mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:42:58 +00:00
[ATL] Fix the CComQIIDPtr template.
This commit is contained in:
parent
eb324b6a9c
commit
09719d25c4
1 changed files with 21 additions and 18 deletions
|
@ -150,13 +150,16 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//CComQIIDPtr<I_ID(Itype)> is the gcc compatible version of CComQIPtr<Itype>
|
//CComQIIDPtr<I_ID(Itype)> is the gcc compatible version of CComQIPtr<Itype>
|
||||||
#define I_ID(Itype) Itype,IID_##Itype
|
#define I_ID(Itype) Itype,&IID_##Itype
|
||||||
|
|
||||||
template <class T, const IID* piid>
|
template <class T, const IID* piid>
|
||||||
class CComQIIDPtr :
|
class CComQIIDPtr :
|
||||||
public CComPtr<T>
|
public CComPtr<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// Let's tell GCC how to find a symbol.
|
||||||
|
using CComPtr<T>::p;
|
||||||
|
|
||||||
CComQIIDPtr()
|
CComQIIDPtr()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -172,37 +175,37 @@ public:
|
||||||
{
|
{
|
||||||
if (lp != NULL)
|
if (lp != NULL)
|
||||||
{
|
{
|
||||||
if (FAILED(lp->QueryInterface(*piid, (void **)&this.p)))
|
if (FAILED(lp->QueryInterface(*piid, reinterpret_cast<void **>(&p))))
|
||||||
this.p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T *operator = (T *lp)
|
T *operator = (T *lp)
|
||||||
{
|
{
|
||||||
if (this.p != NULL)
|
if (p != NULL)
|
||||||
this.p->Release();
|
p->Release();
|
||||||
this.p = lp;
|
p = lp;
|
||||||
if (this.p != NULL)
|
if (p != NULL)
|
||||||
this.p->AddRef();
|
p->AddRef();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
T *operator = (const CComQIIDPtr<T,piid> &lp)
|
T *operator = (const CComQIIDPtr<T,piid> &lp)
|
||||||
{
|
{
|
||||||
if (this.p != NULL)
|
if (p != NULL)
|
||||||
this.p->Release();
|
p->Release();
|
||||||
this.p = lp.p;
|
p = lp.p;
|
||||||
if (this.p != NULL)
|
if (p != NULL)
|
||||||
this.p->AddRef();
|
p->AddRef();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
T * operator=(IUnknown* lp)
|
T * operator=(IUnknown* lp)
|
||||||
{
|
{
|
||||||
if (this.p != NULL)
|
if (p != NULL)
|
||||||
this.p->Release();
|
p->Release();
|
||||||
|
|
||||||
if (FAILED(lp->QueryInterface(*piid, (void **)&this.p)))
|
if (FAILED(lp->QueryInterface(*piid, reinterpret_cast<void **>(&p))))
|
||||||
this.p = NULL;
|
p = NULL;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue