diff src/UiGuiIniFileParser.cpp @ 751:ac165b6ae67e

Done some refactoring: - Moved includes into the cpp files where possible and using class pre-declarations if possible - Made class member variable names begin with an underscore - Made by uic created header files be used as class members instead of inherting them - Renamed some variables to reflect their purpose better - Added some NULL initializations and added some comments - Rearranged some include and declaration code parts to be consistent and better readable - Updated for QScintilla 2.4.5 - Made UiGuiSettings be accessed via a shared pointer only git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1028 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Thu, 14 Oct 2010 19:52:47 +0000
parents 3ee67782b40a
children 302411a51c00
line wrap: on
line diff
--- a/src/UiGuiIniFileParser.cpp	Sat Oct 02 12:48:56 2010 +0000
+++ b/src/UiGuiIniFileParser.cpp	Thu Oct 14 19:52:47 2010 +0000
@@ -19,6 +19,9 @@
 
 #include "UiGuiIniFileParser.h"
 
+#include <QFile>
+#include <QStringList>
+#include <QVariant>
 #include <QTextStream>
 
 //! \defgroup grp_Settings All concerning applications settings.
@@ -41,9 +44,9 @@
     \brief Init and empty all needed lists and strings.
  */
 UiGuiIniFileParser::UiGuiIniFileParser(void) {
-    sections.clear();
-    keyValueMap.clear();
-    iniFileName = "";
+    _sections.clear();
+    _keyValueMap.clear();
+    _iniFileName = "";
 }
 
 
@@ -52,7 +55,7 @@
  */
 UiGuiIniFileParser::UiGuiIniFileParser(const QString &iniFileName) {
     UiGuiIniFileParser();
-    this->iniFileName = iniFileName;
+    _iniFileName = iniFileName;
     parseIniFile();
 }
 
@@ -67,8 +70,8 @@
 QStringList UiGuiIniFileParser::childGroups() {
     QStringList sectionsStringList;
 
-    for( unsigned int i = 0; i < sections.size(); i++ ) {
-        sectionsStringList << sections[i];
+    for( unsigned int i = 0; i < _sections.size(); i++ ) {
+        sectionsStringList << _sections[i];
     }
 
     return sectionsStringList;
@@ -84,7 +87,7 @@
     value("NiceSection/niceKeyName").
  */
 QVariant UiGuiIniFileParser::value(const QString &keyName, const QString &defaultValue) {
-    return keyValueMap.value( keyName, defaultValue );
+    return _keyValueMap.value( keyName, defaultValue );
 }
 
 
@@ -92,12 +95,12 @@
     \brief Parses the ini file and stores the key value pairs in the internal vectors \a keys and \a values.
  */
 void UiGuiIniFileParser::parseIniFile() {
-    QFile iniFile(iniFileName);
+    QFile iniFile(_iniFileName);
 
     if ( iniFile.open(QFile::ReadOnly) ) {
         // Clear the vectors holding the keys and values.
-        sections.clear();
-        keyValueMap.clear();
+        _sections.clear();
+        _keyValueMap.clear();
 
         QTextStream iniFileStream( &iniFile );
         QString line;
@@ -114,7 +117,7 @@
                 currentSectionName.chop(1);
 
                 // Store the section name.
-                sections.push_back( currentSectionName );
+                _sections.push_back( currentSectionName );
             }
             // Otherwise test whether the line has a assign char
             else if ( line.contains("=") ) {
@@ -135,7 +138,7 @@
                     }
 
                     // Store the key and value in the map.
-                    keyValueMap.insert(keyName, valueAsString );
+                    _keyValueMap.insert(keyName, valueAsString );
                 }
             }
         }