Add InfoString loading

This commit is contained in:
Jan
2021-03-25 11:14:51 +01:00
parent 613943b28c
commit 55f48c9bc2
10 changed files with 499 additions and 47 deletions

View File

@ -1,22 +1,44 @@
#pragma once
#include <string>
#include <unordered_set>
#include "Utils/ClassUtils.h"
#include "InfoString/InfoString.h"
#include "Pool/XAssetInfo.h"
#include "Utils/MemoryManager.h"
#include "Zone/ZoneScriptStrings.h"
class InfoStringToStructConverterBase
{
protected:
const InfoString& m_info_string;
ZoneScriptStrings& m_zone_script_strings;
std::unordered_set<scr_string_t> m_used_script_string_list;
std::unordered_set<XAssetInfoGeneric*> m_dependencies;
MemoryManager* m_memory;
void* m_structure;
virtual void FillStructure() = 0;
bool ConvertString(const std::string& value, size_t offset);
bool ConvertStringBuffer(const std::string& value, size_t offset, size_t bufferSize);
bool ConvertInt(const std::string& value, size_t offset);
bool ConvertUint(const std::string& value, size_t offset);
bool ConvertBool(const std::string& value, size_t offset);
bool ConvertQBoolean(const std::string& value, size_t offset);
bool ConvertFloat(const std::string& value, size_t offset);
bool ConvertMilliseconds(const std::string& value, size_t offset);
bool ConvertScriptString(const std::string& value, size_t offset);
bool ConvertEnumInt(const std::string& value, size_t offset, const char** enumValues, size_t enumSize);
public:
InfoStringToStructConverterBase(const InfoString& infoString, void* structure);
virtual ~InfoStringToStructConverterBase();
InfoStringToStructConverterBase(const InfoString& infoString, void* structure, ZoneScriptStrings& zoneScriptStrings, MemoryManager* memory);
virtual ~InfoStringToStructConverterBase() = default;
InfoStringToStructConverterBase(const InfoStringToStructConverterBase& other) = delete;
InfoStringToStructConverterBase(InfoStringToStructConverterBase&& other) noexcept = delete;
InfoStringToStructConverterBase& operator=(const InfoStringToStructConverterBase& other) = delete;
InfoStringToStructConverterBase& operator=(InfoStringToStructConverterBase&& other) noexcept = delete;
void Convert();
};
virtual bool Convert() = 0;
_NODISCARD std::vector<scr_string_t> GetUsedScriptStrings() const;
_NODISCARD std::vector<XAssetInfoGeneric*> GetDependencies() const;
};