EnTT 3.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
entt::meta_type Class Reference

Opaque wrapper for types. More...

#include <meta.hpp>

Public Types

using size_type = typename internal::meta_type_node::size_type
 Unsigned integer type.
 

Public Member Functions

 meta_type () noexcept=default
 Default constructor.
 
 meta_type (const meta_ctx &area, internal::meta_type_node curr) noexcept
 Context aware constructor for meta objects.
 
 meta_type (const meta_ctx &area, const internal::meta_base_node &curr) noexcept
 Context aware constructor for meta objects.
 
const type_infoinfo () const noexcept
 Returns the type info object of the underlying type.
 
id_type id () const noexcept
 Returns the identifier assigned to a type.
 
size_type size_of () const noexcept
 Returns the size of the underlying type if known.
 
bool is_arithmetic () const noexcept
 Checks whether a type refers to an arithmetic type or not.
 
bool is_integral () const noexcept
 Checks whether a type refers to an integral type or not.
 
bool is_signed () const noexcept
 Checks whether a type refers to a signed type or not.
 
bool is_array () const noexcept
 Checks whether a type refers to an array type or not.
 
bool is_enum () const noexcept
 Checks whether a type refers to an enum or not.
 
bool is_class () const noexcept
 Checks whether a type refers to a class or not.
 
bool is_pointer () const noexcept
 Checks whether a type refers to a pointer or not.
 
meta_type remove_pointer () const noexcept
 Provides the type for which the pointer is defined.
 
bool is_pointer_like () const noexcept
 Checks whether a type is a pointer-like type or not.
 
bool is_sequence_container () const noexcept
 Checks whether a type refers to a sequence container or not.
 
bool is_associative_container () const noexcept
 Checks whether a type refers to an associative container or not.
 
bool is_template_specialization () const noexcept
 Checks whether a type refers to a recognized class template specialization or not.
 
size_type template_arity () const noexcept
 Returns the number of template arguments.
 
meta_type template_type () const noexcept
 Returns a tag for the class template of the underlying type.
 
meta_type template_arg (const size_type index) const noexcept
 Returns the type of the i-th template argument of a type.
 
bool can_cast (const meta_type &other) const noexcept
 Checks if a type supports direct casting to another type.
 
bool can_convert (const meta_type &other) const noexcept
 Checks if a type supports conversion it to another type.
 
meta_range< meta_type, typename decltype(internal::meta_type_descriptor::base)::const_iterator > base () const noexcept
 Returns a range to visit registered top-level base meta types.
 
meta_range< meta_data, typename decltype(internal::meta_type_descriptor::data)::const_iterator > data () const noexcept
 Returns a range to visit registered top-level meta data.
 
meta_data data (const id_type id) const
 Lookup utility for meta data (bases are also visited).
 
meta_range< meta_func, typename decltype(internal::meta_type_descriptor::func)::const_iterator > func () const noexcept
 Returns a range to visit registered top-level functions.
 
meta_func func (const id_type id) const
 Lookup utility for meta functions (bases are also visited).
 
meta_any construct (meta_any *const args, const size_type sz) const
 Creates an instance of the underlying type, if possible.
 
template<typename... Args>
meta_any construct (Args &&...args) const
 Creates an instance of the underlying type, if possible.
 
meta_any from_void (void *elem) const
 Wraps an opaque element of the underlying type.
 
meta_any from_void (const void *elem) const
 Wraps an opaque element of the underlying type.
 
meta_any invoke (const id_type id, meta_handle instance, meta_any *const args, const size_type sz) const
 Invokes a function given an identifier, if possible.
 
template<typename... Args>
meta_any invoke (const id_type id, meta_handle instance, Args &&...args) const
 Invokes a function given an identifier, if possible.
 
template<typename Type >
bool set (const id_type id, meta_handle instance, Type &&value) const
 Sets the value of a given variable.
 
meta_any get (const id_type id, meta_handle instance) const
 Gets the value of a given variable.
 
meta_range< meta_prop, typename decltype(internal::meta_type_descriptor::prop)::const_iterator > prop () const noexcept
 Returns a range to visit registered top-level meta properties.
 
meta_prop prop (const id_type key) const
 Lookup utility for meta properties (bases are also visited).
 
