Use STL-style iterators instead of Java-style ones

7220-lua-add-a-general-purpose-lexical-parser
Andrei Kortunov 2 years ago
parent 792feae39e
commit ee9ab8d393

@ -165,12 +165,10 @@ bool Config::GameSettings::readFile(QTextStream& stream, QMultiMap<QString, QStr
bool Config::GameSettings::writeFile(QTextStream& stream)
{
// Iterate in reverse order to preserve insertion order
QMapIterator<QString, QString> i(mUserSettings);
i.toBack();
while (i.hasPrevious())
auto i = mUserSettings.end();
while (i != mUserSettings.begin())
{
i.previous();
i--;
// path lines (e.g. 'data=...') need quotes and ampersands escaping to match how boost::filesystem::path uses
// boost::io::quoted
@ -388,12 +386,10 @@ bool Config::GameSettings::writeFileWithComments(QFile& file)
// Iterate in reverse order to preserve insertion order
QString settingLine;
QMapIterator<QString, QString> it(mUserSettings);
it.toBack();
while (it.hasPrevious())
auto it = mUserSettings.end();
while (it != mUserSettings.begin())
{
it.previous();
it--;
if (it.key() == QLatin1String("data") || it.key() == QLatin1String("data-local")
|| it.key() == QLatin1String("resources") || it.key() == QLatin1String("load-savegame"))

@ -50,12 +50,10 @@ bool Config::LauncherSettings::writeFile(QTextStream& stream)
QRegularExpression sectionRe("^([^/]+)/(.+)$");
QMultiMap<QString, QString> settings = SettingsBase::getSettings();
QMapIterator<QString, QString> i(settings);
i.toBack();
while (i.hasPrevious())
auto i = settings.end();
while (i != settings.begin())
{
i.previous();
i--;
QString prefix;
QString key;

Loading…
Cancel
Save