Config Class Reference
The Config class provides for saving application cofniguration state. More...
#include <config.h>
Collaboration diagram for Config:

Public Types | |
| typedef QMap< QString, QString > | ConfigGroup |
| enum | Domain { File, User } |
Public Member Functions | |
| Config (const QString &name, Domain domain=User) | |
| ~Config () | |
| bool | operator== (const Config &other) const |
| bool | operator!= (const Config &other) const |
| bool | isValid () const |
| bool | hasKey (const QString &key) const |
| bool | hasGroup (const QString &gname) const |
| QStringList | groupList () const |
| void | setGroup (const QString &gname) |
| void | writeEntry (const QString &key, const char *value) |
| void | writeEntry (const QString &key, const QString &value) |
| void | writeEntryCrypt (const QString &key, const QString &value) |
| void | writeEntry (const QString &key, int num) |
| void | writeEntry (const QString &key, const QStringList &lst, const QChar &sep) |
| void | removeEntry (const QString &key) |
| QString | readEntry (const QString &key, const QString &deflt=QString::null) const |
| QString | readEntryCrypt (const QString &key, const QString &deflt=QString::null) const |
| QString | readEntryDirect (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 |
| QString | readEntry (const QString &key, const QString &deflt) |
| QString | readEntryCrypt (const QString &key, const QString &deflt) |
| QString | readEntryDirect (const QString &key, const QString &deflt) |
| int | readNumEntry (const QString &key, int deflt) |
| bool | readBoolEntry (const QString &key, bool deflt) |
| QStringList | readListEntry (const QString &key, const QChar &sep) |
| void | clearGroup () |
| void | write (const QString &fn=QString::null) |
Protected Member Functions | |
| void | read () |
| bool | parse (const QString &line) |
Static Protected Member Functions | |
| QString | configFilename (const QString &name, Domain) |
Protected Attributes | |
| QMap< QString, ConfigGroup > | groups |
|
QMap< QString, ConfigGroup >::Iterator | git |
| QString | filename |
| QString | lang |
| QString | glang |
| bool | changed |
| ConfigPrivate * | d |
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.
Definition at line 30 of file config.h.
Member Enumeration Documentation
|
|
File User See Config for details. |
Constructor & Destructor Documentation
|
||||||||||||
|
Constructs a config that will load or create a configuration with the given name in the given domain. You must call setGroup() before doing much else with the Config. In the default Domain, User, the configuration is user-specific. name should not contain "/" in this case, and in general should be the name of the C++ class that is primarily responsible for maintaining the configuration. In the File Domain, name is an absolute filename. Definition at line 95 of file config.cpp. References QMap< QString, ConfigGroup >::end(). |
|
|
Writes any changes to disk and destroys the in-memory object. Definition at line 120 of file config.cpp. |
Member Function Documentation
|
|
Tests for equality with other. Config objects are equal if they refer to the same filename. Definition at line 39 of file config.h. References filename. |
|
|
Tests for inequality with other. Config objects are equal if they refer to the same filename. Definition at line 40 of file config.h. References filename. |
|
|
Returns whether the Config is in a valid state. Definition at line 501 of file config.cpp. References QMap< QString, ConfigGroup >::end(). Referenced by AppLnk::AppLnk(). |
|
|
Returns whether the current group has an entry called key. Definition at line 129 of file config.cpp. References QMap< QString, ConfigGroup >::end(). |
|
|
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. Definition at line 146 of file config.cpp. References QMap< QString, ConfigGroup >::end(), QMap< QString, ConfigGroup >::find(), and QMap< QString, ConfigGroup >::insert(). Referenced by AppLnk::AppLnk(). |
|
||||||||||||
|
Writes a (key, value) entry to the current group.
Definition at line 162 of file config.cpp. Referenced by AppLnk::setProperty(), and writeEntry(). |
|
||||||||||||
|
Writes a (key, value) entry to the current group.
Definition at line 172 of file config.cpp. References QMap< QString, ConfigGroup >::end(). |
|
||||||||||||
|
Writes an 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.
Definition at line 232 of file config.cpp. References QMap< QString, ConfigGroup >::end(). |
|
||||||||||||
|
Writes a (key, num) entry to the current group.
Definition at line 250 of file config.cpp. References writeEntry(). |
|
||||||||||||||||
|
Writes a (key, lst) entry to the current group. The list is separated by sep, so the strings must not contain that character.
Definition at line 278 of file config.cpp. References QValueList::begin(), QValueList::end(), and writeEntry(). |
|
|
Removes the key entry from the current group. Does nothing if there is no such entry. Definition at line 292 of file config.cpp. References QMap< QString, ConfigGroup >::end(). |
|
||||||||||||
|
Reads a string entry stored with key, defaulting to deflt if there is no entry. Definition at line 96 of file config.h. Referenced by AppLnk::AppLnk(), and AppLnk::property(). |
|
||||||||||||
|
Reads an encrypted string entry stored with key, defaulting to deflt if there is no entry. |
|
||||||||||||
|
Reads a numeric entry stored with key, defaulting to deflt if there is no entry. |
|
||||||||||||
|
Reads a bool entry stored with key, defaulting to deflt if there is no entry. |
|
||||||||||||
|
Reads a string list entry stored with key, and with sep as the separator. Definition at line 106 of file config.h. Referenced by AppLnk::AppLnk(). |
|
|
Removes all entries from the current group. Definition at line 438 of file config.cpp. References QMap< QString, ConfigGroup >::end(). |
The documentation for this class was generated from the following files:
