The instance class is used for forwarding the instance of an object to invoke a property or method.
More...
#include <instance.h>
|
| instance () noexcept |
| Creates an invalid instance object.
|
|
| instance (const instance &other) noexcept |
| Copy constructor for an instance.
|
|
| instance (const variant &var) noexcept |
| Creates an instance object from a variant object.
|
|
template<typename T, typename Tp = decay_instance_t<T>> |
| instance (T &data) noexcept |
| Creates an instance object from type T .
|
|
type | get_derived_type () const noexcept |
| Returns the most derived type of the hold instance.
|
|
type | get_type () const noexcept |
| Returns the type of the internally hold instance.
|
|
instance | get_wrapped_instance () const noexcept |
| Returns an instance object for the wrapped instance.
|
|
bool | is_valid () const noexcept |
| Returns true when the instance class contains a reference to an object.
|
|
| operator bool () const noexcept |
| Returns true when the instance class contains a reference to an object.
|
|
template<typename Target_Type> |
Target_Type * | try_convert () const noexcept |
| This function will try to convert the underlying instance to the given type Target_Type* .
|
|
The instance class is used for forwarding the instance of an object to invoke a property or method.
◆ instance() [1/4]
rttr::instance::instance |
( |
| ) |
|
|
noexcept |
Creates an invalid instance object.
Use this constructor, when you need to invoke a property or method where no instance is required.
◆ instance() [2/4]
rttr::instance::instance |
( |
const variant & | var | ) |
|
|
noexcept |
Creates an instance object from a variant object.
◆ instance() [3/4]
rttr::instance::instance |
( |
const instance & | other | ) |
|
|
noexcept |
Copy constructor for an instance.
◆ instance() [4/4]
template<typename T, typename Tp = decay_instance_t<T>>
rttr::instance::instance |
( |
T & | data | ) |
|
|
noexcept |
Creates an instance object from type T
.
◆ get_derived_type()
type rttr::instance::get_derived_type |
( |
| ) |
const |
|
noexcept |
Returns the most derived type of the hold instance.
See following example code:
derived d;
base& b = d;
instance() noexcept
Creates an invalid instance object.
static type get() noexcept
Returns a type object for the given template type T.
#define RTTR_ENABLE(...)
This macro is necessary in order to retrieve type information about the inheritance graph of a class.
Definition rttr_enable.h:85
◆ get_type()
type rttr::instance::get_type |
( |
| ) |
const |
|
noexcept |
Returns the type of the internally hold instance.
- Returns
- Type object of stored reference.
◆ get_wrapped_instance()
instance rttr::instance::get_wrapped_instance |
( |
| ) |
const |
|
noexcept |
Returns an instance object for the wrapped instance.
See following example code:
std::shared_ptr<foo> f;
type get_type() const noexcept
Returns the type of the internally hold instance.
instance get_wrapped_instance() const noexcept
Returns an instance object for the wrapped instance.
- Returns
- An instance object from the wrapped type.
◆ is_valid()
bool rttr::instance::is_valid |
( |
| ) |
const |
|
noexcept |
Returns true when the instance class contains a reference to an object.
Otherwise false.
- Returns
- True when a reference is stored, otherwise false.
◆ operator bool()
rttr::instance::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Returns true when the instance class contains a reference to an object.
Otherwise false.
- Returns
- True when a reference is stored, otherwise false.
◆ try_convert()
template<typename Target_Type>
Target_Type * rttr::instance::try_convert |
( |
| ) |
const |
|
noexcept |
This function will try to convert the underlying instance to the given type Target_Type*
.
When the conversion succeeds, a valid pointer will be returned. Otherwise a nullptr.
- Returns
- A pointer to the instance of
Target_Type
, when the conversion succeeds, otherwise a nullptr.
The documentation for this class was generated from the following file: