rttr Namespace Reference

The namespace for all rttr components. More...

Classes

class  class_
 This class is used to register the constructors, properties, methods and enumeration for a certain class ClassType. More...
 
class  constructor
 The constructor class provides several meta information about a constructor and can be invoked. More...
 
class  destructor
 The destructor class provides a destructor for registered types. More...
 
class  enumeration
 The enumeration class provides several meta information about an enum. More...
 
class  metadata
 This class is used to add custom meta data to the binding of a type. More...
 
class  method
 The method class provides several meta information about a method and can be invoked. More...
 
class  property
 The property class provides several meta information about a property and gives read/write access to its value. More...
 
class  type
 This class holds the type information for any arbitrary object. More...
 
class  variant
 The variant class allows to store data of any type and convert between these types transparently. More...
 
class  variant_array
 The variant_array class is a specialization of a variant, but for array types. More...
 

Typedefs

typedef short int16
 
typedef int int32
 
typedef char int8
 
typedef unsigned short uint16
 
typedef unsigned int uint32
 
typedef unsigned char uint8
 

Functions

template<typename T >
void constructor_ (std::vector< rttr::metadata > data=std::vector< rttr::metadata >())
 Register a constructor for a type T. More...
 
template<typename EnumType >
void enumeration_ (std::vector< std::pair< std::string, EnumType > > enum_data, std::vector< rttr::metadata > data=std::vector< rttr::metadata >())
 Register an enumeration of type EnumType. More...
 
template<typename F >
void method_ (const std::string &name, F function)
 Register a free function. More...
 
template<typename F >
void method_ (const std::string &name, F function, std::vector< rttr::metadata > data)
 Register a free function. More...
 
template<typename F , typename Policy >
void method_ (const std::string &name, F function, const Policy &policy)
 Register a free function. More...
 
template<typename F , typename Policy >
void method_ (const std::string &name, F function, std::vector< rttr::metadata > data, const Policy &policy)
 Register a free function. More...
 
template<typename A >
void property_ (const std::string &name, A acc)
 Register a property with read and write access. More...
 
template<typename A >
void property_ (const std::string &name, A acc, std::vector< rttr::metadata > data)
 Register a property with read and write access. More...
 
template<typename A , typename Policy >
void property_ (const std::string &name, A acc, const Policy &policy,)
 Register a property with read and write access. More...
 
template<typename A , typename Policy >
void property_ (const std::string &name, A acc, std::vector< rttr::metadata > data, const Policy &policy)
 Register a property with read and write access. More...
 
template<typename A1 , typename A2 >
void property_ (const std::string &name, A1 getter, A2 setter,)
 Register a property with read and write access. More...
 
template<typename A1 , typename A2 >
void property_ (const std::string &name, A1 getter, A2 setter, std::vector< rttr::metadata > data)
 Register a property with read and write access. More...
 
template<typename A1 , typename A2 , typename Policy >
void property_ (const std::string &name, A1 getter, A2 setter, const Policy &policy)
 Register a property with read and write access. More...
 
template<typename A1 , typename A2 , typename Policy >
void property_ (const std::string &name, A1 getter, A2 setter,)
 Register a property with read and write access. More...
 
template<typename A >
void property_readonly_ (const std::string &name, A acc)
 Register a property with read only access. More...
 
template<typename A >
void property_readonly_ (const std::string &name, A acc, std::vector< rttr::metadata > data)
 Register a property with read only access. More...
 
template<typename A , typename Policy >
void property_readonly_ (const std::string &name, A acc, const Policy &policy)
 Register a property with read only access. More...
 
template<typename A , typename Policy >
void property_readonly_ (const std::string &name, A acc, std::vector< rttr::metadata > data, const Policy &policy)
 Register a property with read only access. More...
 
template<typename TargetType , typename SourceType >
TargetType rttr_cast (SourceType object)
 Casts the given object of type SourceType to an object of type TargetType. More...
 

Variables

detail::bind_property_as_ptr_policy bind_property_as_ptr
 
detail::discard_return_value_policy discard_return_value
 
detail::return_reference_as_ptr_policy return_reference_as_ptr
 

Detailed Description

The namespace for all rttr components.

Typedef Documentation

typedef short rttr::int16
typedef int rttr::int32
typedef char rttr::int8
typedef unsigned short rttr::uint16
typedef unsigned int rttr::uint32
typedef unsigned char rttr::uint8

Function Documentation

template<typename T >
void rttr::constructor_ ( std::vector< rttr::metadata data = std::vector< rttr::metadata >())

Register a constructor for a type T.

Parameters
dataAdditional meta data.
See also
rttr::type::get_constructor, rttr::type::create
Returns
Reference to this, in order to chain other calls.
template<typename EnumType >
void rttr::enumeration_ ( std::vector< std::pair< std::string, EnumType > >  enum_data,
std::vector< rttr::metadata data = std::vector< rttr::metadata >() 
)

Register an enumeration of type EnumType.

Parameters
enum_dataThe name of the property.
dataAdditional meta data.
Remarks
Before using this make sure you have registered the type with RTTR_DECLARE_TYPE.
template<typename F >
void rttr::method_ ( const std::string &  name,
function 
)

Register a free function.

Parameters
nameThe name of the method.
functionThe function accessor to this method; this can be a member function, a function or a std::function.
Remarks
The method name does not have to be unique for this class.
Returns
Reference to this, in order to chain other calls.
template<typename F >
void rttr::method_ ( const std::string &  name,
function,
std::vector< rttr::metadata data 
)

Register a free function.

Parameters
nameThe name of the method.
functionThe function accessor to this method; this can be a member function, a function or a std::function.
dataAdditional meta data.
Remarks
The method name does not have to be unique for this class.
Returns
Reference to this, in order to chain other calls.
template<typename F , typename Policy >
void rttr::method_ ( const std::string &  name,
function,
const Policy &  policy 
)

