From 09c1bd2eb053d00bbd221d15c211867865247765 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 3 Apr 2015 21:46:36 +0200 Subject: [PATCH] QUuid: add some noexcept Change-Id: I43647e558a761ff6e7a275e30382919ba038f467 Reviewed-by: Thiago Macieira --- src/corelib/plugin/quuid.cpp | 10 +++++----- src/corelib/plugin/quuid.h | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index dc744e5ca5..f23ec5d75c 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,7 +814,7 @@ QUuid::Version QUuid::version() const \sa variant() */ -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(); @@ -841,7 +841,7 @@ bool QUuid::operator<(const QUuid &other) const \sa variant() */ -bool QUuid::operator>(const QUuid &other) const +bool QUuid::operator>(const QUuid &other) const Q_DECL_NOTHROW { return other < *this; } diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 13fd236a5e..38f3bdfb8b 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;