mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
refeactor all IUnknown implementations using IComSrvBase
svn path=/trunk/; revision=18063
This commit is contained in:
parent
029ccdccaa
commit
8b950fec34
4 changed files with 121 additions and 216 deletions
|
@ -58,8 +58,7 @@ struct BrowserCallback
|
|||
/// Implementation of IShellBrowserImpl interface in explorer child windows
|
||||
struct ShellBrowser : public IShellBrowserImpl
|
||||
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
||||
, public IComSrvBase<IShellFolderViewCB, ShellBrowser>,
|
||||
public SimpleComObject
|
||||
, public IComSrvBase<IShellFolderViewCB, ShellBrowser>, public SimpleComObject
|
||||
#endif
|
||||
{
|
||||
ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
||||
|
|
|
@ -530,8 +530,8 @@ interface FixedDWebBrowserEvents2 : public IDispatch
|
|||
#endif
|
||||
};
|
||||
|
||||
struct ANSUNC DWebBrowserEvents2Impl : public SimpleComObject,
|
||||
public IComSrvBase<FixedDWebBrowserEvents2, DWebBrowserEvents2Impl>,
|
||||
struct ANSUNC DWebBrowserEvents2Impl
|
||||
: public IComSrvBase<FixedDWebBrowserEvents2, DWebBrowserEvents2Impl>, public SimpleComObject,
|
||||
public DWebBrowserEvents2IF
|
||||
{
|
||||
typedef IComSrvBase<FixedDWebBrowserEvents2, DWebBrowserEvents2Impl> super;
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
IDataObjectImpl::IDataObjectImpl(IDropSourceImpl* pDropSource)
|
||||
: m_pDropSource(pDropSource),
|
||||
: super(IID_IDataObject),
|
||||
m_pDropSource(pDropSource),
|
||||
m_cRefCount(0)
|
||||
{
|
||||
}
|
||||
|
@ -33,37 +34,6 @@ IDataObjectImpl::~IDataObjectImpl()
|
|||
ReleaseStgMedium(it->_medium);
|
||||
}
|
||||
|
||||
STDMETHODIMP IDataObjectImpl::QueryInterface(/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject)
|
||||
{
|
||||
*ppvObject = NULL;
|
||||
if (IID_IUnknown==riid || IID_IDataObject==riid)
|
||||
*ppvObject=this;
|
||||
/*if (riid == IID_IAsyncOperation)
|
||||
*ppvObject=(IAsyncOperation*)this;*/
|
||||
if (NULL!=*ppvObject)
|
||||
{
|
||||
((LPUNKNOWN)*ppvObject)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) IDataObjectImpl::AddRef()
|
||||
{
|
||||
return ++m_cRefCount;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) IDataObjectImpl::Release()
|
||||
{
|
||||
long nTemp = --m_cRefCount;
|
||||
|
||||
if (nTemp == 0)
|
||||
delete this;
|
||||
|
||||
return nTemp;
|
||||
}
|
||||
|
||||
STDMETHODIMP IDataObjectImpl::GetData(
|
||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetcIn,
|
||||
/* [out] */ STGMEDIUM __RPC_FAR *pmedium)
|
||||
|
@ -255,38 +225,6 @@ HRESULT STDMETHODCALLTYPE IDataObjectImpl::EnumDAdvise(
|
|||
// IDropSourceImpl Class
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
STDMETHODIMP IDropSourceImpl::QueryInterface(/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject)
|
||||
{
|
||||
*ppvObject = NULL;
|
||||
if (IID_IUnknown==riid || IID_IDropSource==riid)
|
||||
*ppvObject=this;
|
||||
|
||||
if (*ppvObject != NULL)
|
||||
{
|
||||
((LPUNKNOWN)*ppvObject)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) IDropSourceImpl::AddRef()
|
||||
{
|
||||
return ++m_cRefCount;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) IDropSourceImpl::Release()
|
||||
{
|
||||
long nTemp = --m_cRefCount;
|
||||
|
||||
assert(nTemp >= 0);
|
||||
|
||||
if (nTemp == 0)
|
||||
delete this;
|
||||
|
||||
return nTemp;
|
||||
}
|
||||
|
||||
STDMETHODIMP IDropSourceImpl::QueryContinueDrag(
|
||||
/* [in] */ BOOL fEscapePressed,
|
||||
/* [in] */ DWORD grfKeyState)
|
||||
|
@ -314,7 +252,8 @@ STDMETHODIMP IDropSourceImpl::GiveFeedback(
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
EnumFormatEtcImpl::EnumFormatEtcImpl(const FormatArray& ArrFE)
|
||||
: m_cRefCount(0),
|
||||
: super(IID_IEnumFORMATETC),
|
||||
m_cRefCount(0),
|
||||
m_iCur(0)
|
||||
{
|
||||
for(FormatArray::const_iterator it=ArrFE.begin(); it!=ArrFE.end(); ++it)
|
||||
|
@ -322,45 +261,15 @@ EnumFormatEtcImpl::EnumFormatEtcImpl(const FormatArray& ArrFE)
|
|||
}
|
||||
|
||||
EnumFormatEtcImpl::EnumFormatEtcImpl(const StorageArray& ArrFE)
|
||||
: m_cRefCount(0),
|
||||
: super(IID_IEnumFORMATETC),
|
||||
m_cRefCount(0),
|
||||
m_iCur(0)
|
||||
{
|
||||
for(StorageArray::const_iterator it=ArrFE.begin(); it!=ArrFE.end(); ++it)
|
||||
m_pFmtEtc.push_back(*it->_format);
|
||||
}
|
||||
|
||||
STDMETHODIMP EnumFormatEtcImpl::QueryInterface(REFIID refiid, void** ppv)
|
||||
{
|
||||
*ppv = NULL;
|
||||
if (IID_IUnknown==refiid || IID_IEnumFORMATETC==refiid)
|
||||
*ppv=this;
|
||||
|
||||
if (*ppv != NULL)
|
||||
{
|
||||
((LPUNKNOWN)*ppv)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) EnumFormatEtcImpl::AddRef(void)
|
||||
{
|
||||
return ++m_cRefCount;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) EnumFormatEtcImpl::Release(void)
|
||||
{
|
||||
long nTemp = --m_cRefCount;
|
||||
|
||||
assert(nTemp >= 0);
|
||||
|
||||
if (nTemp == 0)
|
||||
delete this;
|
||||
|
||||
return nTemp;
|
||||
}
|
||||
|
||||
STDMETHODIMP EnumFormatEtcImpl::Next( ULONG celt,LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
|
||||
STDMETHODIMP EnumFormatEtcImpl::Next(ULONG celt,LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
|
||||
{
|
||||
if (pceltFetched != NULL)
|
||||
*pceltFetched=0;
|
||||
|
|
|
@ -24,23 +24,21 @@ typedef vector<DataStorage> StorageArray;
|
|||
|
||||
|
||||
/// implementation of IEnumFORMATETC interface
|
||||
class EnumFormatEtcImpl : public IEnumFORMATETC
|
||||
class EnumFormatEtcImpl
|
||||
: public IComSrvBase<IEnumFORMATETC, EnumFormatEtcImpl>, public SimpleComObject
|
||||
{
|
||||
private:
|
||||
typedef IComSrvBase<IEnumFORMATETC, EnumFormatEtcImpl> super;
|
||||
|
||||
private:
|
||||
ULONG m_cRefCount;
|
||||
FormatArray m_pFmtEtc;
|
||||
size_t m_iCur;
|
||||
|
||||
public:
|
||||
public:
|
||||
EnumFormatEtcImpl(const FormatArray& ArrFE);
|
||||
EnumFormatEtcImpl(const StorageArray& ArrFE);
|
||||
virtual ~EnumFormatEtcImpl() {}
|
||||
|
||||
//IUnknown members
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void**);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef(void);
|
||||
virtual ULONG STDMETHODCALLTYPE Release(void);
|
||||
|
||||
//IEnumFORMATETC members
|
||||
virtual HRESULT STDMETHODCALLTYPE Next(ULONG, LPFORMATETC, ULONG*);
|
||||
virtual HRESULT STDMETHODCALLTYPE Skip(ULONG);
|
||||
|
@ -49,22 +47,24 @@ class EnumFormatEtcImpl : public IEnumFORMATETC
|
|||
};
|
||||
|
||||
/// implementation of IDropSource interface
|
||||
class IDropSourceImpl : public IDropSource
|
||||
class IDropSourceImpl
|
||||
: public IComSrvBase<IDropSource, IDropSourceImpl>, public SimpleComObject
|
||||
{
|
||||
typedef IComSrvBase<IDropSource, IDropSourceImpl> super;
|
||||
|
||||
long m_cRefCount;
|
||||
|
||||
public:
|
||||
bool m_bDropped;
|
||||
|
||||
IDropSourceImpl::IDropSourceImpl() : m_cRefCount(0), m_bDropped(false) {}
|
||||
virtual ~IDropSourceImpl() {}
|
||||
IDropSourceImpl()
|
||||
: super(IID_IDropSource),
|
||||
m_cRefCount(0),
|
||||
m_bDropped(false)
|
||||
{
|
||||
}
|
||||
|
||||
//IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
virtual ~IDropSourceImpl() {}
|
||||
|
||||
//IDropSource
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
|
||||
|
@ -76,8 +76,12 @@ public:
|
|||
};
|
||||
|
||||
/// implementation of IDataObject interface
|
||||
class IDataObjectImpl : public IDataObject//,public IAsyncOperation
|
||||
class IDataObjectImpl
|
||||
: public IComSrvBase<IDataObject, IDataObjectImpl>, public SimpleComObject
|
||||
//public IAsyncOperation
|
||||
{
|
||||
typedef IComSrvBase<IDataObject, IDataObjectImpl> super;
|
||||
|
||||
IDropSourceImpl* m_pDropSource;
|
||||
long m_cRefCount;
|
||||
|
||||
|
@ -89,13 +93,6 @@ public:
|
|||
|
||||
void CopyMedium(STGMEDIUM* pMedDest, STGMEDIUM* pMedSrc, FORMATETC* pFmtSrc);
|
||||
|
||||
//IUnknown
|
||||
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
|
||||
virtual ULONG STDMETHODCALLTYPE AddRef();
|
||||
virtual ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
//IDataObject
|
||||
virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData(
|
||||
/* [unique][in] */ FORMATETC __RPC_FAR *pformatetcIn,
|
||||
|
|
Loading…
Reference in a new issue