cppexpose  1.0.0.b785e04f23b8
C++ library for type introspection, reflection, and scripting interface
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
cppexpose::Property< T, BASE > Class Template Reference

Representation of object properties. More...

#include <cppexpose/include/cppexpose/reflection/Property.h>

Inheritance diagram for cppexpose::Property< T, BASE >:
Inheritance graph
[legend]
Collaboration diagram for cppexpose::Property< T, BASE >:
Collaboration graph
[legend]

Public Member Functions

template<typename... Args>
 Property (const std::string &name, Object *parent, Args &&...args)
 Constructor. More...
 
virtual ~Property ()
 Destructor. More...
 
virtual bool isObject () const override
 

Public Attributes

Signal< const T & > valueChanged
 Called when the value has been changed. More...
 

Protected Member Functions

virtual void onValueChanged (const T &value) override
 

Detailed Description

template<typename T, typename BASE = AbstractProperty>
class cppexpose::Property< T, BASE >

Representation of object properties.

A property describes a variable value that belongs to an object. It defines name and value type and provides an interface through which this value can be accessed at runtime. For example, the type and value can be queried, and automatic type conversions can be invoked. Properties are for example used to expose object values for UI and scripting interfaces.

Regular properties defined by this class use getter and setter methods to access the actual property value. Those are specified when declaring the property. This kind of property is regarded as static, since the property is defined on a class and is always present when an object of that class is created. For creating properties on objects dynamically at runtime, see DynamicProperty.

Constructor & Destructor Documentation

template<typename T , typename BASE >
template<typename... Args>
cppexpose::Property< T, BASE >::Property ( const std::string &  name,
Object parent,
Args &&...  args 
)

Constructor.

Parameters
[in]nameProperty name (must NOT be empty!)
[in]parentParent object (can be null)
[in]argsArguments for the typed value (see StoredValueSingle and StoredValueArray)
Remarks
If parent is valid, the property is automatically added to the parent object. The ownership is not transferred, so the property has to be deleted by the caller.

To transfer the ownership to the parent, call this constructor with parent(nullptr), and use addProperty() on the parent object.

template<typename T , typename BASE >
cppexpose::Property< T, BASE >::~Property ( )
virtual

Destructor.

Member Function Documentation

template<typename T , typename BASE >
bool cppexpose::Property< T, BASE >::isObject ( ) const
overridevirtual
template<typename T, typename BASE >
void cppexpose::Property< T, BASE >::onValueChanged ( const T &  value)
overrideprotectedvirtual

Member Data Documentation

template<typename T, typename BASE = AbstractProperty>
Signal<const T &> cppexpose::Property< T, BASE >::valueChanged

Called when the value has been changed.

Referenced by cppexpose::Property< T, BASE >::onValueChanged().


The documentation for this class was generated from the following files: