mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-28 08:34:56 +00:00
wip: use std::format for zcg templates
This commit is contained in:
parent
eec641c933
commit
67e655a1f9
@ -56,8 +56,8 @@ namespace
|
|||||||
void CreateFromString(const std::string& templateString)
|
void CreateFromString(const std::string& templateString)
|
||||||
{
|
{
|
||||||
const auto templateStringLength = templateString.size();
|
const auto templateStringLength = templateString.size();
|
||||||
auto partStart = 0u;
|
auto partStart = 0uz;
|
||||||
for (auto i = 0u; i < templateStringLength; i++)
|
for (auto i = 0uz; i < templateStringLength; i++)
|
||||||
{
|
{
|
||||||
if (templateString[i] != '?')
|
if (templateString[i] != '?')
|
||||||
continue;
|
continue;
|
||||||
|
@ -251,7 +251,7 @@ void UnlinkerArgs::AddSpecifiedAssetType(std::string value)
|
|||||||
|
|
||||||
void UnlinkerArgs::ParseCommaSeparatedAssetTypeString(const std::string& input)
|
void UnlinkerArgs::ParseCommaSeparatedAssetTypeString(const std::string& input)
|
||||||
{
|
{
|
||||||
auto currentPos = 0u;
|
auto currentPos = 0uz;
|
||||||
size_t endPos;
|
size_t endPos;
|
||||||
|
|
||||||
std::string lowerInput(input);
|
std::string lowerInput(input);
|
||||||
|
@ -74,7 +74,7 @@ void BaseTemplate::MakeTypeWrittenPtrVarNameInternal(const DataDefinition* def,
|
|||||||
|
|
||||||
void BaseTemplate::MakeArrayIndicesInternal(const DeclarationModifierComputations& modifierComputations, std::ostringstream& str)
|
void BaseTemplate::MakeArrayIndicesInternal(const DeclarationModifierComputations& modifierComputations, std::ostringstream& str)
|
||||||
{
|
{
|
||||||
for (auto index : modifierComputations.GetArrayIndices())
|
for (const auto index : modifierComputations.GetArrayIndices())
|
||||||
{
|
{
|
||||||
str << "[" << index << "]";
|
str << "[" << index << "]";
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ std::string BaseTemplate::MakeSafeTypeName(const DataDefinition* def)
|
|||||||
return str.str();
|
return str.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BaseTemplate::MakeMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier)
|
std::string BaseTemplate::MakeMemberAccess(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
MakeTypeVarNameInternal(info->m_definition, str);
|
MakeTypeVarNameInternal(info->m_definition, str);
|
||||||
@ -125,7 +125,8 @@ std::string BaseTemplate::MakeMemberAccess(StructureInformation* info, MemberInf
|
|||||||
return str.str();
|
return str.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BaseTemplate::MakeWrittenMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier)
|
std::string
|
||||||
|
BaseTemplate::MakeWrittenMemberAccess(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
MakeTypeWrittenVarNameInternal(info->m_definition, str);
|
MakeTypeWrittenVarNameInternal(info->m_definition, str);
|
||||||
@ -137,7 +138,7 @@ std::string BaseTemplate::MakeWrittenMemberAccess(StructureInformation* info, Me
|
|||||||
|
|
||||||
std::string BaseTemplate::MakeMemberAccess(const std::string& variableName,
|
std::string BaseTemplate::MakeMemberAccess(const std::string& variableName,
|
||||||
StructureInformation* info,
|
StructureInformation* info,
|
||||||
MemberInformation* member,
|
const MemberInformation* member,
|
||||||
const DeclarationModifierComputations& modifier)
|
const DeclarationModifierComputations& modifier)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
@ -185,13 +186,13 @@ std::string BaseTemplate::MakeArrayIndices(const DeclarationModifierComputations
|
|||||||
return str.str();
|
return str.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BaseTemplate::MakeCustomActionCall(CustomAction* action)
|
std::string BaseTemplate::MakeCustomActionCall(const CustomAction* action)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
str << "m_actions." << action->m_action_name << "(";
|
str << "m_actions." << action->m_action_name << "(";
|
||||||
|
|
||||||
auto first = true;
|
auto first = true;
|
||||||
for (auto* def : action->m_parameter_types)
|
for (const auto* def : action->m_parameter_types)
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
#include "Domain/Evaluation/Operation.h"
|
#include "Domain/Evaluation/Operation.h"
|
||||||
#include "Generating/RenderingContext.h"
|
#include "Generating/RenderingContext.h"
|
||||||
|
|
||||||
|
#include <format>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
class BaseTemplate
|
class BaseTemplate
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
static constexpr const char* INTENDATION = " ";
|
static constexpr auto INTENDATION = " ";
|
||||||
|
|
||||||
BaseTemplate(std::ostream& stream, RenderingContext* context);
|
BaseTemplate(std::ostream& stream, RenderingContext* context);
|
||||||
|
|
||||||
@ -26,16 +26,17 @@ protected:
|
|||||||
static std::string MakeTypePtrVarName(const DataDefinition* def);
|
static std::string MakeTypePtrVarName(const DataDefinition* def);
|
||||||
static std::string MakeTypeWrittenPtrVarName(const DataDefinition* def);
|
static std::string MakeTypeWrittenPtrVarName(const DataDefinition* def);
|
||||||
static std::string MakeSafeTypeName(const DataDefinition* def);
|
static std::string MakeSafeTypeName(const DataDefinition* def);
|
||||||
static std::string MakeMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier);
|
static std::string MakeMemberAccess(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier);
|
||||||
static std::string MakeWrittenMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier);
|
static std::string
|
||||||
|
MakeWrittenMemberAccess(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier);
|
||||||
static std::string MakeMemberAccess(const std::string& variableName,
|
static std::string MakeMemberAccess(const std::string& variableName,
|
||||||
StructureInformation* info,
|
StructureInformation* info,
|
||||||
MemberInformation* member,
|
const MemberInformation* member,
|
||||||
const DeclarationModifierComputations& modifier);
|
const DeclarationModifierComputations& modifier);
|
||||||
static std::string MakeTypeDecl(const TypeDeclaration* decl);
|
static std::string MakeTypeDecl(const TypeDeclaration* decl);
|
||||||
static std::string MakeFollowingReferences(const std::vector<DeclarationModifier*>& modifiers);
|
static std::string MakeFollowingReferences(const std::vector<DeclarationModifier*>& modifiers);
|
||||||
static std::string MakeArrayIndices(const DeclarationModifierComputations& modifierComputations);
|
static std::string MakeArrayIndices(const DeclarationModifierComputations& modifierComputations);
|
||||||
static std::string MakeCustomActionCall(CustomAction* action);
|
static std::string MakeCustomActionCall(const CustomAction* action);
|
||||||
static std::string MakeArrayCount(const ArrayDeclarationModifier* arrayModifier);
|
static std::string MakeArrayCount(const ArrayDeclarationModifier* arrayModifier);
|
||||||
static std::string MakeEvaluation(const IEvaluation* evaluation);
|
static std::string MakeEvaluation(const IEvaluation* evaluation);
|
||||||
|
|
||||||
@ -61,16 +62,34 @@ private:
|
|||||||
DoIntendation(); \
|
DoIntendation(); \
|
||||||
m_out << x << "\n"; \
|
m_out << x << "\n"; \
|
||||||
}
|
}
|
||||||
|
#define LINEF(...) \
|
||||||
|
{ \
|
||||||
|
DoIntendation(); \
|
||||||
|
m_out << std::format(__VA_ARGS__) << "\n"; \
|
||||||
|
}
|
||||||
#define LINE_START(x) \
|
#define LINE_START(x) \
|
||||||
{ \
|
{ \
|
||||||
DoIntendation(); \
|
DoIntendation(); \
|
||||||
m_out << x; \
|
m_out << x; \
|
||||||
}
|
}
|
||||||
|
#define LINE_STARTF(...) \
|
||||||
|
{ \
|
||||||
|
DoIntendation(); \
|
||||||
|
m_out << std::format(__VA_ARGS__); \
|
||||||
|
}
|
||||||
#define LINE_MIDDLE(x) \
|
#define LINE_MIDDLE(x) \
|
||||||
{ \
|
{ \
|
||||||
m_out << x; \
|
m_out << x; \
|
||||||
}
|
}
|
||||||
|
#define LINE_MIDDLEF(...) \
|
||||||
|
{ \
|
||||||
|
m_out << std::format(__VA_ARGS__); \
|
||||||
|
}
|
||||||
#define LINE_END(x) \
|
#define LINE_END(x) \
|
||||||
{ \
|
{ \
|
||||||
m_out << x << "\n"; \
|
m_out << x << "\n"; \
|
||||||
}
|
}
|
||||||
|
#define LINE_ENDF(...) \
|
||||||
|
{ \
|
||||||
|
m_out << std::format(__VA_ARGS__) << "\n"; \
|
||||||
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -11,8 +11,8 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static constexpr int TAG_HEADER = 1;
|
constexpr int TAG_HEADER = 1;
|
||||||
static constexpr int TAG_SOURCE = 2;
|
constexpr int TAG_SOURCE = 2;
|
||||||
|
|
||||||
class Template final : BaseTemplate
|
class Template final : BaseTemplate
|
||||||
{
|
{
|
||||||
@ -33,13 +33,14 @@ namespace
|
|||||||
LINE("#pragma once")
|
LINE("#pragma once")
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE("#include \"Loading/AssetMarker.h\"")
|
LINE("#include \"Loading/AssetMarker.h\"")
|
||||||
LINE("#include \"Game/" << m_env.m_game << "/" << m_env.m_game << ".h\"")
|
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
|
||||||
|
LINE("")
|
||||||
LINE("#include <string>")
|
LINE("#include <string>")
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE("namespace " << m_env.m_game)
|
LINEF("namespace {0}", m_env.m_game)
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
LINE("class " << MarkerClassName(m_env.m_asset) << " final : public AssetMarker")
|
LINEF("class {0} final : public AssetMarker", MarkerClassName(m_env.m_asset))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -52,14 +53,14 @@ namespace
|
|||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
// Variable Declarations: type varType;
|
// Variable Declarations: type varType;
|
||||||
for (auto* type : m_env.m_used_types)
|
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())
|
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(VariableDecl(type->m_type))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto* type : m_env.m_used_types)
|
for (const auto* type : m_env.m_used_types)
|
||||||
{
|
{
|
||||||
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
|
if (type->m_pointer_array_reference_exists && !type->m_is_context_asset)
|
||||||
{
|
{
|
||||||
@ -70,14 +71,14 @@ namespace
|
|||||||
LINE("")
|
LINE("")
|
||||||
|
|
||||||
// Method Declarations
|
// Method Declarations
|
||||||
for (auto* type : m_env.m_used_types)
|
for (const auto* type : m_env.m_used_types)
|
||||||
{
|
{
|
||||||
if (type->m_pointer_array_reference_exists && type->m_info->m_requires_marking)
|
if (type->m_pointer_array_reference_exists && type->m_info->m_requires_marking)
|
||||||
{
|
{
|
||||||
PrintHeaderPtrArrayMarkMethodDeclaration(type->m_type);
|
PrintHeaderPtrArrayMarkMethodDeclaration(type->m_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto* type : m_env.m_used_types)
|
for (const auto* type : m_env.m_used_types)
|
||||||
{
|
{
|
||||||
if (type->m_array_reference_exists && type->m_info && !type->m_info->m_is_leaf && type->m_info->m_requires_marking
|
if (type->m_array_reference_exists && type->m_info && !type->m_info->m_is_leaf && type->m_info->m_requires_marking
|
||||||
&& type->m_non_runtime_reference_exists)
|
&& type->m_non_runtime_reference_exists)
|
||||||
@ -115,7 +116,8 @@ namespace
|
|||||||
LINE("// Any changes will be discarded when regenerating.")
|
LINE("// Any changes will be discarded when regenerating.")
|
||||||
LINE("// ====================================================================")
|
LINE("// ====================================================================")
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE("#include \"" << Lower(m_env.m_asset->m_definition->m_name) << "_mark_db.h\"")
|
LINEF("#include \"{0}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
|
||||||
|
LINE("")
|
||||||
LINE("#include <cassert>")
|
LINE("#include <cassert>")
|
||||||
LINE("")
|
LINE("")
|
||||||
|
|
||||||
@ -124,11 +126,11 @@ namespace
|
|||||||
LINE("// Referenced Assets:")
|
LINE("// Referenced Assets:")
|
||||||
for (const auto* type : m_env.m_referenced_assets)
|
for (const auto* type : m_env.m_referenced_assets)
|
||||||
{
|
{
|
||||||
LINE("#include \"../" << Lower(type->m_type->m_name) << "/" << Lower(type->m_type->m_name) << "_mark_db.h\"")
|
LINEF("#include \"../{0}/{0}_mark_db.h\"", Lower(type->m_type->m_name))
|
||||||
}
|
}
|
||||||
LINE("")
|
LINE("")
|
||||||
}
|
}
|
||||||
LINE("using namespace " << m_env.m_game << ";")
|
LINEF("using namespace {0};", m_env.m_game)
|
||||||
LINE("")
|
LINE("")
|
||||||
PrintConstructorMethod();
|
PrintConstructorMethod();
|
||||||
|
|
||||||
@ -168,7 +170,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class MemberLoadType
|
enum class MemberLoadType : std::uint8_t
|
||||||
{
|
{
|
||||||
ARRAY_POINTER,
|
ARRAY_POINTER,
|
||||||
DYNAMIC_ARRAY,
|
DYNAMIC_ARRAY,
|
||||||
@ -178,78 +180,72 @@ namespace
|
|||||||
SINGLE_POINTER
|
SINGLE_POINTER
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::string MarkerClassName(StructureInformation* asset)
|
static std::string MarkerClassName(const StructureInformation* asset)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("Marker_{0}", asset->m_definition->m_name);
|
||||||
str << "Marker_" << asset->m_definition->m_name;
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string VariableDecl(const DataDefinition* def)
|
static std::string VariableDecl(const DataDefinition* def)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("{0}* var{1};", def->GetFullName(), MakeSafeTypeName(def));
|
||||||
str << def->GetFullName() << "* var" << MakeSafeTypeName(def) << ";";
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string PointerVariableDecl(const DataDefinition* def)
|
static std::string PointerVariableDecl(const DataDefinition* def)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("{0}** var{1}Ptr;", def->GetFullName(), MakeSafeTypeName(def));
|
||||||
str << def->GetFullName() << "** var" << MakeSafeTypeName(def) << "Ptr;";
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderPtrArrayMarkMethodDeclaration(const DataDefinition* def) const
|
void PrintHeaderPtrArrayMarkMethodDeclaration(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("void MarkPtrArray_" << MakeSafeTypeName(def) << "(size_t count);")
|
LINEF("void MarkPtrArray_{0}(size_t count);", MakeSafeTypeName(def))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderArrayMarkMethodDeclaration(const DataDefinition* def) const
|
void PrintHeaderArrayMarkMethodDeclaration(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("void MarkArray_" << MakeSafeTypeName(def) << "(size_t count);")
|
LINEF("void MarkArray_{0}(size_t count);", MakeSafeTypeName(def))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderMarkMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderMarkMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("void Mark_" << MakeSafeTypeName(info->m_definition) << "();")
|
LINEF("void Mark_{0}();", MakeSafeTypeName(info->m_definition))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderGetAssetInfoMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderGetAssetInfoMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("XAssetInfo<" << info->m_definition->GetFullName() << ">* GetAssetInfo(" << info->m_definition->GetFullName() << "* pAsset) const;")
|
LINEF("XAssetInfo<{0}>* GetAssetInfo({0}* pAsset) const;", info->m_definition->GetFullName())
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderGetNameMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderGetNameMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("static std::string GetAssetName(" << info->m_definition->GetFullName() << "* pAsset);")
|
LINEF("static std::string GetAssetName({0}* pAsset);", info->m_definition->GetFullName())
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderConstructor() const
|
void PrintHeaderConstructor() const
|
||||||
{
|
{
|
||||||
LINE(MarkerClassName(m_env.m_asset) << "(Zone* zone);")
|
LINEF("{0}(Zone* zone);", MarkerClassName(m_env.m_asset))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderMainMarkMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderMainMarkMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("void Mark(" << info->m_definition->GetFullName() << "* pAsset);")
|
LINEF("void Mark({0}* pAsset);", info->m_definition->GetFullName())
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintVariableInitialization(const DataDefinition* def) const
|
void PrintVariableInitialization(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("var" << def->m_name << " = nullptr;")
|
LINEF("var{0} = nullptr;", def->m_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintPointerVariableInitialization(const DataDefinition* def) const
|
void PrintPointerVariableInitialization(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("var" << def->m_name << "Ptr = nullptr;")
|
LINEF("var{0}Ptr = nullptr;", def->m_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintConstructorMethod()
|
void PrintConstructorMethod()
|
||||||
{
|
{
|
||||||
LINE(MarkerClassName(m_env.m_asset) << "::" << MarkerClassName(m_env.m_asset) << "(Zone* zone)")
|
LINEF("{0}::{0}(Zone* zone)", MarkerClassName(m_env.m_asset))
|
||||||
|
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
LINE(": AssetMarker(" << m_env.m_asset->m_asset_enum_entry->m_name << ", zone)")
|
LINEF(": AssetMarker({0}, zone)", m_env.m_asset->m_asset_enum_entry->m_name)
|
||||||
m_intendation--;
|
m_intendation--;
|
||||||
|
|
||||||
LINE("{")
|
LINE("{")
|
||||||
@ -282,20 +278,20 @@ namespace
|
|||||||
{
|
{
|
||||||
if (info && !info->m_is_leaf)
|
if (info && !info->m_is_leaf)
|
||||||
{
|
{
|
||||||
LINE(MakeTypeVarName(info->m_definition) << " = *" << MakeTypePtrVarName(def) << ";")
|
LINEF("{0} = *{1};", MakeTypeVarName(info->m_definition), MakeTypePtrVarName(def))
|
||||||
LINE("Mark_" << MakeSafeTypeName(def) << "();")
|
LINEF("Mark_{0}();", MakeSafeTypeName(def))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintMarkPtrArrayMethod_PointerCheck(const DataDefinition* def, StructureInformation* info, const bool reusable)
|
void PrintMarkPtrArrayMethod_PointerCheck(const DataDefinition* def, StructureInformation* info, const bool reusable)
|
||||||
{
|
{
|
||||||
LINE("if (*" << MakeTypePtrVarName(def) << ")")
|
LINEF("if (*{0})", MakeTypePtrVarName(def))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
if (info && StructureComputations(info).IsAsset())
|
if (info && StructureComputations(info).IsAsset())
|
||||||
{
|
{
|
||||||
LINE("AddDependency(" << MarkerClassName(info) << "(m_zone).GetAssetInfo(*" << MakeTypePtrVarName(def) << "));")
|
LINEF("AddDependency({0}(m_zone).GetAssetInfo(*{1}));", MarkerClassName(info), MakeTypePtrVarName(def))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -308,19 +304,19 @@ namespace
|
|||||||
|
|
||||||
void PrintMarkPtrArrayMethod(const DataDefinition* def, StructureInformation* info, const bool reusable)
|
void PrintMarkPtrArrayMethod(const DataDefinition* def, StructureInformation* info, const bool reusable)
|
||||||
{
|
{
|
||||||
LINE("void " << MarkerClassName(m_env.m_asset) << "::MarkPtrArray_" << MakeSafeTypeName(def) << "(const size_t count)")
|
LINEF("void {0}::MarkPtrArray_{1}(const size_t count)", MarkerClassName(m_env.m_asset), MakeSafeTypeName(def))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
LINE("assert(" << MakeTypePtrVarName(def) << " != nullptr);")
|
LINEF("assert({0} != nullptr);", MakeTypePtrVarName(def))
|
||||||
LINE("")
|
LINE("")
|
||||||
|
|
||||||
LINE(def->GetFullName() << "** var = " << 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++;
|
||||||
|
|
||||||
LINE(MakeTypePtrVarName(def) << " = var;")
|
LINEF("{0} = var;", MakeTypePtrVarName(def))
|
||||||
PrintMarkPtrArrayMethod_PointerCheck(def, info, reusable);
|
PrintMarkPtrArrayMethod_PointerCheck(def, info, reusable);
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE("var++;")
|
LINE("var++;")
|
||||||
@ -333,20 +329,20 @@ namespace
|
|||||||
|
|
||||||
void PrintMarkArrayMethod(const DataDefinition* def, const StructureInformation* info)
|
void PrintMarkArrayMethod(const DataDefinition* def, const StructureInformation* info)
|
||||||
{
|
{
|
||||||
LINE("void " << MarkerClassName(m_env.m_asset) << "::MarkArray_" << MakeSafeTypeName(def) << "(const size_t count)")
|
LINEF("void {0}::MarkArray_{1}(const size_t count)", MarkerClassName(m_env.m_asset), MakeSafeTypeName(def))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
LINE("assert(" << MakeTypeVarName(def) << " != nullptr);")
|
LINEF("assert({0} != nullptr);", MakeTypeVarName(def))
|
||||||
LINE("")
|
LINE("")
|
||||||
|
|
||||||
LINE(def->GetFullName() << "* var = " << 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++;
|
||||||
|
|
||||||
LINE(MakeTypeVarName(info->m_definition) << " = var;")
|
LINEF("{0} = var;", MakeTypeVarName(info->m_definition))
|
||||||
LINE("Mark_" << info->m_definition->m_name << "();")
|
LINEF("Mark_{0}();", info->m_definition->m_name)
|
||||||
LINE("var++;")
|
LINE("var++;")
|
||||||
|
|
||||||
m_intendation--;
|
m_intendation--;
|
||||||
@ -356,34 +352,34 @@ namespace
|
|||||||
LINE("}")
|
LINE("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_ScriptString(StructureInformation* info,
|
void MarkMember_ScriptString(const StructureInformation* info,
|
||||||
MemberInformation* member,
|
const MemberInformation* member,
|
||||||
const DeclarationModifierComputations& modifier,
|
const DeclarationModifierComputations& modifier,
|
||||||
const MemberLoadType loadType) const
|
const MemberLoadType loadType) const
|
||||||
{
|
{
|
||||||
if (loadType == MemberLoadType::ARRAY_POINTER)
|
if (loadType == MemberLoadType::ARRAY_POINTER)
|
||||||
{
|
{
|
||||||
LINE("MarkArray_ScriptString(" << MakeMemberAccess(info, member, modifier) << ", " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation())
|
LINEF("MarkArray_ScriptString({0}, {1});", MakeMemberAccess(info, member, modifier), MakeEvaluation(modifier.GetArrayPointerCountEvaluation()))
|
||||||
<< ");")
|
|
||||||
}
|
}
|
||||||
else if (loadType == MemberLoadType::EMBEDDED_ARRAY)
|
else if (loadType == MemberLoadType::EMBEDDED_ARRAY)
|
||||||
{
|
{
|
||||||
LINE("MarkArray_ScriptString(" << MakeMemberAccess(info, member, modifier) << ", "
|
LINEF("MarkArray_ScriptString({0}, {1});",
|
||||||
<< MakeArrayCount(dynamic_cast<ArrayDeclarationModifier*>(modifier.GetDeclarationModifier())) << ");")
|
MakeMemberAccess(info, member, modifier),
|
||||||
|
MakeArrayCount(dynamic_cast<ArrayDeclarationModifier*>(modifier.GetDeclarationModifier())))
|
||||||
}
|
}
|
||||||
else if (loadType == MemberLoadType::EMBEDDED)
|
else if (loadType == MemberLoadType::EMBEDDED)
|
||||||
{
|
{
|
||||||
LINE("Mark_ScriptString(" << MakeMemberAccess(info, member, modifier) << ");")
|
LINEF("Mark_ScriptString({0});", MakeMemberAccess(info, member, modifier))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
LINE("#error unsupported loadType " << static_cast<int>(loadType) << " for scriptstring")
|
LINEF("#error unsupported loadType {0} for script string", static_cast<int>(loadType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_AssetRef(StructureInformation* info,
|
void MarkMember_AssetRef(const StructureInformation* info,
|
||||||
MemberInformation* member,
|
const MemberInformation* member,
|
||||||
const DeclarationModifierComputations& modifier,
|
const DeclarationModifierComputations& modifier,
|
||||||
const MemberLoadType loadType) const
|
const MemberLoadType loadType) const
|
||||||
{
|
{
|
||||||
@ -391,34 +387,38 @@ namespace
|
|||||||
{
|
{
|
||||||
if (modifier.IsArray())
|
if (modifier.IsArray())
|
||||||
{
|
{
|
||||||
LINE("MarkArray_IndirectAssetRef(" << member->m_asset_ref->m_name << ", " << MakeMemberAccess(info, member, modifier) << ", "
|
LINEF("MarkArray_IndirectAssetRef({0}, {1}, {2});",
|
||||||
<< modifier.GetArraySize() << ");")
|
member->m_asset_ref->m_name,
|
||||||
|
MakeMemberAccess(info, member, modifier),
|
||||||
|
modifier.GetArraySize())
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LINE("MarkArray_IndirectAssetRef(" << member->m_asset_ref->m_name << ", " << MakeMemberAccess(info, member, modifier) << ", "
|
LINEF("MarkArray_IndirectAssetRef({0}, {1}, {2});",
|
||||||
<< MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");")
|
member->m_asset_ref->m_name,
|
||||||
|
MakeMemberAccess(info, member, modifier),
|
||||||
|
MakeEvaluation(modifier.GetPointerArrayCountEvaluation()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (loadType == MemberLoadType::SINGLE_POINTER)
|
else if (loadType == MemberLoadType::SINGLE_POINTER)
|
||||||
{
|
{
|
||||||
LINE("Mark_IndirectAssetRef(" << member->m_asset_ref->m_name << ", " << MakeMemberAccess(info, member, modifier) << ");")
|
LINEF("Mark_IndirectAssetRef({0}, {1});", member->m_asset_ref->m_name, MakeMemberAccess(info, member, modifier))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
LINE("#error unsupported loadType " << static_cast<int>(loadType) << " for scriptstring")
|
LINEF("#error unsupported loadType {0} for script string", static_cast<int>(loadType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_Asset(StructureInformation* info,
|
void MarkMember_Asset(const StructureInformation* info,
|
||||||
MemberInformation* member,
|
const MemberInformation* member,
|
||||||
const DeclarationModifierComputations& modifier,
|
const DeclarationModifierComputations& modifier,
|
||||||
const MemberLoadType loadType) const
|
const MemberLoadType loadType) const
|
||||||
{
|
{
|
||||||
if (loadType == MemberLoadType::SINGLE_POINTER)
|
if (loadType == MemberLoadType::SINGLE_POINTER)
|
||||||
{
|
{
|
||||||
LINE("AddDependency(" << MarkerClassName(member->m_type) << "(m_zone).GetAssetInfo(" << MakeMemberAccess(info, member, modifier) << "));")
|
LINEF("AddDependency({0}(m_zone).GetAssetInfo({1}));", MarkerClassName(member->m_type), MakeMemberAccess(info, member, modifier))
|
||||||
}
|
}
|
||||||
else if (loadType == MemberLoadType::POINTER_ARRAY)
|
else if (loadType == MemberLoadType::POINTER_ARRAY)
|
||||||
{
|
{
|
||||||
@ -427,34 +427,35 @@ namespace
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
LINE("#error unsupported loadType " << static_cast<int>(loadType) << " for asset")
|
LINEF("#error unsupported loadType {0} for asset", static_cast<int>(loadType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_ArrayPointer(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
void MarkMember_ArrayPointer(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
||||||
{
|
{
|
||||||
LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";")
|
LINEF("{0} = {1};", MakeTypeVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||||
LINE("MarkArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "("
|
LINEF("MarkArray_{0}({1});",
|
||||||
<< MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");")
|
MakeSafeTypeName(member->m_member->m_type_declaration->m_type),
|
||||||
|
MakeEvaluation(modifier.GetArrayPointerCountEvaluation()))
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_PointerArray(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
void MarkMember_PointerArray(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
||||||
{
|
{
|
||||||
LINE(MakeTypePtrVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";")
|
LINEF("{0} = {1};", MakeTypePtrVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||||
if (modifier.IsArray())
|
if (modifier.IsArray())
|
||||||
{
|
{
|
||||||
LINE("MarkPtrArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(" << modifier.GetArraySize() << ");")
|
LINEF("MarkPtrArray_{0}({1});", MakeSafeTypeName(member->m_member->m_type_declaration->m_type), modifier.GetArraySize())
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LINE("MarkPtrArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "("
|
LINEF("MarkPtrArray_{0}({1});",
|
||||||
<< MakeEvaluation(modifier.GetPointerArrayCountEvaluation()) << ");")
|
MakeSafeTypeName(member->m_member->m_type_declaration->m_type),
|
||||||
|
MakeEvaluation(modifier.GetPointerArrayCountEvaluation()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_EmbeddedArray(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
void MarkMember_EmbeddedArray(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
||||||
{
|
{
|
||||||
const MemberComputations computations(member);
|
|
||||||
std::string arraySizeStr;
|
std::string arraySizeStr;
|
||||||
|
|
||||||
if (modifier.HasDynamicArrayCount())
|
if (modifier.HasDynamicArrayCount())
|
||||||
@ -462,31 +463,31 @@ namespace
|
|||||||
else
|
else
|
||||||
arraySizeStr = std::to_string(modifier.GetArraySize());
|
arraySizeStr = std::to_string(modifier.GetArraySize());
|
||||||
|
|
||||||
LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";")
|
LINEF("{0} = {1};", MakeTypeVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||||
LINE("MarkArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "(" << arraySizeStr << ");")
|
LINEF("MarkArray_{0}({1});", MakeSafeTypeName(member->m_member->m_type_declaration->m_type), arraySizeStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_DynamicArray(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
void MarkMember_DynamicArray(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
||||||
{
|
{
|
||||||
LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";")
|
LINEF("{0} = {1};", MakeTypeVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||||
LINE("MarkArray_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "("
|
LINEF(
|
||||||
<< MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()) << ");")
|
"MarkArray_{0}({1});", MakeSafeTypeName(member->m_member->m_type_declaration->m_type), MakeEvaluation(modifier.GetDynamicArraySizeEvaluation()))
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_Embedded(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
void MarkMember_Embedded(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
||||||
{
|
{
|
||||||
LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = &" << MakeMemberAccess(info, member, modifier) << ";")
|
LINEF("{0} = &{1};", MakeTypeVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||||
LINE("Mark_" << MakeSafeTypeName(member->m_member->m_type_declaration->m_type) << "();")
|
LINEF("Mark_{0}();", MakeSafeTypeName(member->m_member->m_type_declaration->m_type))
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_SinglePointer(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
void MarkMember_SinglePointer(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
||||||
{
|
{
|
||||||
LINE(MakeTypeVarName(member->m_member->m_type_declaration->m_type) << " = " << MakeMemberAccess(info, member, modifier) << ";")
|
LINEF("{0} = {1};", MakeTypeVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||||
LINE("Mark_" << MakeSafeTypeName(member->m_type->m_definition) << "();")
|
LINEF("Mark_{0}();", MakeSafeTypeName(member->m_type->m_definition))
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_TypeCheck(StructureInformation* info,
|
void MarkMember_TypeCheck(const StructureInformation* info,
|
||||||
MemberInformation* member,
|
const MemberInformation* member,
|
||||||
const DeclarationModifierComputations& modifier,
|
const DeclarationModifierComputations& modifier,
|
||||||
const MemberLoadType loadType) const
|
const MemberLoadType loadType) const
|
||||||
{
|
{
|
||||||
@ -531,16 +532,13 @@ namespace
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LINE("// t=" << static_cast<int>(loadType))
|
LINEF("// t={0}", static_cast<int>(loadType))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool MarkMember_ShouldMakePointerCheck(StructureInformation* info,
|
static bool MarkMember_ShouldMakePointerCheck(const MemberInformation* member, const DeclarationModifierComputations& modifier, MemberLoadType loadType)
|
||||||
MemberInformation* member,
|
|
||||||
const DeclarationModifierComputations& modifier,
|
|
||||||
MemberLoadType loadType)
|
|
||||||
{
|
{
|
||||||
if (loadType != MemberLoadType::ARRAY_POINTER && loadType != MemberLoadType::POINTER_ARRAY && loadType != MemberLoadType::SINGLE_POINTER)
|
if (loadType != MemberLoadType::ARRAY_POINTER && loadType != MemberLoadType::POINTER_ARRAY && loadType != MemberLoadType::SINGLE_POINTER)
|
||||||
{
|
{
|
||||||
@ -560,14 +558,14 @@ namespace
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_PointerCheck(StructureInformation* info,
|
void MarkMember_PointerCheck(const StructureInformation* info,
|
||||||
MemberInformation* member,
|
const MemberInformation* member,
|
||||||
const DeclarationModifierComputations& modifier,
|
const DeclarationModifierComputations& modifier,
|
||||||
const MemberLoadType loadType)
|
const MemberLoadType loadType)
|
||||||
{
|
{
|
||||||
if (MarkMember_ShouldMakePointerCheck(info, member, modifier, loadType))
|
if (MarkMember_ShouldMakePointerCheck(member, modifier, loadType))
|
||||||
{
|
{
|
||||||
LINE("if (" << MakeMemberAccess(info, member, modifier) << ")")
|
LINEF("if ({0})", MakeMemberAccess(info, member, modifier))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -582,7 +580,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_ReferenceArray(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier)
|
void MarkMember_ReferenceArray(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier)
|
||||||
{
|
{
|
||||||
auto first = true;
|
auto first = true;
|
||||||
for (const auto& entry : modifier.GetArrayEntries())
|
for (const auto& entry : modifier.GetArrayEntries())
|
||||||
@ -600,7 +598,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_Reference(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier)
|
void MarkMember_Reference(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier)
|
||||||
{
|
{
|
||||||
if (modifier.IsDynamicArray())
|
if (modifier.IsDynamicArray())
|
||||||
{
|
{
|
||||||
@ -633,16 +631,16 @@ namespace
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
LINE("#error MarkMemberReference failed @ " << member->m_member->m_name)
|
LINEF("#error MarkMemberReference failed @ {0}", member->m_member->m_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_Condition_Struct(StructureInformation* info, MemberInformation* member)
|
void MarkMember_Condition_Struct(const StructureInformation* info, const MemberInformation* member)
|
||||||
{
|
{
|
||||||
LINE("")
|
LINE("")
|
||||||
if (member->m_condition)
|
if (member->m_condition)
|
||||||
{
|
{
|
||||||
LINE("if (" << MakeEvaluation(member->m_condition.get()) << ")")
|
LINEF("if ({0})", MakeEvaluation(member->m_condition.get()))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -657,7 +655,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkMember_Condition_Union(StructureInformation* info, MemberInformation* member)
|
void MarkMember_Condition_Union(const StructureInformation* info, const MemberInformation* member)
|
||||||
{
|
{
|
||||||
const MemberComputations computations(member);
|
const MemberComputations computations(member);
|
||||||
|
|
||||||
@ -666,7 +664,7 @@ namespace
|
|||||||
LINE("")
|
LINE("")
|
||||||
if (member->m_condition)
|
if (member->m_condition)
|
||||||
{
|
{
|
||||||
LINE("if (" << MakeEvaluation(member->m_condition.get()) << ")")
|
LINEF("if ({0})", MakeEvaluation(member->m_condition.get()))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -684,7 +682,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (member->m_condition)
|
if (member->m_condition)
|
||||||
{
|
{
|
||||||
LINE("else if (" << MakeEvaluation(member->m_condition.get()) << ")")
|
LINEF("else if ({0})", MakeEvaluation(member->m_condition.get()))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -709,7 +707,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (member->m_condition)
|
if (member->m_condition)
|
||||||
{
|
{
|
||||||
LINE("else if (" << MakeEvaluation(member->m_condition.get()) << ")")
|
LINEF("else if ({0})", MakeEvaluation(member->m_condition.get()))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -720,12 +718,12 @@ namespace
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LINE("#error Middle member of union must have condition (" << member->m_member->m_name << ")")
|
LINEF("#error Middle member of union must have condition ({0})", member->m_member->m_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintMarkMemberIfNeedsTreatment(StructureInformation* info, MemberInformation* member)
|
void PrintMarkMemberIfNeedsTreatment(const StructureInformation* info, const MemberInformation* member)
|
||||||
{
|
{
|
||||||
const MemberComputations computations(member);
|
const MemberComputations computations(member);
|
||||||
if (computations.ShouldIgnore() || computations.IsInRuntimeBlock())
|
if (computations.ShouldIgnore() || computations.IsInRuntimeBlock())
|
||||||
@ -741,14 +739,13 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintMarkMethod(StructureInformation* info)
|
void PrintMarkMethod(const StructureInformation* info)
|
||||||
{
|
{
|
||||||
const StructureComputations computations(info);
|
LINEF("void {0}::Mark_{1}()", MarkerClassName(m_env.m_asset), info->m_definition->m_name)
|
||||||
LINE("void " << MarkerClassName(m_env.m_asset) << "::Mark_" << info->m_definition->m_name << "()")
|
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
LINE("assert(" << MakeTypeVarName(info->m_definition) << " != nullptr);")
|
LINEF("assert({0} != nullptr);", MakeTypeVarName(info->m_definition))
|
||||||
|
|
||||||
for (const auto& member : info->m_ordered_members)
|
for (const auto& member : info->m_ordered_members)
|
||||||
{
|
{
|
||||||
@ -761,7 +758,7 @@ namespace
|
|||||||
|
|
||||||
void PrintGetNameMethod()
|
void PrintGetNameMethod()
|
||||||
{
|
{
|
||||||
LINE("std::string " << MarkerClassName(m_env.m_asset) << "::GetAssetName(" << m_env.m_asset->m_definition->GetFullName() << "* pAsset)")
|
LINEF("std::string {0}::GetAssetName({1}* pAsset)", MarkerClassName(m_env.m_asset), m_env.m_asset->m_definition->GetFullName())
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -775,18 +772,18 @@ namespace
|
|||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
first = false;
|
first = false;
|
||||||
LINE_MIDDLE("->" << member->m_member->m_name)
|
LINE_MIDDLEF("->{0}", member->m_member->m_name)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LINE_MIDDLE("." << member->m_member->m_name)
|
LINE_MIDDLEF(".{0}", member->m_member->m_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LINE_END(";")
|
LINE_END(";")
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LINE("return \"" << m_env.m_asset->m_definition->m_name << "\";")
|
LINEF("return \"{0}\";", m_env.m_asset->m_definition->m_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_intendation--;
|
m_intendation--;
|
||||||
@ -795,12 +792,11 @@ namespace
|
|||||||
|
|
||||||
void PrintGetAssetInfoMethod()
|
void PrintGetAssetInfoMethod()
|
||||||
{
|
{
|
||||||
LINE("XAssetInfo<" << m_env.m_asset->m_definition->GetFullName() << ">* " << MarkerClassName(m_env.m_asset) << "::GetAssetInfo("
|
LINEF("XAssetInfo<{0}>* {1}::GetAssetInfo({0}* pAsset) const", m_env.m_asset->m_definition->GetFullName(), MarkerClassName(m_env.m_asset))
|
||||||
<< m_env.m_asset->m_definition->GetFullName() << "* pAsset) const")
|
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
LINE("return reinterpret_cast<XAssetInfo<" << m_env.m_asset->m_definition->GetFullName() << ">*>(GetAssetInfoByName(GetAssetName(pAsset)));")
|
LINEF("return reinterpret_cast<XAssetInfo<{0}>*>(GetAssetInfoByName(GetAssetName(pAsset)));", m_env.m_asset->m_definition->GetFullName())
|
||||||
|
|
||||||
m_intendation--;
|
m_intendation--;
|
||||||
LINE("}")
|
LINE("}")
|
||||||
@ -808,14 +804,14 @@ namespace
|
|||||||
|
|
||||||
void PrintMainMarkMethod()
|
void PrintMainMarkMethod()
|
||||||
{
|
{
|
||||||
LINE("void " << MarkerClassName(m_env.m_asset) << "::Mark(" << m_env.m_asset->m_definition->GetFullName() << "* pAsset)")
|
LINEF("void {0}::Mark({1}* pAsset)", MarkerClassName(m_env.m_asset), m_env.m_asset->m_definition->GetFullName())
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
LINE("assert(pAsset != nullptr);")
|
LINE("assert(pAsset != nullptr);")
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE(MakeTypeVarName(m_env.m_asset->m_definition) << " = pAsset;")
|
LINEF("{0} = pAsset;", MakeTypeVarName(m_env.m_asset->m_definition))
|
||||||
LINE("Mark_" << MakeSafeTypeName(m_env.m_asset->m_definition) << "();")
|
LINEF("Mark_{0}();", MakeSafeTypeName(m_env.m_asset->m_definition))
|
||||||
|
|
||||||
m_intendation--;
|
m_intendation--;
|
||||||
LINE("}")
|
LINE("}")
|
||||||
@ -830,17 +826,8 @@ std::vector<CodeTemplateFile> ZoneMarkTemplate::GetFilesToRender(RenderingContex
|
|||||||
auto assetName = context->m_asset->m_definition->m_name;
|
auto assetName = context->m_asset->m_definition->m_name;
|
||||||
utils::MakeStringLowerCase(assetName);
|
utils::MakeStringLowerCase(assetName);
|
||||||
|
|
||||||
{
|
files.emplace_back(std::format("{0}/{0}_mark_db.h", assetName), TAG_HEADER);
|
||||||
std::ostringstream str;
|
files.emplace_back(std::format("{0}/{0}_mark_db.cpp", assetName), TAG_SOURCE);
|
||||||
str << assetName << '/' << assetName << "_mark_db.h";
|
|
||||||
files.emplace_back(str.str(), TAG_HEADER);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::ostringstream str;
|
|
||||||
str << assetName << '/' << assetName << "_mark_db.cpp";
|
|
||||||
files.emplace_back(str.str(), TAG_SOURCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static constexpr int TAG_HEADER = 1;
|
constexpr int TAG_HEADER = 1;
|
||||||
static constexpr int TAG_SOURCE = 2;
|
constexpr int TAG_SOURCE = 2;
|
||||||
|
|
||||||
class Template final : BaseTemplate
|
class Template final : BaseTemplate
|
||||||
{
|
{
|
||||||
@ -32,13 +32,13 @@ namespace
|
|||||||
LINE("#pragma once")
|
LINE("#pragma once")
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE("#include \"Writing/AssetWriter.h\"")
|
LINE("#include \"Writing/AssetWriter.h\"")
|
||||||
LINE("#include \"Game/" << m_env.m_game << "/" << m_env.m_game << ".h\"")
|
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
|
||||||
LINE("#include <string>")
|
LINE("#include <string>")
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE("namespace " << m_env.m_game)
|
LINEF("namespace {0}", m_env.m_game)
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
LINE("class " << WriterClassName(m_env.m_asset) << " final : public AssetWriter")
|
LINEF("class {0} final : public AssetWriter", WriterClassName(m_env.m_asset))
|
||||||
LINE("{")
|
LINE("{")
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ namespace
|
|||||||
LINE("// Any changes will be discarded when regenerating.")
|
LINE("// Any changes will be discarded when regenerating.")
|
||||||
LINE("// ====================================================================")
|
LINE("// ====================================================================")
|
||||||
LINE("")
|
LINE("")
|
||||||
LINE("#include \"" << Lower(m_env.m_asset->m_definition->m_name) << "_write_db.h\"")
|
LINEF("#include \"{0}_write_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
|
||||||
LINE("#include <cassert>")
|
LINE("#include <cassert>")
|
||||||
LINE("")
|
LINE("")
|
||||||
|
|
||||||
@ -123,11 +123,11 @@ namespace
|
|||||||
LINE("// Referenced Assets:")
|
LINE("// Referenced Assets:")
|
||||||
for (auto* type : m_env.m_referenced_assets)
|
for (auto* type : m_env.m_referenced_assets)
|
||||||
{
|
{
|
||||||
LINE("#include \"../" << Lower(type->m_type->m_name) << "/" << Lower(type->m_type->m_name) << "_write_db.h\"")
|
LINEF("#include \"../{0}/{0}_write_db.h\"", Lower(type->m_type->m_name))
|
||||||
}
|
}
|
||||||
LINE("")
|
LINE("")
|
||||||
}
|
}
|
||||||
LINE("using namespace " << m_env.m_game << ";")
|
LINEF("using namespace {0};", m_env.m_game)
|
||||||
LINE("")
|
LINE("")
|
||||||
PrintConstructorMethod();
|
PrintConstructorMethod();
|
||||||
|
|
||||||
@ -178,104 +178,91 @@ namespace
|
|||||||
|
|
||||||
static std::string WriterClassName(StructureInformation* asset)
|
static std::string WriterClassName(StructureInformation* asset)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("Writer_{0}", asset->m_definition->m_name);
|
||||||
str << "Writer_" << asset->m_definition->m_name;
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string VariableDecl(const DataDefinition* def)
|
static std::string VariableDecl(const DataDefinition* def)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("{0}* var{1};", def->GetFullName(), MakeSafeTypeName(def));
|
||||||
str << def->GetFullName() << "* var" << MakeSafeTypeName(def) << ";";
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string WrittenVariableDecl(const DataDefinition* def)
|
static std::string WrittenVariableDecl(const DataDefinition* def)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("{0}* var{1}Written;", def->GetFullName(), MakeSafeTypeName(def));
|
||||||
str << def->GetFullName() << "* var" << MakeSafeTypeName(def) << "Written;";
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string PointerVariableDecl(const DataDefinition* def)
|
static std::string PointerVariableDecl(const DataDefinition* def)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("{0}** var{1}Ptr;", def->GetFullName(), MakeSafeTypeName(def));
|
||||||
str << def->GetFullName() << "** var" << MakeSafeTypeName(def) << "Ptr;";
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string WrittenPointerVariableDecl(const DataDefinition* def)
|
static std::string WrittenPointerVariableDecl(const DataDefinition* def)
|
||||||
{
|
{
|
||||||
std::ostringstream str;
|
return std::format("{0}** var{1}PtrWritten;", def->GetFullName(), MakeSafeTypeName(def));
|
||||||
str << def->GetFullName() << "** var" << MakeSafeTypeName(def) << "PtrWritten;";
|
|
||||||
return str.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderPtrArrayWriteMethodDeclaration(const DataDefinition* def) const
|
void PrintHeaderPtrArrayWriteMethodDeclaration(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("void WritePtrArray_" << MakeSafeTypeName(def) << "(bool atStreamStart, size_t count);")
|
LINEF("void WritePtrArray_{0}(bool atStreamStart, size_t count);", MakeSafeTypeName(def))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderArrayWriteMethodDeclaration(const DataDefinition* def) const
|
void PrintHeaderArrayWriteMethodDeclaration(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("void WriteArray_" << MakeSafeTypeName(def) << "(bool atStreamStart, size_t count);")
|
LINEF("void WriteArray_{0}(bool atStreamStart, size_t count);", MakeSafeTypeName(def))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderWriteMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderWriteMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("void Write_" << MakeSafeTypeName(info->m_definition) << "(bool atStreamStart);")
|
LINEF("void Write_{0}(bool atStreamStart);", MakeSafeTypeName(info->m_definition))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderTempPtrWriteMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderTempPtrWriteMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("void WritePtr_" << MakeSafeTypeName(info->m_definition) << "(bool atStreamStart);")
|
LINEF("void WritePtr_{0}(bool atStreamStart);", MakeSafeTypeName(info->m_definition))
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderGetNameMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderGetNameMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("static std::string GetAssetName(" << info->m_definition->GetFullName() << "* pAsset);")
|
LINEF("static std::string GetAssetName({0}* pAsset);", info->m_definition->GetFullName())
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderMainWriteMethodDeclaration(const StructureInformation* info) const
|
void PrintHeaderMainWriteMethodDeclaration(const StructureInformation* info) const
|
||||||
{
|
{
|
||||||
LINE("void Write(" << info->m_definition->GetFullName() << "** pAsset);")
|
LINEF("void Write({0}** pAsset);", info->m_definition->GetFullName())
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintHeaderConstructor() const
|
void PrintHeaderConstructor() const
|
||||||
{
|
{
|
||||||
LINE(WriterClassName(m_env.m_asset) << "(" << m_env.m_asset->m_definition->GetFullName()
|
LINEF("{0}({1}* asset, const Zone& zone, IZoneOutputStream& stream);", WriterClassName(m_env.m_asset), m_env.m_asset->m_definition->GetFullName())
|
||||||
<< "* asset, const Zone& zone, IZoneOutputStream& stream);")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintVariableInitialization(const DataDefinition* def) const
|
void PrintVariableInitialization(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("var" << def->m_name << " = nullptr;")
|
LINEF("var{0} = nullptr;", def->m_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintWrittenVariableInitialization(const DataDefinition* def) const
|
void PrintWrittenVariableInitialization(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("var" << def->m_name << "Written = nullptr;")
|
LINEF("var{0}Written = nullptr;", def->m_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintPointerVariableInitialization(const DataDefinition* def) const
|
void PrintPointerVariableInitialization(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("var" << def->m_name << "Ptr = nullptr;")
|
LINEF("var{0}Ptr = nullptr;", def->m_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintWrittenPointerVariableInitialization(const DataDefinition* def) const
|
void PrintWrittenPointerVariableInitialization(const DataDefinition* def) const
|
||||||
{
|
{
|
||||||
LINE("var" << def->m_name << "PtrWritten = nullptr;")
|
LINEF("var{0}PtrWritten = nullptr;", def->m_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintConstructorMethod()
|
void PrintConstructorMethod()
|
||||||
{
|
{
|
||||||
LINE(WriterClassName(m_env.m_asset) << "::" << WriterClassName(m_env.m_asset) << "(" << m_env.m_asset->m_definition->GetFullName()
|
LINEF(
|
||||||
<< "* asset, const Zone& zone, IZoneOutputStream& stream)")
|
"{0}::{0}({1}* asset, const Zone& zone, IZoneOutputStream& stream)", WriterClassName(m_env.m_asset), m_env.m_asset->m_definition->GetFullName())
|
||||||
|
|
||||||
m_intendation++;
|
m_intendation++;
|
||||||
LINE_START(": AssetWriter(zone.m_pools->GetAssetOrAssetReference(" << m_env.m_asset->m_asset_enum_entry->m_name << ", GetAssetName(asset))"
|
LINEF(": AssetWriter(zone.m_pools->GetAssetOrAssetReference({0}, GetAssetName(asset)), zone, stream)", m_env.m_asset->m_asset_enum_entry->m_name)
|
||||||
<< ", zone, stream)")
|
|
||||||
LINE_END("")
|
|
||||||
m_intendation--;
|
m_intendation--;
|
||||||
|
|
||||||
LINE("{")
|
LINE("{")
|
||||||
@ -315,23 +302,23 @@ namespace
|
|||||||
{
|
{
|
||||||
if (writeType == MemberWriteType::ARRAY_POINTER)
|
if (writeType == MemberWriteType::ARRAY_POINTER)
|
||||||
{
|
{
|
||||||
LINE("varScriptString = " << MakeMemberAccess(info, member, modifier) << ";")
|
LINEF("varScriptString = {0};", MakeMemberAccess(info, member, modifier))
|
||||||
LINE("m_stream->MarkFollowing(" << MakeWrittenMemberAccess(info, member, modifier) << ");")
|
LINEF("m_stream->MarkFollowing({0});", MakeWrittenMemberAccess(info, member, modifier))
|
||||||
LINE("WriteScriptStringArray(true, " << MakeEvaluation(modifier.GetArrayPointerCountEvaluation()) << ");")
|
LINEF("WriteScriptStringArray(true, {0});", MakeEvaluation(modifier.GetArrayPointerCountEvaluation()))
|
||||||
}
|
}
|
||||||
else if (writeType == MemberWriteType::EMBEDDED_ARRAY)
|
else if (writeType == MemberWriteType::EMBEDDED_ARRAY)
|
||||||
{
|
{
|
||||||
LINE("varScriptStringWritten = " << MakeWrittenMemberAccess(info, member, modifier) << ";")
|
LINEF("varScriptStringWritten = {0};", MakeWrittenMemberAccess(info, member, modifier))
|
||||||
LINE("WriteScriptStringArray(false, " << MakeArrayCount(dynamic_cast<ArrayDeclarationModifier*>(modifier.GetDeclarationModifier())) << ");")
|
LINEF("WriteScriptStringArray(false, {0});", MakeArrayCount(dynamic_cast<ArrayDeclarationModifier*>(modifier.GetDeclarationModifier())))
|
||||||
}
|
}
|
||||||
else if (writeType == MemberWriteType::EMBEDDED)
|
else if (writeType == MemberWriteType::EMBEDDED)
|
||||||
{
|
{
|
||||||
LINE(MakeWrittenMemberAccess(info, member, modifier) << " = UseScriptString(" << MakeMemberAccess(info, member, modifier) << ");")
|
LINEF("{0} = UseScriptString({1});", MakeWrittenMemberAccess(info, member, modifier), MakeMemberAccess(info, member, modifier))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
LINE("#error unsupported writeType " << static_cast<int>(writeType) << " for scripstring")
|
LINEF("#error unsupported writeType {0} for scripstring", static_cast<int>(writeType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Game/IW4/IW4.h"
|
#include "Game/IW4/IW4.h"
|
||||||
#include "Loading/ContentLoaderBase.h"
|
#include "Loading/ContentLoaderBase.h"
|
||||||
#include "Loading/IContentLoadingEntryPoint.h"
|
#include "Loading/IContentLoadingEntryPoint.h"
|
||||||
@ -7,17 +8,18 @@ namespace IW4
|
|||||||
{
|
{
|
||||||
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
|
class ContentLoader final : public ContentLoaderBase, public IContentLoadingEntryPoint
|
||||||
{
|
{
|
||||||
XAsset* varXAsset;
|
public:
|
||||||
ScriptStringList* varScriptStringList;
|
ContentLoader();
|
||||||
|
|
||||||
|
void Load(Zone* zone, IZoneInputStream* stream) override;
|
||||||
|
|
||||||
|
private:
|
||||||
void LoadScriptStringList(bool atStreamStart);
|
void LoadScriptStringList(bool atStreamStart);
|
||||||
|
|
||||||
void LoadXAsset(bool atStreamStart) const;
|
void LoadXAsset(bool atStreamStart) const;
|
||||||
void LoadXAssetArray(bool atStreamStart, size_t count);
|
void LoadXAssetArray(bool atStreamStart, size_t count);
|
||||||
|
|
||||||
public:
|
XAsset* varXAsset;
|
||||||
ContentLoader();
|
ScriptStringList* varScriptStringList;
|
||||||
|
|
||||||
void Load(Zone* zone, IZoneInputStream* stream) override;
|
|
||||||
};
|
};
|
||||||
} // namespace IW4
|
} // namespace IW4
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), sizeof(T));
|
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> void Load(T* dst, const uint32_t count)
|
template<typename T> void Load(T* dst, const size_t count)
|
||||||
{
|
{
|
||||||
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), count * sizeof(T));
|
LoadDataInBlock(const_cast<void*>(reinterpret_cast<const void*>(dst)), count * sizeof(T));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user