meta  1.4.9
Public Types | Public Member Functions | Friends | List of all members
meta::type Class Reference

Meta type object. More...

#include <meta.hpp>

Public Types

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

Public Member Functions

 type () noexcept
 Default constructor.
 
bool is_void () const noexcept
 Indicates whether a given meta type refers to void or not. More...
 
bool is_integral () const noexcept
 Indicates whether a given meta type refers to an integral type or not. More...
 
bool is_floating_point () const noexcept
 Indicates whether a given meta type refers to a floating-point type or not. More...
 
bool is_array () const noexcept
 Indicates whether a given meta type refers to an array type or not. More...
 
bool is_enum () const noexcept
 Indicates whether a given meta type refers to an enum or not. More...
 
bool is_union () const noexcept
 Indicates whether a given meta type refers to an union or not. More...
 
bool is_class () const noexcept
 Indicates whether a given meta type refers to a class or not. More...
 
bool is_pointer () const noexcept
 Indicates whether a given meta type refers to a pointer or not. More...
 
bool is_function_pointer () const noexcept
 Indicates whether a given meta type refers to a function pointer or not. More...
 
bool is_member_object_pointer () const noexcept
 Indicates whether a given meta type refers to a pointer to data member or not. More...
 
bool is_member_function_pointer () const noexcept
 Indicates whether a given meta type refers to a pointer to member function or not. More...
 
size_type extent () const noexcept
 If a given meta type refers to an array type, provides the number of elements of the array. More...
 
meta::type remove_pointer () const noexcept
 Provides the meta type for which the pointer is defined. More...
 
template<typename Op >
std::enable_if_t< std::is_invocable_v< Op, meta::base >, void > base (Op op) const noexcept
 Iterates all the meta base of a meta type. More...
 
meta::base base (const std::size_t identifier) const noexcept
 Returns the meta base associated with a given identifier. More...
 
template<typename Op >
void conv (Op op) const noexcept
 Iterates all the meta conversion functions of a meta type. More...
 
template<typename Type >
meta::conv conv () const noexcept
 Returns the meta conversion function associated with a given type. More...
 
template<typename Op >
void ctor (Op op) const noexcept
 Iterates all the meta constructors of a meta type. More...
 
template<typename... Args>
meta::ctor ctor () const noexcept
 Returns the meta constructor that accepts a given list of types of arguments. More...
 
meta::dtor dtor () const noexcept
 Returns the meta destructor associated with a given type. More...
 
template<typename Op >
std::enable_if_t< std::is_invocable_v< Op, meta::data >, void > data (Op op) const noexcept
 Iterates all the meta data of a meta type. More...
 
meta::data data (const std::size_t identifier) const noexcept
 Returns the meta data associated with a given identifier. More...
 
template<typename Op >
std::enable_if_t< std::is_invocable_v< Op, meta::func >, void > func (Op op) const noexcept
 Iterates all the meta functions of a meta type. More...
 
meta::func func (const std::size_t identifier) const noexcept
 Returns the meta function associated with a given identifier. More...
 
template<typename... Args>
any construct (Args &&... args) const
 Creates an instance of the underlying type, if possible. More...
 
bool destroy (handle handle) const
 Destroys an instance of the underlying type. More...
 
template<typename Op >
std::enable_if_t< std::is_invocable_v< Op, meta::prop >, void > prop (Op op) const noexcept
 Iterates all the properties assigned to a meta type. More...
 
template<typename Key >
std::enable_if_t<!std::is_invocable_v< Key, meta::prop >, meta::propprop (Key &&key) const noexcept
 Returns the property associated with a given key. More...
 
 operator bool () const noexcept
 Returns true if a meta object is valid, false otherwise. More...
 
bool operator== (const type &other) const noexcept
 Checks if two meta objects refer to the same node. More...
 

Friends

template<typename... >
struct internal::info_node
 A meta node is allowed to create meta objects.
 

Detailed Description

Meta type object.

A meta type is the starting point for accessing a reflected type, thus being able to work through it on real objects.

Definition at line 1524 of file meta.hpp.

Member Function Documentation

◆ base() [1/2]

template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta::base>, void> meta::type::base ( Op  op) const
inlinenoexcept

Iterates all the meta base of a meta type.

Iteratively returns all the base classes of the given type.

