Property.hpp
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <eproperty/Interface.hpp>
11 #include <string>
12 #include <typeinfo>
13 #include <functional>
14 
18 namespace eproperty {
19  class Ref;
23  class Property {
24  public:
25  using Observer = std::function<void()>;
26  private:
27  eproperty::Interface* m_interfaceLink;
28  Observer m_setObserver;
29  std::string m_name;
30  public:
36  Property(eproperty::Interface* _paramInterfaceLink, const std::string& _name);
40  Property();
45  virtual ~Property() = default;
46  protected:
52  public:
56  void notifyChange() const;
61  virtual std::string getName() const;
66  virtual std::string getInfo() const = 0;
71  virtual std::string getPropertyType() const = 0;
76  virtual std::string getType() const = 0;
81  virtual std::string getString() const = 0;
86  virtual std::string getDefault() const = 0;
91  virtual void setString(const std::string& _newVal) = 0;
96  virtual bool isDefault() const = 0;
100  virtual void setDefault() = 0;
105  virtual std::vector<std::string> getListValue() const {
106  return std::vector<std::string>();
107  }
108  public:
115  template<class TYPE>
116  bool operator== (const TYPE& _obj) const = delete;
123  template<class TYPE>
124  bool operator!= (const TYPE& _obj) const = delete;
131  template<class TYPE>
132  bool operator<= (const TYPE& _obj) const = delete;
139  template<class TYPE>
140  bool operator>= (const TYPE& _obj) const = delete;
147  template<class TYPE>
148  bool operator< (const TYPE& _obj) const = delete;
155  template<class TYPE>
156  bool operator> (const TYPE& _obj) const = delete;
157  };
158 }
159 
virtual std::string getInfo() const =0
Description of the Propertys.
bool operator>(const TYPE &_obj) const =delete
Greater comparaison operator (REMOVED)
Base of the property With all generic element needed.
Definition: Property.hpp:23
virtual std::string getName() const
Get the name of the Property.
virtual std::string getDefault() const =0
Get the string of the default value of the Property.
bool operator!=(const TYPE &_obj) const =delete
IN-Eguality comparaison operator (REMOVED)
virtual void setDefault()=0
Reset the value to the default value.
bool operator<(const TYPE &_obj) const =delete
Lesser comparaison operator (REMOVED)
virtual bool isDefault() const =0
Check if the value is the default.
std::function< void()> Observer
Local main object observer of changing value of the property.
Definition: Property.hpp:25
void setObserver(eproperty::Property::Observer _setObs)
Set the change observer of the property.
bool operator>=(const TYPE &_obj) const =delete
Greater eguality comparaison operator (REMOVED)
virtual std::string getPropertyType() const =0
Get the Property type of the class in string mode.
bool operator<=(const TYPE &_obj) const =delete
Lesser eguality comparaison operator (REMOVED)
void notifyChange() const
call main class that PropertyChange
virtual std::vector< std::string > getListValue() const
Specific for eproperty::List to get all the possible values.
Definition: Property.hpp:105
Interface to collect the property list (for abstarction "set" and "get") It create a simple "properti...
Definition: Interface.hpp:19
virtual ~Property()=default
Virtualize the destructor.
bool operator==(const TYPE &_obj) const =delete
Eguality comparaison operator (REMOVED)
Property()
Basic property elements.
virtual void setString(const std::string &_newVal)=0
Set a new value of the Property (with string interface).
virtual std::string getType() const =0
Get the type of the Property in string mode.
eproperty global interface for all property implementation
Definition: Interface.hpp:14
virtual std::string getString() const =0
Get the string of the current value of the Property.