IncronCfg Class Reference

Configuration class. More...

#include <incroncfg.h>

List of all members.

Static Public Member Functions

static void Init ()
 Initializes default configuration values.
static void Load (const std::string &rPath)
 Loads configuration values.
static bool GetValue (const std::string &rKey, std::string &rVal)
 Retrieves a configuration value.
static bool GetValue (const std::string &rKey, int &rVal)
 Retrieves a configuration value.
static bool GetValue (const std::string &rKey, unsigned &rVal)
 Retrieves a configuration value.
static bool GetValue (const std::string &rKey, bool &rVal)
 Retrieves a configuration value.
static std::string BuildPath (const std::string &rPath, const std::string &rName)
 Builds a file path.

Static Protected Member Functions

static bool ParseLine (const char *s, std::string &rKey, std::string &rVal)
 Parses a line a attempts to get a key and a value.
static bool IsComment (const char *s)
 Checks whether a line is a comment.


Detailed Description

Configuration class.

This class provides access to values loaded from a configuration file (either a explicitly specified one or the default one).


Member Function Documentation

void IncronCfg::Init (  )  [static]

Initializes default configuration values.

void IncronCfg::Load ( const std::string &  rPath  )  [static]

Loads configuration values.

This method attempts to load configuration values from the specified file. If it fails (e.g. the file doesn't exist) the default file is read. As the last resort (for the case the default file can't be loaded) the hard-wired values are used.

Parameters:
[in] rPath configuration file path

bool IncronCfg::GetValue ( const std::string &  rKey,
std::string &  rVal 
) [static]

Retrieves a configuration value.

This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.

Parameters:
[in] rKey value key
[out] rVal retrieved value
Returns:
true = success, false = failure (invalid key)

bool IncronCfg::GetValue ( const std::string &  rKey,
int &  rVal 
) [static]

Retrieves a configuration value.

This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.

Parameters:
[in] rKey value key
[out] rVal retrieved value
Returns:
true = success, false = failure (invalid key)

bool IncronCfg::GetValue ( const std::string &  rKey,
unsigned &  rVal 
) [static]

Retrieves a configuration value.

This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.

Parameters:
[in] rKey value key
[out] rVal retrieved value
Returns:
true = success, false = failure (invalid key)

bool IncronCfg::GetValue ( const std::string &  rKey,
bool &  rVal 
) [static]

Retrieves a configuration value.

This method attempts to find the appropriate configuration value for the given key and stores it into the given variable.

Parameters:
[in] rKey value key
[out] rVal retrieved value
Returns:
true = success, false = failure (invalid key)

std::string IncronCfg::BuildPath ( const std::string &  rPath,
const std::string &  rName 
) [static]

Builds a file path.

This function composes a path from a base path and a file name.

Parameters:
[in] rPath base path
[in] rName file name
Returns:
full path

bool IncronCfg::ParseLine ( const char *  s,
std::string &  rKey,
std::string &  rVal 
) [static, protected]

Parses a line a attempts to get a key and a value.

Parameters:
[in] s text line
[out] rKey key
[out] rVal value
Returns:
true = success, false = failure

bool IncronCfg::IsComment ( const char *  s  )  [static, protected]

Checks whether a line is a comment.

Parameters:
[in] s text line
Returns:
true = comment, false = otherwise


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

Generated on Mon Dec 29 17:31:09 2008 for incron by  doxygen 1.5.5