|
xoreos
0.0.5
|
The global config manager, storing all config keys. More...
#include <configman.h>


Public Member Functions | |
| ConfigManager () | |
| ~ConfigManager () | |
| UString | getConfigFile () const |
| Return the config file that's currently in use. More... | |
| void | setConfigFile (const UString &file="") |
| Set the config file to use. More... | |
| void | clear () |
| Clear everything except the command line options. More... | |
| void | clearCommandline () |
| Clear the command line options. More... | |
| bool | fileExists () const |
| Does the config file exist? More... | |
| bool | changed () const |
| Was at least on setting changed? More... | |
| bool | load () |
| Load from the default config file. More... | |
| void | load (SeekableReadStream &stream) |
| Load from a generic read stream. More... | |
| bool | save () |
| Save to the default config file. More... | |
| void | save (WriteStream &stream, bool clearChanged=false) |
| Save to a generic write stream. More... | |
| void | create () |
| Create a new, empty config. More... | |
| UString | findGame (const UString &path) |
| Find the game domain using this path. More... | |
| UString | createGame (const UString &path, UString target="") |
| Create the game domain with this path and target. More... | |
| bool | hasGame (const UString &gameID) |
| Does the specified game domain exist? More... | |
| bool | setGame (const UString &gameID="") |
| Set the game domain to gameID. More... | |
| bool | isInGame () const |
| Are we currently in a game? More... | |
| bool | hasKey (const UString &key) const |
| bool | getKey (const UString &key, UString &value) const |
| UString | getString (const UString &key) const |
| bool | getBool (const UString &key) const |
| int | getInt (const UString &key) const |
| double | getDouble (const UString &key) const |
| UString | getString (const UString &key, const UString &def) const |
| bool | getBool (const UString &key, bool def) const |
| int | getInt (const UString &key, int def) const |
| double | getDouble (const UString &key, double def) const |
| void | setKey (const UString &key, const UString &value, bool update=false) |
| void | setString (const UString &key, const UString &value, bool update=false) |
| void | setBool (const UString &key, bool value, bool update=false) |
| void | setInt (const UString &key, int value, bool update=false) |
| void | setDouble (const UString &key, double value, bool update=false) |
| void | setKey (ConfigRealm realm, const UString &key, const UString &value) |
| Set a config value in a specific realm. More... | |
| void | setString (ConfigRealm realm, const UString &key, const UString &value) |
| void | setBool (ConfigRealm realm, const UString &key, bool value) |
| void | setInt (ConfigRealm realm, const UString &key, int value) |
| void | setDouble (ConfigRealm realm, const UString &key, double value) |
| void | setDefaults () |
| Overwrite the current config with the defaults. More... | |
| bool | hasDefaultKey (const UString &key) const |
| UString | getDefaultKey (const UString &key) const |
| UString | getDefaultString (const UString &key) const |
| bool | getDefaultBool (const UString &key) const |
| int | getDefaultInt (const UString &key) const |
| double | getDefaultDouble (const UString &key) const |
| void | setCommandlineKey (const UString &key, const UString &value) |
| Set a config value that came from the command line. More... | |
Private Member Functions | |
| UString | createGameID (const UString &path) |
| bool | hasKey (const ConfigDomain *domain, const UString &key) const |
| bool | getKey (const ConfigDomain *domain, const UString &key, UString &value) const |
| bool | setKey (ConfigDomain *domain, const UString &key, const UString &value) |
Static Private Member Functions | |
| static UString | getDefaultConfigFile () |
Private Attributes | |
| UString | _configFile |
| The config file to use. More... | |
| bool | _changed |
| ScopedPtr< ConfigFile > | _config |
| The actual config. More... | |
| ScopedPtr< ConfigDomain > | _domainDefaultApp |
| Application defaults domain. More... | |
| ScopedPtr< ConfigDomain > | _domainDefaultGame |
| Game defaults domain. More... | |
| ScopedPtr< ConfigDomain > | _domainCommandline |
| Command line domain. More... | |
| ScopedPtr< ConfigDomain > | _domainGameTemp |
| Temporary game settings domain. More... | |
| ConfigDomain * | _domainApp |
| Application domain, pointer into the config file. More... | |
| ConfigDomain * | _domainGame |
| Game domain, pointer into the config file. More... | |
Static Private Attributes | |
| static const char * | kDomainApp = "xoreos" |
| The name of the application domain. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< ConfigManager > | |
| static ConfigManager & | instance () |
| static void | destroy () |
Protected Types inherited from Common::Singleton< ConfigManager > | |
| typedef ConfigManager | SingletonBaseType |
Protected Member Functions inherited from Common::Singleton< ConfigManager > | |
| Singleton () | |
| virtual | ~Singleton () |
The global config manager, storing all config keys.
Definition at line 51 of file configman.h.
| Common::ConfigManager::ConfigManager | ( | ) |
Definition at line 42 of file configman.cpp.
References _domainCommandline, and _domainDefaultApp.
| Common::ConfigManager::~ConfigManager | ( | ) |
Definition at line 47 of file configman.cpp.
| bool Common::ConfigManager::changed | ( | ) | const |
| void Common::ConfigManager::clear | ( | ) |
Clear everything except the command line options.
Definition at line 54 of file configman.cpp.
References _changed, _config, _domainApp, _domainDefaultApp, _domainDefaultGame, _domainGame, and _domainGameTemp.
Referenced by create(), and load().

