Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TComPtr< T > Class Template Reference

#include <COMPointer.h>

Public Types

typedef T PointerType
 

Public Member Functions

 TComPtr ()
 
 TComPtr (PointerType *const Object)
 
 TComPtr (const TComPtr< PointerType > &Other)
 
 TComPtr (TComPtr< PointerType > &&Other)
 
TComPtr< PointerType > & operator= (PointerType *const Object)
 
TComPtr< PointerType > & operator= (const TComPtr< PointerType > &Other)
 
TComPtr< PointerType > & operator= (TComPtr< PointerType > &&Other)
 
 ~TComPtr ()
 
FORCEINLINE PointerType ** operator& ()
 
FORCEINLINE PointerTypeoperator-> () const
 
FORCEINLINE bool operator== (PointerType *const Object) const
 
FORCEINLINE bool operator!= (PointerType *const Object) const
 
FORCEINLINE operator PointerType * () const
 
void Attach (PointerType *Object)
 
void Detach ()
 
HRESULT FromQueryInterface (REFIID Riid, IUnknown *Unknown)
 
FORCEINLINE PointerTypeGet () const
 
FORCEINLINE const bool IsValid () const
 
void Reset ()
 

Private Attributes

PointerTypeRawPointer
 

Friends

FORCEINLINE uint32 GetTypeHash (const TComPtr< T > &InObjectPtr)
 

Detailed Description

template<typename T>
class TComPtr< T >

Smart COM object pointer.

Definition at line 18 of file COMPointer.h.

Member Typedef Documentation

◆ PointerType

template<typename T >
typedef T TComPtr< T >::PointerType

Definition at line 22 of file COMPointer.h.

Constructor & Destructor Documentation

◆ TComPtr() [1/4]

template<typename T >
TComPtr< T >::TComPtr ( )
inline

Default constructor (initialized to null).

Definition at line 27 of file COMPointer.h.

◆ TComPtr() [2/4]

template<typename T >
TComPtr< T >::TComPtr ( PointerType *const Object)
inline

Create and initialize a new instance.

Parameters
ObjectThe object to point to.

Definition at line 36 of file COMPointer.h.

◆ TComPtr() [3/4]

template<typename T >
TComPtr< T >::TComPtr ( const TComPtr< PointerType > & Other)
inline

Copy constructor.

Parameters
OtherThe instance to copy.

Definition at line 50 of file COMPointer.h.

◆ TComPtr() [4/4]

template<typename T >
TComPtr< T >::TComPtr ( TComPtr< PointerType > && Other)
inline

Move constructor.

Parameters
OtherThe instance to move.

Definition at line 64 of file COMPointer.h.

◆ ~TComPtr()

template<typename T >
TComPtr< T >::~TComPtr ( )
inline

Destructor.

Definition at line 142 of file COMPointer.h.

Member Function Documentation

◆ Attach()

template<typename T >
void TComPtr< T >::Attach ( PointerType * Object)
inline

Set the pointer without adding a reference.

Parameters
InRawPointerThe object to point to.
See also
Detach

Definition at line 186 of file COMPointer.h.

◆ Detach()

template<typename T >
void TComPtr< T >::Detach ( )
inline

Reset the pointer without releasing a reference.

See also
Attach

Definition at line 201 of file COMPointer.h.

◆ FromQueryInterface()

template<typename T >
HRESULT TComPtr< T >::FromQueryInterface ( REFIID Riid,
IUnknown * Unknown )
inline

Initialize this pointer from a COM interface to be queried.

Parameters
RiidThe ID of the interface to be queried.
UnknownThe object to query the interface from.
Returns
The result code of the query.

Definition at line 213 of file COMPointer.h.

◆ Get()

template<typename T >
FORCEINLINE PointerType * TComPtr< T >::Get ( ) const
inline

Get raw pointer to the object pointed to.

Returns
Pointer to the object, or NULL if not valid.
See also
IsValid

Definition at line 230 of file COMPointer.h.

◆ IsValid()

template<typename T >
FORCEINLINE const bool TComPtr< T >::IsValid ( ) const
inline

Whether this pointer is pointing to an actual object.

Returns
true if the pointer is valid, false otherwise.
See also
Get

Definition at line 241 of file COMPointer.h.

◆ operator PointerType *()

template<typename T >
FORCEINLINE TComPtr< T >::operator PointerType * ( ) const
inline

Definition at line 173 of file COMPointer.h.

◆ operator!=()

template<typename T >
FORCEINLINE bool TComPtr< T >::operator!= ( PointerType *const Object) const
inline

Definition at line 168 of file COMPointer.h.

◆ operator&()

template<typename T >
FORCEINLINE PointerType ** TComPtr< T >::operator& ( )
inline

Definition at line 152 of file COMPointer.h.

◆ operator->()

template<typename T >
FORCEINLINE PointerType * TComPtr< T >::operator-> ( ) const
inline

Definition at line 157 of file COMPointer.h.

◆ operator=() [1/3]

template<typename T >
TComPtr< PointerType > & TComPtr< T >::operator= ( const TComPtr< PointerType > & Other)
inline

Copy assignment operator.

Parameters
OtherThe instance to copy.

Definition at line 100 of file COMPointer.h.

◆ operator=() [2/3]

template<typename T >
TComPtr< PointerType > & TComPtr< T >::operator= ( PointerType *const Object)
inline

Assignment operator.

Parameters
ObjectThe object to point to.

Definition at line 75 of file COMPointer.h.

◆ operator=() [3/3]

template<typename T >
TComPtr< PointerType > & TComPtr< T >::operator= ( TComPtr< PointerType > && Other)
inline

Move assignment operator.

Parameters
OtherThe instance to move.

Definition at line 125 of file COMPointer.h.

◆ operator==()

template<typename T >
FORCEINLINE bool TComPtr< T >::operator== ( PointerType *const Object) const
inline

Definition at line 163 of file COMPointer.h.

◆ Reset()

template<typename T >
void TComPtr< T >::Reset ( )
inline

Reset this pointer to null.

Definition at line 247 of file COMPointer.h.

Friends And Related Symbol Documentation

◆ GetTypeHash

template<typename T >
FORCEINLINE uint32 GetTypeHash ( const TComPtr< T > & InObjectPtr)
friend

Definition at line 261 of file COMPointer.h.

Member Data Documentation

◆ RawPointer

template<typename T >
PointerType* TComPtr< T >::RawPointer
private

Pointer to the actual object, if any.

Definition at line 259 of file COMPointer.h.


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