mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-06 16:57:25 +00:00
ZoneCodeGenerator: Remove the const keyword from typename but instead save whether a reference is cosnt in the typedeclaration
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
namespace ZoneCodeGenerator.Domain
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ZoneCodeGenerator.Domain
|
||||
{
|
||||
class DataTypeBaseType : DataType
|
||||
{
|
||||
@@ -6,7 +11,6 @@
|
||||
public static readonly DataTypeBaseType DOUBLE = new DataTypeBaseType("double", 8);
|
||||
public static readonly DataTypeBaseType BOOL = new DataTypeBaseType("bool", 1);
|
||||
public static readonly DataTypeBaseType CHAR = new DataTypeBaseType("char", 1);
|
||||
public static readonly DataTypeBaseType CONST_CHAR = new DataTypeBaseType("const char", 1);
|
||||
public static readonly DataTypeBaseType UNSIGNED_CHAR = new DataTypeBaseType("unsigned char", 1);
|
||||
public static readonly DataTypeBaseType SHORT = new DataTypeBaseType("short", 2);
|
||||
public static readonly DataTypeBaseType UNSIGNED_SHORT = new DataTypeBaseType("unsigned short", 2);
|
||||
@@ -18,23 +22,12 @@
|
||||
public static readonly DataTypeBaseType UNSIGNED_LONG_LONG = new DataTypeBaseType("unsigned long long", 8);
|
||||
public static readonly DataTypeBaseType VOID = new DataTypeBaseType("void", 0);
|
||||
|
||||
public static readonly DataTypeBaseType[] BASE_TYPES = {
|
||||
FLOAT,
|
||||
DOUBLE,
|
||||
BOOL,
|
||||
CHAR,
|
||||
CONST_CHAR,
|
||||
UNSIGNED_CHAR,
|
||||
SHORT,
|
||||
UNSIGNED_SHORT,
|
||||
INT,
|
||||
UNSIGNED_INT,
|
||||
LONG,
|
||||
UNSIGNED_LONG,
|
||||
LONG_LONG,
|
||||
UNSIGNED_LONG_LONG,
|
||||
VOID
|
||||
};
|
||||
public static readonly IEnumerable<DataTypeBaseType> BASE_TYPES = typeof(DataTypeBaseType)
|
||||
.GetFields(BindingFlags.Public | BindingFlags.Static)
|
||||
.Where(info => info.FieldType == typeof(DataTypeBaseType))
|
||||
.Select(info => info.GetValue(null))
|
||||
.Cast<DataTypeBaseType>()
|
||||
.ToList();
|
||||
|
||||
public override int Size { get; }
|
||||
public override int Alignment => Size;
|
||||
|
@@ -9,7 +9,8 @@
|
||||
TypeDefinition = typeDefinitionDeclaration;
|
||||
}
|
||||
|
||||
public override int Alignment => TypeDefinition.Alignment;
|
||||
public int? AlignmentOverride { get; set; }
|
||||
public override int Alignment => AlignmentOverride ?? TypeDefinition.Alignment;
|
||||
public override int Size => TypeDefinition.Size;
|
||||
}
|
||||
}
|
@@ -23,7 +23,9 @@ namespace ZoneCodeGenerator.Domain
|
||||
set => type = value;
|
||||
}
|
||||
|
||||
public int? CustomBitSize { get; }
|
||||
public int? CustomBitSize { get; set; }
|
||||
|
||||
public bool IsConst { get; set; }
|
||||
|
||||
public bool HasCustomBitSize => CustomBitSize != null;
|
||||
|
||||
@@ -61,10 +63,5 @@ namespace ZoneCodeGenerator.Domain
|
||||
this.references = references ?? new List<ReferenceType>();
|
||||
CustomBitSize = null;
|
||||
}
|
||||
|
||||
public TypeDeclaration(DataType type, int customBitSize, List<ReferenceType> references) : this(type, references)
|
||||
{
|
||||
CustomBitSize = customBitSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user