| void Common::ConfigManager::clearCommandline | ( | ) |
Clear the command line options.
Definition at line 67 of file configman.cpp.
References _domainCommandline.
| void Common::ConfigManager::create | ( | ) |
Create a new, empty config.
Definition at line 153 of file configman.cpp.
References _config, _domainApp, clear(), and kDomainApp.

Create the game domain with this path and target.
Definition at line 217 of file configman.cpp.
References _changed, _config, Common::FilePath::canonicalize(), createGameID(), Common::UString::empty(), and Common::ConfigDomain::setString().

Definition at line 187 of file configman.cpp.
References _config, Common::UString::begin(), Common::UString::c_str(), Common::FilePath::canonicalize(), Common::UString::empty(), Common::UString::end(), Common::UString::format(), Common::FilePath::getStem(), and Common::UString::isAlNum().
Referenced by createGame().


| bool Common::ConfigManager::fileExists | ( | ) | const |
Does the config file exist?
Definition at line 71 of file configman.cpp.
References getConfigFile(), and Common::FilePath::isRegularFile().

Find the game domain using this path.
Definition at line 161 of file configman.cpp.
References _config, Common::FilePath::canonicalize(), Common::UString::empty(), and kDomainApp.

| bool Common::ConfigManager::getBool | ( | const UString & | key | ) | const |
Definition at line 298 of file configman.cpp.
References getDefaultKey(), getKey(), and Common::parseString().
Referenced by save().


| bool Common::ConfigManager::getBool | ( | const UString & | key, |
| bool | def | ||
| ) | const |
Definition at line 339 of file configman.cpp.
References Common::exceptionDispatcherWarning(), getKey(), and Common::parseString().

| UString Common::ConfigManager::getConfigFile | ( | ) | const |
Return the config file that's currently in use.
Definition at line 513 of file configman.cpp.
References _configFile, Common::UString::empty(), and getDefaultConfigFile().
Referenced by fileExists(), load(), and save().


| bool Common::ConfigManager::getDefaultBool | ( | const UString & | key | ) | const |
Definition at line 488 of file configman.cpp.
References getDefaultKey(), and Common::parseString().

|
staticprivate |
Definition at line 520 of file configman.cpp.
References Common::FilePath::getConfigDirectory().
Referenced by getConfigFile().


| double Common::ConfigManager::getDefaultDouble | ( | const UString & | key | ) | const |
Definition at line 502 of file configman.cpp.
References getDefaultKey(), and Common::parseString().

| int Common::ConfigManager::getDefaultInt | ( | const UString & | key | ) | const |
Definition at line 495 of file configman.cpp.
References getDefaultKey(), and Common::parseString().

Definition at line 473 of file configman.cpp.
References _domainDefaultApp, _domainDefaultGame, Common::UString::c_str(), and getKey().
Referenced by getBool(), getDefaultBool(), getDefaultDouble(), getDefaultInt(), getDefaultString(), getDouble(), getInt(), and getString().


Definition at line 484 of file configman.cpp.
References getDefaultKey().

