source: trunk/include/qglobal.h@ 81

Last change on this file since 81 was 8, checked in by dmik, 20 years ago

Transferred Qt for OS/2 version 3.3.1-rc5 sources from the CVS

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