IniSection Class Reference

INI section representation. More...

#include <inisection.h>

List of all members.

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 &sectionName)
 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.

Detailed Description

INI section representation.

Provides access to variables in specified INI file section.


Constructor & Destructor Documentation

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.

Parameters:
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.

Member Function Documentation

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.

Parameters:
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.
Returns:
IniVariable object that wraps around specified variable. A valid IniVariable object is returned both if variable was just created or already existed when createSetting() was called. IniVariable object is created by a call to retrieveSetting(). Invalid IniVariable is created if name is empty.
void IniSection::deleteSetting ( const QString &  name  ) 

Deletes specified variable.

Parameters:
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.

Parameters:
name Name of the variable to init. If '/' character is used, a variable in subsection will be accessed.
Returns:
IniVariable object that wraps around the variable. May be invalid if name is empty.
IniVariable IniSection::setting ( const QString &  name  ) 

Gets a variable. Creates it first if it doesn't exist yet.

Parameters:
name Name of the variable to init. If '/' character is used, a variable in subsection will be accessed.
Returns:
IniVariable object that wraps around the variable. May be invalid if name is empty.
void IniSection::setValue ( const QString &  key,
const QVariant &  value 
)

Sets a variable directly. Omits the IniVariable system.

Parameters:
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.

Returns:
QVariant object that denotes the variable. May be invalid if variable is not defined.

The documentation for this class was generated from the following files: