update ConfigIni::Save

This commit is contained in:
Nomango 2020-05-31 22:10:49 +08:00
parent a62f1f4d2d
commit 7f902e3343
1 changed files with 10 additions and 6 deletions

View File

@ -158,16 +158,20 @@ bool ConfigIni::Save(std::ostream& os)
std::sort(keys.begin(), keys.end());
// Output to ini
for (const auto& key : keys)
std::ostream::sentry ok(os);
if (ok)
{
os << '[' << key << ']' << std::endl;
for (const auto& pair : sections_[key])
for (const auto& key : keys)
{
os << pair.first << " = " << pair.second << std::endl;
os << '[' << key << ']' << std::endl;
for (const auto& pair : sections_[key])
{
os << pair.first << " = " << pair.second << std::endl;
}
os << std::endl;
}
os << std::endl;
}
return false;
return !os.fail();
}
ConfigIni::SectionMap ConfigIni::GetSectionMap() const