| double Common::ConfigManager::getDouble | ( | const UString & | key | ) | const |
Definition at line 320 of file configman.cpp.
References getDefaultKey(), getKey(), and Common::parseString().

| double Common::ConfigManager::getDouble | ( | const UString & | key, |
| double | def | ||
| ) | const |
Definition at line 369 of file configman.cpp.
References Common::exceptionDispatcherWarning(), getKey(), and Common::parseString().

| int Common::ConfigManager::getInt | ( | const UString & | key | ) | const |
Definition at line 309 of file configman.cpp.
References getDefaultKey(), getKey(), and Common::parseString().

| int Common::ConfigManager::getInt | ( | const UString & | key, |
| int | def | ||
| ) | const |
Definition at line 354 of file configman.cpp.
References Common::exceptionDispatcherWarning(), getKey(), and Common::parseString().

Definition at line 280 of file configman.cpp.
References _domainApp, _domainCommandline, _domainDefaultApp, _domainDefaultGame, _domainGame, and _domainGameTemp.
Referenced by getBool(), getDefaultKey(), getDouble(), getInt(), getString(), and setKey().

|
private |
Definition at line 529 of file configman.cpp.
References Common::ConfigDomain::getKey().

Definition at line 290 of file configman.cpp.
References getDefaultKey(), and getKey().

Definition at line 331 of file configman.cpp.
References getKey().

| bool Common::ConfigManager::hasDefaultKey | ( | const UString & | key | ) | const |
Definition at line 468 of file configman.cpp.
References _domainDefaultApp, _domainDefaultGame, and hasKey().

| bool Common::ConfigManager::hasGame | ( | const UString & | gameID | ) |
Does the specified game domain exist?
Definition at line 234 of file configman.cpp.
References _config.
| bool Common::ConfigManager::hasKey | ( | const UString & | key | ) | const |
Definition at line 273 of file configman.cpp.
References _domainApp, _domainCommandline, and _domainGame.
Referenced by hasDefaultKey().

|
private |
Definition at line 525 of file configman.cpp.
References Common::ConfigDomain::hasKey().

| bool Common::ConfigManager::isInGame | ( | ) | const |
Are we currently in a game?
Definition at line 269 of file configman.cpp.
References _domainDefaultGame, _domainGame, and _domainGameTemp.
| bool Common::ConfigManager::load | ( | ) |
Load from the default config file.
Definition at line 79 of file configman.cpp.
References Common::UString::c_str(), clear(), Common::exceptionDispatcherWarning(), getConfigFile(), Common::FilePath::isRegularFile(), Common::kOpenError, and Common::ReadFile::open().

| void Common::ConfigManager::load | ( | SeekableReadStream & | stream | ) |
Load from a generic read stream.
Definition at line 104 of file configman.cpp.
References _config, _domainApp, clear(), and kDomainApp.

| bool Common::ConfigManager::save | ( | ) |
Save to the default config file.
Definition at line 114 of file configman.cpp.
References _config, Common::UString::c_str(), Common::FilePath::canonicalize(), Common::FilePath::createDirectories(), Common::exceptionDispatcherWarning(), getBool(), getConfigFile(), Common::FilePath::getDirectory(), Common::kOpenError, and Common::WriteFile::open().

| void Common::ConfigManager::save | ( | WriteStream & | stream, |
| bool | clearChanged = false |
||
| ) |
Save to a generic write stream.
Definition at line 142 of file configman.cpp.
| void Common::ConfigManager::setBool | ( | const UString & | key, |
| bool | value, | ||
| bool | update = false |
||
| ) |
Definition at line 410 of file configman.cpp.
References Common::composeString(), and setKey().

| void Common::ConfigManager::setBool | ( | ConfigRealm | realm, |
| const UString & | key, | ||
| bool | value | ||
| ) |
Definition at line 444 of file configman.cpp.
References Common::composeString(), and setKey().

Set a config value that came from the command line.
Definition at line 509 of file configman.cpp.
References _domainCommandline, and setKey().

| void Common::ConfigManager::setConfigFile | ( | const UString & | file = "" | ) |
| void Common::ConfigManager::setDefaults | ( | ) |
Overwrite the current config with the defaults.
Definition at line 456 of file configman.cpp.
References _changed, _domainApp, _domainDefaultApp, _domainDefaultGame, _domainGame, and Common::ConfigDomain::set().

