AudRecordLib
|
#include <scoped.h>
Public Member Functions | |
ComType (Type *data) | |
ComType (const ComType &other) | |
ComType () | |
~ComType () | |
void | operator= (const ComType &other) |
Type * | get () const |
Type * | operator* () const |
Type ** | operator& () |
Type * | operator-> () |
operator bool_type () const | |
void | Init (Type *newData) |
Type * | Release () |
void | Swap (ComType &other) |
Scoped wrapper around a COM object
Type | The interface type that'll be stored in the object |
Construct an object with a preexisting interface pointer
The function assumes ownership of the pointer and does not call AddRef on it.
data | A pointer that the object takes ownership of |
Copies the pointer stored in another object and calls AddRef
other | The object to copy the pointer from |
Leaves the object in an uninitialised state
Calls Release on the stored interface pointer if there is one
Type* ComType< Type >::get | ( | ) | const [inline] |
Retrieves the stored pointer
The function asserts that the object is initialised before returning the pointer
void ComType< Type >::Init | ( | Type * | newData | ) | [inline] |
Initialises an uninitialised object
The function asserts that the object hasn't been initialised
newData | An interface pointer that the object takes ownership of |
ComType< Type >::operator bool_type | ( | ) | const [inline] |
Safe bool idiom initialised check
Type** ComType< Type >::operator& | ( | ) | [inline] |
Retrieves a pointer to the interface pointer
The function asserts that the object has not already been initialised before returning the pointer. Allowing this can lead to memory leaks
Type* ComType< Type >::operator* | ( | ) | const [inline] |
Retrieves the stored pointer
This operator is just syntactic sugar around the get() method.
Type* ComType< Type >::operator-> | ( | ) | [inline] |
Retrieves the stored pointer
Equivalent to get(), this operator allows the object to be used as a pointer
Makes the contained pointer equal to that contained in another object
other | The object and indirectly the pointer to make this object the same as |
Type* ComType< Type >::Release | ( | ) | [inline] |
Releases the object's ownership of the stored pointer
Turns the object back to an uninitialised state. The caller is then responsible for calling Release() on the interface when it is no longer required. Note: this function DOES NOT call Release on the stored interface pointer and is not equivalent to calling it.
Swaps the pointers stored in two disperate objects
other | The object to swap with |