Represents a handle that was created by an external source. More...
#include <kanzi/core/util/handle.hpp>
Public Types | |
| using | HandleType |
| Alias for this handle type. | |
| using | NativeHandleType |
| Alias for the underlying native handle type. | |
Public Member Functions | |
| KZ_NO_DISCARD const NativeHandleType | get () const noexcept |
| Provides access to stored handle. | |
| KZ_NO_DISCARD NativeHandleType | get () noexcept |
| Provides access to stored handle. | |
| KZ_NO_DISCARD const NativeHandleType | getNativeHandle () const noexcept |
| Provides access to stored handle. | |
| KZ_NO_DISCARD NativeHandleType | getNativeHandle () noexcept |
| Provides access to stored handle. | |
| Handle (const Handle &other)=delete | |
| Copy constructor. | |
| Handle (const NativeHandleType &value) noexcept | |
| Constructor. | |
| Handle (Handle &&other) noexcept=delete | |
| Move constructor. | |
| Handle & | operator= (const Handle &other)=delete |
| Copy assignment operator. | |
| Handle & | operator= (const NativeHandleType &value) |
| Copy assignment operator. | |
| Handle & | operator= (Handle &&other) noexcept=delete |
| Move assignment operator. | |
| Handle & | operator= (NativeHandleType &&value) noexcept |
| Move assignment operator. | |
| template<typename U , typename = enable_if_t<is_convertible_v<decay_t<U>, NativeHandleType>>> | |
| void | reset (U &&newHandle) noexcept |
| Stores a new handle inside. | |
| void | swap (Handle &other) |
| Swap function. | |
| ~Handle () | |
| Destructor. | |
Static Public Member Functions | |
| static constexpr auto | getDeleter () noexcept |
| Gets deleter function. | |
Represents a handle that was created by an external source.
The purpose of this class is to hold the external handle and free the associated resources after this class has been destroyed.
For handles that can have a sentinel value to represent invalid handle, use OptionalHandle instead.
| T | Handle type. |
| deleter | Deleter function, used for freeing resources that handle represents. |
Alias for the underlying native handle type.
Alias for this handle type.
|
inlineexplicitnoexcept |
Constructor.
| value | Handle to store. |
Move constructor.
|
delete |
Copy assignment operator.
|
deletenoexcept |
Move assignment operator.
|
inline |
|
inlinenoexcept |
Swap function.
| other | Second object to swap with. |
Gets deleter function.
|
inlinenoexcept |
Provides access to stored handle.
|
inlinenoexcept |
Provides access to stored handle.
|
inlinenoexcept |
Provides access to stored handle.
|
inlinenoexcept |
Provides access to stored handle.
|
inlinenoexcept |
Stores a new handle inside.
Takes an ownership of the resource.
| U | Deduced type for universal reference of T. |
| newHandle | New handle to store. |