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