cppexpose
1.0.0.b785e04f23b8
C++ library for type introspection, reflection, and scripting interface
|
Representation of object properties. More...
#include <cppexpose/include/cppexpose/reflection/Property.h>
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 |
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.
cppexpose::Property< T, BASE >::Property | ( | const std::string & | name, |
Object * | parent, | ||
Args &&... | args | ||
) |
Constructor.
[in] | name | Property name (must NOT be empty!) |
[in] | parent | Parent object (can be null) |
[in] | args | Arguments for the typed value (see StoredValueSingle and StoredValueArray) |
To transfer the ownership to the parent, call this constructor with parent(nullptr), and use addProperty() on the parent object.
|
virtual |
Destructor.
|
overridevirtual |
|
overrideprotectedvirtual |
References cppexpose::Property< T, BASE >::valueChanged.
Signal<const T &> cppexpose::Property< T, BASE >::valueChanged |
Called when the value has been changed.
Referenced by cppexpose::Property< T, BASE >::onValueChanged().