|
EnTT
3.5.2
|
Non-owning handle to an entity. More...
#include <handle.hpp>
Public Types | |
| using | entity_type = std::remove_const_t< Entity > |
| Underlying entity identifier. | |
| using | registry_type = std::conditional_t< std::is_const_v< Entity >, const basic_registry< entity_type >, basic_registry< entity_type > > |
| Type of registry accepted by the handle. | |
Public Member Functions | |
| basic_handle (registry_type &ref, entity_type value=null) noexcept | |
| Constructs a handle from a given registry and entity. More... | |
| basic_handle & | operator= (const entity_type value) noexcept |
| Assigns an entity to a handle. More... | |
| basic_handle & | operator= (null_t) noexcept |
| Assigns the null object to a handle. More... | |
| operator basic_handle< const entity_type > () const noexcept | |
| Constructs a const handle from a non-const one. More... | |
| operator entity_type () const noexcept | |
| Converts a handle to its underlying entity. More... | |
| operator bool () const | |
| Checks if a handle refers to a valid entity or not. More... | |
| registry_type & | registry () const noexcept |
| Returns a reference to the underlying registry. More... | |
| entity_type | entity () const noexcept |
| Returns 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... Components> | |
| void | remove () const |
| Removes the given components from a handle. More... | |
| template<typename... Components> | |
| 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... Components> | |
| decltype(auto) | has () const |
| Checks if a handle has all the given components. More... | |
| template<typename... Components> | |
| decltype(auto) | any () const |
| Checks if a handle has at least one of the given components. More... | |
| template<typename... Components> | |
| 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... Components> | |
| decltype(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). |
Definition at line 19 of file handle.hpp.
|
inlinenoexcept |
Constructs a handle from a given registry and entity.
| ref | An instance of the registry class. |
| value | An entity identifier. |
Definition at line 35 of file handle.hpp.
|
inline |
Checks if a handle has at least one of the given components.
| Component | Components for which to perform the check. |
Definition at line 197 of file handle.hpp.
|
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. |
Definition at line 106 of file handle.hpp.
|
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. |
Definition at line 119 of file handle.hpp.
|
inlinenoexcept |
Returns the entity associated with a handle.
Definition at line 93 of file handle.hpp.
|
inline |
Returns references to the given components for a handle.
| Component | Types of components to get. |
Definition at line 208 of file handle.hpp.
|
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. |
Definition at line 221 of file handle.hpp.
|
inline |
Checks if a handle has all the given components.
| Component | Components for which to perform the check. |
Definition at line 185 of file handle.hpp.
|
inlinenoexcept |
Constructs a const handle from a non-const one.
Definition at line 61 of file handle.hpp.
|
inlineexplicit |
Checks if a handle refers to a valid entity or not.
Definition at line 77 of file handle.hpp.
|
inlinenoexcept |
Converts a handle to its underlying entity.
Definition at line 69 of file handle.hpp.
|
inlinenoexcept |
Assigns an entity to a handle.
| value | An entity identifier. |
Definition at line 44 of file handle.hpp.
|
inlinenoexcept |
|
inline |
Checks if a handle has components assigned.
Definition at line 240 of file handle.hpp.
|
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. |
Definition at line 132 of file handle.hpp.
|
inlinenoexcept |
Returns a reference to the underlying registry.
Definition at line 85 of file handle.hpp.
|
inline |
Removes the given components from a handle.
| Component | Types of components to remove. |
Definition at line 155 of file handle.hpp.
|
inline |
Removes all the components from a handle and makes it orphaned.
Definition at line 174 of file handle.hpp.
|
inline |
Removes the given components from a handle.
| Component | Types of components to remove. |
Definition at line 166 of file handle.hpp.
|
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. |
Definition at line 145 of file handle.hpp.
|
inline |
Returns pointers to the given components for a handle.
| Component | Types of components to get. |
Definition at line 232 of file handle.hpp.
|
inline |
Visits a handle and returns the types for its components.
| Func | Type of the function object to invoke. |
| func | A valid function object. |
Definition at line 251 of file handle.hpp.