[vlmc-devel] [PATCH 1/2] Use C++11-style for-loop

Yikai Lu luyikei.qmltu at gmail.com
Fri Mar 11 07:09:01 CET 2016


---
 src/Settings/Settings.cpp | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/Settings/Settings.cpp b/src/Settings/Settings.cpp
index 2259228..ab48a23 100644
--- a/src/Settings/Settings.cpp
+++ b/src/Settings/Settings.cpp
@@ -71,19 +71,16 @@ Settings::save( QXmlStreamWriter& project )
 {
     QReadLocker lock( &m_rwLock );
 
-    SettingMap::const_iterator     it = m_settings.begin();
-    SettingMap::const_iterator     end = m_settings.end();
-
     project.writeStartElement( "settings" );
-    for ( ; it != end; ++it )
+    for ( SettingValue* val: m_settings.values() )
     {
-        if ( ( (*it)->flags() & SettingValue::Runtime ) != 0 )
+        if ( ( val->flags() & SettingValue::Runtime ) != 0 )
             continue ;
         project.writeStartElement( "setting" );
-        project.writeAttribute( "key", (*it)->key() );
-        if ( (*it)->get().canConvert<QString>() == false )
-            vlmcWarning() << "Can't serialize" << (*it)->key();
-        project.writeAttribute( "value", (*it)->get().toString() );
+        project.writeAttribute( "key", val->key() );
+        if ( val->get().canConvert<QString>() == false )
+            vlmcWarning() << "Can't serialize" << val->key();
+        project.writeAttribute( "value", val->get().toString() );
         project.writeEndElement();
     }
     project.writeEndElement();
-- 
1.9.1



More information about the Vlmc-devel mailing list