The constructor class provides several meta information about a constructor and can be invoked. More...
#include <constructor.h>
Public Member Functions | |
| type | get_declaring_type () const |
| Returns the type of the class or struct that declares this constructor. More... | |
| type | get_instanciated_type () const |
| Returns the type object of the instantiated type. More... | |
| variant | get_metadata (int key) const |
Returns the metadata for the given key key. More... | |
| variant | get_metadata (const std::string &key) const |
Returns the metadata for the given key key. More... | |
| std::vector< type > | get_parameter_types () const |
| Returns a list of type objects representing the number, order and type of the parameters for this constructor. More... | |
| std::string | get_signature () const |
| Returns the signature of this constructor as readable string. More... | |
| variant | invoke () const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| variant | invoke (detail::argument arg1) const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| variant | invoke (detail::argument arg1, detail::argument arg2) const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| variant | invoke (detail::argument arg1, detail::argument arg2, detail::argument arg3) const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| variant | invoke (detail::argument arg1, detail::argument arg2, detail::argument arg3, detail::argument arg4) const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| variant | invoke (detail::argument arg1, detail::argument arg2, detail::argument arg3, detail::argument arg4, detail::argument arg5) const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| variant | invoke (detail::argument arg1, detail::argument arg2, detail::argument arg3, detail::argument arg4, detail::argument arg5, detail::argument arg6) const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| variant | invoke_variadic (std::vector< detail::argument > args) const |
| Invokes the constructor of type returned by get_instanciated_type(). More... | |
| bool | is_valid () const |
| Returns true if this constructor is valid, otherwise false. More... | |
| operator bool () const | |
| Convenience function to check if this constructor is valid or not. More... | |
| bool | operator!= (const constructor &other) const |
Returns true if this constructor is the not the same like the other. More... | |
| bool | operator== (const constructor &other) const |
Returns true if this constructor is the same like the other. More... | |
The constructor class provides several meta information about a constructor and can be invoked.
A instance of a constructor class can only be obtained from the type class. See type::get_constructor() and type::get_constructors().
For registration a constructor, nested inside a class, see class_::constructor() and for global constructors see constructor_.
A constructor has a signature (get_signature()) and a instantiate exactly one type (get_instanciated_type()). With get_parameter_types() you retrieve all type objects of the parameters for this constructor. When the constructor was declared inside a class, then get_declaring_type() can be used to obtain the type of this class.
The method can be invoked with invoke(); When its not a static method you have to provide a class instance to invoke the method. This instance can be the raw type on the stack; the current hierarchy level doesn't matter. It can be also a raw pointer to the object or a variant which contains the instance, again as pointer or stack object.
Another way to invoke a method is to use the type class through type::create().
A constructor object is lightweight and can be copied by value. However, each copy will refer to the same underlying constructor.
| type rttr::constructor::get_declaring_type | ( | ) | const |
Returns the type of the class or struct that declares this constructor.
| type rttr::constructor::get_instanciated_type | ( | ) | const |
Returns the type object of the instantiated type.
| variant rttr::constructor::get_metadata | ( | int | key | ) | const |
Returns the metadata for the given key key.
key, an invalid variant object is returned (see variant::is_valid).| variant rttr::constructor::get_metadata | ( | const std::string & | key | ) | const |
Returns the metadata for the given key key.
key, an invalid variant object is returned (see variant::is_valid).| std::vector<type> rttr::constructor::get_parameter_types | ( | ) | const |
Returns a list of type objects representing the number, order and type of the parameters for this constructor.
| std::string rttr::constructor::get_signature | ( | ) | const |
Returns the signature of this constructor as readable string.
| variant rttr::constructor::invoke | ( | ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object.
| variant rttr::constructor::invoke | ( | detail::argument | arg1 | ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object.
| variant rttr::constructor::invoke | ( | detail::argument | arg1, |
| detail::argument | arg2 | ||
| ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object.
| variant rttr::constructor::invoke | ( | detail::argument | arg1, |
| detail::argument | arg2, | ||
| detail::argument | arg3 | ||
| ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object.
| variant rttr::constructor::invoke | ( | detail::argument | arg1, |
| detail::argument | arg2, | ||
| detail::argument | arg3, | ||
| detail::argument | arg4 | ||
| ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object.
| variant rttr::constructor::invoke | ( | detail::argument | arg1, |
| detail::argument | arg2, | ||
| detail::argument | arg3, | ||
| detail::argument | arg4, | ||
| detail::argument | arg5 | ||
| ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object.
| variant rttr::constructor::invoke | ( | detail::argument | arg1, |
| detail::argument | arg2, | ||
| detail::argument | arg3, | ||
| detail::argument | arg4, | ||
| detail::argument | arg5, | ||
| detail::argument | arg6 | ||
| ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object.
| variant rttr::constructor::invoke_variadic | ( | std::vector< detail::argument > | args | ) | const |
Invokes the constructor of type returned by get_instanciated_type().
The instance will always be created on the heap and will be returned as variant object. Use this method when you need to instantiate a constructor with more then 6 parameters.
| bool rttr::constructor::is_valid | ( | ) | const |
Returns true if this constructor is valid, otherwise false.
| rttr::constructor::operator bool | ( | ) | const |
Convenience function to check if this constructor is valid or not.
| bool rttr::constructor::operator!= | ( | const constructor & | other | ) | const |
Returns true if this constructor is the not the same like the other.
| bool rttr::constructor::operator== | ( | const constructor & | other | ) | const |
Returns true if this constructor is the same like the other.
1.8.7