mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-13 00:08:26 -05:00
Add loading of gdt entries to info based assets
This commit is contained in:
@ -93,7 +93,7 @@ void InfoString::ToGdtProperties(const std::string& prefix, GdtEntry& gdtEntry)
|
||||
gdtEntry.m_properties[key] = value->second;
|
||||
}
|
||||
|
||||
gdtEntry.m_properties["configstringFileType"] = prefix;
|
||||
gdtEntry.m_properties[GDT_PREFIX_FIELD] = prefix;
|
||||
}
|
||||
|
||||
class InfoStringInputStream
|
||||
@ -195,3 +195,21 @@ bool InfoString::FromStream(const std::string& prefix, std::istream& stream)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InfoString::FromGdtProperties(const std::string& prefix, const GdtEntry& gdtEntry)
|
||||
{
|
||||
const auto foundPrefixEntry = gdtEntry.m_properties.find(GDT_PREFIX_FIELD);
|
||||
if (foundPrefixEntry == gdtEntry.m_properties.end() || foundPrefixEntry->second != prefix)
|
||||
return false;
|
||||
|
||||
for(const auto& [key, value] : gdtEntry.m_properties)
|
||||
{
|
||||
if(key == GDT_PREFIX_FIELD)
|
||||
continue;
|
||||
|
||||
m_keys_by_insertion.push_back(key);
|
||||
m_values.emplace(std::make_pair(key, value));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
class InfoString
|
||||
{
|
||||
static constexpr const char* GDT_PREFIX_FIELD = "configstringFileType";
|
||||
|
||||
static const std::string EMPTY_VALUE;
|
||||
std::unordered_map<std::string, std::string> m_values;
|
||||
std::vector<std::string> m_keys_by_insertion;
|
||||
@ -26,4 +28,5 @@ public:
|
||||
|
||||
bool FromStream(std::istream& stream);
|
||||
bool FromStream(const std::string& prefix, std::istream& stream);
|
||||
bool FromGdtProperties(const std::string& prefix, const GdtEntry& gdtEntry);
|
||||
};
|
Reference in New Issue
Block a user