template<typename Type >
Type traits () const noexcept
 Returns all meta traits for a given meta object.
 
meta_custom custom () const noexcept
 Returns user defined data for a given meta object.
 
 operator bool () const noexcept
 Returns true if an object is valid, false otherwise.
 
bool operator== (const meta_type &other) const noexcept
 Checks if two objects refer to the same type.
 

Detailed Description

Opaque wrapper for types.

Definition at line 1153 of file meta.hpp.

Member Typedef Documentation

◆ size_type

using entt::meta_type::size_type = typename internal::meta_type_node::size_type

Unsigned integer type.

Definition at line 1209 of file meta.hpp.

Constructor & Destructor Documentation

◆ meta_type() [1/2]

entt::meta_type::meta_type ( const meta_ctx & area,
internal::meta_type_node curr )
inlinenoexcept

Context aware constructor for meta objects.

Parameters
areaThe context from which to search for meta types.
currThe underlying node with which to construct the instance.

Definition at line 1219 of file meta.hpp.

◆ meta_type() [2/2]

entt::meta_type::meta_type ( const meta_ctx & area,
const internal::meta_base_node & curr )
inlinenoexcept

Context aware constructor for meta objects.

Parameters
areaThe context from which to search for meta types.
currThe underlying node with which to construct the instance.

Definition at line 1228 of file meta.hpp.

Member Function Documentation

◆ base()

meta_range< meta_type, typename decltype(internal::meta_type_descriptor::base)::const_iterator > entt::meta_type::base ( ) const
inlinenoexcept

Returns a range to visit registered top-level base meta types.

Returns
An iterable range to visit registered top-level base meta types.

Definition at line 1403 of file meta.hpp.

◆ can_cast()

bool entt::meta_type::can_cast ( const meta_type & other) const
inlinenoexcept

Checks if a type supports direct casting to another type.

Parameters
otherThe meta type to test for.
Returns
True if direct casting is allowed, false otherwise.

Definition at line 1385 of file meta.hpp.

◆ can_convert()

bool entt::meta_type::can_convert ( const meta_type & other) const
inlinenoexcept

Checks if a type supports conversion it to another type.

Parameters
otherThe meta type to test for.
Returns
True if the conversion is allowed, false otherwise.

Definition at line 1395 of file meta.hpp.

◆ construct() [1/2]

template<typename... Args>
meta_any entt::meta_type::construct ( Args &&... args) const
inline

Creates an instance of the underlying type, if possible.

Template Parameters
ArgsTypes of arguments to use to construct the instance.
Parameters
argsParameters to use to construct the instance.
Returns
A wrapper containing the new instance, if any.

Definition at line 1476 of file meta.hpp.

◆ construct() [2/2]

meta_any entt::meta_type::construct ( meta_any *const args,
const size_type sz ) const
inline

Creates an instance of the underlying type, if possible.

Parameters
argsParameters to use to construct the instance.
szNumber of parameters to use to construct the instance.
Returns
A wrapper containing the new instance, if any.

Definition at line 1455 of file meta.hpp.

◆ custom()

meta_custom entt::meta_type::custom ( ) const
inlinenoexcept

Returns user defined data for a given meta object.

Returns
User defined arbitrary data.

Definition at line 1587 of file meta.hpp.

◆ data() [1/2]

meta_range< meta_data, typename decltype(internal::meta_type_descriptor::data)::const_iterator > entt::meta_type::data ( ) const
inlinenoexcept

Returns a range to visit registered top-level meta data.

Returns
An iterable range to visit registered top-level meta data.

Definition at line 1412 of file meta.hpp.

◆ data() [2/2]

meta_data entt::meta_type::data ( const id_type id) const
inline

Lookup utility for meta data (bases are also visited).

Parameters
idUnique identifier.
Returns
The registered meta data for the given identifier, if any.

Definition at line 1422 of file meta.hpp.

◆ from_void() [1/2]

meta_any entt::meta_type::from_void ( const void * elem) const
inline

Wraps an opaque element of the underlying type.

Parameters
elemA valid pointer to an element of the underlying type.
Returns
A wrapper that references the given instance.

Definition at line 1491 of file meta.hpp.

◆ from_void() [2/2]

meta_any entt::meta_type::from_void ( void * elem) const
inline

Wraps an opaque element of the underlying type.