Template Parameters
OpType of the function object to invoke.
Parameters
opA valid function object.

Definition at line 1668 of file meta.hpp.

◆ base() [2/2]

meta::base meta::type::base ( const std::size_t  identifier) const
inlinenoexcept

Returns the meta base associated with a given identifier.

Searches recursively among all the base classes of the given type.

Parameters
identifierUnique identifier.
Returns
The meta base associated with the given identifier, if any.

Definition at line 1682 of file meta.hpp.

◆ construct()

template<typename... Args>
any meta::type::construct ( Args &&...  args) const
inline

Creates an instance of the underlying type, if possible.

To create a valid instance, the types of the parameters must coincide exactly with those required by the underlying meta constructor. Otherwise, an empty and then invalid container is returned.

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

Definition at line 1839 of file meta.hpp.

◆ conv() [1/2]

template<typename Op >
void meta::type::conv ( Op  op) const
inlinenoexcept

Iterates all the meta conversion functions of a meta type.

Iteratively returns all the meta conversion functions of the given type.

Template Parameters
OpType of the function object to invoke.
Parameters
opA valid function object.

Definition at line 1700 of file meta.hpp.

◆ conv() [2/2]

template<typename Type >
meta::conv meta::type::conv ( ) const
inlinenoexcept

Returns the meta conversion function associated with a given type.

Searches recursively among all the conversion functions of the given type.

Template Parameters
TypeThe type to use to search for a meta conversion function.
Returns
The meta conversion function associated with the given type, if any.

Definition at line 1717 of file meta.hpp.

◆ ctor() [1/2]

template<typename Op >
void meta::type::ctor ( Op  op) const
inlinenoexcept

Iterates all the meta constructors of a meta type.

Template Parameters
OpType of the function object to invoke.
Parameters
opA valid function object.

Definition at line 1731 of file meta.hpp.

◆ ctor() [2/2]

template<typename... Args>
meta::ctor meta::type::ctor ( ) const
inlinenoexcept

Returns the meta constructor that accepts a given list of types of arguments.

Returns
The requested meta constructor, if any.

Definition at line 1743 of file meta.hpp.

◆ data() [1/2]

template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta::data>, void> meta::type::data ( Op  op) const
inlinenoexcept

Iterates all the meta data of a meta type.

Iteratively returns all the meta data of the given type. This means that the meta data of the base classes will also be returned, if any.

Template Parameters
OpType of the function object to invoke.
Parameters
opA valid function object.

Definition at line 1767 of file meta.hpp.

◆ data() [2/2]

meta::data meta::type::data ( const std::size_t  identifier) const
inlinenoexcept

Returns the meta data associated with a given identifier.

Searches recursively among all the meta data of the given type. This means that the meta data of the base classes will also be inspected, if any.

Parameters
identifierUnique identifier.
Returns
The meta data associated with the given identifier, if any.

Definition at line 1783 of file meta.hpp.

◆ destroy()

bool meta::type::destroy ( handle  handle) const
inline

Destroys an instance of the underlying type.

It must be possible to cast the instance to the underlying type. Otherwise, invoking the meta destructor results in an undefined behavior.
If no destructor has been set, this function returns true without doing anything.

Parameters
handleAn opaque pointer to an instance of the underlying type.
Returns
True in case of success, false otherwise.

Definition at line 1866 of file meta.hpp.

◆ dtor()

meta::dtor meta::type::dtor ( ) const
inlinenoexcept

Returns the meta destructor associated with a given type.

Returns
The meta destructor associated with the given type, if any.

Definition at line 1752 of file meta.hpp.

◆ extent()

size_type meta::type::extent ( ) const
inlinenoexcept

If a given meta type refers to an array type, provides the number of elements of the array.

Returns
The number of elements of the array if the underlying type is an array type, 0 otherwise.

Definition at line 1645 of file meta.hpp.

◆ func() [1/2]

template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta::func>, void> meta::type::func ( Op  op) const
inlinenoexcept

Iterates all the meta functions of a meta type.

Iteratively returns all the meta functions of the given type. This means that the meta functions of the base classes will also be returned, if any.

Template Parameters
OpType of the function object to invoke.
Parameters
opA valid function object.

Definition at line 1803 of file meta.hpp.

◆ func() [2/2]

