summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-04-06 19:10:10 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-04-06 19:10:25 +0200
commit20cac3d9c9c22153e9e316daff32b6050ff6be6b (patch)
treeb563a89475df9afb4f40841ec371be9488d5b1ed /src/corelib/plugin
parent8ce85d74b692392a4ea0785360156f37418cff13 (diff)
parent9eb0b09abce28b11e4915fc9c3b3e996eb19cef2 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/quuid.cpp53
-rw-r--r--src/corelib/plugin/quuid.h39
2 files changed, 58 insertions, 34 deletions
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 8b940aa2dc..72f662dc1e 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -721,7 +721,7 @@ QDataStream &operator>>(QDataStream &s, QUuid &id)
Returns \c true if this is the null UUID
{00000000-0000-0000-0000-000000000000}; otherwise returns \c false.
*/
-bool QUuid::isNull() const
+bool QUuid::isNull() const Q_DECL_NOTHROW
{
return data4[0] == 0 && data4[1] == 0 && data4[2] == 0 && data4[3] == 0 &&
data4[4] == 0 && data4[5] == 0 && data4[6] == 0 && data4[7] == 0 &&
@@ -770,7 +770,7 @@ bool QUuid::isNull() const
\sa version()
*/
-QUuid::Variant QUuid::variant() const
+QUuid::Variant QUuid::variant() const Q_DECL_NOTHROW
{
if (isNull())
return VarUnknown;
@@ -791,7 +791,7 @@ QUuid::Variant QUuid::variant() const
\sa variant()
*/
-QUuid::Version QUuid::version() const
+QUuid::Version QUuid::version() const Q_DECL_NOTHROW
{
// Check the 4 MSB of data3
Version ver = (Version)(data3>>12);
@@ -814,18 +814,19 @@ QUuid::Version QUuid::version() const
\sa variant()
*/
-#define ISLESS(f1, f2) if (f1!=f2) return (f1<f2);
-bool QUuid::operator<(const QUuid &other) const
+bool QUuid::operator<(const QUuid &other) const Q_DECL_NOTHROW
{
if (variant() != other.variant())
return variant() < other.variant();
+#define ISLESS(f1, f2) if (f1!=f2) return (f1<f2);
ISLESS(data1, other.data1);
ISLESS(data2, other.data2);
ISLESS(data3, other.data3);
for (int n = 0; n < 8; n++) {
ISLESS(data4[n], other.data4[n]);
}
+#undef ISLESS
return false;
}
@@ -840,22 +841,40 @@ bool QUuid::operator<(const QUuid &other) const
\sa variant()
*/
-#define ISMORE(f1, f2) if (f1!=f2) return (f1>f2);
-bool QUuid::operator>(const QUuid &other) const
+bool QUuid::operator>(const QUuid &other) const Q_DECL_NOTHROW
{
- if (variant() != other.variant())
- return variant() > other.variant();
-
- ISMORE(data1, other.data1);
- ISMORE(data2, other.data2);
- ISMORE(data3, other.data3);
- for (int n = 0; n < 8; n++) {
- ISMORE(data4[n], other.data4[n]);
- }
- return false;
+ 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()
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 13fd236a5e..f004cba77e 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -75,13 +75,13 @@ public:
};
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
- Q_DECL_CONSTEXPR QUuid() : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
+ Q_DECL_CONSTEXPR QUuid() Q_DECL_NOTHROW : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
- uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
+ uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) Q_DECL_NOTHROW
: data1(l), data2(w1), data3(w2), data4{b1, b2, b3, b4, b5, b6, b7, b8} {}
#else
- QUuid()
+ QUuid() Q_DECL_NOTHROW
{
data1 = 0;
data2 = 0;
@@ -89,7 +89,7 @@ public:
for(int i = 0; i < 8; i++)
data4[i] = 0;
}
- QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
+ QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) Q_DECL_NOTHROW
{
data1 = l;
data2 = w1;
@@ -112,9 +112,9 @@ public:
QByteArray toByteArray() const;
QByteArray toRfc4122() const;
static QUuid fromRfc4122(const QByteArray &);
- bool isNull() const;
+ bool isNull() const Q_DECL_NOTHROW;
- Q_DECL_RELAXED_CONSTEXPR bool operator==(const QUuid &orig) const
+ Q_DECL_RELAXED_CONSTEXPR bool operator==(const QUuid &orig) const Q_DECL_NOTHROW
{
if (data1 != orig.data1 || data2 != orig.data2 ||
data3 != orig.data3)
@@ -127,24 +127,24 @@ public:
return true;
}
- Q_DECL_RELAXED_CONSTEXPR bool operator!=(const QUuid &orig) const
+ Q_DECL_RELAXED_CONSTEXPR bool operator!=(const QUuid &orig) const Q_DECL_NOTHROW
{
return !(*this == orig);
}
- bool operator<(const QUuid &other) const;
- bool operator>(const QUuid &other) const;
+ bool operator<(const QUuid &other) const Q_DECL_NOTHROW;
+ bool operator>(const QUuid &other) const Q_DECL_NOTHROW;
#if defined(Q_OS_WIN)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
- Q_DECL_CONSTEXPR QUuid(const GUID &guid)
+ Q_DECL_CONSTEXPR QUuid(const GUID &guid) Q_DECL_NOTHROW
: data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]} {}
#else
- QUuid(const GUID &guid)
+ QUuid(const GUID &guid) Q_DECL_NOTHROW
{
data1 = guid.Data1;
data2 = guid.Data2;
@@ -154,24 +154,24 @@ public:
}
#endif
- Q_DECL_RELAXED_CONSTEXPR QUuid &operator=(const GUID &guid)
+ Q_DECL_RELAXED_CONSTEXPR QUuid &operator=(const GUID &guid) Q_DECL_NOTHROW
{
*this = QUuid(guid);
return *this;
}
- Q_DECL_RELAXED_CONSTEXPR operator GUID() const
+ Q_DECL_RELAXED_CONSTEXPR operator GUID() const Q_DECL_NOTHROW
{
GUID guid = { data1, data2, data3, { data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7] } };
return guid;
}
- Q_DECL_RELAXED_CONSTEXPR bool operator==(const GUID &guid) const
+ Q_DECL_RELAXED_CONSTEXPR bool operator==(const GUID &guid) const Q_DECL_NOTHROW
{
return *this == QUuid(guid);
}
- Q_DECL_RELAXED_CONSTEXPR bool operator!=(const GUID &guid) const
+ Q_DECL_RELAXED_CONSTEXPR bool operator!=(const GUID &guid) const Q_DECL_NOTHROW
{
return !(*this == guid);
}
@@ -192,8 +192,8 @@ public:
#endif
- QUuid::Variant variant() const;
- QUuid::Version version() const;
+ QUuid::Variant variant() const Q_DECL_NOTHROW;
+ QUuid::Version version() const Q_DECL_NOTHROW;
uint data1;
ushort data2;
@@ -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