#include <appconf.h>
Inheritance diagram for FileConfig:


Public Methods | |
| void | readFile (const char *szFileName) |
Constructors and destructor | |
| FileConfig (const char *szFileName, Bool bLocalOnly=FALSE, Bool bUseSubDir=FALSE) | |
| FileConfig (std::istream *iStream) | |
| FileConfig (void) | |
| ~FileConfig () | |
Implementation of inherited pure virtual functions | |
| const char* | readEntry (const char *szKey, const char *szDefault=NULL) const |
| long int | readEntry (const char *szKey, long int Default) const |
| double | readEntry (const char *szKey, double Default) const |
| Bool | writeEntry (const char *szKey, const char *szValue) |
| Bool | writeEntry (const char *szKey, long int Value) |
| Bool | writeEntry (const char *szKey, double Value) |
| Bool | deleteEntry (const char *szKey) |
| Bool | flush (Bool bCurrentOnly=FALSE) |
| permanently writes changes, returns TRUE on success. | |
| Bool | flush (std::ostream *oStream, Bool=FALSE) |
| writes changes to ostream, returns TRUE on success. | |
| Bool | parseLine (const char *psz) |
| parses one line of config file. | |
| void | changeCurrentPath (const char *szPath="") |
Enumeration | |
| Enumerator* | enumSubgroups () const |
| Enumerate subgroups of the current group. | |
| Enumerator* | enumEntries () const |
| Enumerate entries of the current group. | |
Protected Methods | |
| Bool | DeleteIfEmpty () |
| Bool | readStream (std::istream *istr, ConfigGroup *pRootGroup=NULL) |
| const char* | GlobalConfigFile () const |
| const char* | LocalConfigFile () const |
| void | Init () |
| trivial initialization of member variables (common to all ctors). | |
Protected Attributes | |
| ConfigGroup* | m_pRootGroup |
| ConfigGroup * | m_pCurGroup |
Private Methods | |
| void | AppendCommentLine (const char *psz=NULL) |
Private Attributes | |
| char* | m_szFileName |
| const char* | m_szFullFileName |
| unsigned | m_uiLine |
| Bool | m_bParsingLocal |
| Bool | m_bUseSubDir |
| char* | m_szComment |
# comments are allowed after either ';' or '#' (Win/UNIX standard)
# blank lines (as above) are ignored
# global entries are members of special (no name) top group
written_for = wxWindows
platform = Linux
# the start of the group 'Foo'
[Foo] # may put comments like this also
# following 3 lines are entries
key = value
another_key = " strings with spaces in the beginning should be quoted, \
otherwise the spaces are lost"
last_key = but you don't have to put " normally (nor quote them, like here)
# subgroup of the group 'Foo'
# (order is not important, only the name is: separator is '/', as in paths)
[Foo/Bar]
# entries prefixed with "!" are immutable, i.e. can't be changed if they are
# set in the system wide .conf file
!special_key = value
bar_entry = whatever
[Foo/Bar/Fubar] # depth is (theoretically :-) unlimited
# may have the same name as key in another section
bar_entry = whatever not
You {have read/write/delete}Entry functions (guess what they do) and also setCurrentPath to select current group. enum{Subgroups/Entries} allow you to get all entries in the config file (in the current group). Finally, flush() writes immediately all changed entries to disk (otherwise it would be done automatically in dtor) FileConfig manages not less than 2 config files for each program: global and local (or system and user if you prefer). Entries are read from both of them and the local entries override the global ones unless the latter is immutable (prefixed with '!') in which case a warning message is generated and local value is ignored. Of course, the changes are always written to local file only.
Definition at line 436 of file appconf.h.
|
|
FileConfig will <ll>
|
|
|
@memo Ctor for FileConfig for reading from a stream
|
|
|
Another constructor, creating an empty object. For use with the readFile() method. |
|
|
Notice that if you're interested in error code, you should use flush() function. @memo Dtor will save unsaved data. |
|
|
|
|
|
|
|
|
|
|
|
trivial initialization of member variables (common to all ctors).
|
|
|
|
|
|
Change the current path. Works like 'cd' and supports "..".
Reimplemented from BaseConfig. |
|
|
Delets the entry. Notice that there is intentionally no such function as deleteGroup: the group is automatically deleted when it's last entry is deleted. @memo Deletes the entry.
Reimplemented from BaseConfig. |
|
|
Enumerate entries of the current group.
Reimplemented from BaseConfig. |
|
|
Enumerate subgroups of the current group.
Reimplemented from BaseConfig. |
|
|
writes changes to ostream, returns TRUE on success.
|
|
|
permanently writes changes, returns TRUE on success.
Reimplemented from BaseConfig. |
|
|
parses one line of config file.
|
|
|
Get the value of an entry, or the default value, interpreted as a double value.
Reimplemented from BaseConfig. |
|
|
Get the value of an entry, or the default value, interpreted as a long integer.
Reimplemented from BaseConfig. |
|
|
Get the value of an entry, or the default value.
Reimplemented from BaseConfig. |
|
|
Like reading from a local configuration file, but takes a whole path as argument. No default configuration files used. Use with FileConfig() constructor. |
|
|
|
|
|
Set the value of an entry to a double value.
Reimplemented from BaseConfig. |
|
|
Set the value of an entry to a long int value.
Reimplemented from BaseConfig. |
|
|
Set the value of an entry.
Reimplemented from BaseConfig. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.2.6 written by Dimitri van Heesch,
© 1997-2001