B2BITS FIX Antenna HFT
1.0.17
|
This class represents a persistent set of properties. More...
#include <Properties.h>
Public Types | |
typedef std::vector< std::string > | Keys |
Collection of keys. More... | |
Public Member Functions | |
void | assign (const Properties &other) |
Copies values from other to internal property storage. More... | |
void | clear () |
Resets Properties instance. More... | |
bool | get (const std::string &key, std::string *value=NULL) const |
Searches for the property with the specified key in this property list. More... | |
bool | getBool (const std::string &key, bool *value) const |
bool | getBoolean (const std::string &propertyName) const |
Reads the boolean value from the properties. More... | |
bool | getInt (const std::string &key, int *value) const |
int | getInteger (const std::string &propertyName, int minValue=-INT_MAX, int maxValue=INT_MAX) const |
Reads the integer value from the given properties. More... | |
void | getKeys (Keys *keys) const |
Return a collection of current keys. More... | |
std::string | getString (const std::string &propertyName, bool isRequired=true) const |
Reads the std::string value from the given properties. More... | |
void | load (std::istream *apIStream, PropertyDecoder *decoder=NULL) |
Reads a property list (key and element pairs) from the input stream. More... | |
Properties & | operator= (const Properties &other) |
Assing operator. More... | |
Properties () | |
Constructor. More... | |
Properties (std::istream *apIStream, PropertyDecoder *decoder=NULL) | |
Constructor. More... | |
Properties (const std::map< std::string, std::string > &settings, PropertyDecoder *decoder=NULL) | |
Constructor. More... | |
Properties (const Properties &other) | |
Copy constructor. More... | |
void | save (std::ostream *outStream) |
Saves the properties. More... | |
void | set (const std::string &key, const std::string &value) |
Maps the specified key to the specified value. More... | |
void | set_nolock (const std::string &key, const std::string &value) |
void | setBool (const std::string &key, bool value) |
void | setInt (const std::string &key, int value) |
virtual | ~Properties () |
Destructor. More... | |
Static Public Member Functions | |
static bool | getBooleanProperty (const Utils::Properties *pProperties, const std::string &propertyName) |
Reads the boolean value from the properties. More... | |
static bool | getBoolProperty (const Utils::Properties *pProperties, const std::string &propertyName, bool isRequired=true) |
static int | getIntegerProperty (const Utils::Properties *properties, const std::string &propertyName, int minValue=-INT_MAX, int maxValue=INT_MAX) |
Reads the integer value from the given properties. More... | |
static int | getIntProperty (const Utils::Properties *pProperties, const std::string &propertyName, bool isRequired=true) |
static std::string | getStringProperty (const Utils::Properties *pProperties, const std::string &propertyName, bool isRequired=true) |
Reads the std::string value from the given properties. More... | |
This class represents a persistent set of properties.
The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a std::string.
This class is synchronized.
typedef std::vector<std::string> Utils::Properties::Keys |
Collection of keys.
Utils::Properties::Properties | ( | ) |
Constructor.
Creates an empty property list with no default values.
|
explicit |
Constructor.
Reads a property list (key and element pairs) from the input stream.
A line that contains only whitespace or whose first non-whitespace character is an ASCII # or ! is ignored (thus, # or ! indicate comment lines).
|
explicit |
Constructor.
Creates a property list by the given map.
|
virtual |
Destructor.
Utils::Properties::Properties | ( | const Properties & | other | ) |
Copy constructor.
void Utils::Properties::assign | ( | const Properties & | other | ) |
Copies values from other to internal property storage.
void Utils::Properties::clear | ( | ) |
Resets Properties instance.
bool Utils::Properties::get | ( | const std::string & | key, |
std::string * | value = NULL |
||
) | const |
Searches for the property with the specified key in this property list.
bool Utils::Properties::getBool | ( | const std::string & | key, |
bool * | value | ||
) | const |
bool Utils::Properties::getBoolean | ( | const std::string & | propertyName | ) | const |
Reads the boolean value from the properties.
Utils::Exception | if the key or value was not found. |
|
static |
Reads the boolean value from the properties.
Utils::Exception | if the key or value was not found. |
|
static |
bool Utils::Properties::getInt | ( | const std::string & | key, |
int * | value | ||
) | const |
int Utils::Properties::getInteger | ( | const std::string & | propertyName, |
int | minValue = -INT_MAX , |
||
int | maxValue = INT_MAX |
||
) | const |
Reads the integer value from the given properties.
propertyName | The property name. |
minValue | the minimum value. |
maxValue | the maximum value. |
Utils::Exception | if the key or value was not found or the value is out-of-range. |
|
static |
Reads the integer value from the given properties.
properties | The source properties. |
propertyName | The property name. |
minValue | the minimum value. |
maxValue | the maximum value. |
Utils::Exception | if the key or value was not found or the value is out-of-range. |
|
static |
void Utils::Properties::getKeys | ( | Keys * | keys | ) | const |
Return a collection of current keys.
Referenced by FixProtocols::createCustomProtocols().
std::string Utils::Properties::getString | ( | const std::string & | propertyName, |
bool | isRequired = true |
||
) | const |
Reads the std::string value from the given properties.
Utils::Exception | if isRequired is "true" and the key or value was not found. |
Referenced by FixProtocols::createCustomProtocols(), and FixProtocols::loadProtocolFile().
|
static |
Reads the std::string value from the given properties.
Utils::Exception | if isRequired is "true" and the key or value was not found. |
void Utils::Properties::load | ( | std::istream * | apIStream, |
PropertyDecoder * | decoder = NULL |
||
) |
Reads a property list (key and element pairs) from the input stream.
A line that contains only whitespace or whose first non-whitespace character is an ASCII # or ! is ignored (thus, # or ! indicate comment lines).
Properties& Utils::Properties::operator= | ( | const Properties & | other | ) |
Assing operator.
void Utils::Properties::save | ( | std::ostream * | outStream | ) |
Saves the properties.
void Utils::Properties::set | ( | const std::string & | key, |
const std::string & | value | ||
) |
Maps the specified key to the specified value.
void Utils::Properties::set_nolock | ( | const std::string & | key, |
const std::string & | value | ||
) |
void Utils::Properties::setBool | ( | const std::string & | key, |
bool | value | ||
) |
void Utils::Properties::setInt | ( | const std::string & | key, |
int | value | ||
) |