Clementine
|
Non-owning handle to an entity. More...
#include <entt.hpp>
Public Types | |
using | entity_type = std::remove_const_t< Entity > |
Underlying entity identifier. | |
using | registry_type = constness_as_t< basic_registry< entity_type >, Entity > |
Type of registry accepted by the handle. | |
Public Member Functions | |
basic_handle () ENTT_NOEXCEPT | |
Constructs an invalid handle. | |
basic_handle (registry_type &ref, entity_type value) ENTT_NOEXCEPT | |
Constructs a handle from a given registry and entity. More... | |
template<typename... Args> | |
bool | operator== (const basic_handle< Args... > &other) const ENTT_NOEXCEPT |
Compares two handles. More... | |
template<typename Other , typename... Args> | |
operator basic_handle< Other, Args... > () const ENTT_NOEXCEPT | |
Constructs a const handle from a non-const one. More... | |
operator entity_type () const ENTT_NOEXCEPT | |
Converts a handle to its underlying entity. More... | |
operator bool () const ENTT_NOEXCEPT | |
Checks if a handle refers to non-null registry pointer and entity. More... | |
bool | valid () const |
Checks if a handle refers to a valid entity or not. More... | |
registry_type * | registry () const ENTT_NOEXCEPT |
Returns a pointer to the underlying registry, if any. More... | |
entity_type | entity () const ENTT_NOEXCEPT |
Returns the entity associated with a handle. More... | |
void | destroy () |
Destroys the entity associated with a handle. More... | |
void | destroy (const typename registry_type::version_type version) |
Destroys the entity associated with a handle. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | emplace (Args &&... args) const |
Assigns the given component to a handle. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | emplace_or_replace (Args &&... args) const |
Assigns or replaces the given component for a handle. More... | |
template<typename Component , typename... Func> | |
decltype(auto) | patch (Func &&... func) const |
Patches the given component for a handle. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | replace (Args &&... args) const |
Replaces the given component for a handle. More... | |
template<typename... Component> | |
void | remove () const |
Removes the given components from a handle. More... | |
template<typename... Component> | |
decltype(auto) | remove_if_exists () const |
Removes the given components from a handle. More... | |
void | remove_all () const |
Removes all the components from a handle and makes it orphaned. More... | |
template<typename... Component> | |
decltype(auto) | has () const |
Checks if a handle has all the given components. More... | |
template<typename... Component> | |
decltype(auto) | any () const |
Checks if a handle has at least one of the given components. More... | |
template<typename... Component> | |
decltype(auto) | get () const |
Returns references to the given components for a handle. More... | |
template<typename Component , typename... Args> | |
decltype(auto) | get_or_emplace (Args &&... args) const |
Returns a reference to the given component for a handle. More... | |
template<typename... Component> | |
auto | try_get () const |
Returns pointers to the given components for a handle. More... | |
bool | orphan () const |
Checks if a handle has components assigned. More... | |
template<typename Func > | |
void | visit (Func &&func) const |
Visits a handle and returns the types for its components. More... | |
Non-owning handle to an entity.
Tiny wrapper around a registry and an entity.
Entity | A valid entity type (see entt_traits for more details). |
Type | Types to which to restrict the scope of a handle. |
|
inline |
Constructs a handle from a given registry and entity.
ref | An instance of the registry class. |
value | An entity identifier. |
|
inline |
Checks if a handle has at least one of the given components.
Component | Components for which to perform the check. |
|
inline |
Destroys the entity associated with a handle.
|
inline |
Destroys the entity associated with a handle.
version | A desired version upon destruction. |
|
inline |
Assigns the given component to a handle.
Component | Type of component to create. |
Args | Types of arguments to use to construct the component. |
args | Parameters to use to initialize the component. |
|
inline |
Assigns or replaces the given component for a handle.
Component | Type of component to assign or replace. |
Args | Types of arguments to use to construct the component. |
args | Parameters to use to initialize the component. |
|
inline |
Returns the entity associated with a handle.
|
inline |
Returns references to the given components for a handle.
Component | Types of components to get. |
|
inline |
Returns a reference to the given component for a handle.
Component | Type of component to get. |
Args | Types of arguments to use to construct the component. |
args | Parameters to use to initialize the component. |
|
inline |
Checks if a handle has all the given components.
Component | Components for which to perform the check. |
|
inline |
Constructs a const handle from a non-const one.
Other | A valid entity type (see entt_traits for more details). |
Args | Scope of the handle to construct. |
|
inlineexplicit |
Checks if a handle refers to non-null registry pointer and entity.
|
inline |
Converts a handle to its underlying entity.
|
inline |
Compares two handles.
Args | Template parameters of the handle with which to compare. |
other | Handle with which to compare. |
|
inline |
Checks if a handle has components assigned.
|
inline |
Patches the given component for a handle.
Component | Type of component to patch. |
Func | Types of the function objects to invoke. |
func | Valid function objects. |
|
inline |
Returns a pointer to the underlying registry, if any.
|
inline |
Removes the given components from a handle.
Component | Types of components to remove. |
|
inline |
Removes all the components from a handle and makes it orphaned.
|
inline |
Removes the given components from a handle.
Component | Types of components to remove. |
|
inline |
Replaces the given component for a handle.
Component | Type of component to replace. |
Args | Types of arguments to use to construct the component. |
args | Parameters to use to initialize the component. |
|
inline |
Returns pointers to the given components for a handle.
Component | Types of components to get. |
|
inline |
Checks if a handle refers to a valid entity or not.
|
inline |
Visits a handle and returns the types for its components.
Func | Type of the function object to invoke. |
func | A valid function object. |