xentara-utils v2.0.4
The Xentara Utility Library
|
A smart pointer that frees its object using LocalFree(). More...
#include <xentara/utils/windows/LocalFree.hpp>
Classes | |
class | Setter |
Helper class for calling functions that take an output parameter. More... | |
Public Types | |
using | pointer = Element * |
The stored pointer type. | |
using | element_type = Element |
The type of stored element. | |
Public Member Functions | |
constexpr | LocalFreePointer () noexcept=default |
Default constructor. | |
constexpr | LocalFreePointer (std::nullptr_t) noexcept |
Creates an empty object that does not contain an element. | |
constexpr | LocalFreePointer (std::type_identity_t< pointer > rawPointer) noexcept |
Conversion from a raw pointer. | |
constexpr | LocalFreePointer (LocalFreePointer &&other) noexcept |
Move constructor. | |
template<class OtherElement > requires (!std::is_array_v<OtherElement>) | |
constexpr | LocalFreePointer (LocalFreePointer< OtherElement > &&other) noexcept |
Move constructor for a related type. | |
~LocalFreePointer () | |
Destructor. Frees the element. | |
auto | operator= (LocalFreePointer &&rhs) noexcept -> LocalFreePointer & |
Move assignment operator. | |
template<class OtherElement > requires (!std::is_array_v<OtherElement>) | |
auto | operator= (LocalFreePointer< OtherElement > &&rhs) noexcept -> LocalFreePointer & |
Move assignment operator for a related type. | |
auto | operator= (std::nullptr_t) noexcept -> LocalFreePointer & |
Assignment operator for a null pointer. | |
constexpr | operator bool () const noexcept |
Checks whether the object contains an element. | |
constexpr auto | operator* () const noexcept -> element_type & |
Access to the element. | |
constexpr auto | operator-> () const noexcept -> pointer |
Access to the element. | |
constexpr auto | get () const noexcept -> pointer |
Gets the element. | |
constexpr auto | release () noexcept -> pointer |
Removes the element and passes ownership to the caller. | |
auto | reset (pointer rawPointer) noexcept -> void |
Resets the pointer to point to a diffrerent element. | |
auto | swap (LocalFreePointer &other) noexcept -> void |
Swaps the element with that of another pointer. | |
auto | setter () noexcept -> Setter |
Gets a setter for use as an output parameter for C functions. | |
A smart pointer that frees its object using LocalFree().
using xentara::utils::windows::LocalFreePointer< Element >::element_type = Element |
The type of stored element.
using xentara::utils::windows::LocalFreePointer< Element >::pointer = Element * |
The stored pointer type.
|
constexprdefaultnoexcept |
Default constructor.
Creates an empty object that does not contain an element.
|
constexprnoexcept |
Creates an empty object that does not contain an element.
|
explicitconstexprnoexcept |
Conversion from a raw pointer.
rawPointer | A pointer to the element to store, or nullptr for none. The object takes ownership of the element, if any. |
|
constexprnoexcept |
Move constructor.
Takes ownership of the other object’s element, if any.
other | The object to move. Will be reset and no longer contain an element afterwards. |
|
constexprnoexcept |
Move constructor for a related type.
Takes ownership of the other object’s element, if any.
other | The object to move. Will be reset and no longer contain an element afterwards. |
xentara::utils::windows::LocalFreePointer< Element >::~LocalFreePointer | ( | ) |
Destructor. Frees the element.
|
constexprnoexcept |
Gets the element.
|
explicitconstexprnoexcept |
Checks whether the object contains an element.
|
constexprnoexcept |
Access to the element.
|
constexprnoexcept |
Access to the element.
|
noexcept |
Move assignment operator.
Takes ownership of the other objects’s element, if any. Any existing element is freed.
rhs | The object to move. Will be reset and no longer contain an element afterwards. |
|
noexcept |
Move assignment operator for a related type.
Takes ownership of the other objects’s element, if any. Any existing element is freed.
rhs | The object to move. Will be reset and no longer contain an element afterwards. |
|
noexcept |
Assignment operator for a null pointer.
Frees any object this pointer may contain.
|
constexprnoexcept |
Removes the element and passes ownership to the caller.
After this call, this object will no longer contain an element.
|
noexcept |
Resets the pointer to point to a diffrerent element.
Takes ownership of the element, if any. Any existing element is freed.
rawPointer | A pointer to the element to store, or nullptr for none. The object takes ownership of the element, if any. |
|
noexcept |
Gets a setter for use as an output parameter for C functions.
This function returns a helper object that can be passed to a function that takes an Element ** as output parameter. This provides a safe way of creating elements using such a function without running the risk of leaking the created element.
|
noexcept |
Swaps the element with that of another pointer.
other | The pointer to swap with. |