In file ../core/Kconfig.h:

class KConfig

KDE configuration entries.

public members:

KConfig ( QTextStream* pStream = NULL )
Construct a KConfig object.
~KConfig ()
Destroy the KConfig object and write back dirty config entries.
void setGroup ( const QString& rGroup )
Set the group in which to search for keys.
const QString& getGroup () const
Retrieve the current group.
QString readEntry ( const QString& rKey ) const
Read the value associated with rKey
int KConfig::readNumEntry ( const QString& rKey ) const
Read a numerical value
QString writeEntry ( const QString& rKey, const QString& rValue, bool bPersistent = true )
Write the key/value pair
QString KConfig::writeEntry ( const QString& rKey, int rValue, bool bPersistent = true )
Write the key value pair
void rollback ( bool bDeep = true )
Don't write dirty entries at destruction time.
void sync ()
Flush the entry cache.
bool hasKey ( const QString& rKey ) const
Check if there is a value for rKey.

Documentation

The KConfig class encapsulates all the configuration entries for one application, independent of the configuration files they came from. All configuration entries are of the form "key=value" and belong to a certain group. A group can be specified in a configuration file with "[GroupName]". All configuration entries from the beginning of a configuration file to the first group declaration belong to a special group called the default group.
KConfig ( QTextStream* pStream = NULL )
Construct a KConfig object. Files searched will be all standard config files and the file given by pStream (if pStream != NULL ). The QFile associated with QTextStream already must be opened.

~KConfig ()
Destructor. Writes back any dirty configuration entries.

void setGroup ( const QString& rGroup )
Specify the group in whcih keys will be searched Switch back to the default group by passing an empty string.

const QString& getGroup () const
Retrieve the group where keys are currently searched in.

QString readEntry ( const QString& rKey ) const
Read the value of an entry specified by rKey in the current group

int KConfig:: readNumEntry ( const QString& rKey ) const
Read the value of an entry specified by rKey in the current group and interpret it numerically.

QString writeEntry ( const QString& rKey, const QString& rValue, bool bPersistent = true )
Write the key/value pair. This is stored to the most specific config file when destroying the config object or when calling Sync(). The old value for this key is returned. If this key did not exist, a NULL string is returned. If bPersistent is false, the entry's dirty flag will not be set and thus the entry will not be written to disk at deletion time.

QString KConfig:: writeEntry ( const QString& rKey, int rValue, bool bPersistent = true )
Same as above, but write a numerical value.

void rollback ( bool bDeep = true )
Don't write dirty entries at destruction time. If bDeep is false, only the global dirty flag of the KConfig object gets cleared. If you then call WriteEntry again, the global dirty flag is set again and all dirty entries will be written. If bDeep is true, the dirty flags of all entries are cleared, as well as the global dirty flag.

void sync ()
Write back dirty configuration entries to the most specific file. This is called automatically from the destructor.

bool hasKey ( const QString& rKey ) const
Check if the key has an entry in the specified group Use this to determine if a key is not specified for the current group (HasKey returns false) or is specified but has no value ("key =EOL"; Has Key returns true, ReadEntry returns an empty string)


this class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling