Previous: Configuration FILE FORMAT, Up: Configuration   [Contents][Index]


10.22.5 Configuration METHODS

‘Configuration()’

Constructor

‘~Configuration()’

Destructor

‘void Add(const String& str)’

Add configuration item str to the configuration. The value associated with it is undefined.

‘void Add(const String& name, const String& value)’

Add configuration item name to the configuration and associate it with value .

‘int Remove(const String& name)’

Remove the name from the configuration.

‘void NameValueSeparators(const String& s)’

Let the Configuration know how to parse name value pairs. Each character of string s is a valid separator between the name and the value.

‘virtual int Read(const String& filename)’

Read name/value configuration pairs from the file filename .

‘const String Find(const String& name) const’

Return the value of configuration attribute name as a String .

‘const String operator[](const String& name) const’

Alias to the Find method.

‘int Value(const String& name, int default_value = 0) const’

Return the value associated with the configuration attribute name , converted to integer using the atoi(3) function. If the attribute is not found in the configuration and a default_value is provided, return it.

‘double Double(const String& name, double default_value = 0) const’

Return the value associated with the configuration attribute name , converted to double using the atof(3) function. If the attribute is not found in the configuration and a default_value is provided, return it.

‘int Boolean(const String& name, int default_value = 0) const’

Return 1 if the value associated to name is either 1, yes or true . Return 0 if the value associated to name is either 0, no or false .

‘void Defaults(const ConfigDefaults *array)’

Load configuration attributes from the name and value members of the array argument.


Previous: Configuration FILE FORMAT, Up: Configuration   [Contents][Index]