Make QTime's operators hidden friends

Update docs to match.

Change-Id: Ibcaeaea04fa552c392d49e711201719f99733742
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Edward Welbourne 2020-10-23 14:45:51 +02:00
parent 6206c6c189
commit c81893907e
2 changed files with 19 additions and 19 deletions

View File

@ -2039,40 +2039,40 @@ int QTime::msecsTo(QTime t) const
/*!
\fn bool QTime::operator==(QTime t) const
\fn bool QTime::operator==(QTime lhs, QTime rhs)
Returns \c true if this time is equal to \a t; otherwise returns \c false.
Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false.
*/
/*!
\fn bool QTime::operator!=(QTime t) const
\fn bool QTime::operator!=(QTime lhs, QTime rhs)
Returns \c true if this time is different from \a t; otherwise returns \c false.
Returns \c true if \a lhs is different from \a rhs; otherwise returns \c false.
*/
/*!
\fn bool QTime::operator<(QTime t) const
\fn bool QTime::operator<(QTime lhs, QTime rhs)
Returns \c true if this time is earlier than \a t; otherwise returns \c false.
Returns \c true if \a lhs is earlier than \a rhs; otherwise returns \c false.
*/
/*!
\fn bool QTime::operator<=(QTime t) const
\fn bool QTime::operator<=(QTime lhs, QTime rhs)
Returns \c true if this time is earlier than or equal to \a t;
Returns \c true if \a lhs is earlier than or equal to \a rhs;
otherwise returns \c false.
*/
/*!
\fn bool QTime::operator>(QTime t) const
\fn bool QTime::operator>(QTime lhs, QTime rhs)
Returns \c true if this time is later than \a t; otherwise returns \c false.
Returns \c true if \a lhs is later than \a rhs; otherwise returns \c false.
*/
/*!
\fn bool QTime::operator>=(QTime t) const
\fn bool QTime::operator>=(QTime lhs, QTime rhs)
Returns \c true if this time is later than or equal to \a t;
Returns \c true if \a lhs is later than or equal to \a rhs;
otherwise returns \c false.
*/

View File

@ -193,13 +193,6 @@ public:
[[nodiscard]] QTime addMSecs(int ms) const;
int msecsTo(QTime t) const;
constexpr bool operator==(QTime other) const { return mds == other.mds; }
constexpr bool operator!=(QTime other) const { return mds != other.mds; }
constexpr bool operator< (QTime other) const { return mds < other.mds; }
constexpr bool operator<=(QTime other) const { return mds <= other.mds; }
constexpr bool operator> (QTime other) const { return mds > other.mds; }
constexpr bool operator>=(QTime other) const { return mds >= other.mds; }
static constexpr inline QTime fromMSecsSinceStartOfDay(int msecs) { return QTime(msecs); }
constexpr inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; }
@ -223,6 +216,13 @@ private:
constexpr inline int ds() const { return mds == -1 ? 0 : mds; }
int mds;
friend constexpr bool operator==(QTime lhs, QTime rhs) { return lhs.mds == rhs.mds; }
friend constexpr bool operator!=(QTime lhs, QTime rhs) { return lhs.mds != rhs.mds; }
friend constexpr bool operator< (QTime lhs, QTime rhs) { return lhs.mds < rhs.mds; }
friend constexpr bool operator<=(QTime lhs, QTime rhs) { return lhs.mds <= rhs.mds; }
friend constexpr bool operator> (QTime lhs, QTime rhs) { return lhs.mds > rhs.mds; }
friend constexpr bool operator>=(QTime lhs, QTime rhs) { return lhs.mds >= rhs.mds; }
friend class QDateTime;
friend class QDateTimePrivate;
#ifndef QT_NO_DATASTREAM