acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
definition.h
1#pragma once
2
3
4
5// from 7-zip
6
7namespace acme
8{
9
10 template <class T> inline T MyMin(T a, T b)
11 {
12 return a < b ? a : b;
13 }
14
15 template <class T> inline T MyMax(T a, T b)
16 {
17 return a > b ? a : b;
18 }
19
20 template <class T> inline ::i32 MyCompare(T a, T b)
21 {
22 return a < b ? -1 : (a == b ? 0 : 1);
23 }
24
25 inline ::i32 BoolToInt(bool value)
26 {
27 return (value ? 1 : 0);
28 }
29
30 inline bool IntToBool(::i32 value)
31 {
32 return (value != 0);
33 }
34
35} // // from 7-zip
36
37
38#ifndef RC_INVOKED
39
40#ifndef __cplusplus
41#error acme requires C++ compilation (use a .cpp suffix)
42#endif
43
44#ifdef UNDER_CE
45#error This version of acme is not currently supported for CE. Look for the CE specific version.
46#endif
47
48
49#ifdef _UNICODE
50#ifndef UNICODE
51#define UNICODE // UNICODE is used by Windows headers
52#endif
53#endif
54
55#ifdef UNICODE
56#ifndef _UNICODE
57#define _UNICODE // _UNICODE is used by C-runtime/acme API headers
58#endif
59#endif
60
61
62#ifdef _WIN64
63#define _SUPPORT_VT_I8 // Always support VT_I8 on Win64.
64#endif
65
66#if !defined(UNALIGNED)
67#if defined(_M_IA64) || defined(_M_AMD64)
68#define UNALIGNED __unaligned
69#else
70#define UNALIGNED
71#endif
72#endif
73
74#if !defined(_countof)
75#if !defined(__cplusplus) || defined(VC6)
76#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
77#else
78extern "C++"
79{
80 template <typename _CountofType, size_t _SizeOfArray>
81 ::i8 (*__countof_helper(UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
82#define _countof(_Array) sizeof(*__countof_helper(_Array))
83}
84#endif
85#endif
86
87
88
89
90
91
93// __declspec(novtable) is used on a class declaration to prevent the vtable
94// pointer from being initialized in the constructor and destructor for the
95// class. This has many benefits because the linker can now eliminate the
96// vtable and all the functions pointed to by the vtable. Also, the actual
97// constructor and destructor code are now smaller.
99// This should only be used on a class that is not directly createable but is
100// rather only used as a acme class. Additionally, the constructor and
101// destructor (if provided by the ::account::user) should not call anything that may cause
102// a virtual function call to occur back on the matter.
104// By default, the wizards will generate acme matter classes with this
105// attribute (through the NO_VTABLE macro). This is normally safe as long
106// the restriction mentioned above is followed. It is always safe to erase
107// this macro from your class, so if in doubt, erase it.
109
110#ifdef _DISABLE_NO_VTABLE
111#define NO_VTABLE
112#else
113#define NO_VTABLE __declspec(novtable)
114#endif
115
116
117/*#ifdef _DISABLE_FORCEINLINE
118#define FORCEINLINE
119#else
120#define FORCEINLINE inline
121#endif*/
122
123#if defined(_DISABLE_NOINLINE) || defined(VC6) || defined(LINUX)
124#define NOINLINE
125#else
126#define NOINLINE __declspec( noinline )
127#endif
128
129#ifdef _DISABLE_DEPRECATED
130#define DEPRECATED(_Message)
131#else
132#define DEPRECATED(_Message) __declspec( deprecated(_Message) )
133#endif
134
135// If 80.DLL is being used then _STATIC_REGISTRY doesn't really make sense
136#ifdef _DLL
137#undef _STATIC_REGISTRY
138#else
139// If not linking to 80.DLL, use the static registrar and not building acme.dll
140#ifndef _DLL_IMPL
141#ifndef _STATIC_REGISTRY
142#define _STATIC_REGISTRY
143#endif
144#endif
145#endif
146
147#ifdef _DEBUG_REFCOUNT
148#ifndef DEBUG_INTERFACES
149#define DEBUG_INTERFACES
150#endif
151#endif
152
153
154#ifndef _HEAPFLAGS
155#ifdef _MALLOC_ZEROINIT
156#define _HEAPFLAGS HEAP_ZERO_MEMORY
157#else
158#define _HEAPFLAGS 0
159#endif
160#endif
161
162#define API CLASS_DECL_ACME __declspec(nothrow) HRESULT __stdcall
163#define API_(x)CLASS_DECL_ACME __declspec(nothrow) x __stdcall
164#define APIINL API
165#define APIINL_(x) API_(x)
166
167
168#define offsetofclass(acme, derived) ((uptr)(static_cast<acme*>((derived*)_PACKING))-_PACKING)
169
171// Master version numbers
172
173//#define _ 1 // Active Template Library
174#define _VER 0x0800 // Active Template Library version 8.00
175
177// Threading
178
179#ifndef _SINGLE_THREADED
180#ifndef _APARTMENT_THREADED
181#ifndef _FREE_THREADED
182#define _FREE_THREADED
183#endif
184#endif
185#endif
186
187// UUIDOF
188#ifndef _NO_UUIDOF
189#define _IIDOF(x) __uuidof(x)
190#else
191#define _IIDOF(x) IID_##x
192#endif
193
194// Lean and mean
195#ifndef NO_LEAN_AND_MEAN
196#ifndef WIN32_LEAN_AND_MEAN
197#define WIN32_LEAN_AND_MEAN
198#endif
199#ifndef NOMCX
200#define NOMCX
201#endif
202#endif // NO_LEAN_AND_MEAN
203
204#ifdef NOSERVICE
205#ifndef _NO_SERVICE
206#define _NO_SERVICE
207#endif // _NO_SERVICE
208#else
209#ifdef _NO_SERVICE
210#ifndef NOSERVICE
211#define NOSERVICE
212#endif // NOSERVICE
213#endif // _NO_SERVICE
214#endif // NOSERVICE
215
216
217#endif // RC_INVOKED
218
219#define AXWIN_CLASS "ca_AxWin80"
220#define AXWINLIC_CLASS "ca_AxWinLic80"
221
222// _INSECURE_DEPRECATE define
223#ifndef _INSECURE_DEPRECATE
224#if defined(_SECURE_NO_DEPRECATE) || defined(VC6) || defined(VC71)
225#define _INSECURE_DEPRECATE(_Message)
226#else
227#define _INSECURE_DEPRECATE(_Message) __declspec(deprecated(_Message))
228#endif // _SECURE_NO_DEPRECATE
229#endif // _INSECURE_DEPRECATE
230
231/*
232This is called when something really bad happens -- so bad
233that we consider it dangerous to even throw ::exception( an exception
234*/
235#ifndef _FATAL_SHUTDOWN
236#define _FATAL_SHUTDOWN do { ::TerminateProcess(::GetCurrentProcess(), 0); } while(0);
237#endif
238
239//acme/ API code should use standard pointer to member standard syntax &MyClass::MyMethod, instead
240//of the legacy non-standard syntax - MyMethod.
241#ifdef _ENABLE_PTM_WARNING
242#define PTM_WARNING_DISABLE
243#define PTM_WARNING_RESTORE
244#else
245#define PTM_WARNING_DISABLE \
246 __pragma(warning( push )) \
247 __pragma(warning( disable : 4867 ))
248#define PTM_WARNING_RESTORE \
249 __pragma(warning( pop ))
250#endif //_ENABLE_PTM_WARNING
251
252/* we have to define our own versions of MAKEINTRESOURCE and IS_INTRESOURCE to
253 * fix warning 6268. At least until those macros are not cleanend in PSDK.
254 Same comes true for those definitions of constants which use the above macros
255*/
256#ifndef WINDOWS
257#define MAKEINTRESOURCEA(i) ((char_pointer )((uptr)((::u16)(i))))
258#define MAKEINTRESOURCEW(i) ((wide_character * )((uptr)((::u16)(i))))
259#endif
260#ifdef UNICODE
261#define MAKEINTRESOURCE MAKEINTRESOURCEW
262#else
263#define MAKEINTRESOURCE MAKEINTRESOURCEA
264#endif // !UNICODE
265#ifndef WINDOWS
266#define IS_INTRESOURCE(_r) ((((uptr)(_r)) >> 16) == 0)
267#endif
268
269/*
270 * Predefined Resource Types
271 */
272#define RT_CURSOR MAKEINTRESOURCE(1)
273#define RT_BITMAP MAKEINTRESOURCE(2)
274#define RT_ICON MAKEINTRESOURCE(3)
275#define RT_MENU MAKEINTRESOURCE(4)
276#define RT_DIALOG MAKEINTRESOURCE(5)
277#define RT_STRING MAKEINTRESOURCE(6)
278#define RT_FONTDIR MAKEINTRESOURCE(7)
279#define RT_FONT MAKEINTRESOURCE(8)
280#define RT_ACCELERATOR MAKEINTRESOURCE(9)
281#define RT_RCDATA MAKEINTRESOURCE(10)
282#define RT_MESSAGETABLE MAKEINTRESOURCE(11)
283
284#define DIFFERENCE 11
285//#define RT_GROUP_CURSOR MAKEINTRESOURCE((uptr)RT_CURSOR + DIFFERENCE)
286//#define RT_GROUP_ICON MAKEINTRESOURCE((uptr)RT_ICON + DIFFERENCE)
287#define RT_VERSION MAKEINTRESOURCE(16)
288#define RT_DLGINCLUDE MAKEINTRESOURCE(17)
289#if(WINVER >= 0x0400)
290#define RT_PLUGPLAY MAKEINTRESOURCE(19)
291#define RT_VXD MAKEINTRESOURCE(20)
292#define RT_ANICURSOR MAKEINTRESOURCE(21)
293#define RT_ANIICON MAKEINTRESOURCE(22)
294#endif /* WINVER >= 0x0400 */
295#define RT_HTML MAKEINTRESOURCE(23)
296#ifdef RC_INVOKED
297#define RT_MANIFEST 24
298#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
299#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
300#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
301#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID 1 /* inclusive */
302#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID 16 /* inclusive */
303#else /* RC_INVOKED */
304#define RT_MANIFEST MAKEINTRESOURCE(24)
305#define CREATEPROCESS_MANIFEST_RESOURCE_ID MAKEINTRESOURCE( 1)
306#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(2)
307#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(3)
308#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE( 1 /*inclusive*/)
309#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(16 /*inclusive*/)
310#endif /* RC_INVOKED */
311
312/* sal.h stuff that is not in the current LKG */
313#ifndef __out_ecount_part_z
314#define __out_ecount_part_z(size,length) __out_ecount_part(size,length) __post __nullterminated
315#endif
316
317#ifndef __out_ecount_part_z_opt
318#define __out_ecount_part_z_opt(size,length) __out_ecount_part_opt(size,length) __post __nullterminated
319#endif
320
321#ifndef __deref_opt_out_z
322#define __deref_opt_out_z __deref_opt_out __post __deref __nullterminated
323#endif
324
325#ifndef __out_bcount_part_z
326#define __out_bcount_part_z(size,length) __out_bcount_part(size,length) __post __nullterminated
327#endif
328
329
330
331
332
333
334
include "aura/graphics/image/context.h"
Definition aaaa__defer.h:32