mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Use moar stringstreams (where appropriate)
This commit is contained in:
@ -948,26 +948,26 @@ void pfLocalizationDataMgr::IWriteText(const plFileName & filename, const plStri
|
||||
plStringStream fileData;
|
||||
fileData << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
|
||||
fileData << "<localizations>\n";
|
||||
fileData << plFormat("\t<age name=\"{}\">\n", ageName);
|
||||
fileData << "\t<age name=\"" << ageName << "\">\n";
|
||||
|
||||
std::vector<plString> setNames = GetSetList(ageName);
|
||||
for (int curSet = 0; curSet < setNames.size(); curSet++)
|
||||
{
|
||||
setEmpty = true; // so far, this set is empty
|
||||
plStringStream setCode;
|
||||
setCode << plFormat("\t\t<set name=\"{}\">\n", setNames[curSet]);
|
||||
setCode << "\t\t<set name=\"" << setNames[curSet] << "\">\n";
|
||||
|
||||
std::vector<plString> elementNames = GetElementList(ageName, setNames[curSet]);
|
||||
for (int curElement = 0; curElement < elementNames.size(); curElement++)
|
||||
{
|
||||
setCode << plFormat("\t\t\t<element name=\"{}\">\n", elementNames[curElement]);
|
||||
setCode << "\t\t\t<element name=\"" << elementNames[curElement] << "\">\n";
|
||||
plString key = plFormat("{}.{}.{}", ageName, setNames[curSet], elementNames[curElement]);
|
||||
|
||||
if (fLocalizedElements[key].find(languageName) != fLocalizedElements[key].end())
|
||||
{
|
||||
weWroteData = true;
|
||||
setEmpty = false;
|
||||
setCode << plFormat("\t\t\t\t<translation language=\"{}\">", languageName);
|
||||
setCode << "\t\t\t\t<translation language=\"" << languageName << "\">";
|
||||
setCode << fLocalizedElements[key][languageName].ToXML();
|
||||
setCode << "</translation>\n";
|
||||
}
|
||||
|
@ -2281,34 +2281,42 @@ void plSimpleStateVariable::DumpToObjectDebugger(bool dirtyOnly, int level) cons
|
||||
|
||||
plString pad = plString::Fill(level * 3, ' ');
|
||||
|
||||
plString logMsg = plFormat("{}SimpleVar, name:{}[{}]", pad, GetName(), GetCount());
|
||||
plStringStream logMsg;
|
||||
logMsg << pad << "SimpleVar, name:" << GetName() << '[' << GetCount() << ']';
|
||||
|
||||
if (GetCount()>1)
|
||||
{
|
||||
dbg->LogMsg(logMsg.c_str()); // it's going to be a long msg, so print it on its own line
|
||||
logMsg = "";
|
||||
dbg->LogMsg(logMsg.GetString().c_str()); // it's going to be a long msg, so print it on its own line
|
||||
logMsg.Truncate();
|
||||
}
|
||||
|
||||
|
||||
pad += "\t";
|
||||
for (size_t i=0; i<GetCount(); i++)
|
||||
{
|
||||
logMsg << pad;
|
||||
logMsg << "Var:" << i;
|
||||
|
||||
plString s=GetAsString(i);
|
||||
if (fVar.GetAtomicType() == plVarDescriptor::kTime)
|
||||
{
|
||||
const char* p=fT[i].PrintWMillis();
|
||||
logMsg += plFormat("{}Var:{} gameTime:{} pst:{} ts:{}",
|
||||
pad, i, s, p, fTimeStamp.Format("%c"));
|
||||
logMsg << " gameTime:" << s;
|
||||
logMsg << " pst:" << fT[i].PrintWMillis();
|
||||
logMsg << " ts:" << fTimeStamp.Format("%c").c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
logMsg += plFormat("{}Var:{} value:{} ts:{}",
|
||||
pad, i, s, fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c"));
|
||||
logMsg << " value:" << s;
|
||||
logMsg << " ts:" << (fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c").c_str());
|
||||
}
|
||||
|
||||
if ( !dirtyOnly )
|
||||
logMsg += plFormat(" dirty:{}", IsDirty());
|
||||
if (!dirtyOnly)
|
||||
{
|
||||
logMsg << " dirty:";
|
||||
logMsg << (IsDirty() ? 0 : 1);
|
||||
}
|
||||
|
||||
dbg->LogMsg(logMsg.c_str());
|
||||
logMsg = "";
|
||||
dbg->LogMsg(logMsg.GetString().c_str());
|
||||
logMsg.Truncate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2316,34 +2324,42 @@ void plSimpleStateVariable::DumpToStream(hsStream* stream, bool dirtyOnly, int l
|
||||
{
|
||||
plString pad = plString::Fill(level * 3, ' ');
|
||||
|
||||
plString logMsg = plFormat("{}SimpleVar, name:{}[{}]", pad, GetName(), GetCount());
|
||||
plStringStream logMsg;
|
||||
logMsg << pad << "SimpleVar, name:" << GetName() << '[' << GetCount() << ']';
|
||||
|
||||
if (GetCount()>1)
|
||||
{
|
||||
stream->WriteString(logMsg); // it's going to be a long msg, so print it on its own line
|
||||
logMsg = "";
|
||||
stream->WriteString(logMsg.GetString()); // it's going to be a long msg, so print it on its own line
|
||||
logMsg.Truncate();
|
||||
}
|
||||
|
||||
|
||||
pad += "\t";
|
||||
for (size_t i=0; i<GetCount(); i++)
|
||||
{
|
||||
plString s=GetAsString(i);
|
||||
logMsg << pad;
|
||||
logMsg << "Var:" << i;
|
||||
|
||||
plString s = GetAsString(i);
|
||||
if (fVar.GetAtomicType() == plVarDescriptor::kTime)
|
||||
{
|
||||
const char* p=fT[i].PrintWMillis();
|
||||
logMsg += plFormat("{}Var:{} gameTime:{} pst:{} ts:{}",
|
||||
pad, i, s, p, fTimeStamp.Format("%c"));
|
||||
logMsg << " gameTime:" << s;
|
||||
logMsg << " pst:" << fT[i].PrintWMillis();
|
||||
logMsg << " ts:" << fTimeStamp.Format("%c").c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
logMsg += plFormat("{}Var:{} value:{} ts:{}",
|
||||
pad, i, s, fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c"));
|
||||
logMsg << " value:" << s;
|
||||
logMsg << " ts:" << (fTimeStamp.AtEpoch() ? "0" : fTimeStamp.Format("%c").c_str());
|
||||
}
|
||||
|
||||
if ( !dirtyOnly )
|
||||
logMsg += plFormat(" dirty:{}", IsDirty());
|
||||
if (!dirtyOnly)
|
||||
{
|
||||
logMsg << " dirty:";
|
||||
logMsg << (IsDirty() ? 0 : 1);
|
||||
}
|
||||
|
||||
stream->WriteString(logMsg);
|
||||
logMsg = "";
|
||||
stream->WriteString(logMsg.GetString());
|
||||
logMsg.Truncate();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user