1 /****************************************************************************
4 ** Global type declarations and definitions
8 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
10 ** This file is part of the tools module of the Qt GUI Toolkit.
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.
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.
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.
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.
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.
33 ** Contact info@trolltech.com if any conditions of this licensing are
36 **********************************************************************/
42 #define QT_VERSION 223
43 #define QT_VERSION_STR "2.2.3"
47 // The operating system, must be one of: (_OS_x_)
50 // MSDOS - MS-DOS and Windows
52 // OS2EMX - XFree86 on OS/2 (not PM)
53 // WIN32 - Win32 (Windows 95/98 and Windows NT)
55 // SOLARIS - Sun Solaris
57 // ULTRIX - DEC Ultrix
65 // SCO - SCO of some sort
67 // UNIXWARE - SCO UnixWare
70 // UNIX - Any UNIX bsd/sysv system
73 #if defined(__APPLE__) || defined(macintosh)
75 # ifdef MAC_OS_X_VERSION_MIN_REQUIRED
76 # undef MAC_OS_X_VERSION_MIN_REQUIRED
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
83 # if !defined(MAC_OS_X_VERSION_10_4)
84 # define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 10
86 # if !defined(MAC_OS_X_VERSION_10_5)
87 # define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 10
89 # if !defined(MAC_OS_X_VERSION_10_6)
90 # define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 10
92 # if !defined(MAC_OS_X_VERSION_10_7)
93 # define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 10
95 # if !defined(MAC_OS_X_VERSION_10_8)
96 # define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 10
98 # if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_8)
99 # warning "This version of Mac OS X is unsupported"
101 #elif defined(MSDOS) || defined(_MSDOS) || defined(__MSDOS__)
103 #elif defined(OS2) || defined(_OS2) || defined(__OS2__)
109 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
111 #elif defined(__MWERKS__) && defined(__INTEL__)
113 #elif defined(sun) || defined(__sun) || defined(__sun__)
119 #elif defined(hpux) || defined(__hpux) || defined(__hpux__)
121 #elif defined(ultrix) || defined(__ultrix) || defined(__ultrix__)
123 #elif defined(reliantunix)
124 #define _OS_RELIANTUNIX_
125 #elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
127 #elif defined(__FreeBSD__)
129 #elif defined(__NetBSD__)
131 #elif defined(__OpenBSD__)
133 #elif defined(sgi) || defined(__sgi)
135 #elif defined(__osf__)
137 #elif defined(bsdi) || defined(__bsdi__)
141 #elif defined(__Lynx__)
143 #elif defined(_UNIXWARE)
144 #define _OS_UNIXWARE_
147 #elif defined(__QNX__)
149 #elif defined(_SCO_DS) || defined(M_UNIX) || defined(M_XENIX)
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__)
157 #elif defined(__BEOS__)
159 #elif defined(__MINT__)
162 #error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com"
165 #if defined(_OS_MAC_) || defined(_OS_MSDOS_) || defined(_OS_OS2_) || defined(_OS_WIN32_)
167 #elif !defined(_OS_UNIX_)
169 // QT_CLEAN_NAMESPACE is not defined by default; it would break too
171 #if !defined(QT_CLEAN_NAMESPACE) && !defined(UNIX)
179 // The compiler, must be one of: (_CC_x_)
181 // SYM - Symantec C++ for both PC and Macintosh
183 // MWERKS - Metrowerks CodeWarrior
184 // MSVC - Microsoft Visual C/C++
185 // BOR - Borland/Turbo C++
188 // COMEAU - Comeau C++
189 // EDG - Edison Design Group C++
190 // OC - CenterLine C++
194 // USLC - SCO UnixWare7 C++
200 // Should be sorted most-authorative to least-authorative
204 #elif defined( __KCC )
207 #define Q_HAS_BOOL_TYPE
208 #elif defined(applec)
210 #elif defined(__MWERKS__)
212 #define Q_HAS_BOOL_TYPE
213 #elif defined(_MSC_VER)
215 #elif defined(__BORLANDC__) || defined(__TURBOC__)
217 #elif defined(__WATCOMC__)
219 #define Q_HAS_BOOL_TYPE
220 #elif defined(__GNUC__)
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
228 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 95
229 #define Q_DELETING_VOID_UNDEFINED
231 #if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP)
232 #define Q_PACKED __attribute__ ((packed))
234 #elif defined(__xlC__)
236 #define Q_FULL_TEMPLATE_INSTANTIATION
238 #define Q_HAS_BOOL_TYPE
240 #if __xlC__ <= 0x0306
241 #define Q_TEMPLATE_NEEDS_EXPLICIT_CONVERSION
243 #elif defined(como40)
246 #define Q_HAS_BOOL_TYPE
247 #define Q_C_CALLBACKS
248 #elif defined(__USLC__)
250 #ifdef __EDG__ // UnixWare7
251 #define Q_HAS_BOOL_TYPE
253 #elif defined(__DECCXX)
255 #if __DECCXX_VER >= 60060005
256 #define Q_HAS_BOOL_TYPE
258 #elif defined(__EDG) || defined(__EDG__)
259 // one observed on SGI DCC, the other documented
261 #elif defined(OBJECTCENTER) || defined(CENTERLINE_CLPP)
264 #define Q_HAS_BOOL_TYPE
266 #elif defined(__SUNPRO_CC)
268 #if __SUNPRO_CC >= 0x500
269 #define Q_HAS_BOOL_TYPE
270 #define Q_C_CALLBACKS
272 #elif defined(__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
280 #define Q_HAS_BOOL_TYPE
284 #define Q_FULL_TEMPLATE_INSTANTIATION
285 #define Q_TEMPLATE_NEEDS_EXPLICIT_CONVERSION
288 #error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com"
291 // detect Microsoft compiler version
295 #elif _MSC_VER >= 1310
297 #elif _MSC_VER > 1300
308 // Window system setting
310 #if defined(_OS_MAC_)
312 #elif defined(_OS_MSDOS_)
314 #error "Qt requires Win32 and does not work with Windows 3.x"
315 #elif defined(_WIN32_X11_)
317 #elif defined(_OS_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_)
329 #if defined(_WS_WIN16_) || defined(_WS_WIN32_)
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.
341 #define Q_DISABLE_COPY
345 // Useful type definitions for Qt
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
358 #if (QT_VERSION >= 300)
359 #error "Use an enum for bool"
362 #if !defined(Q_HAS_BOOL_TYPE)
363 #if defined(_CC_MSVC_)
364 #define _CC_BOOL_DEF_
371 typedef unsigned char uchar;
372 typedef unsigned short ushort;
373 typedef unsigned uint;
374 typedef unsigned long ulong;
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;
382 typedef long long int64;
383 typedef unsigned long long uint64;
388 // Constant bool values
392 const bool FALSE = 0;
393 const bool TRUE = !0;
397 #if defined(_CC_MSVC_)
398 // Workaround for static const members.
399 #define QT_STATIC_CONST static
400 #define QT_STATIC_CONST_IMPL
402 #define QT_STATIC_CONST static const
403 #define QT_STATIC_CONST_IMPL const
409 // Utility macros and inline functions
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))
416 inline int qRound( double d )
418 return d > 0.0 ? int(d+0.5) : int(d-0.5);
423 // Size-dependent types (architechture-dependent byte order)
426 // QT_CLEAN_NAMESPACE is not defined by default; it would break too
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
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
447 // Data stream functions is provided by many classes (defined in qdatastream.h)
455 extern bool qt_winunicode;
459 #include <qfeatures.h>
463 // Create Qt DLL if QT_DLL is defined (Windows only)
466 #if defined(_OS_WIN32_)
467 #if defined(QT_NODLL)
472 #if defined(QT_MAKEDLL) /* create a Qt DLL library */
474 #define Q_EXPORT __declspec(dllexport)
475 #define Q_TEMPLATEDLL
476 #undef Q_DISABLE_COPY /* avoid unresolved externals */
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 */
484 #else // ! _OS_WIN32_
485 #undef QT_MAKEDLL /* ignore these for other platforms */
494 // System information
497 Q_EXPORT const char *qVersion();
498 Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian );
502 // Debugging and error handling
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
512 #if !defined(NO_DEBUG) && !defined(DEBUG)
513 #define DEBUG // display debug messages
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"
522 #if !defined(CC_WARNINGS)
523 #define Q_NO_WARNINGS
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
541 #elif defined(_CC_MWERKS_)
542 #pragma warn_possunwant off
544 #endif // Q_NO_WARNINGS
550 #if defined(_CC_EDG_) || defined(_CC_WAT_)
551 #define Q_NO_DEAD_CODE
555 // Use to avoid "unused parameter" warnings
558 #define Q_UNUSED(x) x=x;
559 #define Q_CONST_UNUSED(x) (void)x;
561 Q_EXPORT void qDebug( const char *, ... ) // print debug message
562 #if defined(_CC_GNU_) && !defined(__INSURE__)
563 __attribute__ ((format (printf, 1, 2)))
567 Q_EXPORT void qWarning( const char *, ... ) // print warning message
568 #if defined(_CC_GNU_) && !defined(__INSURE__)
569 __attribute__ ((format (printf, 1, 2)))
573 Q_EXPORT void qFatal( const char *, ... ) // print fatal message and exit
574 #if defined(_CC_GNU_)
575 __attribute__ ((format (printf, 1, 2)))
580 // QT_CLEAN_NAMESPACE is not defined by default; it would break too
582 #if !defined(QT_CLEAN_NAMESPACE)
583 // in that case, also define the old ones...
585 Q_EXPORT void debug( const char *, ... ) // print debug message
586 #if defined(_CC_GNU_) && !defined(__INSURE__)
587 __attribute__ ((format (printf, 1, 2)))
591 Q_EXPORT void warning( const char *, ... ) // print warning message
592 #if defined(_CC_GNU_) && !defined(__INSURE__)
593 __attribute__ ((format (printf, 1, 2)))
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)))
603 // okay, that was debug()/warning()/fatal()
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__)
612 #define ASSERT(x) if ( !(x) )\
613 qWarning("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__)
620 Q_EXPORT bool qt_check_pointer( bool c, const char *, int );
622 #if defined(CHECK_NULL)
623 #define CHECK_PTR(p) (qt_check_pointer((p)==0,__FILE__,__LINE__))
628 enum QtMsgType { QtDebugMsg, QtWarningMsg, QtFatalMsg };
630 typedef void (*msg_handler)(QtMsgType, const char *);
631 Q_EXPORT msg_handler qInstallMsgHandler( msg_handler );
634 Q_EXPORT void qSuppressObsoleteWarnings( bool = TRUE );
636 #if !defined(QT_REJECT_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 );
644 // DvH: added to avoid warnings on recent gcc versions
645 #define Q_DELETING_VOID_UNDEFINED