Public Member Functions | Protected Member Functions | Protected Attributes

SIfacePtr< T > Struct Template Reference

wrapper class for COM interface pointers More...

#include <shellclasses.h>

Inheritance diagram for SIfacePtr< T >:
Inheritance graph
[legend]
Collaboration diagram for SIfacePtr< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SIfacePtr ()
 SIfacePtr (T *p)
 SIfacePtr (IUnknown *unknown, REFIID riid)
 ~SIfacePtr ()
T * operator-> ()
const T * operator-> () 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)
T * get ()
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

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

Definition at line 334 of file shellclasses.h.

     :  _p(0)
    {
    }
template<typename T>
SIfacePtr< T >::SIfacePtr ( T *  p ) [inline]

Definition at line 339 of file shellclasses.h.

     :  _p(p)
    {
        if (p)
            p->AddRef();
    }
template<typename T>
SIfacePtr< T >::SIfacePtr ( IUnknown unknown,
REFIID  riid 
) [inline]

Definition at line 346 of file shellclasses.h.

    {
        CHECKERROR(unknown->QueryInterface(riid, (LPVOID*)&_p));
    }
template<typename T>
SIfacePtr< T >::~SIfacePtr (  ) [inline]

Definition at line 351 of file shellclasses.h.

    {
        Free();
    }
template<typename T>
SIfacePtr< T >::SIfacePtr ( const SIfacePtr< T > &  o ) [inline, protected]

Definition at line 437 of file shellclasses.h.

     :  _p(o._p)
    {
        if (_p)
            _p->AddRef();
    }

Member Function Documentation

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

Definition at line 412 of file shellclasses.h.

    {
        return CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, riid, (LPVOID*)&_p);
    }
template<typename T>
bool SIfacePtr< T >::empty (  ) const [inline]

Definition at line 382 of file shellclasses.h.

                              : GCC seems not to work correctly when defining operator bool() AND operator T*() at one time
    {
        return !_p;
    }
template<typename T>
void SIfacePtr< T >::Free (  ) [inline]

Definition at line 427 of file shellclasses.h.

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

    {
        T* h = _p;
        _p = NULL;

        if (h)
            h->Release();
    }

Here is the caller graph for this function:

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

Definition at line 422 of file shellclasses.h.

    {
        return _p;
    }
template<typename T>
SIfacePtr< T >::operator T * (  ) [inline]

Definition at line 372 of file shellclasses.h.

References SIfacePtr< T >::_p.

    {
        return _p;
    }
template<typename T>
T** SIfacePtr< T >::operator& (  ) [inline]

Definition at line 377 of file shellclasses.h.

    {
        return &_p;
    }
template<typename T>
const T* SIfacePtr< T >::operator-> (  ) const [inline]

Definition at line 361 of file shellclasses.h.

    {
        return _p;
    }
template<typename T>
T* SIfacePtr< T >::operator-> (  ) [inline]

Definition at line 356 of file shellclasses.h.

    {
        return _p;
    }
template<typename T>
void SIfacePtr< T >::operator= ( SIfacePtr< T > const &  o ) [inline]

Definition at line 399 of file shellclasses.h.

    {
        T* h = _p;

        if (o._p)
            o._p->AddRef();

        _p = o._p;

        if (h)
            h->Release();
    }
template<typename T>
SIfacePtr& SIfacePtr< T >::operator= ( T *  p ) [inline]

Definition at line 387 of file shellclasses.h.

    {
        Free();

        if (p) {
            p->AddRef();
            _p = p;
        }

        return *this;
    }
template<typename T>
template<typename I >
HRESULT SIfacePtr< T >::QueryInterface ( REFIID  riid,
I *  p 
) [inline]

Definition at line 417 of file shellclasses.h.

Referenced by BrowserNavigator::navigated().

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

Here is the caller graph for this function:


Member Data Documentation

template<typename T>
T* SIfacePtr< T >::_p [protected]

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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage