ReactOS 0.4.15-dev-8191-gbc6c731
SIfacePtr< T > Struct Template Reference

wrapper class for COM interface pointers More...

#include <shellclasses.h>

Inheritance diagram for SIfacePtr< T >:

Public Member Functions

 SIfacePtr ()
 
 SIfacePtr (T *p)
 
 SIfacePtr (IUnknown *unknown, REFIID riid)
 
 ~SIfacePtr ()
 
Toperator-> ()
 
const Toperator-> () const
 
 operator T* ()
 
T ** operator& ()
 
bool empty () const
 
SIfacePtroperator= (T *p)
 
void operator= (SIfacePtr const &o)
 
HRESULT CreateInstance (REFIID clsid, REFIID riid)
 
template<typename I >
HRESULT QueryInterface (REFIID riid, I *p)
 
Tget ()
 
void Free ()
 

Protected Member Functions

 SIfacePtr (const SIfacePtr &o)
 

Protected Attributes

T_p
 

Detailed Description

template<typename T>
struct SIfacePtr< T >

wrapper class for COM interface pointers

Definition at line 332 of file shellclasses.h.

Constructor & Destructor Documentation

◆ SIfacePtr() [1/4]

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

Definition at line 334 of file shellclasses.h.

335 : _p(0)
336 {
337 }

◆ SIfacePtr() [2/4]

template<typename T >
SIfacePtr< T >::SIfacePtr ( T p)
inline

Definition at line 339 of file shellclasses.h.

340 : _p(p)
341 {
342 if (p)
343 p->AddRef();
344 }
GLfloat GLfloat p
Definition: glext.h:8902

◆ SIfacePtr() [3/4]

template<typename T >
SIfacePtr< T >::SIfacePtr ( IUnknown unknown,
REFIID  riid 
)
inline

Definition at line 346 of file shellclasses.h.

347 {
348 CHECKERROR(unknown->QueryInterface(riid, (LPVOID*)&_p));
349 }
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
REFIID riid
Definition: atlbase.h:39
#define CHECKERROR(hr)
Definition: shellclasses.h:162

◆ ~SIfacePtr()

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

Definition at line 351 of file shellclasses.h.

352 {
353 Free();
354 }
void Free()
Definition: shellclasses.h:427

◆ SIfacePtr() [4/4]

template<typename T >
SIfacePtr< T >::SIfacePtr ( const SIfacePtr< T > &  o)
inlineprotected

Definition at line 437 of file shellclasses.h.

438 : _p(o._p)
439 {
440 if (_p)
441 _p->AddRef();
442 }

Member Function Documentation

◆ CreateInstance()

template<typename T >
HRESULT SIfacePtr< T >::CreateInstance ( REFIID  clsid,
REFIID  riid 
)
inline

Definition at line 412 of file shellclasses.h.

413 {
414 return CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, riid, (LPVOID*)&_p);
415 }
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
REFCLSID clsid
Definition: msctf.c:82

Referenced by SSOThread::Run().

◆ empty()

template<typename T >
bool SIfacePtr< T >::empty ( ) const
inline

Definition at line 382 of file shellclasses.h.

383 {
384 return !_p;
385 }

Referenced by ShellDirectory::get_path().

◆ Free()

template<typename T >
void SIfacePtr< T >::Free ( )
inline

Definition at line 427 of file shellclasses.h.

428 {
429 T* h = _p;
430 _p = NULL;
431
432 if (h)
433 h->Release();
434 }
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define T
Definition: mbstring.h:31

Referenced by SIfacePtr< T >::operator=(), and SIfacePtr< T >::~SIfacePtr().

◆ get()

template<typename T >
T * SIfacePtr< T >::get ( )
inline

Definition at line 422 of file shellclasses.h.

423 {
424 return _p;
425 }

◆ operator T*()

template<typename T >
SIfacePtr< T >::operator T* ( )
inline

Definition at line 372 of file shellclasses.h.

373 {
374 return _p;
375 }

◆ operator&()

template<typename T >
T ** SIfacePtr< T >::operator& ( )
inline

Definition at line 377 of file shellclasses.h.

378 {
379 return &_p;
380 }

◆ operator->() [1/2]

template<typename T >
T * SIfacePtr< T >::operator-> ( )
inline

Definition at line 356 of file shellclasses.h.

357 {
358 return _p;
359 }

◆ operator->() [2/2]

template<typename T >
const T * SIfacePtr< T >::operator-> ( ) const
inline

Definition at line 361 of file shellclasses.h.

362 {
363 return _p;
364 }

◆ operator=() [1/2]

template<typename T >
void SIfacePtr< T >::operator= ( SIfacePtr< T > const o)
inline

Definition at line 399 of file shellclasses.h.

400 {
401 T* h = _p;
402
403 if (o._p)
404 o._p->AddRef();
405
406 _p = o._p;
407
408 if (h)
409 h->Release();
410 }

◆ operator=() [2/2]

template<typename T >
SIfacePtr & SIfacePtr< T >::operator= ( T p)
inline

Definition at line 387 of file shellclasses.h.

388 {
389 Free();
390
391 if (p) {
392 p->AddRef();
393 _p = p;
394 }
395
396 return *this;
397 }

◆ QueryInterface()

template<typename T >
template<typename I >
HRESULT SIfacePtr< T >::QueryInterface ( REFIID  riid,
I p 
)
inline

Definition at line 417 of file shellclasses.h.

418 {
419 return _p->QueryInterface(riid, (LPVOID*)p);
420 }

Referenced by my_SHBindToParent(), and BrowserNavigator::navigated().

Member Data Documentation

◆ _p


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