meta::func meta::type::func ( const std::size_t  identifier) const
inlinenoexcept

Returns the meta function associated with a given identifier.

Searches recursively among all the meta functions of the given type. This means that the meta functions of the base classes will also be inspected, if any.

Parameters
identifierUnique identifier.
Returns
The meta function associated with the given identifier, if any.

Definition at line 1819 of file meta.hpp.

◆ is_array()

bool meta::type::is_array ( ) const
inlinenoexcept

Indicates whether a given meta type refers to an array type or not.

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

Definition at line 1573 of file meta.hpp.

◆ is_class()

bool meta::type::is_class ( ) const
inlinenoexcept

Indicates whether a given meta type refers to a class or not.

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

Definition at line 1597 of file meta.hpp.

◆ is_enum()

bool meta::type::is_enum ( ) const
inlinenoexcept

Indicates whether a given meta type refers to an enum or not.

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

Definition at line 1581 of file meta.hpp.

◆ is_floating_point()

bool meta::type::is_floating_point ( ) const
inlinenoexcept

Indicates whether a given meta type refers to a floating-point type or not.

Returns
True if the underlying type is a floating-point type, false otherwise.

Definition at line 1564 of file meta.hpp.

◆ is_function_pointer()

bool meta::type::is_function_pointer ( ) const
inlinenoexcept

Indicates whether a given meta type refers to a function pointer or not.

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

Definition at line 1615 of file meta.hpp.

◆ is_integral()

bool meta::type::is_integral ( ) const
inlinenoexcept

Indicates whether a given meta type refers to an integral type or not.

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

Definition at line 1554 of file meta.hpp.

◆ is_member_function_pointer()

bool meta::type::is_member_function_pointer ( ) const
inlinenoexcept

Indicates whether a given meta type refers to a pointer to member function or not.

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

Definition at line 1635 of file meta.hpp.

◆ is_member_object_pointer()

bool meta::type::is_member_object_pointer ( ) const
inlinenoexcept

Indicates whether a given meta type refers to a pointer to data member or not.

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

Definition at line 1625 of file meta.hpp.

◆ is_pointer()

bool meta::type::is_pointer ( ) const
inlinenoexcept

Indicates whether a given meta type refers to a pointer or not.

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

Definition at line 1605 of file meta.hpp.

◆ is_union()

bool meta::type::is_union ( ) const
inlinenoexcept

Indicates whether a given meta type refers to an union or not.

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

Definition at line 1589 of file meta.hpp.

◆ is_void()

bool meta::type::is_void ( ) const
inlinenoexcept

Indicates whether a given meta type refers to void or not.

Returns
True if the underlying type is void, false otherwise.

Definition at line 1545 of file meta.hpp.

◆ operator bool()

meta::type::operator bool ( ) const
inlineexplicitnoexcept

Returns true if a meta object is valid, false otherwise.

Returns
True if the meta object is valid, false otherwise.

Definition at line 1912 of file meta.hpp.

◆ operator==()

bool meta::type::operator== ( const type other) const
inlinenoexcept

Checks if two meta objects refer to the same node.

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

Definition at line 1922 of file meta.hpp.

◆ prop() [1/2]

template<typename Op >
std::enable_if_t<std::is_invocable_v<Op, meta::prop>, void> meta::type::prop ( Op  op) const
inlinenoexcept

Iterates all the properties assigned to a meta type.

Iteratively returns all the properties of the given type. This means that the properties of the base classes will also be returned, if any.

Template Parameters
OpType of the function object to invoke.
Parameters
opA valid function object.

Definition at line 1881 of file meta.hpp.

◆ prop() [2/2]

template<typename Key >
std::enable_if_t<!std::is_invocable_v<Key, meta::prop>, meta::prop> meta::type::prop ( Key &&  key) const
inlinenoexcept

Returns the property associated with a given key.

Searches recursively among all the properties of the given type. This means that the properties of the base classes will also be inspected, if any.

Template Parameters
KeyType of key to use to search for a property.
Parameters
keyThe key to use to search for a property.
Returns
The property associated with the given key, if any.

Definition at line 1900 of file meta.hpp.

◆ remove_pointer()

meta::type meta::type::remove_pointer ( ) const
inlinenoexcept

Provides the meta type for which the pointer is defined.

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

Definition at line 1654 of file meta.hpp.


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