#include <config-manager.h>
Classes | |
| class | Domain |
Public Types | |
| typedef HashMap< String, Domain, IgnoreCase_Hash, IgnoreCase_EqualTo > | DomainMap |
Public Member Functions | |
| bool | loadDefaultConfigFile (const Path &fallbackFilename) |
| bool | loadConfigFile (const Path &filename, const Path &fallbackFilename) |
| Domain * | getDomain (const String &domName) |
| const Domain * | getDomain (const String &domName) const |
| bool | hasDefault (const String &key) const |
| void | setAndFlush (const String &key, const Common::String &value) |
Generic access methods | |
No domain specified, use the values from the various domains in the order of their priority. | |
| bool | hasKey (const String &key) const |
| const String & | get (const String &key) const |
| void | set (const String &key, const String &value) |
Domain-specific access methods | |
Access one specific domain and modify it. TBD: Get rid of most of those if possible, or at least reduce their usage, by using getDomain as often as possible. For example in the options dialog code. | |
| bool | hasKey (const String &key, const String &domName) const |
| const String & | get (const String &key, const String &domName) const |
| void | set (const String &key, const String &value, const String &domName) |
| void | removeKey (const String &key, const String &domName) |
Static Public Attributes | |
| static char const *const | kApplicationDomain |
| static char const *const | kTransientDomain |
| static char const *const | kKeymapperDomain |
| static char const *const | kSessionDomain |
Additional convenience accessors | |
| int | getInt (const String &key, const String &domName=String()) const |
| bool | getBool (const String &key, const String &domName=String()) const |
| Path | getPath (const String &key, const String &domName=String()) const |
| float | getFloat (const String &key, const String &domName=String()) const |
| void | setInt (const String &key, int value, const String &domName=String()) |
| void | setBool (const String &key, bool value, const String &domName=String()) |
| void | setPath (const String &key, const Path &value, const String &domName=String()) |
| void | setFloat (const String &key, float value, const String &domName=String()) |
| void | registerDefault (const String &key, const String &value) |
| void | registerDefault (const String &key, const char *value) |
| void | registerDefault (const String &key, int value) |
| void | registerDefault (const String &key, bool value) |
| void | registerDefault (const String &key, const Path &value) |
| void | flushToDisk () |
| void | setActiveDomain (const String &domName) |
| Domain * | getActiveDomain () |
| const Domain * | getActiveDomain () const |
| const String & | getActiveDomainName () const |
| void | addGameDomain (const String &domName) |
| void | removeGameDomain (const String &domName) |
| void | renameGameDomain (const String &oldName, const String &newName) |
| void | addMiscDomain (const String &domName) |
| void | removeMiscDomain (const String &domName) |
| void | renameMiscDomain (const String &oldName, const String &newName) |
| bool | hasGameDomain (const String &domName) const |
| bool | hasMiscDomain (const String &domName) const |
| bool | isKeyTemporary (const String &key) const |
| const DomainMap & | getGameDomains () const |
| DomainMap::iterator | beginGameDomains () |
| DomainMap::iterator | endGameDomains () |
| const Path & | getCustomConfigFileName () |
| void | copyFrom (ConfigManager &source) |
| static void | defragment () |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< ConfigManager > | |
| static bool | hasInstance () |
| static ConfigManager & | instance () |
| static void | destroy () |
Protected Types inherited from Common::Singleton< ConfigManager > | |
| typedef ConfigManager | SingletonBaseType |
Static Protected Attributes inherited from Common::Singleton< ConfigManager > | |
| static ConfigManager * | _singleton |
The (singleton) configuration manager, used to query & set configuration values using string keys.
TBD: Implement the callback based notification system (outlined below) which sends out notifications to interested parties whenever the value of some specific (or any) configuration key changes.
| typedef HashMap<String, Domain, IgnoreCase_Hash, IgnoreCase_EqualTo> Common::ConfigManager::DomainMap |
A hash map of existing configuration domains.
| bool Common::ConfigManager::loadDefaultConfigFile | ( | const Path & | fallbackFilename | ) |
Load the default configuration file.
Load a specific configuration file.
Retrieve the config domain with the given name.
| domName | Name of the domain to retrieve. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| bool Common::ConfigManager::hasKey | ( | const String & | key | ) | const |
Check if a given key exists.
Assign a value to a key.
| bool Common::ConfigManager::hasDefault | ( | const String & | key | ) | const |
Indicate if a default value has been set for the given key.
| void Common::ConfigManager::setAndFlush | ( | const String & | key, |
| const Common::String & | value | ||
| ) |
Update a configuration entry for the active domain and flush the configuration file to disk if the value changed.
Check if a given key exists in the domName domain.
Get the value of a key from the domName domain.
| void Common::ConfigManager::set | ( | const String & | key, |
| const String & | value, | ||
| const String & | domName | ||
| ) |
Assign a value to a key in the domName domain.
Remove a key to a key from the domName domain.
Get integer value.
Get Boolean value.
Get path value.
| float Common::ConfigManager::getFloat | ( | const String & | key, |
| const String & | domName = String() |
||
| ) | const |
Get float value.
| void Common::ConfigManager::setInt | ( | const String & | key, |
| int | value, | ||
| const String & | domName = String() |
||
| ) |
Set integer value.
| void Common::ConfigManager::setBool | ( | const String & | key, |
| bool | value, | ||
| const String & | domName = String() |
||
| ) |
Set Boolean value.
| void Common::ConfigManager::setPath | ( | const String & | key, |
| const Path & | value, | ||
| const String & | domName = String() |
||
| ) |
Set path value.
| void Common::ConfigManager::setFloat | ( | const String & | key, |
| float | value, | ||
| const String & | domName = String() |
||
| ) |
Set float value.
Register a value as the default.
| void Common::ConfigManager::registerDefault | ( | const String & | key, |
| const char * | value | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void Common::ConfigManager::registerDefault | ( | const String & | key, |
| int | value | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void Common::ConfigManager::registerDefault | ( | const String & | key, |
| bool | value | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void Common::ConfigManager::flushToDisk | ( | ) |
Flush configuration to disk.
| void Common::ConfigManager::setActiveDomain | ( | const String & | domName | ) |
Set the given domain as active.
|
inline |
Get the active domain.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Get the name of the active domain.
| void Common::ConfigManager::addGameDomain | ( | const String & | domName | ) |
Add a new game domain.
| void Common::ConfigManager::removeGameDomain | ( | const String & | domName | ) |
Remove a game domain.
Rename a game domain.
| void Common::ConfigManager::addMiscDomain | ( | const String & | domName | ) |
Add a miscellaneous domain.
| void Common::ConfigManager::removeMiscDomain | ( | const String & | domName | ) |
Remove a miscellaneous domain.
Rename a miscellaneous domain.
| bool Common::ConfigManager::hasGameDomain | ( | const String & | domName | ) | const |
Check if a specific game domain exists in the DomainMap.
| bool Common::ConfigManager::hasMiscDomain | ( | const String & | domName | ) | const |
Check if a specific miscellaneous domain exists in the DomainMap.
| bool Common::ConfigManager::isKeyTemporary | ( | const String & | key | ) | const |
Check if a specific key exists in either transient or session domain.
|
inline |
Return all game domains in the DomainMap.
|
inline |
Return the beginning position of game domains.
|
inline |
Return the ending position of game domains.
|
inline |
Return the custom config file being used, or an empty string when using the default config file
|
static |
Move the configuration in memory to reduce fragmentation.
| void Common::ConfigManager::copyFrom | ( | ConfigManager & | source | ) |
Copy from a ConfigManager instance.
|
static |
The name of the application domain (normally 'scummvm').
|
static |
The transient (pseudo) domain.
|
static |
The name of keymapper domain used to store the key maps.
|
static |
The name of the session domain where configs are put for the entire session or until they are overwritten or removed. These settings don't get saved to disk.