Imported Upstream version 1.8.2
[platform/upstream/doxygen.git] / qtools / qglobal.h
1 /****************************************************************************
2 ** 
3 **
4 ** Global type declarations and definitions
5 **
6 ** Created : 920529
7 **
8 ** Copyright (C) 1992-2000 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
42 #define QT_VERSION      223
43 #define QT_VERSION_STR  "2.2.3"
44
45
46 //
47 // The operating system, must be one of: (_OS_x_)
48 //
49 //   MAC        - Macintosh
50 //   MSDOS      - MS-DOS and Windows
51 //   OS2        - OS/2
52 //   OS2EMX     - XFree86 on OS/2 (not PM)
53 //   WIN32      - Win32 (Windows 95/98 and Windows NT)
54 //   SUN        - SunOS
55 //   SOLARIS    - Sun Solaris
56 //   HPUX       - HP-UX
57 //   ULTRIX     - DEC Ultrix
58 //   LINUX      - Linux
59 //   FREEBSD    - FreeBSD
60 //   NETBSD     - NetBSD
61 //   OPENBSD    - OpenBSD
62 //   IRIX       - SGI Irix
63 //   OSF        - OSF Unix
64 //   BSDI       - BSDI Unix
65 //   SCO        - SCO of some sort
66 //   AIX        - AIX Unix
67 //   UNIXWARE   - SCO UnixWare
68 //   GNU        - GNU Hurd
69 //   DGUX       - DG Unix
70 //   UNIX       - Any UNIX bsd/sysv system
71 //
72
73 #if defined(__APPLE__) || defined(macintosh)
74 #define _OS_MAC_
75 #  ifdef MAC_OS_X_VERSION_MIN_REQUIRED
76 #    undef MAC_OS_X_VERSION_MIN_REQUIRED
77 #  endif
78 #  define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_3
79 #  include <AvailabilityMacros.h>
80 #  if !defined(MAC_OS_X_VERSION_10_3)
81 #     define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 10
82 #  endif
83 #  if !defined(MAC_OS_X_VERSION_10_4)
84 #       define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 10
85 #  endif
86 #  if !defined(MAC_OS_X_VERSION_10_5)
87 #       define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 10
88 #  endif
89 #  if !defined(MAC_OS_X_VERSION_10_6)
90 #       define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 10
91 #  endif
92 #  if !defined(MAC_OS_X_VERSION_10_7)
93 #       define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 10
94 #  endif
95 #  if !defined(MAC_OS_X_VERSION_10_8)
96 #       define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 10
97 #  endif
98 #  if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_8)
99 #    warning "This version of Mac OS X is unsupported"
100 #  endif
101 #elif defined(MSDOS) || defined(_MSDOS) || defined(__MSDOS__)
102 #define _OS_MSDOS_
103 #elif defined(OS2) || defined(_OS2) || defined(__OS2__)
104 #if defined(__EMX__)
105 #define _OS_OS2EMX_
106 #else
107 #define _OS_OS2_
108 #endif
109 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
110 #define _OS_WIN32_
111 #elif defined(__MWERKS__) && defined(__INTEL__)
112 #define _OS_WIN32_
113 #elif defined(sun) || defined(__sun) || defined(__sun__)
114 #if defined(__SVR4)
115 #define _OS_SOLARIS_
116 #else
117 #define _OS_SUN_
118 #endif
119 #elif defined(hpux) || defined(__hpux) || defined(__hpux__)
120 #define _OS_HPUX_
121 #elif defined(ultrix) || defined(__ultrix) || defined(__ultrix__)
122 #define _OS_ULTRIX_
123 #elif defined(reliantunix)
124 #define _OS_RELIANTUNIX_
125 #elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
126 #define _OS_LINUX_
127 #elif defined(__FreeBSD__)
128 #define _OS_FREEBSD_
129 #elif defined(__NetBSD__)
130 #define _OS_NETBSD_
131 #elif defined(__OpenBSD__)
132 #define _OS_OPENBSD_
133 #elif defined(sgi) || defined(__sgi)
134 #define _OS_IRIX_
135 #elif defined(__osf__)
136 #define _OS_OSF_
137 #elif defined(bsdi) || defined(__bsdi__)
138 #define _OS_BSDI_
139 #elif defined(_AIX)
140 #define _OS_AIX_
141 #elif defined(__Lynx__)
142 #define _OS_LYNXOS_
143 #elif defined(_UNIXWARE)
144 #define _OS_UNIXWARE_
145 #elif defined(DGUX)
146 #define _OS_DGUX_
147 #elif defined(__QNX__)
148 #define _OS_QNX_
149 #elif defined(_SCO_DS) || defined(M_UNIX) || defined(M_XENIX)
150 #define _OS_SCO_
151 #elif defined(sco) || defined(_UNIXWARE7)
152 #define _OS_UNIXWARE7_
153 #elif !defined(_SCO_DS) && defined(__USLC__) && defined(__SCO_VERSION__)
154 #define _OS_UNIXWARE7_
155 #elif defined(__CYGWIN__)
156 #define _OS_CYGWIN_
157 #elif defined(__BEOS__)
158 #define _OS_BEOS_
159 #elif defined(__MINT__)
160 #define _OS_MINT_
161 #else
162 #error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com"
163 #endif
164
165 #if defined(_OS_MAC_) || defined(_OS_MSDOS_) || defined(_OS_OS2_) || defined(_OS_WIN32_)
166 #undef  _OS_UNIX_
167 #elif !defined(_OS_UNIX_)
168 #define _OS_UNIX_
169 // QT_CLEAN_NAMESPACE is not defined by default; it would break too
170 // much code.
171 #if !defined(QT_CLEAN_NAMESPACE) && !defined(UNIX)
172 // ### remove 3.0
173 #define UNIX
174 #endif
175 #endif
176
177
178 //
179 // The compiler, must be one of: (_CC_x_)
180 //
181 //   SYM        - Symantec C++ for both PC and Macintosh
182 //   MPW        - MPW C++
183 //   MWERKS     - Metrowerks CodeWarrior
184 //   MSVC       - Microsoft Visual C/C++
185 //   BOR        - Borland/Turbo C++
186 //   WAT        - Watcom C++
187 //   GNU        - GNU C++
188 //   COMEAU     - Comeau C++
189 //   EDG        - Edison Design Group C++
190 //   OC         - CenterLine C++
191 //   SUN        - Sun C++
192 //   DEC        - DEC C++
193 //   HP         - HPUX C++
194 //   USLC       - SCO UnixWare7 C++
195 //   CDS        - Reliant C++
196 //   KAI        - KAI C++
197 //
198
199
200 // Should be sorted most-authorative to least-authorative
201
202 #if defined(__SC__)
203 #define _CC_SYM_
204 #elif defined( __KCC )
205 #define _CC_KAI_
206 #define _CC_EDG_
207 #define Q_HAS_BOOL_TYPE
208 #elif defined(applec)
209 #define _CC_MPW_
210 #elif defined(__MWERKS__)
211 #define _CC_MWERKS_
212 #define Q_HAS_BOOL_TYPE
213 #elif defined(_MSC_VER)
214 #define _CC_MSVC_
215 #elif defined(__BORLANDC__) || defined(__TURBOC__)
216 #define _CC_BOR_
217 #elif defined(__WATCOMC__)
218 #define _CC_WAT_
219 #define Q_HAS_BOOL_TYPE
220 #elif defined(__GNUC__)
221 #define _CC_GNU_
222 #if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
223 #define Q_FULL_TEMPLATE_INSTANTIATION
224 #define Q_TEMPLATE_NEEDS_CLASS_DECLARATION
225 #define Q_TEMPLATE_NEEDS_EXPLICIT_CONVERSION
226 #define Q_SPURIOUS_NON_VOID_WARNING
227 #endif
228 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 95
229 #define Q_DELETING_VOID_UNDEFINED
230 #endif
231 #if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP)
232 #define Q_PACKED __attribute__ ((packed))
233 #endif
234 #elif defined(__xlC__)
235 #define _CC_XLC_
236 #define Q_FULL_TEMPLATE_INSTANTIATION
237 #if __xlC__ >= 0x400
238 #define Q_HAS_BOOL_TYPE
239 #endif
240 #if __xlC__ <= 0x0306
241 #define Q_TEMPLATE_NEEDS_EXPLICIT_CONVERSION
242 #endif
243 #elif defined(como40)
244 #define _CC_EDG_
245 #define _CC_COMEAU_
246 #define Q_HAS_BOOL_TYPE
247 #define Q_C_CALLBACKS
248 #elif defined(__USLC__)
249 #define _CC_USLC_
250 #ifdef __EDG__ // UnixWare7
251 #define Q_HAS_BOOL_TYPE
252 #endif
253 #elif defined(__DECCXX)
254 #define _CC_DEC_
255 #if __DECCXX_VER >= 60060005
256 #define Q_HAS_BOOL_TYPE
257 #endif
258 #elif defined(__EDG) || defined(__EDG__)
259 // one observed on SGI DCC, the other documented
260 #define _CC_EDG_
261 #elif defined(OBJECTCENTER) || defined(CENTERLINE_CLPP)
262 #define _CC_OC_
263 #if defined(_BOOL)
264 #define Q_HAS_BOOL_TYPE
265 #endif
266 #elif defined(__SUNPRO_CC)
267 #define _CC_SUN_
268 #if __SUNPRO_CC >= 0x500
269 #define Q_HAS_BOOL_TYPE
270 #define Q_C_CALLBACKS
271 #endif
272 #elif defined(__CDS__)
273 #define _CC_CDS_
274 #define Q_HAS_BOOL_TYPE
275 #elif defined(_OS_HPUX_)
276 // this test is from aCC online help
277 #if defined(__HP_aCC) || __cplusplus >= 199707L
278 // this is the aCC
279 #define _CC_HP_ACC_
280 #define Q_HAS_BOOL_TYPE
281 #else
282 // this is the CC
283 #define _CC_HP_
284 #define Q_FULL_TEMPLATE_INSTANTIATION
285 #define Q_TEMPLATE_NEEDS_EXPLICIT_CONVERSION
286 #endif // __HP_aCC
287 #else
288 #error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com"
289 #endif
290
291 // detect Microsoft compiler version
292 #ifdef _CC_MSVC_
293 #if _MSC_VER >= 1400
294 #define _CC_V2005
295 #elif _MSC_VER >= 1310
296 #define _CC_V2003
297 #elif _MSC_VER > 1300
298 #define _CC_V2002
299 #else
300 #define _CC_V1998
301 #endif 
302 #endif
303
304 #ifndef Q_PACKED
305 #define Q_PACKED
306 #endif
307
308 // Window system setting
309
310 #if defined(_OS_MAC_)
311 #define _WS_MAC_
312 #elif defined(_OS_MSDOS_)
313 #define _WS_WIN16_
314 #error "Qt requires Win32 and does not work with Windows 3.x"
315 #elif defined(_WIN32_X11_)
316 #define _WS_X11_
317 #elif defined(_OS_WIN32_)
318 #define _WS_WIN32_
319 #elif defined(_OS_OS2_)
320 #error "Qt does not work with OS/2 Presentation Manager or Workplace Shell"
321 #elif defined(_OS_UNIX_)
322 #ifdef QWS
323 #define _WS_QWS_
324 #else
325 #define _WS_X11_
326 #endif
327 #endif
328
329 #if defined(_WS_WIN16_) || defined(_WS_WIN32_)
330 #define _WS_WIN_
331 #endif
332
333
334 //
335 // Some classes do not permit copies to be made of an object.
336 // These classes contains a private copy constructor and operator=
337 // to disable copying (the compiler gives an error message).
338 // Undefine Q_DISABLE_COPY to turn off this checking.
339 //
340
341 #define Q_DISABLE_COPY
342
343
344 //
345 // Useful type definitions for Qt
346 //
347
348 #if defined(bool)
349 #define Q_HAS_BOOL_TYPE
350 #elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6)
351 #define Q_HAS_BOOL_TYPE
352 #elif _MSC_VER >= 1100 || __BORLANDC__ >= 0x500
353 #define Q_HAS_BOOL_TYPE
354 #elif defined(sgi) && defined(_BOOL)
355 #define Q_HAS_BOOL_TYPE
356 #endif
357
358 #if (QT_VERSION >= 300)
359 #error "Use an enum for bool"
360 #endif
361
362 #if !defined(Q_HAS_BOOL_TYPE)
363 #if defined(_CC_MSVC_)
364 #define _CC_BOOL_DEF_
365 #define bool            int
366 #else
367 typedef int             bool;
368 #endif
369 #endif
370
371 typedef unsigned char   uchar;
372 typedef unsigned short  ushort;
373 typedef unsigned        uint;
374 typedef unsigned long   ulong;
375 typedef char           *pchar;
376 typedef uchar          *puchar;
377 typedef const char     *pcchar;
378 #if defined(_OS_WIN32_) && !defined(_CC_GNU_)
379 typedef __int64            int64;
380 typedef unsigned __int64   uint64;
381 #else
382 typedef long long          int64;
383 typedef unsigned long long uint64;
384 #endif
385
386
387 //
388 // Constant bool values
389 //
390
391 #ifndef TRUE
392 const bool FALSE = 0;
393 const bool TRUE = !0;
394 #endif
395
396
397 #if defined(_CC_MSVC_)
398 // Workaround for static const members.
399 #define QT_STATIC_CONST static
400 #define QT_STATIC_CONST_IMPL
401 #else
402 #define QT_STATIC_CONST static const
403 #define QT_STATIC_CONST_IMPL const
404 #endif
405
406
407
408 //
409 // Utility macros and inline functions
410 //
411
412 #define QMAX(a,b)       ((a) > (b) ? (a) : (b))
413 #define QMIN(a,b)       ((a) < (b) ? (a) : (b))
414 #define QABS(a)         ((a) >= 0  ? (a) : -(a))
415
416 inline int qRound( double d )
417 {
418     return d > 0.0 ? int(d+0.5) : int(d-0.5);
419 }
420
421
422 //
423 // Size-dependent types (architechture-dependent byte order)
424 //
425
426 // QT_CLEAN_NAMESPACE is not defined by default; it would break too
427 // much code.
428 #if !defined(QT_CLEAN_NAMESPACE)
429 typedef signed char     INT8;                   // 8 bit signed
430 typedef unsigned char   UINT8;                  // 8 bit unsigned
431 typedef short           INT16;                  // 16 bit signed
432 typedef unsigned short  UINT16;                 // 16 bit unsigned
433 typedef int             INT32;                  // 32 bit signed
434 typedef unsigned int    UINT32;                 // 32 bit unsigned
435 #endif
436
437 typedef signed char     Q_INT8;                 // 8 bit signed
438 typedef unsigned char   Q_UINT8;                // 8 bit unsigned
439 typedef short           Q_INT16;                // 16 bit signed
440 typedef unsigned short  Q_UINT16;               // 16 bit unsigned
441 typedef int             Q_INT32;                // 32 bit signed
442 typedef unsigned int    Q_UINT32;               // 32 bit unsigned
443 typedef long            Q_INT64;                // up to 64 bit signed
444 typedef unsigned long   Q_UINT64;               // up to 64 bit unsigned
445
446 //
447 // Data stream functions is provided by many classes (defined in qdatastream.h)
448 //
449
450 class QDataStream;
451
452
453
454 #ifdef _WS_WIN_
455 extern bool qt_winunicode;
456 #endif
457
458 #ifndef QT_H
459 #include <qfeatures.h>
460 #endif // QT_H
461
462 //
463 // Create Qt DLL if QT_DLL is defined (Windows only)
464 //
465
466 #if defined(_OS_WIN32_)
467 #if defined(QT_NODLL)
468 #undef QT_MAKEDLL
469 #undef QT_DLL
470 #endif
471 #ifdef QT_DLL
472 #if defined(QT_MAKEDLL)         /* create a Qt DLL library */
473 #undef QT_DLL
474 #define Q_EXPORT  __declspec(dllexport)
475 #define Q_TEMPLATEDLL
476 #undef  Q_DISABLE_COPY          /* avoid unresolved externals */
477 #endif
478 #endif
479 #if defined(QT_DLL)             /* use a Qt DLL library */
480 #define Q_EXPORT  __declspec(dllimport)
481 #define Q_TEMPLATEDLL
482 #undef  Q_DISABLE_COPY          /* avoid unresolved externals */
483 #endif
484 #else // ! _OS_WIN32_
485 #undef QT_MAKEDLL               /* ignore these for other platforms */
486 #undef QT_DLL
487 #endif
488
489 #ifndef Q_EXPORT
490 #define Q_EXPORT
491 #endif
492
493 //
494 // System information
495 //
496
497 Q_EXPORT const char *qVersion();
498 Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian );
499
500
501 //
502 // Debugging and error handling
503 //
504
505 #if !defined(NO_CHECK)
506 #define CHECK_STATE                             // check state of objects etc.
507 #define CHECK_RANGE                             // check range of indexes etc.
508 #define CHECK_NULL                              // check null pointers
509 #define CHECK_MATH                              // check math functions
510 #endif
511
512 #if !defined(NO_DEBUG) && !defined(DEBUG)
513 #define DEBUG                                   // display debug messages
514 #endif
515
516 //
517 // Avoid some particularly useless warnings from some stupid compilers.
518 // To get ALL C++ compiler warnings, define CC_WARNINGS or comment out
519 // the line "#define Q_NO_WARNINGS"
520 //
521
522 #if !defined(CC_WARNINGS)
523 #define Q_NO_WARNINGS
524 #endif
525 #if defined(Q_NO_WARNINGS)
526 #if defined(_CC_MSVC_)
527 #pragma warning(disable: 4244)
528 #pragma warning(disable: 4275)
529 #pragma warning(disable: 4514)
530 #pragma warning(disable: 4800)
531 #pragma warning(disable: 4097)
532 #pragma warning(disable: 4706)
533 #elif defined(_CC_BOR_)
534 #pragma option -w-inl
535 #pragma option -w-aus
536 #pragma warn -inl
537 #pragma warn -pia
538 #pragma warn -ccc
539 #pragma warn -rch
540 #pragma warn -sig
541 #elif defined(_CC_MWERKS_)
542 #pragma warn_possunwant off
543 #endif
544 #endif // Q_NO_WARNINGS
545
546 //
547 // Avoid dead code
548 //
549
550 #if defined(_CC_EDG_) || defined(_CC_WAT_)
551 #define Q_NO_DEAD_CODE
552 #endif
553
554 //
555 // Use to avoid "unused parameter" warnings
556 //
557
558 #define Q_UNUSED(x) x=x;
559 #define Q_CONST_UNUSED(x) (void)x;
560
561 Q_EXPORT void qDebug( const char *, ... )       // print debug message
562 #if defined(_CC_GNU_) && !defined(__INSURE__)
563     __attribute__ ((format (printf, 1, 2)))
564 #endif
565 ;
566
567 Q_EXPORT void qWarning( const char *, ... )     // print warning message
568 #if defined(_CC_GNU_) && !defined(__INSURE__)
569     __attribute__ ((format (printf, 1, 2)))
570 #endif
571 ;
572
573 Q_EXPORT void qFatal( const char *, ... )       // print fatal message and exit
574 #if defined(_CC_GNU_)
575     __attribute__ ((format (printf, 1, 2)))
576 #endif
577 ;
578
579
580 // QT_CLEAN_NAMESPACE is not defined by default; it would break too
581 // much code.
582 #if !defined(QT_CLEAN_NAMESPACE)
583 // in that case, also define the old ones...
584
585 Q_EXPORT void debug( const char *, ... )        // print debug message
586 #if defined(_CC_GNU_) && !defined(__INSURE__)
587     __attribute__ ((format (printf, 1, 2)))
588 #endif
589 ;
590
591 Q_EXPORT void warning( const char *, ... )      // print warning message
592 #if defined(_CC_GNU_) && !defined(__INSURE__)
593     __attribute__ ((format (printf, 1, 2)))
594 #endif
595 ;
596
597 Q_EXPORT void fatal( const char *, ... )        // print fatal message and exit
598 #if defined(_CC_GNU_) && !defined(__INSURE__)
599     __attribute__ ((format (printf, 1, 2)))
600 #endif
601 ;
602
603 // okay, that was debug()/warning()/fatal()
604 #endif
605
606 #if !defined(ASSERT)
607 #if defined(CHECK_STATE)
608 #if defined(QT_FATAL_ASSERT)
609 #define ASSERT(x)  if ( !(x) )\
610         qFatal("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__)
611 #else
612 #define ASSERT(x)  if ( !(x) )\
613         qWarning("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__)
614 #endif
615 #else
616 #define ASSERT(x)
617 #endif
618 #endif
619
620 Q_EXPORT bool qt_check_pointer( bool c, const char *, int );
621
622 #if defined(CHECK_NULL)
623 #define CHECK_PTR(p) (qt_check_pointer((p)==0,__FILE__,__LINE__))
624 #else
625 #define CHECK_PTR(p)
626 #endif
627
628 enum QtMsgType { QtDebugMsg, QtWarningMsg, QtFatalMsg };
629
630 typedef void (*msg_handler)(QtMsgType, const char *);
631 Q_EXPORT msg_handler qInstallMsgHandler( msg_handler );
632
633
634 Q_EXPORT void qSuppressObsoleteWarnings( bool = TRUE );
635
636 #if !defined(QT_REJECT_OBSOLETE)
637 #define QT_OBSOLETE
638 Q_EXPORT void qObsolete( const char *obj, const char *oldfunc,
639                          const char *newfunc );
640 Q_EXPORT void qObsolete( const char *obj, const char *oldfunc );
641 Q_EXPORT void qObsolete( const char *message );
642 #endif
643
644 // DvH: added to avoid warnings on recent gcc versions
645 #define Q_DELETING_VOID_UNDEFINED
646
647 #endif // QGLOBAL_H