source: trunk/include/qglobal.h@ 7

Last change on this file since 7 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 31.5 KB
Line 
1/****************************************************************************
2** $Id: qglobal.h 2 2005-11-16 15:49:26Z 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__)
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 - unsupported
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# error "Qt does not work with OS/2 Presentation Manager or Workplace Shell"
553#elif defined(Q_OS_UNIX)
554# if defined(QWS)
555# define Q_WS_QWS
556# define QT_NO_QWS_IM
557# elif defined(Q_OS_MACX)
558# define Q_WS_MACX
559# else
560# define Q_WS_X11
561# endif
562#endif
563#if defined(Q_OS_MAC) && !defined(QMAC_PASCAL)
564# define QMAC_PASCAL
565#endif
566
567#if defined(Q_WS_WIN16) || defined(Q_WS_WIN32)
568# define Q_WS_WIN
569#endif
570
571#if (defined(Q_WS_MAC9) || defined(Q_WS_MACX)) && !defined(Q_WS_QWS) && !defined(Q_WS_X11)
572# define Q_WS_MAC
573#endif
574
575
576/*
577 Some classes do not permit copies to be made of an object.
578 These classes contains a private copy constructor and operator=
579 to disable copying (the compiler gives an error message).
580 Undefine Q_DISABLE_COPY to turn off this checking.
581*/
582
583#define Q_DISABLE_COPY
584
585#if defined(__cplusplus)
586
587
588//
589// Useful type definitions for Qt
590//
591
592#if defined(Q_NO_BOOL_TYPE)
593#if defined(Q_CC_HP)
594// bool is an unsupported reserved keyword in later versions
595#define bool int
596#else
597typedef int bool;
598#endif
599#endif
600
601typedef unsigned char uchar;
602typedef unsigned short ushort;
603typedef unsigned uint;
604typedef unsigned long ulong;
605typedef char *pchar;
606typedef uchar *puchar;
607typedef const char *pcchar;
608
609
610//
611// Constant bool values
612//
613
614#ifndef TRUE
615const bool FALSE = 0;
616const bool TRUE = !0;
617#endif
618#if defined(__WATCOMC__)
619# if defined(Q_OS_QNX4)
620const bool false = FALSE;
621const bool true = TRUE;
622# endif
623#endif
624
625//
626// Proper for-scoping
627// ### turn on in 4.0
628
629#if 0 && defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
630# define for if(0){}else for
631#endif
632
633//
634// Use the "explicit" keyword on platforms that support it.
635//
636
637#if !defined(Q_NO_EXPLICIT_KEYWORD)
638# define Q_EXPLICIT explicit
639#else
640# define Q_EXPLICIT
641#endif
642
643
644//
645// Workaround for static const members on MSVC++.
646//
647
648#if defined(Q_CC_MSVC)
649# define QT_STATIC_CONST static
650# define QT_STATIC_CONST_IMPL
651#else
652# define QT_STATIC_CONST static const
653# define QT_STATIC_CONST_IMPL const
654#endif
655
656
657//
658// Utility macros and inline functions
659//
660
661#define QMAX(a, b) ((b) < (a) ? (a) : (b))
662#define QMIN(a, b) ((a) < (b) ? (a) : (b))
663#define QABS(a) ((a) >= 0 ? (a) : -(a))
664
665inline int qRound( double d )
666{
667 return d >= 0.0 ? int(d + 0.5) : int( d - ((int)d-1) + 0.5 ) + ((int)d-1);
668}
669
670
671//
672// Size-dependent types (architechture-dependent byte order)
673//
674
675#if !defined(QT_CLEAN_NAMESPACE)
676// source compatibility with Qt 1.x
677typedef signed char INT8; // 8 bit signed
678typedef unsigned char UINT8; // 8 bit unsigned
679typedef short INT16; // 16 bit signed
680typedef unsigned short UINT16; // 16 bit unsigned
681typedef int INT32; // 32 bit signed
682typedef unsigned int UINT32; // 32 bit unsigned
683#endif
684
685typedef signed char Q_INT8; // 8 bit signed
686typedef unsigned char Q_UINT8; // 8 bit unsigned
687typedef short Q_INT16; // 16 bit signed
688typedef unsigned short Q_UINT16; // 16 bit unsigned
689typedef int Q_INT32; // 32 bit signed
690typedef unsigned int Q_UINT32; // 32 bit unsigned
691#if defined(Q_OS_WIN64)
692typedef __int64 Q_LONG; // word up to 64 bit signed
693typedef unsigned __int64 Q_ULONG; // word up to 64 bit unsigned
694#else
695typedef long Q_LONG; // word up to 64 bit signed
696typedef unsigned long Q_ULONG; // word up to 64 bit unsigned
697#endif
698#if defined(Q_OS_WIN) && !defined(Q_CC_GNU)
699# define Q_INT64_C(c) c ## i64 // signed 64 bit constant
700# define Q_UINT64_C(c) c ## ui64 // unsigned 64 bit constant
701typedef __int64 Q_INT64; // 64 bit signed
702typedef unsigned __int64 Q_UINT64; // 64 bit unsigned
703#else
704# define Q_INT64_C(c) c ## LL // signed 64 bit constant
705# define Q_UINT64_C(c) c ## ULL // unsigned 64 bit constant
706typedef long long Q_INT64; // 64 bit signed
707typedef unsigned long long Q_UINT64; // 64 bit unsigned
708#endif
709typedef Q_INT64 Q_LLONG; // signed long long
710typedef Q_UINT64 Q_ULLONG; // unsigned long long
711
712#if defined(Q_OS_MACX) && !defined(QT_LARGEFILE_SUPPORT)
713# define QT_LARGEFILE_SUPPORT 64
714#endif
715#if defined(QT_LARGEFILE_SUPPORT)
716 typedef Q_ULLONG QtOffset;
717#else
718 typedef Q_ULONG QtOffset;
719#endif
720
721
722//
723// Data stream functions is provided by many classes (defined in qdatastream.h)
724//
725
726class QDataStream;
727
728
729//
730// Feature subsetting
731//
732// Note that disabling some features will produce a libqt that is not
733// compatible with other libqt builds. Such modifications are only
734// supported on Qt/Embedded where reducing the library size is important
735// and where the application-suite is often a fixed set.
736//
737
738#if !defined(QT_MOC)
739#if defined(QCONFIG_LOCAL)
740#include "qconfig-local.h"
741#elif defined(QCONFIG_MINIMAL)
742#include "qconfig-minimal.h"
743#elif defined(QCONFIG_SMALL)
744#include "qconfig-small.h"
745#elif defined(QCONFIG_MEDIUM)
746#include "qconfig-medium.h"
747#elif defined(QCONFIG_LARGE)
748#include "qconfig-large.h"
749#else // everything...
750#include "qconfig.h"
751#endif
752#endif
753
754
755#ifndef QT_BUILD_KEY
756#define QT_BUILD_KEY "unspecified"
757#endif
758
759// prune to local config
760#include "qmodules.h"
761#ifndef QT_MODULE_DIALOGS
762# define QT_NO_DIALOG
763#endif
764#ifndef QT_MODULE_ICONVIEW
765# define QT_NO_ICONVIEW
766#endif
767#ifndef QT_MODULE_WORKSPACE
768# define QT_NO_WORKSPACE
769#endif
770#ifndef QT_MODULE_NETWORK
771#define QT_NO_NETWORK
772#endif
773#ifndef QT_MODULE_CANVAS
774# define QT_NO_CANVAS
775#endif
776#ifndef QT_MODULE_TABLE
777#define QT_NO_TABLE
778#endif
779#ifndef QT_MODULE_XML
780# define QT_NO_XML
781#endif
782#ifndef QT_MODULE_OPENGL
783# define QT_NO_OPENGL
784#endif
785#if !defined(QT_MODULE_SQL)
786# define QT_NO_SQL
787#endif
788
789#if defined(Q_WS_MAC9)
790//No need for menu merging
791# ifndef QMAC_QMENUBAR_NO_MERGE
792# define QMAC_QMENUBAR_NO_MERGE
793# endif
794//Mac9 does not use quartz
795# ifndef QMAC_NO_QUARTZ
796# define QMAC_NO_QUARTZ
797# endif
798# ifndef QMAC_QMENUBAR_NO_EVENT
799# define QMAC_QMENUBAR_NO_EVENT
800# endif
801#endif
802#if defined(Q_WS_MACX) //for no nobody uses quartz, just putting in first level hooks
803# ifndef QMAC_NO_QUARTZ
804# define QMAC_NO_QUARTZ
805# endif
806# ifndef QMAC_QMENUBAR_NO_EVENT
807# define QMAC_QMENUBAR_NO_EVENT
808# endif
809#endif
810
811#if !defined(Q_WS_QWS) && !defined(QT_NO_COP)
812# define QT_NO_COP
813#endif
814
815#ifndef QT_H
816#include "qfeatures.h"
817#endif /* QT_H */
818
819
820//
821// Create Qt DLL if QT_DLL is defined (Windows only)
822// or QT_SHARED is defined (Kylix only)
823//
824
825#if defined(Q_OS_WIN)
826# if defined(QT_NODLL)
827# undef QT_MAKEDLL
828# undef QT_DLL
829# elif defined(QT_MAKEDLL) /* create a Qt DLL library */
830# if defined(QT_DLL)
831# undef QT_DLL
832# endif
833# define Q_EXPORT __declspec(dllexport)
834# define Q_TEMPLATEDLL
835# define Q_TEMPLATE_EXTERN
836# undef Q_DISABLE_COPY /* avoid unresolved externals */
837# elif defined(QT_DLL) /* use a Qt DLL library */
838# define Q_EXPORT __declspec(dllimport)
839# define Q_TEMPLATEDLL
840# ifndef Q_TEMPLATE_EXTERN
841# if defined(Q_CC_MSVC_NET)
842# define Q_TEMPLATE_EXTERN extern
843# else
844# define Q_TEMPLATE_EXTERN
845# endif
846# endif
847# undef Q_DISABLE_COPY /* avoid unresolved externals */
848# endif
849#elif defined(Q_OS_LINUX) && defined(Q_CC_BOR)
850# if defined(QT_SHARED) /* create a Qt shared library */
851# define Q_EXPORT __declspec(dllexport)
852# define Q_TEMPLATEDLL
853# define Q_TEMPLATE_EXTERN
854# undef Q_DISABLE_COPY /* avoid unresolved externals */
855# else
856# define Q_TEMPLATEDLL
857# define Q_TEMPLATE_EXTERN
858# undef Q_DISABLE_COPY /* avoid unresolved externals */
859# endif
860#else
861# undef QT_MAKEDLL /* ignore these for other platforms */
862# undef QT_DLL
863#endif
864
865#ifndef Q_EXPORT
866# define Q_EXPORT
867#endif
868
869
870//
871// Some platform specific stuff
872//
873
874#if defined(Q_WS_WIN)
875extern Q_EXPORT bool qt_winunicode;
876#endif
877
878
879//
880// System information
881//
882
883Q_EXPORT const char *qVersion();
884Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian );
885Q_EXPORT bool qSharedBuild();
886#if defined(Q_OS_MAC)
887int qMacVersion();
888#elif defined(Q_WS_WIN)
889Q_EXPORT int qWinVersion();
890#if defined(UNICODE)
891#define QT_WA( uni, ansi ) if ( qt_winunicode ) { uni } else { ansi }
892#define QT_WA_INLINE( uni, ansi ) ( qt_winunicode ? uni : ansi )
893#else
894#define QT_WA( uni, ansi ) ansi
895#define QT_WA_INLINE( uni, ansi ) ansi
896#endif
897#endif
898
899#ifdef Q_OS_TEMP
900#ifdef QT_WA
901#undef QT_WA
902#undef QT_WA_INLINE
903#endif
904#define QT_WA( uni, ansi ) uni
905#define QT_WA_INLINE( uni, ansi ) ( uni )
906#endif
907
908#ifndef Q_INLINE_TEMPLATES
909# define Q_INLINE_TEMPLATES
910#endif
911
912#ifndef Q_TYPENAME
913# define Q_TYPENAME typename
914#endif
915
916//
917// Use to avoid "unused parameter" warnings
918//
919#define Q_UNUSED(x) (void)x;
920
921//
922// Debugging and error handling
923//
924
925#if !defined(QT_NO_CHECK)
926# define QT_CHECK_STATE // check state of objects etc.
927# define QT_CHECK_RANGE // check range of indexes etc.
928# define QT_CHECK_NULL // check null pointers
929# define QT_CHECK_MATH // check math functions
930#endif
931
932#if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
933# define QT_DEBUG // display debug messages
934# if !defined(QT_NO_COMPAT) // compatibility with Qt 2
935# if !defined(NO_DEBUG) && !defined(DEBUG)
936# if !defined(Q_OS_MACX) // clash with MacOS X headers
937# define DEBUG
938# endif
939# endif
940# endif
941#endif
942
943
944Q_EXPORT void qDebug( const char *, ... ) // print debug message
945#if defined(Q_CC_GNU) && !defined(__INSURE__)
946 __attribute__ ((format (printf, 1, 2)))
947#endif
948;
949
950Q_EXPORT void qWarning( const char *, ... ) // print warning message
951#if defined(Q_CC_GNU) && !defined(__INSURE__)
952 __attribute__ ((format (printf, 1, 2)))
953#endif
954;
955
956Q_EXPORT void qFatal( const char *, ... ) // print fatal message and exit
957#if defined(Q_CC_GNU)
958 __attribute__ ((format (printf, 1, 2)))
959#endif
960;
961
962Q_EXPORT void qSystemWarning( const char *, int code = -1 );
963
964#if !defined(QT_CLEAN_NAMESPACE) // compatibility with Qt 1
965
966Q_EXPORT void debug( const char *, ... ) // print debug message
967#if defined(Q_CC_GNU) && !defined(__INSURE__)
968 __attribute__ ((format (printf, 1, 2)))
969#endif
970;
971
972Q_EXPORT void warning( const char *, ... ) // print warning message
973#if defined(Q_CC_GNU) && !defined(__INSURE__)
974 __attribute__ ((format (printf, 1, 2)))
975#endif
976;
977
978Q_EXPORT void fatal( const char *, ... ) // print fatal message and exit
979#if defined(Q_CC_GNU) && !defined(__INSURE__)
980 __attribute__ ((format (printf, 1, 2)))
981#endif
982;
983
984#endif // QT_CLEAN_NAMESPACE
985
986
987#if !defined(Q_ASSERT)
988# if defined(QT_CHECK_STATE)
989# if defined(QT_FATAL_ASSERT)
990# define Q_ASSERT(x) ((x) ? (void)0 : qFatal("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__))
991# else
992# define Q_ASSERT(x) ((x) ? (void)0 : qWarning("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__))
993# endif
994# else
995# define Q_ASSERT(x)
996# endif
997#endif
998
999#if !defined(QT_NO_COMPAT) // compatibility with Qt 2
1000# if !defined(ASSERT)
1001# if !defined(Q_OS_TEMP)
1002# define ASSERT(x) Q_ASSERT(x)
1003# endif
1004# endif
1005#endif // QT_NO_COMPAT
1006
1007
1008Q_EXPORT bool qt_check_pointer( bool c, const char *, int );
1009
1010#if defined(QT_CHECK_NULL)
1011# define Q_CHECK_PTR(p) (qt_check_pointer((p)==0,__FILE__,__LINE__))
1012#else
1013# define Q_CHECK_PTR(p)
1014#endif
1015
1016#if !defined(QT_NO_COMPAT) // compatibility with Qt 2
1017# if !defined(CHECK_PTR)
1018# define CHECK_PTR(x) Q_CHECK_PTR(x)
1019# endif
1020#endif // QT_NO_COMPAT
1021
1022enum QtMsgType { QtDebugMsg, QtWarningMsg, QtFatalMsg };
1023
1024typedef void (*QtMsgHandler)(QtMsgType, const char *);
1025Q_EXPORT QtMsgHandler qInstallMsgHandler( QtMsgHandler );
1026
1027#if !defined(QT_NO_COMPAT) // compatibility with Qt 2
1028typedef QtMsgHandler msg_handler;
1029#endif // QT_NO_COMPAT
1030
1031Q_EXPORT void qSuppressObsoleteWarnings( bool = TRUE );
1032
1033Q_EXPORT void qObsolete( const char *obj, const char *oldfunc,
1034 const char *newfunc );
1035Q_EXPORT void qObsolete( const char *obj, const char *oldfunc );
1036Q_EXPORT void qObsolete( const char *message );
1037
1038
1039//
1040// Install paths from configure
1041//
1042
1043Q_EXPORT const char *qInstallPath();
1044Q_EXPORT const char *qInstallPathDocs();
1045Q_EXPORT const char *qInstallPathHeaders();
1046Q_EXPORT const char *qInstallPathLibs();
1047Q_EXPORT const char *qInstallPathBins();
1048Q_EXPORT const char *qInstallPathPlugins();
1049Q_EXPORT const char *qInstallPathData();
1050Q_EXPORT const char *qInstallPathTranslations();
1051Q_EXPORT const char *qInstallPathSysconf();
1052
1053#endif /* __cplusplus */
1054
1055/*
1056 compilers which follow outdated template instantiation rules
1057 require a class to have a comparison operator to exist when
1058 a QValueList of this type is instantiated. It's not actually
1059 used in the list, though. Hence the dummy implementation.
1060 Just in case other code relies on it we better trigger a warning
1061 mandating a real implementation.
1062*/
1063#ifdef Q_FULL_TEMPLATE_INSTANTIATION
1064# define Q_DUMMY_COMPARISON_OPERATOR(C) \
1065 bool operator==( const C& ) const { \
1066 qWarning( #C"::operator==( const "#C"& ) got called." ); \
1067 return FALSE; \
1068 }
1069#else
1070# define Q_DUMMY_COMPARISON_OPERATOR(C)
1071#endif
1072
1073#endif /* QGLOBAL_H */
1074
1075/*
1076 Avoid some particularly useless warnings from some stupid compilers.
1077 To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
1078 the line "#define QT_NO_WARNINGS"
1079*/
1080
1081#if !defined(QT_CC_WARNINGS)
1082# define QT_NO_WARNINGS
1083#endif
1084#if defined(QT_NO_WARNINGS)
1085# if defined(Q_CC_MSVC)
1086# pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data
1087# pragma warning(disable: 4275) // non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
1088# pragma warning(disable: 4514) // unreferenced inline/local function has been removed
1089# pragma warning(disable: 4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
1090# pragma warning(disable: 4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2'
1091# pragma warning(disable: 4706) // assignment within conditional expression
1092# pragma warning(disable: 4786) // truncating debug info after 255 characters
1093# pragma warning(disable: 4660) // template-class specialization 'identifier' is already instantiated
1094# pragma warning(disable: 4355) // 'this' : used in base member initializer list
1095# pragma warning(disable: 4231) // nonstandard extension used : 'extern' before template explicit instantiation
1096# pragma warning(disable: 4710) // function not inlined
1097# elif defined(Q_CC_BOR)
1098# pragma option -w-inl
1099# pragma option -w-aus
1100# pragma warn -inl
1101# pragma warn -pia
1102# pragma warn -ccc
1103# pragma warn -rch
1104# pragma warn -sig
1105# endif
1106#endif
1107
Note: See TracBrowser for help on using the repository browser.