IniFileConfigurationReader Class Reference

A class that supports reading configuration maps from an INI file. It is both used on Windows and Linux/OSX/Unix. More...

List of all members.

Public Member Functions

 IniFileConfigurationReader (bool in_caseSensitiveKeys=true)
 Constructor.
bool LoadConfiguration (ConfigMap &io_configMap, const simba_wstring &in_path, const simba_wstring &in_name, const simba_wstring *in_sectionFilter=NULL)
 Loads a configuration map from an INI file.
bool LoadConfiguration (SectionConfigMap &io_configMap, const simba_wstring &in_path, const simba_wstring &in_name, const simba_wstring *in_sectionFilter=NULL, bool in_returnDriver=false)
 Loads a configuration map from an INI file.
virtual ~IniFileConfigurationReader ()
 Destructor.

Detailed Description

A class that supports reading configuration maps from an INI file. It is both used on Windows and Linux/OSX/Unix.


Constructor & Destructor Documentation

IniFileConfigurationReader ( bool  in_caseSensitiveKeys = true  ) 

Constructor.

Parameters:
in_caseSensitiveKeys Should key names be case sensitive (default is true). If false, all configuration key names will be converted to uppercase. Section names are always converted to uppercase despite this.
in_driverModuleId The module identifier of the DLL. If non zero, a relative INI file name is located relative to the DLL location. If zero, a relative INI file name is located relative to the current directory. (WINDOWS ONLY)
virtual ~IniFileConfigurationReader (  )  [virtual]

Destructor.


Member Function Documentation

bool LoadConfiguration ( ConfigMap io_configMap,
const simba_wstring in_path,
const simba_wstring in_name,
const simba_wstring in_sectionFilter = NULL 
)

Loads a configuration map from an INI file.

Two levels of configuration are loaded.

On Windows, the given file name can be either absolute or relative. If relative, the file is searched for in the directory of the current module if a valid module identifier was given at creation or in the current directory if zero was given.

On Linux/OSX/Unix, the path can represent any filesystem location or starts with '$HOME' or '$ETC'. The search order is the following:

  • in_path/in_name,
  • $HOME/.in_name,
  • /etc/in_name
Parameters:
io_configMap Configuration map to fill. Structure: io_configMap[SectionName][KeyName] = KeyValue Section names are converted to uppercase. Key names are case sensitive.
in_path Root path to look for the configuration in. If the configuration is not found there, the defaults will be searched. Use an empty string to skip this step. (UNIX PLATFORMS ONLY)
in_name Name of the file to open.
in_sectionFilter Restrict reading of the config to only one particular section. Pass NULL for no filter. Pass an empty string to filter for keys that are not in a subsection. + Only reads the key/value pairs from the [in_sectionFilter] section.
Returns:
True if an INI was successfully located. False otherwise.
bool LoadConfiguration ( SectionConfigMap io_configMap,
const simba_wstring in_path,
const simba_wstring in_name,
const simba_wstring in_sectionFilter = NULL,
bool  in_returnDriver = false 
)

Loads a configuration map from an INI file.

Only one level of configuration is loaded: The base section if in_sectionFilter is NULL, or a specific subsection if in_sectionFilter is specified.

On Windows, the given file name can be either absolute or relative. If relative, the file is searched for in the directory of the current module if a valid module identifier was given at creation or in the current directory if zero was given.

On Linux/OSX/Unix, the path can represent any filesystem location or starts with '$HOME' or '$ETC'. The search order is the following:

  • in_path/in_name,
  • $HOME/.in_name,
  • /etc/in_name
Parameters:
io_configMap Configuration map to fill.

  • Structure: io_configMap[KeyName] = KeyValue
  • Keys names are case sensitive.
in_path Root path to look for the configuration in. If the configuration is not found there, the defaults will be searched. Use an empty string to skip this step. (UNIX PLATFORMS ONLY)
in_name Name of the file to open.
in_sectionFilter Restrict reading of the config to only one particular section. Pass NULL for no filter. Pass an empty string to filter for keys that are not in a subsection. + Only reads the key/value pairs from the [in_sectionFilter] section.
in_returnDriver Flag to indicate that DRIVER keyword should be returned.
Returns:
True if an INI was successfully located. False otherwise.

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

Generated on Wed May 17 14:21:19 2017 for SimbaEngine 10.1.3.1011 by simba