gatb.core-API-0.0.0
|
Implementation of IProperties interface. More...
#include <Property.hpp>
Public Member Functions | |
Properties (const std::string &rootname="") | |
Properties (const Properties &p) | |
virtual | ~Properties () |
Properties & | operator= (const Properties &p) |
void | accept (IPropertiesVisitor *visitor) |
IProperty * | add (size_t depth, const std::string &aKey, const char *format=0,...) |
IProperty * | add (size_t depth, const std::string &aKey, const std::string &aValue) |
void | add (size_t depth, IProperties *prop) |
void | add (size_t depth, const IProperties &prop) |
void | merge (IProperties *prop) |
IProperty * | operator[] (const std::string &key) |
IProperty * | get (const std::string &key) const |
std::string | getStr (const std::string &key) const |
int64_t | getInt (const std::string &key) const |
double | getDouble (const std::string &key) const |
void | setStr (const std::string &key, const std::string &value) |
void | setInt (const std::string &key, const int64_t &value) |
void | setDouble (const std::string &key, const double &value) |
IProperties * | clone () |
std::list< IProperties * > | map (const char *separator) |
std::set< std::string > | getKeys () |
void | setToFront (const std::string &key) |
void | readXML (std::istream &stream) |
void | readXML (const std::string &xmlString) |
std::string | getXML () |
void | readFile (const std::string &file) |
Public Member Functions inherited from SmartPointer | |
void | use () |
void | forget () |
Public Member Functions inherited from ISmartPointer | |
virtual | ~ISmartPointer () |
Additional Inherited Members | |
Protected Member Functions inherited from SmartPointer | |
SmartPointer () | |
virtual | ~SmartPointer () |
Implementation of IProperties interface.
This class provides a constructor that can read a file holding properties as [key,value] entries (one per line). This is useful for instance for managing a configuration file.
Sample of use:
Properties | ( | const std::string & | rootname = "" | ) |
Constructor. If a file path is provided, it tries to read [key,value] entries from this file.
[in] | rootname | : the file (if any) to be read |
Properties | ( | const Properties & | p | ) |
Copy constructor.
|
virtual |
Destructor.
|
virtual |
Accept a visitor (should loop over all IProperty instances).
[in] | visitor | : visitor to be accepted |
Implements IProperties.
|
virtual |
Add a IProperty instance given a depth, a key and a value provided in a printf way.
[in] | depth | : depth of the property to be added |
[in] | aKey | : key of the property to be added |
[in] | format | : define the format of the value of the property, the actual value being defined by the ellipsis |
Implements IProperties.
|
virtual |
Add a IProperty instance given a depth, a key and a value.
[in] | depth | : depth of the property to be added |
[in] | aKey | : key of the property to be added |
[in] | aValue | : value (as a string) of the property to be added |
Implements IProperties.
|
virtual |
Add all the IProperty instances contained in the provided IProperties instance. Note that a depth is provided and is added to the depth of each added IProperty instance.
[in] | depth | : depth to be added to each depth of added instances. |
[in] | prop | : instance holding IProperty instances to be added |
Implements IProperties.
|
virtual |
Add all the IProperty instances contained in the provided IProperties instance. Note that a depth is provided and is added to the depth of each added IProperty instance.
[in] | depth | : depth to be added to each depth of added instances. |
[in] | prop | : instance holding IProperty instances to be added |
Implements IProperties.
|
virtual |
|
virtual |
Returns the IProperty instance given a key.
[in] | key | : the key |
Implements IProperties.
|
virtual |
Get the value of a property given its key.
[in] | key | : the key of the property |
Implements IProperties.
|
virtual |
Get the value of a property given its key.
[in] | key | : the key of the property |
Implements IProperties.
|
virtual |
|
virtual |
Get the value of a property given its key.
[in] | key | : the key of the property |
Implements IProperties.
|
virtual |
|
virtual |
Distribute arguments that are comma separated list.
Implements IProperties.
|
virtual |
Merge the IProperty instances contained in the provided IProperties instance.
[in] | prop | : instance holding IProperty instances to be added |
Implements IProperties.
Properties & operator= | ( | const Properties & | p | ) |
Affectation operator.
|
virtual |
Returns the IProperty instance given a key.
[in] | key | : the key |
Implements IProperties.
void readFile | ( | const std::string & | file | ) |
Read a file holding [key,value] entries and add them through 'add' method.
[in] | file | : the file to be read |
|
virtual |
Fill a Properties instance from an XML stream.
[in] | stream | the stream to be read (file, string...) |
Implements IProperties.
|
inline |
Fill a Properties instance from an XML string.
[in] | xmlString | the XML string to be read (file, string...) |
|
virtual |
Set the value of a property given its key.
[in] | key | : the key of the property |
[in] | value | : value to be set. |
Implements IProperties.
|
virtual |
Set the value of a property given its key.
[in] | key | : the key of the property |
[in] | value | : value to be set. |
Implements IProperties.
|
virtual |
Set the value of a property given its key.
[in] | key | : the key of the property |
[in] | value | : value to be set. |
Implements IProperties.
|
virtual |
Move the item (given its key) to the front of the container.
[in] | key | : the key of the item to be moved. |
Implements IProperties.