BehaveRT::UtilityConfigFile Class Reference

Class for quickly loading settings from a text file. More...

List of all members.

Public Types

typedef std::map< std::string,
SettingsMultiMap * > 
SettingsBySection

Public Member Functions

void load (const std::string &filename, const std::string &separators="\t:=", bool trimWhitespace=true)
 load from a filename (not using resource group locations)
std::string getSetting (const std::string &key, const std::string &section="", const std::string &defaultValue="") const
BRTStringVector getMultiSetting (const std::string &key, const std::string &section="") const
void clear (void)


Detailed Description

Class for quickly loading settings from a text file.

Remarks:
This class is designed to quickly parse a simple file containing key/value pairs, mainly for use in configuration settings.
This is a very simplified approach, no multiple values per key are allowed, no grouping or context is being kept etc.
By default the key/values pairs are tokenised based on a separator of Tab, the colon (:) or equals (=) character. Each key - value pair must end in a carriage return.
Settings can be optionally grouped in sections, using a header beforehand of the form [SectionName].

Member Typedef Documentation

typedef std::map<std::string, SettingsMultiMap*> BehaveRT::UtilityConfigFile::SettingsBySection

Gets an iterator for stepping through all the keys / values in the file.


Member Function Documentation

void BehaveRT::UtilityConfigFile::clear ( void   ) 

Clear the settings

BRTStringVector BehaveRT::UtilityConfigFile::getMultiSetting ( const std::string &  key,
const std::string &  section = "" 
) const

Gets all settings from the file with the named key.

std::string BehaveRT::UtilityConfigFile::getSetting ( const std::string &  key,
const std::string &  section = "",
const std::string &  defaultValue = "" 
) const

Gets the first setting from the file with the named key.

Parameters:
key The name of the setting
section The name of the section it must be in (if any)
defaultValue The value to return if the setting is not found


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

Generated on Mon Oct 19 13:19:44 2009 for BehaveRT by  doxygen 1.5.7.1