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