singrdk/base/Windows/Inc/objbase.h

384 lines
12 KiB
C++

//+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: objbase.h
//
// Contents: Component object model defintions for dbg extensions.
// ***************************************************************************
// ****** Heavily edited to remove many Windows dependencies *******
// ***************************************************************************
//
//----------------------------------------------------------------------------
#if !defined( _OBJBASE_H_ )
#define _OBJBASE_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <pshpack8.h>
/////////////////////////////////////////////////////////////////// From rpc.h
//
#define __RPC_FAR
//////////////////////////////////////////////////////////////// From rpcndr.h
//
#ifdef __cplusplus
extern "C" {
#endif
/****************************************************************************
* VC COM support
****************************************************************************/
#ifndef DECLSPEC_NOVTABLE
#if (_MSC_VER >= 1100) && defined(__cplusplus)
#define DECLSPEC_NOVTABLE __declspec(novtable)
#else
#define DECLSPEC_NOVTABLE
#endif
#endif
#ifndef DECLSPEC_UUID
#if (_MSC_VER >= 1100) && defined(__cplusplus)
#define DECLSPEC_UUID(x) __declspec(uuid(x))
#else
#define DECLSPEC_UUID(x)
#endif
#endif
#define MIDL_INTERFACE(x) struct DECLSPEC_UUID(x) DECLSPEC_NOVTABLE
#if _MSC_VER >= 1100
#define EXTERN_GUID(itf,l1,s1,s2,c1,c2,c3,c4,c5,c6,c7,c8) \
EXTERN_C const IID DECLSPEC_SELECTANY itf = {l1,s1,s2,{c1,c2,c3,c4,c5,c6,c7,c8}}
#else
#define EXTERN_GUID(itf,l1,s1,s2,c1,c2,c3,c4,c5,c6,c7,c8) EXTERN_C const IID itf
#endif
#ifdef __cplusplus
}
#endif
//////////////////////////////////////////////////////////////////////////////
//
/****** Interface Declaration ***********************************************/
/*
* These are macros for declaring interfaces. They exist so that
* a single definition of the interface is simulataneously a proper
* declaration of the interface structures (C++ abstract classes)
* for both C and C++.
*
* DECLARE_INTERFACE(iface) is used to declare an interface that does
* not derive from a base interface.
* DECLARE_INTERFACE_(iface, baseiface) is used to declare an interface
* that does derive from a base interface.
*
* By default if the source file has a .c extension the C version of
* the interface declaratations will be expanded; if it has a .cpp
* extension the C++ version will be expanded. if you want to force
* the C version expansion even though the source file has a .cpp
* extension, then define the macro "CINTERFACE".
* eg. cl -DCINTERFACE file.cpp
*
* Example Interface declaration:
*
* #undef INTERFACE
* #define INTERFACE IClassFactory
*
* DECLARE_INTERFACE_(IClassFactory, IUnknown)
* {
* // *** IUnknown methods ***
* STDMETHOD(QueryInterface) (THIS_
* REFIID riid,
* LPVOID FAR* ppvObj) PURE;
* STDMETHOD_(ULONG,AddRef) (THIS) PURE;
* STDMETHOD_(ULONG,Release) (THIS) PURE;
*
* // *** IClassFactory methods ***
* STDMETHOD(CreateInstance) (THIS_
* LPUNKNOWN pUnkOuter,
* REFIID riid,
* LPVOID FAR* ppvObject) PURE;
* };
*
* Example C++ expansion:
*
* struct FAR IClassFactory : public IUnknown
* {
* virtual HRESULT STDMETHODCALLTYPE QueryInterface(
* IID FAR& riid,
* LPVOID FAR* ppvObj) = 0;
* virtual HRESULT STDMETHODCALLTYPE AddRef(void) = 0;
* virtual HRESULT STDMETHODCALLTYPE Release(void) = 0;
* virtual HRESULT STDMETHODCALLTYPE CreateInstance(
* LPUNKNOWN pUnkOuter,
* IID FAR& riid,
* LPVOID FAR* ppvObject) = 0;
* };
*
* NOTE: Our documentation says '#define interface class' but we use
* 'struct' instead of 'class' to keep a lot of 'public:' lines
* out of the interfaces. The 'FAR' forces the 'this' pointers to
* be far, which is what we need.
*
* Example C expansion:
*
* typedef struct IClassFactory
* {
* const struct IClassFactoryVtbl FAR* lpVtbl;
* } IClassFactory;
*
* typedef struct IClassFactoryVtbl IClassFactoryVtbl;
*
* struct IClassFactoryVtbl
* {
* HRESULT (STDMETHODCALLTYPE * QueryInterface) (
* IClassFactory FAR* This,
* IID FAR* riid,
* LPVOID FAR* ppvObj) ;
* HRESULT (STDMETHODCALLTYPE * AddRef) (IClassFactory FAR* This) ;
* HRESULT (STDMETHODCALLTYPE * Release) (IClassFactory FAR* This) ;
* HRESULT (STDMETHODCALLTYPE * CreateInstance) (
* IClassFactory FAR* This,
* LPUNKNOWN pUnkOuter,
* IID FAR* riid,
* LPVOID FAR* ppvObject);
* HRESULT (STDMETHODCALLTYPE * LockServer) (
* IClassFactory FAR* This,
* BOOL fLock);
* };
*/
#if defined(__cplusplus) && !defined(CINTERFACE)
//#define interface struct FAR
#define interface struct
#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
#define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
#define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method
#define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method
#define PURE = 0
#define THIS_
#define THIS void
#define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface
#define DECLARE_INTERFACE_(iface, baseiface) interface DECLSPEC_NOVTABLE iface : public baseiface
#if !defined(BEGIN_INTERFACE)
#if defined(_MPPC_) && \
( (defined(_MSC_VER) || defined(__SC__) || defined(__MWERKS__)) && \
!defined(NO_NULL_VTABLE_ENTRY) )
#define BEGIN_INTERFACE virtual void a() {}
#define END_INTERFACE
#else
#define BEGIN_INTERFACE
#define END_INTERFACE
#endif
#endif
#else
#define interface struct
#define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE * method)
#define STDMETHOD_(type,method) type (STDMETHODCALLTYPE * method)
#define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE * method)
#define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE * method)
#if !defined(BEGIN_INTERFACE)
#if defined(_MPPC_)
#define BEGIN_INTERFACE void *b;
#define END_INTERFACE
#else
#define BEGIN_INTERFACE
#define END_INTERFACE
#endif
#endif
#define PURE
#define THIS_ INTERFACE FAR* This,
#define THIS INTERFACE FAR* This
#ifdef CONST_VTABLE
#undef CONST_VTBL
#define CONST_VTBL const
#define DECLARE_INTERFACE(iface) typedef interface iface { \
const struct iface##Vtbl FAR* lpVtbl; \
} iface; \
typedef const struct iface##Vtbl iface##Vtbl; \
const struct iface##Vtbl
#else
#undef CONST_VTBL
#define CONST_VTBL
#define DECLARE_INTERFACE(iface) typedef interface iface { \
struct iface##Vtbl FAR* lpVtbl; \
} iface; \
typedef struct iface##Vtbl iface##Vtbl; \
struct iface##Vtbl
#endif
#define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE(iface)
#endif
/* Forward Declarations */
#ifndef __IUnknown_FWD_DEFINED__
#define __IUnknown_FWD_DEFINED__
typedef interface IUnknown IUnknown;
#endif /* __IUnknown_FWD_DEFINED__ */
#ifdef __cplusplus
extern "C"{
#endif
/* interface __MIDL_itf_unknwn_0000 */
/* [local] */
//+-------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//--------------------------------------------------------------------------
#if ( _MSC_VER >= 1020 )
#pragma once
#endif
#ifndef __IUnknown_INTERFACE_DEFINED__
#define __IUnknown_INTERFACE_DEFINED__
/* interface IUnknown */
/* [unique][uuid][object][local] */
typedef /* [unique] */ IUnknown *LPUNKNOWN;
//////////////////////////////////////////////////////////////////
// IID_IUnknown and all other system IIDs are provided in UUID.LIB
// Link that library in with your proxies, clients and servers
//////////////////////////////////////////////////////////////////
#if (_MSC_VER >= 1100) && defined(__cplusplus) && !defined(CINTERFACE)
EXTERN_C const IID IID_IUnknown;
extern "C++"
{
MIDL_INTERFACE("00000000-0000-0000-C000-000000000046")
IUnknown
{
public:
BEGIN_INTERFACE
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) = 0;
virtual ULONG STDMETHODCALLTYPE AddRef( void) = 0;
virtual ULONG STDMETHODCALLTYPE Release( void) = 0;
template<class Q>
HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp)
{
return QueryInterface(__uuidof(Q), (void **)pp);
}
END_INTERFACE
};
} // extern C++
#else
EXTERN_C const IID IID_IUnknown;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("00000000-0000-0000-C000-000000000046")
IUnknown
{
public:
BEGIN_INTERFACE
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject) = 0;
virtual ULONG STDMETHODCALLTYPE AddRef( void) = 0;
virtual ULONG STDMETHODCALLTYPE Release( void) = 0;
END_INTERFACE
};
#else /* C style interface */
typedef struct IUnknownVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
IUnknown * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
IUnknown * This);
ULONG ( STDMETHODCALLTYPE *Release )(
IUnknown * This);
END_INTERFACE
} IUnknownVtbl;
interface IUnknown
{
CONST_VTBL struct IUnknownVtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IUnknown_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IUnknown_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IUnknown_Release(This) \
(This)->lpVtbl -> Release(This)
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IUnknown_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_unknwn_0005 */
/* [local] */
#endif
#ifdef __cplusplus
}
#endif
#include <guiddef.h>
#if 0
#define __reserved
#define __inout
#endif
#include <poppack.h>
#endif // __OBJBASE_H__