#include <simplecfg.h>
Groups in the configuration file start with a group name embraced with rectangular braces ([groupname]). The key/value pairs following this group name belong to this group.
Normally you should not use this class but instead SimpleCfg which gives you full control over the configuration file.
SimpleCfg is licensed under GPL
bool SimpleCfgGroup::contains (const QString & key) |
Check if configuration contains key named key.
key | Name of key to look for |
void SimpleCfgGroup::setInt (const QString & key, int val) |
Set integer value.
If the key does not exist it is created
key | Key to be searched for |
val | Value to be assigned to key |
int SimpleCfgGroup::getInt (const QString & key, int def) |
Retrieve integer value.
If the key does not exist it is created with the default value.
key | Key to be searched for |
def | Default value to be returned if key not found |
void SimpleCfgGroup::setDouble (const QString & key, double val) |
Set double value.
If the key does not exist it is created
key | Key to be searched for |
val | Value to be assigned to key |
double SimpleCfgGroup::getDouble (const QString & key, double def) |
Retrieve double value.
If the key does not exist it is created with the default value.
key | Key to be searched for |
def | Default value to be returned if key not found |
void SimpleCfgGroup::setString (const QString & key, const QString & val) |
Set string value.
If the key does not exist it is created
key | Key to be searched for |
val | Value to be assigned to key |
QString SimpleCfgGroup::getString (const QString & key, const QString & def) |
Retrieve string value.
If the key does not exist it is created with the default value.
key | Key to be searched for |
def | Default value to be returned if key not found |
void SimpleCfgGroup::setRGB (const QString & key, QRgb val) |
Set QRgb (unsigned long) value.
If the key does not exist it is created
key | Key to be searched for |
val | Value to be assigned to key |
QRgb SimpleCfgGroup::getRGB (const QString & key, QRgb def) |
Retrieve QRgb value (basically unsigned long).
If the key does not exist it is created with the default value.
key | Key to be searched for |
def | Default value to be returned if key not found |
void SimpleCfgGroup::setBool (const QString & key, bool val) |
Set bool value.
If the key does not exist it is created
key | Key to be searched for |
val | Value to be assigned to key |
bool SimpleCfgGroup::getBool (const QString & key, bool def) |
Retrieve bool value.
If the key does not exist it is created with the default value. The bool values appear as "true"/"false" in the configuration file.
key | Key to be searched for |
val | Default value to be returned if key not found |
QMap<QString,QString>::Iterator SimpleCfgGroup::begin () [inline]
|
Access iterator over keys.
If there are no keys this member returns SimpleCfgGroup::end().
If you want to iterate through the keys you'll need code like the following:
QMap<QString,QString>::Iterator it; for (it=group.begin(); it != group.end(); ++it) { // it.key() returns the key // it.data() returns the value as string }
QMap<QString,QString>::Iterator SimpleCfgGroup::end () [inline]
|