Make QDate's operators hidden friends
Adjust the documentation to match and add missing \c before false in two cases. Change-Id: Ic287c4de0b131c3500ee72bf1201900dc3788756 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
cfac358fa3
commit
6206c6c189
|
|
@ -1380,46 +1380,44 @@ qint64 QDate::daysTo(QDate d) const
|
|||
|
||||
|
||||
/*!
|
||||
\fn bool QDate::operator==(QDate d) const
|
||||
\fn bool QDate::operator==(QDate lhs, QDate rhs)
|
||||
|
||||
Returns \c true if this date and \a d represent the same day, otherwise
|
||||
Returns \c true if \a lhs and \a rhs represent the same day, otherwise
|
||||
\c false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDate::operator!=(QDate d) const
|
||||
\fn bool QDate::operator!=(QDate lhs, QDate rhs)
|
||||
|
||||
Returns \c true if this date is different from \a d; otherwise
|
||||
Returns \c true if \a lhs and \a rhs represent distinct days; otherwise
|
||||
returns \c false.
|
||||
|
||||
\sa operator==()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDate::operator<(QDate d) const
|
||||
\fn bool QDate::operator<(QDate lhs, QDate rhs)
|
||||
|
||||
Returns \c true if this date is earlier than \a d; otherwise returns
|
||||
false.
|
||||
Returns \c true if \a lhs is earlier than \a rhs; otherwise returns \c false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDate::operator<=(QDate d) const
|
||||
\fn bool QDate::operator<=(QDate lhs, QDate rhs)
|
||||
|
||||
Returns \c true if this date is earlier than or equal to \a d;
|
||||
Returns \c true if \a lhs is earlier than or equal to \a rhs;
|
||||
otherwise returns \c false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDate::operator>(QDate d) const
|
||||
\fn bool QDate::operator>(QDate lhs, QDate rhs)
|
||||
|
||||
Returns \c true if this date is later than \a d; otherwise returns
|
||||
false.
|
||||
Returns \c true if \a lhs is later than \a rhs; otherwise returns \c false.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool QDate::operator>=(QDate d) const
|
||||
\fn bool QDate::operator>=(QDate lhs, QDate rhs)
|
||||
|
||||
Returns \c true if this date is later than or equal to \a d;
|
||||
Returns \c true if \a lhs is later than or equal to \a rhs;
|
||||
otherwise returns \c false.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -117,13 +117,6 @@ public:
|
|||
[[nodiscard]] QDate addYears(int years, QCalendar cal) const;
|
||||
qint64 daysTo(QDate d) const;
|
||||
|
||||
constexpr bool operator==(QDate other) const { return jd == other.jd; }
|
||||
constexpr bool operator!=(QDate other) const { return jd != other.jd; }
|
||||
constexpr bool operator< (QDate other) const { return jd < other.jd; }
|
||||
constexpr bool operator<=(QDate other) const { return jd <= other.jd; }
|
||||
constexpr bool operator> (QDate other) const { return jd > other.jd; }
|
||||
constexpr bool operator>=(QDate other) const { return jd >= other.jd; }
|
||||
|
||||
static QDate currentDate();
|
||||
#if QT_CONFIG(datestring)
|
||||
static QDate fromString(QStringView string, Qt::DateFormat format = Qt::TextDate);
|
||||
|
|
@ -155,6 +148,13 @@ private:
|
|||
|
||||
friend class QDateTime;
|
||||
friend class QDateTimePrivate;
|
||||
|
||||
friend constexpr bool operator==(QDate lhs, QDate rhs) { return lhs.jd == rhs.jd; }
|
||||
friend constexpr bool operator!=(QDate lhs, QDate rhs) { return lhs.jd != rhs.jd; }
|
||||
friend constexpr bool operator< (QDate lhs, QDate rhs) { return lhs.jd < rhs.jd; }
|
||||
friend constexpr bool operator<=(QDate lhs, QDate rhs) { return lhs.jd <= rhs.jd; }
|
||||
friend constexpr bool operator> (QDate lhs, QDate rhs) { return lhs.jd > rhs.jd; }
|
||||
friend constexpr bool operator>=(QDate lhs, QDate rhs) { return lhs.jd >= rhs.jd; }
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QDate);
|
||||
friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QDate &);
|
||||
|
|
|
|||
Loading…
Reference in New Issue