source: trunk/src/corelib/global/qglobal.h@ 22

Last change on this file since 22 was 17, checked in by Dmitry A. Kuminov, 16 years ago

corelib/global: OS/2 bits.

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