LCOV - code coverage report
Current view: top level - usr/include/x86_64-linux-gnu/qt5/QtCore - qglobal.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 8 75.0 %
Date: 2016-11-29 15:07:43 Functions: 11 33 33.3 %

          Line data    Source code
       1             : /****************************************************************************
       2             : **
       3             : ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
       4             : ** Copyright (C) 2014 Intel Corporation.
       5             : ** Contact: http://www.qt-project.org/legal
       6             : **
       7             : ** This file is part of the QtCore module of the Qt Toolkit.
       8             : **
       9             : ** $QT_BEGIN_LICENSE:LGPL$
      10             : ** Commercial License Usage
      11             : ** Licensees holding valid commercial Qt licenses may use this file in
      12             : ** accordance with the commercial license agreement provided with the
      13             : ** Software or, alternatively, in accordance with the terms contained in
      14             : ** a written agreement between you and Digia.  For licensing terms and
      15             : ** conditions see http://qt.digia.com/licensing.  For further information
      16             : ** use the contact form at http://qt.digia.com/contact-us.
      17             : **
      18             : ** GNU Lesser General Public License Usage
      19             : ** Alternatively, this file may be used under the terms of the GNU Lesser
      20             : ** General Public License version 2.1 as published by the Free Software
      21             : ** Foundation and appearing in the file LICENSE.LGPL included in the
      22             : ** packaging of this file.  Please review the following information to
      23             : ** ensure the GNU Lesser General Public License version 2.1 requirements
      24             : ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
      25             : **
      26             : ** In addition, as a special exception, Digia gives you certain additional
      27             : ** rights.  These rights are described in the Digia Qt LGPL Exception
      28             : ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
      29             : **
      30             : ** GNU General Public License Usage
      31             : ** Alternatively, this file may be used under the terms of the GNU
      32             : ** General Public License version 3.0 as published by the Free Software
      33             : ** Foundation and appearing in the file LICENSE.GPL included in the
      34             : ** packaging of this file.  Please review the following information to
      35             : ** ensure the GNU General Public License version 3.0 requirements will be
      36             : ** met: http://www.gnu.org/copyleft/gpl.html.
      37             : **
      38             : **
      39             : ** $QT_END_LICENSE$
      40             : **
      41             : ****************************************************************************/
      42             : 
      43             : #ifndef QGLOBAL_H
      44             : #define QGLOBAL_H
      45             : 
      46             : #include <stddef.h>
      47             : 
      48             : #define QT_VERSION_STR   "5.3.2"
      49             : /*
      50             :    QT_VERSION is (major << 16) + (minor << 8) + patch.
      51             : */
      52             : #define QT_VERSION 0x050302
      53             : /*
      54             :    can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
      55             : */
      56             : #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
      57             : 
      58             : #if !defined(QT_BUILD_QMAKE) && !defined(QT_BUILD_CONFIGURE)
      59             : #include <QtCore/qconfig.h>
      60             : #include <QtCore/qfeatures.h>
      61             : #endif
      62             : #ifdef _MSC_VER
      63             : #  define QT_SUPPORTS(FEATURE) (!defined QT_NO_##FEATURE)
      64             : #else
      65             : #  define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE))
      66             : #endif
      67             : #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
      68             : #  define QT_NO_UNSHARABLE_CONTAINERS
      69             : #endif
      70             : 
      71             : /* These two macros makes it possible to turn the builtin line expander into a
      72             :  * string literal. */
      73             : #define QT_STRINGIFY2(x) #x
      74             : #define QT_STRINGIFY(x) QT_STRINGIFY2(x)
      75             : 
      76             : #include <QtCore/qsystemdetection.h>
      77             : #include <QtCore/qprocessordetection.h>
      78             : #include <QtCore/qcompilerdetection.h>
      79             : 
      80             : #if defined (__ELF__)
      81             : #  define Q_OF_ELF
      82             : #endif
      83             : #if defined (__MACH__) && defined (__APPLE__)
      84             : #  define Q_OF_MACH_O
      85             : #endif
      86             : 
      87             : #ifdef __cplusplus
      88             : 
      89             : #include <algorithm>
      90             : 
      91             : #if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */
      92             : 
      93             : # define QT_PREPEND_NAMESPACE(name) ::name
      94             : # define QT_USE_NAMESPACE
      95             : # define QT_BEGIN_NAMESPACE
      96             : # define QT_END_NAMESPACE
      97             : # define QT_BEGIN_INCLUDE_NAMESPACE
      98             : # define QT_END_INCLUDE_NAMESPACE
      99             : #ifndef QT_BEGIN_MOC_NAMESPACE
     100             : # define QT_BEGIN_MOC_NAMESPACE
     101             : #endif
     102             : #ifndef QT_END_MOC_NAMESPACE
     103             : # define QT_END_MOC_NAMESPACE
     104             : #endif
     105             : # define QT_FORWARD_DECLARE_CLASS(name) class name;
     106             : # define QT_FORWARD_DECLARE_STRUCT(name) struct name;
     107             : # define QT_MANGLE_NAMESPACE(name) name
     108             : 
     109             : #else /* user namespace */
     110             : 
     111             : # define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
     112             : # define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE;
     113             : # define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE {
     114             : # define QT_END_NAMESPACE }
     115             : # define QT_BEGIN_INCLUDE_NAMESPACE }
     116             : # define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE {
     117             : #ifndef QT_BEGIN_MOC_NAMESPACE
     118             : # define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE
     119             : #endif
     120             : #ifndef QT_END_MOC_NAMESPACE
     121             : # define QT_END_MOC_NAMESPACE
     122             : #endif
     123             : # define QT_FORWARD_DECLARE_CLASS(name) \
     124             :     QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \
     125             :     using QT_PREPEND_NAMESPACE(name);
     126             : 
     127             : # define QT_FORWARD_DECLARE_STRUCT(name) \
     128             :     QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \
     129             :     using QT_PREPEND_NAMESPACE(name);
     130             : 
     131             : # define QT_MANGLE_NAMESPACE0(x) x
     132             : # define QT_MANGLE_NAMESPACE1(a, b) a##_##b
     133             : # define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b)
     134             : # define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \
     135             :         QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE))
     136             : 
     137             : namespace QT_NAMESPACE {}
     138             : 
     139             : # ifndef QT_BOOTSTRAPPED
     140             : # ifndef QT_NO_USING_NAMESPACE
     141             :    /*
     142             :     This expands to a "using QT_NAMESPACE" also in _header files_.
     143             :     It is the only way the feature can be used without too much
     144             :     pain, but if people _really_ do not want it they can add
     145             :     DEFINES += QT_NO_USING_NAMESPACE to their .pro files.
     146             :     */
     147             :    QT_USE_NAMESPACE
     148             : # endif
     149             : # endif
     150             : 
     151             : #endif /* user namespace */
     152             : 
     153             : #else /* __cplusplus */
     154             : 
     155             : # define QT_BEGIN_NAMESPACE
     156             : # define QT_END_NAMESPACE
     157             : # define QT_USE_NAMESPACE
     158             : # define QT_BEGIN_INCLUDE_NAMESPACE
     159             : # define QT_END_INCLUDE_NAMESPACE
     160             : 
     161             : #endif /* __cplusplus */
     162             : 
     163             : // ### Qt6: remove me.
     164             : #define QT_BEGIN_HEADER
     165             : #define QT_END_HEADER
     166             : 
     167             : #if defined(Q_OS_DARWIN) && !defined(QT_LARGEFILE_SUPPORT)
     168             : #  define QT_LARGEFILE_SUPPORT 64
     169             : #endif
     170             : 
     171             : QT_BEGIN_NAMESPACE
     172             : 
     173             : /*
     174             :    Size-dependent types (architechture-dependent byte order)
     175             : 
     176             :    Make sure to update QMetaType when changing these typedefs
     177             : */
     178             : 
     179             : typedef signed char qint8;         /* 8 bit signed */
     180             : typedef unsigned char quint8;      /* 8 bit unsigned */
     181             : typedef short qint16;              /* 16 bit signed */
     182             : typedef unsigned short quint16;    /* 16 bit unsigned */
     183             : typedef int qint32;                /* 32 bit signed */
     184             : typedef unsigned int quint32;      /* 32 bit unsigned */
     185             : #if defined(Q_OS_WIN) && !defined(Q_CC_GNU)
     186             : #  define Q_INT64_C(c) c ## i64    /* signed 64 bit constant */
     187             : #  define Q_UINT64_C(c) c ## ui64   /* unsigned 64 bit constant */
     188             : typedef __int64 qint64;            /* 64 bit signed */
     189             : typedef unsigned __int64 quint64;  /* 64 bit unsigned */
     190             : #else
     191             : #  define Q_INT64_C(c) static_cast<long long>(c ## LL)     /* signed 64 bit constant */
     192             : #  define Q_UINT64_C(c) static_cast<unsigned long long>(c ## ULL) /* unsigned 64 bit constant */
     193             : typedef long long qint64;           /* 64 bit signed */
     194             : typedef unsigned long long quint64; /* 64 bit unsigned */
     195             : #endif
     196             : 
     197             : typedef qint64 qlonglong;
     198             : typedef quint64 qulonglong;
     199             : 
     200             : #ifndef QT_POINTER_SIZE
     201             : #  if defined(Q_OS_WIN64) || (defined(Q_OS_WINRT) && defined(_M_X64))
     202             : #   define QT_POINTER_SIZE 8
     203             : #  elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
     204             : #   define QT_POINTER_SIZE 4
     205             : #  elif defined(Q_OS_ANDROID)
     206             : #   define QT_POINTER_SIZE 4 // ### Add auto-detection to Windows configure
     207             : #  elif !defined(QT_BOOTSTRAPPED)
     208             : #   error could not determine QT_POINTER_SIZE
     209             : #  endif
     210             : #endif
     211             : 
     212             : /*
     213             :    Useful type definitions for Qt
     214             : */
     215             : 
     216             : QT_BEGIN_INCLUDE_NAMESPACE
     217             : typedef unsigned char uchar;
     218             : typedef unsigned short ushort;
     219             : typedef unsigned int uint;
     220             : typedef unsigned long ulong;
     221             : QT_END_INCLUDE_NAMESPACE
     222             : 
     223             : #if defined(QT_COORD_TYPE)
     224             : typedef QT_COORD_TYPE qreal;
     225             : #else
     226             : typedef double qreal;
     227             : #endif
     228             : 
     229             : #if defined(QT_NO_DEPRECATED)
     230             : #  undef QT_DEPRECATED
     231             : #  undef QT_DEPRECATED_X
     232             : #  undef QT_DEPRECATED_VARIABLE
     233             : #  undef QT_DEPRECATED_CONSTRUCTOR
     234             : #elif defined(QT_DEPRECATED_WARNINGS)
     235             : #  undef QT_DEPRECATED
     236             : #  define QT_DEPRECATED Q_DECL_DEPRECATED
     237             : #  undef QT_DEPRECATED_X
     238             : #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
     239             : #  undef QT_DEPRECATED_VARIABLE
     240             : #  define QT_DEPRECATED_VARIABLE Q_DECL_VARIABLE_DEPRECATED
     241             : #  undef QT_DEPRECATED_CONSTRUCTOR
     242             : #  define QT_DEPRECATED_CONSTRUCTOR explicit Q_DECL_CONSTRUCTOR_DEPRECATED
     243             : #else
     244             : #  undef QT_DEPRECATED
     245             : #  define QT_DEPRECATED
     246             : #  undef QT_DEPRECATED_X
     247             : #  define QT_DEPRECATED_X(text)
     248             : #  undef QT_DEPRECATED_VARIABLE
     249             : #  define QT_DEPRECATED_VARIABLE
     250             : #  undef QT_DEPRECATED_CONSTRUCTOR
     251             : #  define QT_DEPRECATED_CONSTRUCTOR
     252             : #endif
     253             : 
     254             : #ifndef QT_DISABLE_DEPRECATED_BEFORE
     255             : #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0)
     256             : #endif
     257             : 
     258             : /*
     259             :     QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than
     260             :     the deprecation point specified.
     261             : 
     262             :     Use it to specify from which version of Qt a function or class has been deprecated
     263             : 
     264             :     Example:
     265             :         #if QT_DEPRECATED_SINCE(5,1)
     266             :             QT_DEPRECATED void deprecatedFunction(); //function deprecated since Qt 5.1
     267             :         #endif
     268             : 
     269             : */
     270             : #ifdef QT_DEPRECATED
     271             : #define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE)
     272             : #else
     273             : #define QT_DEPRECATED_SINCE(major, minor) 0
     274             : #endif
     275             : 
     276             : /*
     277             :    The Qt modules' export macros.
     278             :    The options are:
     279             :     - defined(QT_STATIC): Qt was built or is being built in static mode
     280             :     - defined(QT_SHARED): Qt was built or is being built in shared/dynamic mode
     281             :    If neither was defined, then QT_SHARED is implied. If Qt was compiled in static
     282             :    mode, QT_STATIC is defined in qconfig.h. In shared mode, QT_STATIC is implied
     283             :    for the bootstrapped tools.
     284             : */
     285             : 
     286             : #ifdef QT_BOOTSTRAPPED
     287             : #  ifdef QT_SHARED
     288             : #    error "QT_SHARED and QT_BOOTSTRAPPED together don't make sense. Please fix the build"
     289             : #  elif !defined(QT_STATIC)
     290             : #    define QT_STATIC
     291             : #  endif
     292             : #endif
     293             : 
     294             : #if defined(QT_SHARED) || !defined(QT_STATIC)
     295             : #  ifdef QT_STATIC
     296             : #    error "Both QT_SHARED and QT_STATIC defined, please make up your mind"
     297             : #  endif
     298             : #  ifndef QT_SHARED
     299             : #    define QT_SHARED
     300             : #  endif
     301             : #  if defined(QT_BUILD_CORE_LIB)
     302             : #    define Q_CORE_EXPORT Q_DECL_EXPORT
     303             : #  else
     304             : #    define Q_CORE_EXPORT Q_DECL_IMPORT
     305             : #  endif
     306             : #  if defined(QT_BUILD_GUI_LIB)
     307             : #    define Q_GUI_EXPORT Q_DECL_EXPORT
     308             : #  else
     309             : #    define Q_GUI_EXPORT Q_DECL_IMPORT
     310             : #  endif
     311             : #  if defined(QT_BUILD_WIDGETS_LIB)
     312             : #    define Q_WIDGETS_EXPORT Q_DECL_EXPORT
     313             : #  else
     314             : #    define Q_WIDGETS_EXPORT Q_DECL_IMPORT
     315             : #  endif
     316             : #  if defined(QT_BUILD_NETWORK_LIB)
     317             : #    define Q_NETWORK_EXPORT Q_DECL_EXPORT
     318             : #  else
     319             : #    define Q_NETWORK_EXPORT Q_DECL_IMPORT
     320             : #  endif
     321             : #else
     322             : #  define Q_CORE_EXPORT
     323             : #  define Q_GUI_EXPORT
     324             : #  define Q_WIDGETS_EXPORT
     325             : #  define Q_NETWORK_EXPORT
     326             : #endif
     327             : 
     328             : /*
     329             :    No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols
     330             :    for Qt's internal unit tests. If you want slower loading times and more
     331             :    symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL.
     332             : */
     333             : #if defined(QT_BUILD_INTERNAL) && defined(QT_BUILDING_QT) && defined(QT_SHARED)
     334             : #    define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
     335             : #elif defined(QT_BUILD_INTERNAL) && defined(QT_SHARED)
     336             : #    define Q_AUTOTEST_EXPORT Q_DECL_IMPORT
     337             : #else
     338             : #    define Q_AUTOTEST_EXPORT
     339             : #endif
     340             : 
     341             : #define Q_INIT_RESOURCE(name) \
     342             :     do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) ();       \
     343             :         QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0)
     344             : #define Q_CLEANUP_RESOURCE(name) \
     345             :     do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) ();    \
     346             :         QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (0)
     347             : 
     348             : /*
     349             :  * If we're compiling C++ code:
     350             :  *  - and this is a non-namespace build, declare qVersion as extern "C"
     351             :  *  - and this is a namespace build, declare it as a regular function
     352             :  *    (we're already inside QT_BEGIN_NAMESPACE / QT_END_NAMESPACE)
     353             :  * If we're compiling C code, simply declare the function. If Qt was compiled
     354             :  * in a namespace, qVersion isn't callable anyway.
     355             :  */
     356             : #if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC)
     357             : extern "C"
     358             : #endif
     359             : Q_CORE_EXPORT const char *qVersion() Q_DECL_NOTHROW;
     360             : 
     361             : #if defined(__cplusplus)
     362             : 
     363             : #ifndef Q_CONSTRUCTOR_FUNCTION
     364             : # define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
     365             :     namespace { \
     366             :     static const struct AFUNC ## _ctor_class_ { \
     367             :         inline AFUNC ## _ctor_class_() { AFUNC(); } \
     368             :     } AFUNC ## _ctor_instance_; \
     369             :     }
     370             : 
     371             : # define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
     372             : #endif
     373             : 
     374             : #ifndef Q_DESTRUCTOR_FUNCTION
     375             : # define Q_DESTRUCTOR_FUNCTION0(AFUNC) \
     376             :     namespace { \
     377             :     static const struct AFUNC ## _dtor_class_ { \
     378             :         inline AFUNC ## _dtor_class_() { } \
     379             :         inline ~ AFUNC ## _dtor_class_() { AFUNC(); } \
     380             :     } AFUNC ## _dtor_instance_; \
     381             :     }
     382             : # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
     383             : #endif
     384             : 
     385             : namespace QtPrivate {
     386             :     template <class T>
     387             :     struct AlignOfHelper
     388             :     {
     389             :         char c;
     390             :         T type;
     391             : 
     392             :         AlignOfHelper();
     393             :         ~AlignOfHelper();
     394             :     };
     395             : 
     396             :     template <class T>
     397             :     struct AlignOf_Default
     398             :     {
     399             :         enum { Value = sizeof(AlignOfHelper<T>) - sizeof(T) };
     400             :     };
     401             : 
     402             :     template <class T> struct AlignOf : AlignOf_Default<T> { };
     403             :     template <class T> struct AlignOf<T &> : AlignOf<T> {};
     404             :     template <size_t N, class T> struct AlignOf<T[N]> : AlignOf<T> {};
     405             : 
     406             : #ifdef Q_COMPILER_RVALUE_REFS
     407             :     template <class T> struct AlignOf<T &&> : AlignOf<T> {};
     408             : #endif
     409             : 
     410             : #if defined(Q_PROCESSOR_X86_32) && !defined(Q_OS_WIN)
     411             :     template <class T> struct AlignOf_WorkaroundForI386Abi { enum { Value = sizeof(T) }; };
     412             : 
     413             :     // x86 ABI weirdness
     414             :     // Alignment of naked type is 8, but inside struct has alignment 4.
     415             :     template <> struct AlignOf<double>  : AlignOf_WorkaroundForI386Abi<double> {};
     416             :     template <> struct AlignOf<qint64>  : AlignOf_WorkaroundForI386Abi<qint64> {};
     417             :     template <> struct AlignOf<quint64> : AlignOf_WorkaroundForI386Abi<quint64> {};
     418             : #ifdef Q_CC_CLANG
     419             :     // GCC and Clang seem to disagree wrt to alignment of arrays
     420             :     template <size_t N> struct AlignOf<double[N]>   : AlignOf_Default<double> {};
     421             :     template <size_t N> struct AlignOf<qint64[N]>   : AlignOf_Default<qint64> {};
     422             :     template <size_t N> struct AlignOf<quint64[N]>  : AlignOf_Default<quint64> {};
     423             : #endif
     424             : #endif
     425             : } // namespace QtPrivate
     426             : 
     427             : #define QT_EMULATED_ALIGNOF(T) \
     428             :     (size_t(QT_PREPEND_NAMESPACE(QtPrivate)::AlignOf<T>::Value))
     429             : 
     430             : #ifndef Q_ALIGNOF
     431             : #define Q_ALIGNOF(T) QT_EMULATED_ALIGNOF(T)
     432             : #endif
     433             : 
     434             : 
     435             : /*
     436             :   quintptr and qptrdiff is guaranteed to be the same size as a pointer, i.e.
     437             : 
     438             :       sizeof(void *) == sizeof(quintptr)
     439             :       && sizeof(void *) == sizeof(qptrdiff)
     440             : */
     441             : template <int> struct QIntegerForSize;
     442             : template <>    struct QIntegerForSize<1> { typedef quint8  Unsigned; typedef qint8  Signed; };
     443             : template <>    struct QIntegerForSize<2> { typedef quint16 Unsigned; typedef qint16 Signed; };
     444             : template <>    struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; };
     445             : template <>    struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; };
     446             : template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { };
     447             : typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Signed qregisterint;
     448             : typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint;
     449             : typedef QIntegerForSizeof<void*>::Unsigned quintptr;
     450             : typedef QIntegerForSizeof<void*>::Signed qptrdiff;
     451             : typedef qptrdiff qintptr;
     452             : 
     453             : /* moc compats (signals/slots) */
     454             : #ifndef QT_MOC_COMPAT
     455             : #  define QT_MOC_COMPAT
     456             : #else
     457             : #  undef QT_MOC_COMPAT
     458             : #  define QT_MOC_COMPAT
     459             : #endif
     460             : 
     461             : #ifdef QT_ASCII_CAST_WARNINGS
     462             : #  define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED
     463             : #else
     464             : #  define QT_ASCII_CAST_WARN
     465             : #endif
     466             : 
     467             : #if defined(__i386__) || defined(_WIN32) || defined(_WIN32_WCE)
     468             : #  if defined(Q_CC_GNU)
     469             : #    define QT_FASTCALL __attribute__((regparm(3)))
     470             : #  elif defined(Q_CC_MSVC)
     471             : #    define QT_FASTCALL __fastcall
     472             : #  else
     473             : #     define QT_FASTCALL
     474             : #  endif
     475             : #else
     476             : #  define QT_FASTCALL
     477             : #endif
     478             : 
     479             : // enable gcc warnings for printf-style functions
     480             : #if defined(Q_CC_GNU) && !defined(__INSURE__)
     481             : #  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
     482             : #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \
     483             :          __attribute__((format(gnu_printf, (A), (B))))
     484             : #  else
     485             : #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \
     486             :          __attribute__((format(printf, (A), (B))))
     487             : #  endif
     488             : #else
     489             : #  define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
     490             : #endif
     491             : 
     492             : //defines the type for the WNDPROC on windows
     493             : //the alignment needs to be forced for sse2 to not crash with mingw
     494             : #if defined(Q_OS_WIN)
     495             : #  if defined(Q_CC_MINGW) && !defined(Q_OS_WIN64)
     496             : #    define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer))
     497             : #  else
     498             : #    define QT_ENSURE_STACK_ALIGNED_FOR_SSE
     499             : #  endif
     500             : #  define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE
     501             : #endif
     502             : 
     503             : typedef int QNoImplicitBoolCast;
     504             : 
     505             : /*
     506             :    Utility macros and inline functions
     507             : */
     508             : 
     509             : template <typename T>
     510             : Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
     511             : 
     512             : Q_DECL_CONSTEXPR inline int qRound(double d)
     513             : { return d >= 0.0 ? int(d + 0.5) : int(d - double(int(d-1)) + 0.5) + int(d-1); }
     514             : Q_DECL_CONSTEXPR inline int qRound(float d)
     515             : { return d >= 0.0f ? int(d + 0.5f) : int(d - float(int(d-1)) + 0.5f) + int(d-1); }
     516             : #ifdef Q_QDOC
     517             : /*
     518             :     Just for documentation generation
     519             : */
     520             : int qRound(qreal d);
     521             : #endif
     522             : 
     523             : Q_DECL_CONSTEXPR inline qint64 qRound64(double d)
     524             : { return d >= 0.0 ? qint64(d + 0.5) : qint64(d - double(qint64(d-1)) + 0.5) + qint64(d-1); }
     525             : Q_DECL_CONSTEXPR inline qint64 qRound64(float d)
     526             : { return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - float(qint64(d-1)) + 0.5f) + qint64(d-1); }
     527             : #ifdef Q_QDOC
     528             : /*
     529             :     Just for documentation generation
     530             : */
     531             : qint64 qRound64(qreal d);
     532             : #endif
     533             : 
     534             : template <typename T>
     535           0 : Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }
     536             : template <typename T>
     537           0 : Q_DECL_CONSTEXPR inline const T &qMax(const T &a, const T &b) { return (a < b) ? b : a; }
     538             : template <typename T>
     539             : Q_DECL_CONSTEXPR inline const T &qBound(const T &min, const T &val, const T &max)
     540             : { return qMax(min, qMin(max, val)); }
     541             : 
     542             : #ifdef Q_OS_DARWIN
     543             : #  define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) \
     544             :     ((defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MAX_ALLOWED >= osx) || \
     545             :      (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios))
     546             : 
     547             : #  define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) \
     548             :     ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && osx != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < osx) || \
     549             :      (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios))
     550             : 
     551             : #  define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \
     552             :       QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios)
     553             : #  define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) \
     554             :       QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, __IPHONE_NA)
     555             : 
     556             : #  define QT_IOS_DEPLOYMENT_TARGET_BELOW(ios) \
     557             :       QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios)
     558             : #  define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) \
     559             :       QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, __IPHONE_NA)
     560             : #endif
     561             : 
     562             : /*
     563             :    Data stream functions are provided by many classes (defined in qdatastream.h)
     564             : */
     565             : 
     566             : class QDataStream;
     567             : 
     568             : #if defined(Q_OS_VXWORKS)
     569             : #  define QT_NO_CRASHHANDLER     // no popen
     570             : #  define QT_NO_PROCESS          // no exec*, no fork
     571             : #  define QT_NO_SHAREDMEMORY     // only POSIX, no SysV and in the end...
     572             : #  define QT_NO_SYSTEMSEMAPHORE  // not needed at all in a flat address space
     573             : #endif
     574             : 
     575             : #if defined(Q_OS_WINRT)
     576             : #  define QT_NO_FILESYSTEMWATCHER
     577             : #  define QT_NO_GETADDRINFO
     578             : #  define QT_NO_NETWORKPROXY
     579             : #  define QT_NO_PROCESS
     580             : #  define QT_NO_SOCKETNOTIFIER
     581             : #  define QT_NO_SOCKS5
     582             : #endif
     583             : 
     584         614 : inline void qt_noop(void) {}
     585             : 
     586             : /* These wrap try/catch so we can switch off exceptions later.
     587             : 
     588             :    Beware - do not use more than one QT_CATCH per QT_TRY, and do not use
     589             :    the exception instance in the catch block.
     590             :    If you can't live with those constraints, don't use these macros.
     591             :    Use the QT_NO_EXCEPTIONS macro to protect your code instead.
     592             : */
     593             : 
     594             : #if !defined(QT_NO_EXCEPTIONS)
     595             : #  if defined(QT_BOOTSTRAPPED) || (defined(Q_CC_GNU) && !defined (__EXCEPTIONS) && !defined(Q_MOC_RUN))
     596             : #    define QT_NO_EXCEPTIONS
     597             : #  endif
     598             : #endif
     599             : 
     600             : #ifdef QT_NO_EXCEPTIONS
     601             : #  define QT_TRY if (true)
     602             : #  define QT_CATCH(A) else
     603             : #  define QT_THROW(A) qt_noop()
     604             : #  define QT_RETHROW qt_noop()
     605             : #  define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0)
     606             : #else
     607             : #  define QT_TRY try
     608             : #  define QT_CATCH(A) catch (A)
     609             : #  define QT_THROW(A) throw A
     610             : #  define QT_RETHROW throw
     611             : Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
     612             : #  ifdef Q_COMPILER_NOEXCEPT
     613             : #    define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (0)
     614             : #  else
     615             : #    define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (0)
     616             : #  endif
     617             : #endif
     618             : 
     619             : Q_CORE_EXPORT bool qSharedBuild() Q_DECL_NOTHROW;
     620             : 
     621             : #ifndef Q_OUTOFLINE_TEMPLATE
     622             : #  define Q_OUTOFLINE_TEMPLATE
     623             : #endif
     624             : #ifndef Q_INLINE_TEMPLATE
     625             : #  define Q_INLINE_TEMPLATE inline
     626             : #endif
     627             : 
     628             : /*
     629             :    Avoid "unused parameter" warnings
     630             : */
     631             : 
     632             : #if defined(Q_CC_RVCT)
     633             : template <typename T>
     634             : inline void qUnused(T &x) { (void)x; }
     635             : #  define Q_UNUSED(x) qUnused(x);
     636             : #else
     637             : #  define Q_UNUSED(x) (void)x;
     638             : #endif
     639             : 
     640             : /*
     641             :    Debugging and error handling
     642             : */
     643             : 
     644             : #if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
     645             : #  define QT_DEBUG
     646             : #endif
     647             : 
     648             : #ifndef qPrintable
     649             : #  define qPrintable(string) QString(string).toLocal8Bit().constData()
     650             : #endif
     651             : 
     652             : class QString;
     653             : Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
     654             : 
     655             : #ifndef Q_CC_MSVC
     656             : Q_NORETURN
     657             : #endif
     658             : Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW;
     659             : 
     660             : #if !defined(Q_ASSERT)
     661             : #  if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
     662             : #    define Q_ASSERT(cond) qt_noop()
     663             : #  else
     664             : #    define Q_ASSERT(cond) ((!(cond)) ? qt_assert(#cond,__FILE__,__LINE__) : qt_noop())
     665             : #  endif
     666             : #endif
     667             : 
     668             : #if defined(QT_NO_DEBUG) && !defined(QT_PAINT_DEBUG)
     669             : #define QT_NO_PAINT_DEBUG
     670             : #endif
     671             : 
     672             : #ifndef Q_CC_MSVC
     673             : Q_NORETURN
     674             : #endif
     675             : Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW;
     676             : 
     677             : #if !defined(Q_ASSERT_X)
     678             : #  if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
     679             : #    define Q_ASSERT_X(cond, where, what) qt_noop()
     680             : #  else
     681             : #    define Q_ASSERT_X(cond, where, what) ((!(cond)) ? qt_assert_x(where, what,__FILE__,__LINE__) : qt_noop())
     682             : #  endif
     683             : #endif
     684             : 
     685             : 
     686             : #ifdef Q_COMPILER_STATIC_ASSERT
     687             : #define Q_STATIC_ASSERT(Condition) static_assert(bool(Condition), #Condition)
     688             : #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
     689             : #else
     690             : // Intentionally undefined
     691             : template <bool Test> class QStaticAssertFailure;
     692             : template <> class QStaticAssertFailure<true> {};
     693             : 
     694             : #define Q_STATIC_ASSERT_PRIVATE_JOIN(A, B) Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B)
     695             : #define Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B) A ## B
     696             : #ifdef __COUNTER__
     697             : #define Q_STATIC_ASSERT(Condition) \
     698             :     enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __COUNTER__) = sizeof(QStaticAssertFailure<!!(Condition)>)}
     699             : #else
     700             : #define Q_STATIC_ASSERT(Condition) \
     701             :     enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __LINE__) = sizeof(QStaticAssertFailure<!!(Condition)>)}
     702             : #endif /* __COUNTER__ */
     703             : #define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition)
     704             : #endif
     705             : 
     706             : Q_CORE_EXPORT void qt_check_pointer(const char *, int);
     707             : Q_CORE_EXPORT void qBadAlloc();
     708             : 
     709             : #ifdef QT_NO_EXCEPTIONS
     710             : #  if defined(QT_NO_DEBUG)
     711             : #    define Q_CHECK_PTR(p) qt_noop()
     712             : #  else
     713             : #    define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0)
     714             : #  endif
     715             : #else
     716             : #  define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (0)
     717             : #endif
     718             : 
     719             : template <typename T>
     720             : inline T *q_check_ptr(T *p) { Q_CHECK_PTR(p); return p; }
     721             : 
     722             : typedef void (*QFunctionPointer)();
     723             : 
     724             : #if !defined(Q_UNIMPLEMENTED)
     725             : #  define Q_UNIMPLEMENTED() qWarning("%s:%d: %s: Unimplemented code.", __FILE__, __LINE__, Q_FUNC_INFO)
     726             : #endif
     727             : 
     728             : Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
     729             : Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(double p1, double p2)
     730             : {
     731             :     return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
     732             : }
     733             : 
     734             : Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2) Q_REQUIRED_RESULT Q_DECL_UNUSED;
     735             : Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
     736             : {
     737             :     return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
     738             : }
     739             : 
     740             : /*!
     741             :   \internal
     742             : */
     743             : Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
     744             : Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(double d)
     745             : {
     746             :     return qAbs(d) <= 0.000000000001;
     747             : }
     748             : 
     749             : /*!
     750             :   \internal
     751             : */
     752             : Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
     753             : Q_DECL_CONSTEXPR static inline bool qFuzzyIsNull(float f)
     754             : {
     755             :     return qAbs(f) <= 0.00001f;
     756             : }
     757             : 
     758             : /*
     759             :    This function tests a double for a null value. It doesn't
     760             :    check whether the actual value is 0 or close to 0, but whether
     761             :    it is binary 0, disregarding sign.
     762             : */
     763             : static inline bool qIsNull(double d) Q_REQUIRED_RESULT Q_DECL_UNUSED;
     764             : static inline bool qIsNull(double d)
     765             : {
     766             :     union U {
     767             :         double d;
     768             :         quint64 u;
     769             :     };
     770             :     U val;
     771             :     val.d = d;
     772             :     return (val.u & Q_UINT64_C(0x7fffffffffffffff)) == 0;
     773             : }
     774             : 
     775             : /*
     776             :    This function tests a float for a null value. It doesn't
     777             :    check whether the actual value is 0 or close to 0, but whether
     778             :    it is binary 0, disregarding sign.
     779             : */
     780             : static inline bool qIsNull(float f) Q_REQUIRED_RESULT Q_DECL_UNUSED;
     781             : static inline bool qIsNull(float f)
     782             : {
     783             :     union U {
     784             :         float f;
     785             :         quint32 u;
     786             :     };
     787             :     U val;
     788             :     val.f = f;
     789             :     return (val.u & 0x7fffffff) == 0;
     790             : }
     791             : 
     792             : /*
     793             :    Compilers which follow outdated template instantiation rules
     794             :    require a class to have a comparison operator to exist when
     795             :    a QList of this type is instantiated. It's not actually
     796             :    used in the list, though. Hence the dummy implementation.
     797             :    Just in case other code relies on it we better trigger a warning
     798             :    mandating a real implementation.
     799             : */
     800             : 
     801             : #ifdef Q_FULL_TEMPLATE_INSTANTIATION
     802             : #  define Q_DUMMY_COMPARISON_OPERATOR(C) \
     803             :     bool operator==(const C&) const { \
     804             :         qWarning(#C"::operator==(const "#C"&) was called"); \
     805             :         return false; \
     806             :     }
     807             : #else
     808             : 
     809             : #  define Q_DUMMY_COMPARISON_OPERATOR(C)
     810             : #endif
     811             : 
     812             : template <typename T>
     813          52 : inline void qSwap(T &value1, T &value2)
     814             : {
     815             :     using std::swap;
     816          52 :     swap(value1, value2);
     817          52 : }
     818             : 
     819             : #if QT_DEPRECATED_SINCE(5, 0)
     820             : Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1);
     821             : Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr);
     822             : Q_CORE_EXPORT QT_DEPRECATED void *qRealloc(void *ptr, size_t size) Q_ALLOC_SIZE(2);
     823             : Q_CORE_EXPORT QT_DEPRECATED void *qMemCopy(void *dest, const void *src, size_t n);
     824             : Q_CORE_EXPORT QT_DEPRECATED void *qMemSet(void *dest, int c, size_t n);
     825             : #endif
     826             : Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1);
     827             : Q_CORE_EXPORT void *qReallocAligned(void *ptr, size_t size, size_t oldsize, size_t alignment) Q_ALLOC_SIZE(2);
     828             : Q_CORE_EXPORT void qFreeAligned(void *ptr);
     829             : 
     830             : 
     831             : /*
     832             :    Avoid some particularly useless warnings from some stupid compilers.
     833             :    To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
     834             :    the line "#define QT_NO_WARNINGS".
     835             : */
     836             : #if !defined(QT_CC_WARNINGS)
     837             : #  define QT_NO_WARNINGS
     838             : #endif
     839             : #if defined(QT_NO_WARNINGS)
     840             : #  if defined(Q_CC_MSVC)
     841             : #    pragma warning(disable: 4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */
     842             : #    pragma warning(disable: 4244) /* conversion from 'type1' to 'type2', possible loss of data */
     843             : #    pragma warning(disable: 4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
     844             : #    pragma warning(disable: 4514) /* unreferenced inline function has been removed */
     845             : #    pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
     846             : #    pragma warning(disable: 4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
     847             : #    pragma warning(disable: 4706) /* assignment within conditional expression */
     848             : #    if _MSC_VER <= 1310 // MSVC 2003
     849             : #      pragma warning(disable: 4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */
     850             : #    endif
     851             : #    pragma warning(disable: 4355) /* 'this' : used in base member initializer list */
     852             : #    if _MSC_VER < 1800 // MSVC 2013
     853             : #      pragma warning(disable: 4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */
     854             : #    endif
     855             : #    pragma warning(disable: 4710) /* function not inlined */
     856             : #    pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
     857             : #  elif defined(Q_CC_BOR)
     858             : #    pragma option -w-inl
     859             : #    pragma option -w-aus
     860             : #    pragma warn -inl
     861             : #    pragma warn -pia
     862             : #    pragma warn -ccc
     863             : #    pragma warn -rch
     864             : #    pragma warn -sig
     865             : #  endif
     866             : #endif
     867             : 
     868             : #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_RVCT)
     869             : /* make use of typeof-extension */
     870             : template <typename T>
     871          42 : class QForeachContainer {
     872             : public:
     873          42 :     inline QForeachContainer(const T& t) : c(t), brk(0), i(c.begin()), e(c.end()) { }
     874             :     const T c;
     875             :     int brk;
     876             :     typename T::const_iterator i, e;
     877             : };
     878             : 
     879             : #define Q_FOREACH(variable, container)                                \
     880             : for (QForeachContainer<__typeof__((container))> _container_((container)); \
     881             :      !_container_.brk && _container_.i != _container_.e;              \
     882             :      __extension__  ({ ++_container_.brk; ++_container_.i; }))                       \
     883             :     for (variable = *_container_.i;; __extension__ ({--_container_.brk; break;}))
     884             : 
     885             : #else
     886             : 
     887             : struct QForeachContainerBase {};
     888             : 
     889             : template <typename T>
     890             : class QForeachContainer : public QForeachContainerBase {
     891             :     QForeachContainer &operator=(const QForeachContainer &) Q_DECL_EQ_DELETE;
     892             : public:
     893             :     inline QForeachContainer(const T& t): c(t), brk(0), i(c.begin()), e(c.end()){}
     894             :     QForeachContainer(const QForeachContainer &other)
     895             :         : c(other.c), brk(other.brk), i(other.i), e(other.e) {}
     896             :     const T c;
     897             :     mutable int brk;
     898             :     mutable typename T::const_iterator i, e;
     899             :     inline bool condition() const { return (!brk++ && i != e); }
     900             : };
     901             : 
     902             : template <typename T> inline T *qForeachPointer(const T &) { return 0; }
     903             : 
     904             : template <typename T> inline QForeachContainer<T> qForeachContainerNew(const T& t)
     905             : { return QForeachContainer<T>(t); }
     906             : 
     907             : template <typename T>
     908             : inline const QForeachContainer<T> *qForeachContainer(const QForeachContainerBase *base, const T *)
     909             : { return static_cast<const QForeachContainer<T> *>(base); }
     910             : 
     911             : #if defined(Q_CC_DIAB)
     912             : // VxWorks DIAB generates unresolvable symbols, if container is a function call
     913             : #  define Q_FOREACH(variable,container)                                                             \
     914             :     if(0){}else                                                                                     \
     915             :     for (const QForeachContainerBase &_container_ = qForeachContainerNew(container);                \
     916             :          qForeachContainer(&_container_, (__typeof__(container) *) 0)->condition();       \
     917             :          ++qForeachContainer(&_container_, (__typeof__(container) *) 0)->i)               \
     918             :         for (variable = *qForeachContainer(&_container_, (__typeof__(container) *) 0)->i; \
     919             :              qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk;           \
     920             :              --qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk)
     921             : 
     922             : #else
     923             : #  define Q_FOREACH(variable, container) \
     924             :     for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \
     925             :          qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->condition();       \
     926             :          ++qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i)               \
     927             :         for (variable = *qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->i; \
     928             :              qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk;           \
     929             :              --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk)
     930             : #endif // MSVC6 || MIPSpro
     931             : 
     932             : #endif
     933             : 
     934             : #define Q_FOREVER for(;;)
     935             : #ifndef QT_NO_KEYWORDS
     936             : #  ifndef foreach
     937             : #    define foreach Q_FOREACH
     938             : #  endif
     939             : #  ifndef forever
     940             : #    define forever Q_FOREVER
     941             : #  endif
     942             : #endif
     943             : 
     944             : template <typename T> static inline T *qGetPtrHelper(T *ptr) { return ptr; }
     945             : template <typename Wrapper> static inline typename Wrapper::pointer qGetPtrHelper(const Wrapper &p) { return p.data(); }
     946             : 
     947             : #define Q_DECLARE_PRIVATE(Class) \
     948             :     inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr)); } \
     949             :     inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \
     950             :     friend class Class##Private;
     951             : 
     952             : #define Q_DECLARE_PRIVATE_D(Dptr, Class) \
     953             :     inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(Dptr); } \
     954             :     inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(Dptr); } \
     955             :     friend class Class##Private;
     956             : 
     957             : #define Q_DECLARE_PUBLIC(Class)                                    \
     958             :     inline Class* q_func() { return static_cast<Class *>(q_ptr); } \
     959             :     inline const Class* q_func() const { return static_cast<const Class *>(q_ptr); } \
     960             :     friend class Class;
     961             : 
     962             : #define Q_D(Class) Class##Private * const d = d_func()
     963             : #define Q_Q(Class) Class * const q = q_func()
     964             : 
     965             : #define QT_TR_NOOP(x) x
     966             : #define QT_TR_NOOP_UTF8(x) x
     967             : #define QT_TRANSLATE_NOOP(scope, x) x
     968             : #define QT_TRANSLATE_NOOP_UTF8(scope, x) x
     969             : #define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment}
     970             : #define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment}
     971             : 
     972             : #ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above
     973             : 
     974             : // Defined in qcoreapplication.cpp
     975             : // The better name qTrId() is reserved for an upcoming function which would
     976             : // return a much more powerful QStringFormatter instead of a QString.
     977             : Q_CORE_EXPORT QString qtTrId(const char *id, int n = -1);
     978             : 
     979             : #define QT_TRID_NOOP(id) id
     980             : 
     981             : #endif // QT_NO_TRANSLATION
     982             : 
     983             : #define QDOC_PROPERTY(text)
     984             : 
     985             : /*
     986             :    When RTTI is not available, define this macro to force any uses of
     987             :    dynamic_cast to cause a compile failure.
     988             : */
     989             : 
     990             : #if defined(QT_NO_DYNAMIC_CAST) && !defined(dynamic_cast)
     991             : #  define dynamic_cast QT_PREPEND_NAMESPACE(qt_dynamic_cast_check)
     992             : 
     993             :   template<typename T, typename X>
     994             :   T qt_dynamic_cast_check(X, T* = 0)
     995             :   { return T::dynamic_cast_will_always_fail_because_rtti_is_disabled; }
     996             : #endif
     997             : 
     998             : /*
     999             :    Some classes do not permit copies to be made of an object. These
    1000             :    classes contains a private copy constructor and assignment
    1001             :    operator to disable copying (the compiler gives an error message).
    1002             : */
    1003             : #define Q_DISABLE_COPY(Class) \
    1004             :     Class(const Class &) Q_DECL_EQ_DELETE;\
    1005             :     Class &operator=(const Class &) Q_DECL_EQ_DELETE;
    1006             : 
    1007             : class QByteArray;
    1008             : Q_CORE_EXPORT QByteArray qgetenv(const char *varName);
    1009             : Q_CORE_EXPORT bool qputenv(const char *varName, const QByteArray& value);
    1010             : Q_CORE_EXPORT bool qunsetenv(const char *varName);
    1011             : 
    1012             : Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT;
    1013             : Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT;
    1014             : 
    1015             : inline int qIntCast(double f) { return int(f); }
    1016             : inline int qIntCast(float f) { return int(f); }
    1017             : 
    1018             : /*
    1019             :   Reentrant versions of basic rand() functions for random number generation
    1020             : */
    1021             : Q_CORE_EXPORT void qsrand(uint seed);
    1022             : Q_CORE_EXPORT int qrand();
    1023             : 
    1024             : #define QT_MODULE(x)
    1025             : 
    1026             : #ifdef Q_OS_QNX
    1027             : // QNX doesn't have SYSV style shared memory. Multiprocess QWS apps,
    1028             : // shared fonts and QSystemSemaphore + QSharedMemory are not available
    1029             : #  define QT_NO_SYSTEMSEMAPHORE
    1030             : #  define QT_NO_SHAREDMEMORY
    1031             : #endif
    1032             : 
    1033             : #if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) && defined(__ELF__) && !defined(__PIC__) && !defined(__PIE__)
    1034             : #  error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\
    1035             :          "Compile your code with -fPIC or -fPIE."
    1036             : #endif
    1037             : 
    1038             : namespace QtPrivate {
    1039             : //like std::enable_if
    1040             : template <bool B, typename T = void> struct QEnableIf;
    1041             : template <typename T> struct QEnableIf<true, T> { typedef T Type; };
    1042             : 
    1043             : template <bool B, typename T, typename F> struct QConditional { typedef T Type; };
    1044             : template <typename T, typename F> struct QConditional<false, T, F> { typedef F Type; };
    1045             : }
    1046             : 
    1047             : #ifndef Q_FORWARD_DECLARE_OBJC_CLASS
    1048             : #  ifdef __OBJC__
    1049             : #    define Q_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname
    1050             : #  else
    1051             : #    define Q_FORWARD_DECLARE_OBJC_CLASS(classname) typedef struct objc_object classname
    1052             : #  endif
    1053             : #endif
    1054             : #ifndef Q_FORWARD_DECLARE_CF_TYPE
    1055             : #  define Q_FORWARD_DECLARE_CF_TYPE(type) typedef const struct __ ## type * type ## Ref
    1056             : #endif
    1057             : #ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE
    1058             : #  define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref
    1059             : #endif
    1060             : 
    1061             : QT_END_NAMESPACE
    1062             : 
    1063             : // We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4.
    1064             : // Be careful when changing the order of these files.
    1065             : #include <QtCore/qtypeinfo.h>
    1066             : #include <QtCore/qsysinfo.h>
    1067             : #include <QtCore/qlogging.h>
    1068             : 
    1069             : #include <QtCore/qflags.h>
    1070             : 
    1071             : #include <QtCore/qatomic.h>
    1072             : #include <QtCore/qglobalstatic.h>
    1073             : #include <QtCore/qnumeric.h>
    1074             : 
    1075             : #endif /* __cplusplus */
    1076             : 
    1077             : #endif /* QGLOBAL_H */

Generated by: LCOV version 1.11