Register a free function.

Parameters
nameThe name of the method.
functionThe function accessor to this method; this can be a member function, a function or a std::function.
policyThe policies parameter describes how the method should be binded to the type system.
Remarks
The method name does not have to be unique for this class.
Returns
Reference to this, in order to chain other calls.
template<typename F , typename Policy >
void rttr::method_ ( const std::string &  name,
function,
std::vector< rttr::metadata data,
const Policy &  policy 
)

Register a free function.

Parameters
nameThe name of the method.
functionThe function accessor to this method; this can be a member function, a function or a std::function.
dataAdditional meta data.
policyThe policies parameter describes how the method should be binded to the type system.
Remarks
The method name does not have to be unique for this class.
Returns
Reference to this, in order to chain other calls.
template<typename A >
void rttr::property_ ( const std::string &  name,
acc 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
accThe accessor to the property; a pointer to a variable.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A >
void rttr::property_ ( const std::string &  name,
acc,
std::vector< rttr::metadata data 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
accThe accessor to the property; a pointer to a variable.
dataAdditional meta data.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A , typename Policy >
void rttr::property_ ( const std::string &  name,
acc,
const Policy &  policy 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
accThe accessor to the property; a pointer to a variable.
policyThe policies parameter describes how the property should be binded to the type system.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A , typename Policy >
void rttr::property_ ( const std::string &  name,
acc,
std::vector< rttr::metadata data,
const Policy &  policy 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
accThe accessor to the property; a pointer to a variable.
dataAdditional meta data.
policyThe policies parameter describes how the property should be binded to the type system.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A1 , typename A2 >
void rttr::property_ ( const std::string &  name,
A1  getter,
A2  setter 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
getterThe getter accessor to the property; this can be a pointer to a function or a std::function.
setterThe setter accessor to the property; this can be a pointer to a function or a std::function.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A1 , typename A2 >
void rttr::property_ ( const std::string &  name,
A1  getter,
A2  setter,
std::vector< rttr::metadata data 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
getterThe getter accessor to the property; this can be a pointer to a function or a std::function.
setterThe setter accessor to the property; this can be a pointer to a function or a std::function.
dataAdditional meta data.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A1 , typename A2 , typename Policy >
void rttr::property_ ( const std::string &  name,
A1  getter,
A2  setter,
const Policy &  policy 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
getterThe getter accessor to the property; this can be a pointer to a function or a std::function.
setterThe setter accessor to the property; this can be a pointer to a function or a std::function.
policyThe policies parameter describes how the property should be binded to the type system.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A1 , typename A2 , typename Policy >
void rttr::property_ ( const std::string &  name,
A1  getter,
A2  setter 
)

Register a property with read and write access.

Parameters
nameThe name of the property.
getterThe getter accessor to the property; this can be a pointer to a function or a std::function.
setterThe setter accessor to the property; this can be a pointer to a function or a std::function.
dataAdditional meta data.
policyThe policies parameter describes how the property should be binded to the type system.
Remarks
The name of the property has to be unique for this class, otherwise it will not be registered.
template<typename A >
void rttr::property_readonly_ ( const std::string &  name,
acc 
)

Register a property with read only access.

Parameters
nameThe name of the property.
accThe accessor to the property; this can be a pointer to a variable, a pointer to a function or a std::function.
dataAdditional meta data.
Remarks
The name of the property has to be unique for a namespace, otherwise it will not be registered.
Returns
Reference to this, in order to chain other calls.
template<typename A >
void rttr::property_readonly_ ( const std::string &  name,
acc,
std::vector< rttr::metadata data 
)

Register a property with read only access.

Parameters
nameThe name of the property.
accThe accessor to the property; this can be a pointer to a variable, a pointer to a function or a std::function.
dataAdditional meta data.
Remarks
The name of the property has to be unique for a namespace, otherwise it will not be registered.
Returns
Reference to this, in order to chain other calls.
template<typename A , typename Policy >
void rttr::property_readonly_ ( const std::string &  name,
acc,
const Policy &  policy 
)

Register a property with read only access.

Parameters
nameThe name of the property.
accThe accessor to the property; this can be a pointer to a variable, a pointer to a function or a std::function.
policyThe policies parameter describes how the property should be binded to the type system.
Remarks
The name of the property has to be unique for a namespace, otherwise it will not be registered.
Returns
Reference to this, in order to chain other calls.
template<typename A , typename Policy >
void rttr::property_readonly_ ( const std::string &  name,
acc,
std::vector< rttr::metadata data,
const Policy &  policy 
)

Register a property with read only access.

Parameters
nameThe name of the property.
accThe accessor to the property; this can be a pointer to a variable, a pointer to a function or a std::function.
dataAdditional meta data.
policyThe policies parameter describes how the property should be binded to the type system.
Remarks
The name of the property has to be unique for a namespace, otherwise it will not be registered.
Returns
Reference to this, in order to chain other calls.
template<typename TargetType , typename SourceType >
TargetType rttr::rttr_cast ( SourceType  object)

Casts the given object of type SourceType to an object of type TargetType.

When the given the given object is an instance of type TargetType, then this function will cast the pointer to the TargetType; otherwise it will return a nullptr. If object is already a nullptr then it will also return a nullptr.

Remarks
SourceType and TargetType must be both pointer types.
Returns
A pointer of type TargetType

Variable Documentation

detail::bind_property_as_ptr_policy rttr::bind_property_as_ptr
detail::discard_return_value_policy rttr::discard_return_value
detail::return_reference_as_ptr_policy rttr::return_reference_as_ptr