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 §ion, const QString &key) | |
Creates a valid IniVariable object, provided that the section is also valid. More... | |
bool | isNull () const |
If true, IniVariable 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 IniVariable & | operator= (const QString &str) |
const IniVariable & | operator= (const char *str) |
const IniVariable & | operator= (int i) |
const IniVariable & | operator= (unsigned int i) |
const IniVariable & | operator= (short i) |
const IniVariable & | operator= (unsigned short i) |
const IniVariable & | operator= (bool b) |
Sets the value to bool. More... | |
const IniVariable & | operator= (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 |
INI variable representation.
Structure containing variable's value and comments.
Definition at line 41 of file inivariable.h.
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, provided that the section is also valid.
Definition at line 50 of file inivariable.cpp.
bool IniVariable::isNull | ( | ) | const |
If true, IniVariable 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.
|
inline |
Attempts to convert the value to QString.
Definition at line 111 of file inivariable.h.
|
inline |
Attempts to convert the value to QString.
Definition at line 103 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.
|
inline |
Returns the underlying value as a QString.
Internally the value is always accessed as QVariant.
Definition at line 76 of file inivariable.h.