Config Class Reference
The Config class provides for saving application configuration state.
More...
#include <qtopia/config.h>
List of all member functions.
Public Members
Config ( const QString & name, Domain domain = User )
bool
hasKey ( const QString & key ) const
void
writeEntry ( const QString & key, const char * value )
void
writeEntry ( const QString & key, const QString & value )
void
writeEntry ( const QString & key, const QStringList & lst, const QChar & sep )
void
writeEntry ( const QString & key, const QByteArray & byteArray )
QString
readEntry ( const QString & key, const QString & deflt = QString::null ) const
QString
readEntryCrypt ( const QString & key, const QString & deflt = QString::null ) const
int
readNumEntry ( const QString & key, int deflt = -1 ) const
bool
readBoolEntry ( const QString & key, bool deflt = FALSE ) const
QStringList
readListEntry ( const QString & key, const QChar & sep ) const
Detailed Description
The Config class provides for saving application configuration 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.
Note that in Qtopia before 1.6, the 'const' forms of the read functions
where not available.
See also Qtopia Classes.
Member Type Documentation
Config::Domain
- Config::File
- Config::User
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().
QByteArray Config::readByteArrayEntry ( const QString & key ) const
Returns the QByteArray stored using key. Returns an empty array if
no matching key is found.
First availability: Qtopia 1.6
QByteArray Config::readByteArrayEntry ( const QString & key, const QByteArray & dflt ) const
Returns the QByteArray stored using key. Returns dflt if
no matching key is found.
First availability: Qtopia 1.6
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::writeEntry ( const QString & key, const QByteArray & byteArray )
Writes a (key, byteArray) entry to the current group. The byteArray is stored as
a base64 encoded string.
First availability: Qtopia 1.6
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 Trolltech | Trademarks
| Qtopia version 1.7.1
|