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