MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Static Public Attributes | List of all members
MinVR::ConfigValMap Class Reference

Static Public Attributes

static ConfigMapRef map
 

Detailed Description

ConfigVal's and config files description:

ConfigVal's are an easy way to access program settings that can be stored in a configuration file. They are all key=value pairs where key and value are both originally std::strings. But, the value string can be easily reinterpreted by any class that overrides the stream >> and << operators. The ConfigVal() function figures out what type to try to convert to by the type of the second parameter to the function. This parameter also specifies the default value to return if the key is not found in the ConfigMap::_map Table.

To use a config file, call ConfigMap::readFile() with the filename of a text file to read. The format of each line of the file should be:

key value

where key has no spaces in it. value is everything after the space until the end of the line, so it can have spaces in it. Any line that starts with the character # is a comment and is ignored. A single \ character means cut the line here and continue on the next line. Everything after the \ is ignored and the text on the next line is appended to the text on the current line. You can escape the \ operator with a \ to get a single \ character.

Additionally, any value X appearing inside the special character sequence will be replaced by the value of the environment variable named X. If X is not defined, it will be replaced by a null string. If X takes the form of the path to a file and you're running in Windows under cygwin then X will be automatically converted from the form /cygdrive/c/blah/blah to the more Windows friendly form c:/blah/blah to stay compatible with the Visual C++ compiler.

Additionally, if you put a += after the key and the key has already been defined, then the value is appended to the key's current value. If you don't have the += and the same key is read in from a file, then the new value overwrites the old. For example:

mykey1 value1 mykey1 value2 mykey2 value3 mykey2+= value4

The value of mykey1 will be "value2". The value of mykey2 will be "value3 value4".This static class holds a ConfigMap that is used for the ConfigVal function.

Member Data Documentation

ConfigMapRef MinVR::ConfigValMap::map
static

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