| Classes | Functions | DevRef | Qt API Qtopia Documentation

Config Class Reference

The Config class provides for saving application cofniguration state. More...

#include <config.h>

List of all member functions.

Public Members


Detailed Description

The Config class provides for saving application cofniguration state.

You should keep a Config in existence only while you do not want others to be able to change the state. There is no locking currently, but there may be in the future.


Member Type Documentation

Config::Domain

See Config() for details.


Member Function Documentation

Config::Config ( const QString & name, Domain domain = User )

Constructs a configuration object that will load or create a configuration with the given name in the given domain.

After construction, call setGroup() since almost every other function works in terms of the 'current group'.

In the default Domain, User, the configuration is user-specific, and the name should not contain "/". This name should be globally unique.

In the File Domain, name is an absolute filename.

Config::~Config ()

Writes any changes to disk and destroys the in-memory object.

void Config::clearGroup ()

Removes all entries from the current group.

See also removeEntry().

bool Config::hasKey ( const QString & key ) const

Returns TRUE if the current group has an entry called key; otherwise returns FALSE.

bool Config::isValid () const

Returns TRUE if the Config is in a valid state; otherwise returns FALSE.

bool Config::operator!= ( const Config & other ) const

Tests for inequality with other. Config objects are equal if they refer to the same filename.

See also operator==().

bool Config::operator== ( const Config & other ) const

Tests for equality with other. Config objects are equal if they refer to the same filename.

See also operator!=().

bool Config::readBoolEntry ( const QString & key, bool deflt = FALSE ) const

Returns the boolean entry stored (as an integer) using key, defaulting to deflt if there is no entry for the given key.

See also writeEntry().

QString Config::readEntry ( const QString & key, const QString & deflt = QString::null ) const

Returns the string entry for key, defaulting to deflt if there is no entry for the given key.

See also writeEntry().

QString Config::readEntryCrypt ( const QString & key, const QString & deflt = QString::null ) const

Returns the unencrypted string entry for the encrypted entry stored using key, defaulting to deflt if there is no entry for the given key.

See also writeEntryCrypt().

QStringList Config::readListEntry ( const QString & key, const QChar & sep ) const

Returns the string list entry stored using key and with sep as the separator.

These entries are stored as a single string, with each element separated by sep.

See also writeEntry().

int Config::readNumEntry ( const QString & key, int deflt = -1 ) const

Returns the integer entry stored using key, defaulting to deflt if there is no entry for the given key.

See also writeEntry().

void Config::removeEntry ( const QString & key )

Removes the key entry from the current group. Does nothing if there is no such entry.

See also writeEntry() and clearGroup().

void Config::setGroup ( const QString & gname )

Sets the current group for subsequent reading and writing of entries to gname. Grouping allows the application to partition the namespace.

This function must be called prior to any reading or writing of entries.

The gname must not be empty.

See also writeEntry(), readEntry(), readListEntry(), readNumEntry() and readBoolEntry().

void Config::writeEntry ( const QString & key, const char * value )

Writes a (key, value) entry to the current group.

See also readEntry().

void Config::writeEntry ( const QString & key, const QString & value )

Writes a (key, value) entry to the current group.

See also readEntry().

void Config::writeEntry ( const QString & key, int num )

Writes a (key, num) entry to the current group.

See also readNumEntry() and readBoolEntry().

void Config::writeEntry ( const QString & key, const QStringList & lst, const QChar & sep )

Writes a (key, lst) entry to the current group. The list is separated by sep, so the strings must not contain that character.

See also readListEntry().

void Config::writeEntryCrypt ( const QString & key, const QString & value )

Writes a weakly encrypted (key, value) entry to the current group.

Note that the degree of protection offered by the encryption is only sufficient to avoid the most casual observation of the configuration files.

See also readEntryCrypt().


This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.


Copyright © 2001-2002 TrolltechTrademarks
Qtopia version 1.5.0