Data Structures | |
class | Object |
Base class. More... | |
class | Property |
Read-write property. More... | |
class | Property_Base |
class | Property_ReadOnly |
Read-only property. More... | |
class | Property_WriteOnly |
Write-only property. More... | |
class | PropertyBase_ReadOnly |
class | PropertyBase_WriteOnly |
class | PropertyProxy |
Read-write property proxy. More... | |
class | PropertyProxy_ReadOnly |
Read-only property proxy. More... | |
class | PropertyProxy_WriteOnly |
Write-only property proxy. More... | |
class | Proxy_Base |
Write property base. More... | |
class | Proxy_ConstBase |
Read-only property base class. More... |
Properties are pseudo-variables getting/setting which causes side effects. Following conditions must be met in order to define property object..
class Widget : public PropC::Object { ...
PropC::Property_ReadOnly
Color get_Color () const { ... }
PropC::Property_WriteOnly
PropC::Property
There are several ways of the property creation..
... PropC::Property_ReadOnly<Color, Widget, &Widget::get_Color> color () { return PropC::Property_ReadOnly<Color, Widget, &Widget::get_Color> (this); }
... public: PropC::Property_ReadOnly<Color, Widget, &Widget::get_Color> color; ... Widget ( .. ) : color (this) .. { ... }
Proxy provides property interface without knowledge of exact object type and access methods used in the concrete property instance
Use like this
class Widget : public PropC::Object { ... bool get_realized () const { ... } void realize (bool = true) { ... } public: PropC::PropertyProxy<bool> realized; Widget () : realized (new PropC::Property<bool, Widget, &Widget::get_realized, &Widget::realize> (this)) { ... } }; ... Widget w; if (w.realized) { ... }
Properties proxy as property can be added to an object without modifing it's class
Widget button; ... PropertyProxy<bool> button_visible (new Property<bool, Widget, &Widget::get_realized, &Widget::realize> (&button)); if (button_visible) { ... } // or .. hide (&button_visible)... ...
Documentation for photonmm by Yakov <iakovz@gmail.com>.