Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Private Attributes | List of all members
CConfigDB Class Reference

#include <ConfigDB.h>

Inheritance diagram for CConfigDB:
Singleton< CConfigDB >

Public Member Functions

 CConfigDB ()
 
CConfigValueGetValue (EConfigNamespace ns, const CStr &name)
 Attempt to find a config variable with the given name; will search CFG_COMMAND first, and then all namespaces from the specified namespace down to system. More...
 
CConfigValueSetGetValues (EConfigNamespace ns, const CStr &name)
 Attempt to retrieve a vector of values corresponding to the given setting; will search CFG_COMMAND first, and then all namespaces from the specified namespace down to system. More...
 
EConfigNamespace GetValueNamespace (EConfigNamespace ns, const CStr &name)
 Returns the namespace that the value returned by GetValues was defined in, or CFG_LAST if it wasn't defined at all. More...
 
std::map< CStr, CConfigValueSetGetValuesWithPrefix (EConfigNamespace ns, const CStr &prefix)
 Retrieve a map of values corresponding to settings whose names begin with the given prefix; will search all namespaces from system up to the specified namespace. More...
 
CConfigValueCreateValue (EConfigNamespace ns, const CStr &name)
 Create a new config value in the specified namespace. More...
 
void SetConfigFile (EConfigNamespace ns, const VfsPath &path)
 Set the path to the config file used to populate the specified namespace Note that this function does not actually load the config file. More...
 
bool Reload (EConfigNamespace)
 Reload the config file associated with the specified config namespace (the last config file path set with SetConfigFile) More...
 
bool WriteFile (EConfigNamespace ns, const VfsPath &path)
 Write the current state of the specified config namespace to the file specified by 'path'. More...
 
bool WriteFile (EConfigNamespace ns)
 Write the current state of the specified config namespace to the file it was originally loaded from. More...
 
- Public Member Functions inherited from Singleton< CConfigDB >
 Singleton ()
 
 ~Singleton ()
 

Static Private Attributes

static std::map< CStr,
CConfigValueSet
m_Map []
 
static VfsPath m_ConfigFile []
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< CConfigDB >
static CConfigDBGetSingleton ()
 
static CConfigDBGetSingletonPtr ()
 
static bool IsInitialised ()
 

Detailed Description

Definition at line 54 of file ConfigDB.h.

Constructor & Destructor Documentation

CConfigDB::CConfigDB ( )

Definition at line 33 of file ConfigDB.cpp.

Member Function Documentation

CConfigValue * CConfigDB::CreateValue ( EConfigNamespace  ns,
const CStr &  name 
)

Create a new config value in the specified namespace.

If such a variable already exists in this namespace, the old value is returned.

Returns a pointer to the value of the newly created config variable, or that of the already existing config variable.

Definition at line 113 of file ConfigDB.cpp.

CConfigValue * CConfigDB::GetValue ( EConfigNamespace  ns,
const CStr &  name 
)

Attempt to find a config variable with the given name; will search CFG_COMMAND first, and then all namespaces from the specified namespace down to system.

Returns a pointer to the config value structure for the variable, or NULL if such a variable could not be found.

Definition at line 37 of file ConfigDB.cpp.

EConfigNamespace CConfigDB::GetValueNamespace ( EConfigNamespace  ns,
const CStr &  name 
)

Returns the namespace that the value returned by GetValues was defined in, or CFG_LAST if it wasn't defined at all.

Definition at line 67 of file ConfigDB.cpp.

CConfigValueSet * CConfigDB::GetValues ( EConfigNamespace  ns,
const CStr &  name 
)

Attempt to retrieve a vector of values corresponding to the given setting; will search CFG_COMMAND first, and then all namespaces from the specified namespace down to system.

Returns a pointer to the vector, or NULL if the setting could not be found.

Definition at line 45 of file ConfigDB.cpp.

std::map< CStr, CConfigValueSet > CConfigDB::GetValuesWithPrefix ( EConfigNamespace  ns,
const CStr &  prefix 
)

Retrieve a map of values corresponding to settings whose names begin with the given prefix; will search all namespaces from system up to the specified namespace.

Definition at line 89 of file ConfigDB.cpp.

bool CConfigDB::Reload ( EConfigNamespace  ns)

Reload the config file associated with the specified config namespace (the last config file path set with SetConfigFile)

Returns: true: if the reload succeeded, false: if the reload failed

Definition at line 140 of file ConfigDB.cpp.

void CConfigDB::SetConfigFile ( EConfigNamespace  ns,
const VfsPath path 
)

Set the path to the config file used to populate the specified namespace Note that this function does not actually load the config file.

Use the Reload() method if you want to read the config file at the same time.

'path': The path to the config file.

Definition at line 129 of file ConfigDB.cpp.

bool CConfigDB::WriteFile ( EConfigNamespace  ns,
const VfsPath path 
)

Write the current state of the specified config namespace to the file specified by 'path'.

Returns: true: if the config namespace was successfully written to the file false: if an error occurred

Definition at line 236 of file ConfigDB.cpp.

bool CConfigDB::WriteFile ( EConfigNamespace  ns)

Write the current state of the specified config namespace to the file it was originally loaded from.

Returns: true: if the config namespace was successfully written to the file false: if an error occurred

Definition at line 225 of file ConfigDB.cpp.

Member Data Documentation

VfsPath CConfigDB::m_ConfigFile
staticprivate

Definition at line 57 of file ConfigDB.h.

TConfigMap CConfigDB::m_Map
staticprivate

Definition at line 56 of file ConfigDB.h.


The documentation for this class was generated from the following files: