plugify 1.0.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
plugify::Handle< T > Class Template Reference

A generic handle class that manages a pointer to an object of type T. More...

#include <handle.hpp>

Public Member Functions

 Handle () noexcept
 Default constructor. Initializes the handle with a null pointer.
 
 Handle (T &impl) noexcept
 Constructs a Handle object from an instance of type T.
 
 Handle (const Handle &)=default
 Copy constructor. Creates a new Handle object from another Handle object.
 
 Handle (Handle &&)=default
 Move constructor. Transfers ownership from another Handle object.
 
auto operator<=> (const Handle &) const =default
 Comparison operator (<=>) for comparing two Handle objects.
 
Handleoperator= (const Handle &) &=default
 Copy assignment operator. Copies the handle from another Handle object.
 
Handleoperator= (const Handle &) &&=delete
 Copy assignment operator for rvalue references is deleted.
 
Handleoperator= (Handle &&) &=default
 Move assignment operator. Transfers ownership from another Handle object.
 
Handleoperator= (Handle &&) &&=delete
 Move assignment operator for rvalue references is deleted.
 
 operator bool () const noexcept
 Explicit conversion operator to bool, indicating if the pointer is non-zero.
 
 operator uintptr_t () const noexcept
 Converts the Handle object to a uintptr_t.
 
 operator void * () const noexcept
 Converts the Handle object to a void pointer.
 

Protected Attributes

T * _impl
 A pointer to the referenced implementation of type T.
 

Detailed Description

template<typename T>
class plugify::Handle< T >

A generic handle class that manages a pointer to an object of type T.

The Handle class provides a lightweight wrapper around a raw pointer, allowing safe access and management of resources. It can be null and provides comparison operators and conversion functions.

Template Parameters
TThe type of the object being referenced.

Definition at line 18 of file handle.hpp.

Constructor & Destructor Documentation

◆ Handle() [1/4]

template<typename T >
plugify::Handle< T >::Handle ( )
inlinenoexcept

Default constructor. Initializes the handle with a null pointer.

Definition at line 23 of file handle.hpp.

◆ Handle() [2/4]

template<typename T >
plugify::Handle< T >::Handle ( T &  impl)
inlinenoexcept

Constructs a Handle object from an instance of type T.

Parameters
implA reference to an object of type T to be wrapped.

Definition at line 29 of file handle.hpp.

◆ Handle() [3/4]

template<typename T >
plugify::Handle< T >::Handle ( const Handle< T > &  )
default

Copy constructor. Creates a new Handle object from another Handle object.

Parameters
otherThe Handle object to copy from.

◆ Handle() [4/4]

template<typename T >
plugify::Handle< T >::Handle ( Handle< T > &&  )
default

Move constructor. Transfers ownership from another Handle object.

Parameters
otherThe Handle object to move from.

Member Function Documentation

◆ operator bool()

template<typename T >
plugify::Handle< T >::operator bool ( ) const
inlineexplicitnoexcept

Explicit conversion operator to bool, indicating if the pointer is non-zero.

Returns
True if the pointer is non-zero, false otherwise.

Definition at line 76 of file handle.hpp.

◆ operator uintptr_t()

template<typename T >
plugify::Handle< T >::operator uintptr_t ( ) const
inlinenoexcept

Converts the Handle object to a uintptr_t.

Returns
The uintptr_t representation of the memory address.

Definition at line 84 of file handle.hpp.

◆ operator void *()

template<typename T >
plugify::Handle< T >::operator void * ( ) const
inlinenoexcept

Converts the Handle object to a void pointer.

Returns
The void pointer representation of the memory address.

Definition at line 92 of file handle.hpp.

◆ operator<=>()

template<typename T >
auto plugify::Handle< T >::operator<=> ( const Handle< T > &  ) const
default

Comparison operator (<=>) for comparing two Handle objects.

Parameters
rhsThe right-hand side Handle object for comparison.
Returns
The result of the comparison.

◆ operator=() [1/4]

template<typename T >
Handle & plugify::Handle< T >::operator= ( const Handle< T > &  ) &&
delete

Copy assignment operator for rvalue references is deleted.

Parameters
otherThe Handle object to copy from.

◆ operator=() [2/4]

template<typename T >
Handle & plugify::Handle< T >::operator= ( const Handle< T > &  ) &
default

Copy assignment operator. Copies the handle from another Handle object.

Parameters
otherThe Handle object to copy from.
Returns
A reference to the current object.

◆ operator=() [3/4]

template<typename T >
Handle & plugify::Handle< T >::operator= ( Handle< T > &&  ) &&
delete

Move assignment operator for rvalue references is deleted.

Parameters
otherThe Handle object to move from.

◆ operator=() [4/4]

template<typename T >
Handle & plugify::Handle< T >::operator= ( Handle< T > &&  ) &
default

Move assignment operator. Transfers ownership from another Handle object.

Parameters
otherThe Handle object to move from.
Returns
A reference to the current object.

Member Data Documentation

◆ _impl

template<typename T >
T* plugify::Handle< T >::_impl
protected

A pointer to the referenced implementation of type T.

Definition at line 97 of file handle.hpp.


The documentation for this class was generated from the following file: