mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
Write ZoneDefinition entry in parenthesis if there are unparsable character sequences
This commit is contained in:
parent
0db526d1c8
commit
a84a4051f9
@ -82,5 +82,35 @@ void ZoneDefinitionOutputStream::WriteMetaData(const std::string& metaDataKey, c
|
|||||||
|
|
||||||
void ZoneDefinitionOutputStream::WriteEntry(const std::string& entryKey, const std::string& entryValue) const
|
void ZoneDefinitionOutputStream::WriteEntry(const std::string& entryKey, const std::string& entryValue) const
|
||||||
{
|
{
|
||||||
m_stream << entryKey << "," << entryValue << "\n";
|
m_stream << entryKey << ",";
|
||||||
|
|
||||||
|
if(entryValue.find('"') != std::string::npos
|
||||||
|
|| entryValue.find("//") != std::string::npos)
|
||||||
|
{
|
||||||
|
m_stream << '"';
|
||||||
|
for(const auto& c : entryValue)
|
||||||
|
{
|
||||||
|
switch(c)
|
||||||
|
{
|
||||||
|
case '"':
|
||||||
|
m_stream << "\\\"";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
m_stream << "\\\\";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
m_stream << c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_stream << '"';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_stream << entryValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_stream << "\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user