EnTT 3.14.0
|
Non-owning handle to an entity. More...
#include <handle.hpp>
Public Types | |
using | registry_type = Registry |
Type of registry accepted by the handle. | |
using | entity_type = typename traits_type::value_type |
Underlying entity identifier. | |
using | version_type = typename traits_type::version_type |
Underlying version type. | |
using | size_type = std::size_t |
Unsigned integer type. | |
using | iterable = iterable_adaptor<internal::handle_storage_iterator<typename decltype(std::declval<registry_type>().storage())::iterator>> |
Iterable handle type. | |
Public Member Functions | |
basic_handle () noexcept | |
Constructs an invalid handle. | |
basic_handle (registry_type &ref, entity_type value) noexcept | |
Constructs a handle from a given registry and entity. | |
iterable | storage () const noexcept |
Returns an iterable object to use to visit a handle. | |
operator bool () const noexcept | |
Checks if a handle refers to a valid registry and entity. | |
bool | valid () const |
Checks if a handle refers to a valid registry and entity. | |
registry_type * | registry () const noexcept |
Returns a pointer to the underlying registry, if any. | |
entity_type | entity () const noexcept |
Returns the entity associated with a handle. | |
operator entity_type () const noexcept | |
Returns the entity associated with a handle. | |
void | destroy () |
Destroys the entity associated with a handle. | |
void | destroy (const version_type version) |
Destroys the entity associated with a handle. | |
template<typename Type , typename... Args> | |
decltype(auto) | emplace (Args &&...args) const |
Assigns the given element to a handle. | |
template<typename Type , typename... Args> | |
decltype(auto) | emplace_or_replace (Args &&...args) const |
Assigns or replaces the given element for a handle. | |
template<typename Type , typename... Func> | |
decltype(auto) | patch (Func &&...func) const |
Patches the given element for a handle. | |
template<typename Type , typename... Args> | |
decltype(auto) | replace (Args &&...args) const |
Replaces the given element for a handle. | |
template<typename... Type> | |
size_type | remove () const |
Removes the given elements from a handle. | |
template<typename... Type> | |
void | erase () const |
Erases the given elements from a handle. | |
template<typename... Type> | |
decltype(auto) | all_of () const |
Checks if a handle has all the given elements. | |
template<typename... Type> | |
decltype(auto) | any_of () const |
Checks if a handle has at least one of the given elements. | |
template<typename... Type> | |
decltype(auto) | get () const |
Returns references to the given elements for a handle. | |
template<typename Type , typename... Args> | |
decltype(auto) | get_or_emplace (Args &&...args) const |
Returns a reference to the given element for a handle. | |
template<typename... Type> | |
auto | try_get () const |
Returns pointers to the given elements for a handle. | |
bool | orphan () const |
Checks if a handle has elements assigned. | |
template<typename Other , typename... Args> | |
operator basic_handle< Other, Args... > () const noexcept | |
Returns a const handle from a non-const one. | |
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 98 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::entity_type = typename traits_type::value_type |
Underlying entity identifier.
Definition at line 110 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::iterable = iterable_adaptor<internal::handle_storage_iterator<typename decltype(std::declval<registry_type>().storage())::iterator>> |
Iterable handle type.
Definition at line 116 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::registry_type = Registry |
Type of registry accepted by the handle.
Definition at line 108 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::size_type = std::size_t |
Unsigned integer type.
Definition at line 114 of file handle.hpp.
using entt::basic_handle< Registry, Scope >::version_type = typename traits_type::version_type |
Underlying version type.
Definition at line 112 of file handle.hpp.
|
inlinenoexcept |
Constructs an invalid handle.
Definition at line 119 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 128 of file handle.hpp.
|
inline |
Checks if a handle has all the given elements.
Type | Elements for which to perform the check. |
Definition at line 276 of file handle.hpp.
|
inline |
Checks if a handle has at least one of the given elements.
Type | Elements for which to perform the check. |
Definition at line 287 of file handle.hpp.
|
inline |
Destroys the entity associated with a handle.
Definition at line 183 of file handle.hpp.
|
inline |
Destroys the entity associated with a handle.
version | A desired version upon destruction. |
Definition at line 191 of file handle.hpp.
|
inline |
Assigns the given element to a handle.
Type | Type of element to create. |
Args | Types of arguments to use to construct the element. |
args | Parameters to use to initialize the element. |
Definition at line 204 of file handle.hpp.
|
inline |
Assigns or replaces the given element for a handle.
Type | Type of element to assign or replace. |
Args | Types of arguments to use to construct the element. |
args | Parameters to use to initialize the element. |
Definition at line 217 of file handle.hpp.
|
inlinenoexcept |
Returns the entity associated with a handle.
Definition at line 173 of file handle.hpp.
|
inline |
Erases the given elements from a handle.
Type | Types of elements to erase. |
Definition at line 265 of file handle.hpp.
|
inline |
Returns references to the given elements for a handle.
Type | Types of elements to get. |
Definition at line 297 of file handle.hpp.
|
inline |
Returns a reference to the given element for a handle.
Type | Type of element to get. |
Args | Types of arguments to use to construct the element. |
args | Parameters to use to initialize the element. |
Definition at line 310 of file handle.hpp.
|
inlinenoexcept |
Returns a const handle from a non-const one.
Other | A valid entity type. |
Args | Scope of the handle to construct. |
Definition at line 342 of file handle.hpp.
|
inlineexplicitnoexcept |
Checks if a handle refers to a valid registry and entity.
Definition at line 148 of file handle.hpp.
|
inlinenoexcept |
Returns the entity associated with a handle.
Definition at line 178 of file handle.hpp.
|
inline |
Checks if a handle has elements assigned.
Definition at line 330 of file handle.hpp.
|
inline |
Patches the given element for a handle.
Type | Type of element to patch. |
Func | Types of the function objects to invoke. |
func | Valid function objects. |
Definition at line 230 of file handle.hpp.
|
inlinenoexcept |
Returns a pointer to the underlying registry, if any.
Definition at line 165 of file handle.hpp.
|
inline |
Removes the given elements from a handle.
Type | Types of elements to remove. |
Definition at line 255 of file handle.hpp.
|
inline |
Replaces the given element for a handle.
Type | Type of element to replace. |
Args | Types of arguments to use to construct the element. |
args | Parameters to use to initialize the element. |
Definition at line 243 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 142 of file handle.hpp.
|
inline |
Returns pointers to the given elements for a handle.
Type | Types of elements to get. |
Definition at line 321 of file handle.hpp.
|
inline |
Checks if a handle refers to a valid registry and entity.
Definition at line 157 of file handle.hpp.