UniversalIndentGUI 1.2.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
UiGuiIniFileParser Class Reference

UiGuiIniFileParser is a simple ini file format parser. More...

#include <UiGuiIniFileParser.h>

List of all members.

Public Member Functions

QStringList childGroups ()
 Returns the group/section names in the same order as they occurr in the ini file as QStringList.
 UiGuiIniFileParser (const QString &iniFileName)
 Directly loads and parses the file with name iniFileName.
 UiGuiIniFileParser (void)
 Init and empty all needed lists and strings.
QVariant value (const QString &keyName, const QString &defaultValue="")
 Returns the value of the defined keyName as QVariant.
 ~UiGuiIniFileParser (void)

Protected Member Functions

void init ()

Private Member Functions

void parseIniFile ()
 Parses the ini file and stores the key value pairs in the internal vectors keys and values.

Private Attributes

QString _iniFileName
QMap< QString, QVariant > _keyValueMap
std::vector< QString > _sections

Detailed Description

UiGuiIniFileParser is a simple ini file format parser.

These ini files need to have key-value pairs in the style "keyname=keyvalue". Groups can be defined by writing the groupname in the style [groupname] before some key-value pairs.

The reason why I use my own class instead of QSettings is mainly, that QSettings always internally sorts the groups alphabetically and also rewrites a settings file sorted. Very annoying for me.

Definition at line 32 of file UiGuiIniFileParser.h.


Constructor & Destructor Documentation

UiGuiIniFileParser::UiGuiIniFileParser ( void  )

Init and empty all needed lists and strings.

Definition at line 46 of file UiGuiIniFileParser.cpp.

References init().

Here is the call graph for this function:

UiGuiIniFileParser::UiGuiIniFileParser ( const QString &  iniFileName)

Directly loads and parses the file with name iniFileName.

Definition at line 54 of file UiGuiIniFileParser.cpp.

References _iniFileName, init(), and parseIniFile().

Here is the call graph for this function:

UiGuiIniFileParser::~UiGuiIniFileParser ( void  )

Definition at line 68 of file UiGuiIniFileParser.cpp.


Member Function Documentation

QStringList UiGuiIniFileParser::childGroups ( )

Returns the group/section names in the same order as they occurr in the ini file as QStringList.

Definition at line 75 of file UiGuiIniFileParser.cpp.

References _sections.

void UiGuiIniFileParser::init ( ) [protected]

Definition at line 61 of file UiGuiIniFileParser.cpp.

References _iniFileName, _keyValueMap, and _sections.

Referenced by UiGuiIniFileParser().

Here is the caller graph for this function:

void UiGuiIniFileParser::parseIniFile ( ) [private]

Parses the ini file and stores the key value pairs in the internal vectors keys and values.

Definition at line 102 of file UiGuiIniFileParser.cpp.

References _iniFileName, _keyValueMap, and _sections.

Referenced by UiGuiIniFileParser().

Here is the caller graph for this function:

QVariant UiGuiIniFileParser::value ( const QString &  keyName,
const QString &  defaultValue = "" 
)

Returns the value of the defined keyName as QVariant.

The keyName is assembled by a section name, a slash and the key name itself. For example if you wish to access the value of the following setting: [NiceSection]niceKeyName=2 you would have to call value("NiceSection/niceKeyName").

Definition at line 94 of file UiGuiIniFileParser.cpp.

References _keyValueMap.


Member Data Documentation

Definition at line 47 of file UiGuiIniFileParser.h.

Referenced by init(), parseIniFile(), and UiGuiIniFileParser().

QMap<QString, QVariant> UiGuiIniFileParser::_keyValueMap [private]

Definition at line 49 of file UiGuiIniFileParser.h.

Referenced by init(), parseIniFile(), and value().

std::vector<QString> UiGuiIniFileParser::_sections [private]

Definition at line 48 of file UiGuiIniFileParser.h.

Referenced by childGroups(), init(), and parseIniFile().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines