refactor: reorder members of zcg generated classes

This commit is contained in:
Jan Laupetin 2025-05-02 15:59:30 +02:00 committed by Jan
parent ed029bc24d
commit 446c38d8ee
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
3 changed files with 101 additions and 89 deletions

View File

@ -47,32 +47,16 @@ namespace
LINE("{") LINE("{")
m_intendation++; m_intendation++;
LINEF("XAssetInfo<{0}>* m_asset_info;", m_env.m_asset->m_definition->GetFullName()) m_intendation--;
if (m_env.m_has_actions) LINE("public:")
{ m_intendation++;
LINEF("Actions_{0} m_actions;", m_env.m_asset->m_definition->m_name) PrintHeaderConstructor();
} PrintHeaderMainLoadMethodDeclaration(m_env.m_asset);
LINE(VariableDecl(m_env.m_asset->m_definition))
LINE(PointerVariableDecl(m_env.m_asset->m_definition))
LINE("")
// Variable Declarations: type varType;
for (const auto* type : m_env.m_used_types)
{
if (type->m_info && !type->m_info->m_definition->m_anonymous && !type->m_info->m_is_leaf && !StructureComputations(type->m_info).IsAsset())
{
LINE(VariableDecl(type->m_type))
}
}
for (const auto* type : m_env.m_used_types)
{
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
{
LINE(PointerVariableDecl(type->m_type))
}
}
LINE("") LINE("")
m_intendation--;
LINE("private:")
m_intendation++;
// Method Declarations // Method Declarations
for (const auto* type : m_env.m_used_types) for (const auto* type : m_env.m_used_types)
@ -100,11 +84,31 @@ namespace
PrintHeaderTempPtrLoadMethodDeclaration(m_env.m_asset); PrintHeaderTempPtrLoadMethodDeclaration(m_env.m_asset);
PrintHeaderAssetLoadMethodDeclaration(m_env.m_asset); PrintHeaderAssetLoadMethodDeclaration(m_env.m_asset);
LINE("") LINE("")
m_intendation--;
LINE("public:") LINEF("XAssetInfo<{0}>* m_asset_info;", m_env.m_asset->m_definition->GetFullName())
m_intendation++; if (m_env.m_has_actions)
PrintHeaderConstructor(); {
PrintHeaderMainLoadMethodDeclaration(m_env.m_asset); LINEF("Actions_{0} m_actions;", m_env.m_asset->m_definition->m_name)
}
LINE(VariableDecl(m_env.m_asset->m_definition))
LINE(PointerVariableDecl(m_env.m_asset->m_definition))
LINE("")
// Variable Declarations: type varType;
for (const auto* type : m_env.m_used_types)
{
if (type->m_info && !type->m_info->m_definition->m_anonymous && !type->m_info->m_is_leaf && !StructureComputations(type->m_info).IsAsset())
{
LINE(VariableDecl(type->m_type))
}
}
for (const auto* type : m_env.m_used_types)
{
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
{
LINE(PointerVariableDecl(type->m_type))
}
}
m_intendation--; m_intendation--;
LINE("};") LINE("};")
@ -142,6 +146,8 @@ namespace
LINEF("using namespace {0};", m_env.m_game) LINEF("using namespace {0};", m_env.m_game)
LINE("") LINE("")
PrintConstructorMethod(); PrintConstructorMethod();
LINE("")
PrintMainLoadMethod();
for (const auto* type : m_env.m_used_types) for (const auto* type : m_env.m_used_types)
{ {
@ -173,8 +179,6 @@ namespace
PrintLoadPtrMethod(m_env.m_asset); PrintLoadPtrMethod(m_env.m_asset);
LINE("") LINE("")
PrintLoadAssetMethod(m_env.m_asset); PrintLoadAssetMethod(m_env.m_asset);
LINE("")
PrintMainLoadMethod();
} }
private: private:

View File