Parameters
elemA valid pointer to an element of the underlying type.
Returns
A wrapper that references the given instance.

Definition at line 1486 of file meta.hpp.

◆ func() [1/2]

meta_range< meta_func, typename decltype(internal::meta_type_descriptor::func)::const_iterator > entt::meta_type::func ( ) const
inlinenoexcept

Returns a range to visit registered top-level functions.

Returns
An iterable range to visit registered top-level functions.

Definition at line 1431 of file meta.hpp.

◆ func() [2/2]

meta_func entt::meta_type::func ( const id_type id) const
inline

Lookup utility for meta functions (bases are also visited).

In case of overloaded functions, a random one is returned.

Parameters
idUnique identifier.
Returns
The registered meta function for the given identifier, if any.

Definition at line 1444 of file meta.hpp.

◆ get()

meta_any entt::meta_type::get ( const id_type id,
meta_handle instance ) const
inline

Gets the value of a given variable.

Parameters
idUnique identifier.
instanceAn opaque instance of the underlying type.
Returns
A wrapper containing the value of the underlying variable.

Definition at line 1556 of file meta.hpp.

◆ id()

id_type entt::meta_type::id ( ) const
inlinenoexcept

Returns the identifier assigned to a type.

Returns
The identifier assigned to the type.

Definition at line 1243 of file meta.hpp.

◆ info()

const type_info & entt::meta_type::info ( ) const
inlinenoexcept

Returns the type info object of the underlying type.

Returns
The type info object of the underlying type.

Definition at line 1235 of file meta.hpp.

◆ invoke() [1/2]

template<typename... Args>
meta_any entt::meta_type::invoke ( const id_type id,
meta_handle instance,
Args &&... args ) const
inline

Invokes a function given an identifier, if possible.

Parameters
idUnique identifier.
Template Parameters
ArgsTypes of arguments to use to invoke the function.
Parameters
instanceAn opaque instance of the underlying type.
argsParameters to use to invoke the function.
Returns
A wrapper containing the returned value, if any.

Definition at line 1531 of file meta.hpp.

◆ invoke() [2/2]

meta_any entt::meta_type::invoke ( const id_type id,
meta_handle instance,
meta_any *const args,
const size_type sz ) const
inline

Invokes a function given an identifier, if possible.

Parameters
idUnique identifier.
instanceAn opaque instance of the underlying type.
argsParameters to use to invoke the function.
szNumber of parameters to use to invoke the function.
Returns
A wrapper containing the returned value, if any.

Definition at line 1503 of file meta.hpp.

◆ is_arithmetic()

bool entt::meta_type::is_arithmetic ( ) const
inlinenoexcept

Checks whether a type refers to an arithmetic type or not.

Returns
True if the underlying type is an arithmetic type, false otherwise.

Definition at line 1260 of file meta.hpp.

◆ is_array()

bool entt::meta_type::is_array ( ) const
inlinenoexcept

Checks whether a type refers to an array type or not.

Returns
True if the underlying type is an array type, false otherwise.

Definition at line 1284 of file meta.hpp.

◆ is_associative_container()

bool entt::meta_type::is_associative_container ( ) const
inlinenoexcept

Checks whether a type refers to an associative container or not.

Returns
True if the type is an associative container, false otherwise.

Definition at line 1341 of file meta.hpp.

◆ is_class()

bool entt::meta_type::is_class ( ) const
inlinenoexcept

Checks whether a type refers to a class or not.

Returns
True if the underlying type is a class, false otherwise.

Definition at line 1300 of file meta.hpp.

◆ is_enum()

bool entt::meta_type::is_enum ( ) const
inlinenoexcept

Checks whether a type refers to an enum or not.

Returns
True if the underlying type is an enum, false otherwise.

Definition at line 1292 of file meta.hpp.

◆ is_integral()

bool entt::meta_type::is_integral ( ) const
inlinenoexcept

Checks whether a type refers to an integral type or not.

Returns
True if the underlying type is an integral type, false otherwise.

Definition at line 1268 of file meta.hpp.

◆ is_pointer()

bool entt::meta_type::is_pointer ( ) const
inlinenoexcept

Checks whether a type refers to a pointer or not.

Returns
True if the underlying type is a pointer, false otherwise.

Definition at line 1308 of file meta.hpp.

