112 lines
1.9 KiB
C++
112 lines
1.9 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "testsUnit/http/msApi/mockXmlHttpRequest.h"
|
|
|
|
namespace US_NS {;
|
|
|
|
MockSequentialStream::MockSequentialStream()
|
|
: m_cRef(0)
|
|
{
|
|
}
|
|
|
|
STDMETHODIMP_(ULONG) MockSequentialStream::AddRef()
|
|
{
|
|
return ::InterlockedIncrement(&m_cRef);
|
|
}
|
|
|
|
STDMETHODIMP_(ULONG) MockSequentialStream::Release()
|
|
{
|
|
ULONG ulRefCount = ::InterlockedDecrement(&m_cRef);
|
|
|
|
if (0 == ulRefCount)
|
|
{
|
|
delete this;
|
|
}
|
|
|
|
return ulRefCount;
|
|
}
|
|
|
|
STDMETHODIMP MockSequentialStream::QueryInterface(REFIID riid, void** ppvObject)
|
|
{
|
|
if (ppvObject == nullptr)
|
|
{
|
|
return E_INVALIDARG;
|
|
}
|
|
|
|
*ppvObject = nullptr;
|
|
|
|
HRESULT hr = S_OK;
|
|
void* pObject = nullptr;
|
|
|
|
if (riid == IID_IUnknown)
|
|
{
|
|
pObject = static_cast<IUnknown*>((IDispatch*)this);
|
|
}
|
|
else
|
|
{
|
|
return E_NOINTERFACE;
|
|
}
|
|
|
|
AddRef();
|
|
|
|
*ppvObject = pObject;
|
|
pObject = nullptr;
|
|
|
|
return hr;
|
|
}
|
|
|
|
|
|
MockXmlHttpRequest::MockXmlHttpRequest()
|
|
: m_cRef(0)
|
|
{
|
|
}
|
|
|
|
STDMETHODIMP_(ULONG) MockXmlHttpRequest::AddRef()
|
|
{
|
|
return ::InterlockedIncrement(&m_cRef);
|
|
}
|
|
|
|
STDMETHODIMP_(ULONG) MockXmlHttpRequest::Release()
|
|
{
|
|
ULONG ulRefCount = ::InterlockedDecrement(&m_cRef);
|
|
|
|
if (0 == ulRefCount)
|
|
{
|
|
delete this;
|
|
}
|
|
|
|
return ulRefCount;
|
|
}
|
|
|
|
STDMETHODIMP MockXmlHttpRequest::QueryInterface(REFIID riid, void** ppvObject)
|
|
{
|
|
if (ppvObject == nullptr)
|
|
{
|
|
return E_INVALIDARG;
|
|
}
|
|
|
|
*ppvObject = nullptr;
|
|
|
|
HRESULT hr = S_OK;
|
|
void* pObject = nullptr;
|
|
|
|
if (riid == IID_IUnknown)
|
|
{
|
|
pObject = static_cast<IUnknown*>((IDispatch*)this);
|
|
}
|
|
else
|
|
{
|
|
return E_NOINTERFACE;
|
|
}
|
|
|
|
AddRef();
|
|
|
|
*ppvObject = pObject;
|
|
pObject = nullptr;
|
|
|
|
return hr;
|
|
}
|
|
|
|
|
|
};
|