@ -43,32 +43,18 @@ namespace
LINE("{") LINE("{")
m_intendation++; m_intendation++;
LINE(VariableDecl(m_env.m_asset->m_definition))
LINE(PointerVariableDecl(m_env.m_asset->m_definition))
LINE("")
m_intendation--; m_intendation--;
LINE("public:") LINE("public:")
m_intendation++; m_intendation++;
PrintHeaderConstructor();
// Variable Declarations: type varType; PrintHeaderMainMarkMethodDeclaration(m_env.m_asset);
for (const auto* type : m_env.m_used_types) PrintHeaderGetAssetInfoMethodDeclaration(m_env.m_asset);
{
if (type->m_info && !type->m_info->m_definition->m_anonymous && !type->m_info->m_is_leaf && !StructureComputations(type->m_info).IsAsset())
{
LINE(VariableDecl(type->m_type))
}
}
for (const auto* type : m_env.m_used_types)
{
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
{
LINE(PointerVariableDecl(type->m_type))
}
}
LINE("") LINE("")
m_intendation--;
LINE("private:")
m_intendation++;
// Method Declarations // Method Declarations
for (const auto* type : m_env.m_used_types) for (const auto* type : m_env.m_used_types)
{ {
@ -94,11 +80,28 @@ namespace
} }
} }
PrintHeaderMarkMethodDeclaration(m_env.m_asset); PrintHeaderMarkMethodDeclaration(m_env.m_asset);
LINE("") LINE("")
PrintHeaderGetAssetInfoMethodDeclaration(m_env.m_asset);
LINE(VariableDecl(m_env.m_asset->m_definition))
LINE(PointerVariableDecl(m_env.m_asset->m_definition))
LINE("") LINE("")
PrintHeaderConstructor();
PrintHeaderMainMarkMethodDeclaration(m_env.m_asset); // Variable Declarations: type varType;
for (const auto* type : m_env.m_used_types)
{
if (type->m_info && !type->m_info->m_definition->m_anonymous && !type->m_info->m_is_leaf && !StructureComputations(type->m_info).IsAsset())
{
LINE(VariableDecl(type->m_type))
}
}
for (const auto* type : m_env.m_used_types)
{
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
{
LINE(PointerVariableDecl(type->m_type))
}
}
m_intendation--; m_intendation--;
LINE("};") LINE("};")
@ -131,6 +134,10 @@ namespace
LINEF("using namespace {0};", m_env.m_game) LINEF("using namespace {0};", m_env.m_game)
LINE("") LINE("")
PrintConstructorMethod(); PrintConstructorMethod();
LINE("")
PrintMainMarkMethod();
LINE("")
PrintGetAssetInfoMethod();
for (const auto* type : m_env.m_used_types) for (const auto* type : m_env.m_used_types)
{ {
@ -160,10 +167,6 @@ namespace
} }
LINE("") LINE("")
PrintMarkMethod(m_env.m_asset); PrintMarkMethod(m_env.m_asset);
LINE("")
PrintMainMarkMethod();
LINE("")
PrintGetAssetInfoMethod();
} }
private: private:

View File

@ -42,31 +42,16 @@ namespace
LINE("{") LINE("{")
m_intendation++; m_intendation++;
LINE(VariableDecl(m_env.m_asset->m_definition)) m_intendation--;
LINE(WrittenVariableDecl(m_env.m_asset->m_definition)) LINE("public:")
LINE(PointerVariableDecl(m_env.m_asset->m_definition)) m_intendation++;
LINE(WrittenPointerVariableDecl(m_env.m_asset->m_definition)) PrintHeaderConstructor();
LINE("") PrintHeaderMainWriteMethodDeclaration(m_env.m_asset);
// Variable Declarations: type varType;
for (const auto* type : m_env.m_used_types)
{
if (type->m_info && !type->m_info->m_definition->m_anonymous && !type->m_info->m_is_leaf && !StructureComputations(type->m_info).IsAsset())
{
LINE(VariableDecl(type->m_type))
LINE(WrittenVariableDecl(type->m_type))
}
}
for (const auto* type : m_env.m_used_types)
{
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
{
LINE(PointerVariableDecl(type->m_type))
LINE(WrittenPointerVariableDecl(type->m_type))
}
}
LINE("") LINE("")
m_intendation--;
LINE("private:")
m_intendation++;
// Method Declarations // Method Declarations
for (const auto* type : m_env.m_used_types) for (const auto* type : m_env.m_used_types)
@ -92,12 +77,32 @@ namespace
} }
PrintHeaderWriteMethodDeclaration(m_env.m_asset); PrintHeaderWriteMethodDeclaration(m_env.m_asset);
PrintHeaderTempPtrWriteMethodDeclaration(m_env.m_asset); PrintHeaderTempPtrWriteMethodDeclaration(m_env.m_asset);
LINE("") LINE("")
m_intendation--;
LINE("public:") LINE(VariableDecl(m_env.m_asset->m_definition))
m_intendation++; LINE(WrittenVariableDecl(m_env.m_asset->m_definition))
PrintHeaderConstructor(); LINE(PointerVariableDecl(m_env.m_asset->m_definition))
PrintHeaderMainWriteMethodDeclaration(m_env.m_asset); LINE(WrittenPointerVariableDecl(m_env.m_asset->m_definition))
LINE("")
// Variable Declarations: type varType;
for (const auto* type : m_env.m_used_types)
{
if (type->m_info && !type->m_info->m_definition->m_anonymous && !type->m_info->m_is_leaf && !StructureComputations(type->m_info).IsAsset())
{
LINE(VariableDecl(type->m_type))
LINE(WrittenVariableDecl(type->m_type))
}
}
for (const auto* type : m_env.m_used_types)
{
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
{
LINE(PointerVariableDecl(type->m_type))
LINE(WrittenPointerVariableDecl(type->m_type))
}
}
m_intendation--; m_intendation--;
LINE("};") LINE("};")
@ -131,6 +136,8 @@ namespace
LINEF("using namespace {0};", m_env.m_game) LINEF("using namespace {0};", m_env.m_game)
LINE("") LINE("")
PrintConstructorMethod(); PrintConstructorMethod();
LINE("")
PrintMainWriteMethod();
for (const auto* type : m_env.m_used_types) for (const auto* type : m_env.m_used_types)
{ {
@ -160,8 +167,6 @@ namespace
PrintWriteMethod(m_env.m_asset); PrintWriteMethod(m_env.m_asset);
LINE("") LINE("")
PrintWritePtrMethod(m_env.m_asset); PrintWritePtrMethod(m_env.m_asset);
LINE("")
PrintMainWriteMethod();
} }
private: private: