|
B2BITS FIX Antenna HFT
1.0.17
|
This class represents a persistent set of properties. More...
#include <FileProperties.h>
Classes | |
| struct | Item |
| struct | RegistrPropertyParams |
Public Types | |
| typedef std::deque< std::string > | KeyNameToID |
| typedef std::map< std::size_t, RegistrPropertyParams > | RegisteredProperties |
| typedef std::map< std::size_t, Item > | Values |
Public Member Functions | |
| void | abandon () |
| Abandons the file stream ownership. More... | |
| void | close () |
| Closes the file stream. More... | |
| FilePropertiesT (FileT &file, bool isStreamOwner=true) | |
| Constructor. More... | |
| void | flush () |
| Flushes the stream . More... | |
| bool | get (const std::string &key, std::string *pValue) const |
| Searches for the property with the specified key in this property list. More... | |
| bool | getBool (const std::string &key, bool *value) const |
| bool | getInt (const std::string &key, int *value) const |
| void | getProperties (std::set< std::string > *keys) |
| Resturns set of the properties existing at the property file. More... | |
| const FileT & | getStream () const |
| Returns the stream. More... | |
| void | registerProperty (const std::string &propName, unsigned int linePosition, int valueLength) |
| Allow to set property position at the file. More... | |
| void | set (const std::string &key, const std::string &value, bool flushStream=false) |
| Maps the specified key to the specified value. More... | |
| void | setBool (const std::string &key, bool value, bool flushStream=false) |
| void | setInt (const std::string &key, int value, bool flushStream=false) |
| void | setStr (const std::string &key, const char *value, int size, bool flushStream=false) |
| virtual | ~FilePropertiesT () |
| Destructor. More... | |
Static Public Member Functions | |
| static bool | getBooleanProperty (FilePropertiesT *pProperties, const std::string &propertyName) |
| Reads the boolean value from the properties. More... | |
| static int | getIntegerProperty (FilePropertiesT *pProperties, const std::string &propertyName) |
| Reads the integer value from the given properties. More... | |
| static std::string | getStringProperty (FilePropertiesT *pProperties, const std::string &propertyName, bool isRequired=true) |
| Reads the std::string value from the given properties. More... | |
| static void | trimWhiteSpace (std::string *apStr) |
| Removes white space from both ends of the given std::string. More... | |
This class represents a persistent set of properties.
The FileProperties can be saved to a file or loaded from a file. Each key and its corresponding value in the property list is a std::string.
| typedef std::deque<std::string> Utils::FilePropertiesT< FileT >::KeyNameToID |
| typedef std::map<std::size_t, RegistrPropertyParams> Utils::FilePropertiesT< FileT >::RegisteredProperties |
| typedef std::map<std::size_t, Item> Utils::FilePropertiesT< FileT >::Values |
| Utils::FilePropertiesT< FileT >::FilePropertiesT | ( | FileT & | file, |
| bool | isStreamOwner = true |
||
| ) |
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). isStreamOwner - not used
|
virtual |
Destructor.
| void Utils::FilePropertiesT< FileT >::abandon | ( | ) |
Abandons the file stream ownership.
| void Utils::FilePropertiesT< FileT >::close | ( | ) |
Closes the file stream.
| void Utils::FilePropertiesT< FileT >::flush | ( | ) |
Flushes the stream .
| bool Utils::FilePropertiesT< FileT >::get | ( | const std::string & | key, |
| std::string * | pValue | ||
| ) | const |
Searches for the property with the specified key in this property list.
Referenced by Utils::FilePropertiesT< FileT >::getStringProperty().
| bool Utils::FilePropertiesT< FileT >::getBool | ( | const std::string & | key, |
| bool * | value | ||
| ) | const |
|
static |
Reads the boolean value from the properties.
| Utils::Exception | if the key or value was not found. |
References Utils::FilePropertiesT< FileT >::trimWhiteSpace().
| bool Utils::FilePropertiesT< FileT >::getInt | ( | const std::string & | key, |
| int * | value | ||
| ) | const |
|
static |
Reads the integer value from the given properties.
| Utils::Exception | if the key or value was not found. |
| void Utils::FilePropertiesT< FileT >::getProperties | ( | std::set< std::string > * | keys | ) |
Resturns set of the properties existing at the property file.
| const FileT & Utils::FilePropertiesT< FileT >::getStream | ( | ) | const |
Returns the stream.
|
static |
Reads the std::string value from the given properties.
| Utils::Exception | if isRequired is "true" and the key or value was not found. |
References Utils::FilePropertiesT< FileT >::get().
| void Utils::FilePropertiesT< FileT >::registerProperty | ( | const std::string & | propName, |
| unsigned int | linePosition, | ||
| int | valueLength | ||
| ) |
Allow to set property position at the file.
| propName | - property name |
| linePosition | - line, where this property have to be wrote. Valid values >= 0. |
| valueLength | - max size of the property value. Valid values >0 and -1. When it '-1' - size undefined. |
| void Utils::FilePropertiesT< FileT >::set | ( | const std::string & | key, |
| const std::string & | value, | ||
| bool | flushStream = false |
||
| ) |
Maps the specified key to the specified value.
| void Utils::FilePropertiesT< FileT >::setBool | ( | const std::string & | key, |
| bool | value, | ||
| bool | flushStream = false |
||
| ) |
| void Utils::FilePropertiesT< FileT >::setInt | ( | const std::string & | key, |
| int | value, | ||
| bool | flushStream = false |
||
| ) |
References Utils::i32toa(), Utils::MAX_INT32_STR_SIZE, Utils::MAX_UINT32_STR_SIZE, and Utils::u32toa().
| void Utils::FilePropertiesT< FileT >::setStr | ( | const std::string & | key, |
| const char * | value, | ||
| int | size, | ||
| bool | flushStream = false |
||
| ) |
|
static |
Removes white space from both ends of the given std::string.
Referenced by Utils::FilePropertiesT< FileT >::getBooleanProperty().
1.8.5