Main Page   Compound List   Header Files   Compound Members  

SimpleCfgGroup Class Reference

Encapsulates a group (section) in the configuration file. More...

#include <simplecfg.h>

List of all members.

Public Members

Protected Members


Detailed Description

Encapsulates a group (section) in the configuration file.

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

Author(s):
Matthias Toussaint, © 2000 Matthias Toussaint

Member Function Documentation

bool SimpleCfgGroup::contains (const QString & key)

Check if configuration contains key named key.

Parameters:
key   Name of key to look for
Returns:
true if found

void SimpleCfgGroup::setInt (const QString & key, int val)

Set integer value.

If the key does not exist it is created

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

Parameters:
key   Key to be searched for
def   Default value to be returned if key not found
Returns:
Value of key or default value

void SimpleCfgGroup::setDouble (const QString & key, double val)

Set double value.

If the key does not exist it is created

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

Parameters:
key   Key to be searched for
def   Default value to be returned if key not found
Returns:
Value of key or default value

void SimpleCfgGroup::setString (const QString & key, const QString & val)

Set string value.

If the key does not exist it is created

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

Parameters:
key   Key to be searched for
def   Default value to be returned if key not found
Returns:
Value of key or default value

void SimpleCfgGroup::setRGB (const QString & key, QRgb val)

Set QRgb (unsigned long) value.

If the key does not exist it is created

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

Parameters:
key   Key to be searched for
def   Default value to be returned if key not found
Returns:
Value of key or default value

void SimpleCfgGroup::setBool (const QString & key, bool val)

Set bool value.

If the key does not exist it is created

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

Parameters:
key   Key to be searched for
val   Default value to be returned if key not found
Returns:
Value of key or default value

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]

Access end value for iterator.

See also:
SimpleCfgGroup::begin()

The documentation for this class was generated from the following files:
Generated at Sat Nov 11 18:45:04 2000 for SimpleCfg by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999