#include <configuration.h>
Public Types | |
| typedef Common::Pair< Common::String, Common::String > | KeyType |
| typedef Common::Array< KeyType > | KeyTypeList |
Public Member Functions | |
| bool | readConfigFile (const Common::String &fname, const Common::String &root, bool readonly=true) |
| void | load (GameId gameId, bool isEnhanced) |
| void | write () |
| void | clear () |
| void | value (const Common::String &key, Common::String &ret, const char *defaultvalue="") const |
| void | value (const Common::String &key, int &ret, int defaultvalue=0) const |
| void | value (const Common::String &key, bool &ret, bool defaultvalue=false) const |
| void | pathFromValue (const Common::String &key, const Common::String &file, Common::Path &full_path) const |
| bool | set (const Common::String &key, const Common::String &value) |
| bool | set (const Common::String &key, const char *value) |
| bool | set (const Common::String &key, int value) |
| bool | set (const Common::String &key, bool value) |
| ConfigNode * | getNode (const Common::String &key) |
| void | getSubkeys (KeyTypeList &ktl, const Common::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.)