template<typename T> class PersistentClass::DescriptionHelper : public Class::DescriptionHelper<T>
Helper class for Persistent reflection definitions.
PersistentClass:: | Helper class for Persistent reflection definitions. |
Functions | |
ReflectConstructor | This function is available in the reflection definition. |
Members | |
Properties | Used to help register properties in a reflection definition. |
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.
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.
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 |
Helper class for Persistent reflection definitions.
template<typename T> class PersistentClass::DescriptionHelper : public Class::DescriptionHelper<T>
The base class of all objects that can be saved and loaded.
class ReflectExport( reflect ) Persistent : public Dynamic
This function is available in the reflection definition.
inline void ReflectConstructor() const
Used to help register properties in a reflection definition.
PropertyCollector Properties
This class enables serialization and stores property maps.
class ReflectExport( reflect ) PersistentClass : public Class
Used in reflection definitions.
template<typename T> class Class::DescriptionHelper : public ObjectType::DescriptionHelper<T>
Returns the annotation by name for the current property.
Variant Annotation( string:: Fragment name ) const
An implemetation of a DataProperty using a pointer-to-member to access the data.
template<typename ObjectType, typename MemberType> class DirectDataProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to read and write a direct reference.
template<typename ObjectType, typename MemberType> class AccessorProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to read and write a reference.
template<typename ObjectType, typename MemberType> class AccessorDirectProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to read and write an indirect reference.
template<typename ObjectType, typename MemberType> class AccessorIndirectProperty : public DataProperty
An implemetation of DataProperty using a pair of callbacks to access a reference (const and non-const).
template<typename ObjectType, typename Type> class AccessorAccessProperty : public DataProperty
An implemetation of ArrayProperty using a pointer-to-member to access the array.
template<typename ObjectType, typename MemberType> class DirectArrayProperty : public ArrayProperty
An implemetation of ArrayProperty using a pointer-to-member to access the vector.
template<typename ObjectType, typename MemberType> class DirectVectorProperty : public ArrayProperty
An implemetation of MapProperty using a pointer-to-member to access the map.
template<typename ObjectType, typename MemberType> class DirectMapProperty : public MapProperty
An implemetation of Property using a callback and a Reflector to access the data.
template<typename ObjectType> class VariantProperty : public Property