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