| void Common::ConfigManager::setDouble | ( | const UString & | key, |
| double | value, | ||
| bool | update = false |
||
| ) |
Definition at line 418 of file configman.cpp.
References Common::composeString(), and setKey().

| void Common::ConfigManager::setDouble | ( | ConfigRealm | realm, |
| const UString & | key, | ||
| double | value | ||
| ) |
Definition at line 452 of file configman.cpp.
References Common::composeString(), and setKey().

| bool Common::ConfigManager::setGame | ( | const UString & | gameID = "" | ) |
Set the game domain to gameID.
Definition at line 241 of file configman.cpp.
References _config, _domainDefaultGame, _domainGame, _domainGameTemp, and Common::UString::empty().

| void Common::ConfigManager::setInt | ( | const UString & | key, |
| int | value, | ||
| bool | update = false |
||
| ) |
Definition at line 414 of file configman.cpp.
References Common::composeString(), and setKey().

| void Common::ConfigManager::setInt | ( | ConfigRealm | realm, |
| const UString & | key, | ||
| int | value | ||
| ) |
Definition at line 448 of file configman.cpp.
References Common::composeString(), and setKey().

| void Common::ConfigManager::setKey | ( | const UString & | key, |
| const UString & | value, | ||
| bool | update = false |
||
| ) |
Definition at line 384 of file configman.cpp.
References _changed, _domainApp, _domainCommandline, _domainGame, and getKey().
Referenced by setBool(), setCommandlineKey(), setDouble(), setInt(), setKey(), and setString().


| void Common::ConfigManager::setKey | ( | ConfigRealm | realm, |
| const UString & | key, | ||
| const UString & | value | ||
| ) |
Set a config value in a specific realm.
Definition at line 422 of file configman.cpp.
References _domainDefaultApp, _domainDefaultGame, _domainGameTemp, Common::kConfigRealmDefault, Common::kConfigRealmGameTemp, and setKey().

|
private |
Definition at line 533 of file configman.cpp.
References Common::ConfigDomain::setKey().

| void Common::ConfigManager::setString | ( | const UString & | key, |
| const UString & | value, | ||
| bool | update = false |
||
| ) |
Definition at line 406 of file configman.cpp.
References setKey().

| void Common::ConfigManager::setString | ( | ConfigRealm | realm, |
| const UString & | key, | ||
| const UString & | value | ||
| ) |
Definition at line 440 of file configman.cpp.
References setKey().

|
private |
Definition at line 151 of file configman.h.
Referenced by changed(), clear(), createGame(), save(), setDefaults(), and setKey().
|
private |
The actual config.
Definition at line 153 of file configman.h.
Referenced by clear(), create(), createGame(), createGameID(), findGame(), hasGame(), load(), save(), and setGame().
|
private |
The config file to use.
Definition at line 149 of file configman.h.
Referenced by getConfigFile(), and setConfigFile().
|
private |
Application domain, pointer into the config file.
Definition at line 160 of file configman.h.
Referenced by clear(), create(), getKey(), hasKey(), load(), setDefaults(), and setKey().
|
private |
Command line domain.
Definition at line 157 of file configman.h.
Referenced by clearCommandline(), ConfigManager(), getKey(), hasKey(), setCommandlineKey(), and setKey().
|
private |
Application defaults domain.
Definition at line 155 of file configman.h.
Referenced by clear(), ConfigManager(), getDefaultKey(), getKey(), hasDefaultKey(), setDefaults(), and setKey().
|
private |
Game defaults domain.
Definition at line 156 of file configman.h.
Referenced by clear(), getDefaultKey(), getKey(), hasDefaultKey(), isInGame(), setDefaults(), setGame(), and setKey().
|
private |
Game domain, pointer into the config file.
Definition at line 161 of file configman.h.
Referenced by clear(), getKey(), hasKey(), isInGame(), setDefaults(), setGame(), and setKey().
|
private |
Temporary game settings domain.
Definition at line 158 of file configman.h.
Referenced by clear(), getKey(), isInGame(), setGame(), and setKey().
|
staticprivate |
The name of the application domain.
Definition at line 147 of file configman.h.
Referenced by create(), findGame(), and load().
1.8.14