ReactOS 0.4.15-dev-7788-g1ad9096
ATL::CComPtr< T > Class Template Reference

#include <atlcomcli.h>

Inheritance diagram for ATL::CComPtr< T >:

Public Member Functions

 CComPtr ()
 
 CComPtr (T *lp)
 
 CComPtr (const CComPtr< T > &lp)
 
 ~CComPtr ()
 
HRESULT CoCreateInstance (REFCLSID rclsid, REFIID riid, LPUNKNOWN pOuter=NULL, DWORD ClsCtx=CLSCTX_ALL)
 
HRESULT CoCreateInstance (LPCOLESTR ProgID, REFIID riid, LPUNKNOWN pOuter=NULL, DWORD ClsCtx=CLSCTX_ALL)
 
Toperator= (T *lp)
 
Toperator= (const CComPtr< T > &lp)
 
void Release ()
 
void Attach (T *lp)
 
TDetach ()
 
T ** operator& ()
 
 operator T* ()
 
_NoAddRefReleaseOnCComPtr< T > * operator-> () const
 

Public Attributes

Tp
 

Detailed Description

template<class T>
class ATL::CComPtr< T >

Definition at line 71 of file atlcomcli.h.

Constructor & Destructor Documentation

◆ CComPtr() [1/3]

template<class T >
ATL::CComPtr< T >::CComPtr ( )
inline

Definition at line 76 of file atlcomcli.h.

77 {
78 p = NULL;
79 }
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902

◆ CComPtr() [2/3]

template<class T >
ATL::CComPtr< T >::CComPtr ( T lp)
inline

Definition at line 81 of file atlcomcli.h.

82 {
83 p = lp;
84 if (p != NULL)
85 p->AddRef();
86 }

◆ CComPtr() [3/3]

template<class T >
ATL::CComPtr< T >::CComPtr ( const CComPtr< T > &  lp)
inline

Definition at line 88 of file atlcomcli.h.

89 {
90 p = lp.p;
91 if (p != NULL)
92 p->AddRef();
93 }

◆ ~CComPtr()

template<class T >
ATL::CComPtr< T >::~CComPtr ( )
inline

Definition at line 95 of file atlcomcli.h.

96 {
97 if (p != NULL)
98 p->Release();
99 }

Member Function Documentation

◆ Attach()

◆ CoCreateInstance() [1/2]

template<class T >
HRESULT ATL::CComPtr< T >::CoCreateInstance ( LPCOLESTR  ProgID,
REFIID  riid,
LPUNKNOWN  pOuter = NULL,
DWORD  ClsCtx = CLSCTX_ALL 
)
inline

Definition at line 107 of file atlcomcli.h.

108 {
109 CLSID clsid;
110 HRESULT hr = CLSIDFromProgID(ProgID, &clsid);
111 return FAILED(hr) ? hr : CoCreateInstance(clsid, riid, pOuter, ClsCtx);
112 }
HRESULT CoCreateInstance(REFCLSID rclsid, REFIID riid, LPUNKNOWN pOuter=NULL, DWORD ClsCtx=CLSCTX_ALL)
Definition: atlcomcli.h:101
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
REFIID riid
Definition: atlbase.h:39
#define FAILED(hr)
Definition: intsafe.h:51
REFCLSID clsid
Definition: msctf.c:82
HRESULT hr
Definition: shlfolder.c:183

◆ CoCreateInstance() [2/2]

template<class T >
HRESULT ATL::CComPtr< T >::CoCreateInstance ( REFCLSID  rclsid,
REFIID  riid,
LPUNKNOWN  pOuter = NULL,
DWORD  ClsCtx = CLSCTX_ALL 
)
inline

Definition at line 101 of file atlcomcli.h.

102 {
103 ATLASSERT(!p);
104 return ::CoCreateInstance(rclsid, pOuter, ClsCtx, riid, (void**)&p);
105 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10

Referenced by ATL::CComPtr< T >::CoCreateInstance().

◆ Detach()

◆ operator T*()

template<class T >
ATL::CComPtr< T >::operator T* ( )
inline

Definition at line 201 of file atlcomcli.h.

202 {
203 return p;
204 }

◆ operator&()

template<class T >
T ** ATL::CComPtr< T >::operator& ( )
inline

Definition at line 195 of file atlcomcli.h.

196 {
197 ATLASSERT(p == NULL);
198 return &p;
199 }

◆ operator->()

template<class T >
_NoAddRefReleaseOnCComPtr< T > * ATL::CComPtr< T >::operator-> ( ) const
inline

Definition at line 206 of file atlcomcli.h.

◆ operator=() [1/2]

template<class T >
T * ATL::CComPtr< T >::operator= ( const CComPtr< T > &  lp)
inline

Definition at line 128 of file atlcomcli.h.

129 {
130 T* pOld = p;
131
132 p = lp.p;
133 if (p != NULL)
134 p->AddRef();
135
136 if (pOld != NULL)
137 pOld->Release();
138
139 return *this;
140 }

◆ operator=() [2/2]

template<class T >
T * ATL::CComPtr< T >::operator= ( T lp)
inline

Definition at line 114 of file atlcomcli.h.

115 {
116 T* pOld = p;
117
118 p = lp;
119 if (p != NULL)
120 p->AddRef();
121
122 if (pOld != NULL)
123 pOld->Release();
124
125 return *this;
126 }

◆ Release()

Member Data Documentation

◆ p


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