Skip to content

Commit

Permalink
[SharpGen] Make sure pack is applied for a struct
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Aug 18, 2015
1 parent 10531ea commit bd051d5
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Source/Tools/SharpGen/Model/CsStruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,18 @@ public CsStruct(CppStruct cppStruct)
IsIn = true;
IsOut = false;
CppElement = cppStruct;
// Align was not overloaded by MappingRule tag, then we can take the default value
if (cppStruct != null && Align == 0)
Align = cppStruct.Align;
}

protected override void UpdateFromTag(MappingRule tag)
{
base.UpdateFromTag(tag);
Align = tag.StructPack != null ? tag.StructPack.Value : Align;
HasMarshalType = tag.StructHasNativeValueType != null ? tag.StructHasNativeValueType.Value : false;
GenerateAsClass = tag.StructToClass != null ? tag.StructToClass.Value : false;
HasCustomMarshal = tag.StructCustomMarshal != null ? tag.StructCustomMarshal.Value : false;
IsStaticMarshal = tag.IsStaticMarshal != null ? tag.IsStaticMarshal.Value : false;
HasCustomNew = tag.StructCustomNew != null ? tag.StructCustomNew.Value : false;
IsOut = tag.StructForceMarshalToToBeGenerated != null ? tag.StructForceMarshalToToBeGenerated.Value : false;
Align = tag.StructPack ?? 0;
HasMarshalType = tag.StructHasNativeValueType ?? false;
GenerateAsClass = tag.StructToClass ?? false;
HasCustomMarshal = tag.StructCustomMarshal ?? false;
IsStaticMarshal = tag.IsStaticMarshal ?? false;
HasCustomNew = tag.StructCustomNew ?? false;
IsOut = tag.StructForceMarshalToToBeGenerated ?? false;

// Force a marshalling if a struct need to be treated as a class)
if (GenerateAsClass)
Expand Down

0 comments on commit bd051d5

Please sign in to comment.