Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

iConfigManager Struct Reference

The config manager is used to make a number of config file objects look like a single object. More...

#include <cfgmgr.h>

Inheritance diagram for iConfigManager:

iConfigFile iBase csConfigManager List of all members.

Public Types

enum  {
  PriorityMin = -1000000000, PriorityVeryLow = -100, PriorityLow = -50, PriorityMedium = 0,
  PriorityHigh = +50, PriorityVeryHigh = +100, PriorityMax = +1000000000
}
enum  {
  ConfigPriorityPlugin = PriorityVeryLow, ConfigPriorityApplication = PriorityLow, ConfigPriorityUserGlobal = PriorityMedium, ConfigPriorityUserApp = PriorityHigh,
  ConfigPriorityCmdLine = PriorityVeryHigh
}
 Default priority values (you may use other values if you want).


Public Methods

virtual void AddDomain (iConfigFile *, int priority)=0
 add a configuration domain.

virtual iConfigFileAddDomain (char const *path, iVFS *, int priority)=0
 Add a configuration domain. More...

virtual void RemoveDomain (iConfigFile *)=0
 remove a configuration domain.

virtual void RemoveDomain (char const *path)=0
 remove a configuration domain.

virtual iConfigFileLookupDomain (char const *path) const=0
 return a pointer to a single config domain.

virtual void SetDomainPriority (char const *path, int priority)=0
 set the priority of a config domain.

virtual void SetDomainPriority (iConfigFile *, int priority)=0
 set the priority of a config domain.

virtual int GetDomainPriority (char const *path) const=0
 return the priority of a config domain.

virtual int GetDomainPriority (iConfigFile *) const=0
 return the priority of a config domain.

virtual bool SetDynamicDomain (iConfigFile *)=0
 Change the dynamic domain. More...

virtual iConfigFileGetDynamicDomain () const=0
 return a pointer to the dynamic config domain.

virtual void SetDynamicDomainPriority (int priority)=0
 set the priority of the dynamic config domain.

virtual int GetDynamicDomainPriority () const=0
 return the priority of the dynamic config domain.

virtual void FlushRemoved ()=0
 flush all removed config files (only required in optimize mode).


Detailed Description

The config manager is used to make a number of config file objects look like a single object.

To do this, every config file object (also called 'domain') is assigned a priority value. Options from config files with higher priority override options from config files with lower priority. These 'lower' options are not really deleted, so if you access the 'lower' config file directly you will still find their real value. If two config objects use the same priority value, it is not defined which of them takes precedence.

One config object is the so-called 'dynamic' object. When you change something in the global configuration, these changes are applied to the dynamic config object. The changed key is removed from all objects with higher priority. The dynamic object is given to the config manager at construction and cannot be changed later. It has always priority 0 (medium).

Differences in behaviour compared to a normal confguration object are:

  • Deleting a key will not always remove the key from the configuration completely. It will only remove the key from the dyamic config object and all higher-priority objects and thus reveal the lower-priority value. This also applies to the Clear() method.
  • The Load() and Save() methods will load or save the configuration of the dynamic domain. The other domains are not affected by Load(), and Save() won't write any keys from other domains.
  • Iterators: If you change an option after an iterator has passed this option, it may appear again, this time with the new value. If you change the option while the iterator looks at it, you may even read it twice after this change, once with the old and once with the new value. In general it's a bad idea to change something while an iterator exists.


Member Function Documentation

iConfigFile * iConfigManager::AddDomain ( char const * path,
iVFS *,
int priority ) [pure virtual]
 

Add a configuration domain.

The new config file is also returned. If you want to store the pointer yourself, you must first IncRef it.

Reimplemented in csConfigManager.

bool iConfigManager::SetDynamicDomain ( iConfigFile * ) [pure virtual]
 

Change the dynamic domain.

The given config object must already be registered with AddDomain(). Returns false if this is not the case.

Reimplemented in csConfigManager.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000