DexProperties Class Reference
[GDB]

Dex properties file. More...

List of all members.

Static Public Member Functions

static void Load (const std::wstring &path)
 Loads properties from the given file path.
static const std::wstring & Get (const std::wstring &key, const std::wstring &def)
 Gets a property.
static int32_t GetInteger (const std::wstring &key, int32_t def)
 Gets a property as an integer.
static bool_t GetBoolean (const std::wstring &key, bool_t def)
 Gets a property as a boolean.
static int64_t GetTimeUnit (const std::wstring &key, int64_t def)
 Gets a property as a time unit.


Detailed Description

Dex properties file.

This class is implemented as a singleton, so all public methods are static.

It allows for getting the property values stored in a properties file. A properties file is a file where there is one line per property. A property is defined by a key and a value as follows: key=value

By default, this loads properties from the file './dex.cfg'. The user may choose to load a different file by calling the method Load().

If the default properties file or the one loaded by the user do not exist, then this behaves as loading an empty properties file.


Member Function Documentation

static void DexProperties::Load ( const std::wstring &  path  )  [static]

Loads properties from the given file path.

Parameters:
path [in] File path to load properties from.

static const std::wstring& DexProperties::Get ( const std::wstring &  key,
const std::wstring &  def 
) [static]

Gets a property.

Parameters:
key [in] The name of the property to lookup.
def [in] Default value to be returned in case there is no property with the name key.
Returns:
The value of the property, or def if the key is not found.

static int32_t DexProperties::GetInteger ( const std::wstring &  key,
int32_t  def 
) [static]

Gets a property as an integer.

Parameters:
key [in] The name of the property to lookup.
def [in] Default value to be returned in case there is no property with the name key.
Returns:
The property value, or def if the key is not found or in case of error.

static bool_t DexProperties::GetBoolean ( const std::wstring &  key,
bool_t  def 
) [static]

Gets a property as a boolean.

Parameters:
key [in] The name of the property to lookup.
def [in] Default value to be returned in case there is no property with the name key.
Returns:
The property value, or def if the key is not found or in case of error.

static int64_t DexProperties::GetTimeUnit ( const std::wstring &  key,
int64_t  def 
) [static]

Gets a property as a time unit.

A time unit is a string representation of a time duration with a time unit such as '10s' or '3H'.

Valid format for the string representation: Blanks at the begining or at the end are ignored. No blanks are allowed between the time duration and the unit time.

Allowed time units: 'D' for days, 'H' for hours, 'M' for minutes, 'S' o 's' for seconds, 'm' for milliseconds and 'u' for microseconds.

There is a special case: If no time unit is given, seconds is the default. So, '10' means 10 seconds.

Parameters:
key [in] The name of the property to lookup.
def [in] The default value (in microseconds) to be returned in case there is no property with the name key.
Returns:
The time duration in microseconds, or def if the key is not found or in case of error.


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

Generated on Mon Oct 15 14:40:32 2012 for Dex by  doxygen 1.5.6