1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtCore module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
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.
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.
40 ****************************************************************************/
47 #define QT_VERSION_STR "5.0.0"
49 QT_VERSION is (major << 16) + (minor << 8) + patch.
51 #define QT_VERSION 0x050000
53 can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
55 #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
57 #ifndef QT_DISABLE_DEPRECATED_BEFORE
58 #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0)
62 QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than
63 the deprecation point specified.
65 Use it to specify from which version of Qt a function or class has been deprecated
68 #if QT_DEPRECATED_SINCE(5,1)
69 QT_DEPRECATED void deprecatedFunction(); //function deprecated sine Qt 5.1
72 #define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE)
74 #define QT_PACKAGEDATE_STR "YYYY-MM-DD"
76 #define QT_PACKAGE_TAG ""
78 #if !defined(QT_BUILD_MOC)
79 #include <QtCore/qconfig.h>
88 #ifndef QT_NAMESPACE /* user namespace */
90 # define QT_PREPEND_NAMESPACE(name) ::name
91 # define QT_USE_NAMESPACE
92 # define QT_BEGIN_NAMESPACE
93 # define QT_END_NAMESPACE
94 # define QT_BEGIN_INCLUDE_NAMESPACE
95 # define QT_END_INCLUDE_NAMESPACE
96 # define QT_BEGIN_MOC_NAMESPACE
97 # define QT_END_MOC_NAMESPACE
98 # define QT_FORWARD_DECLARE_CLASS(name) class name;
99 # define QT_FORWARD_DECLARE_STRUCT(name) struct name;
100 # define QT_MANGLE_NAMESPACE(name) name
102 #else /* user namespace */
104 # define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
105 # define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE;
106 # define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE {
107 # define QT_END_NAMESPACE }
108 # define QT_BEGIN_INCLUDE_NAMESPACE }
109 # define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE {
110 # define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE
111 # define QT_END_MOC_NAMESPACE
112 # define QT_FORWARD_DECLARE_CLASS(name) \
113 QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \
114 using QT_PREPEND_NAMESPACE(name);
116 # define QT_FORWARD_DECLARE_STRUCT(name) \
117 QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \
118 using QT_PREPEND_NAMESPACE(name);
120 # define QT_MANGLE_NAMESPACE0(x) x
121 # define QT_MANGLE_NAMESPACE1(a, b) a##_##b
122 # define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b)
123 # define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \
124 QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE))
126 namespace QT_NAMESPACE {}
128 # ifndef QT_BOOTSTRAPPED
129 # ifndef QT_NO_USING_NAMESPACE
131 This expands to a "using QT_NAMESPACE" also in _header files_.
132 It is the only way the feature can be used without too much
133 pain, but if people _really_ do not want it they can add
134 DEFINES += QT_NO_USING_NAMESPACE to their .pro files.
140 #endif /* user namespace */
142 #else /* __cplusplus */
144 # define QT_BEGIN_NAMESPACE
145 # define QT_END_NAMESPACE
146 # define QT_USE_NAMESPACE
147 # define QT_BEGIN_INCLUDE_NAMESPACE
148 # define QT_END_INCLUDE_NAMESPACE
150 #endif /* __cplusplus */
152 #if defined(Q_OS_MAC) && !defined(Q_CC_INTEL)
153 #define QT_BEGIN_HEADER extern "C++" {
154 #define QT_END_HEADER }
155 #define QT_BEGIN_INCLUDE_HEADER }
156 #define QT_END_INCLUDE_HEADER extern "C++" {
158 #define QT_BEGIN_HEADER
159 #define QT_END_HEADER
160 #define QT_BEGIN_INCLUDE_HEADER
161 #define QT_END_INCLUDE_HEADER extern "C++"
165 The operating system, must be one of: (Q_OS_x)
167 DARWIN - Darwin OS (synonym for Q_OS_MAC)
169 MSDOS - MS-DOS and Windows
171 OS2EMX - XFree86 on OS/2 (not PM)
172 WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
173 WINCE - WinCE (Windows CE 5.0)
175 SOLARIS - Sun Solaris
185 SCO - SCO OpenServer 5
186 UNIXWARE - UnixWare 7, Open UNIX 8
190 RELIANT - Reliant UNIX
195 BSD4 - Any BSD 4.4 system
196 UNIX - Any UNIX BSD/SYSV system
199 #if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
203 # define Q_OS_DARWIN64
205 # define Q_OS_DARWIN32
207 #elif defined(__SYMBIAN32__) || defined(SYMBIAN)
208 # define Q_OS_SYMBIAN
209 # define Q_NO_POSIX_SIGNALS
210 # define QT_NO_GETIFADDRS
211 #elif defined(__CYGWIN__)
213 #elif defined(MSDOS) || defined(_MSDOS)
215 #elif defined(__OS2__)
216 # if defined(__EMX__)
221 #elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
224 #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
225 # if defined(WINCE) || defined(_WIN32_WCE)
230 #elif defined(__MWERKS__) && defined(__INTEL__)
232 #elif defined(__sun) || defined(sun)
233 # define Q_OS_SOLARIS
234 #elif defined(hpux) || defined(__hpux)
236 #elif defined(__ultrix) || defined(ultrix)
239 # define Q_OS_RELIANT
240 #elif defined(__native_client__)
242 #elif defined(__linux__) || defined(__linux)
244 #elif defined(__FreeBSD__) || defined(__DragonFly__)
245 # define Q_OS_FREEBSD
247 #elif defined(__NetBSD__)
250 #elif defined(__OpenBSD__)
251 # define Q_OS_OPENBSD
253 #elif defined(__bsdi__)
258 #elif defined(__osf__)
262 #elif defined(__Lynx__)
264 #elif defined(__GNU__)
266 #elif defined(__DGUX__)
268 #elif defined(__QNXNTO__)
270 #elif defined(_SEQUENT_)
272 #elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */
274 #elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */
275 # define Q_OS_UNIXWARE
276 #elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */
277 # define Q_OS_UNIXWARE
278 #elif defined(__INTEGRITY)
279 # define Q_OS_INTEGRITY
280 #elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
281 # define Q_OS_VXWORKS
282 #elif defined(__MAKEDEPEND__)
284 # error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com"
287 #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE)
291 #if defined(Q_OS_DARWIN)
293 # define Q_OS_MACX /* Q_OS_MACX is only for compatibility.*/
294 # if defined(Q_OS_DARWIN64)
296 # elif defined(Q_OS_DARWIN32)
301 #if defined(Q_WS_MAC64) && !defined(QT_MAC_USE_COCOA) && !defined(QT_BUILD_QMAKE) && !defined(QT_BOOTSTRAPPED)
302 #error "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration."
305 #if defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN)
307 #elif !defined(Q_OS_UNIX)
311 #if defined(Q_OS_DARWIN) && !defined(QT_LARGEFILE_SUPPORT)
312 # define QT_LARGEFILE_SUPPORT 64
316 # ifdef MAC_OS_X_VERSION_MIN_REQUIRED
317 # undef MAC_OS_X_VERSION_MIN_REQUIRED
319 # define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4
320 # include <AvailabilityMacros.h>
321 # if !defined(MAC_OS_X_VERSION_10_3)
322 # define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
324 # if !defined(MAC_OS_X_VERSION_10_4)
325 # define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
327 # if !defined(MAC_OS_X_VERSION_10_5)
328 # define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
330 # if !defined(MAC_OS_X_VERSION_10_6)
331 # define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1
333 # if !defined(MAC_OS_X_VERSION_10_7)
334 # define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
336 # if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_7)
337 # warning "This version of Mac OS X is unsupported"
341 #ifdef __LSB_VERSION__
342 # if __LSB_VERSION__ < 40
343 # error "This version of the Linux Standard Base is unsupported"
346 # define QT_LINUXBASE
351 The compiler, must be one of: (Q_CC_x)
353 SYM - Digital Mars C/C++ (used to be Symantec C++)
354 MWERKS - Metrowerks CodeWarrior
355 MSVC - Microsoft Visual C/C++, Intel C++ for Windows
356 BOR - Borland/Turbo C++
360 EDG - Edison Design Group C++
362 SUN - Forte Developer, or Sun Studio C++
366 USLC - SCO OUDK and UDK
369 INTEL - Intel C++ for Linux, Intel C++ for Windows
370 HIGHC - MetaWare High C/C++
371 PGI - Portland Group C++
372 GHS - Green Hills Optimizing C++ Compilers
373 GCCE - GCCE (Symbian GCCE builds)
374 RVCT - ARM Realview Compiler Suite
375 NOKIAX86 - Nokia x86 (Symbian WINSCW builds)
376 CLANG - C++ front-end for the LLVM compiler
379 Should be sorted most to least authoritative.
383 # define Q_OUTOFLINE_TEMPLATE inline
385 /* the following are necessary because the GHS C++ name mangling relies on __*/
386 # define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
387 static const int AFUNC ## _init_variable_ = AFUNC();
388 # define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
389 # define Q_DESTRUCTOR_FUNCTION0(AFUNC) \
390 class AFUNC ## _dest_class_ { \
392 inline AFUNC ## _dest_class_() { } \
393 inline ~ AFUNC ## _dest_class_() { AFUNC(); } \
394 } AFUNC ## _dest_instance_;
395 # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
399 /* Symantec C++ is now Digital Mars */
400 #if defined(__DMC__) || defined(__SC__)
402 /* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */
403 # if defined(__SC__) && __SC__ < 0x750
404 # define Q_NO_EXPLICIT_KEYWORD
406 # define Q_NO_USING_KEYWORD
408 #elif defined(__MWERKS__)
410 # if defined(__EMU_SYMBIAN_OS__)
411 # define Q_CC_NOKIAX86
413 /* "explicit" recognized since 4.0d1 */
415 #elif defined(_MSC_VER)
417 # define Q_CC_MSVC_NET
418 # define Q_CANNOT_DELETE_CONSTANT
419 # define Q_OUTOFLINE_TEMPLATE inline
420 # define Q_NO_TEMPLATE_FRIENDS
421 # define Q_ALIGNOF(type) __alignof(type)
422 # define Q_DECL_ALIGN(n) __declspec(align(n))
423 /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
424 # if defined(__INTEL_COMPILER)
427 /* MSVC does not support SSE/MMX on x64 */
428 # if (defined(Q_CC_MSVC) && defined(_M_X64))
431 # undef QT_HAVE_3DNOW
434 #if defined(Q_CC_MSVC) && _MSC_VER >= 1600
435 # define Q_COMPILER_RVALUE_REFS
436 # define Q_COMPILER_AUTO_TYPE
437 # define Q_COMPILER_LAMBDA
438 # define Q_COMPILER_DECLTYPE
439 // MSCV has std::initilizer_list, but do not support the braces initialization
440 //# define Q_COMPILER_INITIALIZER_LISTS
444 #elif defined(__BORLANDC__) || defined(__TURBOC__)
446 # define Q_INLINE_TEMPLATE
447 # if __BORLANDC__ < 0x502
448 # define Q_NO_BOOL_TYPE
449 # define Q_NO_EXPLICIT_KEYWORD
451 # define Q_NO_USING_KEYWORD
453 #elif defined(__WATCOMC__)
457 #elif defined(__GCCE__)
459 # define QT_VISIBILITY_AVAILABLE
460 # if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
461 # define QT_HAVE_ARMV6
464 /* ARM Realview Compiler Suite
465 RVCT compiler also defines __EDG__ and __GNUC__ (if --gnu flag is given),
466 so check for it before that */
467 #elif defined(__ARMCC__) || defined(__CC_ARM)
469 # if __TARGET_ARCH_ARM >= 6
470 # define QT_HAVE_ARMV6
472 /* work-around for missing compiler intrinsics */
473 # define __is_empty(X) false
474 # define __is_pod(X) false
475 #elif defined(__GNUC__)
477 # define Q_C_CALLBACKS
478 # if defined(__MINGW32__)
481 # if defined(__INTEL_COMPILER)
482 /* Intel C++ also masquerades as GCC 3.2.0 */
485 # if defined(__clang__)
486 /* Clang also masquerades as GCC 4.2.1 */
490 # define Q_NO_DEPRECATED_CONSTRUCTORS
492 # if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
493 # define Q_FULL_TEMPLATE_INSTANTIATION
495 /* GCC 2.95 knows "using" but does not support it correctly */
496 # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
497 # define Q_NO_USING_KEYWORD
498 # define QT_NO_STL_WCHAR
500 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
501 # define Q_ALIGNOF(type) __alignof__(type)
502 # define Q_TYPEOF(expr) __typeof__(expr)
503 # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
505 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
506 # define Q_LIKELY(expr) __builtin_expect(!!(expr), true)
507 # define Q_UNLIKELY(expr) __builtin_expect(!!(expr), false)
509 /* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */
510 # if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1
511 # define Q_WRONG_SB_CTYPE_MACROS
513 /* GCC <= 3.3 cannot handle template friends */
514 # if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
515 # define Q_NO_TEMPLATE_FRIENDS
517 /* Apple's GCC 3.1 chokes on our streaming qDebug() */
518 # if defined(Q_OS_DARWIN) && __GNUC__ == 3 && (__GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 3)
519 # define Q_BROKEN_DEBUG_STREAM
521 # if (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_MOC_CPP)
522 # define Q_PACKED __attribute__ ((__packed__))
523 # define Q_NO_PACKED_REFERENCE
524 # ifndef __ARM_EABI__
525 # define QT_NO_ARM_EABI
528 # if defined(__GXX_EXPERIMENTAL_CXX0X__)
529 # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 403
530 /* C++0x features supported in GCC 4.3: */
531 # define Q_COMPILER_RVALUE_REFS
532 # define Q_COMPILER_DECLTYPE
534 # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404
535 /* C++0x features supported in GCC 4.4: */
536 # define Q_COMPILER_UNICODE_STRINGS
537 # define Q_COMPILER_VARIADIC_TEMPLATES
538 # define Q_COMPILER_AUTO_TYPE
539 # define Q_COMPILER_EXTERN_TEMPLATES
540 # define Q_COMPILER_DEFAULT_DELETE_MEMBERS
541 # define Q_COMPILER_CLASS_ENUM
542 # define Q_COMPILER_INITIALIZER_LISTS
544 # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
545 /* C++0x features supported in GCC 4.5: */
546 # define Q_COMPILER_LAMBDA
548 # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
549 /* C++0x features supported in GCC 4.6: */
550 # define Q_COMPILER_CONSTEXPR
555 /* IBM compiler versions are a bit messy. There are actually two products:
556 the C product, and the C++ product. The C++ compiler is always packaged
557 with the latest version of the C compiler. Version numbers do not always
558 match. This little table (I'm not sure it's accurate) should be helpful:
560 C++ product C product
562 C Set 3.1 C Compiler 3.0
564 C++ Compiler 3.6.6 C Compiler 4.3
566 Visual Age C++ 4.0 ...
568 Visual Age C++ 5.0 C Compiler 5.0
570 Visual Age C++ 6.0 C Compiler 6.0
573 __xlC__ is the version of the C compiler in hexadecimal notation
574 is only an approximation of the C++ compiler version
575 __IBMCPP__ is the version of the C++ compiler in decimal notation
576 but it is not defined on older compilers like C Set 3.1 */
577 #elif defined(__xlC__)
579 # define Q_FULL_TEMPLATE_INSTANTIATION
581 # define Q_NO_BOOL_TYPE
582 # define Q_NO_EXPLICIT_KEYWORD
583 # define Q_NO_USING_KEYWORD
585 # define Q_OUTOFLINE_TEMPLATE inline
586 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
587 # define Q_CANNOT_DELETE_CONSTANT
588 # elif __xlC__ >= 0x0600
589 # define Q_ALIGNOF(type) __alignof__(type)
590 # define Q_TYPEOF(expr) __typeof__(expr)
591 # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
592 # define Q_PACKED __attribute__((__packed__))
595 /* Older versions of DEC C++ do not define __EDG__ or __EDG - observed
596 on DEC C++ V5.5-004. New versions do define __EDG__ - observed on
598 This compiler is different enough from other EDG compilers to handle
599 it separately anyway. */
600 #elif defined(__DECCXX) || defined(__DECC)
602 /* Compaq C++ V6 compilers are EDG-based but I'm not sure about older
603 DEC C++ V5 compilers. */
604 # if defined(__EDG__)
607 /* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead
608 - observed on Compaq C++ V6.3-002.
609 In any case versions prior to Compaq C++ V6.0-005 do not have bool. */
610 # if !defined(_BOOL_EXISTS)
611 # define Q_NO_BOOL_TYPE
613 /* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
614 # define Q_NO_USING_KEYWORD
615 /* Apply to all versions prior to Compaq C++ V6.0-000 - observed on
617 # if __DECCXX_VER < 60060000
619 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
620 # define Q_CANNOT_DELETE_CONSTANT
622 /* avoid undefined symbol problems with out-of-line template members */
623 # define Q_OUTOFLINE_TEMPLATE inline
625 /* The Portland Group C++ compiler is based on EDG and does define __EDG__
626 but the C compiler does not */
629 # if defined(__EDG__)
633 /* Compilers with EDG front end are similar. To detect them we test:
634 __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b
635 __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002
637 #elif !defined(Q_OS_HPUX) && (defined(__EDG) || defined(__EDG__))
639 /* From the EDG documentation (does not seem to apply to Compaq C++):
641 Defined in C++ mode when bool is a keyword. The name of this
642 predefined macro is specified by a configuration flag. _BOOL
645 Defined in Microsoft C++ mode when bool is a keyword. */
646 # if !defined(_BOOL) && !defined(__BOOL_DEFINED)
647 # define Q_NO_BOOL_TYPE
650 /* The Comeau compiler is based on EDG and does define __EDG__ */
651 # if defined(__COMO__)
653 # define Q_C_CALLBACKS
655 /* The `using' keyword was introduced to avoid KAI C++ warnings
656 but it's now causing KAI C++ errors instead. The standard is
657 unclear about the use of this keyword, and in practice every
658 compiler is using its own set of rules. Forget it. */
659 # elif defined(__KCC)
661 # define Q_NO_USING_KEYWORD
663 /* Using the `using' keyword avoids Intel C++ for Linux warnings */
664 # elif defined(__INTEL_COMPILER)
667 /* Uses CFront, make sure to read the manual how to tweak templates. */
668 # elif defined(__ghs)
671 # elif defined(__DCC__)
673 # undef Q_NO_BOOL_TYPE
674 # if !defined(__bool)
675 # define Q_NO_BOOL_TYPE
678 /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */
679 # elif defined(__USLC__) && defined(__SCO_VERSION__)
681 /* The latest UDK 7.1.1b does not need this, but previous versions do */
682 # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010)
683 # define Q_OUTOFLINE_TEMPLATE inline
685 # define Q_NO_USING_KEYWORD /* ### check "using" status */
688 # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER)
690 # define Q_NO_USING_KEYWORD
692 /* CDS++ defines __EDG__ although this is not documented in the Reliant
693 documentation. It also follows conventions like _BOOL and this documented */
694 # elif defined(sinix)
696 # define Q_NO_USING_KEYWORD
698 /* The MIPSpro compiler defines __EDG */
699 # elif defined(__sgi)
701 # define Q_NO_USING_KEYWORD /* ### check "using" status */
702 # define Q_NO_TEMPLATE_FRIENDS
703 # if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740)
704 # define Q_OUTOFLINE_TEMPLATE inline
705 # pragma set woff 3624,3625,3649 /* turn off some harmless warnings */
709 /* VxWorks' DIAB toolchain has an additional EDG type C++ compiler
710 (see __DCC__ above). This one is for C mode files (__EDG is not defined) */
711 #elif defined(_DIAB_TOOL)
715 #elif defined(__HIGHC__)
718 #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
720 /* 5.0 compiler or better
721 'bool' is enabled by default but can be disabled using -features=nobool
722 in which case _BOOL is not defined
723 this is the default in 4.2 compatibility mode triggered by -compat=4 */
724 # if __SUNPRO_CC >= 0x500
725 # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
726 /* see http://developers.sun.com/sunstudio/support/Ccompare.html */
727 # if __SUNPRO_CC >= 0x590
728 # define Q_ALIGNOF(type) __alignof__(type)
729 # define Q_TYPEOF(expr) __typeof__(expr)
730 # define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
732 # if __SUNPRO_CC >= 0x550
733 # define Q_DECL_EXPORT __global
735 # if __SUNPRO_CC < 0x5a0
736 # define Q_NO_TEMPLATE_FRIENDS
739 # define Q_NO_BOOL_TYPE
741 # if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4)
742 # define Q_NO_USING_KEYWORD
744 # define Q_C_CALLBACKS
745 /* 4.2 compiler or older */
747 # define Q_NO_BOOL_TYPE
748 # define Q_NO_EXPLICIT_KEYWORD
749 # define Q_NO_USING_KEYWORD
752 /* CDS++ does not seem to define __EDG__ or __EDG according to Reliant
753 documentation but nevertheless uses EDG conventions like _BOOL */
758 # define Q_NO_BOOL_TYPE
760 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
762 #elif defined(Q_OS_HPUX)
763 /* __HP_aCC was not defined in first aCC releases */
764 # if defined(__HP_aCC) || __cplusplus >= 199707L
765 # define Q_NO_TEMPLATE_FRIENDS
767 # if __HP_aCC-0 < 060000
768 # define QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
769 # define Q_DECL_EXPORT __declspec(dllexport)
770 # define Q_DECL_IMPORT __declspec(dllimport)
772 # if __HP_aCC-0 >= 061200
773 # define Q_DECL_ALIGN(n) __attribute__((aligned(n)))
775 # if __HP_aCC-0 >= 062000
776 # define Q_DECL_EXPORT __attribute__((visibility("default")))
777 # define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
778 # define Q_DECL_IMPORT Q_DECL_EXPORT
782 # define Q_NO_BOOL_TYPE
783 # define Q_FULL_TEMPLATE_INSTANTIATION
784 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
785 # define Q_NO_EXPLICIT_KEYWORD
787 # define Q_NO_USING_KEYWORD /* ### check "using" status */
789 #elif defined(__WINSCW__) && !defined(Q_CC_NOKIAX86)
790 # define Q_CC_NOKIAX86
793 # error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com"
798 # if __INTEL_COMPILER < 1200
799 # define Q_NO_TEMPLATE_FRIENDS
801 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || defined(__GXX_EXPERIMENTAL_CPP0X__)
802 # if __INTEL_COMPILER >= 1100
803 # define Q_COMPILER_RVALUE_REFS
804 # define Q_COMPILER_EXTERN_TEMPLATES
805 # define Q_COMPILER_DECLTYPE
806 # elif __INTEL_COMPILER >= 1200
807 # define Q_COMPILER_VARIADIC_TEMPLATES
808 # define Q_COMPILER_AUTO_TYPE
809 # define Q_COMPILER_DEFAULT_DELETE_MEMBERS
810 # define Q_COMPILER_CLASS_ENUM
811 # define Q_COMPILER_LAMBDA
818 # undef Q_NO_PACKED_REFERENCE
822 # define Q_LIKELY(x) (x)
825 # define Q_UNLIKELY(x) (x)
828 #ifndef Q_CONSTRUCTOR_FUNCTION
829 # define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
830 static const int AFUNC ## __init_variable__ = AFUNC();
831 # define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
834 #ifndef Q_DESTRUCTOR_FUNCTION
835 # define Q_DESTRUCTOR_FUNCTION0(AFUNC) \
836 class AFUNC ## __dest_class__ { \
838 inline AFUNC ## __dest_class__() { } \
839 inline ~ AFUNC ## __dest_class__() { AFUNC(); } \
840 } AFUNC ## __dest_instance__;
841 # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
844 #ifndef Q_REQUIRED_RESULT
845 # if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
846 # define Q_REQUIRED_RESULT __attribute__ ((warn_unused_result))
848 # define Q_REQUIRED_RESULT
852 #ifndef Q_COMPILER_MANGLES_RETURN_TYPE
853 # if defined(Q_CC_MSVC)
854 # define Q_COMPILER_MANGLES_RETURN_TYPE
859 The window system, must be one of: (Q_WS_x)
863 QWS - Qt for Embedded Linux
865 X11 - X Window System
871 #if defined (Q_WS_QPA)
873 #elif defined(Q_OS_MSDOS)
875 # error "Qt requires Win32 and does not work with Windows 3.x"
876 #elif defined(_WIN32_X11_)
878 #elif defined(Q_OS_WIN32)
880 # if defined(Q_OS_WIN64)
883 #elif defined(Q_OS_WINCE)
886 # if defined(Q_OS_WINCE_WM)
887 # define Q_WS_WINCE_WM
889 #elif defined(Q_OS_OS2)
891 # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell"
892 #elif defined(Q_OS_UNIX)
893 # if defined(Q_OS_SYMBIAN)
894 # if !defined(QT_NO_S60)
897 # elif !defined(Q_WS_QWS) && !defined(Q_WS_QPA)
902 #if defined(Q_WS_WIN16) || defined(Q_WS_WIN32) || defined(Q_WS_WINCE)
910 Size-dependent types (architechture-dependent byte order)
912 Make sure to update QMetaType when changing these typedefs
915 typedef signed char qint8; /* 8 bit signed */
916 typedef unsigned char quint8; /* 8 bit unsigned */
917 typedef short qint16; /* 16 bit signed */
918 typedef unsigned short quint16; /* 16 bit unsigned */
919 typedef int qint32; /* 32 bit signed */
920 typedef unsigned int quint32; /* 32 bit unsigned */
921 #if defined(Q_OS_WIN) && !defined(Q_CC_GNU) && !defined(Q_CC_MWERKS)
922 # define Q_INT64_C(c) c ## i64 /* signed 64 bit constant */
923 # define Q_UINT64_C(c) c ## ui64 /* unsigned 64 bit constant */
924 typedef __int64 qint64; /* 64 bit signed */
925 typedef unsigned __int64 quint64; /* 64 bit unsigned */
927 # define Q_INT64_C(c) static_cast<long long>(c ## LL) /* signed 64 bit constant */
928 # define Q_UINT64_C(c) static_cast<unsigned long long>(c ## ULL) /* unsigned 64 bit constant */
929 typedef long long qint64; /* 64 bit signed */
930 typedef unsigned long long quint64; /* 64 bit unsigned */
933 typedef qint64 qlonglong;
934 typedef quint64 qulonglong;
936 #ifndef QT_POINTER_SIZE
937 # if defined(Q_OS_WIN64)
938 # define QT_POINTER_SIZE 8
939 # elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
940 # define QT_POINTER_SIZE 4
944 #define Q_INIT_RESOURCE_EXTERN(name) \
945 extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) ();
947 #define Q_INIT_RESOURCE(name) \
948 do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
949 QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0)
950 #define Q_CLEANUP_RESOURCE(name) \
951 do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); \
952 QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (0)
954 #if defined(__cplusplus)
957 quintptr and qptrdiff is guaranteed to be the same size as a pointer, i.e.
959 sizeof(void *) == sizeof(quintptr)
960 && sizeof(void *) == sizeof(qptrdiff)
962 template <int> struct QIntegerForSize;
963 template <> struct QIntegerForSize<1> { typedef quint8 Unsigned; typedef qint8 Signed; };
964 template <> struct QIntegerForSize<2> { typedef quint16 Unsigned; typedef qint16 Signed; };
965 template <> struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; };
966 template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; };
967 template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { };
968 typedef QIntegerForSizeof<void*>::Unsigned quintptr;
969 typedef QIntegerForSizeof<void*>::Signed qptrdiff;
972 Useful type definitions for Qt
975 QT_BEGIN_INCLUDE_NAMESPACE
976 typedef unsigned char uchar;
977 typedef unsigned short ushort;
978 typedef unsigned int uint;
979 typedef unsigned long ulong;
980 QT_END_INCLUDE_NAMESPACE
982 #if defined(Q_NO_BOOL_TYPE)
983 #error "Compiler doesn't support the bool type"
991 #ifndef QT_LINUXBASE /* the LSB defines TRUE and FALSE for us */
992 /* Symbian OS defines TRUE = 1 and FALSE = 0,
993 redefine to built-in booleans to make autotests work properly */
995 #include <e32def.h> /* Symbian OS defines */
1002 # define FALSE false
1007 Proper for-scoping in MIPSpro CC
1009 #ifndef QT_NO_KEYWORDS
1010 # if defined(Q_CC_MIPS) || (defined(Q_CC_HPACC) && defined(__ia64))
1011 # define for if(0){}else for
1016 Workaround for static const members on MSVC++.
1019 #if defined(Q_CC_MSVC)
1020 # define QT_STATIC_CONST static
1021 # define QT_STATIC_CONST_IMPL
1023 # define QT_STATIC_CONST static const
1024 # define QT_STATIC_CONST_IMPL const
1028 Warnings and errors when using deprecated methods
1030 #if defined(Q_MOC_RUN)
1031 # define Q_DECL_DEPRECATED Q_DECL_DEPRECATED
1032 #elif (defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2))) || defined(Q_CC_RVCT)
1033 # define Q_DECL_DEPRECATED __attribute__ ((__deprecated__))
1034 #elif defined(Q_CC_MSVC)
1035 # define Q_DECL_DEPRECATED __declspec(deprecated)
1036 # if defined (Q_CC_INTEL)
1037 # define Q_DECL_VARIABLE_DEPRECATED
1041 # define Q_DECL_DEPRECATED
1043 #ifndef Q_DECL_VARIABLE_DEPRECATED
1044 # define Q_DECL_VARIABLE_DEPRECATED Q_DECL_DEPRECATED
1046 #ifndef Q_DECL_CONSTRUCTOR_DEPRECATED
1047 # if defined(Q_MOC_RUN)
1048 # define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_CONSTRUCTOR_DEPRECATED
1049 # elif defined(Q_NO_DEPRECATED_CONSTRUCTORS)
1050 # define Q_DECL_CONSTRUCTOR_DEPRECATED
1052 # define Q_DECL_CONSTRUCTOR_DEPRECATED Q_DECL_DEPRECATED
1056 #if defined(QT_NO_DEPRECATED)
1057 # undef QT_DEPRECATED
1058 # undef QT_DEPRECATED_VARIABLE
1059 # undef QT_DEPRECATED_CONSTRUCTOR
1060 #elif defined(QT_DEPRECATED_WARNINGS)
1061 # undef QT_DEPRECATED
1062 # define QT_DEPRECATED Q_DECL_DEPRECATED
1063 # undef QT_DEPRECATED_VARIABLE
1064 # define QT_DEPRECATED_VARIABLE Q_DECL_VARIABLE_DEPRECATED
1065 # undef QT_DEPRECATED_CONSTRUCTOR
1066 # define QT_DEPRECATED_CONSTRUCTOR explicit Q_DECL_CONSTRUCTOR_DEPRECATED
1068 # undef QT_DEPRECATED
1069 # define QT_DEPRECATED
1070 # undef QT_DEPRECATED_VARIABLE
1071 # define QT_DEPRECATED_VARIABLE
1072 # undef QT_DEPRECATED_CONSTRUCTOR
1073 # define QT_DEPRECATED_CONSTRUCTOR
1076 /* moc compats (signals/slots) */
1077 #ifndef QT_MOC_COMPAT
1078 # if defined(QT3_SUPPORT)
1079 # define QT_MOC_COMPAT QT3_SUPPORT
1081 # define QT_MOC_COMPAT
1084 # undef QT_MOC_COMPAT
1085 # define QT_MOC_COMPAT
1088 #ifdef QT_ASCII_CAST_WARNINGS
1089 # define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED
1090 # if defined(Q_CC_GNU) && __GNUC__ < 4
1091 /* gcc < 4 doesn't like Q_DECL_DEPRECATED in front of constructors */
1092 # define QT_ASCII_CAST_WARN_CONSTRUCTOR
1094 # define QT_ASCII_CAST_WARN_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED
1097 # define QT_ASCII_CAST_WARN
1098 # define QT_ASCII_CAST_WARN_CONSTRUCTOR
1101 #if defined(__i386__) || defined(_WIN32) || defined(_WIN32_WCE)
1102 # if defined(Q_CC_GNU)
1103 #if !defined(Q_CC_INTEL) && ((100*(__GNUC__ - 0) + 10*(__GNUC_MINOR__ - 0) + __GNUC_PATCHLEVEL__) >= 332)
1104 # define QT_FASTCALL __attribute__((regparm(3)))
1106 # define QT_FASTCALL
1108 # elif defined(Q_CC_MSVC)
1109 # define QT_FASTCALL __fastcall
1111 # define QT_FASTCALL
1114 # define QT_FASTCALL
1117 #ifdef Q_COMPILER_CONSTEXPR
1118 # define Q_DECL_CONSTEXPR constexpr
1120 # define Q_DECL_CONSTEXPR
1123 //defines the type for the WNDPROC on windows
1124 //the alignment needs to be forced for sse2 to not crash with mingw
1125 #if defined(Q_OS_WIN)
1126 # if defined(Q_CC_MINGW)
1127 # define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer))
1129 # define QT_ENSURE_STACK_ALIGNED_FOR_SSE
1131 # define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE
1134 typedef int QNoImplicitBoolCast;
1136 // This logic must match the one in qmetatype.h
1137 #if defined(QT_COORD_TYPE)
1138 typedef QT_COORD_TYPE qreal;
1139 #elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
1140 typedef float qreal;
1142 typedef double qreal;
1146 Utility macros and inline functions
1149 template <typename T>
1150 Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
1152 Q_DECL_CONSTEXPR inline int qRound(qreal d)
1153 { return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); }
1155 #if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
1156 Q_DECL_CONSTEXPR inline qint64 qRound64(double d)
1157 { return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); }
1159 Q_DECL_CONSTEXPR inline qint64 qRound64(qreal d)
1160 { return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); }
1163 template <typename T>
1164 Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
1165 template <typename T>
1166 Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
1167 template <typename T>
1168 Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max)
1169 { return qMax(min, qMin(max, val)); }
1172 Data stream functions are provided by many classes (defined in qdatastream.h)
1177 #ifndef QT_BUILD_KEY
1178 #define QT_BUILD_KEY "unspecified"
1181 #if defined(Q_WS_MAC)
1182 # ifndef QMAC_QMENUBAR_NO_EVENT
1183 # define QMAC_QMENUBAR_NO_EVENT
1187 #if !defined(Q_WS_QWS) && !defined(QT_NO_COP)
1191 #if defined(Q_OS_VXWORKS)
1192 # define QT_NO_CRASHHANDLER // no popen
1193 # define QT_NO_PROCESS // no exec*, no fork
1195 # define QT_NO_SHAREDMEMORY // only POSIX, no SysV and in the end...
1196 # define QT_NO_SYSTEMSEMAPHORE // not needed at all in a flat address space
1197 # define QT_NO_QWS_MULTIPROCESS // no processes
1200 # include <QtCore/qfeatures.h>
1202 #define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE))
1204 #if defined(Q_OS_LINUX) && defined(Q_CC_RVCT)
1205 # define Q_DECL_EXPORT __attribute__((visibility("default")))
1206 # define Q_DECL_IMPORT __attribute__((visibility("default")))
1207 # define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
1210 #ifndef Q_DECL_EXPORT
1211 # if defined(Q_OS_WIN) || defined(Q_CC_NOKIAX86) || defined(Q_CC_RVCT)
1212 # define Q_DECL_EXPORT __declspec(dllexport)
1213 # elif defined(QT_VISIBILITY_AVAILABLE)
1214 # define Q_DECL_EXPORT __attribute__((visibility("default")))
1215 # define Q_DECL_HIDDEN __attribute__((visibility("hidden")))
1217 # ifndef Q_DECL_EXPORT
1218 # define Q_DECL_EXPORT
1221 #ifndef Q_DECL_IMPORT
1222 # if defined(Q_OS_WIN) || defined(Q_CC_NOKIAX86) || defined(Q_CC_RVCT)
1223 # define Q_DECL_IMPORT __declspec(dllimport)
1225 # define Q_DECL_IMPORT
1228 #ifndef Q_DECL_HIDDEN
1229 # define Q_DECL_HIDDEN
1234 Create Qt DLL if QT_DLL is defined (Windows and Symbian only)
1237 #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
1238 # if defined(QT_NODLL)
1241 # elif defined(QT_MAKEDLL) /* create a Qt DLL library */
1242 # if defined(QT_DLL)
1245 # if defined(QT_BUILD_CORE_LIB)
1246 # define Q_CORE_EXPORT Q_DECL_EXPORT
1248 # define Q_CORE_EXPORT Q_DECL_IMPORT
1250 # if defined(QT_BUILD_GUI_LIB)
1251 # define Q_GUI_EXPORT Q_DECL_EXPORT
1253 # define Q_GUI_EXPORT Q_DECL_IMPORT
1255 # if defined(QT_BUILD_WIDGETS_LIB)
1256 # define Q_WIDGETS_EXPORT Q_DECL_EXPORT
1258 # define Q_WIDGETS_EXPORT Q_DECL_IMPORT
1260 # if defined(QT_BUILD_SQL_LIB)
1261 # define Q_SQL_EXPORT Q_DECL_EXPORT
1263 # define Q_SQL_EXPORT Q_DECL_IMPORT
1265 # if defined(QT_BUILD_NETWORK_LIB)
1266 # define Q_NETWORK_EXPORT Q_DECL_EXPORT
1268 # define Q_NETWORK_EXPORT Q_DECL_IMPORT
1270 # if defined(QT_BUILD_SVG_LIB)
1271 # define Q_SVG_EXPORT Q_DECL_EXPORT
1273 # define Q_SVG_EXPORT Q_DECL_IMPORT
1275 # if defined(QT_BUILD_DECLARATIVE_LIB)
1276 # define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT
1278 # define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT
1280 # if defined(QT_BUILD_OPENGL_LIB)
1281 # define Q_OPENGL_EXPORT Q_DECL_EXPORT
1283 # define Q_OPENGL_EXPORT Q_DECL_IMPORT
1285 # if defined(QT_BUILD_MULTIMEDIA_LIB)
1286 # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT
1288 # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
1290 # if defined(QT_BUILD_OPENVG_LIB)
1291 # define Q_OPENVG_EXPORT Q_DECL_EXPORT
1293 # define Q_OPENVG_EXPORT Q_DECL_IMPORT
1295 # if defined(QT_BUILD_XML_LIB)
1296 # define Q_XML_EXPORT Q_DECL_EXPORT
1298 # define Q_XML_EXPORT Q_DECL_IMPORT
1300 # if defined(QT_BUILD_XMLPATTERNS_LIB)
1301 # define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT
1303 # define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT
1305 # if defined(QT_BUILD_SCRIPT_LIB)
1306 # define Q_SCRIPT_EXPORT Q_DECL_EXPORT
1308 # define Q_SCRIPT_EXPORT Q_DECL_IMPORT
1310 # if defined(QT_BUILD_SCRIPTTOOLS_LIB)
1311 # define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT
1313 # define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT
1315 # if defined(QT_BUILD_CANVAS_LIB)
1316 # define Q_CANVAS_EXPORT Q_DECL_EXPORT
1318 # define Q_CANVAS_EXPORT Q_DECL_IMPORT
1320 # if defined(QT_BUILD_COMPAT_LIB)
1321 # define Q_COMPAT_EXPORT Q_DECL_EXPORT
1323 # define Q_COMPAT_EXPORT Q_DECL_IMPORT
1325 # if defined(QT_BUILD_DBUS_LIB)
1326 # define Q_DBUS_EXPORT Q_DECL_EXPORT
1328 # define Q_DBUS_EXPORT Q_DECL_IMPORT
1330 # if defined(QT_BUILD_LOCATION_LIB)
1331 # define Q_LOCATION_EXPORT Q_DECL_EXPORT
1333 # define Q_LOCATION_EXPORT Q_DECL_IMPORT
1335 # if defined(QT_BUILD_SENSORS_LIB)
1336 # define Q_SENSORS_EXPORT Q_DECL_EXPORT
1338 # define Q_SENSORS_EXPORT Q_DECL_IMPORT
1340 # define Q_TEMPLATEDLL
1341 # elif defined(QT_DLL) /* use a Qt DLL library */
1342 # define Q_CORE_EXPORT Q_DECL_IMPORT
1343 # define Q_GUI_EXPORT Q_DECL_IMPORT
1344 # define Q_WIDGETS_EXPORT Q_DECL_IMPORT
1345 # define Q_SQL_EXPORT Q_DECL_IMPORT
1346 # define Q_NETWORK_EXPORT Q_DECL_IMPORT
1347 # define Q_SVG_EXPORT Q_DECL_IMPORT
1348 # define Q_DECLARATIVE_EXPORT Q_DECL_IMPORT
1349 # define Q_CANVAS_EXPORT Q_DECL_IMPORT
1350 # define Q_OPENGL_EXPORT Q_DECL_IMPORT
1351 # define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
1352 # define Q_OPENVG_EXPORT Q_DECL_IMPORT
1353 # define Q_XML_EXPORT Q_DECL_IMPORT
1354 # define Q_XMLPATTERNS_EXPORT Q_DECL_IMPORT
1355 # define Q_SCRIPT_EXPORT Q_DECL_IMPORT
1356 # define Q_SCRIPTTOOLS_EXPORT Q_DECL_IMPORT
1357 # define Q_COMPAT_EXPORT Q_DECL_IMPORT
1358 # define Q_DBUS_EXPORT Q_DECL_IMPORT
1359 # define Q_LOCATION_EXPORT Q_DECL_IMPORT
1360 # define Q_SENSORS_EXPORT Q_DECL_IMPORT
1361 # define Q_TEMPLATEDLL
1363 # define Q_NO_DECLARED_NOT_DEFINED
1365 # if defined(Q_OS_LINUX) && defined(Q_CC_BOR)
1366 # define Q_TEMPLATEDLL
1367 # define Q_NO_DECLARED_NOT_DEFINED
1369 # undef QT_MAKEDLL /* ignore these for other platforms */
1373 #if !defined(Q_CORE_EXPORT)
1374 # if defined(QT_SHARED)
1375 # define Q_CORE_EXPORT Q_DECL_EXPORT
1376 # define Q_GUI_EXPORT Q_DECL_EXPORT
1377 # define Q_WIDGETS_EXPORT Q_DECL_EXPORT
1378 # define Q_SQL_EXPORT Q_DECL_EXPORT
1379 # define Q_NETWORK_EXPORT Q_DECL_EXPORT
1380 # define Q_SVG_EXPORT Q_DECL_EXPORT
1381 # define Q_DECLARATIVE_EXPORT Q_DECL_EXPORT
1382 # define Q_OPENGL_EXPORT Q_DECL_EXPORT
1383 # define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT
1384 # define Q_OPENVG_EXPORT Q_DECL_EXPORT
1385 # define Q_XML_EXPORT Q_DECL_EXPORT
1386 # define Q_XMLPATTERNS_EXPORT Q_DECL_EXPORT
1387 # define Q_SCRIPT_EXPORT Q_DECL_EXPORT
1388 # define Q_SCRIPTTOOLS_EXPORT Q_DECL_EXPORT
1389 # define Q_COMPAT_EXPORT Q_DECL_EXPORT
1390 # define Q_DBUS_EXPORT Q_DECL_EXPORT
1391 # define Q_LOCATION_EXPORT Q_DECL_EXPORT
1392 # define Q_SENSORS_EXPORT Q_DECL_EXPORT
1394 # define Q_CORE_EXPORT
1395 # define Q_GUI_EXPORT
1396 # define Q_WIDGETS_EXPORT
1397 # define Q_SQL_EXPORT
1398 # define Q_NETWORK_EXPORT
1399 # define Q_SVG_EXPORT
1400 # define Q_DECLARATIVE_EXPORT
1401 # define Q_OPENGL_EXPORT
1402 # define Q_MULTIMEDIA_EXPORT
1403 # define Q_XML_EXPORT
1404 # define Q_XMLPATTERNS_EXPORT
1405 # define Q_SCRIPT_EXPORT
1406 # define Q_SCRIPTTOOLS_EXPORT
1407 # define Q_COMPAT_EXPORT
1408 # define Q_DBUS_EXPORT
1409 # define Q_LOCATION_EXPORT
1410 # define Q_SENSORS_EXPORT
1414 // Functions marked as Q_GUI_EXPORT_INLINE were exported and inlined by mistake.
1415 // Compilers like MinGW complain that the import attribute is ignored.
1416 #if defined(Q_CC_MINGW)
1417 # if defined(QT_BUILD_CORE_LIB)
1418 # define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline
1420 # define Q_CORE_EXPORT_INLINE inline
1422 # if defined(QT_BUILD_GUI_LIB)
1423 # define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline
1425 # define Q_GUI_EXPORT_INLINE inline
1427 # if defined(QT_BUILD_WIDGETS_LIB)
1428 # define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline
1430 # define Q_WIDGETS_EXPORT_INLINE inline
1432 # if defined(QT_BUILD_COMPAT_LIB)
1433 # define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline
1435 # define Q_COMPAT_EXPORT_INLINE inline
1437 #elif defined(Q_CC_RVCT)
1438 // we force RVCT not to export inlines by passing --visibility_inlines_hidden
1439 // so we need to just inline it, rather than exporting and inlining
1440 // note: this affects the contents of the DEF files (ie. these functions do not appear)
1441 # define Q_CORE_EXPORT_INLINE inline
1442 # define Q_GUI_EXPORT_INLINE inline
1443 # define Q_WIDGETS_EXPORT_INLINE inline
1444 # define Q_COMPAT_EXPORT_INLINE inline
1446 # define Q_CORE_EXPORT_INLINE Q_CORE_EXPORT inline
1447 # define Q_GUI_EXPORT_INLINE Q_GUI_EXPORT inline
1448 # define Q_WIDGETS_EXPORT_INLINE Q_WIDGETS_EXPORT inline
1449 # define Q_COMPAT_EXPORT_INLINE Q_COMPAT_EXPORT inline
1453 No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols
1454 for Qt's internal unit tests. If you want slower loading times and more
1455 symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL.
1457 #if defined(QT_BUILD_INTERNAL) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_MAKEDLL)
1458 # define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
1459 #elif defined(QT_BUILD_INTERNAL) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_DLL)
1460 # define Q_AUTOTEST_EXPORT Q_DECL_IMPORT
1461 #elif defined(QT_BUILD_INTERNAL) && !(defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_SHARED)
1462 # define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
1464 # define Q_AUTOTEST_EXPORT
1467 inline void qt_noop(void) {}
1469 /* These wrap try/catch so we can switch off exceptions later.
1471 Beware - do not use more than one QT_CATCH per QT_TRY, and do not use
1472 the exception instance in the catch block.
1473 If you can't live with those constraints, don't use these macros.
1474 Use the QT_NO_EXCEPTIONS macro to protect your code instead.
1477 #ifdef QT_BOOTSTRAPPED
1478 # define QT_NO_EXCEPTIONS
1480 #if !defined(QT_NO_EXCEPTIONS) && defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN)
1481 # define QT_NO_EXCEPTIONS
1484 #ifdef QT_NO_EXCEPTIONS
1485 # define QT_TRY if (true)
1486 # define QT_CATCH(A) else
1487 # define QT_THROW(A) qt_noop()
1488 # define QT_RETHROW qt_noop()
1491 # define QT_CATCH(A) catch (A)
1492 # define QT_THROW(A) throw A
1493 # define QT_RETHROW throw
1501 class Q_CORE_EXPORT QSysInfo {
1504 WordSize = (sizeof(void *)<<3)
1507 #if defined(QT_BUILD_QMAKE)
1512 /* needed to bootstrap qmake */
1513 static const int ByteOrder;
1514 #elif defined(Q_BYTE_ORDER)
1520 , ByteOrder = <platform-dependent>
1521 # elif Q_BYTE_ORDER == Q_BIG_ENDIAN
1522 , ByteOrder = BigEndian
1523 # elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN
1524 , ByteOrder = LittleEndian
1526 # error "Undefined byte order"
1530 # error "Qt not configured correctly, please run configure"
1532 #if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN)
1538 WV_DOS_based= 0x000f,
1546 WV_WINDOWS7 = 0x0090,
1547 WV_NT_based = 0x00f0,
1549 /* version numbers */
1555 WV_6_1 = WV_WINDOWS7,
1561 WV_CE_based = 0x0f00
1563 static const WinVersion WindowsVersion;
1564 static WinVersion windowsVersion();
1569 MV_Unknown = 0x0000,
1583 MV_CHEETAH = MV_10_0,
1585 MV_JAGUAR = MV_10_2,
1586 MV_PANTHER = MV_10_3,
1588 MV_LEOPARD = MV_10_5,
1589 MV_SNOWLEOPARD = MV_10_6,
1592 static const MacVersion MacintoshVersion;
1595 enum SymbianVersion {
1596 SV_Unknown = 1000000, // Assume unknown is something newer than what is supported
1597 //These are the Symbian Ltd versions 9.2-9.4
1601 //Following values are the symbian foundation versions, i.e. Symbian^1 == SV_SF_1
1605 SV_SF_4 = 60, // Deprecated
1609 static SymbianVersion symbianVersion();
1612 SV_S60_Unknown = SV_Unknown,
1613 SV_S60_3_1 = SV_9_2,
1614 SV_S60_3_2 = SV_9_3,
1615 SV_S60_5_0 = SV_9_4,
1616 SV_S60_5_1 = SV_SF_2, // Deprecated
1617 SV_S60_5_2 = SV_SF_3,
1618 SV_S60_5_3 = SV_API_5_3,
1619 SV_S60_5_4 = SV_API_5_4
1621 static S60Version s60Version();
1625 Q_CORE_EXPORT const char *qVersion();
1626 Q_CORE_EXPORT bool qSharedBuild();
1628 #if defined(Q_OS_MAC)
1629 inline int qMacVersion() { return QSysInfo::MacintoshVersion; }
1632 #ifndef Q_OUTOFLINE_TEMPLATE
1633 # define Q_OUTOFLINE_TEMPLATE
1635 #ifndef Q_INLINE_TEMPLATE
1636 # define Q_INLINE_TEMPLATE inline
1640 # define Q_TYPENAME typename
1644 Avoid "unused parameter" warnings
1647 #if defined(Q_CC_INTEL) && !defined(Q_OS_WIN) || defined(Q_CC_RVCT)
1648 template <typename T>
1649 inline void qUnused(T &x) { (void)x; }
1650 # define Q_UNUSED(x) qUnused(x);
1652 # define Q_UNUSED(x) (void)x;
1656 Debugging and error handling
1660 On Symbian we do not know beforehand whether we are compiling in
1661 release or debug mode, so check the Symbian build define here,
1662 and set the QT_NO_DEBUG define appropriately.
1664 #if defined(Q_OS_SYMBIAN) && defined(NDEBUG) && !defined(QT_NO_DEBUG)
1665 # define QT_NO_DEBUG
1668 #if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
1673 # define qPrintable(string) QString(string).toLocal8Bit().constData()
1676 Q_CORE_EXPORT void qDebug(const char *, ...) /* print debug message */
1677 #if defined(Q_CC_GNU) && !defined(__INSURE__)
1678 __attribute__ ((format (printf, 1, 2)))
1682 Q_CORE_EXPORT void qWarning(const char *, ...) /* print warning message */
1683 #if defined(Q_CC_GNU) && !defined(__INSURE__)
1684 __attribute__ ((format (printf, 1, 2)))
1689 Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
1690 Q_CORE_EXPORT void qCritical(const char *, ...) /* print critical message */
1691 #if defined(Q_CC_GNU) && !defined(__INSURE__)
1692 __attribute__ ((format (printf, 1, 2)))
1695 Q_CORE_EXPORT void qFatal(const char *, ...) /* print fatal message and exit */
1696 #if defined(Q_CC_GNU) && !defined(__INSURE__)
1697 __attribute__ ((format (printf, 1, 2)))
1701 Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);
1702 Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
1704 #if (defined(QT_NO_DEBUG_OUTPUT) || defined(QT_NO_TEXTSTREAM)) && !defined(QT_NO_DEBUG_STREAM)
1705 #define QT_NO_DEBUG_STREAM
1709 Forward declarations only.
1711 In order to use the qDebug() stream, you must #include<QDebug>
1715 #ifndef QT_NO_DEBUG_STREAM
1716 Q_CORE_EXPORT_INLINE QDebug qDebug();
1717 Q_CORE_EXPORT_INLINE QDebug qWarning();
1718 Q_CORE_EXPORT_INLINE QDebug qCritical();
1720 inline QNoDebug qDebug();
1723 #define QT_NO_QDEBUG_MACRO while (false) qDebug
1724 #ifdef QT_NO_DEBUG_OUTPUT
1725 # define qDebug QT_NO_QDEBUG_MACRO
1727 #define QT_NO_QWARNING_MACRO while (false) qWarning
1728 #ifdef QT_NO_WARNING_OUTPUT
1729 # define qWarning QT_NO_QWARNING_MACRO
1733 Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);
1735 #if !defined(Q_ASSERT)
1736 # ifndef QT_NO_DEBUG
1737 # define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop())
1739 # define Q_ASSERT(cond) qt_noop()
1743 #if defined(QT_NO_DEBUG) && !defined(QT_PAINT_DEBUG)
1744 #define QT_NO_PAINT_DEBUG
1747 Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line);
1749 #if !defined(Q_ASSERT_X)
1750 # ifndef QT_NO_DEBUG
1751 # define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop())
1753 # define Q_ASSERT_X(cond, where, what) qt_noop()
1757 Q_CORE_EXPORT void qt_check_pointer(const char *, int);
1758 Q_CORE_EXPORT void qBadAlloc();
1760 #ifdef QT_NO_EXCEPTIONS
1761 # if defined(QT_NO_DEBUG)
1762 # define Q_CHECK_PTR(p) qt_noop()
1764 # define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0)
1767 # define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0)
1770 template <typename T>
1771 inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; }
1773 #if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB)
1774 # define Q_FUNC_INFO __PRETTY_FUNCTION__
1775 #elif defined(_MSC_VER)
1776 # define Q_FUNC_INFO __FUNCSIG__
1778 # if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC) || defined(Q_OS_SYMBIAN)
1779 # define Q_FUNC_INFO __FILE__ "(line number unavailable)"
1781 /* These two macros makes it possible to turn the builtin line expander into a
1782 * string literal. */
1783 # define QT_STRINGIFY2(x) #x
1784 # define QT_STRINGIFY(x) QT_STRINGIFY2(x)
1785 # define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__)
1787 /* The MIPSpro and RVCT compilers postpones macro expansion,
1788 and therefore macros must be in scope when being used. */
1789 # if !defined(Q_CC_MIPS) && !defined(Q_CC_RVCT) && !defined(Q_CC_NOKIAX86)
1790 # undef QT_STRINGIFY2
1791 # undef QT_STRINGIFY
1795 enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg };
1797 Q_CORE_EXPORT void qt_message_output(QtMsgType, const char *buf);
1799 typedef void (*QtMsgHandler)(QtMsgType, const char *);
1800 Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
1802 #if !defined(Q_UNIMPLEMENTED)
1803 # define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO)
1806 #if defined(QT_NO_THREAD)
1808 template <typename T>
1813 inline QGlobalStatic(T *p) : pointer(p) { }
1814 inline ~QGlobalStatic() { pointer = 0; }
1817 #define Q_GLOBAL_STATIC(TYPE, NAME) \
1818 static TYPE *NAME() \
1820 static TYPE thisVariable; \
1821 static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \
1822 return thisGlobalStatic.pointer; \
1825 #define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
1826 static TYPE *NAME() \
1828 static TYPE thisVariable ARGS; \
1829 static QGlobalStatic<TYPE > thisGlobalStatic(&thisVariable); \
1830 return thisGlobalStatic.pointer; \
1833 #define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \
1834 static TYPE *NAME() \
1836 static TYPE thisVariable; \
1837 static QGlobalStatic<TYPE > thisGlobalStatic(0); \
1838 if (!thisGlobalStatic.pointer) { \
1839 TYPE *x = thisGlobalStatic.pointer = &thisVariable; \
1842 return thisGlobalStatic.pointer; \
1847 // forward declaration, since qatomic.h needs qglobal.h
1848 template <typename T> class QBasicAtomicPointer;
1850 // POD for Q_GLOBAL_STATIC
1851 template <typename T>
1855 QBasicAtomicPointer<T> pointer;
1859 // Created as a function-local static to delete a QGlobalStatic<T>
1860 template <typename T>
1861 class QGlobalStaticDeleter
1864 QGlobalStatic<T> &globalStatic;
1865 QGlobalStaticDeleter(QGlobalStatic<T> &_globalStatic)
1866 : globalStatic(_globalStatic)
1869 inline ~QGlobalStaticDeleter()
1871 delete globalStatic.pointer;
1872 globalStatic.pointer = 0;
1873 globalStatic.destroyed = true;
1877 #define Q_GLOBAL_STATIC(TYPE, NAME) \
1878 static TYPE *NAME() \
1880 static QGlobalStatic<TYPE > thisGlobalStatic \
1881 = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \
1882 if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \
1883 TYPE *x = new TYPE; \
1884 if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \
1887 static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
1889 return thisGlobalStatic.pointer; \
1892 #define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
1893 static TYPE *NAME() \
1895 static QGlobalStatic<TYPE > thisGlobalStatic \
1896 = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \
1897 if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \
1898 TYPE *x = new TYPE ARGS; \
1899 if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \
1902 static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
1904 return thisGlobalStatic.pointer; \
1907 #define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \
1908 static TYPE *NAME() \
1910 static QGlobalStatic<TYPE > thisGlobalStatic \
1911 = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \
1912 if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \
1913 QScopedPointer<TYPE > x(new TYPE); \
1915 if (thisGlobalStatic.pointer.testAndSetOrdered(0, x.data())) { \
1916 static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \
1920 return thisGlobalStatic.pointer; \
1930 inline explicit QBool(bool B) : b(B) {}
1931 inline operator const void *() const
1932 { return b ? static_cast<const void *>(this) : static_cast<const void *>(0); }
1935 inline bool operator==(QBool b1, bool b2) { return !b1 == !b2; }
1936 inline bool operator==(bool b1, QBool b2) { return !b1 == !b2; }
1937 inline bool operator==(QBool b1, QBool b2) { return !b1 == !b2; }
1938 inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; }
1939 inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; }
1940 inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; }
1942 Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
1944 return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2)));
1947 Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
1949 return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
1955 Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
1957 return qAbs(d) <= 0.000000000001;
1963 Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
1965 return qAbs(f) <= 0.00001f;
1969 This function tests a double for a null value. It doesn't
1970 check whether the actual value is 0 or close to 0, but whether
1973 static inline bool qIsNull(double d)
1981 return val.u == quint64(0);
1985 This function tests a float for a null value. It doesn't
1986 check whether the actual value is 0 or close to 0, but whether
1989 static inline bool qIsNull(float f)
2001 Compilers which follow outdated template instantiation rules
2002 require a class to have a comparison operator to exist when
2003 a QList of this type is instantiated. It's not actually
2004 used in the list, though. Hence the dummy implementation.
2005 Just in case other code relies on it we better trigger a warning
2006 mandating a real implementation.
2009 #ifdef Q_FULL_TEMPLATE_INSTANTIATION
2010 # define Q_DUMMY_COMPARISON_OPERATOR(C) \
2011 bool operator==(const C&) const { \
2012 qWarning(#C"::operator==(const "#C"&) was called"); \
2016 # define Q_DUMMY_COMPARISON_OPERATOR(C)
2021 QTypeInfo - type trait functionality
2022 qIsDetached - data sharing functionality
2026 The catch-all template.
2029 template <typename T> inline bool qIsDetached(T &) { return true; }
2031 template <typename T>
2039 isLarge = (sizeof(T)>sizeof(void*)),
2044 template <typename T>
2058 Specialize a specific type with:
2060 Q_DECLARE_TYPEINFO(type, flags);
2062 where 'type' is the name of the type to specialize and 'flags' is
2063 logically-OR'ed combination of the flags below.
2065 enum { /* TYPEINFO flags */
2067 Q_PRIMITIVE_TYPE = 0x1,
2069 Q_MOVABLE_TYPE = 0x2,
2073 #define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) \
2074 class QTypeInfo<TYPE > \
2078 isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0), \
2079 isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \
2080 isLarge = (sizeof(TYPE)>sizeof(void*)), \
2081 isPointer = false, \
2082 isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0) \
2084 static inline const char *name() { return #TYPE; } \
2087 #define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \
2089 Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS)
2092 template <typename T>
2093 inline void qSwap(T &value1, T &value2)
2101 swap(value1, value2);
2106 Specialize a shared type with:
2108 Q_DECLARE_SHARED(type);
2110 where 'type' is the name of the type to specialize. NOTE: shared
2111 types must declare a 'bool isDetached(void) const;' member for this
2115 #define Q_DECLARE_SHARED_STL(TYPE)
2117 #define Q_DECLARE_SHARED_STL(TYPE) \
2120 template<> inline void swap<QT_PREPEND_NAMESPACE(TYPE)>(QT_PREPEND_NAMESPACE(TYPE) &value1, QT_PREPEND_NAMESPACE(TYPE) &value2) \
2121 { swap(value1.data_ptr(), value2.data_ptr()); } \
2126 #define Q_DECLARE_SHARED(TYPE) \
2127 template <> inline bool qIsDetached<TYPE>(TYPE &t) { return t.isDetached(); } \
2128 template <> inline void qSwap<TYPE>(TYPE &value1, TYPE &value2) \
2129 { qSwap(value1.data_ptr(), value2.data_ptr()); } \
2130 Q_DECLARE_SHARED_STL(TYPE)
2133 QTypeInfo primitive specializations
2135 Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE);
2136 Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE);
2137 Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE);
2138 Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE);
2139 Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE);
2140 Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE);
2141 Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE);
2142 Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE);
2143 Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE);
2144 Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE);
2145 Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE);
2146 Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE);
2147 Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE);
2148 Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE);
2150 Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE);
2154 These functions make it possible to use standard C++ functions with
2155 a similar name from Qt header files (especially template classes).
2157 Q_CORE_EXPORT void *qMalloc(size_t size);
2158 Q_CORE_EXPORT void qFree(void *ptr);
2159 Q_CORE_EXPORT void *qRealloc(void *ptr, size_t size);
2160 Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment);
2161 Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment);
2162 Q_CORE_EXPORT void qFreeAligned(void *ptr);
2163 Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n);
2164 Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);
2168 Avoid some particularly useless warnings from some stupid compilers.
2169 To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
2170 the line "#define QT_NO_WARNINGS".
2172 #if !defined(QT_CC_WARNINGS)
2173 # define QT_NO_WARNINGS
2175 #if defined(QT_NO_WARNINGS)
2176 # if defined(Q_CC_MSVC)
2177 # pragma warning(disable: 4251) /* class 'A' needs to have dll interface for to be used by clients of class 'B'. */
2178 # pragma warning(disable: 4244) /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */
2179 # pragma warning(disable: 4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
2180 # pragma warning(disable: 4514) /* unreferenced inline/local function has been removed */
2181 # pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
2182 # pragma warning(disable: 4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
2183 # pragma warning(disable: 4706) /* assignment within conditional expression */
2184 # pragma warning(disable: 4786) /* truncating debug info after 255 characters */
2185 # pragma warning(disable: 4660) /* template-class specialization 'identifier' is already instantiated */
2186 # pragma warning(disable: 4355) /* 'this' : used in base member initializer list */
2187 # pragma warning(disable: 4231) /* nonstandard extension used : 'extern' before template explicit instantiation */
2188 # pragma warning(disable: 4710) /* function not inlined */
2189 # pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify -GX */
2190 # elif defined(Q_CC_BOR)
2191 # pragma option -w-inl
2192 # pragma option -w-aus
2201 class Q_CORE_EXPORT QFlag
2205 inline QFlag(int i);
2206 inline operator int() const { return i; }
2209 inline QFlag::QFlag(int ai) : i(ai) {}
2211 class Q_CORE_EXPORT QIncompatibleFlag
2215 inline explicit QIncompatibleFlag(int i);
2216 inline operator int() const { return i; }
2219 inline QIncompatibleFlag::QIncompatibleFlag(int ai) : i(ai) {}
2222 #ifndef Q_NO_TYPESAFE_FLAGS
2224 template<typename Enum>
2227 typedef void **Zero;
2230 typedef Enum enum_type;
2231 Q_DECL_CONSTEXPR inline QFlags(const QFlags &f) : i(f.i) {}
2232 Q_DECL_CONSTEXPR inline QFlags(Enum f) : i(f) {}
2233 Q_DECL_CONSTEXPR inline QFlags(Zero = 0) : i(0) {}
2234 inline QFlags(QFlag f) : i(f) {}
2236 inline QFlags &operator=(const QFlags &f) { i = f.i; return *this; }
2237 inline QFlags &operator&=(int mask) { i &= mask; return *this; }
2238 inline QFlags &operator&=(uint mask) { i &= mask; return *this; }
2239 inline QFlags &operator|=(QFlags f) { i |= f.i; return *this; }
2240 inline QFlags &operator|=(Enum f) { i |= f; return *this; }
2241 inline QFlags &operator^=(QFlags f) { i ^= f.i; return *this; }
2242 inline QFlags &operator^=(Enum f) { i ^= f; return *this; }
2244 Q_DECL_CONSTEXPR inline operator int() const { return i; }
2246 Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const { return QFlags(Enum(i | f.i)); }
2247 Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const { return QFlags(Enum(i | f)); }
2248 Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const { return QFlags(Enum(i ^ f.i)); }
2249 Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const { return QFlags(Enum(i ^ f)); }
2250 Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const { return QFlags(Enum(i & mask)); }
2251 Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const { return QFlags(Enum(i & mask)); }
2252 Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const { return QFlags(Enum(i & f)); }
2253 Q_DECL_CONSTEXPR inline QFlags operator~() const { return QFlags(Enum(~i)); }
2255 Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
2257 inline bool testFlag(Enum f) const { return (i & f) == f && (f != 0 || i == int(f) ); }
2260 #define Q_DECLARE_FLAGS(Flags, Enum)\
2261 typedef QFlags<Enum> Flags;
2263 #define Q_DECLARE_INCOMPATIBLE_FLAGS(Flags) \
2264 inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) \
2265 { return QIncompatibleFlag(int(f1) | f2); }
2267 #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \
2268 Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \
2269 { return QFlags<Flags::enum_type>(f1) | f2; } \
2270 Q_DECL_CONSTEXPR inline QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \
2271 { return f2 | f1; } Q_DECLARE_INCOMPATIBLE_FLAGS(Flags)
2274 #else /* Q_NO_TYPESAFE_FLAGS */
2276 #define Q_DECLARE_FLAGS(Flags, Enum)\
2278 #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
2280 #endif /* Q_NO_TYPESAFE_FLAGS */
2282 #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT)
2283 /* make use of typeof-extension */
2284 template <typename T>
2285 class QForeachContainer {
2287 inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { }
2290 typename T::const_iterator i, e;
2293 #define Q_FOREACH(variable, container) \
2294 for (QForeachContainer<__typeof__(container)> _container_(container); \
2295 !_container_.brk && _container_.i != _container_.e; \
2296 __extension__ ({ ++_container_.brk; ++_container_.i; })) \
2297 for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;}))
2301 struct QForeachContainerBase {};
2303 template <typename T>
2304 class QForeachContainer : public QForeachContainerBase {
2306 inline QForeachContainer(const T& t): c(t), brk(0), i(c.begin()), e(c.end()){};
2309 mutable typename T::const_iterator i, e;
2310 inline bool condition() const { return (!brk++ && i != e); }
2313 template <typename T> inline T *qForeachPointer(const T &) { return 0; }
2315 template <typename T> inline QForeachContainer<T> qForeachContainerNew(const T& t)
2316 { return QForeachContainer<T>(t); }
2318 template <typename T>
2319 inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase *base, const T *)
2320 { return static_cast<const QForeachContainer<T> *>(base); }
2322 #if defined(Q_CC_MIPS)
2324 Proper for-scoping in MIPSpro CC
2326 # define Q_FOREACH(variable,container) \
2328 for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \
2329 qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \
2330 ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \
2331 for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \
2332 qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \
2333 --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk)
2335 #elif defined(Q_CC_DIAB)
2336 // VxWorks DIAB generates unresolvable symbols, if container is a function call
2337 # define Q_FOREACH(variable,container) \
2339 for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \
2340 qForeachContainer(&_container_, (__typeof__(container) *) 0)->condition(); \
2341 ++qForeachContainer(&_container_, (__typeof__(container) *) 0)->i) \
2342 for (variable = *qForeachContainer(&_container_, (__typeof__(container) *) 0)->i; \
2343 qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk; \
2344 --qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk)
2347 # define Q_FOREACH(variable, container) \
2348 for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \
2349 qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition(); \
2350 ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i) \
2351 for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \
2352 qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \
2353 --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk)
2354 #endif // MSVC6 || MIPSpro
2358 #define Q_FOREVER for(;;)
2359 #ifndef QT_NO_KEYWORDS
2361 # define foreach Q_FOREACH
2364 # define forever Q_FOREVER
2369 /* tell gcc to use its built-in methods for some common functions */
2370 #if defined(QT_NO_DEBUG) && defined(Q_CC_GNU)
2371 # define qMemCopy __builtin_memcpy
2372 # define qMemSet __builtin_memset
2376 template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; }
2377 template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.data(); }
2379 #define Q_DECLARE_PRIVATE(Class) \
2380 inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr)); } \
2381 inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \
2382 friend class Class##Private;
2384 #define Q_DECLARE_PRIVATE_D(Dptr, Class) \
2385 inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(Dptr); } \
2386 inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(Dptr); } \
2387 friend class Class##Private;
2389 #define Q_DECLARE_PUBLIC(Class) \
2390 inline Class* q_func() { return static_cast<Class *>(q_ptr); } \
2391 inline const Class* q_func() const { return static_cast<const Class *>(q_ptr); } \
2394 #define Q_D(Class) Class##Private * const d = d_func()
2395 #define Q_Q(Class) Class * const q = q_func()
2397 #define QT_TR_NOOP(x) (x)
2398 #define QT_TR_NOOP_UTF8(x) (x)
2399 #define QT_TRANSLATE_NOOP(scope, x) (x)
2400 #define QT_TRANSLATE_NOOP_UTF8(scope, x) (x)
2401 #define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment}
2402 #define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment}
2404 #ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above
2406 // Defined in qcoreapplication.cpp
2407 // The better name qTrId() is reserved for an upcoming function which would
2408 // return a much more powerful QStringFormatter instead of a QString.
2409 Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
2411 #define QT_TRID_NOOP(id) id
2413 #endif // QT_NO_TRANSLATION
2415 #define QDOC_PROPERTY(text)
2418 When RTTI is not available, define this macro to force any uses of
2419 dynamic_cast to cause a compile failure.
2422 #ifdef QT_NO_DYNAMIC_CAST
2423 # define dynamic_cast QT_PREPEND_NAMESPACE(qt_dynamic_cast_check)
2425 template<typename T, typename X>
2426 T qt_dynamic_cast_check(X, T* = 0)
2427 { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; }
2431 Some classes do not permit copies to be made of an object. These
2432 classes contains a private copy constructor and assignment
2433 operator to disable copying (the compiler gives an error message).
2435 #ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS
2436 #define Q_DISABLE_COPY(Class) \
2437 Class(const Class &) = delete;\
2438 Class &operator=(const Class &) = delete;
2440 #define Q_DISABLE_COPY(Class) \
2441 Class(const Class &); \
2442 Class &operator=(const Class &);
2446 Q_CORE_EXPORT QByteArray qgetenv(const char *varName);
2447 Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value);
2449 inline int qIntCast(double f) { return int(f); }
2450 inline int qIntCast(float f) { return int(f); }
2453 Reentrant versions of basic rand() functions for random number generation
2455 Q_CORE_EXPORT void qsrand(uint seed);
2456 Q_CORE_EXPORT int qrand();
2458 #if defined(Q_OS_SYMBIAN)
2460 #ifdef SYMBIAN_BUILD_GCE
2461 #define Q_SYMBIAN_SUPPORTS_SURFACES
2462 //RWsPointerCursor is fixed, so don't use low performance sprites
2463 #define Q_SYMBIAN_FIXED_POINTER_CURSORS
2464 #define Q_SYMBIAN_HAS_EXTENDED_BITMAP_TYPE
2465 #define Q_SYMBIAN_WINDOW_SIZE_CACHE
2466 #define QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
2468 //enabling new graphics resources
2469 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
2470 # define QT_SYMBIAN_SUPPORTS_SGIMAGE
2473 #ifdef SYMBIAN_GRAPHICS_SET_SURFACE_TRANSPARENCY_AVAILABLE
2474 # define Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
2477 #ifdef SYMBIAN_GRAPHICS_TRANSITION_EFFECTS_SIGNALING_AVAILABLE
2478 # define Q_SYMBIAN_TRANSITION_EFFECTS
2482 #ifdef SYMBIAN_WSERV_AND_CONE_MULTIPLE_SCREENS
2483 #define Q_SYMBIAN_SUPPORTS_MULTIPLE_SCREENS
2486 #ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
2487 #define Q_SYMBIAN_SUPPORTS_FIXNATIVEORIENTATION
2490 //Symbian does not support data imports from a DLL
2491 #define Q_NO_DATA_RELOCATION
2494 // forward declare std::exception
2496 namespace std { class exception; }
2499 Q_CORE_EXPORT void qt_symbian_throwIfError(int error);
2500 Q_CORE_EXPORT void qt_symbian_exception2LeaveL(const std::exception& ex);
2501 Q_CORE_EXPORT int qt_symbian_exception2Error(const std::exception& ex);
2503 #define QT_TRAP_THROWING(_f) \
2506 TRAP(____error, _f); \
2507 qt_symbian_throwIfError(____error); \
2510 #define QT_TRYCATCH_ERROR(_err, _f) \
2515 } catch (const std::exception &____ex) { \
2516 _err = qt_symbian_exception2Error(____ex); \
2520 #define QT_TRYCATCH_LEAVING(_f) \
2523 QT_TRYCATCH_ERROR(____err, _f) \
2524 User::LeaveIfError(____err); \
2530 This gives us the possibility to check which modules the user can
2531 use. These are purely compile time checks and will generate no code.
2535 #define QT_MODULE_CORE 0x000001
2536 #define QT_MODULE_GUI 0x000002
2537 #define QT_MODULE_NETWORK 0x000004
2538 #define QT_MODULE_OPENGL 0x000008
2539 #define QT_MODULE_SQL 0x000010
2540 #define QT_MODULE_XML 0x000020
2541 #define QT_MODULE_SVG 0x000100
2542 #define QT_MODULE_ACTIVEQT 0x000200
2543 #define QT_MODULE_GRAPHICSVIEW 0x000400
2544 #define QT_MODULE_SCRIPT 0x000800
2545 #define QT_MODULE_XMLPATTERNS 0x001000
2546 #define QT_MODULE_HELP 0x002000
2547 #define QT_MODULE_TEST 0x004000
2548 #define QT_MODULE_DBUS 0x008000
2549 #define QT_MODULE_SCRIPTTOOLS 0x010000
2550 #define QT_MODULE_OPENVG 0x020000
2551 #define QT_MODULE_MULTIMEDIA 0x040000
2552 #define QT_MODULE_DECLARATIVE 0x080000
2553 #define QT_MODULE_LOCATION 0x100000
2554 #define QT_MODULE_SENSORS 0x200000
2557 #define QT_EDITION_CONSOLE (QT_MODULE_CORE \
2558 | QT_MODULE_NETWORK \
2560 | QT_MODULE_SCRIPT \
2561 | QT_MODULE_MULTIMEDIA \
2563 | QT_MODULE_XMLPATTERNS \
2566 #define QT_EDITION_DESKTOPLIGHT (QT_MODULE_CORE \
2570 #define QT_EDITION_OPENSOURCE (QT_MODULE_CORE \
2572 | QT_MODULE_NETWORK \
2573 | QT_MODULE_OPENGL \
2574 | QT_MODULE_OPENVG \
2576 | QT_MODULE_MULTIMEDIA \
2578 | QT_MODULE_XMLPATTERNS \
2579 | QT_MODULE_SCRIPT \
2580 | QT_MODULE_SCRIPTTOOLS \
2582 | QT_MODULE_DECLARATIVE \
2583 | QT_MODULE_GRAPHICSVIEW \
2587 | QT_MODULE_LOCATION \
2588 | QT_MODULE_SENSORS \
2589 | QT_MODULE_ACTIVEQT)
2590 #define QT_EDITION_DESKTOP (QT_EDITION_OPENSOURCE)
2591 #define QT_EDITION_UNIVERSAL QT_EDITION_DESKTOP
2592 #define QT_EDITION_ACADEMIC QT_EDITION_DESKTOP
2593 #define QT_EDITION_EDUCATIONAL QT_EDITION_DESKTOP
2594 #define QT_EDITION_EVALUATION QT_EDITION_DESKTOP
2596 /* Determine which modules can be used */
2598 # ifdef QT_BUILD_QMAKE
2599 # define QT_EDITION QT_EDITION_DESKTOP
2601 # error "Qt not configured correctly, please run configure"
2605 #define QT_LICENSED_MODULE(x) \
2606 enum QtValidLicenseFor##x##Module { Licensed##x = true };
2608 /* qdoc is really unhappy with the following block of preprocessor checks,
2609 making it difficult to document classes properly after this point. */
2611 #if (QT_EDITION & QT_MODULE_CORE)
2612 QT_LICENSED_MODULE(Core)
2614 #if (QT_EDITION & QT_MODULE_GUI)
2615 QT_LICENSED_MODULE(Gui)
2617 #if (QT_EDITION & QT_MODULE_NETWORK)
2618 QT_LICENSED_MODULE(Network)
2620 #if (QT_EDITION & QT_MODULE_OPENGL)
2621 QT_LICENSED_MODULE(OpenGL)
2623 #if (QT_EDITION & QT_MODULE_OPENVG)
2624 QT_LICENSED_MODULE(OpenVG)
2626 #if (QT_EDITION & QT_MODULE_SQL)
2627 QT_LICENSED_MODULE(Sql)
2629 #if (QT_EDITION & QT_MODULE_MULTIMEDIA)
2630 QT_LICENSED_MODULE(Multimedia)
2632 #if (QT_EDITION & QT_MODULE_XML)
2633 QT_LICENSED_MODULE(Xml)
2635 #if (QT_EDITION & QT_MODULE_XMLPATTERNS)
2636 QT_LICENSED_MODULE(XmlPatterns)
2638 #if (QT_EDITION & QT_MODULE_HELP)
2639 QT_LICENSED_MODULE(Help)
2641 #if (QT_EDITION & QT_MODULE_SCRIPT) || defined(QT_BUILD_QMAKE)
2642 QT_LICENSED_MODULE(Script)
2644 #if (QT_EDITION & QT_MODULE_SCRIPTTOOLS)
2645 QT_LICENSED_MODULE(ScriptTools)
2647 #if (QT_EDITION & QT_MODULE_SVG)
2648 QT_LICENSED_MODULE(Svg)
2650 #if (QT_EDITION & QT_MODULE_DECLARATIVE)
2651 QT_LICENSED_MODULE(Declarative)
2653 #if (QT_EDITION & QT_MODULE_ACTIVEQT)
2654 QT_LICENSED_MODULE(ActiveQt)
2656 #if (QT_EDITION & QT_MODULE_TEST)
2657 QT_LICENSED_MODULE(Test)
2659 #if (QT_EDITION & QT_MODULE_DBUS)
2660 QT_LICENSED_MODULE(DBus)
2662 #if (QT_EDITION & QT_MODULE_LOCATION)
2663 QT_LICENSED_MODULE(Location)
2665 #if (QT_EDITION & QT_MODULE_SENSORS)
2666 QT_LICENSED_MODULE(Sensors)
2669 #define QT_MODULE(x) \
2670 typedef QtValidLicenseFor##x##Module Qt##x##Module;
2672 #ifdef QT_NO_CONCURRENT
2673 # define QT_NO_QFUTURE
2676 // gcc 3 version has problems with some of the
2677 // map/filter overloads.
2678 #if defined(Q_CC_GNU) && (__GNUC__ < 4)
2679 # define QT_NO_CONCURRENT_MAP
2680 # define QT_NO_CONCURRENT_FILTER
2684 // QNX doesn't have SYSV style shared memory. Multiprocess QWS apps,
2685 // shared fonts and QSystemSemaphore + QSharedMemory are not available
2686 # define QT_NO_QWS_MULTIPROCESS
2687 # define QT_NO_QWS_SHARE_FONTS
2688 # define QT_NO_SYSTEMSEMAPHORE
2689 # define QT_NO_SHAREDMEMORY
2690 // QNX currently doesn't support forking in a thread, so disable QProcess
2691 # define QT_NO_PROCESS
2694 #if defined (__ELF__)
2695 # if defined (Q_OS_LINUX) || defined (Q_OS_SOLARIS) || defined (Q_OS_FREEBSD) || defined (Q_OS_OPENBSD) || defined (Q_OS_IRIX)
2700 #if !(defined(Q_WS_WIN) && !defined(Q_WS_WINCE)) \
2701 && !(defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) \
2702 && !(defined(Q_WS_X11) && !defined(QT_NO_FREETYPE)) \
2703 && !(defined(Q_WS_QPA))
2704 # define QT_NO_RAWFONT
2707 namespace QtPrivate {
2708 //like std::enable_if
2709 template <bool B, typename T = void> struct QEnableIf;
2710 template <typename T> struct QEnableIf<true, T> { typedef T Type; };
2716 #endif /* __cplusplus */
2718 #endif /* QGLOBAL_H */