From 1b109967c56c67d45a0b142fe9ba9adbce0a0d7b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 3 Apr 2015 21:47:52 +0200 Subject: QUuid: add missing relational operators QUuid has ==, !=, <, and >. Add <= and =>, too. Change-Id: I11a0b8028be766e2d48dc7664d935df4d327b3d3 Reviewed-by: Thiago Macieira --- src/corelib/plugin/quuid.cpp | 28 ++++++++++++++++++++++++++++ src/corelib/plugin/quuid.h | 5 +++++ 2 files changed, 33 insertions(+) (limited to 'src/corelib/plugin') diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index f23ec5d75c..72f662dc1e 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -846,6 +846,34 @@ bool QUuid::operator>(const QUuid &other) const Q_DECL_NOTHROW return other < *this; } +/*! + \fn bool operator<=(const QUuid &lhs, const QUuid &rhs) + \relates QUuid + \since 5.5 + + Returns \c true if \a lhs has the same \l{Variant field} + {variant field} as \a rhs and is lexicographically + \e{not after} \a rhs. If \a rhs has a + different variant field, the return value is determined by + comparing the two \l{QUuid::Variant} {variants}. + + \sa variant() +*/ + +/*! + \fn bool operator>=(const QUuid &lhs, const QUuid &rhs) + \relates QUuid + \since 5.5 + + Returns \c true if \a lhs has the same \l{Variant field} + {variant field} as \a rhs and is lexicographically + \e{not before} \a rhs. If \a rhs has a + different variant field, the return value is determined by + comparing the two \l{QUuid::Variant} {variants}. + + \sa variant() +*/ + /*! \fn QUuid QUuid::createUuid() diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 38f3bdfb8b..f004cba77e 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -214,6 +214,11 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QUuid &); Q_CORE_EXPORT uint qHash(const QUuid &uuid, uint seed = 0) Q_DECL_NOTHROW; +inline bool operator<=(const QUuid &lhs, const QUuid &rhs) Q_DECL_NOTHROW +{ return !(rhs < lhs); } +inline bool operator>=(const QUuid &lhs, const QUuid &rhs) Q_DECL_NOTHROW +{ return !(lhs < rhs); } + QT_END_NAMESPACE #endif // QUUID_H -- cgit v1.2.3