diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-25 02:26:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-25 02:26:34 +0300 |
commit | c9f43996f3147100627ee2c6f9da993ceb160113 (patch) | |
tree | 7577f02f4658b19e05d586f66b67a9a4f5fedb7e /src/configuration.cpp | |
parent | 8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf (diff) | |
download | mv-c9f43996f3147100627ee2c6f9da993ceb160113.tar.gz mv-c9f43996f3147100627ee2c6f9da993ceb160113.tar.bz2 mv-c9f43996f3147100627ee2c6f9da993ceb160113.tar.xz mv-c9f43996f3147100627ee2c6f9da993ceb160113.zip |
Improve iterators part 2.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r-- | src/configuration.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index e4a1702de..684468997 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -222,8 +222,11 @@ void Configuration::setValue(const std::string &key, const std::string &value) if (list != mListenerMap.end()) { Listeners listeners = list->second; - for (ListenerIterator i = listeners.begin(); i != listeners.end(); ++i) + for (ListenerIterator i = listeners.begin(), i_end = listeners.end(); + i != i_end; ++i) + { (*i)->optionChanged(key); + } } } @@ -735,8 +738,8 @@ void ConfigurationObject::writeToXML(XmlTextWriterPtr writer) } for (std::map<std::string, ConfigurationList>::const_iterator - it = mContainerOptions.begin(); - it != mContainerOptions.end(); ++it) + it = mContainerOptions.begin(), it_end = mContainerOptions.end(); + it != it_end; ++ it) { const char *name = it->first.c_str(); @@ -744,8 +747,8 @@ void ConfigurationObject::writeToXML(XmlTextWriterPtr writer) xmlTextWriterWriteAttribute(writer, BAD_CAST "name", BAD_CAST name); // recurse on all elements - for (ConfigurationList::const_iterator elt_it = it->second.begin(); - elt_it != it->second.end(); ++elt_it) + for (ConfigurationList::const_iterator elt_it = it->second.begin(), + elt_it_end = it->second.end(); elt_it != elt_it_end; ++elt_it) { xmlTextWriterStartElement(writer, BAD_CAST name); if (*elt_it) @@ -807,10 +810,11 @@ void Configuration::removeListener(const std::string &key, void Configuration::removeListeners(ConfigListener *listener) { - ListenerMapIterator it = mListenerMap.begin(); - ListenerMapIterator it_end = mListenerMap.end(); - for (; it != it_end; ++ it) + for (ListenerMapIterator it = mListenerMap.begin(), + it_end = mListenerMap.end(); it != it_end; ++ it) + { (it->second).remove(listener); + } } void Configuration::removeOldKeys() |