Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtCore/qtversionchecks.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2022 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QTVERSIONCHECKS_H
0005 #define QTVERSIONCHECKS_H
0006 
0007 #if 0
0008 #pragma qt_class(QtVersionChecks)
0009 #pragma qt_sync_stop_processing
0010 #endif
0011 
0012 #include <QtCore/qtconfiginclude.h>
0013 
0014 /*
0015    QT_VERSION is (major << 16) | (minor << 8) | patch.
0016 */
0017 #define QT_VERSION      QT_VERSION_CHECK(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH)
0018 /*
0019    can be used like #if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
0020 */
0021 #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
0022 
0023 /*
0024    Helper macros to make some simple code active in Qt 6 or Qt 7 only,
0025    like:
0026      struct QT6_ONLY(Q_CORE_EXPORT) QTrivialClass
0027      {
0028          void QT7_ONLY(Q_CORE_EXPORT) void operate();
0029      }
0030 */
0031 #if QT_VERSION_MAJOR == 7 || defined(QT_BOOTSTRAPPED)
0032 #  define QT7_ONLY(...)         __VA_ARGS__
0033 #  define QT6_ONLY(...)
0034 #elif QT_VERSION_MAJOR == 6
0035 #  define QT7_ONLY(...)
0036 #  define QT6_ONLY(...)         __VA_ARGS__
0037 #else
0038 #  error Qt major version not 6 or 7
0039 #endif
0040 
0041 /* Macro and tag type to help overload resolution on functions
0042    that are, e.g., QT_REMOVED_SINCE'ed. Example use:
0043 
0044    #if QT_CORE_REMOVED_SINCE(6, 4)
0045    int size() const;
0046    #endif
0047    qsizetype size(QT6_DECL_NEW_OVERLOAD) const;
0048 
0049    in the normal cpp file:
0050 
0051    qsizetype size(QT6_IMPL_NEW_OVERLOAD) const {
0052       ~~~
0053    }
0054 
0055    in removed_api.cpp:
0056 
0057    int size() const { return int(size(QT6_CALL_NEW_OVERLOAD)); }
0058 */
0059 #ifdef Q_QDOC
0060 # define QT6_DECL_NEW_OVERLOAD
0061 # define QT6_DECL_NEW_OVERLOAD_TAIL
0062 # define QT6_IMPL_NEW_OVERLOAD
0063 # define QT6_IMPL_NEW_OVERLOAD_TAIL
0064 # define QT6_CALL_NEW_OVERLOAD
0065 # define QT6_CALL_NEW_OVERLOAD_TAIL
0066 #else
0067 # define QT6_DECL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t = Qt::Disambiguated)
0068 # define QT6_DECL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_DECL_NEW_OVERLOAD)
0069 # define QT6_IMPL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated_t)
0070 # define QT6_IMPL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_IMPL_NEW_OVERLOAD)
0071 # define QT6_CALL_NEW_OVERLOAD QT6_ONLY(Qt::Disambiguated)
0072 # define QT6_CALL_NEW_OVERLOAD_TAIL QT6_ONLY(, QT6_CALL_NEW_OVERLOAD)
0073 #endif
0074 
0075 /*
0076     Macro to tag Tech Preview APIs.
0077     It expands to nothing, because we want to use it in places where
0078     nothing is generally allowed (not even an attribute); for instance:
0079     to tag other macros, Q_PROPERTY declarations, and so on.
0080 
0081     Still: use it as if it were an C++ attribute.
0082 
0083     To mark a class as TP:
0084         class QT_TECH_PREVIEW_API Q_CORE_EXPORT QClass { ... };
0085 
0086     To mark a function:
0087         QT_TECH_PREVIEW_API void qFunction();
0088 
0089     To mark an enumeration or enumerator:
0090         enum class QT_TECH_PREVIEW_API QEnum {
0091             Enum1,
0092             Enum2 QT_TECH_PREVIEW_API,
0093         };
0094 
0095     To mark parts of a class:
0096         class QClass : public QObject
0097         {
0098             // Q_OBJECT omitted d/t QTBUG-123229
0099 
0100             QT_TECH_PREVIEW_API
0101             Q_PROPERTY(int countNG ...)   // this is TP
0102 
0103             Q_PROPERTY(int count ...)     // this is stable API
0104 
0105         public:
0106             QT_TECH_PREVIEW_API
0107             void f();     // TP
0108 
0109             void g();     // stable
0110         };
0111 */
0112 #define QT_TECH_PREVIEW_API
0113 
0114 #endif /* QTVERSIONCHECKS_H */