EnTT 3.16.0
Loading...
Searching...
No Matches
entt::meta_factory< Type > Class Template Reference

Meta factory to be used for reflection purposes. More...

#include <factory.hpp>

Inheritance diagram for entt::meta_factory< Type >:
Collaboration diagram for entt::meta_factory< Type >:

Public Types

using element_type = Type
 Type of object for which this factory builds a meta type.

Public Member Functions

 meta_factory () noexcept
 Default constructor.
 meta_factory (meta_ctx &area) noexcept
 Context aware constructor.
meta_factory type (const char *name) noexcept
 Assigns a custom unique identifier to a meta type.
meta_factory type (const id_type id, const char *name=nullptr) noexcept
 Assigns a custom unique identifier to a meta type.
template<typename Base>
meta_factory base () noexcept
 Assigns a meta base to a meta type.
template<auto Candidate>
auto conv () noexcept
 Assigns a meta conversion function to a meta type.
template<typename To>
meta_factory conv () noexcept
 Assigns a meta conversion function to a meta type.
template<auto Candidate, typename Policy = as_value_t>
meta_factory ctor () noexcept
 Assigns a meta constructor to a meta type.
template<typename... Args>
meta_factory ctor () noexcept
 Assigns a meta constructor to a meta type.
template<auto Data, typename Policy = as_value_t>
meta_factory data (const char *name) noexcept
 Assigns a meta data to a meta type.
template<auto Data, typename Policy = as_value_t>
meta_factory data (const id_type id, const char *name=nullptr) noexcept
 Assigns a meta data to a meta type.
template<auto Setter, auto Getter, typename Policy = as_value_t>
meta_factory data (const char *name) noexcept
 Assigns a meta data to a meta type by means of its setter and getter.
template<auto Setter, auto Getter, typename Policy = as_value_t>
meta_factory data (const id_type id, const char *name=nullptr) noexcept
 Assigns a meta data to a meta type by means of its setter and getter.
template<auto Candidate, typename Policy = as_value_t>
meta_factory func (const char *name) noexcept
 Assigns a meta function to a meta type.
template<auto Candidate, typename Policy = as_value_t>
meta_factory func (const id_type id, const char *name=nullptr) noexcept
 Assigns a meta function to a meta type.
template<typename Value>
meta_factory traits (const Value value, const bool unset=false)
 Sets traits on the last created meta object.
template<typename Value, typename... Args>
meta_factory custom (Args &&...args)
 Sets user defined data that will never be used by the library.

Detailed Description

template<typename Type>
class entt::meta_factory< Type >

Meta factory to be used for reflection purposes.

Template Parameters
TypeType for which the factory was created.

Definition at line 158 of file factory.hpp.

Member Typedef Documentation

◆ element_type

template<typename Type>
using entt::meta_factory< Type >::element_type = Type

Type of object for which this factory builds a meta type.

Definition at line 163 of file factory.hpp.

Constructor & Destructor Documentation

◆ meta_factory() [1/2]

template<typename Type>
entt::meta_factory< Type >::meta_factory ( )
inlinenoexcept

Default constructor.

Definition at line 166 of file factory.hpp.

◆ meta_factory() [2/2]

template<typename Type>
entt::meta_factory< Type >::meta_factory ( meta_ctx & area)
inlinenoexcept

Context aware constructor.

Parameters
areaThe context into which to construct meta types.

Definition at line 173 of file factory.hpp.

Member Function Documentation

◆ base()

template<typename Type>
template<typename Base>
meta_factory entt::meta_factory< Type >::base ( )
inlinenoexcept

Assigns a meta base to a meta type.

A reflected base class must be a real base class of the reflected type.

Template Parameters
BaseType of the base class to assign to the meta type.
Returns
A meta factory for the parent type.

Definition at line 205 of file factory.hpp.

◆ conv() [1/2]

template<typename Type>
template<typename To>
meta_factory entt::meta_factory< Type >::conv ( )
inlinenoexcept

Assigns a meta conversion function to a meta type.

The given type must be such that an instance of the reflected type can be converted to it.

Template Parameters
ToType of the conversion function to assign to the meta type.
Returns
A meta factory for the parent type.

Definition at line 242 of file factory.hpp.

◆ conv() [2/2]

template<typename Type>
template<auto Candidate>
auto entt::meta_factory< Type >::conv ( )
inlinenoexcept

Assigns a meta conversion function to a meta type.

Conversion functions can be either free functions or member functions.
In case of free functions, they must accept a const reference to an instance of the parent type as an argument. In case of member functions, they should have no arguments at all.

Template Parameters
CandidateThe actual function to use for the conversion.
Returns
A meta factory for the parent type.

Definition at line 225 of file factory.hpp.

◆ ctor() [1/2]

template<typename Type>
template<typename... Args>
meta_factory entt::meta_factory< Type >::ctor ( )
inlinenoexcept

Assigns a meta constructor to a meta type.

A meta constructor is uniquely identified by the types of its arguments and is such that there exists an actual constructor of the underlying type that can be invoked with parameters whose types are those given.

Template Parameters
ArgsTypes of arguments to use to construct an instance.
Returns
A meta factory for the parent type.

Definition at line 282 of file factory.hpp.

◆ ctor() [2/2]

template<typename Type>
template<auto Candidate, typename Policy = as_value_t>
meta_factory entt::meta_factory< Type >::ctor ( )
inlinenoexcept

Assigns a meta constructor to a meta type.

Both member functions and free function can be assigned to meta types in the role of constructors. All that is required is that they return an instance of the underlying type.
From a client's point of view, nothing changes if a constructor of a meta type is a built-in one or not.

