Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:28:52

0001 // Copyright (C) 2020 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 QOPENGLVERSIONPROFILE_H
0005 #define QOPENGLVERSIONPROFILE_H
0006 
0007 #include <QtOpenGL/qtopenglglobal.h>
0008 
0009 #include <QtGui/QSurfaceFormat>
0010 
0011 #include <QtCore/qhashfunctions.h>
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QOpenGLVersionProfilePrivate;
0016 class QDebug;
0017 
0018 class Q_OPENGL_EXPORT QOpenGLVersionProfile
0019 {
0020 public:
0021     QOpenGLVersionProfile();
0022     explicit QOpenGLVersionProfile(const QSurfaceFormat &format);
0023     QOpenGLVersionProfile(const QOpenGLVersionProfile &other);
0024     ~QOpenGLVersionProfile();
0025 
0026     QOpenGLVersionProfile &operator=(const QOpenGLVersionProfile &rhs);
0027 
0028     std::pair<int, int> version() const;
0029     void setVersion(int majorVersion, int minorVersion);
0030 
0031     QSurfaceFormat::OpenGLContextProfile profile() const;
0032     void setProfile(QSurfaceFormat::OpenGLContextProfile profile);
0033 
0034     bool hasProfiles() const;
0035     bool isLegacyVersion() const;
0036     bool isValid() const;
0037 
0038 private:
0039     QOpenGLVersionProfilePrivate* d;
0040 
0041     friend bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
0042     {
0043         if (lhs.profile() != rhs.profile())
0044             return false;
0045         return lhs.version() == rhs.version();
0046     }
0047 
0048     friend bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
0049     {
0050         return !operator==(lhs, rhs);
0051     }
0052 };
0053 
0054 inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0) noexcept
0055 {
0056     return qHash(static_cast<int>(v.profile() * 1000)
0057                + v.version().first * 100 + v.version().second * 10, seed);
0058 }
0059 
0060 
0061 #ifndef QT_NO_DEBUG_STREAM
0062 Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp);
0063 #endif // !QT_NO_DEBUG_STREAM
0064 
0065 QT_END_NAMESPACE
0066 
0067 #endif // QOPENGLVERSIONPROFILE_H