libport: Remove support for PPC32.
[wine.git] / include / guiddef.h
blob546c4500434bdf67f178cdc825d36de45ed05090
1 /*
2 * Copyright (C) 2000 Alexandre Julliard
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef GUID_DEFINED
20 #define GUID_DEFINED
22 #ifdef __WIDL__
23 typedef struct
25 unsigned long Data1;
26 unsigned short Data2;
27 unsigned short Data3;
28 byte Data4[ 8 ];
29 } GUID;
30 #else
31 typedef struct _GUID
33 #ifdef WINE_USE_LONG
34 unsigned long Data1;
35 #else
36 unsigned int Data1;
37 #endif
38 unsigned short Data2;
39 unsigned short Data3;
40 unsigned char Data4[ 8 ];
41 } GUID;
42 #endif
44 /* Macros for __uuidof emulation */
45 #ifdef __cplusplus
46 # if defined(__MINGW32__)
47 # define __WINE_UUID_ATTR __attribute__((selectany))
48 # elif defined(__GNUC__)
49 # define __WINE_UUID_ATTR __attribute__((visibility("hidden"),weak))
50 # endif
51 #endif
53 #ifdef __WINE_UUID_ATTR
55 extern "C++" {
56 template<typename T> struct __wine_uuidof;
58 template<typename T> struct __wine_uuidof_type {
59 typedef __wine_uuidof<T> inst;
61 template<typename T> struct __wine_uuidof_type<T *> {
62 typedef __wine_uuidof<T> inst;
64 template<typename T> struct __wine_uuidof_type<T * const> {
65 typedef __wine_uuidof<T> inst;
69 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
70 extern "C++" { \
71 template<> struct __wine_uuidof<type> { \
72 static const GUID uuid; \
73 }; \
74 __WINE_UUID_ATTR const GUID __wine_uuidof<type>::uuid = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}; \
77 #define __uuidof(type) __wine_uuidof_type<typeof(type)>::inst::uuid
79 #else /* __WINE_UUID_ATTR */
81 #define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
83 #endif /* __WINE_UUID_ATTR */
85 #endif
87 #undef DEFINE_GUID
89 #ifdef INITGUID
90 #ifdef __cplusplus
91 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
92 EXTERN_C const GUID name DECLSPEC_HIDDEN; \
93 EXTERN_C const GUID name = \
94 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
95 #else
96 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
97 const GUID name DECLSPEC_HIDDEN; \
98 const GUID name = \
99 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
100 #endif
101 #else
102 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
103 EXTERN_C const GUID name DECLSPEC_HIDDEN
104 #endif
106 #define DEFINE_OLEGUID(name, l, w1, w2) \
107 DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
109 #ifndef _GUIDDEF_H_
110 #define _GUIDDEF_H_
112 #ifndef __LPGUID_DEFINED__
113 #define __LPGUID_DEFINED__
114 typedef GUID *LPGUID;
115 #endif
117 #ifndef __LPCGUID_DEFINED__
118 #define __LPCGUID_DEFINED__
119 typedef const GUID *LPCGUID;
120 #endif
122 #ifndef __IID_DEFINED__
123 #define __IID_DEFINED__
125 typedef GUID IID,*LPIID;
126 typedef GUID CLSID,*LPCLSID;
127 typedef GUID FMTID,*LPFMTID;
128 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
129 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
130 #define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
131 #define IID_NULL GUID_NULL
132 #define CLSID_NULL GUID_NULL
133 #define FMTID_NULL GUID_NULL
135 #ifdef __midl_proxy
136 #define __MIDL_CONST
137 #else
138 #define __MIDL_CONST const
139 #endif
141 #endif /* ndef __IID_DEFINED__ */
143 #ifdef __cplusplus
144 #define REFGUID const GUID &
145 #define REFCLSID const CLSID &
146 #define REFIID const IID &
147 #define REFFMTID const FMTID &
148 #else
149 #define REFGUID const GUID* __MIDL_CONST
150 #define REFCLSID const CLSID* __MIDL_CONST
151 #define REFIID const IID* __MIDL_CONST
152 #define REFFMTID const FMTID* __MIDL_CONST
153 #endif
155 #ifdef __cplusplus
156 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
157 inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
159 return (((ULONG *)&rguid1)[0] == ((ULONG *)&rguid2)[0] &&
160 ((ULONG *)&rguid1)[1] == ((ULONG *)&rguid2)[1] &&
161 ((ULONG *)&rguid1)[2] == ((ULONG *)&rguid2)[2] &&
162 ((ULONG *)&rguid1)[3] == ((ULONG *)&rguid2)[3]);
164 #else
165 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
166 #define InlineIsEqualGUID(rguid1, rguid2) \
167 (((ULONG *)rguid1)[0] == ((ULONG *)rguid2)[0] && \
168 ((ULONG *)rguid1)[1] == ((ULONG *)rguid2)[1] && \
169 ((ULONG *)rguid1)[2] == ((ULONG *)rguid2)[2] && \
170 ((ULONG *)rguid1)[3] == ((ULONG *)rguid2)[3])
171 #endif
173 #ifdef __cplusplus
174 #include <string.h>
175 inline bool operator==(const GUID& guidOne, const GUID& guidOther)
177 return !memcmp(&guidOne,&guidOther,sizeof(GUID));
179 inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
181 return !(guidOne == guidOther);
183 #endif
185 #endif /* _GUIDDEF_H_ */