#include <configuration.h>
Public Types | |
typedef Common::Pair< Common::String, Common::String > | KeyType |
typedef Common::Array< KeyType > | KeyTypeList |
Public Member Functions | |
bool | readConfigFile (const Std::string &fname, const Std::string &root, bool readonly=true) |
void | load (GameId gameId, bool isEnhanced) |
void | write () |
void | clear () |
void | value (const Std::string &key, Std::string &ret, const char *defaultvalue="") const |
void | value (const Std::string &key, int &ret, int defaultvalue=0) const |
void | value (const Std::string &key, bool &ret, bool defaultvalue=false) const |
void | pathFromValue (const Std::string &key, const Std::string &file, Common::Path &full_path) const |
bool | set (const Std::string &key, const Std::string &value) |
bool | set (const Std::string &key, const char *value) |
bool | set (const Std::string &key, int value) |
bool | set (const Std::string &key, bool value) |
ConfigNode * | getNode (const Std::string &key) |
Std::set< Std::string > | listKeys (const Std::string &key, bool longformat=false) const |
void | getSubkeys (KeyTypeList &ktl, const Std::string &basekey) |
Configuration class.
Configuration values are stored in one of two ways -either as a standalone nuvie.cfg file, or otherwise from the ScummVM domain for the added game.
When the nuvie.cfg file is present, it's contents are stored as an XML tree (or a forest, technically). All values are stored as strings, but access functions for ints and bools are provided You should only store values in leaf nodes. (This isn't enforced everywhere, but contents of non-leaf nodes can disappear without warning)
You can load multiple config files, which can be read-only. Each config file contains a single tree. Values in files loaded last override values in files loaded earlier. Values are written to the last-loaded writable config file with the right root. Because of this it's important to make sure the last-loaded config file with a given root is writable. (The idea is that you can load a system-wide config file first, and a user's config file after that.)