27 #ifndef COMMON_CONFIGMAN_H 28 #define COMMON_CONFIGMAN_H 41 class SeekableReadStream;
118 void setBool (
const UString &key,
bool value,
bool update =
false);
119 void setInt (
const UString &key,
int value,
bool update =
false);
176 #define ConfigMan Common::ConfigManager::instance() 178 #endif // COMMON_CONFIGMAN_H Class and macro for implementing singletons.
void setDefaults()
Overwrite the current config with the defaults.
bool hasKey(const UString &key) const
void setString(const UString &key, const UString &value, bool update=false)
A class holding an UTF-8 string.
Temporary game settings/properties.
ScopedPtr< ConfigDomain > _domainDefaultGame
Game defaults domain.
UString createGame(const UString &path, UString target="")
Create the game domain with this path and target.
bool load()
Load from the default config file.
bool fileExists() const
Does the config file exist?
bool setGame(const UString &gameID="")
Set the game domain to gameID.
int getDefaultInt(const UString &key) const
void clear()
Clear everything except the command line options.
bool getKey(const UString &key, UString &value) const
UString getDefaultKey(const UString &key) const
double getDefaultDouble(const UString &key) const
ScopedPtr< ConfigDomain > _domainDefaultApp
Application defaults domain.
The global config manager, storing all config keys.
void setConfigFile(const UString &file="")
Set the config file to use.
void setBool(const UString &key, bool value, bool update=false)
UString createGameID(const UString &path)
A simple scoped smart pointer template.
Basic exceptions to throw.
Generic template base class for implementing the singleton design pattern.
ConfigDomain * _domainApp
Application domain, pointer into the config file.
static const char * kDomainApp
The name of the application domain.
UString _configFile
The config file to use.
bool getDefaultBool(const UString &key) const
ConfigRealm
Special config realms.
ConfigDomain * _domainGame
Game domain, pointer into the config file.
Low-level type definitions to handle fixed width types portably.
void create()
Create a new, empty config.
A scoped plain pointer, allowing pointer-y access and normal deletion.
ScopedPtr< ConfigDomain > _domainCommandline
Command line domain.
UString getDefaultString(const UString &key) const
Generic interface for a writable data stream.
UString findGame(const UString &path)
Find the game domain using this path.
bool changed() const
Was at least on setting changed?
ScopedPtr< ConfigFile > _config
The actual config.
Application or game defaults.
void clearCommandline()
Clear the command line options.
void setKey(const UString &key, const UString &value, bool update=false)
Accessor for a domain (section) in a config file.
bool hasDefaultKey(const UString &key) const
bool getBool(const UString &key) const
UString getConfigFile() const
Return the config file that's currently in use.
static UString getDefaultConfigFile()
void setDouble(const UString &key, double value, bool update=false)
double getDouble(const UString &key) const
bool save()
Save to the default config file.
ScopedPtr< ConfigDomain > _domainGameTemp
Temporary game settings domain.
bool isInGame() const
Are we currently in a game?
UString getString(const UString &key) const
bool hasGame(const UString &gameID)
Does the specified game domain exist?
Interface for a seekable & readable data stream.
void setCommandlineKey(const UString &key, const UString &value)
Set a config value that came from the command line.
int getInt(const UString &key) const
void setInt(const UString &key, int value, bool update=false)