|
// CopyPolicies.h
//
// Author : David Shepherd
// Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
/////////////////////////////////////////////////////////////////////////////
// _CopyInterfaceFromAdaptInterface
template <class T>
class _CopyInterfaceFromAdaptInterface
{
public:
static HRESULT copy(T **p1,CAdapt<CComPtr<T> > *p2)
{
// check parameters
if(p1==NULL)
{
return E_POINTER;
}
if(p2==NULL)
{
return E_POINTER;
}
// copy the interface
*p1=CComPtr<T>(*p2).Detach();
return S_OK;
}
static void init(T **p)
{
// initialise
ATLASSERT(p!=NULL);
*p=NULL;
}
static void destroy(T **p)
{
// destroy
ATLASSERT(p!=NULL);
CComPtr<T>().Attach(*p);
}
};
/////////////////////////////////////////////////////////////////////////////
// _CopyVariantFromAdaptIUnknown
class _CopyVariantFromAdaptIUnknown
{
public:
static HRESULT copy(VARIANT *p1,CAdapt<CComPtr<IUnknown> > *p2);
static void init(VARIANT *p);
static void destroy(VARIANT *p);
};
/////////////////////////////////////////////////////////////////////////////
// _CopyVariantFromAdaptIDispatch
class _CopyVariantFromAdaptIDispatch
{
public:
static HRESULT copy(VARIANT *p1,CAdapt<CComPtr<IDispatch> > *p2);
static void init(VARIANT *p);
static void destroy(VARIANT *p);
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.