1 /****************************************************************************
2 ** $Id: qt/qglobal.h 3.3.8 edited Feb 2 15:00 $
3 **
4 ** Global type declarations and definitions
5 **
6 ** Created : 920529
7 **
8 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
9 **
10 ** This file is part of the tools module of the Qt GUI Toolkit.
11 **
12 ** This file may be distributed under the terms of the Q Public License
13 ** as defined by Trolltech ASA of Norway and appearing in the file
14 ** LICENSE.QPL included in the packaging of this file.
15 **
16 ** This file may be distributed and/or modified under the terms of the
17 ** GNU General Public License version 2 as published by the Free Software
18 ** Foundation and appearing in the file LICENSE.GPL included in the
19 ** packaging of this file.
20 **
21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22 ** licenses may use this file in accordance with the Qt Commercial License
23 ** Agreement provided with the Software.
24 **
25 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27 **
28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29 ** information about Qt Commercial License Agreements.
30 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
31 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
32 **
33 ** Contact info@trolltech.com if any conditions of this licensing are
34 ** not clear to you.
35 **
36 **********************************************************************/
37
38 #ifndef QGLOBAL_H
39 #define QGLOBAL_H
40
41 #define QT_VERSION_STR "3.3.8"
42 /*
43 QT_VERSION is (major << 16) + (minor << 8) + patch.
44 */
45 #define QT_VERSION 0x030308
46
47 /*
48 The operating system, must be one of: (Q_OS_x)
49
50 MACX - Mac OS X
51 MAC9 - Mac OS 9
52 DARWIN - Darwin OS (Without Mac OS X)
53 MSDOS - MS-DOS and Windows
54 OS2 - OS/2
55 OS2EMX - XFree86 on OS/2 (not PM)
56 WIN32 - Win32 (Windows 95/98/ME and Windows NT/2000/XP)
57 CYGWIN - Cygwin
58 SOLARIS - Sun Solaris
59 HPUX - HP-UX
60 ULTRIX - DEC Ultrix
61 LINUX - Linux
62 FREEBSD - FreeBSD
63 NETBSD - NetBSD
64 OPENBSD - OpenBSD
65 BSDI - BSD/OS
66 IRIX - SGI Irix
67 OSF - HP Tru64 UNIX
68 SCO - SCO OpenServer 5
69 UNIXWARE - UnixWare 7, Open UNIX 8
70 AIX - AIX
71 HURD - GNU Hurd
72 DGUX - DG/UX
73 RELIANT - Reliant UNIX
74 DYNIX - DYNIX/ptx
75 QNX - QNX
76 QNX6 - QNX RTP 6.1
77 LYNX - LynxOS
78 BSD4 - Any BSD 4.4 system
79 UNIX - Any UNIX BSD/SYSV system
80 */
81
82 #if defined(__DARWIN_X11__)
83 # define Q_OS_DARWIN
84 #elif defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__))
85 # define Q_OS_MACX
86 #elif defined(__MACOSX__)
87 # define Q_OS_MACX
88 #elif defined(macintosh)
89 # define Q_OS_MAC9
90 #elif defined(__CYGWIN__)
91 # define Q_OS_CYGWIN
92 #elif defined(MSDOS) || defined(_MSDOS)
93 # define Q_OS_MSDOS
94 #elif defined(__OS2__)
95 # if defined(__EMX__)
96 # define Q_OS_OS2EMX
97 # else
98 # define Q_OS_OS2
99 # endif
100 #elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
101 # define Q_OS_WIN32
102 # define Q_OS_WIN64
103 #elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
104 # define Q_OS_WIN32
105 #elif defined(__MWERKS__) && defined(__INTEL__)
106 # define Q_OS_WIN32
107 #elif defined(__sun) || defined(sun)
108 # define Q_OS_SOLARIS
109 #elif defined(hpux) || defined(__hpux)
110 # define Q_OS_HPUX
111 #elif defined(__ultrix) || defined(ultrix)
112 # define Q_OS_ULTRIX
113 #elif defined(sinix)
114 # define Q_OS_RELIANT
115 #elif defined(__linux__) || defined(__linux)
116 # define Q_OS_LINUX
117 #elif defined(__FreeBSD__) || defined(__DragonFly__)
118 # define Q_OS_FREEBSD
119 # define Q_OS_BSD4
120 #elif defined(__NetBSD__)
121 # define Q_OS_NETBSD
122 # define Q_OS_BSD4
123 #elif defined(__OpenBSD__)
124 # define Q_OS_OPENBSD
125 # define Q_OS_BSD4
126 #elif defined(__bsdi__)
127 # define Q_OS_BSDI
128 # define Q_OS_BSD4
129 #elif defined(__sgi)
130 # define Q_OS_IRIX
131 #elif defined(__osf__)
132 # define Q_OS_OSF
133 #elif defined(_AIX)
134 # define Q_OS_AIX
135 #elif defined(__Lynx__)
136 # define Q_OS_LYNX
137 #elif defined(__GNU_HURD__)
138 # define Q_OS_HURD
139 #elif defined(__DGUX__)
140 # define Q_OS_DGUX
141 #elif defined(__QNXNTO__)
142 # define Q_OS_QNX6
143 #elif defined(__QNX__)
144 # define Q_OS_QNX
145 #elif defined(_SEQUENT_)
146 # define Q_OS_DYNIX
147 #elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */
148 # define Q_OS_SCO
149 #elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */
150 # define Q_OS_UNIXWARE
151 # define Q_OS_UNIXWARE7
152 #elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */
153 # define Q_OS_UNIXWARE
154 # define Q_OS_UNIXWARE7
155 #elif defined(__MAKEDEPEND__)
156 #else
157 # error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com"
158 #endif
159
160 #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
161 # define Q_OS_WIN
162 #endif
163
164 #if defined(Q_OS_MAC9) || defined(Q_OS_MACX)
165 # define Q_OS_MAC
166 #endif
167
168 #if defined(Q_OS_MAC9) || defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN)
169 # undef Q_OS_UNIX
170 #elif !defined(Q_OS_UNIX)
171 # define Q_OS_UNIX
172 #endif
173
174 #if defined(Q_OS_MACX)
175 # ifdef MAC_OS_X_VERSION_MIN_REQUIRED
176 # undef MAC_OS_X_VERSION_MIN_REQUIRED
177 # endif
178 # define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_2
179 # include <AvailabilityMacros.h>
180 # if !defined(MAC_OS_X_VERSION_10_3)
181 # define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
182 # endif
183 # if !defined(MAC_OS_X_VERSION_10_4)
184 # define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
185 # endif
186 # if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
187 # error "This version of Mac OS X is unsupported"
188 # endif
189 #endif
190
191
192 /*
193 The compiler, must be one of: (Q_CC_x)
194
195 SYM - Symantec C++ for both PC and Macintosh
196 MPW - MPW C++
197 MWERKS - Metrowerks CodeWarrior
198 MSVC - Microsoft Visual C/C++, Intel C++ for Windows
199 BOR - Borland/Turbo C++
200 WAT - Watcom C++
201 GNU - GNU C++
202 COMEAU - Comeau C++
203 EDG - Edison Design Group C++
204 OC - CenterLine C++
205 SUN - Sun WorkShop, Forte Developer, or Sun ONE Studio C++
206 MIPS - MIPSpro C++
207 DEC - DEC C++
208 HP - HPUX C++
209 HPACC - HPUX ANSI C++
210 USLC - SCO OUDK, UDK, and UnixWare 2.X C++
211 CDS - Reliant C++
212 KAI - KAI C++
213 INTEL - Intel C++ for Linux, Intel C++ for Windows
214 HIGHC - MetaWare High C/C++
215 PGI - Portland Group C++
216 GHS - Green Hills Optimizing C++ Compilers
217
218 Should be sorted most to least authoritative.
219 */
220
221 /* Symantec C++ is now Digital Mars */
222 #if defined(__DMC__) || defined(__SC__)
223 # define Q_CC_SYM
224 /* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */
225 # if defined(__SC__) && __SC__ < 0x750
226 # define Q_NO_EXPLICIT_KEYWORD
227 # endif
228 # define Q_NO_USING_KEYWORD
229 # if !defined(_CPPUNWIND)
230 # define Q_NO_EXCEPTIONS
231 # endif
232
233 #elif defined(applec)
234 # define Q_CC_MPW
235 # define Q_NO_BOOL_TYPE
236 # define Q_NO_EXPLICIT_KEYWORD
237 # define Q_NO_USING_KEYWORD
238
239 #elif defined(__MWERKS__)
240 # define Q_CC_MWERKS
241 /* "explicit" recognized since 4.0d1 */
242 # define QMAC_PASCAL pascal
243
244 #elif defined(_MSC_VER)
245 # define Q_CC_MSVC
246 /* proper support of bool for _MSC_VER >= 1100 */
247 # define Q_CANNOT_DELETE_CONSTANT
248 # define Q_INLINE_TEMPLATES inline
249 /* Visual C++.Net issues for _MSC_VER >= 1300 */
250 # if _MSC_VER >= 1300
251 # define Q_CC_MSVC_NET
252 # if _MSC_VER < 1310 || (defined(Q_OS_WIN64) && defined(_M_IA64))
253 # define Q_TYPENAME
254 # endif
255 # endif
256 /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */
257 # if defined(__INTEL_COMPILER)
258 # define Q_CC_INTEL
259 # if !defined(__EXCEPTIONS)
260 # define Q_NO_EXCEPTIONS
261 # endif
262 # else
263 # define Q_NO_USING_KEYWORD /* ### check "using" status */
264 # endif
265
266 #elif defined(__BORLANDC__) || defined(__TURBOC__)
267 # define Q_CC_BOR
268 # if __BORLANDC__ < 0x502
269 # define Q_NO_BOOL_TYPE
270 # define Q_NO_EXPLICIT_KEYWORD
271 # endif
272 # define Q_NO_USING_KEYWORD /* ### check "using" status */
273
274 #elif defined(__WATCOMC__)
275 # define Q_CC_WAT
276 # if defined(Q_OS_QNX4)
277 /* compiler flags */
278 # define Q_TYPENAME
279 # define Q_NO_BOOL_TYPE
280 # define Q_CANNOT_DELETE_CONSTANT
281 # define mutable
282 /* ??? */
283 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
284 /* no template classes in QVariant */
285 # define QT_NO_TEMPLATE_VARIANT
286 /* Wcc does not fill in functions needed by valuelists, maps, and
287 valuestacks implicitly */
288 # define Q_FULL_TEMPLATE_INSTANTIATION
289 /* can we just compare the structures? */
290 # define Q_FULL_TEMPLATE_INSTANTIATION_MEMCMP
291 /* these are not useful to our customers */
292 # define QT_QWS_NO_SHM
293 # define QT_NO_QWS_MULTIPROCESS
294 # define QT_NO_SQL
295 # define QT_NO_QWS_CURSOR
296 # endif
297
298 #elif defined(__GNUC__)
299 # define Q_CC_GNU
300 # define Q_C_CALLBACKS
301 # if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
302 # define Q_FULL_TEMPLATE_INSTANTIATION
303 # endif
304 /* GCC 2.95 knows "using" but does not support it correctly */
305 # if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
306 # define Q_NO_USING_KEYWORD
307 # endif
308 /* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */
309 # if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1
310 # define Q_WRONG_SB_CTYPE_MACROS
311 # endif
312
313 /* ARM gcc pads structs to 32 bits, even when they contain a single
314 char, or short. We tell gcc to pack QChars to 16 bits, to avoid
315 QString bloat. However, gcc 3.4 doesn't allow us to create references to
316 members of a packed struct. (Pointers are OK, because then you
317 supposedly know what you are doing.) */
318 # if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP)
319 # define Q_PACKED __attribute__ ((packed))
320 # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4
321 # define Q_NO_PACKED_REFERENCE
322 # endif
323 # endif
324 # if !defined(__EXCEPTIONS)
325 # define Q_NO_EXCEPTIONS
326 # endif
327
328 /* IBM compiler versions are a bit messy. There are actually two products:
329 the C product, and the C++ product. The C++ compiler is always packaged
330 with the latest version of the C compiler. Version numbers do not always
331 match. This little table (I'm not sure it's accurate) should be helpful:
332
333 C++ product C product
334
335 C Set 3.1 C Compiler 3.0
336 ... ...
337 C++ Compiler 3.6.6 C Compiler 4.3
338 ... ...
339 Visual Age C++ 4.0 ...
340 ... ...
341 Visual Age C++ 5.0 C Compiler 5.0
342 ... ...
343 Visual Age C++ 6.0 C Compiler 6.0
344
345 Now:
346 __xlC__ is the version of the C compiler in hexadecimal notation
347 is only an approximation of the C++ compiler version
348 __IBMCPP__ is the version of the C++ compiler in decimal notation
349 but it is not defined on older compilers like C Set 3.1 */
350 #elif defined(__xlC__)
351 # define Q_CC_XLC
352 # define Q_FULL_TEMPLATE_INSTANTIATION
353 # if __xlC__ < 0x400
354 # define Q_NO_BOOL_TYPE
355 # define Q_NO_EXPLICIT_KEYWORD
356 # define Q_NO_USING_KEYWORD
357 # define Q_TYPENAME
358 # define Q_INLINE_TEMPLATES inline
359 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
360 # define Q_CANNOT_DELETE_CONSTANT
361 # endif
362
363 /* Older versions of DEC C++ do not define __EDG__ or __EDG - observed
364 on DEC C++ V5.5-004. New versions do define __EDG__ - observed on
365 Compaq C++ V6.3-002.
366 This compiler is different enough from other EDG compilers to handle
367 it separately anyway. */
368 #elif defined(__DECCXX) || defined(__DECC)
369 # define Q_CC_DEC
370 /* Compaq C++ V6 compilers are EDG-based but I'm not sure about older
371 DEC C++ V5 compilers. */
372 # if defined(__EDG__)
373 # define Q_CC_EDG
374 # endif
375 /* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead
376 - observed on Compaq C++ V6.3-002.
377 In any case versions prior to Compaq C++ V6.0-005 do not have bool. */
378 # if !defined(_BOOL_EXISTS)
379 # define Q_NO_BOOL_TYPE
380 # endif
381 /* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
382 # define Q_NO_USING_KEYWORD
383 /* Apply to all versions prior to Compaq C++ V6.0-000 - observed on
384 DEC C++ V5.5-004. */
385 # if __DECCXX_VER < 60060000
386 # define Q_TYPENAME
387 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
388 # define Q_CANNOT_DELETE_CONSTANT
389 # endif
390 /* avoid undefined symbol problems with out-of-line template members */
391 # define Q_INLINE_TEMPLATES inline
392
393 /* Compilers with EDG front end are similar. To detect them we test:
394 __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b
395 __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 */
396 #elif defined(__EDG) || defined(__EDG__)
397 # define Q_CC_EDG
398 /* From the EDG documentation (does not seem to apply to Compaq C++):
399 _BOOL
400 Defined in C++ mode when bool is a keyword. The name of this
401 predefined macro is specified by a configuration flag. _BOOL
402 is the default.
403 __BOOL_DEFINED
404 Defined in Microsoft C++ mode when bool is a keyword. */
405 # if !defined(_BOOL) && !defined(__BOOL_DEFINED)
406 # define Q_NO_BOOL_TYPE
407 # endif
408
409 /* The Comeau compiler is based on EDG and does define __EDG__ */
410 # if defined(__COMO__)
411 # define Q_CC_COMEAU
412 # define Q_C_CALLBACKS
413
414 /* The `using' keyword was introduced to avoid KAI C++ warnings
415 but it's now causing KAI C++ errors instead. The standard is
416 unclear about the use of this keyword, and in practice every
417 compiler is using its own set of rules. Forget it. */
418 # elif defined(__KCC)
419 # define Q_CC_KAI
420 # if !defined(_EXCEPTIONS)
421 # define Q_NO_EXCEPTIONS
422 # endif
423 # define Q_NO_USING_KEYWORD
424
425 /* Using the `using' keyword avoids Intel C++ for Linux warnings */
426 # elif defined(__INTEL_COMPILER)
427 # define Q_CC_INTEL
428 # if !defined(__EXCEPTIONS)
429 # define Q_NO_EXCEPTIONS
430 # endif
431
432 /* The Portland Group compiler is based on EDG and does define __EDG__ */
433 # elif defined(__PGI)
434 # define Q_CC_PGI
435 # if !defined(__EXCEPTIONS)
436 # define Q_NO_EXCEPTIONS
437 # endif
438
439 /* Never tested! */
440 # elif defined(__ghs)
441 # define Q_CC_GHS
442
443 /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */
444 # elif defined(__USLC__) && defined(__SCO_VERSION__)
445 # define Q_CC_USLC
446 /* The latest UDK 7.1.1b does not need this, but previous versions do */
447 # if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010)
448 # define Q_INLINE_TEMPLATES inline
449 # endif
450 # define Q_NO_USING_KEYWORD /* ### check "using" status */
451
452 /* Never tested! */
453 # elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER)
454 # define Q_CC_OC
455 # define Q_NO_USING_KEYWORD
456
457 /* CDS++ defines __EDG__ although this is not documented in the Reliant
458 documentation. It also follows conventions like _BOOL and this documented */
459 # elif defined(sinix)
460 # define Q_CC_CDS
461 # define Q_NO_USING_KEYWORD
462 # if defined(__cplusplus) && (__cplusplus < 2) /* Cfront C++ mode */
463 # define Q_NO_EXCEPTIONS
464 # endif
465
466 /* The MIPSpro compiler in o32 mode is based on EDG but disables features
467 such as template specialization nevertheless */
468 # elif defined(__sgi)
469 # define Q_CC_MIPS
470 # if defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32) /* o32 ABI */
471 # define Q_TYPENAME
472 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
473 # define Q_NO_EXPLICIT_KEYWORD
474 # define Q_INLINE_TEMPLATES inline
475 # elif defined(_COMPILER_VERSION) && (_COMPILER_VERSION < 730) /* 7.2 */
476 # define Q_TYPENAME
477 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
478 # endif
479 # define Q_NO_USING_KEYWORD /* ### check "using" status */
480 # if defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 740)
481 # pragma set woff 3624,3625, 3649 /* turn off some harmless warnings */
482 # endif
483 # endif
484
485 /* The older UnixWare 2.X compiler? */
486 #elif defined(__USLC__)
487 # define Q_CC_USLC
488 # define Q_TYPENAME
489 # define Q_NO_BOOL_TYPE
490 # define Q_NO_EXPLICIT_KEYWORD
491 # define Q_NO_USING_KEYWORD
492 # define Q_INLINE_TEMPLATES inline
493
494 /* Never tested! */
495 #elif defined(__HIGHC__)
496 # define Q_CC_HIGHC
497
498 #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
499 # define Q_CC_SUN
500 /* 5.0 compiler or better
501 'bool' is enabled by default but can be disabled using -features=nobool
502 in which case _BOOL is not defined
503 this is the default in 4.2 compatibility mode triggered by -compat=4 */
504 # if __SUNPRO_CC >= 0x500
505 # if !defined(_BOOL)
506 # define Q_NO_BOOL_TYPE
507 # endif
508 # if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4)
509 # define Q_NO_USING_KEYWORD
510 # endif
511 # define Q_C_CALLBACKS
512 /* 4.2 compiler or older */
513 # else
514 # define Q_NO_BOOL_TYPE
515 # define Q_NO_EXPLICIT_KEYWORD
516 # define Q_NO_USING_KEYWORD
517 # endif
518
519 /* CDS++ does not seem to define __EDG__ or __EDG according to Reliant
520 documentation but nevertheless uses EDG conventions like _BOOL */
521 #elif defined(sinix)
522 # define Q_CC_EDG
523 # define Q_CC_CDS
524 # if !defined(_BOOL)
525 # define Q_NO_BOOL_TYPE
526 # endif
527 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
528
529 #elif defined(Q_OS_HPUX)
530 /* __HP_aCC was not defined in first aCC releases */
531 # if defined(__HP_aCC) || __cplusplus >= 199707L
532 # define Q_CC_HPACC
533 # else
534 # define Q_CC_HP
535 # define Q_NO_BOOL_TYPE
536 # define Q_FULL_TEMPLATE_INSTANTIATION
537 # define Q_BROKEN_TEMPLATE_SPECIALIZATION
538 # define Q_NO_EXPLICIT_KEYWORD
539 # endif
540 # define Q_NO_USING_KEYWORD /* ### check "using" status */
541
542 #else
543 # error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com"
544 #endif
545
546 #ifndef Q_PACKED
547 # define Q_PACKED
548 #endif
549
550
551 /*
552 The window system, must be one of: (Q_WS_x)
553
554 MACX - Mac OS X
555 MAC9 - Mac OS 9
556 QWS - Qt/Embedded
557 WIN32 - Windows
558 X11 - X Window System
559 PM - unsupported
560 WIN16 - unsupported
561 */
562
563 #if defined(Q_OS_MAC9)
564 # define Q_WS_MAC9
565 #elif defined(Q_OS_MSDOS)
566 # define Q_WS_WIN16
567 # error "Qt requires Win32 and does not work with Windows 3.x"
568 #elif defined(_WIN32_X11_)
569 # define Q_WS_X11
570 #elif defined(Q_OS_WIN32)
571 # define Q_WS_WIN32
572 # if defined(Q_OS_WIN64)
573 # define Q_WS_WIN64
574 # endif
575 #elif defined(Q_OS_OS2)
576 # define Q_WS_PM
577 # error "Qt does not work with OS/2 Presentation Manager or Workplace Shell"
578 #elif defined(Q_OS_UNIX)
579 # if defined(QWS)
580 # define Q_WS_QWS
581 # define QT_NO_QWS_IM
582 # elif defined(Q_OS_MACX)
583 # define Q_WS_MACX
584 # else
585 # define Q_WS_X11
586 # endif
587 #endif
588 #if defined(Q_OS_MAC) && !defined(QMAC_PASCAL)
589 # define QMAC_PASCAL
590 #endif
591
592 #if defined(Q_WS_WIN16) || defined(Q_WS_WIN32)
593 # define Q_WS_WIN
594 #endif
595
596 #if (defined(Q_WS_MAC9) || defined(Q_WS_MACX)) && !defined(Q_WS_QWS) && !defined(Q_WS_X11)
597 # define Q_WS_MAC
598 #endif
599
600
601 /*
602 Some classes do not permit copies to be made of an object.
603 These classes contains a private copy constructor and operator=
604 to disable copying (the compiler gives an error message).
605 Undefine Q_DISABLE_COPY to turn off this checking.
606 */
607
608 #define Q_DISABLE_COPY
609
610 #if defined(__cplusplus)
611
612
613 //
614 // Useful type definitions for Qt
615 //
616
617 #if defined(Q_NO_BOOL_TYPE)
618 #if defined(Q_CC_HP)
619 // bool is an unsupported reserved keyword in later versions
620 #define bool int
621 #else
622 typedef int bool;
623 #endif
624 #endif
625
626 typedef unsigned char uchar;
627 typedef unsigned short ushort;
628 typedef unsigned uint;
629 typedef unsigned long ulong;
630 typedef char *pchar;
631 typedef uchar *puchar;
632 typedef const char *pcchar;
633
634
635 //
636 // Constant bool values
637 //
638
639 #ifndef TRUE
640 const bool FALSE = 0;
641 const bool TRUE = !0;
642 #endif
643 #if defined(__WATCOMC__)
644 # if defined(Q_OS_QNX4)
645 const bool false = FALSE;
646 const bool true = TRUE;
647 # endif
648 #endif
649
650 //
651 // Proper for-scoping
652 // ### turn on in 4.0
653
654 #if 0 && defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
655 # define for if(0){}else for
656 #endif
657
658 //
659 // Use the "explicit" keyword on platforms that support it.
660 //
661
662 #if !defined(Q_NO_EXPLICIT_KEYWORD)
663 # define Q_EXPLICIT explicit
664 #else
665 # define Q_EXPLICIT
666 #endif
667
668
669 //
670 // Workaround for static const members on MSVC++.
671 //
672
673 #if defined(Q_CC_MSVC)
674 # define QT_STATIC_CONST static
675 # define QT_STATIC_CONST_IMPL
676 #else
677 # define QT_STATIC_CONST static const
678 # define QT_STATIC_CONST_IMPL const
679 #endif
680
681
682 //
683 // Utility macros and inline functions
684 //
685
686 #define QMAX(a, b) ((b) < (a) ? (a) : (b))
687 #define QMIN(a, b) ((a) < (b) ? (a) : (b))
688 #define QABS(a) ((a) >= 0 ? (a) : -(a))
689
qRound(double d)690 inline int qRound( double d )
691 {
692 return d >= 0.0 ? int(d + 0.5) : int( d - ((int)d-1) + 0.5 ) + ((int)d-1);
693 }
694
695
696 //
697 // Size-dependent types (architechture-dependent byte order)
698 //
699
700 #if !defined(QT_CLEAN_NAMESPACE)
701 // source compatibility with Qt 1.x
702 typedef signed char INT8; // 8 bit signed
703 typedef unsigned char UINT8; // 8 bit unsigned
704 typedef short INT16; // 16 bit signed
705 typedef unsigned short UINT16; // 16 bit unsigned
706 typedef int INT32; // 32 bit signed
707 typedef unsigned int UINT32; // 32 bit unsigned
708 #endif
709
710 typedef signed char Q_INT8; // 8 bit signed
711 typedef unsigned char Q_UINT8; // 8 bit unsigned
712 typedef short Q_INT16; // 16 bit signed
713 typedef unsigned short Q_UINT16; // 16 bit unsigned
714 typedef int Q_INT32; // 32 bit signed
715 typedef unsigned int Q_UINT32; // 32 bit unsigned
716 #if defined(Q_OS_WIN64)
717 typedef __int64 Q_LONG; // word up to 64 bit signed
718 typedef unsigned __int64 Q_ULONG; // word up to 64 bit unsigned
719 #else
720 typedef long Q_LONG; // word up to 64 bit signed
721 typedef unsigned long Q_ULONG; // word up to 64 bit unsigned
722 #endif
723 #if defined(Q_OS_WIN) && !defined(Q_CC_GNU)
724 # define Q_INT64_C(c) c ## i64 // signed 64 bit constant
725 # define Q_UINT64_C(c) c ## ui64 // unsigned 64 bit constant
726 typedef __int64 Q_INT64; // 64 bit signed
727 typedef unsigned __int64 Q_UINT64; // 64 bit unsigned
728 #else
729 # define Q_INT64_C(c) c ## LL // signed 64 bit constant
730 # define Q_UINT64_C(c) c ## ULL // unsigned 64 bit constant
731 typedef long long Q_INT64; // 64 bit signed
732 typedef unsigned long long Q_UINT64; // 64 bit unsigned
733 #endif
734 typedef Q_INT64 Q_LLONG; // signed long long
735 typedef Q_UINT64 Q_ULLONG; // unsigned long long
736
737 #if defined(Q_OS_MACX) && !defined(QT_LARGEFILE_SUPPORT)
738 # define QT_LARGEFILE_SUPPORT 64
739 #endif
740 #if defined(QT_LARGEFILE_SUPPORT)
741 typedef Q_ULLONG QtOffset;
742 #else
743 typedef Q_ULONG QtOffset;
744 #endif
745
746
747 //
748 // Data stream functions is provided by many classes (defined in qdatastream.h)
749 //
750
751 class QDataStream;
752
753
754 //
755 // Feature subsetting
756 //
757 // Note that disabling some features will produce a libqt that is not
758 // compatible with other libqt builds. Such modifications are only
759 // supported on Qt/Embedded where reducing the library size is important
760 // and where the application-suite is often a fixed set.
761 //
762
763 #if !defined(QT_MOC)
764 #if defined(QCONFIG_LOCAL)
765 #include "qconfig-local.h"
766 #elif defined(QCONFIG_MINIMAL)
767 #include "qconfig-minimal.h"
768 #elif defined(QCONFIG_SMALL)
769 #include "qconfig-small.h"
770 #elif defined(QCONFIG_MEDIUM)
771 #include "qconfig-medium.h"
772 #elif defined(QCONFIG_LARGE)
773 #include "qconfig-large.h"
774 #else // everything...
775 #include "qconfig.h"
776 #endif
777 #endif
778
779
780 #ifndef QT_BUILD_KEY
781 #define QT_BUILD_KEY "unspecified"
782 #endif
783
784 // prune to local config
785 #include "qmodules.h"
786 #ifndef QT_MODULE_DIALOGS
787 # define QT_NO_DIALOG
788 #endif
789 #ifndef QT_MODULE_ICONVIEW
790 # define QT_NO_ICONVIEW
791 #endif
792 #ifndef QT_MODULE_WORKSPACE
793 # define QT_NO_WORKSPACE
794 #endif
795 #ifndef QT_MODULE_NETWORK
796 #define QT_NO_NETWORK
797 #endif
798 #ifndef QT_MODULE_CANVAS
799 # define QT_NO_CANVAS
800 #endif
801 #ifndef QT_MODULE_TABLE
802 #define QT_NO_TABLE
803 #endif
804 #ifndef QT_MODULE_XML
805 # define QT_NO_XML
806 #endif
807 #ifndef QT_MODULE_OPENGL
808 # define QT_NO_OPENGL
809 #endif
810 #if !defined(QT_MODULE_SQL)
811 # define QT_NO_SQL
812 #endif
813
814 #if defined(Q_WS_MAC9)
815 //No need for menu merging
816 # ifndef QMAC_QMENUBAR_NO_MERGE
817 # define QMAC_QMENUBAR_NO_MERGE
818 # endif
819 //Mac9 does not use quartz
820 # ifndef QMAC_NO_QUARTZ
821 # define QMAC_NO_QUARTZ
822 # endif
823 # ifndef QMAC_QMENUBAR_NO_EVENT
824 # define QMAC_QMENUBAR_NO_EVENT
825 # endif
826 #endif
827 #if defined(Q_WS_MACX) //for no nobody uses quartz, just putting in first level hooks
828 # ifndef QMAC_NO_QUARTZ
829 # define QMAC_NO_QUARTZ
830 # endif
831 # ifndef QMAC_QMENUBAR_NO_EVENT
832 # define QMAC_QMENUBAR_NO_EVENT
833 # endif
834 #endif
835
836 #if !defined(Q_WS_QWS) && !defined(QT_NO_COP)
837 # define QT_NO_COP
838 #endif
839
840 #ifndef QT_H
841 #include "qfeatures.h"
842 #endif /* QT_H */
843
844
845 //
846 // Create Qt DLL if QT_DLL is defined (Windows only)
847 // or QT_SHARED is defined (Kylix only)
848 //
849
850 #if defined(Q_OS_WIN)
851 # if defined(QT_NODLL)
852 # undef QT_MAKEDLL
853 # undef QT_DLL
854 # elif defined(QT_MAKEDLL) /* create a Qt DLL library */
855 # if defined(QT_DLL)
856 # undef QT_DLL
857 # endif
858 # define Q_EXPORT __declspec(dllexport)
859 # define Q_TEMPLATEDLL
860 # define Q_TEMPLATE_EXTERN
861 # undef Q_DISABLE_COPY /* avoid unresolved externals */
862 # elif defined(QT_DLL) /* use a Qt DLL library */
863 # define Q_EXPORT __declspec(dllimport)
864 # define Q_TEMPLATEDLL
865 # ifndef Q_TEMPLATE_EXTERN
866 # if defined(Q_CC_MSVC_NET)
867 # define Q_TEMPLATE_EXTERN extern
868 # else
869 # define Q_TEMPLATE_EXTERN
870 # endif
871 # endif
872 # undef Q_DISABLE_COPY /* avoid unresolved externals */
873 # endif
874 #elif defined(Q_OS_LINUX) && defined(Q_CC_BOR)
875 # if defined(QT_SHARED) /* create a Qt shared library */
876 # define Q_EXPORT __declspec(dllexport)
877 # define Q_TEMPLATEDLL
878 # define Q_TEMPLATE_EXTERN
879 # undef Q_DISABLE_COPY /* avoid unresolved externals */
880 # else
881 # define Q_TEMPLATEDLL
882 # define Q_TEMPLATE_EXTERN
883 # undef Q_DISABLE_COPY /* avoid unresolved externals */
884 # endif
885 #else
886 # undef QT_MAKEDLL /* ignore these for other platforms */
887 # undef QT_DLL
888 #endif
889
890 #ifndef Q_EXPORT
891 # define Q_EXPORT
892 #endif
893
894
895 //
896 // Some platform specific stuff
897 //
898
899 #if defined(Q_WS_WIN)
900 extern Q_EXPORT bool qt_winunicode;
901 #endif
902
903
904 //
905 // System information
906 //
907
908 Q_EXPORT const char *qVersion();
909 Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian );
910 Q_EXPORT bool qSharedBuild();
911 #if defined(Q_OS_MAC)
912 int qMacVersion();
913 #elif defined(Q_WS_WIN)
914 Q_EXPORT int qWinVersion();
915 #if defined(UNICODE)
916 #define QT_WA( uni, ansi ) if ( qt_winunicode ) { uni } else { ansi }
917 #define QT_WA_INLINE( uni, ansi ) ( qt_winunicode ? uni : ansi )
918 #else
919 #define QT_WA( uni, ansi ) ansi
920 #define QT_WA_INLINE( uni, ansi ) ansi
921 #endif
922 #endif
923
924 #ifdef Q_OS_TEMP
925 #ifdef QT_WA
926 #undef QT_WA
927 #undef QT_WA_INLINE
928 #endif
929 #define QT_WA( uni, ansi ) uni
930 #define QT_WA_INLINE( uni, ansi ) ( uni )
931 #endif
932
933 #ifndef Q_INLINE_TEMPLATES
934 # define Q_INLINE_TEMPLATES
935 #endif
936
937 #ifndef Q_TYPENAME
938 # define Q_TYPENAME typename
939 #endif
940
941 //
942 // Use to avoid "unused parameter" warnings
943 //
944 #define Q_UNUSED(x) (void)x;
945
946 //
947 // Debugging and error handling
948 //
949
950 #if !defined(QT_NO_CHECK)
951 # define QT_CHECK_STATE // check state of objects etc.
952 # define QT_CHECK_RANGE // check range of indexes etc.
953 # define QT_CHECK_NULL // check null pointers
954 # define QT_CHECK_MATH // check math functions
955 #endif
956
957 #if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
958 # define QT_DEBUG // display debug messages
959 # if !defined(QT_NO_COMPAT) // compatibility with Qt 2
960 # if !defined(NO_DEBUG) && !defined(DEBUG)
961 # if !defined(Q_OS_MACX) // clash with MacOS X headers
962 # define DEBUG
963 # endif
964 # endif
965 # endif
966 #endif
967
968
969 Q_EXPORT void qDebug( const char *, ... ) // print debug message
970 #if defined(Q_CC_GNU) && !defined(__INSURE__)
971 __attribute__ ((format (printf, 1, 2)))
972 #endif
973 ;
974
975 Q_EXPORT void qWarning( const char *, ... ) // print warning message
976 #if defined(Q_CC_GNU) && !defined(__INSURE__)
977 __attribute__ ((format (printf, 1, 2)))
978 #endif
979 ;
980
981 Q_EXPORT void qFatal( const char *, ... ) // print fatal message and exit
982 #if defined(Q_CC_GNU)
983 __attribute__ ((format (printf, 1, 2)))
984 #endif
985 ;
986
987 Q_EXPORT void qSystemWarning( const char *, int code = -1 );
988
989 #if !defined(QT_CLEAN_NAMESPACE) // compatibility with Qt 1
990
991 Q_EXPORT void debug( const char *, ... ) // print debug message
992 #if defined(Q_CC_GNU) && !defined(__INSURE__)
993 __attribute__ ((format (printf, 1, 2)))
994 #endif
995 ;
996
997 Q_EXPORT void warning( const char *, ... ) // print warning message
998 #if defined(Q_CC_GNU) && !defined(__INSURE__)
999 __attribute__ ((format (printf, 1, 2)))
1000 #endif
1001 ;
1002
1003 Q_EXPORT void fatal( const char *, ... ) // print fatal message and exit
1004 #if defined(Q_CC_GNU) && !defined(__INSURE__)
1005 __attribute__ ((format (printf, 1, 2)))
1006 #endif
1007 ;
1008
1009 #endif // QT_CLEAN_NAMESPACE
1010
1011
1012 #if !defined(Q_ASSERT)
1013 # if defined(QT_CHECK_STATE)
1014 # if defined(QT_FATAL_ASSERT)
1015 # define Q_ASSERT(x) ((x) ? (void)0 : qFatal("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__))
1016 # else
1017 # define Q_ASSERT(x) ((x) ? (void)0 : qWarning("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__))
1018 # endif
1019 # else
1020 # define Q_ASSERT(x)
1021 # endif
1022 #endif
1023
1024 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2
1025 # if !defined(ASSERT)
1026 # if !defined(Q_OS_TEMP)
1027 # define ASSERT(x) Q_ASSERT(x)
1028 # endif
1029 # endif
1030 #endif // QT_NO_COMPAT
1031
1032
1033 Q_EXPORT bool qt_check_pointer( bool c, const char *, int );
1034
1035 #if defined(QT_CHECK_NULL)
1036 # define Q_CHECK_PTR(p) (qt_check_pointer((p)==0,__FILE__,__LINE__))
1037 #else
1038 # define Q_CHECK_PTR(p)
1039 #endif
1040
1041 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2
1042 # if !defined(CHECK_PTR)
1043 # define CHECK_PTR(x) Q_CHECK_PTR(x)
1044 # endif
1045 #endif // QT_NO_COMPAT
1046
1047 enum QtMsgType { QtDebugMsg, QtWarningMsg, QtFatalMsg };
1048
1049 typedef void (*QtMsgHandler)(QtMsgType, const char *);
1050 Q_EXPORT QtMsgHandler qInstallMsgHandler( QtMsgHandler );
1051
1052 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2
1053 typedef QtMsgHandler msg_handler;
1054 #endif // QT_NO_COMPAT
1055
1056 Q_EXPORT void qSuppressObsoleteWarnings( bool = TRUE );
1057
1058 Q_EXPORT void qObsolete( const char *obj, const char *oldfunc,
1059 const char *newfunc );
1060 Q_EXPORT void qObsolete( const char *obj, const char *oldfunc );
1061 Q_EXPORT void qObsolete( const char *message );
1062
1063
1064 //
1065 // Install paths from configure
1066 //
1067
1068 Q_EXPORT const char *qInstallPath();
1069 Q_EXPORT const char *qInstallPathDocs();
1070 Q_EXPORT const char *qInstallPathHeaders();
1071 Q_EXPORT const char *qInstallPathLibs();
1072 Q_EXPORT const char *qInstallPathBins();
1073 Q_EXPORT const char *qInstallPathPlugins();
1074 Q_EXPORT const char *qInstallPathData();
1075 Q_EXPORT const char *qInstallPathTranslations();
1076 Q_EXPORT const char *qInstallPathSysconf();
1077
1078 #endif /* __cplusplus */
1079
1080 /*
1081 compilers which follow outdated template instantiation rules
1082 require a class to have a comparison operator to exist when
1083 a QValueList of this type is instantiated. It's not actually
1084 used in the list, though. Hence the dummy implementation.
1085 Just in case other code relies on it we better trigger a warning
1086 mandating a real implementation.
1087 */
1088 #ifdef Q_FULL_TEMPLATE_INSTANTIATION
1089 # define Q_DUMMY_COMPARISON_OPERATOR(C) \
1090 bool operator==( const C& ) const { \
1091 qWarning( #C"::operator==( const "#C"& ) got called." ); \
1092 return FALSE; \
1093 }
1094 #else
1095 # define Q_DUMMY_COMPARISON_OPERATOR(C)
1096 #endif
1097
1098 #endif /* QGLOBAL_H */
1099
1100 /*
1101 Avoid some particularly useless warnings from some stupid compilers.
1102 To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
1103 the line "#define QT_NO_WARNINGS"
1104 */
1105
1106 #if !defined(QT_CC_WARNINGS)
1107 # define QT_NO_WARNINGS
1108 #endif
1109 #if defined(QT_NO_WARNINGS)
1110 # if defined(Q_CC_MSVC)
1111 # pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data
1112 # pragma warning(disable: 4275) // non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
1113 # pragma warning(disable: 4514) // unreferenced inline/local function has been removed
1114 # pragma warning(disable: 4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
1115 # pragma warning(disable: 4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2'
1116 # pragma warning(disable: 4706) // assignment within conditional expression
1117 # pragma warning(disable: 4786) // truncating debug info after 255 characters
1118 # pragma warning(disable: 4660) // template-class specialization 'identifier' is already instantiated
1119 # pragma warning(disable: 4355) // 'this' : used in base member initializer list
1120 # pragma warning(disable: 4231) // nonstandard extension used : 'extern' before template explicit instantiation
1121 # pragma warning(disable: 4710) // function not inlined
1122 # elif defined(Q_CC_BOR)
1123 # pragma option -w-inl
1124 # pragma option -w-aus
1125 # pragma warn -inl
1126 # pragma warn -pia
1127 # pragma warn -ccc
1128 # pragma warn -rch
1129 # pragma warn -sig
1130 # endif
1131 #endif
1132
1133