Windows C++ Library
Public Member Functions | Static Private Attributes
WCL::ComPtr< T > Class Template Reference

A smart-pointer type for use with COM objects and interfaces. More...

#include <ComPtr.hpp>

Inheritance diagram for WCL::ComPtr< T >:
WCL::IFacePtr< T >

List of all members.

Public Member Functions

 ComPtr ()
 Default constructor.
 ComPtr (T *pInterface, bool bAddRef=false)
 Construction from an existing interface pointer.
 ComPtr (const CLSID &rCLSID)
 Construction by creating an object of the CLSID.
 ComPtr (const ComPtr &rhs)
 Copy constructor.
template<typename U >
 ComPtr (const IFacePtr< U > &rhs)
 Aquire a different interface for another COM object.
 ~ComPtr ()
 Destructor.
ComPtroperator= (const ComPtr &rhs)
 Assignment operator.
template<typename U >
ComPtroperator= (const IFacePtr< U > &rhs)
 Aquire a different interface for another COM object.
void CreateInstance (const CLSID &rCLSID)
 Create an instance of the object.
template<typename U >
void QueryInterface (const IFacePtr< U > &rhs)
 Aquire a different interface for another COM object.

Static Private Attributes

static const size_t MAX_GUID_CHARS = 38
 Maximum number of characters in a GUID string.

Detailed Description

template<typename T>
class WCL::ComPtr< T >

A smart-pointer type for use with COM objects and interfaces.

This IFacePtr derived class adds the ability to create objects via their CLSIDs as well as managing the lifetimes of COM interfaces.


Constructor & Destructor Documentation

template<typename T >
WCL::ComPtr< T >::ComPtr ( ) [inline]

Default constructor.

template<typename T >
WCL::ComPtr< T >::ComPtr ( T *  pInterface,
bool  bAddRef = false 
) [inline, explicit]

Construction from an existing interface pointer.

template<typename T >
WCL::ComPtr< T >::ComPtr ( const CLSID &  rCLSID) [inline, explicit]

Construction by creating an object of the CLSID.

template<typename T >
WCL::ComPtr< T >::ComPtr ( const ComPtr< T > &  rhs) [inline]

Copy constructor.

template<typename T >
template<typename U >
WCL::ComPtr< T >::ComPtr ( const IFacePtr< U > &  rhs) [inline, explicit]

Aquire a different interface for another COM object.

template<typename T >
WCL::ComPtr< T >::~ComPtr ( ) [inline]

Destructor.


Member Function Documentation

template<typename T >
ComPtr< T > & WCL::ComPtr< T >::operator= ( const ComPtr< T > &  rhs) [inline]

Assignment operator.

template<typename T >
template<typename U >
ComPtr< T > & WCL::ComPtr< T >::operator= ( const IFacePtr< U > &  rhs) [inline]

Aquire a different interface for another COM object.

template<typename T >
void WCL::ComPtr< T >::CreateInstance ( const CLSID &  rCLSID) [inline]

Create an instance of the object.

template<typename T >
template<typename U >
void WCL::ComPtr< T >::QueryInterface ( const IFacePtr< U > &  rhs) [inline]

Aquire a different interface for another COM object.


Member Data Documentation

template<typename T >
const size_t WCL::ComPtr< T >::MAX_GUID_CHARS = 38 [static, private]

Maximum number of characters in a GUID string.


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