Using auto keyword in most apps

Detected by clang-tidy's modernize-use-auto
dont-compose-content
Thunderforge 4 years ago
parent fea5c0ac1a
commit ded7bd92e6

@ -357,7 +357,7 @@ namespace ESSImport
std::string idLower = Misc::StringUtils::lowerCase(out.mRefID); std::string idLower = Misc::StringUtils::lowerCase(out.mRefID);
std::map<std::pair<int, std::string>, NPCC>::const_iterator npccIt = mContext->mNpcChanges.find( auto npccIt = mContext->mNpcChanges.find(
std::make_pair(refIndex, out.mRefID)); std::make_pair(refIndex, out.mRefID));
if (npccIt != mContext->mNpcChanges.end()) if (npccIt != mContext->mNpcChanges.end())
{ {
@ -383,7 +383,7 @@ namespace ESSImport
continue; continue;
} }
std::map<std::pair<int, std::string>, CNTC>::const_iterator cntcIt = mContext->mContainerChanges.find( auto cntcIt = mContext->mContainerChanges.find(
std::make_pair(refIndex, out.mRefID)); std::make_pair(refIndex, out.mRefID));
if (cntcIt != mContext->mContainerChanges.end()) if (cntcIt != mContext->mContainerChanges.end())
{ {
@ -398,7 +398,7 @@ namespace ESSImport
continue; continue;
} }
std::map<std::pair<int, std::string>, CREC>::const_iterator crecIt = mContext->mCreatureChanges.find( auto crecIt = mContext->mCreatureChanges.find(
std::make_pair(refIndex, out.mRefID)); std::make_pair(refIndex, out.mRefID));
if (crecIt != mContext->mCreatureChanges.end()) if (crecIt != mContext->mCreatureChanges.end())
{ {

@ -374,7 +374,7 @@ public:
void write(ESM::ESMWriter &esm) override void write(ESM::ESMWriter &esm) override
{ {
esm.startRecord(ESM::REC_DCOU); esm.startRecord(ESM::REC_DCOU);
for (std::map<std::string, int>::const_iterator it = mKillCounter.begin(); it != mKillCounter.end(); ++it) for (auto it = mKillCounter.begin(); it != mKillCounter.end(); ++it)
{ {
esm.writeHNString("ID__", it->first); esm.writeHNString("ID__", it->first);
esm.writeHNT ("COUN", it->second); esm.writeHNT ("COUN", it->second);
@ -397,7 +397,7 @@ public:
faction.load(esm, isDeleted); faction.load(esm, isDeleted);
std::string id = Misc::StringUtils::lowerCase(faction.mId); std::string id = Misc::StringUtils::lowerCase(faction.mId);
for (std::map<std::string, int>::const_iterator it = faction.mReactions.begin(); it != faction.mReactions.end(); ++it) for (auto it = faction.mReactions.begin(); it != faction.mReactions.end(); ++it)
{ {
std::string faction2 = Misc::StringUtils::lowerCase(it->first); std::string faction2 = Misc::StringUtils::lowerCase(it->first);
mContext->mDialogueState.mChangedFactionReaction[id].insert(std::make_pair(faction2, it->second)); mContext->mDialogueState.mChangedFactionReaction[id].insert(std::make_pair(faction2, it->second));
@ -431,7 +431,7 @@ public:
void write(ESM::ESMWriter &esm) override void write(ESM::ESMWriter &esm) override
{ {
ESM::StolenItems items; ESM::StolenItems items;
for (std::map<std::string, std::set<Owner> >::const_iterator it = mStolenItems.begin(); it != mStolenItems.end(); ++it) for (auto it = mStolenItems.begin(); it != mStolenItems.end(); ++it)
{ {
std::map<std::pair<std::string, bool>, int> owners; std::map<std::pair<std::string, bool>, int> owners;
for (const auto & ownerIt : it->second) for (const auto & ownerIt : it->second)
@ -487,7 +487,7 @@ public:
} }
void write(ESM::ESMWriter &esm) override void write(ESM::ESMWriter &esm) override
{ {
for (std::map<std::string, DIAL>::const_iterator it = mDials.begin(); it != mDials.end(); ++it) for (auto it = mDials.begin(); it != mDials.end(); ++it)
{ {
esm.startRecord(ESM::REC_QUES); esm.startRecord(ESM::REC_QUES);
ESM::QuestState state; ESM::QuestState state;

@ -385,7 +385,7 @@ namespace ESSImport
// Writing order should be Dynamic Store -> Cells -> Player, // Writing order should be Dynamic Store -> Cells -> Player,
// so that references to dynamic records can be recognized when loading // so that references to dynamic records can be recognized when loading
for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin(); for (auto it = converters.begin();
it != converters.end(); ++it) it != converters.end(); ++it)
{ {
if (it->second->getStage() != 0) if (it->second->getStage() != 0)
@ -398,7 +398,7 @@ namespace ESSImport
context.mPlayerBase.save(writer); context.mPlayerBase.save(writer);
writer.endRecord(ESM::REC_NPC_); writer.endRecord(ESM::REC_NPC_);
for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin(); for (auto it = converters.begin();
it != converters.end(); ++it) it != converters.end(); ++it)
{ {
if (it->second->getStage() != 1) if (it->second->getStage() != 1)
@ -423,7 +423,7 @@ namespace ESSImport
writer.endRecord(ESM::REC_ACTC); writer.endRecord(ESM::REC_ACTC);
// Stage 2 requires cell references to be written / actors IDs assigned // Stage 2 requires cell references to be written / actors IDs assigned
for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin(); for (auto it = converters.begin();
it != converters.end(); ++it) it != converters.end(); ++it)
{ {
if (it->second->getStage() != 2) if (it->second->getStage() != 2)

@ -52,8 +52,8 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
iconWidget->setCurrentRow(0); iconWidget->setCurrentRow(0);
iconWidget->setFlow(QListView::LeftToRight); iconWidget->setFlow(QListView::LeftToRight);
QPushButton *helpButton = new QPushButton(tr("Help")); auto *helpButton = new QPushButton(tr("Help"));
QPushButton *playButton = new QPushButton(tr("Play")); auto *playButton = new QPushButton(tr("Play"));
buttonBox->button(QDialogButtonBox::Close)->setText(tr("Close")); buttonBox->button(QDialogButtonBox::Close)->setText(tr("Close"));
buttonBox->addButton(helpButton, QDialogButtonBox::HelpRole); buttonBox->addButton(helpButton, QDialogButtonBox::HelpRole);
buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole); buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole);
@ -79,31 +79,31 @@ void Launcher::MainDialog::createIcons()
if (!QIcon::hasThemeIcon("document-new")) if (!QIcon::hasThemeIcon("document-new"))
QIcon::setThemeName("tango"); QIcon::setThemeName("tango");
QListWidgetItem *playButton = new QListWidgetItem(iconWidget); auto *playButton = new QListWidgetItem(iconWidget);
playButton->setIcon(QIcon(":/images/openmw.png")); playButton->setIcon(QIcon(":/images/openmw.png"));
playButton->setText(tr("Play")); playButton->setText(tr("Play"));
playButton->setTextAlignment(Qt::AlignCenter); playButton->setTextAlignment(Qt::AlignCenter);
playButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); playButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *dataFilesButton = new QListWidgetItem(iconWidget); auto *dataFilesButton = new QListWidgetItem(iconWidget);
dataFilesButton->setIcon(QIcon(":/images/openmw-plugin.png")); dataFilesButton->setIcon(QIcon(":/images/openmw-plugin.png"));
dataFilesButton->setText(tr("Data Files")); dataFilesButton->setText(tr("Data Files"));
dataFilesButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom); dataFilesButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
dataFilesButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); dataFilesButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *graphicsButton = new QListWidgetItem(iconWidget); auto *graphicsButton = new QListWidgetItem(iconWidget);
graphicsButton->setIcon(QIcon(":/images/preferences-video.png")); graphicsButton->setIcon(QIcon(":/images/preferences-video.png"));
graphicsButton->setText(tr("Graphics")); graphicsButton->setText(tr("Graphics"));
graphicsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom | Qt::AlignAbsolute); graphicsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom | Qt::AlignAbsolute);
graphicsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); graphicsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *settingsButton = new QListWidgetItem(iconWidget); auto *settingsButton = new QListWidgetItem(iconWidget);
settingsButton->setIcon(QIcon(":/images/preferences.png")); settingsButton->setIcon(QIcon(":/images/preferences.png"));
settingsButton->setText(tr("Settings")); settingsButton->setText(tr("Settings"));
settingsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom); settingsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
settingsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); settingsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *advancedButton = new QListWidgetItem(iconWidget); auto *advancedButton = new QListWidgetItem(iconWidget);
advancedButton->setIcon(QIcon(":/images/preferences-advanced.png")); advancedButton->setIcon(QIcon(":/images/preferences-advanced.png"));
advancedButton->setText(tr("Advanced")); advancedButton->setText(tr("Advanced"));
advancedButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom); advancedButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);

@ -29,7 +29,7 @@ void ProfilesComboBox::setEditEnabled(bool editable)
setEditable(true); setEditable(true);
setValidator(mValidator); setValidator(mValidator);
ComboBoxLineEdit *edit = new ComboBoxLineEdit(this); auto *edit = new ComboBoxLineEdit(this);
setLineEdit(edit); setLineEdit(edit);
setCompleter(nullptr); setCompleter(nullptr);

@ -16,7 +16,7 @@ Launcher::TextInputDialog::TextInputDialog(const QString& title, const QString &
mButtonBox->addButton(QDialogButtonBox::Cancel); mButtonBox->addButton(QDialogButtonBox::Cancel);
mButtonBox->button(QDialogButtonBox::Ok)->setEnabled (false); mButtonBox->button(QDialogButtonBox::Ok)->setEnabled (false);
QLabel *label = new QLabel(this); auto *label = new QLabel(this);
label->setText(text); label->setText(text);
// Line edit // Line edit
@ -25,7 +25,7 @@ Launcher::TextInputDialog::TextInputDialog(const QString& title, const QString &
mLineEdit->setValidator(validator); mLineEdit->setValidator(validator);
mLineEdit->setCompleter(nullptr); mLineEdit->setCompleter(nullptr);
QVBoxLayout *dialogLayout = new QVBoxLayout(this); auto *dialogLayout = new QVBoxLayout(this);
dialogLayout->addWidget(label); dialogLayout->addWidget(label);
dialogLayout->addWidget(mLineEdit); dialogLayout->addWidget(mLineEdit);
dialogLayout->addWidget(mButtonBox); dialogLayout->addWidget(mButtonBox);

@ -778,7 +778,7 @@ void MwIniImporter::mergeFallback(multistrmap &cfg, const multistrmap &ini) cons
} }
void MwIniImporter::insertMultistrmap(multistrmap &cfg, const std::string& key, const std::string& value) { void MwIniImporter::insertMultistrmap(multistrmap &cfg, const std::string& key, const std::string& value) {
const multistrmap::const_iterator it = cfg.find(key); const auto it = cfg.find(key);
if(it == cfg.end()) { if(it == cfg.end()) {
cfg.insert(std::make_pair (key, std::vector<std::string>() )); cfg.insert(std::make_pair (key, std::vector<std::string>() ));
} }
@ -791,7 +791,7 @@ void MwIniImporter::importArchives(multistrmap &cfg, const multistrmap &ini) con
std::string archive; std::string archive;
// Search archives listed in ini file // Search archives listed in ini file
multistrmap::const_iterator it = ini.begin(); auto it = ini.begin();
for(int i=0; it != ini.end(); i++) { for(int i=0; it != ini.end(); i++) {
archive = baseArchive; archive = baseArchive;
archive.append(std::to_string(i)); archive.append(std::to_string(i));
@ -813,7 +813,7 @@ void MwIniImporter::importArchives(multistrmap &cfg, const multistrmap &ini) con
// does not appears in the ini file // does not appears in the ini file
cfg["fallback-archive"].push_back("Morrowind.bsa"); cfg["fallback-archive"].push_back("Morrowind.bsa");
for(std::vector<std::string>::const_iterator iter=archives.begin(); iter!=archives.end(); ++iter) { for(auto iter=archives.begin(); iter!=archives.end(); ++iter) {
cfg["fallback-archive"].push_back(*iter); cfg["fallback-archive"].push_back(*iter);
} }
} }
@ -886,7 +886,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
dataPaths.push_back(iniFilename.parent_path() /= "Data Files"); dataPaths.push_back(iniFilename.parent_path() /= "Data Files");
multistrmap::const_iterator it = ini.begin(); auto it = ini.begin();
for (int i=0; it != ini.end(); i++) for (int i=0; it != ini.end(); i++)
{ {
std::string gameFile = baseGameFile; std::string gameFile = baseGameFile;
@ -969,7 +969,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
void MwIniImporter::writeToFile(std::ostream &out, const multistrmap &cfg) { void MwIniImporter::writeToFile(std::ostream &out, const multistrmap &cfg) {
for(multistrmap::const_iterator it=cfg.begin(); it != cfg.end(); ++it) { for(multistrmap::const_iterator it=cfg.begin(); it != cfg.end(); ++it) {
for(std::vector<std::string>::const_iterator entry=it->second.begin(); entry != it->second.end(); ++entry) { for(auto entry=it->second.begin(); entry != it->second.end(); ++entry) {
out << (it->first) << "=" << (*entry) << std::endl; out << (it->first) << "=" << (*entry) << std::endl;
} }
} }

@ -53,7 +53,7 @@ void readVFS(VFS::Archive* anArchive,std::string archivePath = "")
myManager.buildIndex(); myManager.buildIndex();
std::map<std::string, VFS::File*> files=myManager.getIndex(); std::map<std::string, VFS::File*> files=myManager.getIndex();
for(std::map<std::string, VFS::File*>::const_iterator it=files.begin(); it!=files.end(); ++it) for(auto it=files.begin(); it!=files.end(); ++it)
{ {
std::string name = it->first; std::string name = it->first;
@ -134,7 +134,7 @@ int main(int argc, char **argv)
Nif::NIFFile::setLoadUnsupportedFiles(true); Nif::NIFFile::setLoadUnsupportedFiles(true);
// std::cout << "Reading Files" << std::endl; // std::cout << "Reading Files" << std::endl;
for(std::vector<std::string>::const_iterator it=files.begin(); it!=files.end(); ++it) for(auto it=files.begin(); it!=files.end(); ++it)
{ {
std::string name = *it; std::string name = *it;

Loading…
Cancel
Save