Pyrogenesis  trunk
Public Member Functions | Static Private Attributes | List of all members
CConfigDB Class Reference

#include <ConfigDB.h>

Inheritance diagram for CConfigDB:
Inheritance graph
[legend]
Collaboration diagram for CConfigDB:
Collaboration graph
[legend]

Public Member Functions

 CConfigDB ()
 
void GetValue (EConfigNamespace ns, const CStr &name, bool &value)
 Attempt to retrieve the value of a config variable with the given name; will search CFG_COMMAND first, and then all namespaces from the specified namespace down. More...
 
void GetValue (EConfigNamespace ns, const CStr &name, int &value)
 Attempt to retrieve the value of a config variable with the given name; will search CFG_COMMAND first, and then all namespaces from the specified namespace down. More...
 
void GetValue (EConfigNamespace ns, const CStr &name, float &value)
 Attempt to retrieve the value of a config variable with the given name; will search CFG_COMMAND first, and then all namespaces from the specified namespace down. More...
 
void GetValue (EConfigNamespace ns, const CStr &name, double &value)
 Attempt to retrieve the value of a config variable with the given name; will search CFG_COMMAND first, and then all namespaces from the specified namespace down. More...
 
void GetValue (EConfigNamespace ns, const CStr &name, std::string &value)
 Attempt to retrieve the value of a config variable with the given name; will search CFG_COMMAND first, and then all namespaces from the specified namespace down. More...
 
bool HasChanges (EConfigNamespace ns) const
 Returns true if changed with respect to last write on file. More...
 
void SetChanges (EConfigNamespace ns, bool value)
 
void GetValues (EConfigNamespace ns, const CStr &name, CConfigValueSet &values) const
 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. More...
 
EConfigNamespace GetValueNamespace (EConfigNamespace ns, const CStr &name) const
 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) const
 Retrieve a map of values corresponding to settings whose names begin with the given prefix; will search all namespaces from default up to the specified namespace. More...
 
void SetValueString (EConfigNamespace ns, const CStr &name, const CStr &value)
 Save a config value in the specified namespace. More...
 
void SetValueBool (EConfigNamespace ns, const CStr &name, const bool value)
 
void RemoveValue (EConfigNamespace ns, const CStr &name)
 Remove a 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) const
 Write the current state of the specified config namespace to the file specified by 'path'. More...
 
bool WriteFile (EConfigNamespace ns) const
 Write the current state of the specified config namespace to the file it was originally loaded from. More...
 
bool WriteValueToFile (EConfigNamespace ns, const CStr &name, const CStr &value, const VfsPath &path)
 Write a config value to the file specified by 'path'. More...
 
bool WriteValueToFile (EConfigNamespace ns, const CStr &name, const CStr &value)
 
- Public Member Functions inherited from Singleton< CConfigDB >
 Singleton ()
 
 ~Singleton ()
 

Static Private Attributes

static std::map< CStr, CConfigValueSetm_Map []
 
static VfsPath m_ConfigFile []
 
static bool m_HasChanges []
 

Additional Inherited Members

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

Constructor & Destructor Documentation

CConfigDB::CConfigDB ( )

Member Function Documentation

void CConfigDB::GetValue ( EConfigNamespace  ns,
const CStr &  name,
bool &  value 
)

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

void CConfigDB::GetValue ( EConfigNamespace  ns,
const CStr &  name,
int &  value 
)

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

void CConfigDB::GetValue ( EConfigNamespace  ns,
const CStr &  name,
float &  value 
)

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

void CConfigDB::GetValue ( EConfigNamespace  ns,
const CStr &  name,
double &  value 
)

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

void CConfigDB::GetValue ( EConfigNamespace  ns,
const CStr &  name,
std::string &  value 
)

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

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

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

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

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.

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

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

bool CConfigDB::HasChanges ( EConfigNamespace  ns) const

Returns true if changed with respect to last write on file.

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

void CConfigDB::RemoveValue ( EConfigNamespace  ns,
const CStr &  name 
)

Remove a config value in the specified namespace.

void CConfigDB::SetChanges ( EConfigNamespace  ns,
bool  value 
)
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.

void CConfigDB::SetValueBool ( EConfigNamespace  ns,
const CStr &  name,
const bool  value 
)
void CConfigDB::SetValueString ( EConfigNamespace  ns,
const CStr &  name,
const CStr &  value 
)

Save a config value in the specified namespace.

If the config variable existed the value is replaced.

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

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

bool CConfigDB::WriteFile ( EConfigNamespace  ns) const

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

bool CConfigDB::WriteValueToFile ( EConfigNamespace  ns,
const CStr &  name,
const CStr &  value,
const VfsPath path 
)

Write a config value to the file specified by 'path'.

Returns: true: if the config value was successfully saved and written to the file false: if an error occurred

bool CConfigDB::WriteValueToFile ( EConfigNamespace  ns,
const CStr &  name,
const CStr &  value 
)

Member Data Documentation

VfsPath CConfigDB::m_ConfigFile
staticprivate
bool CConfigDB::m_HasChanges
staticprivate
TConfigMap CConfigDB::m_Map
staticprivate

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