update for HEAD-2003091401
[reactos.git] / include / ole32 / objbase.h
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS system libraries
4  * FILE:            include\ole32\objbase.h
5  * PURPOSE:         Header file for the ole32.dll implementation
6  * PROGRAMMER:      jurgen van gael [jurgen.vangael@student.kuleuven.ac.be]
7  * UPDATE HISTORY:
8  *                  Created 01/05/2001
9  */
10 /********************************************************************
11
12
13 This library is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Library General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 Library General Public License for more details.
22
23 You should have received a copy of the GNU Library General Public
24 License along with this library; see the file COPYING.LIB.  If
25 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
26 Cambridge, MA 02139, USA.
27
28
29 ********************************************************************/
30 #ifndef _OBJBASE
31 #define _OBJBASE
32
33 #include "guiddef.h"
34
35 #ifndef EXTERN_C
36         #ifdef __cplusplus
37                 #define EXTERN_C    extern "C"
38         #else
39                 #define EXTERN_C    extern
40         #endif
41 #endif
42
43 #define STDMETHODCALLTYPE               __stdcall
44 #define STDMETHODVCALLTYPE              __cdecl
45
46 #define STDAPICALLTYPE                  __stdcall
47 #define STDAPIVCALLTYPE                 __cdecl
48
49
50 #define STDAPI                                  EXTERN_C HRESULT STDMETHODCALLTYPE
51 #define STDAPI_(type)                   EXTERN_C type STDAPICALLTYPE
52
53 #define STDMETHODIMP                    HRESULT STDMETHODCALLTYPE
54 #define STDMETHODIMP_(type)             type STDMETHODCALLTYPE
55
56
57 /*      variable argument lists versions */
58 #define STDAPIV                 EXTERN_C HRESULT STDAPIVCALLTYPE
59 #define STDAPIV_(type)          EXTERN_C type STDAPIVCALLTYPE
60
61 #define STDMETHODIMPV           HRESULT STDMETHODVCALLTYPE
62 #define STDMETHODIMPV_(type)    type STDMETHODVCALLTYPE
63
64 #ifndef WINOLEAPI
65         #define WINOLEAPI        STDAPI
66         #define WINOLEAPI_(type) STDAPI_(type)
67 #endif
68
69 /*
70  *      COM interface declaration macros [from the wine implementation
71  *
72  *      These macros declare interfaces for both C and C++ depending for what
73  *      language you are compiling
74  *
75  *      DECLARE_INTERFACE(iface): declare not derived interface
76  *      DECLARE_INTERFACE(iface, baseiface): declare derived interface
77  *
78  *      Use CINTERFACE if you want to force a c style interface declaration,
79  *      else, the compiler will look at the source file extension
80  */
81 #if     defined(__cplusplus) && !defined(CINTERFACE)
82         /*      define the c++ macros */
83         #define interface                                       struct
84         #define STDMETHOD(method)                       virtual HRESULT STDMETHODCALLTYPE       method
85         #define STDMETHOD_(type,method)         virtual type    STDMETHODCALLTYPE       method
86         #define STDMETHODV(method)                      virtual HRESULT STDMETHODVCALLTYPE      method
87         #define STDMETHODV_(type,method)        virtual type    STDMETHODVCALLTYPE      method
88         #define PURE                                            = 0
89         #define THIS_
90         #define THIS
91         #define DECLARE_INTERFACE(iface)                                interface iface
92         #define DECLARE_INTERFACE_(iface, baseiface)    interface iface : public baseiface
93
94 #else
95         /*      define the c macros */
96         #define interface                               struct
97         #define STDMETHOD(method)               HRESULT (STDMETHODCALLTYPE*             method)
98         #define STDMETHOD_(type,method) type    (STDMETHODCALLTYPE*             method)
99         #define STDMETHODV(method)              HRESULT (STDMETHODVCALLTYPE*    method)
100         #define STDMETHODV_(type,method)type    (STDMETHODVCALLTYPE*    method)
101         #define PURE
102         #define THIS_                                   INTERFACE       FAR*    This,
103         #define THIS                    INTERFACE       FAR*    This
104
105         #ifdef CONST_VTABLE
106                 #define DECLARE_INTERFACE(iface)        typedef interface       iface   {       \
107                                         const   struct  iface##Vtbl     FAR*    lpVtbl;                         \
108                                         }       iface;                                                                                          \
109                                         typedef const   struct  iface##Vtbl     iface##Vtbl;            \
110                                         const   struct  iface##Vtbl
111         #else
112                 #define DECLARE_INTERFACE(iface)        typedef interface       iface   {       \
113                                         struct  iface##Vtbl     FAR*    lpVtbl;                                         \
114                                         }       iface;                                                                                          \
115                                         typedef struct  iface##Vtbl     iface##Vtbl;                            \
116                                         struct  iface##Vtbl
117         #endif
118         
119         #define DECLARE_INTERFACE_(iface, baseiface)    DECLARE_INTERFACE(iface)
120 #endif
121
122 #endif