QPartialOrdering: add lower-case flags for std/Qt:: compatibility
The misspelt flags (Less, etc) make it hard to use QPartialOrdering interchangably with Qt or std ordering types, e.g. in generic code. [ChangeLog][QtCore][QPartialOrdering] Added a set of lower-case flags (::less, ::greater, etc) to improve source-compatibility with {Qt,std}::partial_ordering. Change-Id: I160600c01c4a2ab72c7b217a306d08045e363578 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
07ed8acdf9
commit
ccd0dc7f6d
@ -652,10 +652,10 @@ CHECK(strong, equivalent);
|
||||
represented by the following four symbolic constants:
|
||||
|
||||
\list
|
||||
\li \c Less represents that the left operand is less than the right;
|
||||
\li \c Equivalent represents that left operand is equivalent to the right;
|
||||
\li \c Greater represents that the left operand is greater than the right;
|
||||
\li \c Unordered represents that the left operand is \e {not ordered} with
|
||||
\li \c less represents that the left operand is less than the right;
|
||||
\li \c equivalent represents that left operand is equivalent to the right;
|
||||
\li \c greater represents that the left operand is greater than the right;
|
||||
\li \c unordered represents that the left operand is \e {not ordered} with
|
||||
respect to the right operand.
|
||||
\endlist
|
||||
|
||||
@ -692,10 +692,10 @@ CHECK(strong, equivalent);
|
||||
rules:
|
||||
|
||||
\list
|
||||
\li std::partial_ordering::less converts to \l Less.
|
||||
\li std::partial_ordering::equivalent converts to \l Equivalent.
|
||||
\li std::partial_ordering::greater converts to \l Greater.
|
||||
\li std::partial_ordering::unordered converts to \l Unordered
|
||||
\li std::partial_ordering::less converts to \l less.
|
||||
\li std::partial_ordering::equivalent converts to \l equivalent.
|
||||
\li std::partial_ordering::greater converts to \l greater.
|
||||
\li std::partial_ordering::unordered converts to \l unordered
|
||||
\endlist
|
||||
*/
|
||||
|
||||
@ -706,10 +706,10 @@ CHECK(strong, equivalent);
|
||||
the following rules:
|
||||
|
||||
\list
|
||||
\li \l Less converts to std::partial_ordering::less.
|
||||
\li \l Equivalent converts to std::partial_ordering::equivalent.
|
||||
\li \l Greater converts to std::partial_ordering::greater.
|
||||
\li \l Unordered converts to std::partial_ordering::unordered.
|
||||
\li \l less converts to std::partial_ordering::less.
|
||||
\li \l equivalent converts to std::partial_ordering::equivalent.
|
||||
\li \l greater converts to std::partial_ordering::greater.
|
||||
\li \l unordered converts to std::partial_ordering::unordered.
|
||||
\endlist
|
||||
*/
|
||||
|
||||
@ -759,6 +759,34 @@ CHECK(strong, equivalent);
|
||||
These functions are provided for compatibility with \c{std::partial_ordering}.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\variable QPartialOrdering::less
|
||||
|
||||
Represents the result of a comparison where the left operand is less than
|
||||
the right operand.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\variable QPartialOrdering::equivalent
|
||||
|
||||
Represents the result of a comparison where the left operand is equivalent
|
||||
to the right operand.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\variable QPartialOrdering::greater
|
||||
|
||||
Represents the result of a comparison where the left operand is greater
|
||||
than the right operand.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\variable QPartialOrdering::unordered
|
||||
|
||||
Represents the result of a comparison where the left operand is not ordered
|
||||
with respect to the right operand.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\variable QPartialOrdering::Less
|
||||
|
||||
|
@ -644,6 +644,11 @@ public:
|
||||
static const QPartialOrdering Greater;
|
||||
static const QPartialOrdering Unordered;
|
||||
|
||||
static const QPartialOrdering less;
|
||||
static const QPartialOrdering equivalent;
|
||||
static const QPartialOrdering greater;
|
||||
static const QPartialOrdering unordered;
|
||||
|
||||
friend constexpr bool operator==(QPartialOrdering lhs,
|
||||
QtPrivate::CompareAgainstLiteralZero) noexcept
|
||||
{ return lhs.isOrdered() && lhs.m_order == 0; }
|
||||
@ -826,6 +831,11 @@ inline constexpr QPartialOrdering QPartialOrdering::Equivalent(QtPrivate::Orderi
|
||||
inline constexpr QPartialOrdering QPartialOrdering::Greater(QtPrivate::Ordering::Greater);
|
||||
inline constexpr QPartialOrdering QPartialOrdering::Unordered(QtPrivate::LegacyUncomparable::Unordered);
|
||||
|
||||
inline constexpr QPartialOrdering QPartialOrdering::less(QtPrivate::Ordering::Less);
|
||||
inline constexpr QPartialOrdering QPartialOrdering::equivalent(QtPrivate::Ordering::Equivalent);
|
||||
inline constexpr QPartialOrdering QPartialOrdering::greater(QtPrivate::Ordering::Greater);
|
||||
inline constexpr QPartialOrdering QPartialOrdering::unordered(QtPrivate::LegacyUncomparable::Unordered);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QCOMPARE_H
|
||||
|
@ -25,6 +25,11 @@ private slots:
|
||||
|
||||
void tst_QCompare::legacyPartialOrdering()
|
||||
{
|
||||
static_assert(QPartialOrdering::Unordered == QPartialOrdering::unordered);
|
||||
static_assert(QPartialOrdering::Less == QPartialOrdering::less);
|
||||
static_assert(QPartialOrdering::Equivalent == QPartialOrdering::equivalent);
|
||||
static_assert(QPartialOrdering::Greater == QPartialOrdering::greater);
|
||||
|
||||
static_assert(QPartialOrdering::Unordered == QPartialOrdering::Unordered);
|
||||
static_assert(QPartialOrdering::Unordered != QPartialOrdering::Less);
|
||||
static_assert(QPartialOrdering::Unordered != QPartialOrdering::Equivalent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user