23 #ifndef SRC_CONFIGURATION_PROPERTY_HPP_
24 #define SRC_CONFIGURATION_PROPERTY_HPP_
28 #include <boost/lexical_cast.hpp>
29 #include <boost/function.hpp>
31 #include <boost/preprocessor/list.hpp>
32 #include <boost/preprocessor/tuple/to_list.hpp>
52 namespace configuration {
61 static std::string
toStr(
const T & val) {
63 return boost::lexical_cast<std::string>(val);
72 static T
fromStr(
const std::string & str) {
74 return boost::lexical_cast<T>(str);
76 std::stringstream ss(str);
103 const std::string &
name()
const {
111 virtual void setValue(
const std::string & str) = 0;
132 template<
class T,
class Translator = LexicalTranslator<T> >
141 Property(
const std::string& name_,
const T & initializer_ = T(),
T property_value
Actual property value.
virtual ~PropertyInterface()
friend std::ostream & operator<<(std::ostream &os, const Property &prop)
static T fromStr(const std::string &str)
bool operator==(T const &value_)
std::string property_name
Name of the property.
Template class used for lexical casting between string and other types. Used by Property class...
Basic interface property - used during registration etc.
virtual std::string getValue()=0
std::pair< std::string, PropertyInterface * > PropertyPair
Type representing a pair consisting of name-property.
bool operator!=(T const &value_)
Template class for storing properties.
Property(const std::string &name_, const T &initializer_=T(), std::string type_=typeid(T).name())
virtual void setValue(const std::string &str)
PropertyInterface(const std::string &name_)
Property< T > & operator=(T const &value_)
virtual std::string getValue()
virtual void setValue(const std::string &str)=0
T operator()(T const &value_)
std::string property_type
Type of the property.
const std::string & name() const
static std::string toStr(const T &val)