PersistentClass::DescriptionHelper

template<typename T> class PersistentClass::DescriptionHelper : public Class::DescriptionHelper<T>

Helper class for Persistent reflection definitions.

See Also

Summary
PersistentClass::DescriptionHelperHelper class for Persistent reflection definitions.
Functions
ReflectConstructorThis function is available in the reflection definition.
Members
PropertiesUsed to help register properties in a reflection definition.

Functions

ReflectConstructor

inline void ReflectConstructor() const

This function is available in the reflection definition. to register the default constructor as a factory.  If this is not called, the class will be considered <Class.Abstract> for the purposes of reflection.

Calling this function requires (at compile time) a default constructor for the class.

Members

Properties

PropertyCollector Properties

Used to help register properties in a reflection definition.

For example, the following sample shows how to register three member variables, the first two are plain data such as ints or floats, the third has to be an array or a class that acts like std::vector.

The reflection definition is friended in DECLARE_REFLECTION to have private access to members.

Usage

namespace example {

class MyClass : public reflect::Persistent
{
    DECLARE_REFLECTION(reflect::Persistent)
private:
    int mX;
    reflect::String mY;
    std::vector<int> mThingVector;
};

}

DEFINE_REFLECTION(example::MyClass, "example::MyClass")
{
    ReflectConstructor();

    Properties
       ("x", &example::MyClass::mX)
           ["tooltip"]("left-right location")
       ("y", &example::MyClass::mY)
       ("things", &example::MyClass::mThingVector, Array)
           ["tooltip"]("up-down location")
           ["tooltip"]("up-down location")
       ;
    ...etc...
}

The [“key”](“value”) syntax can be used to register metadata about properties.  They are not used by anything in reflect itself.  They can be accessed by PropertyPath::Annotation.

The following is a list of the types of registration with the type of Property created.

(“name”, &MyClass::mVar)DirectDataProperty
(“name”, &MyClass::GetVar, &MyClass::SetVar)AccessorProperty
(“name”, &MyClass::GetVarRef, &MyClass::SetVarRef)AccessorDirectProperty
(“name”, &MyClass::ReadVar, &MyClass::WriteVar)AccessorIndirectProperty
(“name”, &MyClass::VarConst, &MyClass::Var)AccessorAccessProperty
(“name”, &MyClass::mArrayVar, Array)DirectArrayProperty
(“name”, &MyClass::mVectorVar, Array)DirectVectorProperty
(“name”, &MyClass::mVar, Map)DirectMapProperty
(“name”, &MyClass::ser_fun, &MyClass::deser_fun, Variant)VariantProperty
template<typename T> class PersistentClass::DescriptionHelper : public Class::DescriptionHelper<T>
Helper class for Persistent reflection definitions.
class ReflectExport(reflect) Persistent : public Dynamic
The base class of all objects that can be saved and loaded.
inline void ReflectConstructor() const
This function is available in the reflection definition.
PropertyCollector Properties
Used to help register properties in a reflection definition.
class ReflectExport(reflect) PersistentClass : public Class
This class enables serialization and stores property maps.
template<typename T> class Class::DescriptionHelper : public ObjectType::DescriptionHelper<T>
Used in reflection definitions.
Defines the reflection support for a type using its class’ DescriptionHelper.
Declares reflection for a class.
Variant Annotation(string::Fragment name) const
Returns the annotation by name for the current property.
template<typename ObjectType, typename MemberType> class DirectDataProperty : public DataProperty
An implemetation of a DataProperty using a pointer-to-member to access the data.
template<typename ObjectType, typename MemberType> class AccessorProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to read and write a direct reference.
template<typename ObjectType, typename MemberType> class AccessorDirectProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to read and write a reference.
template<typename ObjectType, typename MemberType> class AccessorIndirectProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to read and write an indirect reference.
template<typename ObjectType, typename Type> class AccessorAccessProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to access a reference (const and non-const).
template<typename ObjectType, typename MemberType> class DirectArrayProperty : public ArrayProperty
An implemetation of ArrayProperty using a pointer-to-member to access the array.
template<typename ObjectType, typename MemberType> class DirectVectorProperty : public ArrayProperty
An implemetation of ArrayProperty using a pointer-to-member to access the vector.
template<typename ObjectType, typename MemberType> class DirectMapProperty : public MapProperty
An implemetation of MapProperty using a pointer-to-member to access the map.
template<typename ObjectType> class VariantProperty : public Property
An implemetation of Property using a callback and a Reflector to access the data.
Close