From 2263af8d2f4e3d899e753f942c087205527f07a5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Jul 2020 11:30:16 -0400 Subject: [PATCH] CTemplateEditDialog: Make use of ranged for where applicable --- src/Editor/WorldEditor/CTemplateEditDialog.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Editor/WorldEditor/CTemplateEditDialog.cpp b/src/Editor/WorldEditor/CTemplateEditDialog.cpp index bca7e9c8..f82d5aaa 100644 --- a/src/Editor/WorldEditor/CTemplateEditDialog.cpp +++ b/src/Editor/WorldEditor/CTemplateEditDialog.cpp @@ -96,8 +96,8 @@ CTemplateEditDialog::CTemplateEditDialog(IProperty *pProperty, QWidget *pParent) std::set Templates; NPropertyMap::RetrieveXMLsWithProperty( pProperty->ID(), pProperty->HashableTypeName(), Templates ); - for (auto Iter = Templates.begin(); Iter != Templates.end(); Iter++) - mpUI->TemplatesListWidget->addItem(TO_QSTRING(*Iter)); + for (const auto& Template : Templates) + mpUI->TemplatesListWidget->addItem(TO_QSTRING(Template)); mpUI->ValidityLabel->SetValidityText(tr("Hash match! Property name is likely correct."), tr("Hash mismatch! Property name is likely wrong.")); connect(mpUI->NameLineEdit, &CSoftValidatorLineEdit::SoftValidityChanged, mpUI->ValidityLabel, &CValidityLabel::SetValid); @@ -229,19 +229,17 @@ void CTemplateEditDialog::UpdateDescription(const TString& rkNewDesc) mpProperty->SetDescription(rkNewDesc); // Update all copies of this property in memory with the new description - TString SourceFile = mpProperty->GetTemplateFileName(); + const TString SourceFile = mpProperty->GetTemplateFileName(); if (!SourceFile.IsEmpty()) { std::vector Templates; NPropertyMap::RetrievePropertiesWithID(mpProperty->ID(), mpProperty->HashableTypeName(), Templates); - for (auto Iter = Templates.begin(); Iter != Templates.end(); Iter++) + for (auto* property : Templates) { - IProperty* pProperty = *Iter; - - if (pProperty->GetTemplateFileName() == SourceFile && pProperty->Description() == mOriginalDescription) - pProperty->SetDescription(rkNewDesc); + if (property->GetTemplateFileName() == SourceFile && property->Description() == mOriginalDescription) + property->SetDescription(rkNewDesc); } }