Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

PropC Namespace Reference

Simple properties. More...


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...


Detailed Description

Simple properties.

Properties system

Properties are pseudo-variables getting/setting which causes side effects. Following conditions must be met in order to define property object..

  1. derivation from PropC::Object

            class Widget : public PropC::Object 
            { 
                    ...
    

  2. proper access methods

There are several ways of the property creation..

  1. returning by demand with the advantage of absence of memory overhead

  2. storing property objects together in the class object

            ...
    
            public:
                    PropC::Property_ReadOnly<Color, Widget, &Widget::get_Color> color;
    
                    ...
    
                    Widget ( .. ) : color (this) ..
                    {
    
                            ...
                    }
    

Proxy system

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)...

        ...


SourceForge.net Logo

Documentation for photonmm by Yakov <iakovz@gmail.com>.