#include <cfgmgr.h>
Inheritance diagram for csConfigManager:
Public Methods | |
csConfigManager (iConfigFile *DynamicDomain, bool Optimize) | |
Create a new config manager object. More... | |
virtual | ~csConfigManager () |
delete this config manager. | |
virtual void | AddDomain (iConfigFile *, int priority) |
add a configuration domain. | |
virtual iConfigFile* | AddDomain (char const *path, iVFS *, int priority) |
add a configuration domain. | |
virtual void | RemoveDomain (iConfigFile *) |
remove a configuration domain. | |
virtual void | RemoveDomain (char const *path) |
remove a configuration domain. | |
virtual iConfigFile* | LookupDomain (char const *path) const |
return a pointer to a single config domain. | |
virtual void | SetDomainPriority (char const *path, int priority) |
set the priority of a config domain. | |
virtual void | SetDomainPriority (iConfigFile *, int priority) |
set the priority of a config domain. | |
virtual int | GetDomainPriority (char const *path) const |
return the priority of a config domain. | |
virtual int | GetDomainPriority (iConfigFile *) const |
return the priority of a config domain. | |
virtual bool | SetDynamicDomain (iConfigFile *) |
Change the dynamic domain. More... | |
virtual iConfigFile* | GetDynamicDomain () const |
return a pointer to the dynamic config domain. | |
virtual void | SetDynamicDomainPriority (int priority) |
set the priority of the dynamic config domain. | |
virtual int | GetDynamicDomainPriority () const |
return the priority of the dynamic config domain. | |
virtual void | FlushRemoved () |
flush all removed config files (only required in optimize mode). | |
virtual const char* | GetFileName () const |
Get configuration file name. More... | |
virtual iVFS* | GetVFS () const |
Get the VFS object on which this file is stored (if any). More... | |
virtual void | SetFileName (const char *, iVFS *) |
Set config file name. More... | |
virtual bool | Load (const char *iFileName, iVFS *=NULL, bool Merge=false, bool NewWins=true) |
Load a configuration file. More... | |
virtual bool | Save () |
Save configuration to the same place from which it was loaded. More... | |
virtual bool | Save (const char *iFileName, iVFS *=NULL) |
Save configuration into the given file (on VFS or on the physical filesystem). More... | |
virtual void | Clear () |
Delete all options and rewind all iterators. | |
virtual iConfigIterator* | Enumerate (const char *Subsection=NULL) |
Enumerate selected keys. More... | |
virtual bool | KeyExists (const char *Key) const |
Test if a key exists. | |
virtual bool | SubsectionExists (const char *Subsection) const |
Test if at least one key exists with the given Subsection prefix. | |
virtual int | GetInt (const char *Key, int Def=0) const |
Get an integer value from the configuration. | |
virtual float | GetFloat (const char *Key, float Def=0.0) const |
Get a float value from the configuration. | |
virtual const char* | GetStr (const char *Key, const char *Def="") const |
Get a string value from the configuration. | |
virtual bool | GetBool (const char *Key, bool Def=false) const |
Get a boolean value from the configuration. | |
virtual const char* | GetComment (const char *Key) const |
Get the comment of the given key, or NULL if no comment exists. | |
virtual void | SetStr (const char *Key, const char *Val) |
Set an null-terminated string value. | |
virtual void | SetInt (const char *Key, int Value) |
Set an integer value. | |
virtual void | SetFloat (const char *Key, float Value) |
Set a floating-point value. | |
virtual void | SetBool (const char *Key, bool Value) |
Set a boolean value. | |
virtual bool | SetComment (const char *Key, const char *Text) |
Set the comment for given key. More... | |
virtual void | DeleteKey (const char *Key) |
Delete a key and its value and comment. | |
virtual const char* | GetEOFComment () const |
return the final comment at the end of the configuration file. | |
virtual void | SetEOFComment (const char *Text) |
set the final comment at the end of the configuration file. | |
Public Attributes | |
SCF_DECLARE_IBASE | |
Friends | |
class | csConfigManagerIterator |
See the description of the SCF interface iConfigManager for full details.
|
Create a new config manager object. If 'Optimize' is set to 'true', then the config manager will enable some optimizations, which you may or may not want:
|
|
Enumerate selected keys. If a subsection is given, only those keys which are prefixed by the subsection string will be enumerated. The returned iterator does not yet point to a valid key. You must call Next() to set it to the first key. Reimplemented from iConfigFile. |
|
Get configuration file name. Also consult GetVFS() to determine which (if any) VFS object was used for the file's storage. Reimplemented from iConfigFile. |
|
Get the VFS object on which this file is stored (if any). Returns NULL if this file resides within the real (non-VFS) filesystem. Reimplemented from iConfigFile. |
|
Load a configuration file.
If the file resides in a real filesystem, rather than a VFS filesystem, then pass NULL for the VFS argument. This will clear all options before loading the new options, even if the file cannot be opened. You can set the Merge flag to merge the newly loaded configuration information into the existing information. If you do so, nothing will happen if the named file doesn't exist. The NewWins flag determines the behavior in case of configuration key conflicts. If true, then the new configuration value replaces the old for that key. If false, then the old value is kept, and the new value is ignored. The recorded file name will be set to the name of the newly loaded file if the Merge flag is false; otherwise it will retain the old name. Reimplemented from iConfigFile. |
|
Save configuration into the given file (on VFS or on the physical filesystem). If the second parameter is skipped, the file will be written to the physical filesystem, otherwise it is stored on given VFS filesystem. This method does not change the internally stored file name. Reimplemented from iConfigFile. |
|
Save configuration to the same place from which it was loaded. Returns true if the save operation succeeded. Reimplemented from iConfigFile. |
|
Set the comment for given key. In addition to an actual comment, you can use "" for Text to place an empty comment line before this key, or NULL to remove the comment entirely. The comment may contain newline characters. Returns false if the key does not exist. Reimplemented from iConfigFile. |
|
Change the dynamic domain. The given config object must already be registered with AddDomain(). Returns false if this is not the case. Reimplemented from iConfigManager. |
|
Set config file name. You can use this if you want Save() to write to another file. This will set the dirty flag. Reimplemented from iConfigFile. |