Make QVersionNumber and QArrayDataPointer comparisons hidden
Change-Id: I8de0407843103b49877621534c14046e3a7d1b2f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
331a200b97
commit
72ccb4fa7b
|
|
@ -240,6 +240,16 @@ public:
|
|||
return QArrayDataPointer(header, dataPtr);
|
||||
}
|
||||
|
||||
friend bool operator==(const QArrayDataPointer &lhs, const QArrayDataPointer &rhs) noexcept
|
||||
{
|
||||
return lhs.data() == rhs.data() && lhs.size == rhs.size;
|
||||
}
|
||||
|
||||
friend bool operator!=(const QArrayDataPointer &lhs, const QArrayDataPointer &rhs) noexcept
|
||||
{
|
||||
return lhs.data() != rhs.data() || lhs.size != rhs.size;
|
||||
}
|
||||
|
||||
private:
|
||||
[[nodiscard]] QPair<Data *, T *> clone(QArrayData::ArrayOptions options) const
|
||||
{
|
||||
|
|
@ -262,18 +272,6 @@ public:
|
|||
qsizetype size;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline bool operator==(const QArrayDataPointer<T> &lhs, const QArrayDataPointer<T> &rhs) noexcept
|
||||
{
|
||||
return lhs.data() == rhs.data() && lhs.size == rhs.size;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool operator!=(const QArrayDataPointer<T> &lhs, const QArrayDataPointer<T> &rhs) noexcept
|
||||
{
|
||||
return lhs.data() != rhs.data() || lhs.size != rhs.size;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void qSwap(QArrayDataPointer<T> &p1, QArrayDataPointer<T> &p2) noexcept
|
||||
{
|
||||
|
|
|
|||
|
|
@ -328,8 +328,7 @@ QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
|
|||
}
|
||||
|
||||
/*!
|
||||
\fn bool operator<(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
\relates QVersionNumber
|
||||
\fn bool QVersionNumber::operator<(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
|
||||
Returns \c true if \a lhs is less than \a rhs; otherwise returns \c false.
|
||||
|
||||
|
|
@ -337,8 +336,7 @@ QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
\relates QVersionNumber
|
||||
\fn bool QVersionNumber::operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
|
||||
Returns \c true if \a lhs is less than or equal to \a rhs; otherwise
|
||||
returns \c false.
|
||||
|
|
@ -347,8 +345,7 @@ QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator>(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
\relates QVersionNumber
|
||||
\fn bool QVersionNumber::operator>(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
|
||||
Returns \c true if \a lhs is greater than \a rhs; otherwise returns \c
|
||||
false.
|
||||
|
|
@ -357,8 +354,7 @@ QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
\relates QVersionNumber
|
||||
\fn bool QVersionNumber::operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
|
||||
Returns \c true if \a lhs is greater than or equal to \a rhs; otherwise
|
||||
returns \c false.
|
||||
|
|
@ -367,8 +363,7 @@ QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
\relates QVersionNumber
|
||||
\fn bool QVersionNumber::operator==(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
|
||||
Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false.
|
||||
|
||||
|
|
@ -376,8 +371,7 @@ QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
|
|||
*/
|
||||
|
||||
/*!
|
||||
\fn bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
\relates QVersionNumber
|
||||
\fn bool QVersionNumber::operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs)
|
||||
|
||||
Returns \c true if \a lhs is not equal to \a rhs; otherwise returns
|
||||
\c false.
|
||||
|
|
|
|||
|
|
@ -277,6 +277,25 @@ public:
|
|||
[[nodiscard]] Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QLatin1String string, int *suffixIndex = nullptr);
|
||||
[[nodiscard]] Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QStringView string, int *suffixIndex = nullptr);
|
||||
|
||||
[[nodiscard]] friend bool operator> (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return compare(lhs, rhs) > 0; }
|
||||
|
||||
[[nodiscard]] friend bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return compare(lhs, rhs) >= 0; }
|
||||
|
||||
[[nodiscard]] friend bool operator< (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return compare(lhs, rhs) < 0; }
|
||||
|
||||
[[nodiscard]] friend bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return compare(lhs, rhs) <= 0; }
|
||||
|
||||
[[nodiscard]] friend bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return compare(lhs, rhs) == 0; }
|
||||
|
||||
[[nodiscard]] friend bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return compare(lhs, rhs) != 0; }
|
||||
|
||||
|
||||
private:
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
friend Q_CORE_EXPORT QDataStream& operator>>(QDataStream &in, QVersionNumber &version);
|
||||
|
|
@ -290,24 +309,6 @@ Q_DECLARE_TYPEINFO(QVersionNumber, Q_MOVABLE_TYPE);
|
|||
Q_CORE_EXPORT QDebug operator<<(QDebug, const QVersionNumber &version);
|
||||
#endif
|
||||
|
||||
[[nodiscard]] inline bool operator> (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return QVersionNumber::compare(lhs, rhs) > 0; }
|
||||
|
||||
[[nodiscard]] inline bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return QVersionNumber::compare(lhs, rhs) >= 0; }
|
||||
|
||||
[[nodiscard]] inline bool operator< (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return QVersionNumber::compare(lhs, rhs) < 0; }
|
||||
|
||||
[[nodiscard]] inline bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return QVersionNumber::compare(lhs, rhs) <= 0; }
|
||||
|
||||
[[nodiscard]] inline bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return QVersionNumber::compare(lhs, rhs) == 0; }
|
||||
|
||||
[[nodiscard]] inline bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept
|
||||
{ return QVersionNumber::compare(lhs, rhs) != 0; }
|
||||
|
||||
class QTypeRevision;
|
||||
Q_CORE_EXPORT size_t qHash(const QTypeRevision &key, size_t seed = 0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue