2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-06-28 23:31:54 +00:00

Add written variable for zone writing code to be able to differ between written data and original data

This commit is contained in:
Jan
2021-05-08 16:41:42 +02:00
parent acc11a1609
commit a8c62de081
7 changed files with 159 additions and 76 deletions

View File

@ -52,6 +52,13 @@ void BaseTemplate::MakeTypeVarNameInternal(const DataDefinition* def, std::ostri
MakeSafeTypeNameInternal(def, str);
}
void BaseTemplate::MakeTypeWrittenVarNameInternal(const DataDefinition* def, std::ostringstream& str)
{
str << "var";
MakeSafeTypeNameInternal(def, str);
str << "Written";
}
void BaseTemplate::MakeTypePtrVarNameInternal(const DataDefinition* def, std::ostringstream& str)
{
str << "var";
@ -59,6 +66,13 @@ void BaseTemplate::MakeTypePtrVarNameInternal(const DataDefinition* def, std::os
str << "Ptr";
}
void BaseTemplate::MakeTypeWrittenPtrVarNameInternal(const DataDefinition* def, std::ostringstream& str)
{
str << "var";
MakeSafeTypeNameInternal(def, str);
str << "PtrWritten";
}
void BaseTemplate::MakeArrayIndicesInternal(const DeclarationModifierComputations& modifierComputations, std::ostringstream& str)
{
for (auto index : modifierComputations.GetArrayIndices())
@ -74,6 +88,14 @@ std::string BaseTemplate::MakeTypeVarName(const DataDefinition* def)
return str.str();
}
std::string BaseTemplate::MakeTypeWrittenVarName(const DataDefinition* def)
{
std::ostringstream str;
MakeTypeWrittenVarNameInternal(def, str);
return str.str();
}
std::string BaseTemplate::MakeTypePtrVarName(const DataDefinition* def)
{
std::ostringstream str;
@ -81,6 +103,13 @@ std::string BaseTemplate::MakeTypePtrVarName(const DataDefinition* def)
return str.str();
}
std::string BaseTemplate::MakeTypeWrittenPtrVarName(const DataDefinition* def)
{
std::ostringstream str;
MakeTypeWrittenPtrVarNameInternal(def, str);
return str.str();
}
std::string BaseTemplate::MakeSafeTypeName(const DataDefinition* def)
{
std::ostringstream str;
@ -98,6 +127,16 @@ std::string BaseTemplate::MakeMemberAccess(StructureInformation* info, MemberInf
return str.str();
}
std::string BaseTemplate::MakeWrittenMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier)
{
std::ostringstream str;
MakeTypeWrittenVarNameInternal(info->m_definition, str);
str << "->" << member->m_member->m_name;
MakeArrayIndicesInternal(modifier, str);
return str.str();
}
std::string BaseTemplate::MakeMemberAccess(const std::string& variableName, StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier)
{
std::ostringstream str;

View File

@ -26,7 +26,9 @@ protected:
private:
static void MakeSafeTypeNameInternal(const DataDefinition* def, std::ostringstream& str);
static void MakeTypeVarNameInternal(const DataDefinition* def, std::ostringstream& str);
static void MakeTypeWrittenVarNameInternal(const DataDefinition* def, std::ostringstream& str);
static void MakeTypePtrVarNameInternal(const DataDefinition* def, std::ostringstream& str);
static void MakeTypeWrittenPtrVarNameInternal(const DataDefinition* def, std::ostringstream& str);
static void MakeArrayIndicesInternal(const DeclarationModifierComputations& modifierComputations, std::ostringstream& str);
static void MakeOperandStatic(const OperandStatic* op, std::ostringstream& str);
static void MakeOperandDynamic(const OperandDynamic* op, std::ostringstream& str);
@ -37,9 +39,12 @@ protected:
static std::string Upper(std::string str);
static std::string Lower(std::string str);
static std::string MakeTypeVarName(const DataDefinition* def);
static std::string MakeTypeWrittenVarName(const DataDefinition* def);
static std::string MakeTypePtrVarName(const DataDefinition* def);
static std::string MakeTypeWrittenPtrVarName(const DataDefinition* def);
static std::string MakeSafeTypeName(const DataDefinition* def);
static std::string MakeMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier);
static std::string MakeWrittenMemberAccess(StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier);
static std::string MakeMemberAccess(const std::string& variableName, StructureInformation* info, MemberInformation* member, const DeclarationModifierComputations& modifier);
static std::string MakeTypeDecl(const TypeDeclaration* decl);
static std::string MakeFollowingReferences(const std::vector<DeclarationModifier*>& modifiers);