◆ is_pointer_like()

bool entt::meta_type::is_pointer_like ( ) const
inlinenoexcept

Checks whether a type is a pointer-like type or not.

Returns
True if the underlying type is pointer-like, false otherwise.

Definition at line 1325 of file meta.hpp.

◆ is_sequence_container()

bool entt::meta_type::is_sequence_container ( ) const
inlinenoexcept

Checks whether a type refers to a sequence container or not.

Returns
True if the type is a sequence container, false otherwise.

Definition at line 1333 of file meta.hpp.

◆ is_signed()

bool entt::meta_type::is_signed ( ) const
inlinenoexcept

Checks whether a type refers to a signed type or not.

Returns
True if the underlying type is a signed type, false otherwise.

Definition at line 1276 of file meta.hpp.

◆ is_template_specialization()

bool entt::meta_type::is_template_specialization ( ) const
inlinenoexcept

Checks whether a type refers to a recognized class template specialization or not.

Returns
True if the type is a recognized class template specialization, false otherwise.

Definition at line 1351 of file meta.hpp.

◆ operator bool()

entt::meta_type::operator bool ( ) const
inlineexplicitnoexcept

Returns true if an object is valid, false otherwise.

Returns
True if the object is valid, false otherwise.

Definition at line 1595 of file meta.hpp.

◆ operator==()

bool entt::meta_type::operator== ( const meta_type & other) const
inlinenoexcept

Checks if two objects refer to the same type.

Parameters
otherThe object with which to compare.
Returns
True if the objects refer to the same type, false otherwise.

Definition at line 1600 of file meta.hpp.

◆ prop() [1/2]

meta_range< meta_prop, typename decltype(internal::meta_type_descriptor::prop)::const_iterator > entt::meta_type::prop ( ) const
inlinenoexcept

Returns a range to visit registered top-level meta properties.

Returns
An iterable range to visit registered top-level meta properties.

Definition at line 1565 of file meta.hpp.

◆ prop() [2/2]

meta_prop entt::meta_type::prop ( const id_type key) const
inline

Lookup utility for meta properties (bases are also visited).

Parameters
keyThe key to use to search for a property.
Returns
The registered meta property for the given key, if any.

Definition at line 1575 of file meta.hpp.

◆ remove_pointer()

meta_type entt::meta_type::remove_pointer ( ) const
inlinenoexcept

Provides the type for which the pointer is defined.

Returns
The type for which the pointer is defined or this type if it doesn't refer to a pointer type.

Definition at line 1317 of file meta.hpp.

◆ set()

template<typename Type >
bool entt::meta_type::set ( const id_type id,
meta_handle instance,
Type && value ) const
inline

Sets the value of a given variable.

Template Parameters
TypeType of value to assign.
Parameters
idUnique identifier.
instanceAn opaque instance of the underlying type.
valueParameter to use to set the underlying variable.
Returns
True in case of success, false otherwise.

Definition at line 1545 of file meta.hpp.

◆ size_of()

size_type entt::meta_type::size_of ( ) const
inlinenoexcept

Returns the size of the underlying type if known.

Returns
The size of the underlying type if known, 0 otherwise.

Definition at line 1251 of file meta.hpp.

◆ template_arg()

meta_type entt::meta_type::template_arg ( const size_type index) const
inlinenoexcept

Returns the type of the i-th template argument of a type.

Parameters
indexIndex of the template argument of which to return the type.
Returns
The type of the i-th template argument of a type.

Definition at line 1376 of file meta.hpp.

◆ template_arity()

size_type entt::meta_type::template_arity ( ) const
inlinenoexcept

Returns the number of template arguments.

Returns
The number of template arguments.

Definition at line 1359 of file meta.hpp.

◆ template_type()

meta_type entt::meta_type::template_type ( ) const
inlinenoexcept

Returns a tag for the class template of the underlying type.

Returns
The tag for the class template of the underlying type.

Definition at line 1367 of file meta.hpp.

◆ traits()

template<typename Type >
Type entt::meta_type::traits ( ) const
inlinenoexcept

Returns all meta traits for a given meta object.

Template Parameters
TypeThe type to convert the meta traits to.
Returns
The registered meta traits, if any.

Definition at line 1582 of file meta.hpp.


The documentation for this class was generated from the following file: