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