summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-04-03 21:47:52 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-04-04 06:40:27 +0000
commit1b109967c56c67d45a0b142fe9ba9adbce0a0d7b (patch)
tree19e7d5552638389f5b7dab5a0f0b6530af5e1523 /src
parent09c1bd2eb053d00bbd221d15c211867865247765 (diff)
QUuid: add missing relational operators
QUuid has ==, !=, <, and >. Add <= and =>, too. Change-Id: I11a0b8028be766e2d48dc7664d935df4d327b3d3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/plugin/quuid.cpp28
-rw-r--r--src/corelib/plugin/quuid.h5
2 files changed, 33 insertions, 0 deletions
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
@@ -847,6 +847,34 @@ bool QUuid::operator>(const QUuid &other) const Q_DECL_NOTHROW
}
/*!
+ \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()
On any platform other than Windows, this function returns a new
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