CrystalSpace

Public API Reference

iConfigManager Struct Reference
[Utilities]

The configuration manager is used to make a number of iConfigFile object appear like a single object. More...

#include <iutil/cfgmgr.h>

Inheritance diagram for iConfigManager:

Inheritance graph
[legend]
List of all members.

Public Types

enum  
enum  
 Default priority values (you may use other values if you want). More...

Public Member Functions

virtual iConfigFileAddDomain (char const *path, iVFS *, int priority)=0
 Add a configuration domain by loading it from a file.
virtual void AddDomain (iConfigFile *, int priority)=0
 Add a configuration domain.
virtual void FlushRemoved ()=0
 Flush all removed configuration files (only required in optimize mode).
virtual int GetDomainPriority (iConfigFile *) const =0
 Return the priority of a configuration domain.
virtual int GetDomainPriority (char const *path) const =0
 Return the priority of a configuration domain.
virtual iConfigFileGetDynamicDomain () const =0
 Return a pointer to the dynamic configuration domain.
virtual int GetDynamicDomainPriority () const =0
 Return the priority of the dynamic configuration domain.
virtual iConfigFileLookupDomain (char const *path) const =0
 Find the iConfigFile object for a registered domain.
virtual void RemoveDomain (char const *path)=0
 Remove a configuration domain.
virtual void RemoveDomain (iConfigFile *)=0
 Remove a configuration domain.
virtual void SetDomainPriority (iConfigFile *, int priority)=0
 Set the priority of a registered configuration domain.
virtual void SetDomainPriority (char const *path, int priority)=0
 Set the priority of a configuration domain.
virtual bool SetDynamicDomain (iConfigFile *)=0
 Change the dynamic domain.
virtual void SetDynamicDomainPriority (int priority)=0
 Set the priority of the dynamic configuration domain.

Detailed Description

The configuration manager is used to make a number of iConfigFile object appear like a single object.

To do this, each iConfigFile object (also called a 'domain') is assigned a priority value. Options from config files with higher priority override or shadow options from configuration objects with lower priority. The lower priority options are still present, so if you access the lower priority iConfigFile directly you will still find their real values. If two iConfigFile objects use the same priority value, then one will shadow the other (but it is not possible to predict which will be the victor).

One iConfigFile object is the so-called 'dynamic' domain. When you alter a setting in the configuration manager, the change is applied to the dynamic iConfigFile object. As a side-effect, the changed key is also removed from all objects with higher priority. The dynamic domain has always priority 0 (medium).

Differences in behaviour compared to a normal configuration object are:

Main creators of instances implementing this interface:

Main ways to get pointers to this interface:

Definition at line 77 of file cfgmgr.h.


Member Enumeration Documentation

anonymous enum

Default priority values (you may use other values if you want).

Definition at line 92 of file cfgmgr.h.


Member Function Documentation

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

Add a configuration domain by loading it from a file.

The new iConfigFile object which represents the loaded file is also returned. If you want to hold onto the iConfigFile even after it is removed from this object or after the configuration manager is destroyed, be sure to invoke IncRef() or assign it to a csRef<>. The incoming iVFS* may be null, in which case the path is assumed to point at a file in the physical filesystem, rather than at a file in the virtual filesystem.

Implemented in csConfigManager.

virtual void iConfigManager::AddDomain ( iConfigFile ,
int  priority 
) [pure virtual]

Add a configuration domain.

The configuration manager invokes IncRef() upon the incoming iConfigFile.

Implemented in csConfigManager.

virtual void iConfigManager::FlushRemoved (  )  [pure virtual]

Flush all removed configuration files (only required in optimize mode).

Implemented in csConfigManager.

virtual int iConfigManager::GetDomainPriority ( iConfigFile  )  const [pure virtual]

Return the priority of a configuration domain.

If the domain is not registered, PriorityMedium is returned.

Implemented in csConfigManager.

virtual int iConfigManager::GetDomainPriority ( char const *  path  )  const [pure virtual]

Return the priority of a configuration domain.

If the domain is not registered, PriorityMedium is returned.

Implemented in csConfigManager.

virtual iConfigFile* iConfigManager::GetDynamicDomain (  )  const [pure virtual]

Return a pointer to the dynamic configuration domain.

The returned pointer will remain valid as long as the domain is registered with the configuration manager.

Implemented in csConfigManager.

virtual int iConfigManager::GetDynamicDomainPriority (  )  const [pure virtual]

Return the priority of the dynamic configuration domain.

Implemented in csConfigManager.

virtual iConfigFile* iConfigManager::LookupDomain ( char const *  path  )  const [pure virtual]

Find the iConfigFile object for a registered domain.

Returns null if the domain is not registered.

Implemented in csConfigManager.

virtual void iConfigManager::RemoveDomain ( char const *  path  )  [pure virtual]

Remove a configuration domain.

Implemented in csConfigManager.

virtual void iConfigManager::RemoveDomain ( iConfigFile  )  [pure virtual]

Remove a configuration domain.

If registered, the configuration manager will relinquish its reference to the domain by invoking DecRef() on it to balance the IncRef() it performed when the domain was added. If the domain is not registered, the RemoveDomain() request is ignored. It is not legal to remove the dynamic domain. Note that if optimize is on then this removal will not take place until FlushRemoved() is called.

Implemented in csConfigManager.

virtual void iConfigManager::SetDomainPriority ( iConfigFile ,
int  priority 
) [pure virtual]

Set the priority of a registered configuration domain.

If the domain is not registered, the request is ignored.

Implemented in csConfigManager.

virtual void iConfigManager::SetDomainPriority ( char const *  path,
int  priority 
) [pure virtual]

Set the priority of a configuration domain.

Implemented in csConfigManager.

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

Change the dynamic domain.

The domain must already have been registered with AddDomain() before calling this method. If the domain is not registered, then false is returned.

Implemented in csConfigManager.

virtual void iConfigManager::SetDynamicDomainPriority ( int  priority  )  [pure virtual]

Set the priority of the dynamic configuration domain.

Implemented in csConfigManager.


The documentation for this struct was generated from the following file:
Generated for Crystal Space 1.0.2 by doxygen 1.4.7