refactor: update zcg generate file headers

This commit is contained in:
Jan 2025-04-30 16:57:36 +01:00
parent 115765ad86
commit 50612d117e
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
3 changed files with 24 additions and 17 deletions

View File

@ -6,7 +6,6 @@
#include "Utils/StringUtils.h" #include "Utils/StringUtils.h"
#include <cassert> #include <cassert>
#include <iostream>
#include <sstream> #include <sstream>
namespace namespace
@ -32,12 +31,13 @@ namespace
LINE("") LINE("")
LINE("#pragma once") LINE("#pragma once")
LINE("") LINE("")
LINE("#include \"Loading/AssetLoader.h\"")
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game) LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
if (m_env.m_has_actions) if (m_env.m_has_actions)
{ {
LINEF("#include \"Game/{0}/XAssets/{1}/{1}_actions.h\"", m_env.m_game, Lower(m_env.m_asset->m_definition->m_name)) LINEF("#include \"Game/{0}/XAssets/{1}/{1}_actions.h\"", m_env.m_game, Lower(m_env.m_asset->m_definition->m_name))
} }
LINE("#include \"Loading/AssetLoader.h\"")
LINE("")
LINE("#include <string>") LINE("#include <string>")
LINE("") LINE("")
LINEF("namespace {0}", m_env.m_game) LINEF("namespace {0}", m_env.m_game)
@ -121,20 +121,24 @@ namespace
LINE("// ====================================================================") LINE("// ====================================================================")
LINE("") LINE("")
LINEF("#include \"{0}_load_db.h\"", Lower(m_env.m_asset->m_definition->m_name)) LINEF("#include \"{0}_load_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
LINEF("#include \"{0}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
LINE("#include <cassert>")
LINE("#include <cstring>")
LINE("") LINE("")
LINEF("#include \"{0}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
if (!m_env.m_referenced_assets.empty()) if (!m_env.m_referenced_assets.empty())
{ {
LINE("")
LINE("// Referenced Assets:") LINE("// Referenced Assets:")
for (const auto* type : m_env.m_referenced_assets) for (const auto* type : m_env.m_referenced_assets)
{ {
LINEF("#include \"../{0}/{0}_load_db.h\"", Lower(type->m_type->m_name)) LINEF("#include \"../{0}/{0}_load_db.h\"", Lower(type->m_type->m_name))
} }
LINE("")
} }
LINE("")
LINE("#include <cassert>")
LINE("#include <cstring>")
LINE("")
LINEF("using namespace {0};", m_env.m_game) LINEF("using namespace {0};", m_env.m_game)
LINE("") LINE("")
PrintConstructorMethod(); PrintConstructorMethod();
@ -362,7 +366,7 @@ namespace
LINE("") LINE("")
LINEF("{0}** var = {1};", def->GetFullName(), MakeTypePtrVarName(def)) LINEF("{0}** var = {1};", def->GetFullName(), MakeTypePtrVarName(def))
LINE("for(size_t index = 0; index < count; index++)") LINE("for (size_t index = 0; index < count; index++)")
LINE("{") LINE("{")
m_intendation++; m_intendation++;
@ -392,7 +396,7 @@ namespace
LINE("") LINE("")
LINEF("{0}* var = {1};", def->GetFullName(), MakeTypeVarName(def)) LINEF("{0}* var = {1};", def->GetFullName(), MakeTypeVarName(def))
LINE("for(size_t index = 0; index < count; index++)") LINE("for (size_t index = 0; index < count; index++)")
LINE("{") LINE("{")
m_intendation++; m_intendation++;

View File

@ -32,8 +32,8 @@ namespace
LINE("") LINE("")
LINE("#pragma once") LINE("#pragma once")
LINE("") LINE("")
LINE("#include \"Loading/AssetMarker.h\"")
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game) LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
LINE("#include \"Loading/AssetMarker.h\"")
LINE("") LINE("")
LINE("#include <string>") LINE("#include <string>")
LINE("") LINE("")
@ -116,19 +116,19 @@ namespace
LINE("// ====================================================================") LINE("// ====================================================================")
LINE("") LINE("")
LINEF("#include \"{0}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name)) LINEF("#include \"{0}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
LINE("")
LINE("#include <cassert>")
LINE("")
if (!m_env.m_referenced_assets.empty()) if (!m_env.m_referenced_assets.empty())
{ {
LINE("")
LINE("// Referenced Assets:") LINE("// Referenced Assets:")
for (const auto* type : m_env.m_referenced_assets) for (const auto* type : m_env.m_referenced_assets)
{ {
LINEF("#include \"../{0}/{0}_mark_db.h\"", Lower(type->m_type->m_name)) LINEF("#include \"../{0}/{0}_mark_db.h\"", Lower(type->m_type->m_name))
} }
LINE("")
} }
LINE("")
LINE("#include <cassert>")
LINE("")
LINEF("using namespace {0};", m_env.m_game) LINEF("using namespace {0};", m_env.m_game)
LINE("") LINE("")
PrintConstructorMethod(); PrintConstructorMethod();

View File

@ -30,8 +30,9 @@ namespace
LINE("") LINE("")
LINE("#pragma once") LINE("#pragma once")
LINE("") LINE("")
LINE("#include \"Writing/AssetWriter.h\"")
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game) LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
LINE("#include \"Writing/AssetWriter.h\"")
LINE("")
LINE("#include <string>") LINE("#include <string>")
LINE("") LINE("")
LINEF("namespace {0}", m_env.m_game) LINEF("namespace {0}", m_env.m_game)
@ -113,18 +114,20 @@ namespace
LINE("// ====================================================================") LINE("// ====================================================================")
LINE("") LINE("")
LINEF("#include \"{0}_write_db.h\"", Lower(m_env.m_asset->m_definition->m_name)) LINEF("#include \"{0}_write_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
LINE("#include <cassert>")
LINE("")
if (!m_env.m_referenced_assets.empty()) if (!m_env.m_referenced_assets.empty())
{ {
LINE("")
LINE("// Referenced Assets:") LINE("// Referenced Assets:")
for (const auto* type : m_env.m_referenced_assets) for (const auto* type : m_env.m_referenced_assets)
{ {
LINEF("#include \"../{0}/{0}_write_db.h\"", Lower(type->m_type->m_name)) LINEF("#include \"../{0}/{0}_write_db.h\"", Lower(type->m_type->m_name))
} }
LINE("")
} }
LINE("")
LINE("#include <cassert>")
LINE("")
LINEF("using namespace {0};", m_env.m_game) LINEF("using namespace {0};", m_env.m_game)
LINE("") LINE("")
PrintConstructorMethod(); PrintConstructorMethod();