11 #define P6COMPTR_H__ 1
82 operator I*()
const {
return static_cast<I*
>(
m_pRaw); }
92 return reinterpret_cast<I**
>(&
m_pRaw);
98 return reinterpret_cast<I**
>(&
m_pRaw);
112 *ppIface =
reinterpret_cast<I*
>(
m_pRaw);
126 inline I*
get()
const
128 return reinterpret_cast<I*
>(
m_pRaw);
219 return m_pRaw->queryInterface(riid,reinterpret_cast<P6VOID**>(ppIface));
253 if(pErr) (*pErr) = err;
260 if(pErr) (*pErr) = err;
277 if(pErr) (*pErr) = err;
317 template<
typename Interface>
319 { left.
swap(right); }
430 #define VALIDATECOMPTR(type,smartComPtr) IID_##type, reinterpret_cast<P6R::P6VOID**>(static_cast<type**>((smartComPtr).addressofWithRelease()))
434 #endif // __cplusplus
A smart pointer implementation to help manage and use [p6]COM based interfaces.
P6API P6ERR P6CCALL p6GetRuntimeIface(const P6R::P6IID &iid, P6VOID **ppIface)
This method is used to retreive any of the loader runtime interfaces.
P6VOID swap(p6ComPtr< Interface > &left, p6ComPtr< Interface > &right)
In order for generic algorithms to find p6ComPtr's swap() implementation, we must also provide a non-...
p6ComPtrBase(I *pRawPtr=NULL)
Default constructor.
I * detach()
Detach the owned inteface from the smart pointer and return a dumb pointer without release() directly...
p6ComPtr< I > & operator=(I *ip)
Assign from a dumb pointer of the correct type.
unsigned char P6BOOL
Boolean type.
P6R::P6ERR createInstance(P6R::p6ICom *pOuter, const P6R::P6CID &cid, const P6R::P6IID &riid)
Create a new component instance and assign the result to this smart pointer.
P6BOOL operator!=(I *pI) const
p6ComPtr(const P6R::P6IID &riid, P6R::P6ERR *pErr=NULL)
P6VOID swap(p6ComPtrBase< I > &rhs)
Exchange ownership.
p6ComPtr(p6ICom *pCom, const P6R::P6IID &riid, P6R::P6ERR *pErr=NULL)
Construct from the specified interface via queryInterface() This will query the interface passed in p...
P6VOID detach(I **ppIface)
Detach the owned interface from the smart pointer without release().
p6ComPtr(p6ICom *pI)
Contruct from a dumb pointer of the correct type.
p6ComPtr()
Default constructor.
P6ERR(P6CCALL * P6ASSERT)(const P6WCHAR *pszExpr, const P6CHAR *pszFile, P6UINT32 nLine)
I ** addressofWithRelease()
void attach(I *pIface)
Take ownership of a new interface without addref().
P6COM runtime interfaces definitions.
p6ComPtr(const p6ComPtr< I > &rSI)
Copy.
P6R::P6ERR getRuntimeIface(const P6R::P6IID &riid)
Get an instance of a runtime interface and adding the result to this smart pointer.
virtual P6R::P6ERR queryInterface(const P6R::P6IID &iid, P6VOID **ppIface)=0
This method queries the component for a specific interface.
The base interface all [p6]COM components must derive from and implement.
P6API P6ERR P6CCALL p6CreateInstance(p6ICom *pOuter, const P6R::P6CID &cid, const P6R::P6IID &iid, P6VOID **ppIface)
Creates a single uninitialized instance of the class/interface associated with the specified componen...
p6ComPtr< I > & operator=(const p6ComPtr< I > &cp)
Assign from a smart pointer of the correct type.
P6BOOL operator==(I *pI) const
A template specialization to support the p6ICom interface.
p6ComPtr(I *ip=NULL)
Construct from a raw pointer of the correct type Must be derrived from p6ICom.
p6ComPtrNoAddrefRelease< I > * operator->() const
p6ComPtr< p6ICom > & operator=(const p6ComPtr< p6ICom > &cp)
Assign from a smart pointer of the correct type.
p6ComPtr< p6ICom > & operator=(p6ICom *ip)
Assign from a dumb pointer of the correct type.
P6BOOL operator<(I *pI) const
P6UINT32 P6ERR
COM err return type see P6ERR.h.
Base class which implements common functionality for p6ComPtr and it's p6ICom specialization.
P6R::P6ERR queryInterface(const P6R::P6IID &riid, Q **ppIface)
A type safe version of queryInterface().
Template used to make the addref() and release() methods inaccessable when dereferncing a p6ComPtr<> ...
p6ComPtr(const P6R::P6CID &rclsid, const P6R::P6IID &riid, P6R::P6ERR *pErr=NULL)
Construct a new instance given the component ID and interface ID.
p6ComPtr(const p6ComPtr< p6ICom > &smartPtr)
Copy constructor.
P6VOID swap(I **ppIface)
Exchange ownership.