Template Parameters
CandidateThe actual function to use as a constructor.
PolicyOptional policy (no policy set by default).
Returns
A meta factory for the parent type.

Definition at line 263 of file factory.hpp.

◆ custom()

template<typename Type>
template<typename Value, typename... Args>
meta_factory entt::meta_factory< Type >::custom ( Args &&... args)
inline

Sets user defined data that will never be used by the library.

Template Parameters
ValueType of user defined data to store.
ArgsTypes of arguments to use to construct the user data.
Parameters
argsParameters to use to initialize the user data.
Returns
A meta factory for the parent type.

Definition at line 499 of file factory.hpp.

◆ data() [1/4]

template<typename Type>
template<auto Setter, auto Getter, typename Policy = as_value_t>
meta_factory entt::meta_factory< Type >::data ( const char * name)
inlinenoexcept

Assigns a meta data to a meta type by means of its setter and getter.

Template Parameters
SetterThe actual function to use as a setter.
GetterThe actual function to use as a getter.
PolicyOptional policy (no policy set by default).
Parameters
nameA custom unique identifier as a string literal.
Returns
A meta factory for the given type.

Definition at line 369 of file factory.hpp.

◆ data() [2/4]

template<typename Type>
template<auto Data, typename Policy = as_value_t>
meta_factory entt::meta_factory< Type >::data ( const char * name)
inlinenoexcept

Assigns a meta data to a meta type.

Template Parameters
DataThe actual variable to attach to the meta type.
PolicyOptional policy (no policy set by default).
Parameters
nameA custom unique identifier as a string literal.
Returns
A meta factory for the given type.

Definition at line 300 of file factory.hpp.

◆ data() [3/4]

template<typename Type>
template<auto Setter, auto Getter, typename Policy = as_value_t>
meta_factory entt::meta_factory< Type >::data ( const id_type id,
const char * name = nullptr )
inlinenoexcept

Assigns a meta data to a meta type by means of its setter and getter.

Setters and getters can be either free functions, member functions or a mix of them.
In case of free functions, setters and getters must accept a reference to an instance of the parent type as their first argument. A setter has then an extra argument of a type convertible to that of the parameter to set.
In case of member functions, getters have no arguments at all, while setters has an argument of a type convertible to that of the parameter to set.

Template Parameters
SetterThe actual function to use as a setter.
GetterThe actual function to use as a getter.
PolicyOptional policy (no policy set by default).
Parameters
idUnique identifier.
nameAn optional name for the meta data as a string literal.
Returns
A meta factory for the parent type.

Definition at line 395 of file factory.hpp.

◆ data() [4/4]

template<typename Type>
template<auto Data, typename Policy = as_value_t>
meta_factory entt::meta_factory< Type >::data ( const id_type id,
const char * name = nullptr )
inlinenoexcept

Assigns a meta data to a meta type.

Both data members and static and global variables, as well as constants of any kind, can be assigned to a meta type.
From a client's point of view, all the variables associated with the reflected object will appear as if they were part of the type itself.

Template Parameters
DataThe actual variable to attach to the meta type.
PolicyOptional policy (no policy set by default).
Parameters
idUnique identifier.
nameAn optional name for the meta data as a string literal.
Returns
A meta factory for the parent type.

Definition at line 319 of file factory.hpp.

◆ func() [1/2]

template<typename Type>
template<auto Candidate, typename Policy = as_value_t>
meta_factory entt::meta_factory< Type >::func ( const char * name)
inlinenoexcept

Assigns a meta function to a meta type.

Template Parameters
CandidateThe actual function to attach to the meta function.
PolicyOptional policy (no policy set by default).
Parameters
nameA custom unique identifier as a string literal.
Returns
A meta factory for the given type.

Definition at line 438 of file factory.hpp.

◆ func() [2/2]

template<typename Type>
template<auto Candidate, typename Policy = as_value_t>
meta_factory entt::meta_factory< Type >::func ( const id_type id,
const char * name = nullptr )
inlinenoexcept

Assigns a meta function to a meta type.

Both member functions and free functions can be assigned to a meta type.
From a client's point of view, all the functions associated with the reflected object will appear as if they were part of the type itself.

Template Parameters
CandidateThe actual function to attach to the meta type.
PolicyOptional policy (no policy set by default).
Parameters
idUnique identifier.
nameAn optional name for the function as a string literal.
Returns
A meta factory for the parent type.

Definition at line 457 of file factory.hpp.

◆ traits()

template<typename Type>
template<typename Value>
meta_factory entt::meta_factory< Type >::traits ( const Value value,
const bool unset = false )
inline

Sets traits on the last created meta object.

The assigned value must be an enum and intended as a bitmask.

Template Parameters
ValueType of the traits value.
Parameters
valueTraits value.
unsetTrue to unset the given traits, false otherwise.
Returns
A meta factory for the parent type.

Definition at line 485 of file factory.hpp.

◆ type() [1/2]

template<typename Type>
meta_factory entt::meta_factory< Type >::type ( const char * name)
inlinenoexcept

Assigns a custom unique identifier to a meta type.

Parameters
nameA custom unique identifier as a string literal.
Returns
A meta factory for the given type.

Definition at line 181 of file factory.hpp.

◆ type() [2/2]

template<typename Type>
meta_factory entt::meta_factory< Type >::type ( const id_type id,
const char * name = nullptr )
inlinenoexcept

Assigns a custom unique identifier to a meta type.

Parameters
idA custom unique identifier.
nameAn optional name for the type as a string literal.
Returns
A meta factory for the given type.

Definition at line 191 of file factory.hpp.


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