EnTT 4.0.0
Loading...
Searching...
No Matches
entt::meta_type Class Reference

Opaque wrapper for types. More...

#include <meta.hpp>

Public Types

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

Public Member Functions

 meta_type () noexcept=default
 Default constructor.
 meta_type (const meta_ctx &area, const internal::meta_type_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 alias () const noexcept
 Returns the alias assigned to a type.
stl::string_view name () const noexcept
 Returns the name assigned to a type, if any.
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 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 whether a type supports conversion to another type.
meta_range< meta_base, 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, 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 bool recursive=true) const
 Lookup utility for meta data (bases are also visited).
meta_range< meta_func, 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 bool recursive=true) const
 Lookup utility for meta functions (bases are also visited).
meta_any construct (auto &&...args) const
meta_any from_void (void *elem, bool transfer_ownership=false) 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.
template<typename Instance = meta_handle>
meta_any invoke (const id_type id, Instance &&instance, auto &&...args) const
template<typename Instance = meta_handle>
bool set (const id_type id, Instance &&instance, auto &&...args) const
 Sets the value of a given variable.
template<typename Instance = meta_handle>
meta_any get (const id_type id, Instance &&instance, auto &&...args) const
 Gets the value of a given variable.
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.

Friends

class meta_any

Detailed Description

Opaque wrapper for types.

Definition at line 1026 of file meta.hpp.

Member Typedef Documentation

◆ size_type

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

Unsigned integer type.

Definition at line 1087 of file meta.hpp.

Constructor & Destructor Documentation

◆ meta_type()

entt::meta_type::meta_type ( const meta_ctx & area,
const 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 1097 of file meta.hpp.

Member Function Documentation

◆ alias()

id_type entt::meta_type::alias ( ) const
inlinenodiscardnoexcept

Returns the alias assigned to a type.

Returns
The alias assigned to the type.

Definition at line 1113 of file meta.hpp.

◆ base()

meta_range< meta_base, decltype(internal::meta_type_descriptor::base)::const_iterator > entt::meta_type::base ( ) const
inlinenodiscardnoexcept

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 1293 of file meta.hpp.

◆ can_cast()

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

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 1261 of file meta.hpp.

◆ can_convert()

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

Checks whether a type supports conversion to another type.

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

Definition at line 1271 of file meta.hpp.

◆ construct()

meta_any entt::meta_type::construct ( auto &&... args) const
inlinenodiscard

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

Definition at line 1343 of file meta.hpp.

◆ custom()

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

Returns user defined data for a given meta object.

Returns
User defined arbitrary data.

Definition at line 1442 of file meta.hpp.

◆ data() [1/2]

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

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

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

Definition at line 1302 of file meta.hpp.

◆ data() [2/2]

meta_data entt::meta_type::data ( const id_type id,
const bool recursive = true ) const
inlinenodiscard

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

Parameters
idUnique identifier.
recursiveTrue for a search in the base classes, false otherwise.
Returns
The registered meta data for the given identifier, if any.

Definition at line 1313 of file meta.hpp.

◆ from_void() [1/2]

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

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 1372 of file meta.hpp.

◆ from_void() [2/2]

meta_any entt::meta_type::from_void ( void * elem,
bool transfer_ownership = false ) const
inlinenodiscard

Wraps an opaque element of the underlying type.

Parameters
elemA valid pointer to an element of the underlying type.
transfer_ownershipTrue to transfer ownership, false otherwise.
Returns
A wrapper that references the given instance.

Definition at line 1363 of file meta.hpp.

◆ func() [1/2]

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

Returns a range to visit registered top-level functions.

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

Definition at line 1322 of file meta.hpp.

◆ func() [2/2]

meta_func entt::meta_type::func ( const id_type id,
const bool recursive = true ) const
inlinenodiscard

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

Parameters
idUnique identifier.
recursiveTrue for a search in the base classes, false otherwise.
Returns
The registered meta function for the given identifier, if any.

Definition at line 1333 of file meta.hpp.

◆ get()

template<typename Instance = meta_handle>
meta_any entt::meta_type::get ( const id_type id,
Instance && instance,
auto &&... args ) const
inlinenodiscard

Gets the value of a given variable.

Template Parameters
InstanceType of instance to operate on.
Parameters
idUnique identifier.
instanceAn instance that fits the underlying type.
argsParameters to use to set the underlying variable, if any.
Returns
A wrapper containing the value of the underlying variable.

Definition at line 1430 of file meta.hpp.

◆ info()

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

Returns the type info object of the underlying type.

Returns
The type info object of the underlying type.

Definition at line 1105 of file meta.hpp.

◆ invoke()

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

Parameters
idUnique identifier.
Template Parameters
InstanceType of instance to operate on.
Parameters
instanceAn instance that fits the underlying type.
argsParameters to use to invoke the function.
Returns
A wrapper containing the returned value, if any.

Definition at line 1386 of file meta.hpp.

◆ is_arithmetic()

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

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 1138 of file meta.hpp.

◆ is_array()

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

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 1162 of file meta.hpp.

◆ is_associative_container()

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

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 1219 of file meta.hpp.

◆ is_class()

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

Checks whether a type refers to a class or not.

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

Definition at line 1178 of file meta.hpp.

◆ is_enum()

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

Checks whether a type refers to an enum or not.

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

Definition at line 1170 of file meta.hpp.

◆ is_integral()

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

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 1146 of file meta.hpp.

◆ is_pointer()

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

Checks whether a type refers to a pointer or not.

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

Definition at line 1186 of file meta.hpp.

◆ is_pointer_like()

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

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 1203 of file meta.hpp.

◆ is_sequence_container()

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

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 1211 of file meta.hpp.

◆ is_signed()

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

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 1154 of file meta.hpp.

◆ is_template_specialization()

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

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

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

Definition at line 1227 of file meta.hpp.

◆ name()

stl::string_view entt::meta_type::name ( ) const
inlinenodiscardnoexcept

Returns the name assigned to a type, if any.

Returns
The name assigned to the type, if any.

Definition at line 1121 of file meta.hpp.

◆ operator bool()

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

Returns true if an object is valid, false otherwise.

Returns
True if the object is valid, false otherwise.

Definition at line 1447 of file meta.hpp.

◆ operator==()

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

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 1452 of file meta.hpp.

◆ remove_pointer()

meta_type entt::meta_type::remove_pointer ( ) const
inlinenodiscardnoexcept

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 1195 of file meta.hpp.

◆ set()

template<typename Instance = meta_handle>
bool entt::meta_type::set ( const id_type id,
Instance && instance,
auto &&... args ) const
inline

Sets the value of a given variable.

Template Parameters
InstanceType of instance to operate on.
Parameters
idUnique identifier.
instanceAn instance that fits the underlying type.
argsParameters to use to set the underlying variable.
Returns
True in case of success, false otherwise.

Definition at line 1416 of file meta.hpp.

◆ size_of()

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

Returns the size of the underlying type if known.

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

Definition at line 1129 of file meta.hpp.

◆ template_arg()

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

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 1252 of file meta.hpp.

◆ template_arity()

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

Returns the number of template arguments.

Returns
The number of template arguments.

Definition at line 1235 of file meta.hpp.

◆ template_type()

meta_type entt::meta_type::template_type ( ) const
inlinenodiscardnoexcept

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 1243 of file meta.hpp.

◆ traits()

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

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 1437 of file meta.hpp.

◆ meta_any

friend class meta_any
friend

Definition at line 1027 of file meta.hpp.


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