EnTT 3.11.0
|
Non-owning handle to an entity. More...
#include <handle.hpp>
Public Types | |
using | registry_type = Registry |
Type of registry accepted by the handle. More... | |
using | entity_type = typename registry_type::entity_type |
Underlying entity identifier. More... | |
using | version_type = typename registry_type::version_type |
Underlying version type. More... | |
using | size_type = typename registry_type::size_type |
Unsigned integer type. More... | |
Public Member Functions | |
basic_handle () noexcept | |
Constructs an invalid handle. More... | |
basic_handle (registry_type &ref, entity_type value) noexcept | |
Constructs a handle from a given registry and entity. More... | |
auto | storage () const noexcept |
Returns an iterable object to use to visit a handle. More... | |
template<typename Other , typename... Args> | |
operator basic_handle< Other, Args... > () 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 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 noexcept |
Returns a pointer to the underlying registry, if any. More... | |
entity_type | entity () const noexcept |
Returns the entity associated with a handle. More... | |
void | destroy () |
Destroys the entity associated with a handle. More... | |
void | destroy (const 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> | |
size_type | remove () const |
Removes the given components from a handle. More... | |
template<typename... Component> | |
void | erase () const |
Erases the given components from a handle. More... | |
template<typename... Component> | |
decltype(auto) | all_of () const |
Checks if a handle has all the given components. More... | |
template<typename... Component> | |
decltype(auto) | any_of () 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... | |
Non-owning handle to an entity.
Tiny wrapper around a registry and an entity.
Registry | Basic registry type. |
Scope | Types to which to restrict the scope of a handle. |
Definition at line 102 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::entity_type = typename registry_type::entity_type |
Underlying entity identifier.
Definition at line 106 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::registry_type = Registry |
Type of registry accepted by the handle.
Definition at line 104 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::size_type = typename registry_type::size_type |
Unsigned integer type.
Definition at line 110 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::version_type = typename registry_type::version_type |
Underlying version type.
Definition at line 108 of file handle.hpp.
|
inlinenoexcept |
Constructs an invalid handle.
Definition at line 113 of file handle.hpp.
|
inlinenoexcept |
Constructs a handle from a given registry and entity.
ref | An instance of the registry class. |
value | A valid identifier. |
Definition at line 122 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 289 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 300 of file handle.hpp.
|
inline |
Destroys the entity associated with a handle.
Definition at line 198 of file handle.hpp.
|
inline |
Destroys the entity associated with a handle.
version | A desired version upon destruction. |
Definition at line 206 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 218 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 231 of file handle.hpp.
|
inlinenoexcept |
Returns the entity associated with a handle.
Definition at line 193 of file handle.hpp.
|
inline |
Erases the given components from a handle.
Component | Types of components to erase. |
Definition at line 278 of file handle.hpp.
|
inline |
Returns references to the given components for a handle.
Component | Types of components to get. |
Definition at line 310 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 323 of file handle.hpp.
|
inlinenoexcept |
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. |
Definition at line 150 of file handle.hpp.
|
inlineexplicitnoexcept |
Checks if a handle refers to non-null registry pointer and entity.
Definition at line 169 of file handle.hpp.
|
inlinenoexcept |
Converts a handle to its underlying entity.
Definition at line 161 of file handle.hpp.
|
inline |
Checks if a handle has components assigned.
Definition at line 343 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 244 of file handle.hpp.
|
inlinenoexcept |
Returns a pointer to the underlying registry, if any.
Definition at line 185 of file handle.hpp.
|
inline |
Removes the given components from a handle.
Component | Types of components to remove. |
Definition at line 268 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 257 of file handle.hpp.
|
inlinenoexcept |
Returns an iterable object to use to visit a handle.
The iterable object returns a pair that contains the name and a reference to the current storage.
Returned storage are those that contain the entity associated with the handle.
Definition at line 136 of file handle.hpp.
|
inline |
Returns pointers to the given components for a handle.
Component | Types of components to get. |
Definition at line 334 of file handle.hpp.
|
inline |
Checks if a handle refers to a valid entity or not.
Definition at line 177 of file handle.hpp.