|
| | ObjectHandle () noexcept=default |
| | Default Constructor.
|
| |
| | ObjectHandle (std::nullptr_t) noexcept |
| | Constructor for a null handle.
|
| |
| | ObjectHandle (ObjectClass *object) noexcept |
| | Constructor that sets the object.
|
| |
| | ObjectHandle (ObjectHandle &&other) noexcept=default |
| | Move constructor.
|
| |
| auto | operator= (ObjectHandle &&rhs) noexcept -> ObjectHandle &=default |
| | Move assignment operator.
|
| |
| auto | operator= (std::nullptr_t) noexcept -> ObjectHandle & |
| | Turns the handle into a null handle.
|
| |
| auto | reset (ObjectClass *object=nullptr) noexcept -> void |
| | Resets the handle.
|
| |
| auto | get () const noexcept -> ObjectClass * |
| | Accesses the object.
|
| |
| auto | operator* () const noexcept -> ObjectClass & |
| | Accesses the object.
|
| |
| | operator bool () const noexcept |
| | Checks if the handle contains an object.
|
| |
| auto | operator-> () const noexcept -> ObjectClass * |
| | Accesses the object.
|
| |
| auto | release () noexcept -> ObjectClass * |
| | Gives up ownership of the object and returns it.
|
| |
| void | swap (ObjectHandle &other) noexcept |
| | Swaps objects with another handle.
|
| |
| auto | setter () noexcept -> Setter |
| | Gets a setter for use as an output parameter for C functions.
|
| |
template<typename ObjectClass>
requires
std::is_class_v<ObjectClass>
class xentara::utils::windows::com::ObjectHandle< ObjectClass >
A handle to a COM object.
This class stores a handle to a Component Object Model (COM) object, and autoreleases that handle in it's destructor.
template<typename ObjectClass >
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 ObjectClass **, a void **, or an LPVOID * as output parameter, like e.g. CoCreateInstance(). This provides a safe way of creating objects using such a function without running the risk of leaking the created object.
CoCreateInstance() can be called like this, for example:
CoCreateInstance(CLSID_TaskbarList,
nullptr, CLSCTX_ALL, IID_ITaskbarList3,,
object.
setter());
A handle to a COM object.
Definition ObjectHandle.hpp:21
auto setter() noexcept -> Setter
Gets a setter for use as an output parameter for C functions.
Definition ObjectHandle.hpp:177