2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 17:47:43 +00:00

Added binarySize method to DNA implementations

This commit is contained in:
Jack Andersen
2015-10-17 18:08:45 -10:00
parent 6bd5c42a9e
commit 9529fad78f
21 changed files with 668 additions and 15 deletions

View File

@@ -211,6 +211,38 @@ void STRG::write(Athena::io::IStreamWriter& writer) const
}
}
size_t STRG::binarySize(size_t __isz) const
{
__isz += 24;
__isz += names.size() * 8;
for (const auto& name : names)
__isz += name.first.size() + 1;
__isz += langs.size() * 4;
for (const auto& lang : langs)
__isz += 4 + lang.second.size() * 4;
size_t strCount = STRG::count();
for (atUint32 s=0 ; s<strCount ; ++s)
{
for (const auto& lang : langs)
{
if (s >= lang.second.size())
{
__isz += 5;
}
else
{
const std::string& str = lang.second[s];
__isz += str.size() + 5;
}
}
}
return __isz;
}
void STRG::toYAML(Athena::io::YAMLDocWriter& writer) const
{
for (const auto& item : langs)