summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd/src/options.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-21 18:33:29 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:14 +0300
commite4e088d37070bab69b1457621706d65472874243 (patch)
treeb031344561547208e567fa473e1640b302407a86 /plugins/SmileyAdd/src/options.cpp
parentba75602b16e4b9b484c2c05f70c117f612c81e1d (diff)
SmileyAdd: C++'11 iterators
Diffstat (limited to 'plugins/SmileyAdd/src/options.cpp')
-rw-r--r--plugins/SmileyAdd/src/options.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp
index 84a84a3bb2..3f1551fd42 100644
--- a/plugins/SmileyAdd/src/options.cpp
+++ b/plugins/SmileyAdd/src/options.cpp
@@ -281,13 +281,13 @@ void OptionsDialogType::UpdateVisibleSmPackList(void)
bool usePhysProto = IsDlgButtonChecked(m_hwndDialog, IDC_USEPHYSPROTO) == BST_CHECKED;
SmileyCategoryListType::SmileyCategoryVectorType &smc = *tmpsmcat.GetSmileyCategoryList();
- for (int i = 0; i < smc.getCount(); i++) {
- bool visiblecat = usePhysProto ? !smc[i].IsAcc() : !smc[i].IsPhysProto();
- bool visible = useOne ? !smc[i].IsProto() : visiblecat;
+ for (auto &it : smc) {
+ bool visiblecat = usePhysProto ? !it->IsAcc() : !it->IsPhysProto();
+ bool visible = useOne ? !it->IsProto() : visiblecat;
- if (!visible && smc[i].IsAcc() && !useOne) {
+ if (!visible && it->IsAcc() && !useOne) {
CMStringW PhysProtoName = L"AllProto";
- CMStringW ProtoName = smc[i].GetName();
+ CMStringW ProtoName = it->GetName();
DBVARIANT dbv;
if (db_get_ws(NULL, _T2A(ProtoName.GetBuffer()), "AM_BaseProto", &dbv) == 0) {
ProtoName = dbv.ptszVal;
@@ -307,7 +307,7 @@ void OptionsDialogType::UpdateVisibleSmPackList(void)
}
}
- smc[i].SetVisible(visible);
+ it->SetVisible(visible);
}
}
@@ -388,12 +388,12 @@ void OptionsDialogType::InitDialog(void)
tmpsmcat = g_SmileyCategories;
SmileyCategoryListType::SmileyCategoryVectorType &smc = *g_SmileyCategories.GetSmileyCategoryList();
- for (int i = 0; i < smc.getCount(); i++) {
+ for (auto &it : smc) {
HICON hIcon = nullptr;
- if (smc[i].IsProto()) {
- hIcon = (HICON)CallProtoService(_T2A(smc[i].GetName().c_str()), PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
+ if (it->IsProto()) {
+ hIcon = (HICON)CallProtoService(_T2A(it->GetName().c_str()), PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
if (hIcon == nullptr || (INT_PTR)hIcon == CALLSERVICE_NOTFOUND)
- hIcon = (HICON)CallProtoService(_T2A(smc[i].GetName().c_str()), PS_LOADICON, PLI_PROTOCOL, 0);
+ hIcon = (HICON)CallProtoService(_T2A(it->GetName().c_str()), PS_LOADICON, PLI_PROTOCOL, 0);
}
if (hIcon == nullptr || hIcon == (HICON)CALLSERVICE_NOTFOUND)
hIcon = GetDefaultIcon();
@@ -445,9 +445,9 @@ void OptionsDialogType::ApplyChanges(void)
// Cleanup database
CMStringW empty;
SmileyCategoryListType::SmileyCategoryVectorType &smc = *g_SmileyCategories.GetSmileyCategoryList();
- for (int i = 0; i < smc.getCount(); i++)
- if (tmpsmcat.GetSmileyCategory(smc[i].GetName()) == nullptr)
- opt.WritePackFileName(empty, smc[i].GetName());
+ for (auto &it : smc)
+ if (tmpsmcat.GetSmileyCategory(it->GetName()) == nullptr)
+ opt.WritePackFileName(empty, it->GetName());
g_SmileyCategories = tmpsmcat;
g_SmileyCategories.SaveSettings();