mirror of
https://github.com/reactos/reactos.git
synced 2024-10-02 15:34:13 +00:00
[ATL]
-Add a new template called CComQIIDPtr and its partner I_ID macro. Its purpose is to be a gcc compatible version of CComQIPtr. -CComQIIDPtr<I_ID(Itype)> is the gcc compatible version of CComQIPtr<Itype> - WARNING: this is not tested yet. svn path=/trunk/; revision=75129
This commit is contained in:
parent
f43b456462
commit
615f2ccd2f
|
@ -149,6 +149,66 @@ public:
|
|||
};
|
||||
|
||||
|
||||
//CComQIIDPtr<I_ID(Itype)> is the gcc compatible version of CComQIPtr<Itype>
|
||||
#define I_ID(Itype) Itype,IID_##Itype
|
||||
|
||||
template <class T, const IID* piid>
|
||||
class CComQIIDPtr :
|
||||
public CComPtr<T>
|
||||
{
|
||||
public:
|
||||
CComQIIDPtr()
|
||||
{
|
||||
}
|
||||
CComQIIDPtr(_Inout_opt_ T* lp) :
|
||||
CComPtr<T>(lp)
|
||||
{
|
||||
}
|
||||
CComQIIDPtr(_Inout_ const CComQIIDPtr<T,piid>& lp):
|
||||
CComPtr<T>(lp.p)
|
||||
{
|
||||
}
|
||||
CComQIIDPtr(_Inout_opt_ IUnknown* lp)
|
||||
{
|
||||
if (lp != NULL)
|
||||
{
|
||||
if (FAILED(lp->QueryInterface(*piid, (void **)&this.p)))
|
||||
this.p = NULL;
|
||||
}
|
||||
}
|
||||
T *operator = (T *lp)
|
||||
{
|
||||
if (this.p != NULL)
|
||||
this.p->Release();
|
||||
this.p = lp;
|
||||
if (this.p != NULL)
|
||||
this.p->AddRef();
|
||||
return *this;
|
||||
}
|
||||
|
||||
T *operator = (const CComQIIDPtr<T,piid> &lp)
|
||||
{
|
||||
if (this.p != NULL)
|
||||
this.p->Release();
|
||||
this.p = lp.p;
|
||||
if (this.p != NULL)
|
||||
this.p->AddRef();
|
||||
return *this;
|
||||
}
|
||||
|
||||
T * operator=(IUnknown* lp)
|
||||
{
|
||||
if (this.p != NULL)
|
||||
this.p->Release();
|
||||
|
||||
if (FAILED(lp->QueryInterface(*piid, (void **)&this.p)))
|
||||
this.p = NULL;
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CComBSTR
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue