ScummVM API documentation
Ultima::Nuvie::Configuration Class Reference

#include <configuration.h>

Public Types

typedef Common::Pair< Common::String, Common::StringKeyType
 
typedef Common::Array< KeyTypeKeyTypeList
 

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)
 
ConfigNodegetNode (const Std::string &key)
 
Std::set< Std::stringlistKeys (const Std::string &key, bool longformat=false) const
 
void getSubkeys (KeyTypeList &ktl, const Std::string &basekey)
 

Detailed Description

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.)


The documentation for this class was generated from the following file: