Hide comparison operators for QtOpenGLVersion types from ADL
Make hidden friends. Also add noexcept. No documentation to adjust. Fixes: QTBUG-87978 Change-Id: I6e757b7c37fb8aabdfd395ab057a84696104e640 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
a5ce712d6b
commit
d017baac89
@ -94,6 +94,16 @@ struct QOpenGLVersionStatus
|
|||||||
|
|
||||||
QPair<int, int> version;
|
QPair<int, int> version;
|
||||||
OpenGLStatus status;
|
OpenGLStatus status;
|
||||||
|
|
||||||
|
friend constexpr bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs) noexcept
|
||||||
|
{
|
||||||
|
return lhs.status == rhs.status && lhs.version == rhs.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend constexpr bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs) noexcept
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline size_t qHash(const QOpenGLVersionStatus &v, size_t seed = 0) noexcept
|
inline size_t qHash(const QOpenGLVersionStatus &v, size_t seed = 0) noexcept
|
||||||
@ -102,16 +112,6 @@ inline size_t qHash(const QOpenGLVersionStatus &v, size_t seed = 0) noexcept
|
|||||||
+ v.version.first * 100 + v.version.second * 10, seed);
|
+ v.version.first * 100 + v.version.second * 10, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline bool operator==(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
|
|
||||||
{
|
|
||||||
return lhs.status == rhs.status && lhs.version == rhs.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr inline bool operator!=(const QOpenGLVersionStatus &lhs, const QOpenGLVersionStatus &rhs)
|
|
||||||
{
|
|
||||||
return !operator==(lhs, rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define QT_OPENGL_DECLARE_FUNCTIONS(ret, name, args) \
|
#define QT_OPENGL_DECLARE_FUNCTIONS(ret, name, args) \
|
||||||
ret (QOPENGLF_APIENTRYP name)args;
|
ret (QOPENGLF_APIENTRYP name)args;
|
||||||
#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
|
#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
|
||||||
|
@ -74,25 +74,26 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QOpenGLVersionProfilePrivate* d;
|
QOpenGLVersionProfilePrivate* d;
|
||||||
|
|
||||||
|
friend bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
|
||||||
|
{
|
||||||
|
if (lhs.profile() != rhs.profile())
|
||||||
|
return false;
|
||||||
|
return lhs.version() == rhs.version();
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs) noexcept
|
||||||
|
{
|
||||||
|
return !operator==(lhs, rhs);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0)
|
inline size_t qHash(const QOpenGLVersionProfile &v, size_t seed = 0) noexcept
|
||||||
{
|
{
|
||||||
return qHash(static_cast<int>(v.profile() * 1000)
|
return qHash(static_cast<int>(v.profile() * 1000)
|
||||||
+ v.version().first * 100 + v.version().second * 10, seed);
|
+ v.version().first * 100 + v.version().second * 10, seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs)
|
|
||||||
{
|
|
||||||
if (lhs.profile() != rhs.profile())
|
|
||||||
return false;
|
|
||||||
return lhs.version() == rhs.version();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs)
|
|
||||||
{
|
|
||||||
return !operator==(lhs, rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp);
|
Q_OPENGL_EXPORT QDebug operator<<(QDebug debug, const QOpenGLVersionProfile &vp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user