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