INI section representation. More...
#include <inisection.h>
Classes | |
class | PrivData |
Public Member Functions | |
IniSection () | |
Creates an invalid IniSection object. Such object should not be used for read/write operations. | |
IniSection (Ini *pIni, const QString §ionName) | |
Creates a valid IniSection object. | |
IniVariable | createSetting (const QString &name, const QVariant &data) |
Inits specified variable with specified data. | |
void | deleteSetting (const QString &name) |
Deletes specified variable. | |
bool | isNull () const |
If true, IniSection object is not valid and should not be used to perform any actions on the Ini file. | |
IniVariable | retrieveSetting (const QString &name) |
Gets a variable but only if it already exists. | |
const IniVariable | retrieveSetting (const QString &name) const |
const version of retrieveSetting() | |
const QString & | sectionName () const |
Name (or path) of the current section. | |
IniVariable | setting (const QString &name) |
Gets a variable. Creates it first if it doesn't exist yet. | |
void | setValue (const QString &key, const QVariant &value) |
Sets a variable directly. Omits the IniVariable system. | |
IniVariable | operator[] (const QString &name) |
Calls setting(). | |
const IniVariable | operator[] (const QString &name) const |
Calls const retrieveSetting(). | |
QVariant | value (const QString &key) const |
Retrieves a variable directly. Omits the IniVariable system. |
INI section representation.
Provides access to variables in specified INI file section.
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. |
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. |
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. |
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. |
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. |
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. |
QVariant IniSection::value | ( | const QString & | key | ) | const |
Retrieves a variable directly. Omits the IniVariable system.