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

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

Loading…
Cancel
Save