INI section representation. More...
#include <inisection.h>
Public Member Functions | |
IniSection () | |
Creates an invalid IniSection object. Such object should not be used for read/write operations. More... | |
IniSection (Ini *pIni, const QString §ionName) | |
Creates a valid IniSection object. More... | |
IniVariable | createSetting (const QString &name, const QVariant &data) |
Inits specified variable with specified data. More... | |
void | deleteSetting (const QString &name) |
Deletes specified variable. More... | |
bool | hasSetting (const QString &name) const |
true if setting of given name exists within the section. More... | |
bool | isNull () const |
If true, IniSection object is not valid and should not be used to perform any actions on the Ini file. More... | |
const QString & | name () const |
A name (or path) of this section with lettercase preserved. More... | |
IniVariable | operator[] (const QString &name) |
Calls setting(). More... | |
const IniVariable | operator[] (const QString &name) const |
Calls const retrieveSetting(). More... | |
IniVariable | retrieveSetting (const QString &name) |
Gets a variable but only if it already exists. More... | |
const IniVariable | retrieveSetting (const QString &name) const |
const version of retrieveSetting() More... | |
IniVariable | setting (const QString &name) |
Gets a variable. Creates it first if it doesn't exist yet. More... | |
void | setValue (const QString &key, const QVariant &value) |
Sets a variable directly. Omits the IniVariable system. More... | |
QVariant | value (const QString &key) const |
Retrieves a variable directly; omits the IniVariable system. More... | |
QVariant | value (const QString &key, QVariant defaultValue) const |
Retrieves a variable directly; omits the IniVariable system. More... | |
INI section representation.
Provides access to variables in specified INI file section.
Definition at line 40 of file inisection.h.
IniSection::IniSection | ( | ) |
Creates an invalid IniSection object. Such object should not be used for read/write operations.
IniSection::IniSection | ( | Ini * | pIni, |
const QString & | sectionName | ||
) |
Creates a valid IniSection object.
IniSection object will operate on specified Ini object and provide access to variables in specified section.
pIni | Pointer to Ini object on which this object will operate on. pIni is not deleted when this is deleted. pIni pointer is copied over when this is copied over. |
sectionName | Name of the section for which the variables will be accessed. |
Definition at line 47 of file inisection.cpp.
IniVariable IniSection::createSetting | ( | const QString & | name, |
const QVariant & | data | ||
) |
Inits specified variable with specified data.
This method serves specifically for init purposes. If variable exists already exists, data will not be modified.
name | Name of the variable to init. If '/' character is used, a variable in subsection will be accessed. |
data | Init data. This data will be assigned to variable if specified variable doesn't yet exist. |
Definition at line 57 of file inisection.cpp.
void IniSection::deleteSetting | ( | const QString & | name | ) |
Deletes specified variable.
name | Name of the variable to init. If '/' character is used, a variable in subsection will be accessed. |
Definition at line 69 of file inisection.cpp.
bool IniSection::hasSetting | ( | const QString & | name | ) | const |
true if setting of given name exists within the section.
Setting contents may be empty and this will still return true. false is returned only if setting doesn't exist at all.
Definition at line 78 of file inisection.cpp.
bool IniSection::isNull | ( | ) | const |
If true, IniSection object is not valid and should not be used to perform any actions on the Ini file.
Definition at line 84 of file inisection.cpp.
const QString & IniSection::name | ( | ) | const |
A name (or path) of this section with lettercase preserved.
Definition at line 89 of file inisection.cpp.
IniVariable IniSection::operator[] | ( | const QString & | name | ) |
Calls setting().
Definition at line 94 of file inisection.cpp.
const IniVariable IniSection::operator[] | ( | const QString & | name | ) | const |
Calls const retrieveSetting().
Definition at line 99 of file inisection.cpp.
IniVariable IniSection::retrieveSetting | ( | const QString & | name | ) |
Gets a variable but only if it already exists.
name | Name of the variable to init. If '/' character is used, a variable in subsection will be accessed. |
Definition at line 109 of file inisection.cpp.
const IniVariable IniSection::retrieveSetting | ( | const QString & | name | ) | const |
const version of retrieveSetting()
Definition at line 118 of file inisection.cpp.
IniVariable IniSection::setting | ( | const QString & | name | ) |
Gets a variable. Creates it first if it doesn't exist yet.
name | Name of the variable to init. If '/' character is used, a variable in subsection will be accessed. |
Definition at line 127 of file inisection.cpp.
void IniSection::setValue | ( | const QString & | key, |
const QVariant & | value | ||
) |
Sets a variable directly. Omits the IniVariable system.
key | Path to the variable name. May include subsections by using '/' character. |
value | New value for the variable. |
Definition at line 140 of file inisection.cpp.
QVariant IniSection::value | ( | const QString & | key | ) | const |
Retrieves a variable directly; omits the IniVariable system.
Definition at line 148 of file inisection.cpp.
QVariant IniSection::value | ( | const QString & | key, |
QVariant | defaultValue | ||
) | const |
Retrieves a variable directly; omits the IniVariable system.
Overload that returns defaultValue if requested value is invalid.
Definition at line 156 of file inisection.cpp.