1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the QtCore module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
38 | ** $QT_END_LICENSE$ |
39 | ** |
40 | ****************************************************************************/ |
41 | |
42 | #ifndef QGLOBAL_H |
43 | #define QGLOBAL_H |
44 | |
45 | #include <stddef.h> |
46 | |
47 | #define QT_VERSION_STR "4.8.6" |
48 | /* |
49 | QT_VERSION is (major << 16) + (minor << 8) + patch. |
50 | */ |
51 | #define QT_VERSION 0x040806 |
52 | /* |
53 | can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) |
54 | */ |
55 | #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) |
56 | |
57 | #define QT_PACKAGEDATE_STR "2014-04-10" |
58 | |
59 | #define QT_PACKAGE_TAG "68a911862e05400ced87971c43fb27fb5d5d8ebd" |
60 | |
61 | #if !defined(QT_BUILD_MOC) |
62 | #include <QtCore/qconfig.h> |
63 | #endif |
64 | |
65 | #ifdef __cplusplus |
66 | |
67 | #ifndef QT_NO_STL |
68 | #include <algorithm> |
69 | #endif |
70 | |
71 | #ifndef QT_NAMESPACE /* user namespace */ |
72 | |
73 | # define QT_PREPEND_NAMESPACE(name) ::name |
74 | # define QT_USE_NAMESPACE |
75 | # define QT_BEGIN_NAMESPACE |
76 | # define QT_END_NAMESPACE |
77 | # define QT_BEGIN_INCLUDE_NAMESPACE |
78 | # define QT_END_INCLUDE_NAMESPACE |
79 | # define QT_BEGIN_MOC_NAMESPACE |
80 | # define QT_END_MOC_NAMESPACE |
81 | # define QT_FORWARD_DECLARE_CLASS(name) class name; |
82 | # define QT_FORWARD_DECLARE_STRUCT(name) struct name; |
83 | # define QT_MANGLE_NAMESPACE(name) name |
84 | |
85 | #else /* user namespace */ |
86 | |
87 | # define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name |
88 | # define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE; |
89 | # define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE { |
90 | # define QT_END_NAMESPACE } |
91 | # define QT_BEGIN_INCLUDE_NAMESPACE } |
92 | # define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE { |
93 | # define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE |
94 | # define QT_END_MOC_NAMESPACE |
95 | # define QT_FORWARD_DECLARE_CLASS(name) \ |
96 | QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \ |
97 | using QT_PREPEND_NAMESPACE(name); |
98 | |
99 | # define QT_FORWARD_DECLARE_STRUCT(name) \ |
100 | QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \ |
101 | using QT_PREPEND_NAMESPACE(name); |
102 | |
103 | # define QT_MANGLE_NAMESPACE0(x) x |
104 | # define QT_MANGLE_NAMESPACE1(a, b) a##_##b |
105 | # define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b) |
106 | # define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \ |
107 | QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE)) |
108 | |
109 | namespace QT_NAMESPACE {} |
110 | |
111 | # ifndef QT_BOOTSTRAPPED |
112 | # ifndef QT_NO_USING_NAMESPACE |
113 | /* |
114 | This expands to a "using QT_NAMESPACE" also in _header files_. |
115 | It is the only way the feature can be used without too much |
116 | pain, but if people _really_ do not want it they can add |
117 | DEFINES += QT_NO_USING_NAMESPACE to their .pro files. |
118 | */ |
119 | QT_USE_NAMESPACE |
120 | # endif |
121 | # endif |
122 | |
123 | #endif /* user namespace */ |
124 | |
125 | #else /* __cplusplus */ |
126 | |
127 | # define QT_BEGIN_NAMESPACE |
128 | # define QT_END_NAMESPACE |
129 | # define QT_USE_NAMESPACE |
130 | # define QT_BEGIN_INCLUDE_NAMESPACE |
131 | # define QT_END_INCLUDE_NAMESPACE |
132 | |
133 | #endif /* __cplusplus */ |
134 | |
135 | #if defined(Q_OS_MAC) && !defined(Q_CC_INTEL) |
136 | #define QT_BEGIN_HEADER extern "C++" { |
137 | #define QT_END_HEADER } |
138 | #define QT_BEGIN_INCLUDE_HEADER } |
139 | #define QT_END_INCLUDE_HEADER extern "C++" { |
140 | #else |
141 | #define QT_BEGIN_HEADER |
142 | #define QT_END_HEADER |
143 | #define QT_BEGIN_INCLUDE_HEADER |
144 | #define QT_END_INCLUDE_HEADER extern "C++" |
145 | #endif |
146 | |
147 | /* |
148 | The operating system, must be one of: (Q_OS_x) |
149 | |
150 | DARWIN - Darwin OS (synonym for Q_OS_MAC) |
151 | SYMBIAN - Symbian |
152 | MSDOS - MS-DOS and Windows |
153 | OS2 - OS/2 |
154 | OS2EMX - XFree86 on OS/2 (not PM) |
155 | WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) |
156 | WINCE - WinCE (Windows CE 5.0) |
157 | CYGWIN - Cygwin |
158 | SOLARIS - Sun Solaris |
159 | HPUX - HP-UX |
160 | ULTRIX - DEC Ultrix |
161 | LINUX - Linux |
162 | FREEBSD - FreeBSD |
163 | NETBSD - NetBSD |
164 | OPENBSD - OpenBSD |
165 | BSDI - BSD/OS |
166 | IRIX - SGI Irix |
167 | OSF - HP Tru64 UNIX |
168 | SCO - SCO OpenServer 5 |
169 | UNIXWARE - UnixWare 7, Open UNIX 8 |
170 | AIX - AIX |
171 | HURD - GNU Hurd |
172 | DGUX - DG/UX |
173 | RELIANT - Reliant UNIX |
174 | DYNIX - DYNIX/ptx |
175 | QNX - QNX |
176 | LYNX - LynxOS |
177 | BSD4 - Any BSD 4.4 system |
178 | UNIX - Any UNIX BSD/SYSV system |
179 | */ |
180 | |
181 | #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__)) |
182 | # define Q_OS_DARWIN |
183 | # define Q_OS_BSD4 |
184 | # ifdef __LP64__ |
185 | # define Q_OS_DARWIN64 |
186 | # else |
187 | # define Q_OS_DARWIN32 |
188 | # endif |
189 | #elif defined(__SYMBIAN32__) || defined(SYMBIAN) |
190 | # define Q_OS_SYMBIAN |
191 | # define Q_NO_POSIX_SIGNALS |
192 | # define QT_NO_GETIFADDRS |
193 | #elif defined(__CYGWIN__) |
194 | # define Q_OS_CYGWIN |
195 | #elif defined(MSDOS) || defined(_MSDOS) |
196 | # define Q_OS_MSDOS |
197 | #elif defined(__OS2__) |
198 | # if defined(__EMX__) |
199 | # define Q_OS_OS2EMX |
200 | # else |
201 | # define Q_OS_OS2 |
202 | # endif |
203 | #elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) |
204 | # define Q_OS_WIN32 |
205 | # define Q_OS_WIN64 |
206 | #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) |
207 | # if defined(WINCE) || defined(_WIN32_WCE) |
208 | # define Q_OS_WINCE |
209 | # else |
210 | # define Q_OS_WIN32 |
211 | # endif |
212 | #elif defined(__MWERKS__) && defined(__INTEL__) |
213 | # define Q_OS_WIN32 |
214 | #elif defined(__sun) || defined(sun) |
215 | # define Q_OS_SOLARIS |
216 | #elif defined(hpux) || defined(__hpux) |
217 | # define Q_OS_HPUX |
218 | #elif defined(__ultrix) || defined(ultrix) |
219 | # define Q_OS_ULTRIX |
220 | #elif defined(sinix) |
221 | # define Q_OS_RELIANT |
222 | #elif defined(__native_client__) |
223 | # define Q_OS_NACL |
224 | #elif defined(__linux__) || defined(__linux) |
225 | # define Q_OS_LINUX |
226 | #elif defined(__FreeBSD__) || defined(__DragonFly__) |
227 | # define Q_OS_FREEBSD |
228 | # define Q_OS_BSD4 |
229 | #elif defined(__NetBSD__) |
230 | # define Q_OS_NETBSD |
231 | # define Q_OS_BSD4 |
232 | #elif defined(__OpenBSD__) |
233 | # define Q_OS_OPENBSD |
234 | # define Q_OS_BSD4 |
235 | #elif defined(__bsdi__) |
236 | # define Q_OS_BSDI |
237 | # define Q_OS_BSD4 |
238 | #elif defined(__sgi) |
239 | # define Q_OS_IRIX |
240 | #elif defined(__osf__) |
241 | # define Q_OS_OSF |
242 | #elif defined(_AIX) |
243 | # define Q_OS_AIX |
244 | #elif defined(__Lynx__) |
245 | # define Q_OS_LYNX |
246 | #elif defined(__GNU__) |
247 | # define Q_OS_HURD |
248 | #elif defined(__DGUX__) |
249 | # define Q_OS_DGUX |
250 | #elif defined(__QNXNTO__) |
251 | # define Q_OS_QNX |
252 | #elif defined(_SEQUENT_) |
253 | # define Q_OS_DYNIX |
254 | #elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ |
255 | # define Q_OS_SCO |
256 | #elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ |
257 | # define Q_OS_UNIXWARE |
258 | #elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ |
259 | # define Q_OS_UNIXWARE |
260 | #elif defined(__INTEGRITY) |
261 | # define Q_OS_INTEGRITY |
262 | #elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ |
263 | # define Q_OS_VXWORKS |
264 | #elif defined(__MAKEDEPEND__) |
265 | #else |
266 | # error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com" |
267 | #endif |
268 | |
269 | #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) |
270 | # define Q_OS_WIN |
271 | #endif |
272 | |
273 | #if defined(Q_OS_DARWIN) |
274 | # define Q_OS_MAC /* Q_OS_MAC is mostly for compatibility, but also more clear */ |
275 | # define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/ |
276 | # if defined(Q_OS_DARWIN64) |
277 | # define Q_OS_MAC64 |
278 | # elif defined(Q_OS_DARWIN32) |
279 | # define Q_OS_MAC32 |
280 | # endif |
281 | #endif |
282 | |
283 | #ifdef QT_AUTODETECT_COCOA |
284 | # ifdef Q_OS_MAC64 |
285 | # define QT_MAC_USE_COCOA 1 |
286 | # define QT_BUILD_KEY QT_BUILD_KEY_COCOA |
287 | # else |
288 | # define QT_BUILD_KEY QT_BUILD_KEY_CARBON |
289 | # endif |
290 | #endif |
291 | |
292 | #if defined(Q_WS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) && !defined(QT_BOOTSTRAPPED) |
293 | #error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration." |
294 | #endif |
295 | |
296 | #if defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN) |
297 | # undef Q_OS_UNIX |
298 | #elif !defined(Q_OS_UNIX) |
299 | # define Q_OS_UNIX |
300 | #endif |
301 | |
302 | #if defined(Q_OS_DARWIN) && !defined(QT_LARGEFILE_SUPPORT) |
303 | # define QT_LARGEFILE_SUPPORT 64 |
304 | #endif |
305 | |
306 | #ifdef Q_OS_DARWIN |
307 | # ifdef MAC_OS_X_VERSION_MIN_REQUIRED |
308 | # undef MAC_OS_X_VERSION_MIN_REQUIRED |
309 | # endif |
310 | # define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4 |
311 | # include <AvailabilityMacros.h> |
312 | # if !defined(MAC_OS_X_VERSION_10_3) |
313 | # define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1 |
314 | # endif |
315 | # if !defined(MAC_OS_X_VERSION_10_4) |
316 | # define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1 |
317 | # endif |
318 | # if !defined(MAC_OS_X_VERSION_10_5) |
319 | # define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1 |
320 | # endif |
321 | # if !defined(MAC_OS_X_VERSION_10_6) |
322 | # define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1 |
323 | # endif |
324 | # if !defined(MAC_OS_X_VERSION_10_7) |
325 | # define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1 |
326 | # endif |
327 | # if !defined(MAC_OS_X_VERSION_10_8) |
328 | # define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1 |
329 | # endif |
330 | # if !defined(MAC_OS_X_VERSION_10_9) |
331 | # define MAC_OS_X_VERSION_10_9 MAC_OS_X_VERSION_10_8 + 1 |
332 | # endif |
333 | #endif |
334 | |
335 | #ifdef __LSB_VERSION__ |
336 | # if __LSB_VERSION__ < 40 |
337 | # error "This version of the Linux Standard Base is unsupported" |
338 | # endif |
339 | #ifndef QT_LINUXBASE |
340 | # define QT_LINUXBASE |
341 | #endif |
342 | #endif |
343 | |
344 | /* |
345 | The compiler, must be one of: (Q_CC_x) |
346 | |
347 | SYM - Digital Mars C/C++ (used to be Symantec C++) |
348 | MWERKS - Metrowerks CodeWarrior |
349 | MSVC - Microsoft Visual C/C++, Intel C++ for Windows |
350 | BOR - Borland/Turbo C++ |
351 | WAT - Watcom C++ |
352 | GNU - GNU C++ |
353 | COMEAU - Comeau C++ |
354 | EDG - Edison Design Group C++ |
355 | OC - CenterLine C++ |
356 | SUN - Forte Developer, or Sun Studio C++ |
357 | MIPS - MIPSpro C++ |
358 | DEC - DEC C++ |
359 | HPACC - HP aC++ |
360 | USLC - SCO OUDK and UDK |
361 | CDS - Reliant C++ |
362 | KAI - KAI C++ |
363 | INTEL - Intel C++ for Linux, Intel C++ for Windows |
364 | HIGHC - MetaWare High C/C++ |
365 | PGI - Portland Group C++ |
366 | GHS - Green Hills Optimizing C++ Compilers |
367 | GCCE - GCCE (Symbian GCCE builds) |
368 | RVCT - ARM Realview Compiler Suite |
369 | NOKIAX86 - Nokia x86 (Symbian WINSCW builds) |
370 | CLANG - C++ front-end for the LLVM compiler |
371 | |
372 | |
373 | Should be sorted most to least authoritative. |
374 | */ |
375 | |
376 | #if defined(__ghs) |
377 | # define Q_OUTOFLINE_TEMPLATE inline |
378 | |
379 | /* the following are necessary because the GHS C++ name mangling relies on __*/ |
380 | # define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \ |
381 | static const int AFUNC ## _init_variable_ = AFUNC(); |
382 | # define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC) |
383 | # define Q_DESTRUCTOR_FUNCTION0(AFUNC) \ |
384 | class AFUNC ## _dest_class_ { \ |
385 | public: \ |
386 | inline AFUNC ## _dest_class_() { } \ |
387 | inline ~ AFUNC ## _dest_class_() { AFUNC(); } \ |
388 | } AFUNC ## _dest_instance_; |
389 | # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC) |
390 | |
391 | #endif |
392 | |
393 | /* Symantec C++ is now Digital Mars */ |
394 | #if defined(__DMC__) || defined(__SC__) |
395 | # define Q_CC_SYM |
396 | /* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */ |
397 | # if defined(__SC__) && __SC__ < 0x750 |
398 | # define Q_NO_EXPLICIT_KEYWORD |
399 | # endif |
400 | # define Q_NO_USING_KEYWORD |
401 | |
402 | #elif defined(__MWERKS__) |
403 | # define Q_CC_MWERKS |
404 | # if defined(__EMU_SYMBIAN_OS__) |
405 | # define Q_CC_NOKIAX86 |
406 | # endif |
407 | /* "explicit" recognized since 4.0d1 */ |
408 | |
409 | #elif defined(_MSC_VER) |
410 | # define Q_CC_MSVC |
411 | # define Q_CC_MSVC_NET |
412 | # define Q_CANNOT_DELETE_CONSTANT |
413 | # define Q_OUTOFLINE_TEMPLATE inline |
414 | # define Q_NO_TEMPLATE_FRIENDS |
415 | # define Q_ALIGNOF(type) __alignof(type) |
416 | # define Q_DECL_ALIGN(n) __declspec(align(n)) |
417 | /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ |
418 | # if defined(__INTEL_COMPILER) |
419 | # define Q_CC_INTEL |
420 | # endif |
421 | /* MSVC does not support SSE/MMX on x64 */ |
422 | # if (defined(Q_CC_MSVC) && defined(_M_X64)) |
423 | # undef QT_HAVE_SSE |
424 | # undef QT_HAVE_MMX |
425 | # undef QT_HAVE_3DNOW |
426 | # endif |
427 | |
428 | #if defined(Q_CC_MSVC) && _MSC_VER >= 1600 |
429 | # define Q_COMPILER_RVALUE_REFS |
430 | # define Q_COMPILER_AUTO_FUNCTION |
431 | # define Q_COMPILER_AUTO_TYPE |
432 | # define Q_COMPILER_LAMBDA |
433 | # define Q_COMPILER_DECLTYPE |
434 | // MSCV has std::initilizer_list, but do not support the braces initialization |
435 | //# define Q_COMPILER_INITIALIZER_LISTS |
436 | # endif |
437 | |
438 | |
439 | #elif defined(__BORLANDC__) || defined(__TURBOC__) |
440 | # define Q_CC_BOR |
441 | # define Q_INLINE_TEMPLATE |
442 | # if __BORLANDC__ < 0x502 |
443 | # define Q_NO_BOOL_TYPE |
444 | # define Q_NO_EXPLICIT_KEYWORD |
445 | # endif |
446 | # define Q_NO_USING_KEYWORD |
447 | |
448 | #elif defined(__WATCOMC__) |
449 | # define Q_CC_WAT |
450 | |
451 | /* Symbian GCCE */ |
452 | #elif defined(__GCCE__) |
453 | # define Q_CC_GCCE |
454 | # define QT_VISIBILITY_AVAILABLE |
455 | # if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) |
456 | # define QT_HAVE_ARMV6 |
457 | # endif |
458 | |
459 | /* ARM Realview Compiler Suite |
460 | RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given), |
461 | so check for it before that */ |
462 | #elif defined(__ARMCC__) || defined(__CC_ARM) |
463 | # define Q_CC_RVCT |
464 | # if __TARGET_ARCH_ARM >= 6 |
465 | # define QT_HAVE_ARMV6 |
466 | # endif |
467 | /* work-around for missing compiler intrinsics */ |
468 | # define __is_empty(X) false |
469 | # define __is_pod(X) false |
470 | #elif defined(__GNUC__) |
471 | # define Q_CC_GNU |
472 | # define Q_C_CALLBACKS |
473 | # if defined(__MINGW32__) |
474 | # define Q_CC_MINGW |
475 | # endif |
476 | # if defined(__INTEL_COMPILER) |
477 | /* Intel C++ also masquerades as GCC 3.2.0 */ |
478 | # define Q_CC_INTEL |
479 | # endif |
480 | # if defined(__clang__) |
481 | /* Clang also masquerades as GCC 4.2.1 */ |
482 | # define Q_CC_CLANG |
483 | # endif |
484 | # ifdef __APPLE__ |
485 | # define Q_NO_DEPRECATED_CONSTRUCTORS |
486 | # endif |
487 | # if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 |
488 | # define Q_FULL_TEMPLATE_INSTANTIATION |
489 | # endif |
490 | /* GCC 2.95 knows "using" but does not support it correctly */ |
491 | # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 |
492 | # define Q_NO_USING_KEYWORD |
493 | # define QT_NO_STL_WCHAR |
494 | # endif |
495 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) |
496 | # define Q_ALIGNOF(type) __alignof__(type) |
497 | # define Q_TYPEOF(expr) __typeof__(expr) |
498 | # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) |
499 | # endif |
500 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) |
501 | # define Q_LIKELY(expr) __builtin_expect(!!(expr), true) |
502 | # define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false) |
503 | # endif |
504 | /* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */ |
505 | # if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1 |
506 | # define Q_WRONG_SB_CTYPE_MACROS |
507 | # endif |
508 | /* GCC <= 3.3 cannot handle template friends */ |
509 | # if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3) |
510 | # define Q_NO_TEMPLATE_FRIENDS |
511 | # endif |
512 | /* Apple's GCC 3.1 chokes on our streaming qDebug() */ |
513 | # if defined(Q_OS_DARWIN) && __GNUC__ == 3 && (__GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 3) |
514 | # define Q_BROKEN_DEBUG_STREAM |
515 | # endif |
516 | # if (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_MOC_CPP) |
517 | # define Q_PACKED __attribute__ ((__packed__)) |
518 | # define Q_NO_PACKED_REFERENCE |
519 | # ifndef __ARM_EABI__ |
520 | # define QT_NO_ARM_EABI |
521 | # endif |
522 | # endif |
523 | # if defined(__GXX_EXPERIMENTAL_CXX0X__) |
524 | # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403 |
525 | /* C++0x features supported in GCC 4.3: */ |
526 | # define Q_COMPILER_RVALUE_REFS |
527 | # define Q_COMPILER_DECLTYPE |
528 | # endif |
529 | # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 |
530 | /* C++0x features supported in GCC 4.4: */ |
531 | # define Q_COMPILER_VARIADIC_TEMPLATES |
532 | # define Q_COMPILER_AUTO_FUNCTION |
533 | # define Q_COMPILER_AUTO_TYPE |
534 | # define Q_COMPILER_EXTERN_TEMPLATES |
535 | # define Q_COMPILER_DEFAULT_DELETE_MEMBERS |
536 | # define Q_COMPILER_CLASS_ENUM |
537 | # define Q_COMPILER_INITIALIZER_LISTS |
538 | # endif |
539 | # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 |
540 | /* C++0x features supported in GCC 4.5: */ |
541 | # define Q_COMPILER_LAMBDA |
542 | # define Q_COMPILER_UNICODE_STRINGS |
543 | # endif |
544 | # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 |
545 | /* C++0x features supported in GCC 4.6: */ |
546 | # define Q_COMPILER_CONSTEXPR |
547 | # endif |
548 | |
549 | # endif |
550 | |
551 | /* IBM compiler versions are a bit messy. There are actually two products: |
552 | the C product, and the C++ product. The C++ compiler is always packaged |
553 | with the latest version of the C compiler. Version numbers do not always |
554 | match. This little table (I'm not sure it's accurate) should be helpful: |
555 | |
556 | C++ product C product |
557 | |
558 | C Set 3.1 C Compiler 3.0 |
559 | ... ... |
560 | C++ Compiler 3.6.6 C Compiler 4.3 |
561 | ... ... |
562 | Visual Age C++ 4.0 ... |
563 | ... ... |
564 | Visual Age C++ 5.0 C Compiler 5.0 |
565 | ... ... |
566 | Visual Age C++ 6.0 C Compiler 6.0 |
567 | |
568 | Now: |
569 | __xlC__ is the version of the C compiler in hexadecimal notation |
570 | is only an approximation of the C++ compiler version |
571 | __IBMCPP__ is the version of the C++ compiler in decimal notation |
572 | but it is not defined on older compilers like C Set 3.1 */ |
573 | #elif defined(__xlC__) |
574 | # define Q_CC_XLC |
575 | # define Q_FULL_TEMPLATE_INSTANTIATION |
576 | # if __xlC__ < 0x400 |
577 | # define Q_NO_BOOL_TYPE |
578 | # define Q_NO_EXPLICIT_KEYWORD |
579 | # define Q_NO_USING_KEYWORD |
580 | # define Q_TYPENAME |
581 | # define Q_OUTOFLINE_TEMPLATE inline |
582 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
583 | # define Q_CANNOT_DELETE_CONSTANT |
584 | # elif __xlC__ >= 0x0600 |
585 | # define Q_ALIGNOF(type) __alignof__(type) |
586 | # define Q_TYPEOF(expr) __typeof__(expr) |
587 | # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) |
588 | # define Q_PACKED __attribute__((__packed__)) |
589 | # endif |
590 | |
591 | /* Older versions of DEC C++ do not define __EDG__ or __EDG - observed |
592 | on DEC C++ V5.5-004. New versions do define __EDG__ - observed on |
593 | Compaq C++ V6.3-002. |
594 | This compiler is different enough from other EDG compilers to handle |
595 | it separately anyway. */ |
596 | #elif defined(__DECCXX) || defined(__DECC) |
597 | # define Q_CC_DEC |
598 | /* Compaq C++ V6 compilers are EDG-based but I'm not sure about older |
599 | DEC C++ V5 compilers. */ |
600 | # if defined(__EDG__) |
601 | # define Q_CC_EDG |
602 | # endif |
603 | /* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead |
604 | - observed on Compaq C++ V6.3-002. |
605 | In any case versions prior to Compaq C++ V6.0-005 do not have bool. */ |
606 | # if !defined(_BOOL_EXISTS) |
607 | # define Q_NO_BOOL_TYPE |
608 | # endif |
609 | /* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ |
610 | # define Q_NO_USING_KEYWORD |
611 | /* Apply to all versions prior to Compaq C++ V6.0-000 - observed on |
612 | DEC C++ V5.5-004. */ |
613 | # if __DECCXX_VER < 60060000 |
614 | # define Q_TYPENAME |
615 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
616 | # define Q_CANNOT_DELETE_CONSTANT |
617 | # endif |
618 | /* avoid undefined symbol problems with out-of-line template members */ |
619 | # define Q_OUTOFLINE_TEMPLATE inline |
620 | |
621 | /* The Portland Group C++ compiler is based on EDG and does define __EDG__ |
622 | but the C compiler does not */ |
623 | #elif defined(__PGI) |
624 | # define Q_CC_PGI |
625 | # if defined(__EDG__) |
626 | # define Q_CC_EDG |
627 | # endif |
628 | |
629 | /* Compilers with EDG front end are similar. To detect them we test: |
630 | __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b |
631 | __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 |
632 | and PGI C++ 5.2-4 */ |
633 | #elif !defined(Q_OS_HPUX) && (defined(__EDG) || defined(__EDG__)) |
634 | # define Q_CC_EDG |
635 | /* From the EDG documentation (does not seem to apply to Compaq C++): |
636 | _BOOL |
637 | Defined in C++ mode when bool is a keyword. The name of this |
638 | predefined macro is specified by a configuration flag. _BOOL |
639 | is the default. |
640 | __BOOL_DEFINED |
641 | Defined in Microsoft C++ mode when bool is a keyword. */ |
642 | # if !defined(_BOOL) && !defined(__BOOL_DEFINED) |
643 | # define Q_NO_BOOL_TYPE |
644 | # endif |
645 | |
646 | /* The Comeau compiler is based on EDG and does define __EDG__ */ |
647 | # if defined(__COMO__) |
648 | # define Q_CC_COMEAU |
649 | # define Q_C_CALLBACKS |
650 | |
651 | /* The `using' keyword was introduced to avoid KAI C++ warnings |
652 | but it's now causing KAI C++ errors instead. The standard is |
653 | unclear about the use of this keyword, and in practice every |
654 | compiler is using its own set of rules. Forget it. */ |
655 | # elif defined(__KCC) |
656 | # define Q_CC_KAI |
657 | # define Q_NO_USING_KEYWORD |
658 | |
659 | /* Using the `using' keyword avoids Intel C++ for Linux warnings */ |
660 | # elif defined(__INTEL_COMPILER) |
661 | # define Q_CC_INTEL |
662 | |
663 | /* Uses CFront, make sure to read the manual how to tweak templates. */ |
664 | # elif defined(__ghs) |
665 | # define Q_CC_GHS |
666 | |
667 | # elif defined(__DCC__) |
668 | # define Q_CC_DIAB |
669 | # undef Q_NO_BOOL_TYPE |
670 | # if !defined(__bool) |
671 | # define Q_NO_BOOL_TYPE |
672 | # endif |
673 | |
674 | /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ |
675 | # elif defined(__USLC__) && defined(__SCO_VERSION__) |
676 | # define Q_CC_USLC |
677 | /* The latest UDK 7.1.1b does not need this, but previous versions do */ |
678 | # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) |
679 | # define Q_OUTOFLINE_TEMPLATE inline |
680 | # endif |
681 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
682 | |
683 | /* Never tested! */ |
684 | # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) |
685 | # define Q_CC_OC |
686 | # define Q_NO_USING_KEYWORD |
687 | |
688 | /* CDS++ defines __EDG__ although this is not documented in the Reliant |
689 | documentation. It also follows conventions like _BOOL and this documented */ |
690 | # elif defined(sinix) |
691 | # define Q_CC_CDS |
692 | # define Q_NO_USING_KEYWORD |
693 | |
694 | /* The MIPSpro compiler defines __EDG */ |
695 | # elif defined(__sgi) |
696 | # define Q_CC_MIPS |
697 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
698 | # define Q_NO_TEMPLATE_FRIENDS |
699 | # if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740) |
700 | # define Q_OUTOFLINE_TEMPLATE inline |
701 | # pragma set woff 3624,3625,3649 /* turn off some harmless warnings */ |
702 | # endif |
703 | # endif |
704 | |
705 | /* VxWorks' DIAB toolchain has an additional EDG type C++ compiler |
706 | (see __DCC__ above). This one is for C mode files (__EDG is not defined) */ |
707 | #elif defined(_DIAB_TOOL) |
708 | # define Q_CC_DIAB |
709 | |
710 | /* Never tested! */ |
711 | #elif defined(__HIGHC__) |
712 | # define Q_CC_HIGHC |
713 | |
714 | #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) |
715 | # define Q_CC_SUN |
716 | /* 5.0 compiler or better |
717 | 'bool' is enabled by default but can be disabled using -features=nobool |
718 | in which case _BOOL is not defined |
719 | this is the default in 4.2 compatibility mode triggered by -compat=4 */ |
720 | # if __SUNPRO_CC >= 0x500 |
721 | # if __SUNPRO_CC < 0x590 |
722 | # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS |
723 | /* see http://www.oracle.com/technetwork/systems/cccompare-137792.html */ |
724 | # endif |
725 | # if __SUNPRO_CC >= 0x590 |
726 | # define Q_ALIGNOF(type) __alignof__(type) |
727 | # define Q_TYPEOF(expr) __typeof__(expr) |
728 | # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n))) |
729 | # endif |
730 | # if __SUNPRO_CC >= 0x550 |
731 | # define Q_DECL_EXPORT __global |
732 | # endif |
733 | # if __SUNPRO_CC < 0x5a0 |
734 | # define Q_NO_TEMPLATE_FRIENDS |
735 | # endif |
736 | # if !defined(_BOOL) |
737 | # define Q_NO_BOOL_TYPE |
738 | # endif |
739 | # if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) |
740 | # define Q_NO_USING_KEYWORD |
741 | # endif |
742 | # define Q_C_CALLBACKS |
743 | /* 4.2 compiler or older */ |
744 | # else |
745 | # define Q_NO_BOOL_TYPE |
746 | # define Q_NO_EXPLICIT_KEYWORD |
747 | # define Q_NO_USING_KEYWORD |
748 | # endif |
749 | |
750 | /* CDS++ does not seem to define __EDG__ or __EDG according to Reliant |
751 | documentation but nevertheless uses EDG conventions like _BOOL */ |
752 | #elif defined(sinix) |
753 | # define Q_CC_EDG |
754 | # define Q_CC_CDS |
755 | # if !defined(_BOOL) |
756 | # define Q_NO_BOOL_TYPE |
757 | # endif |
758 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
759 | |
760 | #elif defined(Q_OS_HPUX) |
761 | /* __HP_aCC was not defined in first aCC releases */ |
762 | # if defined(__HP_aCC) || __cplusplus >= 199707L |
763 | # define Q_NO_TEMPLATE_FRIENDS |
764 | # define Q_CC_HPACC |
765 | # if __HP_aCC-0 < 060000 |
766 | # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS |
767 | # define Q_DECL_EXPORT __declspec(dllexport) |
768 | # define Q_DECL_IMPORT __declspec(dllimport) |
769 | # endif |
770 | # if __HP_aCC-0 >= 061200 |
771 | # define Q_DECL_ALIGN(n) __attribute__((aligned(n))) |
772 | # endif |
773 | # if __HP_aCC-0 >= 062000 |
774 | # define Q_DECL_EXPORT __attribute__((visibility("default"))) |
775 | # define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) |
776 | # define Q_DECL_IMPORT Q_DECL_EXPORT |
777 | # endif |
778 | # else |
779 | # define Q_CC_HP |
780 | # define Q_NO_BOOL_TYPE |
781 | # define Q_FULL_TEMPLATE_INSTANTIATION |
782 | # define Q_BROKEN_TEMPLATE_SPECIALIZATION |
783 | # define Q_NO_EXPLICIT_KEYWORD |
784 | # endif |
785 | # define Q_NO_USING_KEYWORD /* ### check "using" status */ |
786 | |
787 | #elif defined(__WINSCW__) && !defined(Q_CC_NOKIAX86) |
788 | # define Q_CC_NOKIAX86 |
789 | |
790 | #else |
791 | # error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com" |
792 | #endif |
793 | |
794 | |
795 | #ifdef Q_CC_INTEL |
796 | # if __INTEL_COMPILER < 1200 |
797 | # define Q_NO_TEMPLATE_FRIENDS |
798 | # endif |
799 | # if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__) |
800 | # if __INTEL_COMPILER >= 1100 |
801 | # define Q_COMPILER_RVALUE_REFS |
802 | # define Q_COMPILER_EXTERN_TEMPLATES |
803 | # define Q_COMPILER_DECLTYPE |
804 | # elif __INTEL_COMPILER >= 1200 |
805 | # define Q_COMPILER_VARIADIC_TEMPLATES |
806 | # define Q_COMPILER_AUTO_TYPE |
807 | # define Q_COMPILER_DEFAULT_DELETE_MEMBERS |
808 | # define Q_COMPILER_CLASS_ENUM |
809 | # define Q_COMPILER_LAMBDA |
810 | # endif |
811 | # endif |
812 | #endif |
813 | |
814 | #ifndef Q_PACKED |
815 | # define Q_PACKED |
816 | # undef Q_NO_PACKED_REFERENCE |
817 | #endif |
818 | |
819 | #ifndef Q_LIKELY |
820 | # define Q_LIKELY(x) (x) |
821 | #endif |
822 | #ifndef Q_UNLIKELY |
823 | # define Q_UNLIKELY(x) (x) |
824 | #endif |
825 | |
826 | #ifndef Q_CONSTRUCTOR_FUNCTION |
827 | # define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \ |
828 | static const int AFUNC ## __init_variable__ = AFUNC(); |
829 | # define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC) |
830 | #endif |
831 | |
832 | #ifndef Q_DESTRUCTOR_FUNCTION |
833 | # define Q_DESTRUCTOR_FUNCTION0(AFUNC) \ |
834 | class AFUNC ## __dest_class__ { \ |
835 | public: \ |
836 | inline AFUNC ## __dest_class__() { } \ |
837 | inline ~ AFUNC ## __dest_class__() { AFUNC(); } \ |
838 | } AFUNC ## __dest_instance__; |
839 | # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC) |
840 | #endif |
841 | |
842 | #ifndef Q_REQUIRED_RESULT |
843 | # if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) |
844 | # define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result)) |
845 | # else |
846 | # define Q_REQUIRED_RESULT |
847 | # endif |
848 | #endif |
849 | |
850 | #ifndef Q_COMPILER_MANGLES_RETURN_TYPE |
851 | # if defined(Q_CC_MSVC) |
852 | # define Q_COMPILER_MANGLES_RETURN_TYPE |
853 | # endif |
854 | #endif |
855 | |
856 | #ifdef __cplusplus |
857 | # if defined(Q_OS_QNX) || defined(Q_OS_BLACKBERRY) |
858 | # include <utility> |
859 | # if defined(_YVALS) || defined(_LIBCPP_VER) |
860 | // QNX: libcpp (Dinkumware-based) doesn't have the <initializer_list> |
861 | // header, so the feature is useless, even if the compiler supports |
862 | // it. Disable. |
863 | # ifdef Q_COMPILER_INITIALIZER_LISTS |
864 | # undef Q_COMPILER_INITIALIZER_LISTS |
865 | # endif |
866 | # endif |
867 | # endif |
868 | #endif |
869 | |
870 | /* |
871 | The window system, must be one of: (Q_WS_x) |
872 | |
873 | MACX - Mac OS X |
874 | MAC9 - Mac OS 9 |
875 | QWS - Qt for Embedded Linux |
876 | WIN32 - Windows |
877 | X11 - X Window System |
878 | S60 - Symbian S60 |
879 | PM - unsupported |
880 | WIN16 - unsupported |
881 | */ |
882 | |
883 | #if defined(Q_OS_MSDOS) |
884 | # define Q_WS_WIN16 |
885 | # error "Qt requires Win32 and does not work with Windows 3.x" |
886 | #elif defined(_WIN32_X11_) |
887 | # define Q_WS_X11 |
888 | #elif defined(Q_OS_WIN32) |
889 | # define Q_WS_WIN32 |
890 | # if defined(Q_OS_WIN64) |
891 | # define Q_WS_WIN64 |
892 | # endif |
893 | #elif defined(Q_OS_WINCE) |
894 | # define Q_WS_WIN32 |
895 | # define Q_WS_WINCE |
896 | # if defined(Q_OS_WINCE_WM) |
897 | # define Q_WS_WINCE_WM |
898 | # endif |
899 | #elif defined(Q_OS_OS2) |
900 | # define Q_WS_PM |
901 | # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" |
902 | #elif defined(Q_OS_UNIX) |
903 | # if defined(Q_OS_MAC) && !defined(__USE_WS_X11__) && !defined(Q_WS_QWS) && !defined(Q_WS_QPA) |
904 | # define Q_WS_MAC |
905 | # define Q_WS_MACX |
906 | # if defined(Q_OS_MAC64) |
907 | # define Q_WS_MAC64 |
908 | # elif defined(Q_OS_MAC32) |
909 | # define Q_WS_MAC32 |
910 | # endif |
911 | # elif defined(Q_OS_SYMBIAN) |
912 | # if !defined(QT_NO_S60) |
913 | # define Q_WS_S60 |
914 | # endif |
915 | # elif !defined(Q_WS_QWS) && !defined(Q_WS_QPA) |
916 | # define Q_WS_X11 |
917 | # endif |
918 | #endif |
919 | |
920 | #if defined(Q_WS_WIN16) || defined(Q_WS_WIN32) || defined(Q_WS_WINCE) |
921 | # define Q_WS_WIN |
922 | #endif |
923 | |
924 | QT_BEGIN_HEADER |
925 | QT_BEGIN_NAMESPACE |
926 | |
927 | /* |
928 | Size-dependent types (architechture-dependent byte order) |
929 | |
930 | Make sure to update QMetaType when changing these typedefs |
931 | */ |
932 | |
933 | typedef signed char qint8; /* 8 bit signed */ |
934 | typedef unsigned char quint8; /* 8 bit unsigned */ |
935 | typedef short qint16; /* 16 bit signed */ |
936 | typedef unsigned short quint16; /* 16 bit unsigned */ |
937 | typedef int qint32; /* 32 bit signed */ |
938 | typedef unsigned int quint32; /* 32 bit unsigned */ |
939 | #if defined(Q_OS_WIN) && !defined(Q_CC_GNU) && !defined(Q_CC_MWERKS) |
940 | # define Q_INT64_C(c) c ## i64 /* signed 64 bit constant */ |
941 | # define Q_UINT64_C(c) c ## ui64 /* unsigned 64 bit constant */ |
942 | typedef __int64 qint64; /* 64 bit signed */ |
943 | typedef unsigned __int64 quint64; /* 64 bit unsigned */ |
944 | #else |
945 | # define Q_INT64_C(c) static_cast<long long>(c ## LL) /* signed 64 bit constant */ |
946 | # define Q_UINT64_C(c) static_cast<unsigned long long>(c ## ULL) /* unsigned 64 bit constant */ |
947 | typedef long long qint64; /* 64 bit signed */ |
948 | typedef unsigned long long quint64; /* 64 bit unsigned */ |
949 | #endif |
950 | |
951 | typedef qint64 qlonglong; |
952 | typedef quint64 qulonglong; |
953 | |
954 | #ifndef QT_POINTER_SIZE |
955 | # if defined(Q_OS_WIN64) |
956 | # define QT_POINTER_SIZE 8 |
957 | # elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) |
958 | # define QT_POINTER_SIZE 4 |
959 | # endif |
960 | #endif |
961 | |
962 | #define Q_INIT_RESOURCE_EXTERN(name) \ |
963 | extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); |
964 | |
965 | #define Q_INIT_RESOURCE(name) \ |
966 | do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \ |
967 | QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0) |
968 | #define Q_CLEANUP_RESOURCE(name) \ |
969 | do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \ |
970 | QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (0) |
971 | |
972 | #if defined(__cplusplus) |
973 | |
974 | /* |
975 | quintptr and qptrdiff is guaranteed to be the same size as a pointer, i.e. |
976 | |
977 | sizeof(void *) == sizeof(quintptr) |
978 | && sizeof(void *) == sizeof(qptrdiff) |
979 | */ |
980 | template <int> struct QIntegerForSize; |
981 | template <> struct QIntegerForSize<1> { typedef quint8 Unsigned; typedef qint8 Signed; }; |
982 | template <> struct QIntegerForSize<2> { typedef quint16 Unsigned; typedef qint16 Signed; }; |
983 | template <> struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; }; |
984 | template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; }; |
985 | template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { }; |
986 | typedef QIntegerForSizeof<void*>::Unsigned quintptr; |
987 | typedef QIntegerForSizeof<void*>::Signed qptrdiff; |
988 | |
989 | /* |
990 | Useful type definitions for Qt |
991 | */ |
992 | |
993 | QT_BEGIN_INCLUDE_NAMESPACE |
994 | typedef unsigned char uchar; |
995 | typedef unsigned short ushort; |
996 | typedef unsigned int uint; |
997 | typedef unsigned long ulong; |
998 | QT_END_INCLUDE_NAMESPACE |
999 | |
1000 | #if defined(Q_NO_BOOL_TYPE) |
1001 | #error "Compiler doesn't support the bool type" |
1002 | #endif |
1003 | |
1004 | /* |
1005 | Constant bool values |
1006 | */ |
1007 | |
1008 | #ifndef QT_LINUXBASE /* the LSB defines TRUE and FALSE for us */ |
1009 | /* Symbian OS defines TRUE = 1 and FALSE = 0, |
1010 | redefine to built-in booleans to make autotests work properly */ |
1011 | #ifdef Q_OS_SYMBIAN |
1012 | #include <e32def.h> /* Symbian OS defines */ |
1013 | |
1014 | #undef TRUE |
1015 | #undef FALSE |
1016 | #endif |
1017 | # ifndef TRUE |
1018 | # define TRUE true |
1019 | # define FALSE false |
1020 | # endif |
1021 | #endif |
1022 | |
1023 | /* |
1024 | Proper for-scoping in MIPSpro CC |
1025 | */ |
1026 | #ifndef QT_NO_KEYWORDS |
1027 | # if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64)) |
1028 | # define for if(0){}else for |
1029 | # endif |
1030 | #endif |
1031 | |
1032 | /* |
1033 | Workaround for static const members on MSVC++. |
1034 | */ |
1035 | |
1036 | #if defined(Q_CC_MSVC) |
1037 | # define QT_STATIC_CONST static |
1038 | # define QT_STATIC_CONST_IMPL |
1039 | #else |
1040 | # define QT_STATIC_CONST static const |
1041 | # define QT_STATIC_CONST_IMPL const |
1042 | #endif |
1043 | |
1044 | /* |
1045 | Warnings and errors when using deprecated methods |
1046 | */ |
1047 | #if defined(Q_MOC_RUN) |
1048 | # define Q_DECL_DEPRECATED Q_DECL_DEPRECATED |
1049 | #elif (defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2))) || defined(Q_CC_RVCT) |
1050 | # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__)) |
1051 | #elif defined(Q_CC_MSVC) |
1052 | # define Q_DECL_DEPRECATED __declspec(deprecated) |
1053 | # if defined (Q_CC_INTEL) |
1054 | # define Q_DECL_VARIABLE_DEPRECATED |
1055 | # else |
1056 | # endif |
1057 | #else |
1058 | # define Q_DECL_DEPRECATED |
1059 | #endif |
1060 | #ifndef Q_DECL_VARIABLE_DEPRECATED |
1061 | # define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED |
1062 | #endif |
1063 | #ifndef Q_DECL_CONSTRUCTOR_DEPRECATED |
1064 | # if defined(Q_MOC_RUN) |
1065 | # define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED |
1066 | # elif defined(Q_NO_DEPRECATED_CONSTRUCTORS) |
1067 | # define Q_DECL_CONSTRUCTOR_DEPRECATED |
1068 | # else |
1069 | # define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_DEPRECATED |
1070 | # endif |
1071 | #endif |
1072 | |
1073 | #if defined(QT_NO_DEPRECATED) |
1074 | /* disable Qt3 support as well */ |
1075 | # undef QT3_SUPPORT_WARNINGS |
1076 | # undef QT3_SUPPORT |
1077 | # undef QT_DEPRECATED |
1078 | # undef QT_DEPRECATED_VARIABLE |
1079 | # undef QT_DEPRECATED_CONSTRUCTOR |
1080 | #elif defined(QT_DEPRECATED_WARNINGS) |
1081 | # ifdef QT3_SUPPORT |
1082 | /* enable Qt3 support warnings as well */ |
1083 | # undef QT3_SUPPORT_WARNINGS |
1084 | # define QT3_SUPPORT_WARNINGS |
1085 | # endif |
1086 | # undef QT_DEPRECATED |
1087 | # define QT_DEPRECATED Q_DECL_DEPRECATED |
1088 | # undef QT_DEPRECATED_VARIABLE |
1089 | # define QT_DEPRECATED_VARIABLE Q_DECL_VARIABLE_DEPRECATED |
1090 | # undef QT_DEPRECATED_CONSTRUCTOR |
1091 | # define QT_DEPRECATED_CONSTRUCTOR explicit Q_DECL_CONSTRUCTOR_DEPRECATED |
1092 | #else |
1093 | # undef QT_DEPRECATED |
1094 | # define QT_DEPRECATED |
1095 | # undef QT_DEPRECATED_VARIABLE |
1096 | # define QT_DEPRECATED_VARIABLE |
1097 | # undef QT_DEPRECATED_CONSTRUCTOR |
1098 | # define QT_DEPRECATED_CONSTRUCTOR |
1099 | #endif |
1100 | |
1101 | #if defined(QT3_SUPPORT_WARNINGS) |
1102 | # if !defined(QT_COMPAT_WARNINGS) /* also enable compat */ |
1103 | # define QT_COMPAT_WARNINGS |
1104 | # endif |
1105 | # undef QT3_SUPPORT |
1106 | # define QT3_SUPPORT Q_DECL_DEPRECATED |
1107 | # undef QT3_SUPPORT_VARIABLE |
1108 | # define QT3_SUPPORT_VARIABLE Q_DECL_VARIABLE_DEPRECATED |
1109 | # undef QT3_SUPPORT_CONSTRUCTOR |
1110 | # define QT3_SUPPORT_CONSTRUCTOR explicit Q_DECL_CONSTRUCTOR_DEPRECATED |
1111 | #elif defined(QT3_SUPPORT) /* define back to nothing */ |
1112 | # if !defined(QT_COMPAT) /* also enable qt3 support */ |
1113 | # define QT_COMPAT |
1114 | # endif |
1115 | # undef QT3_SUPPORT |
1116 | # define QT3_SUPPORT |
1117 | # undef QT3_SUPPORT_VARIABLE |
1118 | # define QT3_SUPPORT_VARIABLE |
1119 | # undef QT3_SUPPORT_CONSTRUCTOR |
1120 | # define QT3_SUPPORT_CONSTRUCTOR explicit |
1121 | #endif |
1122 | |
1123 | /* moc compats (signals/slots) */ |
1124 | #ifndef QT_MOC_COMPAT |
1125 | # if defined(QT3_SUPPORT) |
1126 | # define QT_MOC_COMPAT QT3_SUPPORT |
1127 | # else |
1128 | # define QT_MOC_COMPAT |
1129 | # endif |
1130 | #else |
1131 | # undef QT_MOC_COMPAT |
1132 | # define QT_MOC_COMPAT |
1133 | #endif |
1134 | |
1135 | #ifdef QT_ASCII_CAST_WARNINGS |
1136 | # define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED |
1137 | # if defined(Q_CC_GNU) && __GNUC__ < 4 |
1138 | /* gcc < 4 doesn't like Q_DECL_DEPRECATED in front of constructors */ |
1139 | # define QT_ASCII_CAST_WARN_CONSTRUCTOR |
1140 | # else |
1141 | # define QT_ASCII_CAST_WARN_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED |
1142 | # endif |
1143 | #else |
1144 | # define QT_ASCII_CAST_WARN |
1145 | # define QT_ASCII_CAST_WARN_CONSTRUCTOR |
1146 | #endif |
1147 | |
1148 | #if defined(__i386__) || defined(_WIN32) || defined(_WIN32_WCE) |
1149 | # if defined(Q_CC_GNU) |
1150 | #if !defined(Q_CC_INTEL) && ((100*(__GNUC__ - 0) + 10*(__GNUC_MINOR__ - 0) + __GNUC_PATCHLEVEL__) >= 332) |
1151 | # define QT_FASTCALL __attribute__((regparm(3))) |
1152 | #else |
1153 | # define QT_FASTCALL |
1154 | #endif |
1155 | # elif defined(Q_CC_MSVC) |
1156 | # define QT_FASTCALL __fastcall |
1157 | # else |
1158 | # define QT_FASTCALL |
1159 | # endif |
1160 | #else |
1161 | # define QT_FASTCALL |
1162 | #endif |
1163 | |
1164 | #ifdef Q_COMPILER_CONSTEXPR |
1165 | # define Q_DECL_CONSTEXPR constexpr |
1166 | #else |
1167 | # define Q_DECL_CONSTEXPR |
1168 | #endif |
1169 | |
1170 | //defines the type for the WNDPROC on windows |
1171 | //the alignment needs to be forced for sse2 to not crash with mingw |
1172 | #if defined(Q_WS_WIN) |
1173 | # if defined(Q_CC_MINGW) |
1174 | # define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer)) |
1175 | # else |
1176 | # define QT_ENSURE_STACK_ALIGNED_FOR_SSE |
1177 | # endif |
1178 | # define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE |
1179 | #endif |
1180 | |
1181 | typedef int QNoImplicitBoolCast; |
1182 | |
1183 | #if defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_MIPS) && (defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_WINCE))) || defined(QT_ARCH_SH) || defined(QT_ARCH_SH4A) |
1184 | #define QT_NO_FPU |
1185 | #endif |
1186 | |
1187 | // This logic must match the one in qmetatype.h |
1188 | #if defined(QT_COORD_TYPE) |
1189 | typedef QT_COORD_TYPE qreal; |
1190 | #elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) |
1191 | typedef float qreal; |
1192 | #else |
1193 | typedef double qreal; |
1194 | #endif |
1195 | |
1196 | /* |
1197 | Utility macros and inline functions |
1198 | */ |
1199 | |
1200 | template <typename T> |
1201 | Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; } |
1202 | |
1203 | Q_DECL_CONSTEXPR inline int qRound(qreal d) |
1204 | { return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); } |
1205 | |
1206 | #if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) |
1207 | Q_DECL_CONSTEXPR inline qint64 qRound64(double d) |
1208 | { return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } |
1209 | #else |
1210 | Q_DECL_CONSTEXPR inline qint64 qRound64(qreal d) |
1211 | { return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); } |
1212 | #endif |
1213 | |
1214 | template <typename T> |
1215 | Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; } |
1216 | template <typename T> |
1217 | Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; } |
1218 | template <typename T> |
1219 | Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max) |
1220 | { return qMax(min, qMin(max, val)); } |
1221 | |
1222 | #ifdef QT3_SUPPORT |
1223 | typedef qint8 Q_INT8; |
1224 | typedef quint8 Q_UINT8; |
1225 | typedef qint16 Q_INT16; |
1226 | typedef quint16 Q_UINT16; |
1227 | typedef qint32 Q_INT32; |
1228 | typedef quint32 Q_UINT32; |
1229 | typedef qint64 Q_INT64; |
1230 | typedef quint64 Q_UINT64; |
1231 | |
1232 | typedef qint64 Q_LLONG; |
1233 | typedef quint64 Q_ULLONG; |
1234 | #if defined(Q_OS_WIN64) |
1235 | typedef __int64 Q_LONG; /* word up to 64 bit signed */ |
1236 | typedef unsigned __int64 Q_ULONG; /* word up to 64 bit unsigned */ |
1237 | #else |
1238 | typedef long Q_LONG; /* word up to 64 bit signed */ |
1239 | typedef unsigned long Q_ULONG; /* word up to 64 bit unsigned */ |
1240 | #endif |
1241 | |
1242 | # define QABS(a) qAbs(a) |
1243 | # define QMAX(a, b) qMax((a), (b)) |
1244 | # define QMIN(a, b) qMin((a), (b)) |
1245 | #endif |
1246 | |
1247 | /* |
1248 | Data stream functions are provided by many classes (defined in qdatastream.h) |
1249 | */ |
1250 | |
1251 | class QDataStream; |
1252 | |
1253 | #ifndef QT_BUILD_KEY |
1254 | #define QT_BUILD_KEY "unspecified" |
1255 | #endif |
1256 | |
1257 | #if defined(Q_WS_MAC) |
1258 | # ifndef QMAC_QMENUBAR_NO_EVENT |
1259 | # define QMAC_QMENUBAR_NO_EVENT |
1260 | # endif |
1261 | #endif |
1262 | |
1263 | #if !defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1264 | # define QT_NO_COP |
1265 | #endif |
1266 | |
1267 | #if defined(Q_OS_VXWORKS) |
1268 | # define QT_NO_CRASHHANDLER // no popen |
1269 | # define QT_NO_PROCESS // no exec*, no fork |
1270 | # define QT_NO_LPR |
1271 | # define QT_NO_SHAREDMEMORY // only POSIX, no SysV and in the end... |
1272 | # define QT_NO_SYSTEMSEMAPHORE // not needed at all in a flat address space |
1273 | # define QT_NO_QWS_MULTIPROCESS // no processes |
1274 | #endif |
1275 | |
1276 | # include <QtCore/qfeatures.h> |
1277 | |
1278 | #define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) |
1279 | |
1280 | #if defined(Q_OS_LINUX) && defined(Q_CC_RVCT) |
1281 | # define Q_DECL_EXPORT __attribute__((visibility("default"))) |
1282 | # define Q_DECL_IMPORT __attribute__((visibility("default"))) |
1283 | # define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) |
1284 | #endif |
1285 | |
1286 | #ifndef Q_DECL_EXPORT |
1287 | # if defined(Q_OS_WIN) || defined(Q_CC_NOKIAX86) || defined(Q_CC_RVCT) |
1288 | # define Q_DECL_EXPORT __declspec(dllexport) |
1289 | # elif defined(QT_VISIBILITY_AVAILABLE) |
1290 | # define Q_DECL_EXPORT __attribute__((visibility("default"))) |
1291 | # define Q_DECL_HIDDEN __attribute__((visibility("hidden"))) |
1292 | # endif |
1293 | # ifndef Q_DECL_EXPORT |
1294 | # define Q_DECL_EXPORT |
1295 | # endif |
1296 | #endif |
1297 | #ifndef Q_DECL_IMPORT |
1298 | # if defined(Q_OS_WIN) || defined(Q_CC_NOKIAX86) || defined(Q_CC_RVCT) |
1299 | # define Q_DECL_IMPORT __declspec(dllimport) |
1300 | # else |
1301 | # define Q_DECL_IMPORT |
1302 | # endif |
1303 | #endif |
1304 | #ifndef Q_DECL_HIDDEN |
1305 | # define Q_DECL_HIDDEN |
1306 | #endif |
1307 | |
1308 | |
1309 | /* |
1310 | Create Qt DLL if QT_DLL is defined (Windows and Symbian only) |
1311 | */ |
1312 | |
1313 | #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) |
1314 | # if defined(QT_NODLL) |
1315 | # undef QT_MAKEDLL |
1316 | # undef QT_DLL |
1317 | # elif defined(QT_MAKEDLL) /* create a Qt DLL library */ |
1318 | # if defined(QT_DLL) |
1319 | # undef QT_DLL |
1320 | # endif |
1321 | # if defined(QT_BUILD_CORE_LIB) |
1322 | # define Q_CORE_EXPORT Q_DECL_EXPORT |
1323 | # else |
1324 | # define Q_CORE_EXPORT Q_DECL_IMPORT |
1325 | # endif |
1326 | # if defined(QT_BUILD_GUI_LIB) |
1327 | # define Q_GUI_EXPORT Q_DECL_EXPORT |
1328 | # else |
1329 | # define Q_GUI_EXPORT Q_DECL_IMPORT |
1330 | # endif |
1331 | # if defined(QT_BUILD_SQL_LIB) |
1332 | # define Q_SQL_EXPORT Q_DECL_EXPORT |
1333 | # else |
1334 | # define Q_SQL_EXPORT Q_DECL_IMPORT |
1335 | # endif |
1336 | # if defined(QT_BUILD_NETWORK_LIB) |
1337 | # define Q_NETWORK_EXPORT Q_DECL_EXPORT |
1338 | # else |
1339 | # define Q_NETWORK_EXPORT Q_DECL_IMPORT |
1340 | # endif |
1341 | # if defined(QT_BUILD_SVG_LIB) |
1342 | # define Q_SVG_EXPORT Q_DECL_EXPORT |
1343 | # else |
1344 | # define Q_SVG_EXPORT Q_DECL_IMPORT |
1345 | # endif |
1346 | # if defined(QT_BUILD_DECLARATIVE_LIB) |
1347 | # define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT |
1348 | # else |
1349 | # define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT |
1350 | # endif |
1351 | # if defined(QT_BUILD_OPENGL_LIB) |
1352 | # define Q_OPENGL_EXPORT Q_DECL_EXPORT |
1353 | # else |
1354 | # define Q_OPENGL_EXPORT Q_DECL_IMPORT |
1355 | # endif |
1356 | # if defined(QT_BUILD_MULTIMEDIA_LIB) |
1357 | # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT |
1358 | # else |
1359 | # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT |
1360 | # endif |
1361 | # if defined(QT_BUILD_OPENVG_LIB) |
1362 | # define Q_OPENVG_EXPORT Q_DECL_EXPORT |
1363 | # else |
1364 | # define Q_OPENVG_EXPORT Q_DECL_IMPORT |
1365 | # endif |
1366 | # if defined(QT_BUILD_XML_LIB) |
1367 | # define Q_XML_EXPORT Q_DECL_EXPORT |
1368 | # else |
1369 | # define Q_XML_EXPORT Q_DECL_IMPORT |
1370 | # endif |
1371 | # if defined(QT_BUILD_XMLPATTERNS_LIB) |
1372 | # define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT |
1373 | # else |
1374 | # define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT |
1375 | # endif |
1376 | # if defined(QT_BUILD_SCRIPT_LIB) |
1377 | # define Q_SCRIPT_EXPORT Q_DECL_EXPORT |
1378 | # else |
1379 | # define Q_SCRIPT_EXPORT Q_DECL_IMPORT |
1380 | # endif |
1381 | # if defined(QT_BUILD_SCRIPTTOOLS_LIB) |
1382 | # define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT |
1383 | # else |
1384 | # define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT |
1385 | # endif |
1386 | # if defined(QT_BUILD_CANVAS_LIB) |
1387 | # define Q_CANVAS_EXPORT Q_DECL_EXPORT |
1388 | # else |
1389 | # define Q_CANVAS_EXPORT Q_DECL_IMPORT |
1390 | # endif |
1391 | # if defined(QT_BUILD_COMPAT_LIB) |
1392 | # define Q_COMPAT_EXPORT Q_DECL_EXPORT |
1393 | # else |
1394 | # define Q_COMPAT_EXPORT Q_DECL_IMPORT |
1395 | # endif |
1396 | # if defined(QT_BUILD_DBUS_LIB) |
1397 | # define Q_DBUS_EXPORT Q_DECL_EXPORT |
1398 | # else |
1399 | # define Q_DBUS_EXPORT Q_DECL_IMPORT |
1400 | # endif |
1401 | # define Q_TEMPLATEDLL |
1402 | # elif defined(QT_DLL) /* use a Qt DLL library */ |
1403 | # define Q_CORE_EXPORT Q_DECL_IMPORT |
1404 | # define Q_GUI_EXPORT Q_DECL_IMPORT |
1405 | # define Q_SQL_EXPORT Q_DECL_IMPORT |
1406 | # define Q_NETWORK_EXPORT Q_DECL_IMPORT |
1407 | # define Q_SVG_EXPORT Q_DECL_IMPORT |
1408 | # define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT |
1409 | # define Q_CANVAS_EXPORT Q_DECL_IMPORT |
1410 | # define Q_OPENGL_EXPORT Q_DECL_IMPORT |
1411 | # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT |
1412 | # define Q_OPENVG_EXPORT Q_DECL_IMPORT |
1413 | # define Q_XML_EXPORT Q_DECL_IMPORT |
1414 | # define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT |
1415 | # define Q_SCRIPT_EXPORT Q_DECL_IMPORT |
1416 | # define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT |
1417 | # define Q_COMPAT_EXPORT Q_DECL_IMPORT |
1418 | # define Q_DBUS_EXPORT Q_DECL_IMPORT |
1419 | # define Q_TEMPLATEDLL |
1420 | # endif |
1421 | # define Q_NO_DECLARED_NOT_DEFINED |
1422 | #else |
1423 | # if defined(Q_OS_LINUX) && defined(Q_CC_BOR) |
1424 | # define Q_TEMPLATEDLL |
1425 | # define Q_NO_DECLARED_NOT_DEFINED |
1426 | # endif |
1427 | # undef QT_MAKEDLL /* ignore these for other platforms */ |
1428 | # undef QT_DLL |
1429 | #endif |
1430 | |
1431 | #if !defined(Q_CORE_EXPORT) |
1432 | # if defined(QT_SHARED) |
1433 | # define Q_CORE_EXPORT Q_DECL_EXPORT |
1434 | # define Q_GUI_EXPORT Q_DECL_EXPORT |
1435 | # define Q_SQL_EXPORT Q_DECL_EXPORT |
1436 | # define Q_NETWORK_EXPORT Q_DECL_EXPORT |
1437 | # define Q_SVG_EXPORT Q_DECL_EXPORT |
1438 | # define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT |
1439 | # define Q_OPENGL_EXPORT Q_DECL_EXPORT |
1440 | # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT |
1441 | # define Q_OPENVG_EXPORT Q_DECL_EXPORT |
1442 | # define Q_XML_EXPORT Q_DECL_EXPORT |
1443 | # define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT |
1444 | # define Q_SCRIPT_EXPORT Q_DECL_EXPORT |
1445 | # define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT |
1446 | # define Q_COMPAT_EXPORT Q_DECL_EXPORT |
1447 | # define Q_DBUS_EXPORT Q_DECL_EXPORT |
1448 | # else |
1449 | # define Q_CORE_EXPORT |
1450 | # define Q_GUI_EXPORT |
1451 | # define Q_SQL_EXPORT |
1452 | # define Q_NETWORK_EXPORT |
1453 | # define Q_SVG_EXPORT |
1454 | # define Q_DECLARATIVE_EXPORT |
1455 | # define Q_OPENGL_EXPORT |
1456 | # define Q_MULTIMEDIA_EXPORT |
1457 | # define Q_OPENVG_EXPORT |
1458 | # define Q_XML_EXPORT |
1459 | # define Q_XMLPATTERNS_EXPORT |
1460 | # define Q_SCRIPT_EXPORT |
1461 | # define Q_SCRIPTTOOLS_EXPORT |
1462 | # define Q_COMPAT_EXPORT |
1463 | # define Q_DBUS_EXPORT |
1464 | # endif |
1465 | #endif |
1466 | |
1467 | // Functions marked as Q_GUI_EXPORT_INLINE were exported and inlined by mistake. |
1468 | // Compilers like MinGW complain that the import attribute is ignored. |
1469 | #if defined(Q_CC_MINGW) |
1470 | # if defined(QT_BUILD_CORE_LIB) |
1471 | # define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline |
1472 | # else |
1473 | # define Q_CORE_EXPORT_INLINE inline |
1474 | # endif |
1475 | # if defined(QT_BUILD_GUI_LIB) |
1476 | # define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline |
1477 | # else |
1478 | # define Q_GUI_EXPORT_INLINE inline |
1479 | # endif |
1480 | # if defined(QT_BUILD_COMPAT_LIB) |
1481 | # define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline |
1482 | # else |
1483 | # define Q_COMPAT_EXPORT_INLINE inline |
1484 | # endif |
1485 | #elif defined(Q_CC_RVCT) |
1486 | // we force RVCT not to export inlines by passing --visibility_inlines_hidden |
1487 | // so we need to just inline it, rather than exporting and inlining |
1488 | // note: this affects the contents of the DEF files (ie. these functions do not appear) |
1489 | # define Q_CORE_EXPORT_INLINE inline |
1490 | # define Q_GUI_EXPORT_INLINE inline |
1491 | # define Q_COMPAT_EXPORT_INLINE inline |
1492 | #else |
1493 | # define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline |
1494 | # define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline |
1495 | # define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline |
1496 | #endif |
1497 | |
1498 | /* |
1499 | No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols |
1500 | for Qt's internal unit tests. If you want slower loading times and more |
1501 | symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL. |
1502 | */ |
1503 | #if defined(QT_BUILD_INTERNAL) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_MAKEDLL) |
1504 | # define Q_AUTOTEST_EXPORT Q_DECL_EXPORT |
1505 | #elif defined(QT_BUILD_INTERNAL) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_DLL) |
1506 | # define Q_AUTOTEST_EXPORT Q_DECL_IMPORT |
1507 | #elif defined(QT_BUILD_INTERNAL) && !(defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_SHARED) |
1508 | # define Q_AUTOTEST_EXPORT Q_DECL_EXPORT |
1509 | #else |
1510 | # define Q_AUTOTEST_EXPORT |
1511 | #endif |
1512 | |
1513 | inline void qt_noop(void) {} |
1514 | |
1515 | /* These wrap try/catch so we can switch off exceptions later. |
1516 | |
1517 | Beware - do not use more than one QT_CATCH per QT_TRY, and do not use |
1518 | the exception instance in the catch block. |
1519 | If you can't live with those constraints, don't use these macros. |
1520 | Use the QT_NO_EXCEPTIONS macro to protect your code instead. |
1521 | */ |
1522 | |
1523 | #ifdef QT_BOOTSTRAPPED |
1524 | # define QT_NO_EXCEPTIONS |
1525 | #endif |
1526 | #if !defined(QT_NO_EXCEPTIONS) && defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN) |
1527 | # define QT_NO_EXCEPTIONS |
1528 | #endif |
1529 | |
1530 | #ifdef QT_NO_EXCEPTIONS |
1531 | # define QT_TRY if (true) |
1532 | # define QT_CATCH(A) else |
1533 | # define QT_THROW(A) qt_noop() |
1534 | # define QT_RETHROW qt_noop() |
1535 | #else |
1536 | # define QT_TRY try |
1537 | # define QT_CATCH(A) catch (A) |
1538 | # define QT_THROW(A) throw A |
1539 | # define QT_RETHROW throw |
1540 | #endif |
1541 | |
1542 | /* |
1543 | System information |
1544 | */ |
1545 | |
1546 | class QString; |
1547 | class Q_CORE_EXPORT QSysInfo { |
1548 | public: |
1549 | enum Sizes { |
1550 | WordSize = (sizeof(void *)<<3) |
1551 | }; |
1552 | |
1553 | #if defined(QT_BUILD_QMAKE) |
1554 | enum Endian { |
1555 | BigEndian, |
1556 | LittleEndian |
1557 | }; |
1558 | /* needed to bootstrap qmake */ |
1559 | static const int ByteOrder; |
1560 | #elif defined(Q_BYTE_ORDER) |
1561 | enum Endian { |
1562 | BigEndian, |
1563 | LittleEndian |
1564 | |
1565 | # ifdef qdoc |
1566 | , ByteOrder = <platform-dependent> |
1567 | # elif Q_BYTE_ORDER == Q_BIG_ENDIAN |
1568 | , ByteOrder = BigEndian |
1569 | # elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN |
1570 | , ByteOrder = LittleEndian |
1571 | # else |
1572 | # error "Undefined byte order" |
1573 | # endif |
1574 | }; |
1575 | #else |
1576 | # error "Qt not configured correctly, please run configure" |
1577 | #endif |
1578 | #if defined(Q_WS_WIN) || defined(Q_OS_CYGWIN) |
1579 | enum WinVersion { |
1580 | WV_32s = 0x0001, |
1581 | WV_95 = 0x0002, |
1582 | WV_98 = 0x0003, |
1583 | WV_Me = 0x0004, |
1584 | WV_DOS_based= 0x000f, |
1585 | |
1586 | /* codenames */ |
1587 | WV_NT = 0x0010, |
1588 | WV_2000 = 0x0020, |
1589 | WV_XP = 0x0030, |
1590 | WV_2003 = 0x0040, |
1591 | WV_VISTA = 0x0080, |
1592 | WV_WINDOWS7 = 0x0090, |
1593 | WV_WINDOWS8 = 0x00a0, |
1594 | WV_WINDOWS8_1 = 0x00b0, |
1595 | WV_NT_based = 0x00f0, |
1596 | |
1597 | /* version numbers */ |
1598 | WV_4_0 = WV_NT, |
1599 | WV_5_0 = WV_2000, |
1600 | WV_5_1 = WV_XP, |
1601 | WV_5_2 = WV_2003, |
1602 | WV_6_0 = WV_VISTA, |
1603 | WV_6_1 = WV_WINDOWS7, |
1604 | WV_6_2 = WV_WINDOWS8, |
1605 | WV_6_3 = WV_WINDOWS8_1, |
1606 | |
1607 | WV_CE = 0x0100, |
1608 | WV_CENET = 0x0200, |
1609 | WV_CE_5 = 0x0300, |
1610 | WV_CE_6 = 0x0400, |
1611 | WV_CE_based = 0x0f00 |
1612 | }; |
1613 | static const WinVersion WindowsVersion; |
1614 | static WinVersion windowsVersion(); |
1615 | |
1616 | #endif |
1617 | #ifdef Q_OS_MAC |
1618 | enum MacVersion { |
1619 | MV_Unknown = 0x0000, |
1620 | |
1621 | /* version */ |
1622 | MV_9 = 0x0001, |
1623 | MV_10_0 = 0x0002, |
1624 | MV_10_1 = 0x0003, |
1625 | MV_10_2 = 0x0004, |
1626 | MV_10_3 = 0x0005, |
1627 | MV_10_4 = 0x0006, |
1628 | MV_10_5 = 0x0007, |
1629 | MV_10_6 = 0x0008, |
1630 | MV_10_7 = 0x0009, |
1631 | MV_10_8 = 0x000A, |
1632 | MV_10_9 = 0x000B, |
1633 | |
1634 | /* codenames */ |
1635 | MV_CHEETAH = MV_10_0, |
1636 | MV_PUMA = MV_10_1, |
1637 | MV_JAGUAR = MV_10_2, |
1638 | MV_PANTHER = MV_10_3, |
1639 | MV_TIGER = MV_10_4, |
1640 | MV_LEOPARD = MV_10_5, |
1641 | MV_SNOWLEOPARD = MV_10_6, |
1642 | MV_LION = MV_10_7, |
1643 | MV_MOUNTAINLION = MV_10_8, |
1644 | MV_MAVERICKS = MV_10_9 |
1645 | }; |
1646 | static const MacVersion MacintoshVersion; |
1647 | #endif |
1648 | #ifdef Q_OS_SYMBIAN |
1649 | enum SymbianVersion { |
1650 | SV_Unknown = 1000000, // Assume unknown is something newer than what is supported |
1651 | //These are the Symbian Ltd versions 9.2-9.4 |
1652 | SV_9_2 = 10, |
1653 | SV_9_3 = 20, |
1654 | SV_9_4 = 30, |
1655 | //Following values are the symbian foundation versions, i.e. Symbian^1 == SV_SF_1 |
1656 | SV_SF_1 = SV_9_4, |
1657 | SV_SF_2 = 40, |
1658 | SV_SF_3 = 50, |
1659 | SV_SF_4 = 60, // Deprecated |
1660 | SV_API_5_3 = 70, |
1661 | SV_API_5_4 = 80, |
1662 | SV_API_5_5 = 90 |
1663 | }; |
1664 | static SymbianVersion symbianVersion(); |
1665 | enum S60Version { |
1666 | SV_S60_None = 0, |
1667 | SV_S60_Unknown = SV_Unknown, |
1668 | SV_S60_3_1 = SV_9_2, |
1669 | SV_S60_3_2 = SV_9_3, |
1670 | SV_S60_5_0 = SV_9_4, |
1671 | SV_S60_5_1 = SV_SF_2, // Deprecated |
1672 | SV_S60_5_2 = SV_SF_3, |
1673 | SV_S60_5_3 = SV_API_5_3, |
1674 | SV_S60_5_4 = SV_API_5_4, |
1675 | SV_S60_5_5 = SV_API_5_5 |
1676 | }; |
1677 | static S60Version s60Version(); |
1678 | #endif |
1679 | }; |
1680 | |
1681 | Q_CORE_EXPORT const char *qVersion(); |
1682 | Q_CORE_EXPORT bool qSharedBuild(); |
1683 | |
1684 | #if defined(Q_OS_MAC) |
1685 | inline int qMacVersion() { return QSysInfo::MacintoshVersion; } |
1686 | #endif |
1687 | |
1688 | #ifdef QT3_SUPPORT |
1689 | inline QT3_SUPPORT bool qSysInfo(int *wordSize, bool *bigEndian) |
1690 | { |
1691 | *wordSize = QSysInfo::WordSize; |
1692 | *bigEndian = (QSysInfo::ByteOrder == QSysInfo::BigEndian); |
1693 | return true; |
1694 | } |
1695 | #endif |
1696 | |
1697 | #if defined(Q_WS_WIN) || defined(Q_OS_CYGWIN) |
1698 | #if defined(QT3_SUPPORT) |
1699 | inline QT3_SUPPORT bool qt_winUnicode() { return true; } |
1700 | inline QT3_SUPPORT int qWinVersion() { return QSysInfo::WindowsVersion; } |
1701 | #endif |
1702 | |
1703 | // ### Qt 5: remove Win9x support macros QT_WA and QT_WA_INLINE. |
1704 | #define QT_WA(unicode, ansi) unicode |
1705 | #define QT_WA_INLINE(unicode, ansi) (unicode) |
1706 | |
1707 | #endif /* Q_WS_WIN */ |
1708 | |
1709 | #ifndef Q_OUTOFLINE_TEMPLATE |
1710 | # define Q_OUTOFLINE_TEMPLATE |
1711 | #endif |
1712 | #ifndef Q_INLINE_TEMPLATE |
1713 | # define Q_INLINE_TEMPLATE inline |
1714 | #endif |
1715 | |
1716 | #ifndef Q_TYPENAME |
1717 | # define Q_TYPENAME typename |
1718 | #endif |
1719 | |
1720 | /* |
1721 | Avoid "unused parameter" warnings |
1722 | */ |
1723 | |
1724 | #if defined(Q_CC_INTEL) && !defined(Q_OS_WIN) || defined(Q_CC_RVCT) |
1725 | template <typename T> |
1726 | inline void qUnused(T &x) { (void)x; } |
1727 | # define Q_UNUSED(x) qUnused(x); |
1728 | #else |
1729 | # define Q_UNUSED(x) (void)x; |
1730 | #endif |
1731 | |
1732 | /* |
1733 | Debugging and error handling |
1734 | */ |
1735 | |
1736 | /* |
1737 | On Symbian we do not know beforehand whether we are compiling in |
1738 | release or debug mode, so check the Symbian build define here, |
1739 | and set the QT_NO_DEBUG define appropriately. |
1740 | */ |
1741 | #if defined(Q_OS_SYMBIAN) && defined(NDEBUG) && !defined(QT_NO_DEBUG) |
1742 | # define QT_NO_DEBUG |
1743 | #endif |
1744 | |
1745 | #if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG) |
1746 | # define QT_DEBUG |
1747 | #endif |
1748 | |
1749 | #ifndef qPrintable |
1750 | # define qPrintable(string) QString(string).toLocal8Bit().constData() |
1751 | #endif |
1752 | |
1753 | Q_CORE_EXPORT void qDebug(const char *, ...) /* print debug message */ |
1754 | #if defined(Q_CC_GNU) && !defined(__INSURE__) |
1755 | __attribute__ ((format (printf, 1, 2))) |
1756 | #endif |
1757 | ; |
1758 | |
1759 | Q_CORE_EXPORT void qWarning(const char *, ...) /* print warning message */ |
1760 | #if defined(Q_CC_GNU) && !defined(__INSURE__) |
1761 | __attribute__ ((format (printf, 1, 2))) |
1762 | #endif |
1763 | ; |
1764 | |
1765 | class QString; |
1766 | Q_CORE_EXPORT QString qt_error_string(int errorCode = -1); |
1767 | Q_CORE_EXPORT void qCritical(const char *, ...) /* print critical message */ |
1768 | #if defined(Q_CC_GNU) && !defined(__INSURE__) |
1769 | __attribute__ ((format (printf, 1, 2))) |
1770 | #endif |
1771 | ; |
1772 | Q_CORE_EXPORT void qFatal(const char *, ...) /* print fatal message and exit */ |
1773 | #if defined(Q_CC_GNU) && !defined(__INSURE__) |
1774 | __attribute__ ((format (printf, 1, 2))) |
1775 | #endif |
1776 | ; |
1777 | |
1778 | #ifdef QT3_SUPPORT |
1779 | Q_CORE_EXPORT QT3_SUPPORT void qSystemWarning(const char *msg, int code = -1); |
1780 | #endif /* QT3_SUPPORT */ |
1781 | Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...); |
1782 | Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...); |
1783 | |
1784 | #if (defined(QT_NO_DEBUG_OUTPUT) || defined(QT_NO_TEXTSTREAM)) && !defined(QT_NO_DEBUG_STREAM) |
1785 | #define QT_NO_DEBUG_STREAM |
1786 | #endif |
1787 | |
1788 | /* |
1789 | Forward declarations only. |
1790 | |
1791 | In order to use the qDebug() stream, you must #include<QDebug> |
1792 | */ |
1793 | class QDebug; |
1794 | class QNoDebug; |
1795 | #ifndef QT_NO_DEBUG_STREAM |
1796 | Q_CORE_EXPORT_INLINE QDebug qDebug(); |
1797 | #ifndef QT_NO_WARNING_OUTPUT |
1798 | Q_CORE_EXPORT_INLINE QDebug qWarning(); |
1799 | #endif |
1800 | Q_CORE_EXPORT_INLINE QDebug qCritical(); |
1801 | #else |
1802 | inline QNoDebug qDebug(); |
1803 | #endif |
1804 | |
1805 | #ifdef QT_NO_WARNING_OUTPUT |
1806 | inline QNoDebug qWarning(); |
1807 | #endif |
1808 | |
1809 | #define QT_NO_QDEBUG_MACRO while (false) qDebug |
1810 | #ifdef QT_NO_DEBUG_OUTPUT |
1811 | # define qDebug QT_NO_QDEBUG_MACRO |
1812 | #endif |
1813 | #define QT_NO_QWARNING_MACRO while (false) qWarning |
1814 | #ifdef QT_NO_WARNING_OUTPUT |
1815 | # define qWarning QT_NO_QWARNING_MACRO |
1816 | #endif |
1817 | |
1818 | |
1819 | Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line); |
1820 | |
1821 | #if !defined(Q_ASSERT) |
1822 | # ifndef QT_NO_DEBUG |
1823 | # define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop()) |
1824 | # else |
1825 | # define Q_ASSERT(cond) qt_noop() |
1826 | # endif |
1827 | #endif |
1828 | |
1829 | #if defined(QT_NO_DEBUG) && !defined(QT_PAINT_DEBUG) |
1830 | #define QT_NO_PAINT_DEBUG |
1831 | #endif |
1832 | |
1833 | Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line); |
1834 | |
1835 | #if !defined(Q_ASSERT_X) |
1836 | # ifndef QT_NO_DEBUG |
1837 | # define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop()) |
1838 | # else |
1839 | # define Q_ASSERT_X(cond, where, what) qt_noop() |
1840 | # endif |
1841 | #endif |
1842 | |
1843 | Q_CORE_EXPORT void qt_check_pointer(const char *, int); |
1844 | Q_CORE_EXPORT void qBadAlloc(); |
1845 | |
1846 | #ifdef QT_NO_EXCEPTIONS |
1847 | # if defined(QT_NO_DEBUG) |
1848 | # define Q_CHECK_PTR(p) qt_noop() |
1849 | # else |
1850 | # define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0) |
1851 | # endif |
1852 | #else |
1853 | # define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0) |
1854 | #endif |
1855 | |
1856 | template <typename T> |
1857 | inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; } |
1858 | |
1859 | #if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB) |
1860 | # define Q_FUNC_INFO __PRETTY_FUNCTION__ |
1861 | #elif defined(_MSC_VER) |
1862 | # define Q_FUNC_INFO __FUNCSIG__ |
1863 | #else |
1864 | # if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC) || defined(Q_OS_SYMBIAN) || defined(Q_OS_INTEGRITY) |
1865 | # define Q_FUNC_INFO __FILE__ "(line number unavailable)" |
1866 | # else |
1867 | /* These two macros makes it possible to turn the builtin line expander into a |
1868 | * string literal. */ |
1869 | # define QT_STRINGIFY2(x) #x |
1870 | # define QT_STRINGIFY(x) QT_STRINGIFY2(x) |
1871 | # define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__) |
1872 | # endif |
1873 | /* The MIPSpro and RVCT compilers postpones macro expansion, |
1874 | and therefore macros must be in scope when being used. */ |
1875 | # if !defined(Q_CC_MIPS) && !defined(Q_CC_RVCT) && !defined(Q_CC_NOKIAX86) |
1876 | # undef QT_STRINGIFY2 |
1877 | # undef QT_STRINGIFY |
1878 | # endif |
1879 | #endif |
1880 | |
1881 | enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg }; |
1882 | |
1883 | Q_CORE_EXPORT void qt_message_output(QtMsgType, const char *buf); |
1884 | |
1885 | typedef void (*QtMsgHandler)(QtMsgType, const char *); |
1886 | Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler); |
1887 | |
1888 | #ifdef QT3_SUPPORT |
1889 | inline QT3_SUPPORT void qSuppressObsoleteWarnings(bool = true) {} |
1890 | inline QT3_SUPPORT void qObsolete(const char *, const char * = 0, const char * = 0) {} |
1891 | #endif |
1892 | |
1893 | #if defined(QT_NO_THREAD) |
1894 | |
1895 | template <typename T> |
1896 | class QGlobalStatic |
1897 | { |
1898 | public: |
1899 | T *pointer; |
1900 | inline QGlobalStatic(T *p) : pointer(p) { } |
1901 | inline ~QGlobalStatic() { pointer = 0; } |
1902 | }; |
1903 | |
1904 | #define Q_GLOBAL_STATIC(TYPE, NAME) \ |
1905 | static TYPE *NAME() \ |
1906 | { \ |
1907 | static TYPE thisVariable; \ |
1908 | static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \ |
1909 | return thisGlobalStatic.pointer; \ |
1910 | } |
1911 | |
1912 | #define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ |
1913 | static TYPE *NAME() \ |
1914 | { \ |
1915 | static TYPE thisVariable ARGS; \ |
1916 | static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \ |
1917 | return thisGlobalStatic.pointer; \ |
1918 | } |
1919 | |
1920 | #define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \ |
1921 | static TYPE *NAME() \ |
1922 | { \ |
1923 | static TYPE thisVariable; \ |
1924 | static QGlobalStatic<TYPE > thisGlobalStatic(0); \ |
1925 | if (!thisGlobalStatic.pointer) { \ |
1926 | TYPE *x = thisGlobalStatic.pointer = &thisVariable; \ |
1927 | INITIALIZER; \ |
1928 | } \ |
1929 | return thisGlobalStatic.pointer; \ |
1930 | } |
1931 | |
1932 | #else |
1933 | |
1934 | // forward declaration, since qatomic.h needs qglobal.h |
1935 | template <typename T> class QBasicAtomicPointer; |
1936 | |
1937 | // POD for Q_GLOBAL_STATIC |
1938 | template <typename T> |
1939 | class QGlobalStatic |
1940 | { |
1941 | public: |
1942 | QBasicAtomicPointer<T> pointer; |
1943 | bool destroyed; |
1944 | }; |
1945 | |
1946 | // Created as a function-local static to delete a QGlobalStatic<T> |
1947 | template <typename T> |
1948 | class QGlobalStaticDeleter |
1949 | { |
1950 | public: |
1951 | QGlobalStatic<T> &globalStatic; |
1952 | QGlobalStaticDeleter(QGlobalStatic<T> &_globalStatic) |
1953 | : globalStatic(_globalStatic) |
1954 | { } |
1955 | |
1956 | inline ~QGlobalStaticDeleter() |
1957 | { |
1958 | delete globalStatic.pointer; |
1959 | globalStatic.pointer = 0; |
1960 | globalStatic.destroyed = true; |
1961 | } |
1962 | }; |
1963 | |
1964 | #define Q_GLOBAL_STATIC_INIT(TYPE, NAME) \ |
1965 | static QGlobalStatic<TYPE > this_ ## NAME \ |
1966 | = { Q_BASIC_ATOMIC_INITIALIZER(0), false } |
1967 | |
1968 | #define Q_GLOBAL_STATIC(TYPE, NAME) \ |
1969 | static TYPE *NAME() \ |
1970 | { \ |
1971 | Q_GLOBAL_STATIC_INIT(TYPE, _StaticVar_); \ |
1972 | if (!this__StaticVar_.pointer && !this__StaticVar_.destroyed) { \ |
1973 | TYPE *x = new TYPE; \ |
1974 | if (!this__StaticVar_.pointer.testAndSetOrdered(0, x)) \ |
1975 | delete x; \ |
1976 | else \ |
1977 | static QGlobalStaticDeleter<TYPE > cleanup(this__StaticVar_); \ |
1978 | } \ |
1979 | return this__StaticVar_.pointer; \ |
1980 | } |
1981 | |
1982 | #define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ |
1983 | static TYPE *NAME() \ |
1984 | { \ |
1985 | Q_GLOBAL_STATIC_INIT(TYPE, _StaticVar_); \ |
1986 | if (!this__StaticVar_.pointer && !this__StaticVar_.destroyed) { \ |
1987 | TYPE *x = new TYPE ARGS; \ |
1988 | if (!this__StaticVar_.pointer.testAndSetOrdered(0, x)) \ |
1989 | delete x; \ |
1990 | else \ |
1991 | static QGlobalStaticDeleter<TYPE > cleanup(this__StaticVar_); \ |
1992 | } \ |
1993 | return this__StaticVar_.pointer; \ |
1994 | } |
1995 | |
1996 | #define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \ |
1997 | static TYPE *NAME() \ |
1998 | { \ |
1999 | Q_GLOBAL_STATIC_INIT(TYPE, _StaticVar_); \ |
2000 | if (!this__StaticVar_.pointer && !this__StaticVar_.destroyed) { \ |
2001 | QScopedPointer<TYPE > x(new TYPE); \ |
2002 | INITIALIZER; \ |
2003 | if (this__StaticVar_.pointer.testAndSetOrdered(0, x.data())) { \ |
2004 | static QGlobalStaticDeleter<TYPE > cleanup(this__StaticVar_); \ |
2005 | x.take(); \ |
2006 | } \ |
2007 | } \ |
2008 | return this__StaticVar_.pointer; \ |
2009 | } |
2010 | |
2011 | #endif |
2012 | |
2013 | class QBool |
2014 | { |
2015 | bool b; |
2016 | |
2017 | public: |
2018 | inline explicit QBool(bool B) : b(B) {} |
2019 | inline operator const void *() const |
2020 | { return b ? static_cast<const void *>(this) : static_cast<const void *>(0); } |
2021 | }; |
2022 | |
2023 | inline bool operator==(QBool b1, bool b2) { return !b1 == !b2; } |
2024 | inline bool operator==(bool b1, QBool b2) { return !b1 == !b2; } |
2025 | inline bool operator==(QBool b1, QBool b2) { return !b1 == !b2; } |
2026 | inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; } |
2027 | inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; } |
2028 | inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; } |
2029 | |
2030 | Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) |
2031 | { |
2032 | return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2))); |
2033 | } |
2034 | |
2035 | Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) |
2036 | { |
2037 | return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); |
2038 | } |
2039 | |
2040 | /*! |
2041 | \internal |
2042 | */ |
2043 | Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) |
2044 | { |
2045 | return qAbs(d) <= 0.000000000001; |
2046 | } |
2047 | |
2048 | /*! |
2049 | \internal |
2050 | */ |
2051 | Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) |
2052 | { |
2053 | return qAbs(f) <= 0.00001f; |
2054 | } |
2055 | |
2056 | /* |
2057 | This function tests a double for a null value. It doesn't |
2058 | check whether the actual value is 0 or close to 0, but whether |
2059 | it is binary 0. |
2060 | */ |
2061 | static inline bool qIsNull(double d) |
2062 | { |
2063 | union U { |
2064 | double d; |
2065 | quint64 u; |
2066 | }; |
2067 | U val; |
2068 | val.d = d; |
2069 | return val.u == quint64(0); |
2070 | } |
2071 | |
2072 | /* |
2073 | This function tests a float for a null value. It doesn't |
2074 | check whether the actual value is 0 or close to 0, but whether |
2075 | it is binary 0. |
2076 | */ |
2077 | static inline bool qIsNull(float f) |
2078 | { |
2079 | union U { |
2080 | float f; |
2081 | quint32 u; |
2082 | }; |
2083 | U val; |
2084 | val.f = f; |
2085 | return val.u == 0u; |
2086 | } |
2087 | |
2088 | /* |
2089 | Compilers which follow outdated template instantiation rules |
2090 | require a class to have a comparison operator to exist when |
2091 | a QList of this type is instantiated. It's not actually |
2092 | used in the list, though. Hence the dummy implementation. |
2093 | Just in case other code relies on it we better trigger a warning |
2094 | mandating a real implementation. |
2095 | */ |
2096 | |
2097 | #ifdef Q_FULL_TEMPLATE_INSTANTIATION |
2098 | # define Q_DUMMY_COMPARISON_OPERATOR(C) \ |
2099 | bool operator==(const C&) const { \ |
2100 | qWarning(#C"::operator==(const "#C"&) was called"); \ |
2101 | return false; \ |
2102 | } |
2103 | #else |
2104 | # define Q_DUMMY_COMPARISON_OPERATOR(C) |
2105 | #endif |
2106 | |
2107 | |
2108 | /* |
2109 | QTypeInfo - type trait functionality |
2110 | qIsDetached - data sharing functionality |
2111 | */ |
2112 | |
2113 | /* |
2114 | The catch-all template. |
2115 | */ |
2116 | |
2117 | template <typename T> inline bool qIsDetached(T &) { return true; } |
2118 | |
2119 | template <typename T> |
2120 | class QTypeInfo |
2121 | { |
2122 | public: |
2123 | enum { |
2124 | isPointer = false, |
2125 | isComplex = true, |
2126 | isStatic = true, |
2127 | isLarge = (sizeof(T)>sizeof(void*)), |
2128 | isDummy = false |
2129 | }; |
2130 | }; |
2131 | |
2132 | template <typename T> |
2133 | class QTypeInfo<T*> |
2134 | { |
2135 | public: |
2136 | enum { |
2137 | isPointer = true, |
2138 | isComplex = false, |
2139 | isStatic = false, |
2140 | isLarge = false, |
2141 | isDummy = false |
2142 | }; |
2143 | }; |
2144 | |
2145 | /* |
2146 | Specialize a specific type with: |
2147 | |
2148 | Q_DECLARE_TYPEINFO(type, flags); |
2149 | |
2150 | where 'type' is the name of the type to specialize and 'flags' is |
2151 | logically-OR'ed combination of the flags below. |
2152 | */ |
2153 | enum { /* TYPEINFO flags */ |
2154 | Q_COMPLEX_TYPE = 0, |
2155 | Q_PRIMITIVE_TYPE = 0x1, |
2156 | Q_STATIC_TYPE = 0, |
2157 | Q_MOVABLE_TYPE = 0x2, |
2158 | Q_DUMMY_TYPE = 0x4 |
2159 | }; |
2160 | |
2161 | #define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) \ |
2162 | class QTypeInfo<TYPE > \ |
2163 | { \ |
2164 | public: \ |
2165 | enum { \ |
2166 | isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0), \ |
2167 | isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \ |
2168 | isLarge = (sizeof(TYPE)>sizeof(void*)), \ |
2169 | isPointer = false, \ |
2170 | isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0) \ |
2171 | }; \ |
2172 | static inline const char *name() { return #TYPE; } \ |
2173 | } |
2174 | |
2175 | #define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \ |
2176 | template<> \ |
2177 | Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) |
2178 | |
2179 | |
2180 | template <typename T> |
2181 | inline void qSwap(T &value1, T &value2) |
2182 | { |
2183 | #ifdef QT_NO_STL |
2184 | const T t = value1; |
2185 | value1 = value2; |
2186 | value2 = t; |
2187 | #else |
2188 | using std::swap; |
2189 | swap(value1, value2); |
2190 | #endif |
2191 | } |
2192 | |
2193 | /* |
2194 | Specialize a shared type with: |
2195 | |
2196 | Q_DECLARE_SHARED(type); |
2197 | |
2198 | where 'type' is the name of the type to specialize. NOTE: shared |
2199 | types must declare a 'bool isDetached(void) const;' member for this |
2200 | to work. |
2201 | */ |
2202 | #ifdef QT_NO_STL |
2203 | #define Q_DECLARE_SHARED_STL(TYPE) |
2204 | #else |
2205 | #define Q_DECLARE_SHARED_STL(TYPE) \ |
2206 | QT_END_NAMESPACE \ |
2207 | namespace std { \ |
2208 | template<> inline void swap<QT_PREPEND_NAMESPACE(TYPE)>(QT_PREPEND_NAMESPACE(TYPE) &value1, QT_PREPEND_NAMESPACE(TYPE) &value2) \ |
2209 | { swap(value1.data_ptr(), value2.data_ptr()); } \ |
2210 | } \ |
2211 | QT_BEGIN_NAMESPACE |
2212 | #endif |
2213 | |
2214 | #define Q_DECLARE_SHARED(TYPE) \ |
2215 | template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \ |
2216 | template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \ |
2217 | { qSwap(value1.data_ptr(), value2.data_ptr()); } \ |
2218 | Q_DECLARE_SHARED_STL(TYPE) |
2219 | |
2220 | /* |
2221 | QTypeInfo primitive specializations |
2222 | */ |
2223 | Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE); |
2224 | Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE); |
2225 | Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE); |
2226 | Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE); |
2227 | Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE); |
2228 | Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE); |
2229 | Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE); |
2230 | Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE); |
2231 | Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE); |
2232 | Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE); |
2233 | Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE); |
2234 | Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE); |
2235 | Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE); |
2236 | Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE); |
2237 | #ifndef Q_OS_DARWIN |
2238 | Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE); |
2239 | #endif |
2240 | |
2241 | /* |
2242 | These functions make it possible to use standard C++ functions with |
2243 | a similar name from Qt header files (especially template classes). |
2244 | */ |
2245 | Q_CORE_EXPORT void *qMalloc(size_t size); |
2246 | Q_CORE_EXPORT void qFree(void *ptr); |
2247 | Q_CORE_EXPORT void *qRealloc(void *ptr, size_t size); |
2248 | Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment); |
2249 | Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment); |
2250 | Q_CORE_EXPORT void qFreeAligned(void *ptr); |
2251 | Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n); |
2252 | Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); |
2253 | |
2254 | |
2255 | /* |
2256 | Avoid some particularly useless warnings from some stupid compilers. |
2257 | To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out |
2258 | the line "#define QT_NO_WARNINGS". |
2259 | */ |
2260 | #if !defined(QT_CC_WARNINGS) |
2261 | # define QT_NO_WARNINGS |
2262 | #endif |
2263 | #if defined(QT_NO_WARNINGS) |
2264 | # if defined(Q_CC_MSVC) |
2265 | # pragma warning(disable: 4251) /* class 'A' needs to have dll interface for to be used by clients of class 'B'. */ |
2266 | # pragma warning(disable: 4244) /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */ |
2267 | # pragma warning(disable: 4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */ |
2268 | # pragma warning(disable: 4514) /* unreferenced inline/local function has been removed */ |
2269 | # pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ |
2270 | # pragma warning(disable: 4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */ |
2271 | # pragma warning(disable: 4706) /* assignment within conditional expression */ |
2272 | # pragma warning(disable: 4786) /* truncating debug info after 255 characters */ |
2273 | # pragma warning(disable: 4660) /* template-class specialization 'identifier' is already instantiated */ |
2274 | # pragma warning(disable: 4355) /* 'this' : used in base member initializer list */ |
2275 | # pragma warning(disable: 4231) /* nonstandard extension used : 'extern' before template explicit instantiation */ |
2276 | # pragma warning(disable: 4710) /* function not inlined */ |
2277 | # pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify -GX */ |
2278 | # elif defined(Q_CC_BOR) |
2279 | # pragma option -w-inl |
2280 | # pragma option -w-aus |
2281 | # pragma warn -inl |
2282 | # pragma warn -pia |
2283 | # pragma warn -ccc |
2284 | # pragma warn -rch |
2285 | # pragma warn -sig |
2286 | # endif |
2287 | #endif |
2288 | |
2289 | class Q_CORE_EXPORT QFlag |
2290 | { |
2291 | int i; |
2292 | public: |
2293 | inline QFlag(int i); |
2294 | inline operator int() const { return i; } |
2295 | }; |
2296 | |
2297 | inline QFlag::QFlag(int ai) : i(ai) {} |
2298 | |
2299 | class Q_CORE_EXPORT QIncompatibleFlag |
2300 | { |
2301 | int i; |
2302 | public: |
2303 | inline explicit QIncompatibleFlag(int i); |
2304 | inline operator int() const { return i; } |
2305 | }; |
2306 | |
2307 | inline QIncompatibleFlag::QIncompatibleFlag(int ai) : i(ai) {} |
2308 | |
2309 | |
2310 | #ifndef Q_NO_TYPESAFE_FLAGS |
2311 | |
2312 | template<typename Enum> |
2313 | class QFlags |
2314 | { |
2315 | typedef void **Zero; |
2316 | int i; |
2317 | public: |
2318 | typedef Enum enum_type; |
2319 | Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {} |
2320 | Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {} |
2321 | Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {} |
2322 | inline QFlags(QFlag f) : i(f) {} |
2323 | |
2324 | inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; } |
2325 | inline QFlags &operator&=(int mask) { i &= mask; return *this; } |
2326 | inline QFlags &operator&=(uint mask) { i &= mask; return *this; } |
2327 | inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; } |
2328 | inline QFlags &operator|=(Enum f) { i |= f; return *this; } |
2329 | inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; } |
2330 | inline QFlags &operator^=(Enum f) { i ^= f; return *this; } |
2331 | |
2332 | Q_DECL_CONSTEXPR inline operator int() const { return i; } |
2333 | |
2334 | Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); } |
2335 | Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | f)); } |
2336 | Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); } |
2337 | Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ f)); } |
2338 | Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); } |
2339 | Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); } |
2340 | Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & f)); } |
2341 | Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); } |
2342 | |
2343 | Q_DECL_CONSTEXPR inline bool operator!() const { return !i; } |
2344 | |
2345 | inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); } |
2346 | }; |
2347 | |
2348 | #define Q_DECLARE_FLAGS(Flags, Enum)\ |
2349 | typedef QFlags<Enum> Flags; |
2350 | |
2351 | #define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \ |
2352 | inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) \ |
2353 | { return QIncompatibleFlag(int(f1) | f2); } |
2354 | |
2355 | #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ |
2356 | Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ |
2357 | { return QFlags<Flags::enum_type>(f1) | f2; } \ |
2358 | Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \ |
2359 | { return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) |
2360 | |
2361 | |
2362 | #else /* Q_NO_TYPESAFE_FLAGS */ |
2363 | |
2364 | #define Q_DECLARE_FLAGS(Flags, Enum)\ |
2365 | typedef uint Flags; |
2366 | #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) |
2367 | |
2368 | #endif /* Q_NO_TYPESAFE_FLAGS */ |
2369 | |
2370 | #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT) |
2371 | /* make use of typeof-extension */ |
2372 | template <typename T> |
2373 | class QForeachContainer { |
2374 | public: |
2375 | inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { } |
2376 | const T c; |
2377 | int brk; |
2378 | typename T::const_iterator i, e; |
2379 | }; |
2380 | |
2381 | #define Q_FOREACH(variable, container) \ |
2382 | for (QForeachContainer<__typeof__(container)> _container_(container); \ |
2383 | !_container_.brk && _container_.i != _container_.e; \ |
2384 | __extension__ ({ ++_container_.brk; ++_container_.i; })) \ |
2385 | for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;})) |
2386 | |
2387 | #else |
2388 | |
2389 | struct QForeachContainerBase {}; |
2390 | |
2391 | template <typename T> |
2392 | class QForeachContainer : public QForeachContainerBase { |
2393 | public: |
2394 | inline QForeachContainer(const T& t): c(t), brk(0), i(c.begin()), e(c.end()){}; |
2395 | const T c; |
2396 | mutable int brk; |
2397 | mutable typename T::const_iterator i, e; |
2398 | inline bool condition() const { return (!brk++ && i != e); } |
2399 | }; |
2400 | |
2401 | template <typename T> inline T *qForeachPointer(const T &) { return 0; } |
2402 | |
2403 | template <typename T> inline QForeachContainer<T> qForeachContainerNew(const T& t) |
2404 | { return QForeachContainer<T>(t); } |
2405 | |
2406 | template <typename T> |
2407 | inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase *base, const T *) |
2408 | { return static_cast<const QForeachContainer<T> *>(base); } |
2409 | |
2410 | #if defined(Q_CC_MIPS) |
2411 | /* |
2412 | Proper for-scoping in MIPSpro CC |
2413 | */ |
2414 | # define Q_FOREACH(variable,container) \ |
2415 | if(0){}else \ |
2416 | for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ |
2417 | qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \ |
2418 | ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \ |
2419 | for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \ |
2420 | qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \ |
2421 | --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk) |
2422 | |
2423 | #elif defined(Q_CC_DIAB) |
2424 | // VxWorks DIAB generates unresolvable symbols, if container is a function call |
2425 | # define Q_FOREACH(variable,container) \ |
2426 | if(0){}else \ |
2427 | for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ |
2428 | qForeachContainer(&_container_, (__typeof__(container) *) 0)->condition(); \ |
2429 | ++qForeachContainer(&_container_, (__typeof__(container) *) 0)->i) \ |
2430 | for (variable = *qForeachContainer(&_container_, (__typeof__(container) *) 0)->i; \ |
2431 | qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk; \ |
2432 | --qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk) |
2433 | |
2434 | #else |
2435 | # define Q_FOREACH(variable, container) \ |
2436 | for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ |
2437 | qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \ |
2438 | ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \ |
2439 | for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \ |
2440 | qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \ |
2441 | --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk) |
2442 | #endif // MSVC6 || MIPSpro |
2443 | |
2444 | #endif |
2445 | |
2446 | #define Q_FOREVER for(;;) |
2447 | #ifndef QT_NO_KEYWORDS |
2448 | # ifndef foreach |
2449 | # define foreach Q_FOREACH |
2450 | # endif |
2451 | # ifndef forever |
2452 | # define forever Q_FOREVER |
2453 | # endif |
2454 | #endif |
2455 | |
2456 | #if 0 |
2457 | /* tell gcc to use its built-in methods for some common functions */ |
2458 | #if defined(QT_NO_DEBUG) && defined(Q_CC_GNU) |
2459 | # define qMemCopy __builtin_memcpy |
2460 | # define qMemSet __builtin_memset |
2461 | #endif |
2462 | #endif |
2463 | |
2464 | template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; } |
2465 | template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.data(); } |
2466 | |
2467 | #define Q_DECLARE_PRIVATE(Class) \ |
2468 | inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr)); } \ |
2469 | inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \ |
2470 | friend class Class##Private; |
2471 | |
2472 | #define Q_DECLARE_PRIVATE_D(Dptr, Class) \ |
2473 | inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(Dptr); } \ |
2474 | inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(Dptr); } \ |
2475 | friend class Class##Private; |
2476 | |
2477 | #define Q_DECLARE_PUBLIC(Class) \ |
2478 | inline Class* q_func() { return static_cast<Class *>(q_ptr); } \ |
2479 | inline const Class* q_func() const { return static_cast<const Class *>(q_ptr); } \ |
2480 | friend class Class; |
2481 | |
2482 | #define Q_D(Class) Class##Private * const d = d_func() |
2483 | #define Q_Q(Class) Class * const q = q_func() |
2484 | |
2485 | #define QT_TR_NOOP(x) (x) |
2486 | #define QT_TR_NOOP_UTF8(x) (x) |
2487 | #define QT_TRANSLATE_NOOP(scope, x) (x) |
2488 | #define QT_TRANSLATE_NOOP_UTF8(scope, x) (x) |
2489 | #define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment} |
2490 | #define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment} |
2491 | |
2492 | #ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above |
2493 | |
2494 | // Defined in qcoreapplication.cpp |
2495 | // The better name qTrId() is reserved for an upcoming function which would |
2496 | // return a much more powerful QStringFormatter instead of a QString. |
2497 | Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1); |
2498 | |
2499 | #define QT_TRID_NOOP(id) id |
2500 | |
2501 | #endif // QT_NO_TRANSLATION |
2502 | |
2503 | #define QDOC_PROPERTY(text) |
2504 | |
2505 | /* |
2506 | When RTTI is not available, define this macro to force any uses of |
2507 | dynamic_cast to cause a compile failure. |
2508 | */ |
2509 | |
2510 | #ifdef QT_NO_DYNAMIC_CAST |
2511 | # define dynamic_cast QT_PREPEND_NAMESPACE(qt_dynamic_cast_check) |
2512 | |
2513 | template<typename T, typename X> |
2514 | T qt_dynamic_cast_check(X, T* = 0) |
2515 | { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; } |
2516 | #endif |
2517 | |
2518 | /* |
2519 | Some classes do not permit copies to be made of an object. These |
2520 | classes contains a private copy constructor and assignment |
2521 | operator to disable copying (the compiler gives an error message). |
2522 | */ |
2523 | #define Q_DISABLE_COPY(Class) \ |
2524 | Class(const Class &); \ |
2525 | Class &operator=(const Class &); |
2526 | |
2527 | class QByteArray; |
2528 | Q_CORE_EXPORT QByteArray qgetenv(const char *varName); |
2529 | Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value); |
2530 | |
2531 | inline int qIntCast(double f) { return int(f); } |
2532 | inline int qIntCast(float f) { return int(f); } |
2533 | |
2534 | /* |
2535 | Reentrant versions of basic rand() functions for random number generation |
2536 | */ |
2537 | Q_CORE_EXPORT void qsrand(uint seed); |
2538 | Q_CORE_EXPORT int qrand(); |
2539 | |
2540 | /* |
2541 | Compat functions that were generated by configure |
2542 | */ |
2543 | #ifdef QT3_SUPPORT |
2544 | #ifndef QT_PRODUCT_LICENSEE |
2545 | # define QT_PRODUCT_LICENSEE QLibraryInfo::licensee() |
2546 | #endif |
2547 | #ifndef QT_PRODUCT_LICENSE |
2548 | # define QT_PRODUCT_LICENSE QLibraryInfo::licensedProducts() |
2549 | #endif |
2550 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPath(); |
2551 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathDocs(); |
2552 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathHeaders(); |
2553 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathLibs(); |
2554 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathBins(); |
2555 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathPlugins(); |
2556 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathData(); |
2557 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathTranslations(); |
2558 | QT3_SUPPORT Q_CORE_EXPORT const char *qInstallPathSysconf(); |
2559 | #endif |
2560 | |
2561 | #if defined(Q_OS_SYMBIAN) |
2562 | |
2563 | #ifdef SYMBIAN_BUILD_GCE |
2564 | #define Q_SYMBIAN_SUPPORTS_SURFACES |
2565 | //RWsPointerCursor is fixed, so don't use low performance sprites |
2566 | #define Q_SYMBIAN_FIXED_POINTER_CURSORS |
2567 | #define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE |
2568 | #define Q_SYMBIAN_WINDOW_SIZE_CACHE |
2569 | #define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
2570 | |
2571 | //enabling new graphics resources |
2572 | #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE |
2573 | # define QT_SYMBIAN_SUPPORTS_SGIMAGE |
2574 | #endif |
2575 | |
2576 | #ifdef SYMBIAN_GRAPHICS_SET_SURFACE_TRANSPARENCY_AVAILABLE |
2577 | # define Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE |
2578 | #endif |
2579 | |
2580 | #ifdef SYMBIAN_GRAPHICS_TRANSITION_EFFECTS_SIGNALING_AVAILABLE |
2581 | # define Q_SYMBIAN_TRANSITION_EFFECTS |
2582 | #endif |
2583 | #endif |
2584 | |
2585 | #ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS |
2586 | #define Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS |
2587 | #endif |
2588 | |
2589 | #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION |
2590 | #define Q_SYMBIAN_SUPPORTS_FIXNATIVEORIENTATION |
2591 | #endif |
2592 | |
2593 | //Symbian does not support data imports from a DLL |
2594 | #define Q_NO_DATA_RELOCATION |
2595 | |
2596 | // Winscw compiler is unable to compile QtConcurrent. |
2597 | #ifdef Q_CC_NOKIAX86 |
2598 | #ifndef QT_NO_CONCURRENT |
2599 | #define QT_NO_CONCURRENT |
2600 | #endif |
2601 | #ifndef QT_NO_QFUTURE |
2602 | #define QT_NO_QFUTURE |
2603 | #endif |
2604 | #endif |
2605 | |
2606 | QT_END_NAMESPACE |
2607 | // forward declare std::exception |
2608 | #ifdef __cplusplus |
2609 | namespace std { class exception; } |
2610 | #endif |
2611 | QT_BEGIN_NAMESPACE |
2612 | Q_CORE_EXPORT void qt_symbian_throwIfError(int error); |
2613 | Q_CORE_EXPORT void qt_symbian_exception2LeaveL(const std::exception& ex); |
2614 | Q_CORE_EXPORT int qt_symbian_exception2Error(const std::exception& ex); |
2615 | |
2616 | #define QT_TRAP_THROWING(_f) \ |
2617 | { \ |
2618 | TInt ____error; \ |
2619 | TRAP(____error, _f); \ |
2620 | qt_symbian_throwIfError(____error); \ |
2621 | } |
2622 | |
2623 | #define QT_TRYCATCH_ERROR(_err, _f) \ |
2624 | { \ |
2625 | _err = KErrNone; \ |
2626 | try { \ |
2627 | _f; \ |
2628 | } catch (const std::exception &____ex) { \ |
2629 | _err = qt_symbian_exception2Error(____ex); \ |
2630 | } \ |
2631 | } |
2632 | |
2633 | #define QT_TRYCATCH_LEAVING(_f) \ |
2634 | { \ |
2635 | TInt ____err; \ |
2636 | QT_TRYCATCH_ERROR(____err, _f) \ |
2637 | User::LeaveIfError(____err); \ |
2638 | } |
2639 | #endif |
2640 | |
2641 | |
2642 | /* |
2643 | This gives us the possibility to check which modules the user can |
2644 | use. These are purely compile time checks and will generate no code. |
2645 | */ |
2646 | |
2647 | /* Qt modules */ |
2648 | #define QT_MODULE_CORE 0x00001 |
2649 | #define QT_MODULE_GUI 0x00002 |
2650 | #define QT_MODULE_NETWORK 0x00004 |
2651 | #define QT_MODULE_OPENGL 0x00008 |
2652 | #define QT_MODULE_SQL 0x00010 |
2653 | #define QT_MODULE_XML 0x00020 |
2654 | #define QT_MODULE_QT3SUPPORTLIGHT 0x00040 |
2655 | #define QT_MODULE_QT3SUPPORT 0x00080 |
2656 | #define QT_MODULE_SVG 0x00100 |
2657 | #define QT_MODULE_ACTIVEQT 0x00200 |
2658 | #define QT_MODULE_GRAPHICSVIEW 0x00400 |
2659 | #define QT_MODULE_SCRIPT 0x00800 |
2660 | #define QT_MODULE_XMLPATTERNS 0x01000 |
2661 | #define QT_MODULE_HELP 0x02000 |
2662 | #define QT_MODULE_TEST 0x04000 |
2663 | #define QT_MODULE_DBUS 0x08000 |
2664 | #define QT_MODULE_SCRIPTTOOLS 0x10000 |
2665 | #define QT_MODULE_OPENVG 0x20000 |
2666 | #define QT_MODULE_MULTIMEDIA 0x40000 |
2667 | #define QT_MODULE_DECLARATIVE 0x80000 |
2668 | |
2669 | /* Qt editions */ |
2670 | #define QT_EDITION_CONSOLE (QT_MODULE_CORE \ |
2671 | | QT_MODULE_NETWORK \ |
2672 | | QT_MODULE_SQL \ |
2673 | | QT_MODULE_SCRIPT \ |
2674 | | QT_MODULE_MULTIMEDIA \ |
2675 | | QT_MODULE_XML \ |
2676 | | QT_MODULE_XMLPATTERNS \ |
2677 | | QT_MODULE_TEST \ |
2678 | | QT_MODULE_DBUS) |
2679 | #define QT_EDITION_DESKTOPLIGHT (QT_MODULE_CORE \ |
2680 | | QT_MODULE_GUI \ |
2681 | | QT_MODULE_QT3SUPPORTLIGHT \ |
2682 | | QT_MODULE_TEST \ |
2683 | | QT_MODULE_DBUS) |
2684 | #define QT_EDITION_OPENSOURCE (QT_MODULE_CORE \ |
2685 | | QT_MODULE_GUI \ |
2686 | | QT_MODULE_NETWORK \ |
2687 | | QT_MODULE_OPENGL \ |
2688 | | QT_MODULE_OPENVG \ |
2689 | | QT_MODULE_SQL \ |
2690 | | QT_MODULE_MULTIMEDIA \ |
2691 | | QT_MODULE_XML \ |
2692 | | QT_MODULE_XMLPATTERNS \ |
2693 | | QT_MODULE_SCRIPT \ |
2694 | | QT_MODULE_SCRIPTTOOLS \ |
2695 | | QT_MODULE_QT3SUPPORTLIGHT \ |
2696 | | QT_MODULE_QT3SUPPORT \ |
2697 | | QT_MODULE_SVG \ |
2698 | | QT_MODULE_DECLARATIVE \ |
2699 | | QT_MODULE_GRAPHICSVIEW \ |
2700 | | QT_MODULE_HELP \ |
2701 | | QT_MODULE_TEST \ |
2702 | | QT_MODULE_DBUS \ |
2703 | | QT_MODULE_ACTIVEQT) |
2704 | #define QT_EDITION_DESKTOP (QT_EDITION_OPENSOURCE) |
2705 | #define QT_EDITION_UNIVERSAL QT_EDITION_DESKTOP |
2706 | #define QT_EDITION_ACADEMIC QT_EDITION_DESKTOP |
2707 | #define QT_EDITION_EDUCATIONAL QT_EDITION_DESKTOP |
2708 | #define QT_EDITION_EVALUATION QT_EDITION_DESKTOP |
2709 | |
2710 | /* Determine which modules can be used */ |
2711 | #ifndef QT_EDITION |
2712 | # ifdef QT_BUILD_QMAKE |
2713 | # define QT_EDITION QT_EDITION_DESKTOP |
2714 | # else |
2715 | # error "Qt not configured correctly, please run configure" |
2716 | # endif |
2717 | #endif |
2718 | |
2719 | #define QT_LICENSED_MODULE(x) \ |
2720 | enum QtValidLicenseFor##x##Module { Licensed##x = true }; |
2721 | |
2722 | /* qdoc is really unhappy with the following block of preprocessor checks, |
2723 | making it difficult to document classes properly after this point. */ |
2724 | |
2725 | #if (QT_EDITION & QT_MODULE_CORE) |
2726 | QT_LICENSED_MODULE(Core) |
2727 | #endif |
2728 | #if (QT_EDITION & QT_MODULE_GUI) |
2729 | QT_LICENSED_MODULE(Gui) |
2730 | #endif |
2731 | #if (QT_EDITION & QT_MODULE_NETWORK) |
2732 | QT_LICENSED_MODULE(Network) |
2733 | #endif |
2734 | #if (QT_EDITION & QT_MODULE_OPENGL) |
2735 | QT_LICENSED_MODULE(OpenGL) |
2736 | #endif |
2737 | #if (QT_EDITION & QT_MODULE_OPENVG) |
2738 | QT_LICENSED_MODULE(OpenVG) |
2739 | #endif |
2740 | #if (QT_EDITION & QT_MODULE_SQL) |
2741 | QT_LICENSED_MODULE(Sql) |
2742 | #endif |
2743 | #if (QT_EDITION & QT_MODULE_MULTIMEDIA) |
2744 | QT_LICENSED_MODULE(Multimedia) |
2745 | #endif |
2746 | #if (QT_EDITION & QT_MODULE_XML) |
2747 | QT_LICENSED_MODULE(Xml) |
2748 | #endif |
2749 | #if (QT_EDITION & QT_MODULE_XMLPATTERNS) |
2750 | QT_LICENSED_MODULE(XmlPatterns) |
2751 | #endif |
2752 | #if (QT_EDITION & QT_MODULE_HELP) |
2753 | QT_LICENSED_MODULE(Help) |
2754 | #endif |
2755 | #if (QT_EDITION & QT_MODULE_SCRIPT) || defined(QT_BUILD_QMAKE) |
2756 | QT_LICENSED_MODULE(Script) |
2757 | #endif |
2758 | #if (QT_EDITION & QT_MODULE_SCRIPTTOOLS) |
2759 | QT_LICENSED_MODULE(ScriptTools) |
2760 | #endif |
2761 | #if (QT_EDITION & QT_MODULE_QT3SUPPORTLIGHT) |
2762 | QT_LICENSED_MODULE(Qt3SupportLight) |
2763 | #endif |
2764 | #if (QT_EDITION & QT_MODULE_QT3SUPPORT) |
2765 | QT_LICENSED_MODULE(Qt3Support) |
2766 | #endif |
2767 | #if (QT_EDITION & QT_MODULE_SVG) |
2768 | QT_LICENSED_MODULE(Svg) |
2769 | #endif |
2770 | #if (QT_EDITION & QT_MODULE_DECLARATIVE) |
2771 | QT_LICENSED_MODULE(Declarative) |
2772 | #endif |
2773 | #if (QT_EDITION & QT_MODULE_ACTIVEQT) |
2774 | QT_LICENSED_MODULE(ActiveQt) |
2775 | #endif |
2776 | #if (QT_EDITION & QT_MODULE_TEST) |
2777 | QT_LICENSED_MODULE(Test) |
2778 | #endif |
2779 | #if (QT_EDITION & QT_MODULE_DBUS) |
2780 | QT_LICENSED_MODULE(DBus) |
2781 | #endif |
2782 | |
2783 | #define QT_MODULE(x) \ |
2784 | typedef QtValidLicenseFor##x##Module Qt##x##Module; |
2785 | |
2786 | #ifdef QT_NO_CONCURRENT |
2787 | # define QT_NO_QFUTURE |
2788 | #endif |
2789 | |
2790 | // gcc 3 version has problems with some of the |
2791 | // map/filter overloads. |
2792 | #if defined(Q_CC_GNU) && (__GNUC__ < 4) |
2793 | # define QT_NO_CONCURRENT_MAP |
2794 | # define QT_NO_CONCURRENT_FILTER |
2795 | #endif |
2796 | |
2797 | #if defined (__ELF__) |
2798 | # if defined (Q_OS_LINUX) || defined (Q_OS_SOLARIS) || defined (Q_OS_FREEBSD) || defined (Q_OS_OPENBSD) || defined (Q_OS_IRIX) |
2799 | # define Q_OF_ELF |
2800 | # endif |
2801 | #endif |
2802 | |
2803 | #if !(defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) \ |
2804 | && !(defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) \ |
2805 | && !(defined(Q_WS_X11) && !defined(QT_NO_FREETYPE)) \ |
2806 | && !(defined(Q_WS_QPA)) |
2807 | # define QT_NO_RAWFONT |
2808 | #endif |
2809 | |
2810 | namespace QtPrivate { |
2811 | //like std::enable_if |
2812 | template <bool B, typename T = void> struct QEnableIf; |
2813 | template <typename T> struct QEnableIf<true, T> { typedef T Type; }; |
2814 | } |
2815 | |
2816 | QT_END_NAMESPACE |
2817 | QT_END_HEADER |
2818 | |
2819 | #endif /* __cplusplus */ |
2820 | |
2821 | #endif /* QGLOBAL_H */ |
2822 | |