IniVariable Class Reference

INI variable representation. More...

#include <inivariable.h>

Public Member Functions

 IniVariable ()
 Creates an invalid IniVariable object. Such object should not be used for read/write operations. More...
 
 IniVariable (const IniSection &section, const QString &key)
 Creates a valid IniVariable object. 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 & key ()
 Name of the variable within the section. More...
 
 operator bool () const
 Convert value to boolean, if possible. It's done by converting to numValue() first, then to bool. More...
 
 operator float () const
 Attempts to convert the value to a float. More...
 
 operator int () const
 Attempts to convert the value to a integer. More...
 
 operator QString () const
 Attempts to convert the value to QString. More...
 
 operator short () const
 
 operator unsigned int () const
 
 operator unsigned short () const
 
QString operator* () const
 Attempts to convert the value to QString. More...
 
const IniVariableoperator= (const QString &str)
 
const IniVariableoperator= (const char *str)
 
const IniVariableoperator= (int i)
 
const IniVariableoperator= (unsigned int i)
 
const IniVariableoperator= (short i)
 
const IniVariableoperator= (unsigned short i)
 
const IniVariableoperator= (bool b)
 Sets the value to bool. More...
 
const IniVariableoperator= (float f)
 
void setValue (const QVariant &value)
 Explicitly sets the value from QVariant. More...
 
QVariant value () const
 Extracts the value as QVariant. More...
 
QString valueString () const
 Returns the underlying value as a QString. More...
 

Friends

class TestReadINIList
 
class TestReadINIVariable
 

Detailed Description

INI variable representation.

Structure containing variable's value and comments.

Definition at line 41 of file inivariable.h.

Constructor & Destructor Documentation

IniVariable::IniVariable ( )

Creates an invalid IniVariable object. Such object should not be used for read/write operations.

isNull() will return true.

IniVariable::IniVariable ( const IniSection section,
const QString &  key 
)

Creates a valid IniVariable object.

Definition at line 50 of file inivariable.cpp.

Member Function Documentation

bool IniVariable::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 150 of file inivariable.cpp.

const QString & IniVariable::key ( )

Name of the variable within the section.

Definition at line 145 of file inivariable.cpp.

IniVariable::operator bool ( ) const

Convert value to boolean, if possible. It's done by converting to numValue() first, then to bool.

Definition at line 60 of file inivariable.cpp.

IniVariable::operator float ( ) const

Attempts to convert the value to a float.

Definition at line 87 of file inivariable.cpp.

IniVariable::operator int ( ) const

Attempts to convert the value to a integer.

Definition at line 65 of file inivariable.cpp.

IniVariable::operator QString ( ) const
inline

Attempts to convert the value to QString.

Definition at line 101 of file inivariable.h.

QString IniVariable::operator* ( ) const
inline

Attempts to convert the value to QString.

Definition at line 96 of file inivariable.h.

const IniVariable & IniVariable::operator= ( bool  b)

Sets the value to bool.

The value is set by converting the bool to a integer, 0 for false and 1 for true.

Definition at line 132 of file inivariable.cpp.

void IniVariable::setValue ( const QVariant &  value)

Explicitly sets the value from QVariant.

Definition at line 155 of file inivariable.cpp.

QVariant IniVariable::value ( ) const

Extracts the value as QVariant.

Definition at line 160 of file inivariable.cpp.

QString IniVariable::valueString ( ) const
inline

Returns the underlying value as a QString.

Internally the value is always accessed as QVariant.

Definition at line 75 of file inivariable.h.


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