diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-04-02 10:54:54 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-04-03 13:49:45 +0000 |
commit | a1e62e7ba14b00ac7c361936a18e7bc42bf1286d (patch) | |
tree | 50f5188dbc6092aca660eec970d71fe5ce1706ae /src/corelib/tools | |
parent | 6c761a0db11b7a2b0104dbf46607ca396ae7ee2d (diff) |
Replace Q_DECL_NOEXCEPT with noexcept in corelib
In preparation of Qt6 move away from pre-C++11 macros.
Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
65 files changed, 1514 insertions, 1514 deletions
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h index 0146e22fa3..f1243b5c61 100644 --- a/src/corelib/tools/qalgorithms.h +++ b/src/corelib/tools/qalgorithms.h @@ -533,7 +533,7 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera #if defined QT_HAS_CONSTEXPR_BUILTINS #if defined(Q_CC_GNU) || defined(Q_CC_CLANG) # define QT_HAS_BUILTIN_CTZS -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept { # if QT_HAS_BUILTIN(__builtin_ctzs) return __builtin_ctzs(v); @@ -542,7 +542,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW # endif } #define QT_HAS_BUILTIN_CLZS -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept { # if QT_HAS_BUILTIN(__builtin_clzs) return __builtin_clzs(v); @@ -551,40 +551,40 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW # endif } #define QT_HAS_BUILTIN_CTZ -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctz(quint32 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctz(quint32 v) noexcept { return __builtin_ctz(v); } #define QT_HAS_BUILTIN_CLZ -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clz(quint32 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clz(quint32 v) noexcept { return __builtin_clz(v); } #define QT_HAS_BUILTIN_CTZLL -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzll(quint64 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzll(quint64 v) noexcept { return __builtin_ctzll(v); } #define QT_HAS_BUILTIN_CLZLL -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzll(quint64 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzll(quint64 v) noexcept { return __builtin_clzll(v); } #define QALGORITHMS_USE_BUILTIN_POPCOUNT -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) noexcept { return __builtin_popcount(v); } -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) noexcept { return __builtin_popcount(v); } -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) noexcept { return __builtin_popcount(v); } #define QALGORITHMS_USE_BUILTIN_POPCOUNTLL -Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) noexcept { return __builtin_popcountll(v); } @@ -630,12 +630,12 @@ Q_ALWAYS_INLINE unsigned long qt_builtin_clzll(quint64 val) } #endif // MSVC 64bit # define QT_HAS_BUILTIN_CTZS -Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) noexcept { return qt_builtin_ctz(v); } #define QT_HAS_BUILTIN_CLZS -Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) noexcept { return qt_builtin_clz(v) - 16U; } @@ -652,19 +652,19 @@ Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW #if defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__) #define QALGORITHMS_USE_BUILTIN_POPCOUNT #define QALGORITHMS_USE_BUILTIN_POPCOUNTLL -Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) noexcept { return __popcnt(v); } -Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint8 v) noexcept { return __popcnt16(v); } -Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) noexcept { return __popcnt16(v); } -Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW +Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) noexcept { #if Q_PROCESSOR_WORDSIZE == 8 return __popcnt64(v); @@ -685,7 +685,7 @@ Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW } //namespace QAlgorithmsPrivate -Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 v) noexcept { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT return QAlgorithmsPrivate::qt_builtin_popcount(v); @@ -698,7 +698,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint32 #endif } -Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 v) noexcept { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT return QAlgorithmsPrivate::qt_builtin_popcount(v); @@ -708,7 +708,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint8 #endif } -Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 v) noexcept { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNT return QAlgorithmsPrivate::qt_builtin_popcount(v); @@ -719,7 +719,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint16 #endif } -Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 v) noexcept { #ifdef QALGORITHMS_USE_BUILTIN_POPCOUNTLL return QAlgorithmsPrivate::qt_builtin_popcountll(v); @@ -734,7 +734,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(quint64 #endif } -Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long unsigned int v) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long unsigned int v) noexcept { return qPopulationCount(static_cast<quint64>(v)); } @@ -744,7 +744,7 @@ Q_DECL_CONST_FUNCTION QT_POPCOUNT_CONSTEXPR inline uint qPopulationCount(long un #endif #undef QT_POPCOUNT_CONSTEXPR -Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) noexcept { #if defined(QT_HAS_BUILTIN_CTZ) return v ? QAlgorithmsPrivate::qt_builtin_ctz(v) : 32U; @@ -762,7 +762,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint32 v) Q_DECL_NO #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) noexcept { #if defined(QT_HAS_BUILTIN_CTZ) return v ? QAlgorithmsPrivate::qt_builtin_ctz(v) : 8U; @@ -777,7 +777,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) Q_DECL_NOT #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) noexcept { #if defined(QT_HAS_BUILTIN_CTZS) return v ? QAlgorithmsPrivate::qt_builtin_ctzs(v) : 16U; @@ -793,7 +793,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NO #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint64 v) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint64 v) noexcept { #if defined(QT_HAS_BUILTIN_CTZLL) return v ? QAlgorithmsPrivate::qt_builtin_ctzll(v) : 64; @@ -804,12 +804,12 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint64 v) Q_DECL_NO #endif } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(unsigned long v) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(unsigned long v) noexcept { return qCountTrailingZeroBits(QIntegerForSizeof<long>::Unsigned(v)); } -Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) noexcept { #if defined(QT_HAS_BUILTIN_CLZ) return v ? QAlgorithmsPrivate::qt_builtin_clz(v) : 32U; @@ -824,7 +824,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint32 v) Q_DECL_NOT #endif } -QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) noexcept { #if defined(QT_HAS_BUILTIN_CLZ) return v ? QAlgorithmsPrivate::qt_builtin_clz(v)-24U : 8U; @@ -836,7 +836,7 @@ QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL #endif } -QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) noexcept { #if defined(QT_HAS_BUILTIN_CLZS) return v ? QAlgorithmsPrivate::qt_builtin_clzs(v) : 16U; @@ -849,7 +849,7 @@ QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DEC #endif } -QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) noexcept { #if defined(QT_HAS_BUILTIN_CLZLL) return v ? QAlgorithmsPrivate::qt_builtin_clzll(v) : 64U; @@ -864,7 +864,7 @@ QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint64 v) Q_DEC #endif } -QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(unsigned long v) Q_DECL_NOTHROW +QT_POPCOUNT_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(unsigned long v) noexcept { return qCountLeadingZeroBits(QIntegerForSizeof<long>::Unsigned(v)); } diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index a91d833e3b..bcc0688a91 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -87,7 +87,7 @@ static QArrayData *reallocateData(QArrayData *header, size_t allocSize, uint opt } QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment, - size_t capacity, AllocationOptions options) Q_DECL_NOTHROW + size_t capacity, AllocationOptions options) noexcept { // Alignment is a power of two Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData) @@ -135,7 +135,7 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment, } QArrayData *QArrayData::reallocateUnaligned(QArrayData *data, size_t objectSize, size_t capacity, - AllocationOptions options) Q_DECL_NOTHROW + AllocationOptions options) noexcept { Q_ASSERT(data); Q_ASSERT(data->isMutable()); @@ -150,7 +150,7 @@ QArrayData *QArrayData::reallocateUnaligned(QArrayData *data, size_t objectSize, } void QArrayData::deallocate(QArrayData *data, size_t objectSize, - size_t alignment) Q_DECL_NOTHROW + size_t alignment) noexcept { // Alignment is a power of two Q_ASSERT(alignment >= Q_ALIGNOF(QArrayData) diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index a642fb9b39..f78b9be2db 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -113,14 +113,14 @@ struct Q_CORE_EXPORT QArrayData } Q_REQUIRED_RESULT static QArrayData *allocate(size_t objectSize, size_t alignment, - size_t capacity, AllocationOptions options = Default) Q_DECL_NOTHROW; + size_t capacity, AllocationOptions options = Default) noexcept; Q_REQUIRED_RESULT static QArrayData *reallocateUnaligned(QArrayData *data, size_t objectSize, - size_t newCapacity, AllocationOptions newOptions = Default) Q_DECL_NOTHROW; + size_t newCapacity, AllocationOptions newOptions = Default) noexcept; static void deallocate(QArrayData *data, size_t objectSize, - size_t alignment) Q_DECL_NOTHROW; + size_t alignment) noexcept; static const QArrayData shared_null[2]; - static QArrayData *sharedNull() Q_DECL_NOTHROW { return const_cast<QArrayData*>(shared_null); } + static QArrayData *sharedNull() noexcept { return const_cast<QArrayData*>(shared_null); } }; Q_DECLARE_OPERATORS_FOR_FLAGS(QArrayData::AllocationOptions) @@ -254,7 +254,7 @@ struct QTypedArrayData return result; } - static QTypedArrayData *sharedNull() Q_DECL_NOTHROW + static QTypedArrayData *sharedNull() noexcept { Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); return static_cast<QTypedArrayData *>(QArrayData::sharedNull()); diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index 51cfa6e849..bce8fc8ddc 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -52,7 +52,7 @@ private: typedef QArrayDataOps<T> DataOps; public: - QArrayDataPointer() Q_DECL_NOTHROW + QArrayDataPointer() noexcept : d(Data::sharedNull()) { } @@ -83,13 +83,13 @@ public: } #ifdef Q_COMPILER_RVALUE_REFS - QArrayDataPointer(QArrayDataPointer &&other) Q_DECL_NOTHROW + QArrayDataPointer(QArrayDataPointer &&other) noexcept : d(other.d) { other.d = Data::sharedNull(); } - QArrayDataPointer &operator=(QArrayDataPointer &&other) Q_DECL_NOTHROW + QArrayDataPointer &operator=(QArrayDataPointer &&other) noexcept { QArrayDataPointer moved(std::move(other)); this->swap(moved); @@ -150,7 +150,7 @@ public: bool isSharable() const { return d->isSharable(); } #endif - void swap(QArrayDataPointer &other) Q_DECL_NOTHROW + void swap(QArrayDataPointer &other) noexcept { qSwap(d, other.d); } diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h index ff40bf5654..78beff0d42 100644 --- a/src/corelib/tools/qbitarray.h +++ b/src/corelib/tools/qbitarray.h @@ -50,21 +50,21 @@ class Q_CORE_EXPORT QBitArray { friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QBitArray &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QBitArray &); - friend Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed) Q_DECL_NOTHROW; + friend Q_CORE_EXPORT uint qHash(const QBitArray &key, uint seed) noexcept; QByteArray d; public: - inline QBitArray() Q_DECL_NOTHROW {} + inline QBitArray() noexcept {} explicit QBitArray(int size, bool val = false); QBitArray(const QBitArray &other) : d(other.d) {} inline QBitArray &operator=(const QBitArray &other) { d = other.d; return *this; } #ifdef Q_COMPILER_RVALUE_REFS - inline QBitArray(QBitArray &&other) Q_DECL_NOTHROW : d(std::move(other.d)) {} - inline QBitArray &operator=(QBitArray &&other) Q_DECL_NOTHROW + inline QBitArray(QBitArray &&other) noexcept : d(std::move(other.d)) {} + inline QBitArray &operator=(QBitArray &&other) noexcept { qSwap(d, other.d); return *this; } #endif - inline void swap(QBitArray &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + inline void swap(QBitArray &other) noexcept { qSwap(d, other.d); } inline int size() const { return (d.size() << 3) - *d.constData(); } inline int count() const { return (d.size() << 3) - *d.constData(); } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 8bf20350d6..a5a473acf4 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -165,7 +165,7 @@ int qFindByteArray( This function returns SIZE_MAX (~0) on overflow or if the memory block size would not fit an int. */ -size_t qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) Q_DECL_NOTHROW +size_t qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) noexcept { unsigned count = unsigned(elementCount); unsigned size = unsigned(elementSize); @@ -206,7 +206,7 @@ size_t qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t heade needed. */ CalculateGrowingBlockSizeResult -qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) Q_DECL_NOTHROW +qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) noexcept { CalculateGrowingBlockSizeResult result = { std::numeric_limits<size_t>::max(),std::numeric_limits<size_t>::max() @@ -1281,7 +1281,7 @@ QByteArray qUncompress(const uchar* data, int nbytes) Assigns \a other to this byte array and returns a reference to this byte array. */ -QByteArray &QByteArray::operator=(const QByteArray & other) Q_DECL_NOTHROW +QByteArray &QByteArray::operator=(const QByteArray & other) noexcept { other.d->ref.ref(); if (!d->ref.deref()) diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 8ee3a29ecc..318d773eb6 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -168,22 +168,22 @@ public: }; Q_DECLARE_FLAGS(Base64Options, Base64Option) - inline QByteArray() Q_DECL_NOTHROW; + inline QByteArray() noexcept; QByteArray(const char *, int size = -1); QByteArray(int size, char c); QByteArray(int size, Qt::Initialization); - inline QByteArray(const QByteArray &) Q_DECL_NOTHROW; + inline QByteArray(const QByteArray &) noexcept; inline ~QByteArray(); - QByteArray &operator=(const QByteArray &) Q_DECL_NOTHROW; + QByteArray &operator=(const QByteArray &) noexcept; QByteArray &operator=(const char *str); #ifdef Q_COMPILER_RVALUE_REFS - inline QByteArray(QByteArray && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); } - inline QByteArray &operator=(QByteArray &&other) Q_DECL_NOTHROW + inline QByteArray(QByteArray && other) noexcept : d(other.d) { other.d = Data::sharedNull(); } + inline QByteArray &operator=(QByteArray &&other) noexcept { qSwap(d, other.d); return *this; } #endif - inline void swap(QByteArray &other) Q_DECL_NOTHROW + inline void swap(QByteArray &other) noexcept { qSwap(d, other.d); } inline int size() const; @@ -472,7 +472,7 @@ public: Q_DECLARE_OPERATORS_FOR_FLAGS(QByteArray::Base64Options) -inline QByteArray::QByteArray() Q_DECL_NOTHROW : d(Data::sharedNull()) { } +inline QByteArray::QByteArray() noexcept : d(Data::sharedNull()) { } inline QByteArray::~QByteArray() { if (!d->ref.deref()) Data::deallocate(d); } inline int QByteArray::size() const { return d->size; } @@ -502,7 +502,7 @@ inline void QByteArray::detach() { if (d->ref.isShared() || (d->offset != sizeof(QByteArrayData))) reallocData(uint(d->size) + 1u, d->detachFlags()); } inline bool QByteArray::isDetached() const { return !d->ref.isShared(); } -inline QByteArray::QByteArray(const QByteArray &a) Q_DECL_NOTHROW : d(a.d) +inline QByteArray::QByteArray(const QByteArray &a) noexcept : d(a.d) { d->ref.ref(); } inline int QByteArray::capacity() const @@ -617,41 +617,41 @@ inline int QByteArray::compare(const QByteArray &a, Qt::CaseSensitivity cs) cons return cs == Qt::CaseSensitive ? qstrcmp(*this, a) : qstrnicmp(data(), size(), a.data(), a.size()); } -inline bool operator==(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator==(const QByteArray &a1, const QByteArray &a2) noexcept { return (a1.size() == a2.size()) && (memcmp(a1.constData(), a2.constData(), a1.size())==0); } -inline bool operator==(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW +inline bool operator==(const QByteArray &a1, const char *a2) noexcept { return a2 ? qstrcmp(a1,a2) == 0 : a1.isEmpty(); } -inline bool operator==(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator==(const char *a1, const QByteArray &a2) noexcept { return a1 ? qstrcmp(a1,a2) == 0 : a2.isEmpty(); } -inline bool operator!=(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator!=(const QByteArray &a1, const QByteArray &a2) noexcept { return !(a1==a2); } -inline bool operator!=(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW +inline bool operator!=(const QByteArray &a1, const char *a2) noexcept { return a2 ? qstrcmp(a1,a2) != 0 : !a1.isEmpty(); } -inline bool operator!=(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator!=(const char *a1, const QByteArray &a2) noexcept { return a1 ? qstrcmp(a1,a2) != 0 : !a2.isEmpty(); } -inline bool operator<(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator<(const QByteArray &a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) < 0; } - inline bool operator<(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW + inline bool operator<(const QByteArray &a1, const char *a2) noexcept { return qstrcmp(a1, a2) < 0; } -inline bool operator<(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator<(const char *a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) < 0; } -inline bool operator<=(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator<=(const QByteArray &a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) <= 0; } -inline bool operator<=(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW +inline bool operator<=(const QByteArray &a1, const char *a2) noexcept { return qstrcmp(a1, a2) <= 0; } -inline bool operator<=(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator<=(const char *a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) <= 0; } -inline bool operator>(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator>(const QByteArray &a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) > 0; } -inline bool operator>(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW +inline bool operator>(const QByteArray &a1, const char *a2) noexcept { return qstrcmp(a1, a2) > 0; } -inline bool operator>(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator>(const char *a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) > 0; } -inline bool operator>=(const QByteArray &a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator>=(const QByteArray &a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) >= 0; } -inline bool operator>=(const QByteArray &a1, const char *a2) Q_DECL_NOTHROW +inline bool operator>=(const QByteArray &a1, const char *a2) noexcept { return qstrcmp(a1, a2) >= 0; } -inline bool operator>=(const char *a1, const QByteArray &a2) Q_DECL_NOTHROW +inline bool operator>=(const char *a1, const QByteArray &a2) noexcept { return qstrcmp(a1, a2) >= 0; } #if !defined(QT_USE_QSTRINGBUILDER) inline const QByteArray operator+(const QByteArray &a1, const QByteArray &a2) diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index 72f0e0519d..d2eb4e0e3c 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -404,7 +404,7 @@ int qFindByteArray( /*! \internal */ -int QStaticByteArrayMatcherBase::indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const Q_DECL_NOTHROW +int QStaticByteArrayMatcherBase::indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const noexcept { if (from < 0) from = 0; diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index dafaea9c12..0eedfc1d20 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -90,15 +90,15 @@ class QStaticByteArrayMatcherBase uchar data[256]; } m_skiptable; protected: - explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcherBase(const char *pattern, uint n) Q_DECL_NOTHROW + explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcherBase(const char *pattern, uint n) noexcept : m_skiptable(generate(pattern, n)) {} // compiler-generated copy/more ctors/assignment operators are ok! // compiler-generated dtor is ok! - Q_CORE_EXPORT int indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const Q_DECL_NOTHROW; + Q_CORE_EXPORT int indexOfIn(const char *needle, uint nlen, const char *haystack, int hlen, int from) const noexcept; private: - static Q_DECL_RELAXED_CONSTEXPR Skiptable generate(const char *pattern, uint n) Q_DECL_NOTHROW + static Q_DECL_RELAXED_CONSTEXPR Skiptable generate(const char *pattern, uint n) noexcept { const auto uchar_max = (std::numeric_limits<uchar>::max)(); uchar max = n > uchar_max ? uchar_max : n; @@ -140,23 +140,23 @@ class QStaticByteArrayMatcher : QStaticByteArrayMatcherBase char m_pattern[N]; Q_STATIC_ASSERT_X(N > 2, "QStaticByteArrayMatcher makes no sense for finding a single-char pattern"); public: - explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher(const char (&patternToMatch)[N]) Q_DECL_NOTHROW + explicit Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher(const char (&patternToMatch)[N]) noexcept : QStaticByteArrayMatcherBase(patternToMatch, N - 1), m_pattern() { for (uint i = 0; i < N; ++i) m_pattern[i] = patternToMatch[i]; } - int indexIn(const QByteArray &haystack, int from = 0) const Q_DECL_NOTHROW + int indexIn(const QByteArray &haystack, int from = 0) const noexcept { return this->indexOfIn(m_pattern, N - 1, haystack.data(), haystack.size(), from); } - int indexIn(const char *haystack, int hlen, int from = 0) const Q_DECL_NOTHROW + int indexIn(const char *haystack, int hlen, int from = 0) const noexcept { return this->indexOfIn(m_pattern, N - 1, haystack, hlen, from); } QByteArray pattern() const { return QByteArray(m_pattern, int(N - 1)); } }; template <uint N> -Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher<N> qMakeStaticByteArrayMatcher(const char (&pattern)[N]) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR QStaticByteArrayMatcher<N> qMakeStaticByteArrayMatcher(const char (&pattern)[N]) noexcept { return QStaticByteArrayMatcher<N>(pattern); } QT_END_NAMESPACE diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h index b558a8358d..4fcde46fbc 100644 --- a/src/corelib/tools/qcache.h +++ b/src/corelib/tools/qcache.h @@ -89,7 +89,7 @@ class QCache Q_DISABLE_COPY(QCache) public: - inline explicit QCache(int maxCost = 100) Q_DECL_NOTHROW; + inline explicit QCache(int maxCost = 100) noexcept; inline ~QCache() { clear(); } inline int maxCost() const { return mx; } @@ -116,7 +116,7 @@ private: }; template <class Key, class T> -inline QCache<Key, T>::QCache(int amaxCost) Q_DECL_NOTHROW +inline QCache<Key, T>::QCache(int amaxCost) noexcept : f(nullptr), l(nullptr), mx(amaxCost), total(0) {} template <class Key, class T> diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index 47c853084b..d6061defc3 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -733,7 +733,7 @@ QT_BEGIN_NAMESPACE Note that this gives no indication of whether the character is available in a particular font. */ -bool QChar::isPrint(uint ucs4) Q_DECL_NOTHROW +bool QChar::isPrint(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -766,7 +766,7 @@ bool QChar::isPrint(uint ucs4) Q_DECL_NOTHROW /*! \internal */ -bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) Q_DECL_NOTHROW +bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -792,7 +792,7 @@ bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) Q_DECL_NOTHROW Returns \c true if the UCS-4-encoded character specified by \a ucs4 is a mark (Mark_* categories); otherwise returns \c false. */ -bool QChar::isMark(uint ucs4) Q_DECL_NOTHROW +bool QChar::isMark(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -816,7 +816,7 @@ bool QChar::isMark(uint ucs4) Q_DECL_NOTHROW Returns \c true if the UCS-4-encoded character specified by \a ucs4 is a punctuation mark (Punctuation_* categories); otherwise returns \c false. */ -bool QChar::isPunct(uint ucs4) Q_DECL_NOTHROW +bool QChar::isPunct(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -844,7 +844,7 @@ bool QChar::isPunct(uint ucs4) Q_DECL_NOTHROW Returns \c true if the UCS-4-encoded character specified by \a ucs4 is a symbol (Symbol_* categories); otherwise returns \c false. */ -bool QChar::isSymbol(uint ucs4) Q_DECL_NOTHROW +bool QChar::isSymbol(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -874,7 +874,7 @@ bool QChar::isSymbol(uint ucs4) Q_DECL_NOTHROW /*! \internal */ -bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) Q_DECL_NOTHROW +bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -909,7 +909,7 @@ bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) Q_DECL_NOTHROW /*! \internal */ -bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) Q_DECL_NOTHROW +bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -938,7 +938,7 @@ bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) Q_DECL_NOTHROW /*! \internal */ -bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Q_DECL_NOTHROW +bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -1101,7 +1101,7 @@ bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Q_DECL_NOTHROW Returns the numeric value of the digit specified by the UCS-4-encoded character, \a ucs4, or -1 if the character is not a digit. */ -int QChar::digitValue(uint ucs4) Q_DECL_NOTHROW +int QChar::digitValue(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return -1; @@ -1118,7 +1118,7 @@ int QChar::digitValue(uint ucs4) Q_DECL_NOTHROW \overload Returns the category of the UCS-4-encoded character specified by \a ucs4. */ -QChar::Category QChar::category(uint ucs4) Q_DECL_NOTHROW +QChar::Category QChar::category(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return QChar::Other_NotAssigned; @@ -1135,7 +1135,7 @@ QChar::Category QChar::category(uint ucs4) Q_DECL_NOTHROW \overload Returns the direction of the UCS-4-encoded character specified by \a ucs4. */ -QChar::Direction QChar::direction(uint ucs4) Q_DECL_NOTHROW +QChar::Direction QChar::direction(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return QChar::DirL; @@ -1158,7 +1158,7 @@ QChar::Direction QChar::direction(uint ucs4) Q_DECL_NOTHROW character specified by \a ucs4 (needed for certain languages such as Arabic or Syriac). */ -QChar::JoiningType QChar::joiningType(uint ucs4) Q_DECL_NOTHROW +QChar::JoiningType QChar::joiningType(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return QChar::Joining_None; @@ -1181,7 +1181,7 @@ QChar::JoiningType QChar::joiningType(uint ucs4) Q_DECL_NOTHROW Returns information about the joining properties of the UCS-4-encoded character specified by \a ucs4 (needed for certain languages such as Arabic). */ -QChar::Joining QChar::joining(uint ucs4) Q_DECL_NOTHROW +QChar::Joining QChar::joining(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return QChar::OtherJoining; @@ -1217,7 +1217,7 @@ QChar::Joining QChar::joining(uint ucs4) Q_DECL_NOTHROW \sa mirroredChar() */ -bool QChar::hasMirrored(uint ucs4) Q_DECL_NOTHROW +bool QChar::hasMirrored(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return false; @@ -1299,7 +1299,7 @@ bool QChar::hasMirrored(uint ucs4) Q_DECL_NOTHROW \sa hasMirrored() */ -uint QChar::mirroredChar(uint ucs4) Q_DECL_NOTHROW +uint QChar::mirroredChar(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return ucs4; @@ -1383,7 +1383,7 @@ QString QChar::decomposition(uint ucs4) Returns the tag defining the composition of the UCS-4-encoded character specified by \a ucs4. Returns QChar::NoDecomposition if no decomposition exists. */ -QChar::Decomposition QChar::decompositionTag(uint ucs4) Q_DECL_NOTHROW +QChar::Decomposition QChar::decompositionTag(uint ucs4) noexcept { if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) return QChar::Canonical; @@ -1409,7 +1409,7 @@ QChar::Decomposition QChar::decompositionTag(uint ucs4) Q_DECL_NOTHROW Returns the combining class for the UCS-4-encoded character specified by \a ucs4, as defined in the Unicode standard. */ -unsigned char QChar::combiningClass(uint ucs4) Q_DECL_NOTHROW +unsigned char QChar::combiningClass(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return 0; @@ -1430,7 +1430,7 @@ unsigned char QChar::combiningClass(uint ucs4) Q_DECL_NOTHROW Returns the Unicode script property value for the character specified in its UCS-4-encoded form as \a ucs4. */ -QChar::Script QChar::script(uint ucs4) Q_DECL_NOTHROW +QChar::Script QChar::script(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return QChar::Script_Unknown; @@ -1448,7 +1448,7 @@ QChar::Script QChar::script(uint ucs4) Q_DECL_NOTHROW Returns the Unicode version that introduced the character specified in its UCS-4-encoded form as \a ucs4. */ -QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) Q_DECL_NOTHROW +QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return QChar::Unicode_Unassigned; @@ -1458,14 +1458,14 @@ QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) Q_DECL_NOTHROW /*! Returns the most recent supported Unicode version. */ -QChar::UnicodeVersion QChar::currentUnicodeVersion() Q_DECL_NOTHROW +QChar::UnicodeVersion QChar::currentUnicodeVersion() noexcept { return UNICODE_DATA_VERSION; } template <typename Traits, typename T> -Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) noexcept { const QUnicodeTables::Properties *prop = qGetProp(uc); @@ -1491,7 +1491,7 @@ Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) Q_DECL_NOTHROW by \a ucs4 if the character is uppercase or titlecase; otherwise returns the character itself. */ -uint QChar::toLower(uint ucs4) Q_DECL_NOTHROW +uint QChar::toLower(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return ucs4; @@ -1511,7 +1511,7 @@ uint QChar::toLower(uint ucs4) Q_DECL_NOTHROW by \a ucs4 if the character is lowercase or titlecase; otherwise returns the character itself. */ -uint QChar::toUpper(uint ucs4) Q_DECL_NOTHROW +uint QChar::toUpper(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return ucs4; @@ -1531,7 +1531,7 @@ uint QChar::toUpper(uint ucs4) Q_DECL_NOTHROW by \a ucs4 if the character is lowercase or uppercase; otherwise returns the character itself. */ -uint QChar::toTitleCase(uint ucs4) Q_DECL_NOTHROW +uint QChar::toTitleCase(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return ucs4; @@ -1546,7 +1546,7 @@ static inline uint foldCase(const ushort *ch, const ushort *start) return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4); } -static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW +static inline uint foldCase(uint ch, uint &last) noexcept { uint ucs4 = ch; if (QChar::isLowSurrogate(ucs4) && QChar::isHighSurrogate(last)) @@ -1555,12 +1555,12 @@ static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4); } -static inline ushort foldCase(ushort ch) Q_DECL_NOTHROW +static inline ushort foldCase(ushort ch) noexcept { return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch); } -static inline QChar foldCase(QChar ch) Q_DECL_NOTHROW +static inline QChar foldCase(QChar ch) noexcept { return QChar(foldCase(ch.unicode())); } @@ -1577,7 +1577,7 @@ static inline QChar foldCase(QChar ch) Q_DECL_NOTHROW Returns the case folded equivalent of the UCS-4-encoded character specified by \a ucs4. For most Unicode characters this is the same as toLower(). */ -uint QChar::toCaseFolded(uint ucs4) Q_DECL_NOTHROW +uint QChar::toCaseFolded(uint ucs4) noexcept { if (ucs4 > LastValidCodePoint) return ucs4; diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index 8590b91ba3..be344838ed 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -50,9 +50,9 @@ class QString; struct QLatin1Char { public: - Q_DECL_CONSTEXPR inline explicit QLatin1Char(char c) Q_DECL_NOTHROW : ch(c) {} - Q_DECL_CONSTEXPR inline char toLatin1() const Q_DECL_NOTHROW { return ch; } - Q_DECL_CONSTEXPR inline ushort unicode() const Q_DECL_NOTHROW { return ushort(uchar(ch)); } + Q_DECL_CONSTEXPR inline explicit QLatin1Char(char c) noexcept : ch(c) {} + Q_DECL_CONSTEXPR inline char toLatin1() const noexcept { return ch; } + Q_DECL_CONSTEXPR inline ushort unicode() const noexcept { return ushort(uchar(ch)); } private: char ch; @@ -78,30 +78,30 @@ public: LastValidCodePoint = 0x10ffff }; - Q_DECL_CONSTEXPR QChar() Q_DECL_NOTHROW : ucs(0) {} - Q_DECL_CONSTEXPR QChar(ushort rc) Q_DECL_NOTHROW : ucs(rc) {} // implicit - Q_DECL_CONSTEXPR QChar(uchar c, uchar r) Q_DECL_NOTHROW : ucs(ushort((r << 8) | c)) {} - Q_DECL_CONSTEXPR QChar(short rc) Q_DECL_NOTHROW : ucs(ushort(rc)) {} // implicit - Q_DECL_CONSTEXPR QChar(uint rc) Q_DECL_NOTHROW : ucs(ushort(rc & 0xffff)) {} - Q_DECL_CONSTEXPR QChar(int rc) Q_DECL_NOTHROW : ucs(ushort(rc & 0xffff)) {} - Q_DECL_CONSTEXPR QChar(SpecialCharacter s) Q_DECL_NOTHROW : ucs(ushort(s)) {} // implicit - Q_DECL_CONSTEXPR QChar(QLatin1Char ch) Q_DECL_NOTHROW : ucs(ch.unicode()) {} // implicit + Q_DECL_CONSTEXPR QChar() noexcept : ucs(0) {} + Q_DECL_CONSTEXPR QChar(ushort rc) noexcept : ucs(rc) {} // implicit + Q_DECL_CONSTEXPR QChar(uchar c, uchar r) noexcept : ucs(ushort((r << 8) | c)) {} + Q_DECL_CONSTEXPR QChar(short rc) noexcept : ucs(ushort(rc)) {} // implicit + Q_DECL_CONSTEXPR QChar(uint rc) noexcept : ucs(ushort(rc & 0xffff)) {} + Q_DECL_CONSTEXPR QChar(int rc) noexcept : ucs(ushort(rc & 0xffff)) {} + Q_DECL_CONSTEXPR QChar(SpecialCharacter s) noexcept : ucs(ushort(s)) {} // implicit + Q_DECL_CONSTEXPR QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit #if defined(Q_COMPILER_UNICODE_STRINGS) - Q_DECL_CONSTEXPR QChar(char16_t ch) Q_DECL_NOTHROW : ucs(ushort(ch)) {} // implicit + Q_DECL_CONSTEXPR QChar(char16_t ch) noexcept : ucs(ushort(ch)) {} // implicit #endif #if defined(Q_OS_WIN) Q_STATIC_ASSERT(sizeof(wchar_t) == sizeof(ushort)); #endif #if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) # if !defined(_WCHAR_T_DEFINED) || defined(_NATIVE_WCHAR_T_DEFINED) - Q_DECL_CONSTEXPR QChar(wchar_t ch) Q_DECL_NOTHROW : ucs(ushort(ch)) {} // implicit + Q_DECL_CONSTEXPR QChar(wchar_t ch) noexcept : ucs(ushort(ch)) {} // implicit # endif #endif #ifndef QT_NO_CAST_FROM_ASCII - QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(char c) Q_DECL_NOTHROW : ucs(uchar(c)) { } + QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(char c) noexcept : ucs(uchar(c)) { } #ifndef QT_RESTRICTED_CAST_FROM_ASCII - QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(uchar c) Q_DECL_NOTHROW : ucs(c) { } + QT_ASCII_CAST_WARN Q_DECL_CONSTEXPR explicit QChar(uchar c) noexcept : ucs(c) { } #endif #endif // Unicode information @@ -411,11 +411,11 @@ public: }; // ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO - inline Category category() const Q_DECL_NOTHROW { return QChar::category(ucs); } - inline Direction direction() const Q_DECL_NOTHROW { return QChar::direction(ucs); } - inline JoiningType joiningType() const Q_DECL_NOTHROW { return QChar::joiningType(ucs); } + inline Category category() const noexcept { return QChar::category(ucs); } + inline Direction direction() const noexcept { return QChar::direction(ucs); } + inline JoiningType joiningType() const noexcept { return QChar::joiningType(ucs); } #if QT_DEPRECATED_SINCE(5, 3) - QT_DEPRECATED inline Joining joining() const Q_DECL_NOTHROW + QT_DEPRECATED inline Joining joining() const noexcept { switch (QChar::joiningType(ucs)) { case QChar::Joining_Causing: return QChar::Center; @@ -428,198 +428,198 @@ public: } } #endif - inline unsigned char combiningClass() const Q_DECL_NOTHROW { return QChar::combiningClass(ucs); } + inline unsigned char combiningClass() const noexcept { return QChar::combiningClass(ucs); } - inline QChar mirroredChar() const Q_DECL_NOTHROW { return QChar::mirroredChar(ucs); } - inline bool hasMirrored() const Q_DECL_NOTHROW { return QChar::hasMirrored(ucs); } + inline QChar mirroredChar() const noexcept { return QChar::mirroredChar(ucs); } + inline bool hasMirrored() const noexcept { return QChar::hasMirrored(ucs); } QString decomposition() const; - inline Decomposition decompositionTag() const Q_DECL_NOTHROW { return QChar::decompositionTag(ucs); } + inline Decomposition decompositionTag() const noexcept { return QChar::decompositionTag(ucs); } - inline int digitValue() const Q_DECL_NOTHROW { return QChar::digitValue(ucs); } - inline QChar toLower() const Q_DECL_NOTHROW { return QChar::toLower(ucs); } - inline QChar toUpper() const Q_DECL_NOTHROW { return QChar::toUpper(ucs); } - inline QChar toTitleCase() const Q_DECL_NOTHROW { return QChar::toTitleCase(ucs); } - inline QChar toCaseFolded() const Q_DECL_NOTHROW { return QChar::toCaseFolded(ucs); } + inline int digitValue() const noexcept { return QChar::digitValue(ucs); } + inline QChar toLower() const noexcept { return QChar::toLower(ucs); } + inline QChar toUpper() const noexcept { return QChar::toUpper(ucs); } + inline QChar toTitleCase() const noexcept { return QChar::toTitleCase(ucs); } + inline QChar toCaseFolded() const noexcept { return QChar::toCaseFolded(ucs); } - inline Script script() const Q_DECL_NOTHROW { return QChar::script(ucs); } + inline Script script() const noexcept { return QChar::script(ucs); } - inline UnicodeVersion unicodeVersion() const Q_DECL_NOTHROW { return QChar::unicodeVersion(ucs); } + inline UnicodeVersion unicodeVersion() const noexcept { return QChar::unicodeVersion(ucs); } #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED Q_DECL_CONSTEXPR inline char toAscii() const Q_DECL_NOTHROW { return toLatin1(); } + QT_DEPRECATED Q_DECL_CONSTEXPR inline char toAscii() const noexcept { return toLatin1(); } #endif - Q_DECL_CONSTEXPR inline char toLatin1() const Q_DECL_NOTHROW { return ucs > 0xff ? '\0' : char(ucs); } - Q_DECL_CONSTEXPR inline ushort unicode() const Q_DECL_NOTHROW { return ucs; } - Q_DECL_RELAXED_CONSTEXPR inline ushort &unicode() Q_DECL_NOTHROW { return ucs; } + Q_DECL_CONSTEXPR inline char toLatin1() const noexcept { return ucs > 0xff ? '\0' : char(ucs); } + Q_DECL_CONSTEXPR inline ushort unicode() const noexcept { return ucs; } + Q_DECL_RELAXED_CONSTEXPR inline ushort &unicode() noexcept { return ucs; } #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED static Q_DECL_CONSTEXPR inline QChar fromAscii(char c) Q_DECL_NOTHROW + QT_DEPRECATED static Q_DECL_CONSTEXPR inline QChar fromAscii(char c) noexcept { return fromLatin1(c); } #endif - static Q_DECL_CONSTEXPR inline QChar fromLatin1(char c) Q_DECL_NOTHROW { return QChar(ushort(uchar(c))); } - - Q_DECL_CONSTEXPR inline bool isNull() const Q_DECL_NOTHROW { return ucs == 0; } - - inline bool isPrint() const Q_DECL_NOTHROW { return QChar::isPrint(ucs); } - Q_DECL_CONSTEXPR inline bool isSpace() const Q_DECL_NOTHROW { return QChar::isSpace(ucs); } - inline bool isMark() const Q_DECL_NOTHROW { return QChar::isMark(ucs); } - inline bool isPunct() const Q_DECL_NOTHROW { return QChar::isPunct(ucs); } - inline bool isSymbol() const Q_DECL_NOTHROW { return QChar::isSymbol(ucs); } - Q_DECL_CONSTEXPR inline bool isLetter() const Q_DECL_NOTHROW { return QChar::isLetter(ucs); } - Q_DECL_CONSTEXPR inline bool isNumber() const Q_DECL_NOTHROW { return QChar::isNumber(ucs); } - Q_DECL_CONSTEXPR inline bool isLetterOrNumber() const Q_DECL_NOTHROW { return QChar::isLetterOrNumber(ucs); } - Q_DECL_CONSTEXPR inline bool isDigit() const Q_DECL_NOTHROW { return QChar::isDigit(ucs); } - Q_DECL_CONSTEXPR inline bool isLower() const Q_DECL_NOTHROW { return QChar::isLower(ucs); } - Q_DECL_CONSTEXPR inline bool isUpper() const Q_DECL_NOTHROW { return QChar::isUpper(ucs); } - Q_DECL_CONSTEXPR inline bool isTitleCase() const Q_DECL_NOTHROW { return QChar::isTitleCase(ucs); } - - Q_DECL_CONSTEXPR inline bool isNonCharacter() const Q_DECL_NOTHROW { return QChar::isNonCharacter(ucs); } - Q_DECL_CONSTEXPR inline bool isHighSurrogate() const Q_DECL_NOTHROW { return QChar::isHighSurrogate(ucs); } - Q_DECL_CONSTEXPR inline bool isLowSurrogate() const Q_DECL_NOTHROW { return QChar::isLowSurrogate(ucs); } - Q_DECL_CONSTEXPR inline bool isSurrogate() const Q_DECL_NOTHROW { return QChar::isSurrogate(ucs); } - - Q_DECL_CONSTEXPR inline uchar cell() const Q_DECL_NOTHROW { return uchar(ucs & 0xff); } - Q_DECL_CONSTEXPR inline uchar row() const Q_DECL_NOTHROW { return uchar((ucs>>8)&0xff); } - Q_DECL_RELAXED_CONSTEXPR inline void setCell(uchar acell) Q_DECL_NOTHROW { ucs = ushort((ucs & 0xff00) + acell); } - Q_DECL_RELAXED_CONSTEXPR inline void setRow(uchar arow) Q_DECL_NOTHROW { ucs = ushort((ushort(arow)<<8) + (ucs&0xff)); } - - static Q_DECL_CONSTEXPR inline bool isNonCharacter(uint ucs4) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline QChar fromLatin1(char c) noexcept { return QChar(ushort(uchar(c))); } + + Q_DECL_CONSTEXPR inline bool isNull() const noexcept { return ucs == 0; } + + inline bool isPrint() const noexcept { return QChar::isPrint(ucs); } + Q_DECL_CONSTEXPR inline bool isSpace() const noexcept { return QChar::isSpace(ucs); } + inline bool isMark() const noexcept { return QChar::isMark(ucs); } + inline bool isPunct() const noexcept { return QChar::isPunct(ucs); } + inline bool isSymbol() const noexcept { return QChar::isSymbol(ucs); } + Q_DECL_CONSTEXPR inline bool isLetter() const noexcept { return QChar::isLetter(ucs); } + Q_DECL_CONSTEXPR inline bool isNumber() const noexcept { return QChar::isNumber(ucs); } + Q_DECL_CONSTEXPR inline bool isLetterOrNumber() const noexcept { return QChar::isLetterOrNumber(ucs); } + Q_DECL_CONSTEXPR inline bool isDigit() const noexcept { return QChar::isDigit(ucs); } + Q_DECL_CONSTEXPR inline bool isLower() const noexcept { return QChar::isLower(ucs); } + Q_DECL_CONSTEXPR inline bool isUpper() const noexcept { return QChar::isUpper(ucs); } + Q_DECL_CONSTEXPR inline bool isTitleCase() const noexcept { return QChar::isTitleCase(ucs); } + + Q_DECL_CONSTEXPR inline bool isNonCharacter() const noexcept { return QChar::isNonCharacter(ucs); } + Q_DECL_CONSTEXPR inline bool isHighSurrogate() const noexcept { return QChar::isHighSurrogate(ucs); } + Q_DECL_CONSTEXPR inline bool isLowSurrogate() const noexcept { return QChar::isLowSurrogate(ucs); } + Q_DECL_CONSTEXPR inline bool isSurrogate() const noexcept { return QChar::isSurrogate(ucs); } + + Q_DECL_CONSTEXPR inline uchar cell() const noexcept { return uchar(ucs & 0xff); } + Q_DECL_CONSTEXPR inline uchar row() const noexcept { return uchar((ucs>>8)&0xff); } + Q_DECL_RELAXED_CONSTEXPR inline void setCell(uchar acell) noexcept { ucs = ushort((ucs & 0xff00) + acell); } + Q_DECL_RELAXED_CONSTEXPR inline void setRow(uchar arow) noexcept { ucs = ushort((ushort(arow)<<8) + (ucs&0xff)); } + + static Q_DECL_CONSTEXPR inline bool isNonCharacter(uint ucs4) noexcept { return ucs4 >= 0xfdd0 && (ucs4 <= 0xfdef || (ucs4 & 0xfffe) == 0xfffe); } - static Q_DECL_CONSTEXPR inline bool isHighSurrogate(uint ucs4) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline bool isHighSurrogate(uint ucs4) noexcept { return ((ucs4 & 0xfffffc00) == 0xd800); } - static Q_DECL_CONSTEXPR inline bool isLowSurrogate(uint ucs4) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline bool isLowSurrogate(uint ucs4) noexcept { return ((ucs4 & 0xfffffc00) == 0xdc00); } - static Q_DECL_CONSTEXPR inline bool isSurrogate(uint ucs4) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline bool isSurrogate(uint ucs4) noexcept { return (ucs4 - 0xd800u < 2048u); } - static Q_DECL_CONSTEXPR inline bool requiresSurrogates(uint ucs4) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline bool requiresSurrogates(uint ucs4) noexcept { return (ucs4 >= 0x10000); } - static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(ushort high, ushort low) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(ushort high, ushort low) noexcept { return (uint(high)<<10) + low - 0x35fdc00; } - static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(QChar high, QChar low) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline uint surrogateToUcs4(QChar high, QChar low) noexcept { return surrogateToUcs4(high.ucs, low.ucs); } - static Q_DECL_CONSTEXPR inline ushort highSurrogate(uint ucs4) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline ushort highSurrogate(uint ucs4) noexcept { return ushort((ucs4>>10) + 0xd7c0); } - static Q_DECL_CONSTEXPR inline ushort lowSurrogate(uint ucs4) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR inline ushort lowSurrogate(uint ucs4) noexcept { return ushort(ucs4%0x400 + 0xdc00); } - static Category QT_FASTCALL category(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static Direction QT_FASTCALL direction(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static JoiningType QT_FASTCALL joiningType(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static Category QT_FASTCALL category(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static Direction QT_FASTCALL direction(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static JoiningType QT_FASTCALL joiningType(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; #if QT_DEPRECATED_SINCE(5, 3) - QT_DEPRECATED static Joining QT_FASTCALL joining(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + QT_DEPRECATED static Joining QT_FASTCALL joining(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; #endif - static unsigned char QT_FASTCALL combiningClass(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static unsigned char QT_FASTCALL combiningClass(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; - static uint QT_FASTCALL mirroredChar(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static bool QT_FASTCALL hasMirrored(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static uint QT_FASTCALL mirroredChar(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_FASTCALL hasMirrored(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; static QString QT_FASTCALL decomposition(uint ucs4); - static Decomposition QT_FASTCALL decompositionTag(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static Decomposition QT_FASTCALL decompositionTag(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; - static int QT_FASTCALL digitValue(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static uint QT_FASTCALL toLower(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static uint QT_FASTCALL toUpper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static uint QT_FASTCALL toTitleCase(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static uint QT_FASTCALL toCaseFolded(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static int QT_FASTCALL digitValue(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static uint QT_FASTCALL toLower(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static uint QT_FASTCALL toUpper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static uint QT_FASTCALL toTitleCase(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static uint QT_FASTCALL toCaseFolded(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; - static Script QT_FASTCALL script(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static Script QT_FASTCALL script(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; - static UnicodeVersion QT_FASTCALL unicodeVersion(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static UnicodeVersion QT_FASTCALL unicodeVersion(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; - static UnicodeVersion QT_FASTCALL currentUnicodeVersion() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static UnicodeVersion QT_FASTCALL currentUnicodeVersion() noexcept Q_DECL_CONST_FUNCTION; - static bool QT_FASTCALL isPrint(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static Q_DECL_CONSTEXPR inline bool isSpace(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static bool QT_FASTCALL isPrint(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static Q_DECL_CONSTEXPR inline bool isSpace(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { // note that [0x09..0x0d] + 0x85 are exceptional Cc-s and must be handled explicitly return ucs4 == 0x20 || (ucs4 <= 0x0d && ucs4 >= 0x09) || (ucs4 > 127 && (ucs4 == 0x85 || ucs4 == 0xa0 || QChar::isSpace_helper(ucs4))); } - static bool QT_FASTCALL isMark(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static bool QT_FASTCALL isPunct(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static bool QT_FASTCALL isSymbol(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static Q_DECL_CONSTEXPR inline bool isLetter(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static bool QT_FASTCALL isMark(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_FASTCALL isPunct(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_FASTCALL isSymbol(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static Q_DECL_CONSTEXPR inline bool isLetter(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z')) || (ucs4 > 127 && QChar::isLetter_helper(ucs4)); } - static Q_DECL_CONSTEXPR inline bool isNumber(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static Q_DECL_CONSTEXPR inline bool isNumber(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::isNumber_helper(ucs4)); } - static Q_DECL_CONSTEXPR inline bool isLetterOrNumber(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static Q_DECL_CONSTEXPR inline bool isLetterOrNumber(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { return (ucs4 >= 'A' && ucs4 <= 'z' && (ucs4 >= 'a' || ucs4 <= 'Z')) || (ucs4 >= '0' && ucs4 <= '9') || (ucs4 > 127 && QChar::isLetterOrNumber_helper(ucs4)); } - static Q_DECL_CONSTEXPR inline bool isDigit(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static Q_DECL_CONSTEXPR inline bool isDigit(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { return (ucs4 <= '9' && ucs4 >= '0') || (ucs4 > 127 && QChar::category(ucs4) == Number_DecimalDigit); } - static Q_DECL_CONSTEXPR inline bool isLower(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static Q_DECL_CONSTEXPR inline bool isLower(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { return (ucs4 <= 'z' && ucs4 >= 'a') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Lowercase); } - static Q_DECL_CONSTEXPR inline bool isUpper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static Q_DECL_CONSTEXPR inline bool isUpper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { return (ucs4 <= 'Z' && ucs4 >= 'A') || (ucs4 > 127 && QChar::category(ucs4) == Letter_Uppercase); } - static Q_DECL_CONSTEXPR inline bool isTitleCase(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION + static Q_DECL_CONSTEXPR inline bool isTitleCase(uint ucs4) noexcept Q_DECL_CONST_FUNCTION { return ucs4 > 127 && QChar::category(ucs4) == Letter_Titlecase; } private: - static bool QT_FASTCALL isSpace_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static bool QT_FASTCALL isLetter_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static bool QT_FASTCALL isNumber_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; - static bool QT_FASTCALL isLetterOrNumber_helper(uint ucs4) Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; + static bool QT_FASTCALL isSpace_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_FASTCALL isLetter_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_FASTCALL isNumber_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; + static bool QT_FASTCALL isLetterOrNumber_helper(uint ucs4) noexcept Q_DECL_CONST_FUNCTION; #ifdef QT_NO_CAST_FROM_ASCII - QChar(char c) Q_DECL_NOTHROW; - QChar(uchar c) Q_DECL_NOTHROW; + QChar(char c) noexcept; + QChar(uchar c) noexcept; #endif - friend Q_DECL_CONSTEXPR bool operator==(QChar, QChar) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR bool operator< (QChar, QChar) Q_DECL_NOTHROW; + friend Q_DECL_CONSTEXPR bool operator==(QChar, QChar) noexcept; + friend Q_DECL_CONSTEXPR bool operator< (QChar, QChar) noexcept; ushort ucs; }; Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE); -Q_DECL_CONSTEXPR inline bool operator==(QChar c1, QChar c2) Q_DECL_NOTHROW { return c1.ucs == c2.ucs; } -Q_DECL_CONSTEXPR inline bool operator< (QChar c1, QChar c2) Q_DECL_NOTHROW { return c1.ucs < c2.ucs; } +Q_DECL_CONSTEXPR inline bool operator==(QChar c1, QChar c2) noexcept { return c1.ucs == c2.ucs; } +Q_DECL_CONSTEXPR inline bool operator< (QChar c1, QChar c2) noexcept { return c1.ucs < c2.ucs; } -Q_DECL_CONSTEXPR inline bool operator!=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator==(c1, c2); } -Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator< (c1, c2); } -Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) Q_DECL_NOTHROW { return operator< (c2, c1); } -Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) Q_DECL_NOTHROW { return !operator< (c2, c1); } +Q_DECL_CONSTEXPR inline bool operator!=(QChar c1, QChar c2) noexcept { return !operator==(c1, c2); } +Q_DECL_CONSTEXPR inline bool operator>=(QChar c1, QChar c2) noexcept { return !operator< (c1, c2); } +Q_DECL_CONSTEXPR inline bool operator> (QChar c1, QChar c2) noexcept { return operator< (c2, c1); } +Q_DECL_CONSTEXPR inline bool operator<=(QChar c1, QChar c2) noexcept { return !operator< (c2, c1); } -Q_DECL_CONSTEXPR inline bool operator==(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return lhs.isNull(); } -Q_DECL_CONSTEXPR inline bool operator< (QChar, std::nullptr_t) Q_DECL_NOTHROW { return false; } -Q_DECL_CONSTEXPR inline bool operator==(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return rhs.isNull(); } -Q_DECL_CONSTEXPR inline bool operator< (std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !rhs.isNull(); } +Q_DECL_CONSTEXPR inline bool operator==(QChar lhs, std::nullptr_t) noexcept { return lhs.isNull(); } +Q_DECL_CONSTEXPR inline bool operator< (QChar, std::nullptr_t) noexcept { return false; } +Q_DECL_CONSTEXPR inline bool operator==(std::nullptr_t, QChar rhs) noexcept { return rhs.isNull(); } +Q_DECL_CONSTEXPR inline bool operator< (std::nullptr_t, QChar rhs) noexcept { return !rhs.isNull(); } -Q_DECL_CONSTEXPR inline bool operator!=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator==(lhs, nullptr); } -Q_DECL_CONSTEXPR inline bool operator>=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator< (lhs, nullptr); } -Q_DECL_CONSTEXPR inline bool operator> (QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return operator< (nullptr, lhs); } -Q_DECL_CONSTEXPR inline bool operator<=(QChar lhs, std::nullptr_t) Q_DECL_NOTHROW { return !operator< (nullptr, lhs); } +Q_DECL_CONSTEXPR inline bool operator!=(QChar lhs, std::nullptr_t) noexcept { return !operator==(lhs, nullptr); } +Q_DECL_CONSTEXPR inline bool operator>=(QChar lhs, std::nullptr_t) noexcept { return !operator< (lhs, nullptr); } +Q_DECL_CONSTEXPR inline bool operator> (QChar lhs, std::nullptr_t) noexcept { return operator< (nullptr, lhs); } +Q_DECL_CONSTEXPR inline bool operator<=(QChar lhs, std::nullptr_t) noexcept { return !operator< (nullptr, lhs); } -Q_DECL_CONSTEXPR inline bool operator!=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator==(nullptr, rhs); } -Q_DECL_CONSTEXPR inline bool operator>=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator< (nullptr, rhs); } -Q_DECL_CONSTEXPR inline bool operator> (std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return operator< (rhs, nullptr); } -Q_DECL_CONSTEXPR inline bool operator<=(std::nullptr_t, QChar rhs) Q_DECL_NOTHROW { return !operator< (rhs, nullptr); } +Q_DECL_CONSTEXPR inline bool operator!=(std::nullptr_t, QChar rhs) noexcept { return !operator==(nullptr, rhs); } +Q_DECL_CONSTEXPR inline bool operator>=(std::nullptr_t, QChar rhs) noexcept { return !operator< (nullptr, rhs); } +Q_DECL_CONSTEXPR inline bool operator> (std::nullptr_t, QChar rhs) noexcept { return operator< (rhs, nullptr); } +Q_DECL_CONSTEXPR inline bool operator<=(std::nullptr_t, QChar rhs) noexcept { return !operator< (rhs, nullptr); } #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, QChar); diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 700de739bb..6c76ef038f 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -58,10 +58,10 @@ public: ~QCollatorSortKey(); QCollatorSortKey &operator=(const QCollatorSortKey &other); #ifdef Q_COMPILER_RVALUE_REFS - inline QCollatorSortKey &operator=(QCollatorSortKey &&other) Q_DECL_NOTHROW + inline QCollatorSortKey &operator=(QCollatorSortKey &&other) noexcept { swap(other); return *this; } #endif - void swap(QCollatorSortKey &other) Q_DECL_NOTHROW + void swap(QCollatorSortKey &other) noexcept { d.swap(other.d); } int compare(const QCollatorSortKey &key) const; @@ -88,13 +88,13 @@ public: ~QCollator(); QCollator &operator=(const QCollator &); #ifdef Q_COMPILER_RVALUE_REFS - QCollator(QCollator &&other) Q_DECL_NOTHROW + QCollator(QCollator &&other) noexcept : d(other.d) { other.d = nullptr; } - QCollator &operator=(QCollator &&other) Q_DECL_NOTHROW + QCollator &operator=(QCollator &&other) noexcept { swap(other); return *this; } #endif - void swap(QCollator &other) Q_DECL_NOTHROW + void swap(QCollator &other) noexcept { qSwap(d, other.d); } void setLocale(const QLocale &locale); diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp index c2b86014ba..aff684fad2 100644 --- a/src/corelib/tools/qcommandlineoption.cpp +++ b/src/corelib/tools/qcommandlineoption.cpp @@ -254,7 +254,7 @@ namespace { typedef QString argument_type; Q_NEVER_INLINE - result_type operator()(const QString &name) const Q_DECL_NOEXCEPT + result_type operator()(const QString &name) const noexcept { if (Q_UNLIKELY(name.isEmpty())) return warn("be empty"); @@ -271,7 +271,7 @@ namespace { } Q_NEVER_INLINE - static bool warn(const char *what) Q_DECL_NOEXCEPT + static bool warn(const char *what) noexcept { qWarning("QCommandLineOption: Option names cannot %s", what); return true; diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h index 276be042de..643427f6fb 100644 --- a/src/corelib/tools/qcommandlineoption.h +++ b/src/corelib/tools/qcommandlineoption.h @@ -72,10 +72,10 @@ public: QCommandLineOption &operator=(const QCommandLineOption &other); #ifdef Q_COMPILER_RVALUE_REFS - QCommandLineOption &operator=(QCommandLineOption &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QCommandLineOption &operator=(QCommandLineOption &&other) noexcept { swap(other); return *this; } #endif - void swap(QCommandLineOption &other) Q_DECL_NOTHROW + void swap(QCommandLineOption &other) noexcept { qSwap(d, other.d); } QStringList names() const; diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index d06b8a04d2..54e52c4cd1 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -256,7 +256,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) #if QT_CONFIG(datestring) // Parse offset in [+-]HH[[:]mm] format -static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_NOTHROW +static int fromOffsetString(const QStringRef &offsetString, bool *valid) noexcept { *valid = false; @@ -3210,7 +3210,7 @@ QDateTime::QDateTime(const QDate &date, const QTime &time, const QTimeZone &time /*! Constructs a copy of the \a other datetime. */ -QDateTime::QDateTime(const QDateTime &other) Q_DECL_NOTHROW +QDateTime::QDateTime(const QDateTime &other) noexcept : d(other.d) { } @@ -3220,7 +3220,7 @@ QDateTime::QDateTime(const QDateTime &other) Q_DECL_NOTHROW Moves the content of the temporary \a other datetime to this object and leaves \a other in an unspecified (but proper) state. */ -QDateTime::QDateTime(QDateTime &&other) Q_DECL_NOTHROW +QDateTime::QDateTime(QDateTime &&other) noexcept : d(std::move(other.d)) { } @@ -3237,7 +3237,7 @@ QDateTime::~QDateTime() copy. */ -QDateTime &QDateTime::operator=(const QDateTime &other) Q_DECL_NOTHROW +QDateTime &QDateTime::operator=(const QDateTime &other) noexcept { d = other.d; return *this; @@ -4465,7 +4465,7 @@ QDateTime QDateTime::currentDateTimeUtc() return QDateTime(d, t, Qt::UTC); } -qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW +qint64 QDateTime::currentMSecsSinceEpoch() noexcept { SYSTEMTIME st; memset(&st, 0, sizeof(SYSTEMTIME)); @@ -4476,7 +4476,7 @@ qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW - julianDayFromDate(1970, 1, 1)) * Q_INT64_C(86400000); } -qint64 QDateTime::currentSecsSinceEpoch() Q_DECL_NOTHROW +qint64 QDateTime::currentSecsSinceEpoch() noexcept { SYSTEMTIME st; memset(&st, 0, sizeof(SYSTEMTIME)); @@ -4508,7 +4508,7 @@ QDateTime QDateTime::currentDateTimeUtc() return fromMSecsSinceEpoch(currentMSecsSinceEpoch(), Qt::UTC); } -qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW +qint64 QDateTime::currentMSecsSinceEpoch() noexcept { // posix compliant system // we have milliseconds @@ -4517,7 +4517,7 @@ qint64 QDateTime::currentMSecsSinceEpoch() Q_DECL_NOTHROW return qint64(tv.tv_sec) * Q_INT64_C(1000) + tv.tv_usec / 1000; } -qint64 QDateTime::currentSecsSinceEpoch() Q_DECL_NOTHROW +qint64 QDateTime::currentSecsSinceEpoch() noexcept { struct timeval tv; gettimeofday(&tv, 0); @@ -5414,7 +5414,7 @@ uint qHash(const QDateTime &key, uint seed) Returns the hash value for the \a key, using \a seed to seed the calculation. */ -uint qHash(const QDate &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QDate &key, uint seed) noexcept { return qHash(key.toJulianDay(), seed); } @@ -5425,7 +5425,7 @@ uint qHash(const QDate &key, uint seed) Q_DECL_NOTHROW Returns the hash value for the \a key, using \a seed to seed the calculation. */ -uint qHash(const QTime &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QTime &key, uint seed) noexcept { return qHash(key.msecsSinceStartOfDay(), seed); } diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 43271b34ed..144fb9b28a 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -266,16 +266,16 @@ public: #if QT_CONFIG(timezone) QDateTime(const QDate &date, const QTime &time, const QTimeZone &timeZone); #endif // timezone - QDateTime(const QDateTime &other) Q_DECL_NOTHROW; - QDateTime(QDateTime &&other) Q_DECL_NOTHROW; + QDateTime(const QDateTime &other) noexcept; + QDateTime(QDateTime &&other) noexcept; ~QDateTime(); #ifdef Q_COMPILER_RVALUE_REFS - QDateTime &operator=(QDateTime &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QDateTime &operator=(QDateTime &&other) noexcept { swap(other); return *this; } #endif - QDateTime &operator=(const QDateTime &other) Q_DECL_NOTHROW; + QDateTime &operator=(const QDateTime &other) noexcept; - void swap(QDateTime &other) Q_DECL_NOTHROW { qSwap(d.d, other.d.d); } + void swap(QDateTime &other) noexcept { qSwap(d.d, other.d.d); } bool isNull() const; bool isValid() const; @@ -366,8 +366,8 @@ public: static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone); #endif - static qint64 currentMSecsSinceEpoch() Q_DECL_NOTHROW; - static qint64 currentSecsSinceEpoch() Q_DECL_NOTHROW; + static qint64 currentMSecsSinceEpoch() noexcept; + static qint64 currentSecsSinceEpoch() noexcept; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) static QDateTime fromCFDate(CFDateRef date); @@ -410,8 +410,8 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QDateTime &); // QDateTime is not noexcept for now -- to be revised once // timezone and calendaring support is added Q_CORE_EXPORT uint qHash(const QDateTime &key, uint seed = 0); -Q_CORE_EXPORT uint qHash(const QDate &key, uint seed = 0) Q_DECL_NOTHROW; -Q_CORE_EXPORT uint qHash(const QTime &key, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT uint qHash(const QDate &key, uint seed = 0) noexcept; +Q_CORE_EXPORT uint qHash(const QTime &key, uint seed = 0) noexcept; QT_END_NAMESPACE diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index 74bde5825a..1791f19199 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -81,12 +81,12 @@ public: QEasingCurve &operator=(const QEasingCurve &other) { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QEasingCurve(QEasingCurve &&other) Q_DECL_NOTHROW : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } - QEasingCurve &operator=(QEasingCurve &&other) Q_DECL_NOTHROW + QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } + QEasingCurve &operator=(QEasingCurve &&other) noexcept { qSwap(d_ptr, other.d_ptr); return *this; } #endif - void swap(QEasingCurve &other) Q_DECL_NOTHROW { qSwap(d_ptr, other.d_ptr); } + void swap(QEasingCurve &other) noexcept { qSwap(d_ptr, other.d_ptr); } bool operator==(const QEasingCurve &other) const; inline bool operator!=(const QEasingCurve &other) const diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 32e9a4269c..dd22a38be1 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -197,7 +197,7 @@ static uint crc32(...) } #endif -static inline uint hash(const uchar *p, size_t len, uint seed) Q_DECL_NOTHROW +static inline uint hash(const uchar *p, size_t len, uint seed) noexcept { uint h = seed; @@ -210,12 +210,12 @@ static inline uint hash(const uchar *p, size_t len, uint seed) Q_DECL_NOTHROW return h; } -uint qHashBits(const void *p, size_t len, uint seed) Q_DECL_NOTHROW +uint qHashBits(const void *p, size_t len, uint seed) noexcept { return hash(static_cast<const uchar*>(p), int(len), seed); } -static inline uint hash(const QChar *p, size_t len, uint seed) Q_DECL_NOTHROW +static inline uint hash(const QChar *p, size_t len, uint seed) noexcept { uint h = seed; @@ -228,29 +228,29 @@ static inline uint hash(const QChar *p, size_t len, uint seed) Q_DECL_NOTHROW return h; } -uint qHash(const QByteArray &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QByteArray &key, uint seed) noexcept { return hash(reinterpret_cast<const uchar *>(key.constData()), size_t(key.size()), seed); } #if QT_STRINGVIEW_LEVEL < 2 -uint qHash(const QString &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QString &key, uint seed) noexcept { return hash(key.unicode(), size_t(key.size()), seed); } -uint qHash(const QStringRef &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QStringRef &key, uint seed) noexcept { return hash(key.unicode(), size_t(key.size()), seed); } #endif -uint qHash(QStringView key, uint seed) Q_DECL_NOTHROW +uint qHash(QStringView key, uint seed) noexcept { return hash(key.data(), key.size(), seed); } -uint qHash(const QBitArray &bitArray, uint seed) Q_DECL_NOTHROW +uint qHash(const QBitArray &bitArray, uint seed) noexcept { int m = bitArray.d.size() - 1; uint result = hash(reinterpret_cast<const uchar *>(bitArray.d.constData()), @@ -264,7 +264,7 @@ uint qHash(const QBitArray &bitArray, uint seed) Q_DECL_NOTHROW return result; } -uint qHash(QLatin1String key, uint seed) Q_DECL_NOTHROW +uint qHash(QLatin1String key, uint seed) noexcept { return hash(reinterpret_cast<const uchar *>(key.data()), size_t(key.size()), seed); } @@ -398,7 +398,7 @@ void qSetGlobalQHashSeed(int newSeed) This function can hash discontiguous memory by invoking it on each chunk, passing the previous's result in the next call's \a chained argument. */ -uint qt_hash(QStringView key, uint chained) Q_DECL_NOTHROW +uint qt_hash(QStringView key, uint chained) noexcept { auto n = key.size(); auto p = key.utf16(); @@ -938,7 +938,7 @@ void QHashData::checkSanity() Returns the hash value for the \a key, using \a seed to seed the calculation. */ -uint qHash(float key, uint seed) Q_DECL_NOTHROW +uint qHash(float key, uint seed) noexcept { return key != 0.0f ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ; } @@ -948,7 +948,7 @@ uint qHash(float key, uint seed) Q_DECL_NOTHROW Returns the hash value for the \a key, using \a seed to seed the calculation. */ -uint qHash(double key, uint seed) Q_DECL_NOTHROW +uint qHash(double key, uint seed) noexcept { return key != 0.0 ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ; } @@ -959,7 +959,7 @@ uint qHash(double key, uint seed) Q_DECL_NOTHROW Returns the hash value for the \a key, using \a seed to seed the calculation. */ -uint qHash(long double key, uint seed) Q_DECL_NOTHROW +uint qHash(long double key, uint seed) noexcept { return key != 0.0L ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ; } diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index a586ca5671..9a733180a5 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -240,7 +240,7 @@ class QHash static inline int alignOfNode() { return qMax<int>(sizeof(void*), Q_ALIGNOF(Node)); } public: - inline QHash() Q_DECL_NOTHROW : d(const_cast<QHashData *>(&QHashData::shared_null)) { } + inline QHash() noexcept : d(const_cast<QHashData *>(&QHashData::shared_null)) { } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QHash(std::initializer_list<std::pair<Key,T> > list) : d(const_cast<QHashData *>(&QHashData::shared_null)) @@ -255,11 +255,11 @@ public: QHash &operator=(const QHash &other); #ifdef Q_COMPILER_RVALUE_REFS - QHash(QHash &&other) Q_DECL_NOTHROW : d(other.d) { other.d = const_cast<QHashData *>(&QHashData::shared_null); } - QHash &operator=(QHash &&other) Q_DECL_NOTHROW + QHash(QHash &&other) noexcept : d(other.d) { other.d = const_cast<QHashData *>(&QHashData::shared_null); } + QHash &operator=(QHash &&other) noexcept { QHash moved(std::move(other)); swap(moved); return *this; } #endif - void swap(QHash &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QHash &other) noexcept { qSwap(d, other.d); } bool operator==(const QHash &other) const; bool operator!=(const QHash &other) const { return !(*this == other); } @@ -473,7 +473,7 @@ public: inline const_key_value_iterator constKeyValueEnd() const { return const_key_value_iterator(end()); } QPair<iterator, iterator> equal_range(const Key &key); - QPair<const_iterator, const_iterator> equal_range(const Key &key) const Q_DECL_NOTHROW; + QPair<const_iterator, const_iterator> equal_range(const Key &key) const noexcept; iterator erase(iterator it) { return erase(const_iterator(it.i)); } iterator erase(const_iterator it); @@ -512,11 +512,11 @@ private: static void duplicateNode(QHashData::Node *originalNode, void *newNode); - bool isValidIterator(const iterator &it) const Q_DECL_NOTHROW + bool isValidIterator(const iterator &it) const noexcept { return isValidNode(it.i); } - bool isValidIterator(const const_iterator &it) const Q_DECL_NOTHROW + bool isValidIterator(const const_iterator &it) const noexcept { return isValidNode(it.i); } - bool isValidNode(QHashData::Node *node) const Q_DECL_NOTHROW + bool isValidNode(QHashData::Node *node) const noexcept { #if defined(QT_DEBUG) && !defined(Q_HASH_NO_ITERATOR_DEBUG) while (node->next) @@ -993,7 +993,7 @@ QPair<typename QHash<Key, T>::iterator, typename QHash<Key, T>::iterator> QHash< } template <class Key, class T> -QPair<typename QHash<Key, T>::const_iterator, typename QHash<Key, T>::const_iterator> QHash<Key, T>::equal_range(const Key &akey) const Q_DECL_NOTHROW +QPair<typename QHash<Key, T>::const_iterator, typename QHash<Key, T>::const_iterator> QHash<Key, T>::equal_range(const Key &akey) const noexcept { Node *node = *findNode(akey); const_iterator firstIt = const_iterator(node); @@ -1020,7 +1020,7 @@ template <class Key, class T> class QMultiHash : public QHash<Key, T> { public: - QMultiHash() Q_DECL_NOTHROW {} + QMultiHash() noexcept {} #ifdef Q_COMPILER_INITIALIZER_LISTS inline QMultiHash(std::initializer_list<std::pair<Key,T> > list) { @@ -1034,9 +1034,9 @@ public: QMultiHash(const QHash<Key, T> &other) : QHash<Key, T>(other) {} #ifdef Q_COMPILER_RVALUE_REFS - QMultiHash(QHash<Key, T> &&other) Q_DECL_NOTHROW : QHash<Key, T>(std::move(other)) {} + QMultiHash(QHash<Key, T> &&other) noexcept : QHash<Key, T>(std::move(other)) {} #endif - void swap(QMultiHash &other) Q_DECL_NOTHROW { QHash<Key, T>::swap(other); } // prevent QMultiHash<->QHash swaps + void swap(QMultiHash &other) noexcept { QHash<Key, T>::swap(other); } // prevent QMultiHash<->QHash swaps inline typename QHash<Key, T>::iterator replace(const Key &key, const T &value) { return QHash<Key, T>::insert(key, value); } diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h index d013c26d66..2d1ff01294 100644 --- a/src/corelib/tools/qhashfunctions.h +++ b/src/corelib/tools/qhashfunctions.h @@ -67,49 +67,49 @@ class QLatin1String; Q_CORE_EXPORT int qGlobalQHashSeed(); Q_CORE_EXPORT void qSetGlobalQHashSeed(int newSeed); -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) Q_DECL_NOTHROW; - -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uchar key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(signed char key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ushort key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(short key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uint key, uint seed = 0) Q_DECL_NOTHROW { return key ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(int key, uint seed = 0) Q_DECL_NOTHROW { return uint(key) ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ulong key, uint seed = 0) Q_DECL_NOTHROW +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHashBits(const void *p, size_t size, uint seed = 0) noexcept; + +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(char key, uint seed = 0) noexcept { return uint(key) ^ seed; } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uchar key, uint seed = 0) noexcept { return uint(key) ^ seed; } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(signed char key, uint seed = 0) noexcept { return uint(key) ^ seed; } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ushort key, uint seed = 0) noexcept { return uint(key) ^ seed; } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(short key, uint seed = 0) noexcept { return uint(key) ^ seed; } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(uint key, uint seed = 0) noexcept { return key ^ seed; } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(int key, uint seed = 0) noexcept { return uint(key) ^ seed; } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(ulong key, uint seed = 0) noexcept { return (sizeof(ulong) > sizeof(uint)) ? (uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U)) ^ seed) : (uint(key & (~0U)) ^ seed); } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(long key, uint seed = 0) Q_DECL_NOTHROW { return qHash(ulong(key), seed); } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(quint64 key, uint seed = 0) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(long key, uint seed = 0) noexcept { return qHash(ulong(key), seed); } +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(quint64 key, uint seed = 0) noexcept { return uint(((key >> (8 * sizeof(uint) - 1)) ^ key) & (~0U)) ^ seed; } -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(qint64 key, uint seed = 0) Q_DECL_NOTHROW { return qHash(quint64(key), seed); } -Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(float key, uint seed = 0) Q_DECL_NOTHROW; -Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(double key, uint seed = 0) Q_DECL_NOTHROW; +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(qint64 key, uint seed = 0) noexcept { return qHash(quint64(key), seed); } +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(float key, uint seed = 0) noexcept; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(double key, uint seed = 0) noexcept; #if !defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC) -Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(long double key, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(long double key, uint seed = 0) noexcept; #endif -Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(const QChar key, uint seed = 0) Q_DECL_NOTHROW { return qHash(key.unicode(), seed); } -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QByteArray &key, uint seed = 0) Q_DECL_NOTHROW; +Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(const QChar key, uint seed = 0) noexcept { return qHash(key.unicode(), seed); } +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QByteArray &key, uint seed = 0) noexcept; #if QT_STRINGVIEW_LEVEL < 2 -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QString &key, uint seed = 0) Q_DECL_NOTHROW; -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QStringRef &key, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QString &key, uint seed = 0) noexcept; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QStringRef &key, uint seed = 0) noexcept; #endif -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QStringView key, uint seed = 0) Q_DECL_NOTHROW; -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QBitArray &key, uint seed = 0) Q_DECL_NOTHROW; -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QLatin1String key, uint seed = 0) Q_DECL_NOTHROW; -Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key, uint chained = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QStringView key, uint seed = 0) noexcept; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(const QBitArray &key, uint seed = 0) noexcept; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qHash(QLatin1String key, uint seed = 0) noexcept; +Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key, uint chained = 0) noexcept; -Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) noexcept { return qHash(reinterpret_cast<quintptr>(nullptr), seed); } -template <class T> inline uint qHash(const T *key, uint seed = 0) Q_DECL_NOTHROW +template <class T> inline uint qHash(const T *key, uint seed = 0) noexcept { return qHash(reinterpret_cast<quintptr>(key), seed); } diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h index 586d26cbad..90921af16e 100644 --- a/src/corelib/tools/qiterator.h +++ b/src/corelib/tools/qiterator.h @@ -197,8 +197,8 @@ public: return std::pair<Key, T>(i.key(), i.value()); } - friend bool operator==(QKeyValueIterator lhs, QKeyValueIterator rhs) Q_DECL_NOEXCEPT { return lhs.i == rhs.i; } - friend bool operator!=(QKeyValueIterator lhs, QKeyValueIterator rhs) Q_DECL_NOEXCEPT { return lhs.i != rhs.i; } + friend bool operator==(QKeyValueIterator lhs, QKeyValueIterator rhs) noexcept { return lhs.i == rhs.i; } + friend bool operator!=(QKeyValueIterator lhs, QKeyValueIterator rhs) noexcept { return lhs.i != rhs.i; } inline QKeyValueIterator &operator++() { ++i; return *this; } inline QKeyValueIterator operator++(int) { return QKeyValueIterator(i++);} diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 1e6d4df474..91367a74b3 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -80,7 +80,7 @@ class QLinkedList union { QLinkedListData *d; QLinkedListNode<T> *e; }; public: - inline QLinkedList() Q_DECL_NOTHROW : d(const_cast<QLinkedListData *>(&QLinkedListData::shared_null)) { } + inline QLinkedList() noexcept : d(const_cast<QLinkedListData *>(&QLinkedListData::shared_null)) { } inline QLinkedList(const QLinkedList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach(); } #if defined(Q_COMPILER_INITIALIZER_LISTS) inline QLinkedList(std::initializer_list<T> list) @@ -92,12 +92,12 @@ public: ~QLinkedList(); QLinkedList<T> &operator=(const QLinkedList<T> &); #ifdef Q_COMPILER_RVALUE_REFS - QLinkedList(QLinkedList<T> &&other) Q_DECL_NOTHROW + QLinkedList(QLinkedList<T> &&other) noexcept : d(other.d) { other.d = const_cast<QLinkedListData *>(&QLinkedListData::shared_null); } - QLinkedList<T> &operator=(QLinkedList<T> &&other) Q_DECL_NOTHROW + QLinkedList<T> &operator=(QLinkedList<T> &&other) noexcept { QLinkedList moved(std::move(other)); swap(moved); return *this; } #endif - inline void swap(QLinkedList<T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + inline void swap(QLinkedList<T> &other) noexcept { qSwap(d, other.d); } bool operator==(const QLinkedList<T> &l) const; inline bool operator!=(const QLinkedList<T> &l) const { return !(*this == l); } @@ -137,10 +137,10 @@ public: inline iterator() : i(nullptr) {} inline iterator(Node *n) : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) - iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {} - iterator &operator=(const iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; } - iterator(iterator &&other) Q_DECL_NOTHROW : i(other.i) {} - iterator &operator=(iterator &&other) Q_DECL_NOTHROW { return *this = other; } + iterator(const iterator &other) noexcept : i(other.i) {} + iterator &operator=(const iterator &other) noexcept { i = other.i; return *this; } + iterator(iterator &&other) noexcept : i(other.i) {} + iterator &operator=(iterator &&other) noexcept { return *this = other; } #endif inline T &operator*() const { return i->t; } inline T *operator->() const { return &i->t; } @@ -176,10 +176,10 @@ public: inline const_iterator(Node *n) : i(n) {} inline const_iterator(iterator ci) : i(ci.i){} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) - const_iterator(const const_iterator &other) Q_DECL_NOTHROW : i(other.i) {} - const_iterator &operator=(const const_iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; } - const_iterator(const_iterator &&other) Q_DECL_NOTHROW : i(other.i) {} - const_iterator &operator=(const_iterator &&other) Q_DECL_NOTHROW { return *this = other; } + const_iterator(const const_iterator &other) noexcept : i(other.i) {} + const_iterator &operator=(const const_iterator &other) noexcept { i = other.i; return *this; } + const_iterator(const_iterator &&other) noexcept : i(other.i) {} + const_iterator &operator=(const_iterator &&other) noexcept { return *this = other; } #endif inline const T &operator*() const { return i->t; } inline const T *operator->() const { return &i->t; } @@ -203,20 +203,20 @@ public: typedef std::reverse_iterator<const_iterator> const_reverse_iterator; inline iterator begin() { detach(); return e->n; } - inline const_iterator begin() const Q_DECL_NOTHROW { return e->n; } - inline const_iterator cbegin() const Q_DECL_NOTHROW { return e->n; } - inline const_iterator constBegin() const Q_DECL_NOTHROW { return e->n; } + inline const_iterator begin() const noexcept { return e->n; } + inline const_iterator cbegin() const noexcept { return e->n; } + inline const_iterator constBegin() const noexcept { return e->n; } inline iterator end() { detach(); return e; } - inline const_iterator end() const Q_DECL_NOTHROW { return e; } - inline const_iterator cend() const Q_DECL_NOTHROW { return e; } - inline const_iterator constEnd() const Q_DECL_NOTHROW { return e; } + inline const_iterator end() const noexcept { return e; } + inline const_iterator cend() const noexcept { return e; } + inline const_iterator constEnd() const noexcept { return e; } reverse_iterator rbegin() { return reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } - const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator crend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } iterator insert(iterator before, const T &t); iterator erase(iterator pos); diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 34577acaa5..3371920ffc 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -111,11 +111,11 @@ struct Q_CORE_EXPORT QListData { void remove(int i); void remove(int i, int n); void move(int from, int to); - inline int size() const Q_DECL_NOTHROW { return d->end - d->begin; } - inline bool isEmpty() const Q_DECL_NOTHROW { return d->end == d->begin; } - inline void **at(int i) const Q_DECL_NOTHROW { return d->array + d->begin + i; } - inline void **begin() const Q_DECL_NOTHROW { return d->array + d->begin; } - inline void **end() const Q_DECL_NOTHROW { return d->array + d->end; } + inline int size() const noexcept { return d->end - d->begin; } + inline bool isEmpty() const noexcept { return d->end == d->begin; } + inline void **at(int i) const noexcept { return d->array + d->begin + i; } + inline void **begin() const noexcept { return d->array + d->begin; } + inline void **end() const noexcept { return d->array + d->end; } }; namespace QtPrivate { @@ -156,17 +156,17 @@ private: union { QListData p; QListData::Data *d; }; public: - inline QList() Q_DECL_NOTHROW : d(const_cast<QListData::Data *>(&QListData::shared_null)) { } + inline QList() noexcept : d(const_cast<QListData::Data *>(&QListData::shared_null)) { } QList(const QList<T> &l); ~QList(); QList<T> &operator=(const QList<T> &l); #ifdef Q_COMPILER_RVALUE_REFS - inline QList(QList<T> &&other) Q_DECL_NOTHROW + inline QList(QList<T> &&other) noexcept : d(other.d) { other.d = const_cast<QListData::Data *>(&QListData::shared_null); } - inline QList &operator=(QList<T> &&other) Q_DECL_NOTHROW + inline QList &operator=(QList<T> &&other) noexcept { QList moved(std::move(other)); swap(moved); return *this; } #endif - inline void swap(QList<T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + inline void swap(QList<T> &other) noexcept { qSwap(d, other.d); } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QList(std::initializer_list<T> args) : d(const_cast<QListData::Data *>(&QListData::shared_null)) @@ -175,7 +175,7 @@ public: bool operator==(const QList<T> &l) const; inline bool operator!=(const QList<T> &l) const { return !(*this == l); } - inline int size() const Q_DECL_NOTHROW { return p.size(); } + inline int size() const noexcept { return p.size(); } inline void detach() { if (d->ref.isShared()) detach_helper(); } @@ -198,9 +198,9 @@ public: d->ref.setSharable(sharable); } #endif - inline bool isSharedWith(const QList<T> &other) const Q_DECL_NOTHROW { return d == other.d; } + inline bool isSharedWith(const QList<T> &other) const noexcept { return d == other.d; } - inline bool isEmpty() const Q_DECL_NOTHROW { return p.isEmpty(); } + inline bool isEmpty() const noexcept { return p.isEmpty(); } void clear(); @@ -243,34 +243,34 @@ public: typedef T *pointer; typedef T &reference; - inline iterator() Q_DECL_NOTHROW : i(nullptr) {} - inline iterator(Node *n) Q_DECL_NOTHROW : i(n) {} + inline iterator() noexcept : i(nullptr) {} + inline iterator(Node *n) noexcept : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) // can't remove it in Qt 5, since doing so would make the type trivial, // which changes the way it's passed to functions by value. - inline iterator(const iterator &o) Q_DECL_NOTHROW : i(o.i){} + inline iterator(const iterator &o) noexcept : i(o.i){} #endif inline T &operator*() const { return i->t(); } inline T *operator->() const { return &i->t(); } inline T &operator[](difference_type j) const { return i[j].t(); } - inline bool operator==(const iterator &o) const Q_DECL_NOTHROW { return i == o.i; } - inline bool operator!=(const iterator &o) const Q_DECL_NOTHROW { return i != o.i; } - inline bool operator<(const iterator& other) const Q_DECL_NOTHROW { return i < other.i; } - inline bool operator<=(const iterator& other) const Q_DECL_NOTHROW { return i <= other.i; } - inline bool operator>(const iterator& other) const Q_DECL_NOTHROW { return i > other.i; } - inline bool operator>=(const iterator& other) const Q_DECL_NOTHROW { return i >= other.i; } + inline bool operator==(const iterator &o) const noexcept { return i == o.i; } + inline bool operator!=(const iterator &o) const noexcept { return i != o.i; } + inline bool operator<(const iterator& other) const noexcept { return i < other.i; } + inline bool operator<=(const iterator& other) const noexcept { return i <= other.i; } + inline bool operator>(const iterator& other) const noexcept { return i > other.i; } + inline bool operator>=(const iterator& other) const noexcept { return i >= other.i; } #ifndef QT_STRICT_ITERATORS - inline bool operator==(const const_iterator &o) const Q_DECL_NOTHROW + inline bool operator==(const const_iterator &o) const noexcept { return i == o.i; } - inline bool operator!=(const const_iterator &o) const Q_DECL_NOTHROW + inline bool operator!=(const const_iterator &o) const noexcept { return i != o.i; } - inline bool operator<(const const_iterator& other) const Q_DECL_NOTHROW + inline bool operator<(const const_iterator& other) const noexcept { return i < other.i; } - inline bool operator<=(const const_iterator& other) const Q_DECL_NOTHROW + inline bool operator<=(const const_iterator& other) const noexcept { return i <= other.i; } - inline bool operator>(const const_iterator& other) const Q_DECL_NOTHROW + inline bool operator>(const const_iterator& other) const noexcept { return i > other.i; } - inline bool operator>=(const const_iterator& other) const Q_DECL_NOTHROW + inline bool operator>=(const const_iterator& other) const noexcept { return i >= other.i; } #endif inline iterator &operator++() { ++i; return *this; } @@ -296,27 +296,27 @@ public: typedef const T *pointer; typedef const T &reference; - inline const_iterator() Q_DECL_NOTHROW : i(nullptr) {} - inline const_iterator(Node *n) Q_DECL_NOTHROW : i(n) {} + inline const_iterator() noexcept : i(nullptr) {} + inline const_iterator(Node *n) noexcept : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) // can't remove it in Qt 5, since doing so would make the type trivial, // which changes the way it's passed to functions by value. - inline const_iterator(const const_iterator &o) Q_DECL_NOTHROW : i(o.i) {} + inline const_iterator(const const_iterator &o) noexcept : i(o.i) {} #endif #ifdef QT_STRICT_ITERATORS - inline explicit const_iterator(const iterator &o) Q_DECL_NOTHROW : i(o.i) {} + inline explicit const_iterator(const iterator &o) noexcept : i(o.i) {} #else - inline const_iterator(const iterator &o) Q_DECL_NOTHROW : i(o.i) {} + inline const_iterator(const iterator &o) noexcept : i(o.i) {} #endif inline const T &operator*() const { return i->t(); } inline const T *operator->() const { return &i->t(); } inline const T &operator[](difference_type j) const { return i[j].t(); } - inline bool operator==(const const_iterator &o) const Q_DECL_NOTHROW { return i == o.i; } - inline bool operator!=(const const_iterator &o) const Q_DECL_NOTHROW { return i != o.i; } - inline bool operator<(const const_iterator& other) const Q_DECL_NOTHROW { return i < other.i; } - inline bool operator<=(const const_iterator& other) const Q_DECL_NOTHROW { return i <= other.i; } - inline bool operator>(const const_iterator& other) const Q_DECL_NOTHROW { return i > other.i; } - inline bool operator>=(const const_iterator& other) const Q_DECL_NOTHROW { return i >= other.i; } + inline bool operator==(const const_iterator &o) const noexcept { return i == o.i; } + inline bool operator!=(const const_iterator &o) const noexcept { return i != o.i; } + inline bool operator<(const const_iterator& other) const noexcept { return i < other.i; } + inline bool operator<=(const const_iterator& other) const noexcept { return i <= other.i; } + inline bool operator>(const const_iterator& other) const noexcept { return i > other.i; } + inline bool operator>=(const const_iterator& other) const noexcept { return i >= other.i; } inline const_iterator &operator++() { ++i; return *this; } inline const_iterator operator++(int) { Node *n = i; ++i; return n; } inline const_iterator &operator--() { i--; return *this; } @@ -334,19 +334,19 @@ public: typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; inline iterator begin() { detach(); return reinterpret_cast<Node *>(p.begin()); } - inline const_iterator begin() const Q_DECL_NOTHROW { return reinterpret_cast<Node *>(p.begin()); } - inline const_iterator cbegin() const Q_DECL_NOTHROW { return reinterpret_cast<Node *>(p.begin()); } - inline const_iterator constBegin() const Q_DECL_NOTHROW { return reinterpret_cast<Node *>(p.begin()); } + inline const_iterator begin() const noexcept { return reinterpret_cast<Node *>(p.begin()); } + inline const_iterator cbegin() const noexcept { return reinterpret_cast<Node *>(p.begin()); } + inline const_iterator constBegin() const noexcept { return reinterpret_cast<Node *>(p.begin()); } inline iterator end() { detach(); return reinterpret_cast<Node *>(p.end()); } - inline const_iterator end() const Q_DECL_NOTHROW { return reinterpret_cast<Node *>(p.end()); } - inline const_iterator cend() const Q_DECL_NOTHROW { return reinterpret_cast<Node *>(p.end()); } - inline const_iterator constEnd() const Q_DECL_NOTHROW { return reinterpret_cast<Node *>(p.end()); } + inline const_iterator end() const noexcept { return reinterpret_cast<Node *>(p.end()); } + inline const_iterator cend() const noexcept { return reinterpret_cast<Node *>(p.end()); } + inline const_iterator constEnd() const noexcept { return reinterpret_cast<Node *>(p.end()); } reverse_iterator rbegin() { return reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } - const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator crend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } iterator insert(iterator before, const T &t); iterator erase(iterator pos); iterator erase(iterator first, iterator last); @@ -423,7 +423,7 @@ private: void node_copy(Node *from, Node *to, Node *src); void node_destruct(Node *from, Node *to); - bool isValidIterator(const iterator &i) const Q_DECL_NOTHROW + bool isValidIterator(const iterator &i) const noexcept { const std::less<const Node *> less = {}; return !less(i.i, cbegin().i) && !less(cend().i, i.i); diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index ebb6c97975..9a3929c4a7 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -94,7 +94,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #include "qlocale_data_p.h" QT_END_INCLUDE_NAMESPACE -QLocale::Language QLocalePrivate::codeToLanguage(QStringView code) Q_DECL_NOTHROW +QLocale::Language QLocalePrivate::codeToLanguage(QStringView code) noexcept { const auto len = code.size(); if (len != 2 && len != 3) @@ -138,7 +138,7 @@ QLocale::Language QLocalePrivate::codeToLanguage(QStringView code) Q_DECL_NOTHRO return QLocale::C; } -QLocale::Script QLocalePrivate::codeToScript(QStringView code) Q_DECL_NOTHROW +QLocale::Script QLocalePrivate::codeToScript(QStringView code) noexcept { const auto len = code.size(); if (len != 4) @@ -158,7 +158,7 @@ QLocale::Script QLocalePrivate::codeToScript(QStringView code) Q_DECL_NOTHROW return QLocale::AnyScript; } -QLocale::Country QLocalePrivate::codeToCountry(QStringView code) Q_DECL_NOTHROW +QLocale::Country QLocalePrivate::codeToCountry(QStringView code) noexcept { const auto len = code.size(); if (len != 2 && len != 3) @@ -982,7 +982,7 @@ bool QLocale::operator!=(const QLocale &other) const Returns the hash value for \a key, using \a seed to seed the calculation. */ -uint qHash(const QLocale &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QLocale &key, uint seed) noexcept { QtPrivate::QHashCombine hash; seed = hash(seed, key.d->m_data); diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 2b4f131552..cb462db770 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -59,7 +59,7 @@ class QTextStreamPrivate; class QLocalePrivate; -Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed = 0) noexcept; class Q_CORE_EXPORT QLocale { @@ -940,12 +940,12 @@ public: QLocale(Language language, Script script, Country country); QLocale(const QLocale &other); #ifdef Q_COMPILER_RVALUE_REFS - QLocale &operator=(QLocale &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QLocale &operator=(QLocale &&other) noexcept { swap(other); return *this; } #endif QLocale &operator=(const QLocale &other); ~QLocale(); - void swap(QLocale &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QLocale &other) noexcept { qSwap(d, other.d); } Language language() const; Script script() const; @@ -1108,7 +1108,7 @@ private: QLocale(QLocalePrivate &dd); friend class QLocalePrivate; friend class QSystemLocale; - friend Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed) Q_DECL_NOTHROW; + friend Q_CORE_EXPORT uint qHash(const QLocale &key, uint seed) noexcept; QSharedDataPointer<QLocalePrivate> d; }; diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 5edeed1954..de973d5eac 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -365,9 +365,9 @@ public: static QLatin1String languageToCode(QLocale::Language language); static QLatin1String scriptToCode(QLocale::Script script); static QLatin1String countryToCode(QLocale::Country country); - static QLocale::Language codeToLanguage(QStringView code) Q_DECL_NOTHROW; - static QLocale::Script codeToScript(QStringView code) Q_DECL_NOTHROW; - static QLocale::Country codeToCountry(QStringView code) Q_DECL_NOTHROW; + static QLocale::Language codeToLanguage(QStringView code) noexcept; + static QLocale::Script codeToScript(QStringView code) noexcept; + static QLocale::Country codeToCountry(QStringView code) noexcept; static void getLangAndCountry(const QString &name, QLocale::Language &lang, QLocale::Script &script, QLocale::Country &cntry); diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 1cf9299e26..103124f4ad 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -100,10 +100,10 @@ struct Q_CORE_EXPORT QMapNodeBase template <typename T> static typename std::enable_if<QTypeInfo<T>::isComplex>::type - callDestructorIfNecessary(T &t) Q_DECL_NOTHROW { Q_UNUSED(t); t.~T(); } // Q_UNUSED: silence MSVC unused 't' warning + callDestructorIfNecessary(T &t) noexcept { Q_UNUSED(t); t.~T(); } // Q_UNUSED: silence MSVC unused 't' warning template <typename T> static typename std::enable_if<!QTypeInfo<T>::isComplex>::type - callDestructorIfNecessary(T &) Q_DECL_NOTHROW {} + callDestructorIfNecessary(T &) noexcept {} }; template <class Key, class T> @@ -325,7 +325,7 @@ class QMap QMapData<Key, T> *d; public: - inline QMap() Q_DECL_NOTHROW : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) { } + inline QMap() noexcept : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) { } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QMap(std::initializer_list<std::pair<Key,T> > list) : d(static_cast<QMapData<Key, T> *>(const_cast<QMapDataBase *>(&QMapDataBase::shared_null))) @@ -340,17 +340,17 @@ public: QMap<Key, T> &operator=(const QMap<Key, T> &other); #ifdef Q_COMPILER_RVALUE_REFS - inline QMap(QMap<Key, T> &&other) Q_DECL_NOTHROW + inline QMap(QMap<Key, T> &&other) noexcept : d(other.d) { other.d = static_cast<QMapData<Key, T> *>( const_cast<QMapDataBase *>(&QMapDataBase::shared_null)); } - inline QMap<Key, T> &operator=(QMap<Key, T> &&other) Q_DECL_NOTHROW + inline QMap<Key, T> &operator=(QMap<Key, T> &&other) noexcept { QMap moved(std::move(other)); swap(moved); return *this; } #endif - inline void swap(QMap<Key, T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + inline void swap(QMap<Key, T> &other) noexcept { qSwap(d, other.d); } explicit QMap(const typename std::map<Key, T> &other); std::map<Key, T> toStdMap() const; @@ -1187,7 +1187,7 @@ template <class Key, class T> class QMultiMap : public QMap<Key, T> { public: - QMultiMap() Q_DECL_NOTHROW {} + QMultiMap() noexcept {} #ifdef Q_COMPILER_INITIALIZER_LISTS inline QMultiMap(std::initializer_list<std::pair<Key,T> > list) { @@ -1197,9 +1197,9 @@ public: #endif QMultiMap(const QMap<Key, T> &other) : QMap<Key, T>(other) {} #ifdef Q_COMPILER_RVALUE_REFS - QMultiMap(QMap<Key, T> &&other) Q_DECL_NOTHROW : QMap<Key, T>(std::move(other)) {} + QMultiMap(QMap<Key, T> &&other) noexcept : QMap<Key, T>(std::move(other)) {} #endif - void swap(QMultiMap<Key, T> &other) Q_DECL_NOTHROW { QMap<Key, T>::swap(other); } + void swap(QMultiMap<Key, T> &other) noexcept { QMap<Key, T>::swap(other); } inline typename QMap<Key, T>::iterator replace(const Key &key, const T &value) { return QMap<Key, T>::insert(key, value); } diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h index 0c73235d26..447037daaa 100644 --- a/src/corelib/tools/qmargins.h +++ b/src/corelib/tools/qmargins.h @@ -51,28 +51,28 @@ QT_BEGIN_NAMESPACE class QMargins { public: - Q_DECL_CONSTEXPR QMargins() Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QMargins(int left, int top, int right, int bottom) Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR int left() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR int top() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR int right() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR int bottom() const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR void setLeft(int left) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR void setTop(int top) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR void setRight(int right) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR void setBottom(int bottom) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR QMargins &operator+=(const QMargins &margins) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMargins &operator-=(const QMargins &margins) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMargins &operator+=(int) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMargins &operator-=(int) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMargins &operator*=(int) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QMargins() noexcept; + Q_DECL_CONSTEXPR QMargins(int left, int top, int right, int bottom) noexcept; + + Q_DECL_CONSTEXPR bool isNull() const noexcept; + + Q_DECL_CONSTEXPR int left() const noexcept; + Q_DECL_CONSTEXPR int top() const noexcept; + Q_DECL_CONSTEXPR int right() const noexcept; + Q_DECL_CONSTEXPR int bottom() const noexcept; + + Q_DECL_RELAXED_CONSTEXPR void setLeft(int left) noexcept; + Q_DECL_RELAXED_CONSTEXPR void setTop(int top) noexcept; + Q_DECL_RELAXED_CONSTEXPR void setRight(int right) noexcept; + Q_DECL_RELAXED_CONSTEXPR void setBottom(int bottom) noexcept; + + Q_DECL_RELAXED_CONSTEXPR QMargins &operator+=(const QMargins &margins) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMargins &operator-=(const QMargins &margins) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMargins &operator+=(int) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMargins &operator-=(int) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMargins &operator*=(int) noexcept; Q_DECL_RELAXED_CONSTEXPR QMargins &operator/=(int); - Q_DECL_RELAXED_CONSTEXPR QMargins &operator*=(qreal) Q_DECL_NOTHROW; + Q_DECL_RELAXED_CONSTEXPR QMargins &operator*=(qreal) noexcept; Q_DECL_RELAXED_CONSTEXPR QMargins &operator/=(qreal); private: @@ -81,8 +81,8 @@ private: int m_right; int m_bottom; - friend Q_DECL_CONSTEXPR inline bool operator==(const QMargins &, const QMargins &) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &, const QMargins &) Q_DECL_NOTHROW; + friend Q_DECL_CONSTEXPR inline bool operator==(const QMargins &, const QMargins &) noexcept; + friend Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &, const QMargins &) noexcept; }; Q_DECLARE_TYPEINFO(QMargins, Q_MOVABLE_TYPE); @@ -99,40 +99,40 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMargins &); QMargins inline functions *****************************************************************************/ -Q_DECL_CONSTEXPR inline QMargins::QMargins() Q_DECL_NOTHROW : m_left(0), m_top(0), m_right(0), m_bottom(0) {} +Q_DECL_CONSTEXPR inline QMargins::QMargins() noexcept : m_left(0), m_top(0), m_right(0), m_bottom(0) {} -Q_DECL_CONSTEXPR inline QMargins::QMargins(int aleft, int atop, int aright, int abottom) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins::QMargins(int aleft, int atop, int aright, int abottom) noexcept : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {} -Q_DECL_CONSTEXPR inline bool QMargins::isNull() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QMargins::isNull() const noexcept { return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; } -Q_DECL_CONSTEXPR inline int QMargins::left() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QMargins::left() const noexcept { return m_left; } -Q_DECL_CONSTEXPR inline int QMargins::top() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QMargins::top() const noexcept { return m_top; } -Q_DECL_CONSTEXPR inline int QMargins::right() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QMargins::right() const noexcept { return m_right; } -Q_DECL_CONSTEXPR inline int QMargins::bottom() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QMargins::bottom() const noexcept { return m_bottom; } -Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setLeft(int aleft) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setLeft(int aleft) noexcept { m_left = aleft; } -Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setTop(int atop) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setTop(int atop) noexcept { m_top = atop; } -Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setRight(int aright) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setRight(int aright) noexcept { m_right = aright; } -Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setBottom(int abottom) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMargins::setBottom(int abottom) noexcept { m_bottom = abottom; } -Q_DECL_CONSTEXPR inline bool operator==(const QMargins &m1, const QMargins &m2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(const QMargins &m1, const QMargins &m2) noexcept { return m1.m_left == m2.m_left && @@ -141,7 +141,7 @@ Q_DECL_CONSTEXPR inline bool operator==(const QMargins &m1, const QMargins &m2) m1.m_bottom == m2.m_bottom; } -Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &m1, const QMargins &m2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &m1, const QMargins &m2) noexcept { return m1.m_left != m2.m_left || @@ -150,55 +150,55 @@ Q_DECL_CONSTEXPR inline bool operator!=(const QMargins &m1, const QMargins &m2) m1.m_bottom != m2.m_bottom; } -Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &m1, const QMargins &m2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &m1, const QMargins &m2) noexcept { return QMargins(m1.left() + m2.left(), m1.top() + m2.top(), m1.right() + m2.right(), m1.bottom() + m2.bottom()); } -Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &m1, const QMargins &m2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &m1, const QMargins &m2) noexcept { return QMargins(m1.left() - m2.left(), m1.top() - m2.top(), m1.right() - m2.right(), m1.bottom() - m2.bottom()); } -Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &lhs, int rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &lhs, int rhs) noexcept { return QMargins(lhs.left() + rhs, lhs.top() + rhs, lhs.right() + rhs, lhs.bottom() + rhs); } -Q_DECL_CONSTEXPR inline QMargins operator+(int lhs, const QMargins &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator+(int lhs, const QMargins &rhs) noexcept { return QMargins(rhs.left() + lhs, rhs.top() + lhs, rhs.right() + lhs, rhs.bottom() + lhs); } -Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &lhs, int rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &lhs, int rhs) noexcept { return QMargins(lhs.left() - rhs, lhs.top() - rhs, lhs.right() - rhs, lhs.bottom() - rhs); } -Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, int factor) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, int factor) noexcept { return QMargins(margins.left() * factor, margins.top() * factor, margins.right() * factor, margins.bottom() * factor); } -Q_DECL_CONSTEXPR inline QMargins operator*(int factor, const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator*(int factor, const QMargins &margins) noexcept { return QMargins(margins.left() * factor, margins.top() * factor, margins.right() * factor, margins.bottom() * factor); } -Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, qreal factor) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator*(const QMargins &margins, qreal factor) noexcept { return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor), qRound(margins.right() * factor), qRound(margins.bottom() * factor)); } -Q_DECL_CONSTEXPR inline QMargins operator*(qreal factor, const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator*(qreal factor, const QMargins &margins) noexcept { return QMargins(qRound(margins.left() * factor), qRound(margins.top() * factor), qRound(margins.right() * factor), qRound(margins.bottom() * factor)); @@ -216,17 +216,17 @@ Q_DECL_CONSTEXPR inline QMargins operator/(const QMargins &margins, qreal diviso qRound(margins.right() / divisor), qRound(margins.bottom() / divisor)); } -Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(const QMargins &margins) noexcept { return *this = *this + margins; } -Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(const QMargins &margins) noexcept { return *this = *this - margins; } -Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(int margin) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(int margin) noexcept { m_left += margin; m_top += margin; @@ -235,7 +235,7 @@ Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator+=(int margin) Q_DEC return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(int margin) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(int margin) noexcept { m_left -= margin; m_top -= margin; @@ -244,7 +244,7 @@ Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator-=(int margin) Q_DEC return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator*=(int factor) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator*=(int factor) noexcept { return *this = *this * factor; } @@ -254,7 +254,7 @@ Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator/=(int divisor) return *this = *this / divisor; } -Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator*=(qreal factor) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator*=(qreal factor) noexcept { return *this = *this * factor; } @@ -264,12 +264,12 @@ Q_DECL_RELAXED_CONSTEXPR inline QMargins &QMargins::operator/=(qreal divisor) return *this = *this / divisor; } -Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator+(const QMargins &margins) noexcept { return margins; } -Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins operator-(const QMargins &margins) noexcept { return QMargins(-margins.left(), -margins.top(), -margins.right(), -margins.bottom()); } @@ -285,30 +285,30 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QMargins &); class QMarginsF { public: - Q_DECL_CONSTEXPR QMarginsF() Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QMarginsF(qreal left, qreal top, qreal right, qreal bottom) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QMarginsF(const QMargins &margins) Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR qreal left() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR qreal top() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR qreal right() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR qreal bottom() const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR void setLeft(qreal left) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR void setTop(qreal top) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR void setRight(qreal right) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR void setBottom(qreal bottom) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator+=(const QMarginsF &margins) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator-=(const QMarginsF &margins) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator+=(qreal addend) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator-=(qreal subtrahend) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator*=(qreal factor) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QMarginsF() noexcept; + Q_DECL_CONSTEXPR QMarginsF(qreal left, qreal top, qreal right, qreal bottom) noexcept; + Q_DECL_CONSTEXPR QMarginsF(const QMargins &margins) noexcept; + + Q_DECL_CONSTEXPR bool isNull() const noexcept; + + Q_DECL_CONSTEXPR qreal left() const noexcept; + Q_DECL_CONSTEXPR qreal top() const noexcept; + Q_DECL_CONSTEXPR qreal right() const noexcept; + Q_DECL_CONSTEXPR qreal bottom() const noexcept; + + Q_DECL_RELAXED_CONSTEXPR void setLeft(qreal left) noexcept; + Q_DECL_RELAXED_CONSTEXPR void setTop(qreal top) noexcept; + Q_DECL_RELAXED_CONSTEXPR void setRight(qreal right) noexcept; + Q_DECL_RELAXED_CONSTEXPR void setBottom(qreal bottom) noexcept; + + Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator+=(const QMarginsF &margins) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator-=(const QMarginsF &margins) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator+=(qreal addend) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator-=(qreal subtrahend) noexcept; + Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator*=(qreal factor) noexcept; Q_DECL_RELAXED_CONSTEXPR QMarginsF &operator/=(qreal divisor); - Q_DECL_CONSTEXPR inline QMargins toMargins() const Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR inline QMargins toMargins() const noexcept; private: qreal m_left; @@ -332,44 +332,44 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMarginsF &); QMarginsF inline functions *****************************************************************************/ -Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF() Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF() noexcept : m_left(0), m_top(0), m_right(0), m_bottom(0) {} -Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom) noexcept : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {} -Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(const QMargins &margins) noexcept : m_left(margins.left()), m_top(margins.top()), m_right(margins.right()), m_bottom(margins.bottom()) {} -Q_DECL_CONSTEXPR inline bool QMarginsF::isNull() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QMarginsF::isNull() const noexcept { return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); } -Q_DECL_CONSTEXPR inline qreal QMarginsF::left() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QMarginsF::left() const noexcept { return m_left; } -Q_DECL_CONSTEXPR inline qreal QMarginsF::top() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QMarginsF::top() const noexcept { return m_top; } -Q_DECL_CONSTEXPR inline qreal QMarginsF::right() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QMarginsF::right() const noexcept { return m_right; } -Q_DECL_CONSTEXPR inline qreal QMarginsF::bottom() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QMarginsF::bottom() const noexcept { return m_bottom; } -Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setLeft(qreal aleft) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setLeft(qreal aleft) noexcept { m_left = aleft; } -Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setTop(qreal atop) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setTop(qreal atop) noexcept { m_top = atop; } -Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setRight(qreal aright) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setRight(qreal aright) noexcept { m_right = aright; } -Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setBottom(qreal abottom) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QMarginsF::setBottom(qreal abottom) noexcept { m_bottom = abottom; } -Q_DECL_CONSTEXPR inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) noexcept { return qFuzzyCompare(lhs.left(), rhs.left()) && qFuzzyCompare(lhs.top(), rhs.top()) @@ -377,48 +377,48 @@ Q_DECL_CONSTEXPR inline bool operator==(const QMarginsF &lhs, const QMarginsF &r && qFuzzyCompare(lhs.bottom(), rhs.bottom()); } -Q_DECL_CONSTEXPR inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) noexcept { return !operator==(lhs, rhs); } -Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) noexcept { return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(), lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom()); } -Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) noexcept { return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(), lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom()); } -Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs) noexcept { return QMarginsF(lhs.left() + rhs, lhs.top() + rhs, lhs.right() + rhs, lhs.bottom() + rhs); } -Q_DECL_CONSTEXPR inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs) noexcept { return QMarginsF(rhs.left() + lhs, rhs.top() + lhs, rhs.right() + lhs, rhs.bottom() + lhs); } -Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs) noexcept { return QMarginsF(lhs.left() - rhs, lhs.top() - rhs, lhs.right() - rhs, lhs.bottom() - rhs); } -Q_DECL_CONSTEXPR inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs) noexcept { return QMarginsF(lhs.left() * rhs, lhs.top() * rhs, lhs.right() * rhs, lhs.bottom() * rhs); } -Q_DECL_CONSTEXPR inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs) noexcept { return QMarginsF(rhs.left() * lhs, rhs.top() * lhs, rhs.right() * lhs, rhs.bottom() * lhs); @@ -430,17 +430,17 @@ Q_DECL_CONSTEXPR inline QMarginsF operator/(const QMarginsF &lhs, qreal divisor) lhs.right() / divisor, lhs.bottom() / divisor); } -Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) noexcept { return *this = *this + margins; } -Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) noexcept { return *this = *this - margins; } -Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(qreal addend) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(qreal addend) noexcept { m_left += addend; m_top += addend; @@ -449,7 +449,7 @@ Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator+=(qreal addend) Q return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(qreal subtrahend) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(qreal subtrahend) noexcept { m_left -= subtrahend; m_top -= subtrahend; @@ -458,7 +458,7 @@ Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator-=(qreal subtrahen return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator*=(qreal factor) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator*=(qreal factor) noexcept { return *this = *this * factor; } @@ -468,17 +468,17 @@ Q_DECL_RELAXED_CONSTEXPR inline QMarginsF &QMarginsF::operator/=(qreal divisor) return *this = *this / divisor; } -Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &margins) noexcept { return margins; } -Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &margins) noexcept { return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom()); } -Q_DECL_CONSTEXPR inline QMargins QMarginsF::toMargins() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QMargins QMarginsF::toMargins() const noexcept { return QMargins(qRound(m_left), qRound(m_top), qRound(m_right), qRound(m_bottom)); } diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index d7323f7707..34df673b93 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -94,7 +94,7 @@ public: friend Q_DECL_CONSTEXPR inline const QPoint operator/(const QPoint &, qreal); #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - Q_REQUIRED_RESULT CGPoint toCGPoint() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT CGPoint toCGPoint() const noexcept; #endif private: @@ -256,8 +256,8 @@ public: Q_DECL_CONSTEXPR QPoint toPoint() const; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - Q_REQUIRED_RESULT static QPointF fromCGPoint(CGPoint point) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT CGPoint toCGPoint() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT static QPointF fromCGPoint(CGPoint point) noexcept; + Q_REQUIRED_RESULT CGPoint toCGPoint() const noexcept; #endif private: diff --git a/src/corelib/tools/qqueue.h b/src/corelib/tools/qqueue.h index b55f210577..16229759ee 100644 --- a/src/corelib/tools/qqueue.h +++ b/src/corelib/tools/qqueue.h @@ -50,7 +50,7 @@ class QQueue : public QList<T> { public: // compiler-generated special member functions are fine! - inline void swap(QQueue<T> &other) Q_DECL_NOTHROW { QList<T>::swap(other); } // prevent QList<->QQueue swaps + inline void swap(QQueue<T> &other) noexcept { QList<T>::swap(other); } // prevent QList<->QQueue swaps #ifndef Q_QDOC // bring in QList::swap(int, int). We cannot say using QList<T>::swap, // because we don't want to make swap(QList&) available. diff --git a/src/corelib/tools/qrect.cpp b/src/corelib/tools/qrect.cpp index 6e51deebea..d622f92530 100644 --- a/src/corelib/tools/qrect.cpp +++ b/src/corelib/tools/qrect.cpp @@ -300,7 +300,7 @@ QT_BEGIN_NAMESPACE \sa isValid(), isEmpty() */ -QRect QRect::normalized() const Q_DECL_NOTHROW +QRect QRect::normalized() const noexcept { QRect r; if (x2 < x1 - 1) { // swap bad x values @@ -820,7 +820,7 @@ QRect QRect::normalized() const Q_DECL_NOTHROW \sa intersects() */ -bool QRect::contains(const QPoint &p, bool proper) const Q_DECL_NOTHROW +bool QRect::contains(const QPoint &p, bool proper) const noexcept { int l, r; if (x2 < x1 - 1) { @@ -884,7 +884,7 @@ bool QRect::contains(const QPoint &p, bool proper) const Q_DECL_NOTHROW rectangle (not on the edge). */ -bool QRect::contains(const QRect &r, bool proper) const Q_DECL_NOTHROW +bool QRect::contains(const QRect &r, bool proper) const noexcept { if (isNull() || r.isNull()) return false; @@ -962,7 +962,7 @@ bool QRect::contains(const QRect &r, bool proper) const Q_DECL_NOTHROW \sa operator|=(), united() */ -QRect QRect::operator|(const QRect &r) const Q_DECL_NOTHROW +QRect QRect::operator|(const QRect &r) const noexcept { if (isNull()) return r; @@ -1033,7 +1033,7 @@ QRect QRect::operator|(const QRect &r) const Q_DECL_NOTHROW \sa operator&=(), intersected() */ -QRect QRect::operator&(const QRect &r) const Q_DECL_NOTHROW +QRect QRect::operator&(const QRect &r) const noexcept { if (isNull() || r.isNull()) return QRect(); @@ -1112,7 +1112,7 @@ QRect QRect::operator&(const QRect &r) const Q_DECL_NOTHROW \sa contains() */ -bool QRect::intersects(const QRect &r) const Q_DECL_NOTHROW +bool QRect::intersects(const QRect &r) const noexcept { if (isNull() || r.isNull()) return false; @@ -1540,7 +1540,7 @@ QDebug operator<<(QDebug dbg, const QRect &r) \sa isValid(), isEmpty() */ -QRectF QRectF::normalized() const Q_DECL_NOTHROW +QRectF QRectF::normalized() const noexcept { QRectF r = *this; if (r.w < 0) { @@ -1964,7 +1964,7 @@ QRectF QRectF::normalized() const Q_DECL_NOTHROW \sa intersects() */ -bool QRectF::contains(const QPointF &p) const Q_DECL_NOTHROW +bool QRectF::contains(const QPointF &p) const noexcept { qreal l = xp; qreal r = xp; @@ -2010,7 +2010,7 @@ bool QRectF::contains(const QPointF &p) const Q_DECL_NOTHROW otherwise returns \c false. */ -bool QRectF::contains(const QRectF &r) const Q_DECL_NOTHROW +bool QRectF::contains(const QRectF &r) const noexcept { qreal l1 = xp; qreal r1 = xp; @@ -2148,7 +2148,7 @@ bool QRectF::contains(const QRectF &r) const Q_DECL_NOTHROW \sa united(), operator|=() */ -QRectF QRectF::operator|(const QRectF &r) const Q_DECL_NOTHROW +QRectF QRectF::operator|(const QRectF &r) const noexcept { if (isNull()) return r; @@ -2217,7 +2217,7 @@ QRectF QRectF::operator|(const QRectF &r) const Q_DECL_NOTHROW \sa operator&=(), intersected() */ -QRectF QRectF::operator&(const QRectF &r) const Q_DECL_NOTHROW +QRectF QRectF::operator&(const QRectF &r) const noexcept { qreal l1 = xp; qreal r1 = xp; @@ -2302,7 +2302,7 @@ QRectF QRectF::operator&(const QRectF &r) const Q_DECL_NOTHROW \sa contains() */ -bool QRectF::intersects(const QRectF &r) const Q_DECL_NOTHROW +bool QRectF::intersects(const QRectF &r) const noexcept { qreal l1 = xp; qreal r1 = xp; @@ -2369,7 +2369,7 @@ bool QRectF::intersects(const QRectF &r) const Q_DECL_NOTHROW \sa toRect() */ -QRect QRectF::toAlignedRect() const Q_DECL_NOTHROW +QRect QRectF::toAlignedRect() const noexcept { int xmin = int(qFloor(xp)); int xmax = int(qCeil(xp + w)); diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index 3b40055b5a..7aa2312f38 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -57,104 +57,104 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QRect { public: - Q_DECL_CONSTEXPR QRect() Q_DECL_NOTHROW : x1(0), y1(0), x2(-1), y2(-1) {} - Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QPoint &bottomright) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QSize &size) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QRect(int left, int top, int width, int height) Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline bool isNull() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isEmpty() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline int left() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline int top() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline int right() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline int bottom() const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QRect normalized() const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline int x() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline int y() const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setLeft(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setTop(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setRight(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setBottom(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setX(int x) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setY(int y) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void setTopLeft(const QPoint &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setBottomRight(const QPoint &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setTopRight(const QPoint &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setBottomLeft(const QPoint &p) Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline QPoint topLeft() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QPoint bottomRight() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QPoint topRight() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QPoint bottomLeft() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QPoint center() const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void moveLeft(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTop(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveRight(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveBottom(int pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTopLeft(const QPoint &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveBottomRight(const QPoint &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTopRight(const QPoint &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveBottomLeft(const QPoint &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveCenter(const QPoint &p) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void translate(int dx, int dy) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPoint &p) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(int dx, int dy) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(const QPoint &p) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect transposed() const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void moveTo(int x, int t) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPoint &p) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void setRect(int x, int y, int w, int h) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QRect() noexcept : x1(0), y1(0), x2(-1), y2(-1) {} + Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QPoint &bottomright) noexcept; + Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QSize &size) noexcept; + Q_DECL_CONSTEXPR QRect(int left, int top, int width, int height) noexcept; + + Q_DECL_CONSTEXPR inline bool isNull() const noexcept; + Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept; + Q_DECL_CONSTEXPR inline bool isValid() const noexcept; + + Q_DECL_CONSTEXPR inline int left() const noexcept; + Q_DECL_CONSTEXPR inline int top() const noexcept; + Q_DECL_CONSTEXPR inline int right() const noexcept; + Q_DECL_CONSTEXPR inline int bottom() const noexcept; + Q_REQUIRED_RESULT QRect normalized() const noexcept; + + Q_DECL_CONSTEXPR inline int x() const noexcept; + Q_DECL_CONSTEXPR inline int y() const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setLeft(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setTop(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setRight(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setBottom(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setX(int x) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setY(int y) noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void setTopLeft(const QPoint &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setBottomRight(const QPoint &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setTopRight(const QPoint &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setBottomLeft(const QPoint &p) noexcept; + + Q_DECL_CONSTEXPR inline QPoint topLeft() const noexcept; + Q_DECL_CONSTEXPR inline QPoint bottomRight() const noexcept; + Q_DECL_CONSTEXPR inline QPoint topRight() const noexcept; + Q_DECL_CONSTEXPR inline QPoint bottomLeft() const noexcept; + Q_DECL_CONSTEXPR inline QPoint center() const noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void moveLeft(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTop(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveRight(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveBottom(int pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTopLeft(const QPoint &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveBottomRight(const QPoint &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTopRight(const QPoint &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveBottomLeft(const QPoint &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveCenter(const QPoint &p) noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void translate(int dx, int dy) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPoint &p) noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(int dx, int dy) const noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect translated(const QPoint &p) const noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect transposed() const noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void moveTo(int x, int t) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPoint &p) noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void setRect(int x, int y, int w, int h) noexcept; Q_DECL_RELAXED_CONSTEXPR inline void getRect(int *x, int *y, int *w, int *h) const; - Q_DECL_RELAXED_CONSTEXPR inline void setCoords(int x1, int y1, int x2, int y2) Q_DECL_NOTHROW; + Q_DECL_RELAXED_CONSTEXPR inline void setCoords(int x1, int y1, int x2, int y2) noexcept; Q_DECL_RELAXED_CONSTEXPR inline void getCoords(int *x1, int *y1, int *x2, int *y2) const; - Q_DECL_RELAXED_CONSTEXPR inline void adjust(int x1, int y1, int x2, int y2) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect adjusted(int x1, int y1, int x2, int y2) const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline QSize size() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline int width() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline int height() const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setSize(const QSize &s) Q_DECL_NOTHROW; - - QRect operator|(const QRect &r) const Q_DECL_NOTHROW; - QRect operator&(const QRect &r) const Q_DECL_NOTHROW; - inline QRect& operator|=(const QRect &r) Q_DECL_NOTHROW; - inline QRect& operator&=(const QRect &r) Q_DECL_NOTHROW; - - bool contains(const QRect &r, bool proper = false) const Q_DECL_NOTHROW; - bool contains(const QPoint &p, bool proper=false) const Q_DECL_NOTHROW; - inline bool contains(int x, int y) const Q_DECL_NOTHROW; - inline bool contains(int x, int y, bool proper) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT inline QRect united(const QRect &other) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT inline QRect intersected(const QRect &other) const Q_DECL_NOTHROW; - bool intersects(const QRect &r) const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline QRect marginsAdded(const QMargins &margins) const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QRect marginsRemoved(const QMargins &margins) const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QRect &operator+=(const QMargins &margins) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QRect &operator-=(const QMargins &margins) Q_DECL_NOTHROW; + Q_DECL_RELAXED_CONSTEXPR inline void adjust(int x1, int y1, int x2, int y2) noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect adjusted(int x1, int y1, int x2, int y2) const noexcept; + + Q_DECL_CONSTEXPR inline QSize size() const noexcept; + Q_DECL_CONSTEXPR inline int width() const noexcept; + Q_DECL_CONSTEXPR inline int height() const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setSize(const QSize &s) noexcept; + + QRect operator|(const QRect &r) const noexcept; + QRect operator&(const QRect &r) const noexcept; + inline QRect& operator|=(const QRect &r) noexcept; + inline QRect& operator&=(const QRect &r) noexcept; + + bool contains(const QRect &r, bool proper = false) const noexcept; + bool contains(const QPoint &p, bool proper=false) const noexcept; + inline bool contains(int x, int y) const noexcept; + inline bool contains(int x, int y, bool proper) const noexcept; + Q_REQUIRED_RESULT inline QRect united(const QRect &other) const noexcept; + Q_REQUIRED_RESULT inline QRect intersected(const QRect &other) const noexcept; + bool intersects(const QRect &r) const noexcept; + + Q_DECL_CONSTEXPR inline QRect marginsAdded(const QMargins &margins) const noexcept; + Q_DECL_CONSTEXPR inline QRect marginsRemoved(const QMargins &margins) const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QRect &operator+=(const QMargins &margins) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QRect &operator-=(const QMargins &margins) noexcept; #if QT_DEPRECATED_SINCE(5, 0) - Q_REQUIRED_RESULT QT_DEPRECATED QRect unite(const QRect &r) const Q_DECL_NOTHROW { return united(r); } - Q_REQUIRED_RESULT QT_DEPRECATED QRect intersect(const QRect &r) const Q_DECL_NOTHROW { return intersected(r); } + Q_REQUIRED_RESULT QT_DEPRECATED QRect unite(const QRect &r) const noexcept { return united(r); } + Q_REQUIRED_RESULT QT_DEPRECATED QRect intersect(const QRect &r) const noexcept { return intersected(r); } #endif - friend Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) Q_DECL_NOTHROW; + friend Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) noexcept; + friend Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) noexcept; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - Q_REQUIRED_RESULT CGRect toCGRect() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT CGRect toCGRect() const noexcept; #endif private: @@ -165,8 +165,8 @@ private: }; Q_DECLARE_TYPEINFO(QRect, Q_MOVABLE_TYPE); -Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) Q_DECL_NOTHROW; -Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) Q_DECL_NOTHROW; +Q_DECL_CONSTEXPR inline bool operator==(const QRect &, const QRect &) noexcept; +Q_DECL_CONSTEXPR inline bool operator!=(const QRect &, const QRect &) noexcept; /***************************************************************************** @@ -181,97 +181,97 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRect &); QRect inline member functions *****************************************************************************/ -Q_DECL_CONSTEXPR inline QRect::QRect(int aleft, int atop, int awidth, int aheight) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect::QRect(int aleft, int atop, int awidth, int aheight) noexcept : x1(aleft), y1(atop), x2(aleft + awidth - 1), y2(atop + aheight - 1) {} -Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight) noexcept : x1(atopLeft.x()), y1(atopLeft.y()), x2(abottomRight.x()), y2(abottomRight.y()) {} -Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QSize &asize) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QSize &asize) noexcept : x1(atopLeft.x()), y1(atopLeft.y()), x2(atopLeft.x()+asize.width() - 1), y2(atopLeft.y()+asize.height() - 1) {} -Q_DECL_CONSTEXPR inline bool QRect::isNull() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QRect::isNull() const noexcept { return x2 == x1 - 1 && y2 == y1 - 1; } -Q_DECL_CONSTEXPR inline bool QRect::isEmpty() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QRect::isEmpty() const noexcept { return x1 > x2 || y1 > y2; } -Q_DECL_CONSTEXPR inline bool QRect::isValid() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QRect::isValid() const noexcept { return x1 <= x2 && y1 <= y2; } -Q_DECL_CONSTEXPR inline int QRect::left() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::left() const noexcept { return x1; } -Q_DECL_CONSTEXPR inline int QRect::top() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::top() const noexcept { return y1; } -Q_DECL_CONSTEXPR inline int QRect::right() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::right() const noexcept { return x2; } -Q_DECL_CONSTEXPR inline int QRect::bottom() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::bottom() const noexcept { return y2; } -Q_DECL_CONSTEXPR inline int QRect::x() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::x() const noexcept { return x1; } -Q_DECL_CONSTEXPR inline int QRect::y() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::y() const noexcept { return y1; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setLeft(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setLeft(int pos) noexcept { x1 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTop(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTop(int pos) noexcept { y1 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setRight(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setRight(int pos) noexcept { x2 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottom(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottom(int pos) noexcept { y2 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTopLeft(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTopLeft(const QPoint &p) noexcept { x1 = p.x(); y1 = p.y(); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottomRight(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottomRight(const QPoint &p) noexcept { x2 = p.x(); y2 = p.y(); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTopRight(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setTopRight(const QPoint &p) noexcept { x2 = p.x(); y1 = p.y(); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottomLeft(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setBottomLeft(const QPoint &p) noexcept { x1 = p.x(); y2 = p.y(); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setX(int ax) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setX(int ax) noexcept { x1 = ax; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setY(int ay) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setY(int ay) noexcept { y1 = ay; } -Q_DECL_CONSTEXPR inline QPoint QRect::topLeft() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QPoint QRect::topLeft() const noexcept { return QPoint(x1, y1); } -Q_DECL_CONSTEXPR inline QPoint QRect::bottomRight() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QPoint QRect::bottomRight() const noexcept { return QPoint(x2, y2); } -Q_DECL_CONSTEXPR inline QPoint QRect::topRight() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QPoint QRect::topRight() const noexcept { return QPoint(x2, y1); } -Q_DECL_CONSTEXPR inline QPoint QRect::bottomLeft() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QPoint QRect::bottomLeft() const noexcept { return QPoint(x1, y2); } -Q_DECL_CONSTEXPR inline QPoint QRect::center() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QPoint QRect::center() const noexcept { return QPoint(int((qint64(x1)+x2)/2), int((qint64(y1)+y2)/2)); } // cast avoids overflow on addition -Q_DECL_CONSTEXPR inline int QRect::width() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::width() const noexcept { return x2 - x1 + 1; } -Q_DECL_CONSTEXPR inline int QRect::height() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QRect::height() const noexcept { return y2 - y1 + 1; } -Q_DECL_CONSTEXPR inline QSize QRect::size() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSize QRect::size() const noexcept { return QSize(width(), height()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(int dx, int dy) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(int dx, int dy) noexcept { x1 += dx; y1 += dy; @@ -279,7 +279,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(int dx, int dy) Q_DECL_NOT y2 += dy; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(const QPoint &p) noexcept { x1 += p.x(); y1 += p.y(); @@ -287,16 +287,16 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::translate(const QPoint &p) Q_DECL_NO y2 += p.y(); } -Q_DECL_CONSTEXPR inline QRect QRect::translated(int dx, int dy) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect QRect::translated(int dx, int dy) const noexcept { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } -Q_DECL_CONSTEXPR inline QRect QRect::translated(const QPoint &p) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect QRect::translated(const QPoint &p) const noexcept { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } -Q_DECL_CONSTEXPR inline QRect QRect::transposed() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect QRect::transposed() const noexcept { return QRect(topLeft(), size().transposed()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(int ax, int ay) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(int ax, int ay) noexcept { x2 += ax - x1; y2 += ay - y1; @@ -304,7 +304,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(int ax, int ay) Q_DECL_NOTHRO y1 = ay; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(const QPoint &p) noexcept { x2 += p.x() - x1; y2 += p.y() - y1; @@ -312,49 +312,49 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTo(const QPoint &p) Q_DECL_NOTHR y1 = p.y(); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveLeft(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveLeft(int pos) noexcept { x2 += (pos - x1); x1 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTop(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTop(int pos) noexcept { y2 += (pos - y1); y1 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveRight(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveRight(int pos) noexcept { x1 += (pos - x2); x2 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottom(int pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottom(int pos) noexcept { y1 += (pos - y2); y2 = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTopLeft(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTopLeft(const QPoint &p) noexcept { moveLeft(p.x()); moveTop(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottomRight(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottomRight(const QPoint &p) noexcept { moveRight(p.x()); moveBottom(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTopRight(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveTopRight(const QPoint &p) noexcept { moveRight(p.x()); moveTop(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottomLeft(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveBottomLeft(const QPoint &p) noexcept { moveLeft(p.x()); moveBottom(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveCenter(const QPoint &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::moveCenter(const QPoint &p) noexcept { int w = x2 - x1; int h = y2 - y1; @@ -372,7 +372,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::getRect(int *ax, int *ay, int *aw, i *ah = y2 - y1 + 1; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setRect(int ax, int ay, int aw, int ah) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setRect(int ax, int ay, int aw, int ah) noexcept { x1 = ax; y1 = ay; @@ -388,7 +388,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::getCoords(int *xp1, int *yp1, int *x *yp2 = y2; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2) noexcept { x1 = xp1; y1 = yp1; @@ -396,10 +396,10 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::setCoords(int xp1, int yp1, int xp2, y2 = yp2; } -Q_DECL_CONSTEXPR inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const noexcept { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2) noexcept { x1 += dx1; y1 += dy1; @@ -407,97 +407,97 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRect::adjust(int dx1, int dy1, int dx2, in y2 += dy2; } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setWidth(int w) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setWidth(int w) noexcept { x2 = (x1 + w - 1); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setHeight(int h) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setHeight(int h) noexcept { y2 = (y1 + h - 1); } -Q_DECL_RELAXED_CONSTEXPR inline void QRect::setSize(const QSize &s) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRect::setSize(const QSize &s) noexcept { x2 = (s.width() + x1 - 1); y2 = (s.height() + y1 - 1); } -inline bool QRect::contains(int ax, int ay, bool aproper) const Q_DECL_NOTHROW +inline bool QRect::contains(int ax, int ay, bool aproper) const noexcept { return contains(QPoint(ax, ay), aproper); } -inline bool QRect::contains(int ax, int ay) const Q_DECL_NOTHROW +inline bool QRect::contains(int ax, int ay) const noexcept { return contains(QPoint(ax, ay), false); } -inline QRect& QRect::operator|=(const QRect &r) Q_DECL_NOTHROW +inline QRect& QRect::operator|=(const QRect &r) noexcept { *this = *this | r; return *this; } -inline QRect& QRect::operator&=(const QRect &r) Q_DECL_NOTHROW +inline QRect& QRect::operator&=(const QRect &r) noexcept { *this = *this & r; return *this; } -inline QRect QRect::intersected(const QRect &other) const Q_DECL_NOTHROW +inline QRect QRect::intersected(const QRect &other) const noexcept { return *this & other; } -inline QRect QRect::united(const QRect &r) const Q_DECL_NOTHROW +inline QRect QRect::united(const QRect &r) const noexcept { return *this | r; } -Q_DECL_CONSTEXPR inline bool operator==(const QRect &r1, const QRect &r2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(const QRect &r1, const QRect &r2) noexcept { return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; } -Q_DECL_CONSTEXPR inline bool operator!=(const QRect &r1, const QRect &r2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(const QRect &r1, const QRect &r2) noexcept { return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2; } -Q_DECL_CONSTEXPR inline QRect operator+(const QRect &rectangle, const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect operator+(const QRect &rectangle, const QMargins &margins) noexcept { return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()), QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom())); } -Q_DECL_CONSTEXPR inline QRect operator+(const QMargins &margins, const QRect &rectangle) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect operator+(const QMargins &margins, const QRect &rectangle) noexcept { return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()), QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom())); } -Q_DECL_CONSTEXPR inline QRect operator-(const QRect &lhs, const QMargins &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept { return QRect(QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()), QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom())); } -Q_DECL_CONSTEXPR inline QRect QRect::marginsAdded(const QMargins &margins) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect QRect::marginsAdded(const QMargins &margins) const noexcept { return QRect(QPoint(x1 - margins.left(), y1 - margins.top()), QPoint(x2 + margins.right(), y2 + margins.bottom())); } -Q_DECL_CONSTEXPR inline QRect QRect::marginsRemoved(const QMargins &margins) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect QRect::marginsRemoved(const QMargins &margins) const noexcept { return QRect(QPoint(x1 + margins.left(), y1 + margins.top()), QPoint(x2 - margins.right(), y2 - margins.bottom())); } -Q_DECL_RELAXED_CONSTEXPR inline QRect &QRect::operator+=(const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QRect &QRect::operator+=(const QMargins &margins) noexcept { *this = marginsAdded(margins); return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QRect &QRect::operator-=(const QMargins &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QRect &QRect::operator-=(const QMargins &margins) noexcept { *this = marginsRemoved(margins); return *this; @@ -511,110 +511,110 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &); class Q_CORE_EXPORT QRectF { public: - Q_DECL_CONSTEXPR QRectF() Q_DECL_NOTHROW : xp(0.), yp(0.), w(0.), h(0.) {} - Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QSizeF &size) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QPointF &bottomRight) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QRectF(qreal left, qreal top, qreal width, qreal height) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QRectF(const QRect &rect) Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline bool isNull() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isEmpty() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QRectF normalized() const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline qreal left() const Q_DECL_NOTHROW { return xp; } - Q_DECL_CONSTEXPR inline qreal top() const Q_DECL_NOTHROW { return yp; } - Q_DECL_CONSTEXPR inline qreal right() const Q_DECL_NOTHROW { return xp + w; } - Q_DECL_CONSTEXPR inline qreal bottom() const Q_DECL_NOTHROW { return yp + h; } - - Q_DECL_CONSTEXPR inline qreal x() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline qreal y() const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setLeft(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setTop(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setRight(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setBottom(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setX(qreal pos) Q_DECL_NOTHROW { setLeft(pos); } - Q_DECL_RELAXED_CONSTEXPR inline void setY(qreal pos) Q_DECL_NOTHROW { setTop(pos); } - - Q_DECL_CONSTEXPR inline QPointF topLeft() const Q_DECL_NOTHROW { return QPointF(xp, yp); } - Q_DECL_CONSTEXPR inline QPointF bottomRight() const Q_DECL_NOTHROW { return QPointF(xp+w, yp+h); } - Q_DECL_CONSTEXPR inline QPointF topRight() const Q_DECL_NOTHROW { return QPointF(xp+w, yp); } - Q_DECL_CONSTEXPR inline QPointF bottomLeft() const Q_DECL_NOTHROW { return QPointF(xp, yp+h); } - Q_DECL_CONSTEXPR inline QPointF center() const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void setTopLeft(const QPointF &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setBottomRight(const QPointF &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setTopRight(const QPointF &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setBottomLeft(const QPointF &p) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void moveLeft(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTop(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveRight(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveBottom(qreal pos) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTopLeft(const QPointF &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveBottomRight(const QPointF &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTopRight(const QPointF &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveBottomLeft(const QPointF &p) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveCenter(const QPointF &p) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void translate(qreal dx, qreal dy) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPointF &p) Q_DECL_NOTHROW; - - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(qreal dx, qreal dy) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(const QPointF &p) const Q_DECL_NOTHROW; - - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF transposed() const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void moveTo(qreal x, qreal y) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPointF &p) Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline void setRect(qreal x, qreal y, qreal w, qreal h) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QRectF() noexcept : xp(0.), yp(0.), w(0.), h(0.) {} + Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QSizeF &size) noexcept; + Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QPointF &bottomRight) noexcept; + Q_DECL_CONSTEXPR QRectF(qreal left, qreal top, qreal width, qreal height) noexcept; + Q_DECL_CONSTEXPR QRectF(const QRect &rect) noexcept; + + Q_DECL_CONSTEXPR inline bool isNull() const noexcept; + Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept; + Q_DECL_CONSTEXPR inline bool isValid() const noexcept; + Q_REQUIRED_RESULT QRectF normalized() const noexcept; + + Q_DECL_CONSTEXPR inline qreal left() const noexcept { return xp; } + Q_DECL_CONSTEXPR inline qreal top() const noexcept { return yp; } + Q_DECL_CONSTEXPR inline qreal right() const noexcept { return xp + w; } + Q_DECL_CONSTEXPR inline qreal bottom() const noexcept { return yp + h; } + + Q_DECL_CONSTEXPR inline qreal x() const noexcept; + Q_DECL_CONSTEXPR inline qreal y() const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setLeft(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setTop(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setRight(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setBottom(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setX(qreal pos) noexcept { setLeft(pos); } + Q_DECL_RELAXED_CONSTEXPR inline void setY(qreal pos) noexcept { setTop(pos); } + + Q_DECL_CONSTEXPR inline QPointF topLeft() const noexcept { return QPointF(xp, yp); } + Q_DECL_CONSTEXPR inline QPointF bottomRight() const noexcept { return QPointF(xp+w, yp+h); } + Q_DECL_CONSTEXPR inline QPointF topRight() const noexcept { return QPointF(xp+w, yp); } + Q_DECL_CONSTEXPR inline QPointF bottomLeft() const noexcept { return QPointF(xp, yp+h); } + Q_DECL_CONSTEXPR inline QPointF center() const noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void setTopLeft(const QPointF &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setBottomRight(const QPointF &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setTopRight(const QPointF &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setBottomLeft(const QPointF &p) noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void moveLeft(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTop(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveRight(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveBottom(qreal pos) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTopLeft(const QPointF &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveBottomRight(const QPointF &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTopRight(const QPointF &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveBottomLeft(const QPointF &p) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveCenter(const QPointF &p) noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void translate(qreal dx, qreal dy) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void translate(const QPointF &p) noexcept; + + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(qreal dx, qreal dy) const noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF translated(const QPointF &p) const noexcept; + + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF transposed() const noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void moveTo(qreal x, qreal y) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void moveTo(const QPointF &p) noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline void setRect(qreal x, qreal y, qreal w, qreal h) noexcept; Q_DECL_RELAXED_CONSTEXPR inline void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const; - Q_DECL_RELAXED_CONSTEXPR inline void setCoords(qreal x1, qreal y1, qreal x2, qreal y2) Q_DECL_NOTHROW; + Q_DECL_RELAXED_CONSTEXPR inline void setCoords(qreal x1, qreal y1, qreal x2, qreal y2) noexcept; Q_DECL_RELAXED_CONSTEXPR inline void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const; - Q_DECL_RELAXED_CONSTEXPR inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline QSizeF size() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline qreal width() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline qreal height() const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setSize(const QSizeF &s) Q_DECL_NOTHROW; - - QRectF operator|(const QRectF &r) const Q_DECL_NOTHROW; - QRectF operator&(const QRectF &r) const Q_DECL_NOTHROW; - inline QRectF& operator|=(const QRectF &r) Q_DECL_NOTHROW; - inline QRectF& operator&=(const QRectF &r) Q_DECL_NOTHROW; - - bool contains(const QRectF &r) const Q_DECL_NOTHROW; - bool contains(const QPointF &p) const Q_DECL_NOTHROW; - inline bool contains(qreal x, qreal y) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT inline QRectF united(const QRectF &other) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT inline QRectF intersected(const QRectF &other) const Q_DECL_NOTHROW; - bool intersects(const QRectF &r) const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline QRectF marginsAdded(const QMarginsF &margins) const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QRectF marginsRemoved(const QMarginsF &margins) const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator+=(const QMarginsF &margins) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator-=(const QMarginsF &margins) Q_DECL_NOTHROW; + Q_DECL_RELAXED_CONSTEXPR inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept; + + Q_DECL_CONSTEXPR inline QSizeF size() const noexcept; + Q_DECL_CONSTEXPR inline qreal width() const noexcept; + Q_DECL_CONSTEXPR inline qreal height() const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setSize(const QSizeF &s) noexcept; + + QRectF operator|(const QRectF &r) const noexcept; + QRectF operator&(const QRectF &r) const noexcept; + inline QRectF& operator|=(const QRectF &r) noexcept; + inline QRectF& operator&=(const QRectF &r) noexcept; + + bool contains(const QRectF &r) const noexcept; + bool contains(const QPointF &p) const noexcept; + inline bool contains(qreal x, qreal y) const noexcept; + Q_REQUIRED_RESULT inline QRectF united(const QRectF &other) const noexcept; + Q_REQUIRED_RESULT inline QRectF intersected(const QRectF &other) const noexcept; + bool intersects(const QRectF &r) const noexcept; + + Q_DECL_CONSTEXPR inline QRectF marginsAdded(const QMarginsF &margins) const noexcept; + Q_DECL_CONSTEXPR inline QRectF marginsRemoved(const QMarginsF &margins) const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator+=(const QMarginsF &margins) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator-=(const QMarginsF &margins) noexcept; #if QT_DEPRECATED_SINCE(5, 0) - Q_REQUIRED_RESULT QT_DEPRECATED QRectF unite(const QRectF &r) const Q_DECL_NOTHROW { return united(r); } - Q_REQUIRED_RESULT QT_DEPRECATED QRectF intersect(const QRectF &r) const Q_DECL_NOTHROW { return intersected(r); } + Q_REQUIRED_RESULT QT_DEPRECATED QRectF unite(const QRectF &r) const noexcept { return united(r); } + Q_REQUIRED_RESULT QT_DEPRECATED QRectF intersect(const QRectF &r) const noexcept { return intersected(r); } #endif - friend Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &) Q_DECL_NOTHROW; + friend Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &) noexcept; + friend Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &) noexcept; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect toRect() const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QRect toAlignedRect() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect toRect() const noexcept; + Q_REQUIRED_RESULT QRect toAlignedRect() const noexcept; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - Q_REQUIRED_RESULT static QRectF fromCGRect(CGRect rect) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT CGRect toCGRect() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT static QRectF fromCGRect(CGRect rect) noexcept; + Q_REQUIRED_RESULT CGRect toCGRect() const noexcept; #endif private: @@ -625,8 +625,8 @@ private: }; Q_DECLARE_TYPEINFO(QRectF, Q_MOVABLE_TYPE); -Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &) Q_DECL_NOTHROW; -Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &) Q_DECL_NOTHROW; +Q_DECL_CONSTEXPR inline bool operator==(const QRectF &, const QRectF &) noexcept; +Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &, const QRectF &) noexcept; /***************************************************************************** @@ -641,23 +641,23 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRectF &); QRectF inline member functions *****************************************************************************/ -Q_DECL_CONSTEXPR inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight) noexcept : xp(aleft), yp(atop), w(awidth), h(aheight) { } -Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize) noexcept : xp(atopLeft.x()), yp(atopLeft.y()), w(asize.width()), h(asize.height()) { } -Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight) noexcept : xp(atopLeft.x()), yp(atopLeft.y()), w(abottomRight.x() - atopLeft.x()), h(abottomRight.y() - atopLeft.y()) { } -Q_DECL_CONSTEXPR inline QRectF::QRectF(const QRect &r) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF::QRectF(const QRect &r) noexcept : xp(r.x()), yp(r.y()), w(r.width()), h(r.height()) { } @@ -666,117 +666,117 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wfloat-equal") QT_WARNING_DISABLE_GCC("-Wfloat-equal") -Q_DECL_CONSTEXPR inline bool QRectF::isNull() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QRectF::isNull() const noexcept { return w == 0. && h == 0.; } -Q_DECL_CONSTEXPR inline bool QRectF::isEmpty() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QRectF::isEmpty() const noexcept { return w <= 0. || h <= 0.; } QT_WARNING_POP -Q_DECL_CONSTEXPR inline bool QRectF::isValid() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QRectF::isValid() const noexcept { return w > 0. && h > 0.; } -Q_DECL_CONSTEXPR inline qreal QRectF::x() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QRectF::x() const noexcept { return xp; } -Q_DECL_CONSTEXPR inline qreal QRectF::y() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QRectF::y() const noexcept { return yp; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setLeft(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setLeft(qreal pos) noexcept { qreal diff = pos - xp; xp += diff; w -= diff; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setRight(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setRight(qreal pos) noexcept { w = pos - xp; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTop(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTop(qreal pos) noexcept { qreal diff = pos - yp; yp += diff; h -= diff; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottom(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottom(qreal pos) noexcept { h = pos - yp; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTopLeft(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTopLeft(const QPointF &p) noexcept { setLeft(p.x()); setTop(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTopRight(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setTopRight(const QPointF &p) noexcept { setRight(p.x()); setTop(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottomLeft(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottomLeft(const QPointF &p) noexcept { setLeft(p.x()); setBottom(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottomRight(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setBottomRight(const QPointF &p) noexcept { setRight(p.x()); setBottom(p.y()); } -Q_DECL_CONSTEXPR inline QPointF QRectF::center() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QPointF QRectF::center() const noexcept { return QPointF(xp + w/2, yp + h/2); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveLeft(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveLeft(qreal pos) noexcept { xp = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTop(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTop(qreal pos) noexcept { yp = pos; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveRight(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveRight(qreal pos) noexcept { xp = pos - w; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottom(qreal pos) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottom(qreal pos) noexcept { yp = pos - h; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTopLeft(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTopLeft(const QPointF &p) noexcept { moveLeft(p.x()); moveTop(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTopRight(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTopRight(const QPointF &p) noexcept { moveRight(p.x()); moveTop(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottomLeft(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottomLeft(const QPointF &p) noexcept { moveLeft(p.x()); moveBottom(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottomRight(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveBottomRight(const QPointF &p) noexcept { moveRight(p.x()); moveBottom(p.y()); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveCenter(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveCenter(const QPointF &p) noexcept { xp = p.x() - w/2; yp = p.y() - h/2; } -Q_DECL_CONSTEXPR inline qreal QRectF::width() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QRectF::width() const noexcept { return w; } -Q_DECL_CONSTEXPR inline qreal QRectF::height() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QRectF::height() const noexcept { return h; } -Q_DECL_CONSTEXPR inline QSizeF QRectF::size() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSizeF QRectF::size() const noexcept { return QSizeF(w, h); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::translate(qreal dx, qreal dy) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::translate(qreal dx, qreal dy) noexcept { xp += dx; yp += dy; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::translate(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::translate(const QPointF &p) noexcept { xp += p.x(); yp += p.y(); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTo(qreal ax, qreal ay) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTo(qreal ax, qreal ay) noexcept { xp = ax; yp = ay; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTo(const QPointF &p) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::moveTo(const QPointF &p) noexcept { xp = p.x(); yp = p.y(); } -Q_DECL_CONSTEXPR inline QRectF QRectF::translated(qreal dx, qreal dy) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF QRectF::translated(qreal dx, qreal dy) const noexcept { return QRectF(xp + dx, yp + dy, w, h); } -Q_DECL_CONSTEXPR inline QRectF QRectF::translated(const QPointF &p) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF QRectF::translated(const QPointF &p) const noexcept { return QRectF(xp + p.x(), yp + p.y(), w, h); } -Q_DECL_CONSTEXPR inline QRectF QRectF::transposed() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF QRectF::transposed() const noexcept { return QRectF(topLeft(), size().transposed()); } Q_DECL_RELAXED_CONSTEXPR inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const @@ -787,7 +787,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aah = this->h; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah) noexcept { this->xp = ax; this->yp = ay; @@ -803,7 +803,7 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRectF::getCoords(qreal *xp1, qreal *yp1, q *yp2 = yp + h; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept { xp = xp1; yp = yp1; @@ -811,105 +811,105 @@ Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setCoords(qreal xp1, qreal yp1, qre h = yp2 - yp1; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept { xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; } -Q_DECL_CONSTEXPR inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const noexcept { return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setWidth(qreal aw) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setWidth(qreal aw) noexcept { this->w = aw; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setHeight(qreal ah) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setHeight(qreal ah) noexcept { this->h = ah; } -Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setSize(const QSizeF &s) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QRectF::setSize(const QSizeF &s) noexcept { w = s.width(); h = s.height(); } -inline bool QRectF::contains(qreal ax, qreal ay) const Q_DECL_NOTHROW +inline bool QRectF::contains(qreal ax, qreal ay) const noexcept { return contains(QPointF(ax, ay)); } -inline QRectF& QRectF::operator|=(const QRectF &r) Q_DECL_NOTHROW +inline QRectF& QRectF::operator|=(const QRectF &r) noexcept { *this = *this | r; return *this; } -inline QRectF& QRectF::operator&=(const QRectF &r) Q_DECL_NOTHROW +inline QRectF& QRectF::operator&=(const QRectF &r) noexcept { *this = *this & r; return *this; } -inline QRectF QRectF::intersected(const QRectF &r) const Q_DECL_NOTHROW +inline QRectF QRectF::intersected(const QRectF &r) const noexcept { return *this & r; } -inline QRectF QRectF::united(const QRectF &r) const Q_DECL_NOTHROW +inline QRectF QRectF::united(const QRectF &r) const noexcept { return *this | r; } -Q_DECL_CONSTEXPR inline bool operator==(const QRectF &r1, const QRectF &r2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(const QRectF &r1, const QRectF &r2) noexcept { return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp) && qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h); } -Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &r1, const QRectF &r2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &r1, const QRectF &r2) noexcept { return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp) || !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h); } -Q_DECL_CONSTEXPR inline QRect QRectF::toRect() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRect QRectF::toRect() const noexcept { return QRect(QPoint(qRound(xp), qRound(yp)), QPoint(qRound(xp + w) - 1, qRound(yp + h) - 1)); } -Q_DECL_CONSTEXPR inline QRectF operator+(const QRectF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF operator+(const QRectF &lhs, const QMarginsF &rhs) noexcept { return QRectF(QPointF(lhs.left() - rhs.left(), lhs.top() - rhs.top()), QSizeF(lhs.width() + rhs.left() + rhs.right(), lhs.height() + rhs.top() + rhs.bottom())); } -Q_DECL_CONSTEXPR inline QRectF operator+(const QMarginsF &lhs, const QRectF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF operator+(const QMarginsF &lhs, const QRectF &rhs) noexcept { return QRectF(QPointF(rhs.left() - lhs.left(), rhs.top() - lhs.top()), QSizeF(rhs.width() + lhs.left() + lhs.right(), rhs.height() + lhs.top() + lhs.bottom())); } -Q_DECL_CONSTEXPR inline QRectF operator-(const QRectF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF operator-(const QRectF &lhs, const QMarginsF &rhs) noexcept { return QRectF(QPointF(lhs.left() + rhs.left(), lhs.top() + rhs.top()), QSizeF(lhs.width() - rhs.left() - rhs.right(), lhs.height() - rhs.top() - rhs.bottom())); } -Q_DECL_CONSTEXPR inline QRectF QRectF::marginsAdded(const QMarginsF &margins) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF QRectF::marginsAdded(const QMarginsF &margins) const noexcept { return QRectF(QPointF(xp - margins.left(), yp - margins.top()), QSizeF(w + margins.left() + margins.right(), h + margins.top() + margins.bottom())); } -Q_DECL_CONSTEXPR inline QRectF QRectF::marginsRemoved(const QMarginsF &margins) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QRectF QRectF::marginsRemoved(const QMarginsF &margins) const noexcept { return QRectF(QPointF(xp + margins.left(), yp + margins.top()), QSizeF(w - margins.left() - margins.right(), h - margins.top() - margins.bottom())); } -Q_DECL_RELAXED_CONSTEXPR inline QRectF &QRectF::operator+=(const QMarginsF &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QRectF &QRectF::operator+=(const QMarginsF &margins) noexcept { *this = marginsAdded(margins); return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QRectF &QRectF::operator-=(const QMarginsF &margins) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QRectF &QRectF::operator-=(const QMarginsF &margins) noexcept { *this = marginsRemoved(margins); return *this; diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h index 9586c3a79a..71adb41f28 100644 --- a/src/corelib/tools/qrefcount.h +++ b/src/corelib/tools/qrefcount.h @@ -51,7 +51,7 @@ namespace QtPrivate class RefCount { public: - inline bool ref() Q_DECL_NOTHROW { + inline bool ref() noexcept { int count = atomic.load(); #if !defined(QT_NO_UNSHARABLE_CONTAINERS) if (count == 0) // !isSharable @@ -62,7 +62,7 @@ public: return true; } - inline bool deref() Q_DECL_NOTHROW { + inline bool deref() noexcept { int count = atomic.load(); #if !defined(QT_NO_UNSHARABLE_CONTAINERS) if (count == 0) // !isSharable @@ -74,7 +74,7 @@ public: } #if !defined(QT_NO_UNSHARABLE_CONTAINERS) - bool setSharable(bool sharable) Q_DECL_NOTHROW + bool setSharable(bool sharable) noexcept { Q_ASSERT(!isShared()); if (sharable) @@ -83,27 +83,27 @@ public: return atomic.testAndSetRelaxed(1, 0); } - bool isSharable() const Q_DECL_NOTHROW + bool isSharable() const noexcept { // Sharable === Shared ownership. return atomic.load() != 0; } #endif - bool isStatic() const Q_DECL_NOTHROW + bool isStatic() const noexcept { // Persistent object, never deleted return atomic.load() == -1; } - bool isShared() const Q_DECL_NOTHROW + bool isShared() const noexcept { int count = atomic.load(); return (count != 1) && (count != 0); } - void initializeOwned() Q_DECL_NOTHROW { atomic.store(1); } - void initializeUnsharable() Q_DECL_NOTHROW { atomic.store(0); } + void initializeOwned() noexcept { atomic.store(1); } + void initializeUnsharable() noexcept { atomic.store(0); } QBasicAtomicInt atomic; }; diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 589eb74520..d970843dea 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -890,7 +890,7 @@ static bool operator==(const QRegExpEngineKey &key1, const QRegExpEngineKey &key && key1.cs == key2.cs; } -static uint qHash(const QRegExpEngineKey &key, uint seed = 0) Q_DECL_NOTHROW +static uint qHash(const QRegExpEngineKey &key, uint seed = 0) noexcept { QtPrivate::QHashCombine hash; seed = hash(seed, key.pattern); @@ -4046,7 +4046,7 @@ bool QRegExp::operator==(const QRegExp &rx) const Returns the hash value for \a key, using \a seed to seed the calculation. */ -uint qHash(const QRegExp &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QRegExp &key, uint seed) noexcept { QtPrivate::QHashCombine hash; seed = hash(seed, key.priv->engineKey); diff --git a/src/corelib/tools/qregexp.h b/src/corelib/tools/qregexp.h index b3fa242168..c043a06496 100644 --- a/src/corelib/tools/qregexp.h +++ b/src/corelib/tools/qregexp.h @@ -53,7 +53,7 @@ struct QRegExpPrivate; class QStringList; class QRegExp; -Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed = 0) noexcept; class Q_CORE_EXPORT QRegExp { @@ -74,9 +74,9 @@ public: ~QRegExp(); QRegExp &operator=(const QRegExp &rx); #ifdef Q_COMPILER_RVALUE_REFS - QRegExp &operator=(QRegExp &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QRegExp &operator=(QRegExp &&other) noexcept { swap(other); return *this; } #endif - void swap(QRegExp &other) Q_DECL_NOTHROW { qSwap(priv, other.priv); } + void swap(QRegExp &other) noexcept { qSwap(priv, other.priv); } bool operator==(const QRegExp &rx) const; inline bool operator!=(const QRegExp &rx) const { return !operator==(rx); } @@ -112,7 +112,7 @@ public: static QString escape(const QString &str); - friend Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed) Q_DECL_NOTHROW; + friend Q_CORE_EXPORT uint qHash(const QRegExp &key, uint seed) noexcept; private: QRegExpPrivate *priv; diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index bdaa2d3243..ca1a866842 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1810,7 +1810,7 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const Returns the hash value for \a key, using \a seed to seed the calculation. */ -uint qHash(const QRegularExpression &key, uint seed) Q_DECL_NOTHROW +uint qHash(const QRegularExpression &key, uint seed) noexcept { QtPrivate::QHashCombine hash; seed = hash(seed, key.d->pattern); diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h index f9e7029550..f16b7e91be 100644 --- a/src/corelib/tools/qregularexpression.h +++ b/src/corelib/tools/qregularexpression.h @@ -59,7 +59,7 @@ class QRegularExpressionMatchIterator; struct QRegularExpressionPrivate; class QRegularExpression; -Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed = 0) Q_DECL_NOTHROW; +Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed = 0) noexcept; class Q_CORE_EXPORT QRegularExpression { @@ -88,11 +88,11 @@ public: QRegularExpression &operator=(const QRegularExpression &re); #ifdef Q_COMPILER_RVALUE_REFS - QRegularExpression &operator=(QRegularExpression &&re) Q_DECL_NOTHROW + QRegularExpression &operator=(QRegularExpression &&re) noexcept { d.swap(re.d); return *this; } #endif - void swap(QRegularExpression &other) Q_DECL_NOTHROW { d.swap(other.d); } + void swap(QRegularExpression &other) noexcept { d.swap(other.d); } QString pattern() const; void setPattern(const QString &pattern); @@ -157,7 +157,7 @@ private: friend class QRegularExpressionMatch; friend struct QRegularExpressionMatchPrivate; friend class QRegularExpressionMatchIterator; - friend Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed) Q_DECL_NOTHROW; + friend Q_CORE_EXPORT uint qHash(const QRegularExpression &key, uint seed) noexcept; QRegularExpression(QRegularExpressionPrivate &dd); QExplicitlySharedDataPointer<QRegularExpressionPrivate> d; @@ -188,10 +188,10 @@ public: QRegularExpressionMatch &operator=(const QRegularExpressionMatch &match); #ifdef Q_COMPILER_RVALUE_REFS - QRegularExpressionMatch &operator=(QRegularExpressionMatch &&match) Q_DECL_NOTHROW + QRegularExpressionMatch &operator=(QRegularExpressionMatch &&match) noexcept { d.swap(match.d); return *this; } #endif - void swap(QRegularExpressionMatch &other) Q_DECL_NOTHROW { d.swap(other.d); } + void swap(QRegularExpressionMatch &other) noexcept { d.swap(other.d); } QRegularExpression regularExpression() const; QRegularExpression::MatchType matchType() const; @@ -258,10 +258,10 @@ public: QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator); QRegularExpressionMatchIterator &operator=(const QRegularExpressionMatchIterator &iterator); #ifdef Q_COMPILER_RVALUE_REFS - QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator) Q_DECL_NOTHROW + QRegularExpressionMatchIterator &operator=(QRegularExpressionMatchIterator &&iterator) noexcept { d.swap(iterator.d); return *this; } #endif - void swap(QRegularExpressionMatchIterator &other) Q_DECL_NOTHROW { d.swap(other.d); } + void swap(QRegularExpressionMatchIterator &other) noexcept { d.swap(other.d); } bool isValid() const; diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 76ab4a5b62..838cb31697 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -65,11 +65,11 @@ class QRingChunk { public: // initialization and cleanup - inline QRingChunk() Q_DECL_NOTHROW : + inline QRingChunk() noexcept : headOffset(0), tailOffset(0) { } - inline QRingChunk(const QRingChunk &other) Q_DECL_NOTHROW : + inline QRingChunk(const QRingChunk &other) noexcept : chunk(other.chunk), headOffset(other.headOffset), tailOffset(other.tailOffset) { } @@ -77,30 +77,30 @@ public: chunk(alloc, Qt::Uninitialized), headOffset(0), tailOffset(0) { } - explicit inline QRingChunk(const QByteArray &qba) Q_DECL_NOTHROW : + explicit inline QRingChunk(const QByteArray &qba) noexcept : chunk(qba), headOffset(0), tailOffset(qba.size()) { } - inline QRingChunk &operator=(const QRingChunk &other) Q_DECL_NOTHROW + inline QRingChunk &operator=(const QRingChunk &other) noexcept { chunk = other.chunk; headOffset = other.headOffset; tailOffset = other.tailOffset; return *this; } - inline QRingChunk(QRingChunk &&other) Q_DECL_NOTHROW : + inline QRingChunk(QRingChunk &&other) noexcept : chunk(other.chunk), headOffset(other.headOffset), tailOffset(other.tailOffset) { other.headOffset = other.tailOffset = 0; } - inline QRingChunk &operator=(QRingChunk &&other) Q_DECL_NOTHROW + inline QRingChunk &operator=(QRingChunk &&other) noexcept { swap(other); return *this; } - inline void swap(QRingChunk &other) Q_DECL_NOTHROW + inline void swap(QRingChunk &other) noexcept { chunk.swap(other.chunk); qSwap(headOffset, other.headOffset); diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 2a4083466b..756e0aec79 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -97,7 +97,7 @@ class QScopedPointer { typedef T *QScopedPointer:: *RestrictedBool; public: - explicit QScopedPointer(T *p = nullptr) Q_DECL_NOTHROW : d(p) + explicit QScopedPointer(T *p = nullptr) noexcept : d(p) { } @@ -113,12 +113,12 @@ public: return *d; } - T *operator->() const Q_DECL_NOTHROW + T *operator->() const noexcept { return d; } - bool operator!() const Q_DECL_NOTHROW + bool operator!() const noexcept { return !d; } @@ -129,23 +129,23 @@ public: return isNull() ? nullptr : &QScopedPointer::d; } #else - operator RestrictedBool() const Q_DECL_NOTHROW + operator RestrictedBool() const noexcept { return isNull() ? nullptr : &QScopedPointer::d; } #endif - T *data() const Q_DECL_NOTHROW + T *data() const noexcept { return d; } - T *get() const Q_DECL_NOTHROW + T *get() const noexcept { return d; } - bool isNull() const Q_DECL_NOTHROW + bool isNull() const noexcept { return !d; } @@ -159,14 +159,14 @@ public: Cleanup::cleanup(oldD); } - T *take() Q_DECL_NOTHROW + T *take() noexcept { T *oldD = d; d = nullptr; return oldD; } - void swap(QScopedPointer<T, Cleanup> &other) Q_DECL_NOTHROW + void swap(QScopedPointer<T, Cleanup> &other) noexcept { qSwap(d, other.d); } @@ -181,43 +181,43 @@ private: }; template <class T, class Cleanup> -inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW +inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) noexcept { return lhs.data() == rhs.data(); } template <class T, class Cleanup> -inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs) noexcept { return lhs.data() != rhs.data(); } template <class T, class Cleanup> -inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator==(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t) noexcept { return lhs.isNull(); } template <class T, class Cleanup> -inline bool operator==(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW +inline bool operator==(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs) noexcept { return rhs.isNull(); } template <class T, class Cleanup> -inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t) noexcept { return !lhs.isNull(); } template <class T, class Cleanup> -inline bool operator!=(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW +inline bool operator!=(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs) noexcept { return !rhs.isNull(); } template <class T, class Cleanup> -inline void swap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2) Q_DECL_NOTHROW +inline void swap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2) noexcept { p1.swap(p2); } template <typename T, typename Cleanup = QScopedPointerArrayDeleter<T> > @@ -244,7 +244,7 @@ public: return this->d[i]; } - void swap(QScopedArrayPointer &other) Q_DECL_NOTHROW // prevent QScopedPointer <->QScopedArrayPointer swaps + void swap(QScopedArrayPointer &other) noexcept // prevent QScopedPointer <->QScopedArrayPointer swaps { QScopedPointer<T, Cleanup>::swap(other); } private: @@ -263,7 +263,7 @@ private: }; template <typename T, typename Cleanup> -inline void swap(QScopedArrayPointer<T, Cleanup> &lhs, QScopedArrayPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW +inline void swap(QScopedArrayPointer<T, Cleanup> &lhs, QScopedArrayPointer<T, Cleanup> &rhs) noexcept { lhs.swap(rhs); } QT_END_NAMESPACE diff --git a/src/corelib/tools/qscopeguard.h b/src/corelib/tools/qscopeguard.h index 0f61996eb6..41d0a6af68 100644 --- a/src/corelib/tools/qscopeguard.h +++ b/src/corelib/tools/qscopeguard.h @@ -58,7 +58,7 @@ Q_REQUIRED_RESULT QScopeGuard { public: - QScopeGuard(QScopeGuard &&other) Q_DECL_NOEXCEPT + QScopeGuard(QScopeGuard &&other) noexcept : m_func(std::move(other.m_func)) , m_invoke(other.m_invoke) { @@ -71,13 +71,13 @@ public: m_func(); } - void dismiss() Q_DECL_NOEXCEPT + void dismiss() noexcept { m_invoke = false; } private: - explicit QScopeGuard(F f) Q_DECL_NOEXCEPT + explicit QScopeGuard(F f) noexcept : m_func(std::move(f)) { } diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 6640c8486d..d7fbc12b99 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -56,7 +56,7 @@ class QSet typedef QHash<T, QHashDummyValue> Hash; public: - inline QSet() Q_DECL_NOTHROW {} + inline QSet() noexcept {} #ifdef Q_COMPILER_INITIALIZER_LISTS inline QSet(std::initializer_list<T> list) { @@ -68,7 +68,7 @@ public: // compiler-generated copy/move ctor/assignment operators are fine! // compiler-generated destructor is fine! - inline void swap(QSet<T> &other) Q_DECL_NOTHROW { q_hash.swap(other.q_hash); } + inline void swap(QSet<T> &other) noexcept { q_hash.swap(other.q_hash); } inline bool operator==(const QSet<T> &other) const { return q_hash == other.q_hash; } @@ -176,20 +176,20 @@ public: typedef std::reverse_iterator<const_iterator> const_reverse_iterator; inline iterator begin() { return q_hash.begin(); } - inline const_iterator begin() const Q_DECL_NOTHROW { return q_hash.begin(); } - inline const_iterator cbegin() const Q_DECL_NOTHROW { return q_hash.begin(); } - inline const_iterator constBegin() const Q_DECL_NOTHROW { return q_hash.constBegin(); } + inline const_iterator begin() const noexcept { return q_hash.begin(); } + inline const_iterator cbegin() const noexcept { return q_hash.begin(); } + inline const_iterator constBegin() const noexcept { return q_hash.constBegin(); } inline iterator end() { return q_hash.end(); } - inline const_iterator end() const Q_DECL_NOTHROW { return q_hash.end(); } - inline const_iterator cend() const Q_DECL_NOTHROW { return q_hash.end(); } - inline const_iterator constEnd() const Q_DECL_NOTHROW { return q_hash.constEnd(); } + inline const_iterator end() const noexcept { return q_hash.end(); } + inline const_iterator cend() const noexcept { return q_hash.end(); } + inline const_iterator constEnd() const noexcept { return q_hash.constEnd(); } reverse_iterator rbegin() { return reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } - const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator crend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } iterator erase(iterator i) { return erase(m2c(i)); } @@ -252,14 +252,14 @@ public: private: Hash q_hash; - static const_iterator m2c(iterator it) Q_DECL_NOTHROW + static const_iterator m2c(iterator it) noexcept { return const_iterator(typename Hash::const_iterator(it.i.i)); } bool isValidIterator(const iterator &i) const { return q_hash.isValidIterator(reinterpret_cast<const typename Hash::iterator&>(i)); } - bool isValidIterator(const const_iterator &i) const Q_DECL_NOTHROW + bool isValidIterator(const const_iterator &i) const noexcept { return q_hash.isValidIterator(reinterpret_cast<const typename Hash::const_iterator&>(i)); } diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 6930cb96a5..cbaa1aa3c4 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -88,7 +88,7 @@ public: inline QSharedDataPointer() { d = nullptr; } inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } - explicit QSharedDataPointer(T *data) Q_DECL_NOTHROW; + explicit QSharedDataPointer(T *data) noexcept; inline QSharedDataPointer(const QSharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); } inline QSharedDataPointer<T> & operator=(const QSharedDataPointer<T> &o) { if (o.d != d) { @@ -113,8 +113,8 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; } - inline QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other) Q_DECL_NOTHROW + QSharedDataPointer(QSharedDataPointer &&o) noexcept : d(o.d) { o.d = nullptr; } + inline QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other) noexcept { QSharedDataPointer moved(std::move(other)); swap(moved); @@ -124,7 +124,7 @@ public: inline bool operator!() const { return !d; } - inline void swap(QSharedDataPointer &other) Q_DECL_NOTHROW + inline void swap(QSharedDataPointer &other) noexcept { qSwap(d, other.d); } protected: @@ -181,7 +181,7 @@ public: inline QExplicitlySharedDataPointer() { d = nullptr; } inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; } - explicit QExplicitlySharedDataPointer(T *data) Q_DECL_NOTHROW; + explicit QExplicitlySharedDataPointer(T *data) noexcept; inline QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<T> &o) : d(o.d) { if (d) d->ref.ref(); } template<class X> @@ -219,8 +219,8 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; } - inline QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other) Q_DECL_NOTHROW + inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) noexcept : d(o.d) { o.d = nullptr; } + inline QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other) noexcept { QExplicitlySharedDataPointer moved(std::move(other)); swap(moved); @@ -230,7 +230,7 @@ public: inline bool operator!() const { return !d; } - inline void swap(QExplicitlySharedDataPointer &other) Q_DECL_NOTHROW + inline void swap(QExplicitlySharedDataPointer &other) noexcept { qSwap(d, other.d); } protected: @@ -243,7 +243,7 @@ private: }; template <class T> -Q_INLINE_TEMPLATE QSharedDataPointer<T>::QSharedDataPointer(T *adata) Q_DECL_NOTHROW +Q_INLINE_TEMPLATE QSharedDataPointer<T>::QSharedDataPointer(T *adata) noexcept : d(adata) { if (d) d->ref.ref(); } @@ -280,7 +280,7 @@ Q_OUTOFLINE_TEMPLATE void QExplicitlySharedDataPointer<T>::detach_helper() } template <class T> -Q_INLINE_TEMPLATE QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(T *adata) Q_DECL_NOTHROW +Q_INLINE_TEMPLATE QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(T *adata) noexcept : d(adata) { if (d) d->ref.ref(); } @@ -317,12 +317,12 @@ namespace std { QT_BEGIN_NAMESPACE template <class T> -Q_INLINE_TEMPLATE uint qHash(const QSharedDataPointer<T> &ptr, uint seed = 0) Q_DECL_NOTHROW +Q_INLINE_TEMPLATE uint qHash(const QSharedDataPointer<T> &ptr, uint seed = 0) noexcept { return qHash(ptr.data(), seed); } template <class T> -Q_INLINE_TEMPLATE uint qHash(const QExplicitlySharedDataPointer<T> &ptr, uint seed = 0) Q_DECL_NOTHROW +Q_INLINE_TEMPLATE uint qHash(const QExplicitlySharedDataPointer<T> &ptr, uint seed = 0) noexcept { return qHash(ptr.data(), seed); } diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index bccf8c5740..81d8dcd839 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -303,18 +303,18 @@ public: typedef const value_type &const_reference; typedef qptrdiff difference_type; - T *data() const Q_DECL_NOTHROW { return value; } - T *get() const Q_DECL_NOTHROW { return value; } - bool isNull() const Q_DECL_NOTHROW { return !data(); } - operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QSharedPointer::value; } - bool operator !() const Q_DECL_NOTHROW { return isNull(); } + T *data() const noexcept { return value; } + T *get() const noexcept { return value; } + bool isNull() const noexcept { return !data(); } + operator RestrictedBool() const noexcept { return isNull() ? nullptr : &QSharedPointer::value; } + bool operator !() const noexcept { return isNull(); } T &operator*() const { return *data(); } - T *operator->() const Q_DECL_NOTHROW { return data(); } + T *operator->() const noexcept { return data(); } - Q_DECL_CONSTEXPR QSharedPointer() Q_DECL_NOTHROW : value(nullptr), d(nullptr) { } + Q_DECL_CONSTEXPR QSharedPointer() noexcept : value(nullptr), d(nullptr) { } ~QSharedPointer() { deref(); } - Q_DECL_CONSTEXPR QSharedPointer(std::nullptr_t) Q_DECL_NOTHROW : value(nullptr), d(nullptr) { } + Q_DECL_CONSTEXPR QSharedPointer(std::nullptr_t) noexcept : value(nullptr), d(nullptr) { } template <class X> inline explicit QSharedPointer(X *ptr) : value(ptr) // noexcept @@ -327,22 +327,22 @@ public: template <typename Deleter> QSharedPointer(std::nullptr_t, Deleter) : value(nullptr), d(nullptr) { } - QSharedPointer(const QSharedPointer &other) Q_DECL_NOTHROW : value(other.value), d(other.d) + QSharedPointer(const QSharedPointer &other) noexcept : value(other.value), d(other.d) { if (d) ref(); } - QSharedPointer &operator=(const QSharedPointer &other) Q_DECL_NOTHROW + QSharedPointer &operator=(const QSharedPointer &other) noexcept { QSharedPointer copy(other); swap(copy); return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QSharedPointer(QSharedPointer &&other) Q_DECL_NOTHROW + QSharedPointer(QSharedPointer &&other) noexcept : value(other.value), d(other.d) { other.d = nullptr; other.value = nullptr; } - QSharedPointer &operator=(QSharedPointer &&other) Q_DECL_NOTHROW + QSharedPointer &operator=(QSharedPointer &&other) noexcept { QSharedPointer moved(std::move(other)); swap(moved); @@ -350,7 +350,7 @@ public: } template <class X> - QSharedPointer(QSharedPointer<X> &&other) Q_DECL_NOTHROW + QSharedPointer(QSharedPointer<X> &&other) noexcept : value(other.value), d(other.d) { other.d = nullptr; @@ -358,7 +358,7 @@ public: } template <class X> - QSharedPointer &operator=(QSharedPointer<X> &&other) Q_DECL_NOTHROW + QSharedPointer &operator=(QSharedPointer<X> &&other) noexcept { QSharedPointer moved(std::move(other)); swap(moved); @@ -368,7 +368,7 @@ public: #endif template <class X> - QSharedPointer(const QSharedPointer<X> &other) Q_DECL_NOTHROW : value(other.value), d(other.d) + QSharedPointer(const QSharedPointer<X> &other) noexcept : value(other.value), d(other.d) { if (d) ref(); } template <class X> @@ -456,9 +456,9 @@ public: private: explicit QSharedPointer(Qt::Initialization) {} - void deref() Q_DECL_NOTHROW + void deref() noexcept { deref(d); } - static void deref(Data *dd) Q_DECL_NOTHROW + static void deref(Data *dd) noexcept { if (!dd) return; if (!dd->strongref.deref()) { @@ -499,7 +499,7 @@ private: enableSharedFromThis(ptr); } - void internalSwap(QSharedPointer &other) Q_DECL_NOTHROW + void internalSwap(QSharedPointer &other) noexcept { qSwap(d, other.d); qSwap(this->value, other.value); @@ -512,7 +512,7 @@ public: template <class X> friend class QWeakPointer; template <class X, class Y> friend QSharedPointer<X> QtSharedPointer::copyAndSetPointer(X * ptr, const QSharedPointer<Y> &src); #endif - void ref() const Q_DECL_NOTHROW { d->weakref.ref(); d->strongref.ref(); } + void ref() const noexcept { d->weakref.ref(); d->strongref.ref(); } inline void internalSet(Data *o, T *actual) { @@ -563,12 +563,12 @@ public: typedef const value_type &const_reference; typedef qptrdiff difference_type; - bool isNull() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 || value == nullptr; } - operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QWeakPointer::value; } - bool operator !() const Q_DECL_NOTHROW { return isNull(); } - T *data() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 ? nullptr : value; } + bool isNull() const noexcept { return d == nullptr || d->strongref.load() == 0 || value == nullptr; } + operator RestrictedBool() const noexcept { return isNull() ? nullptr : &QWeakPointer::value; } + bool operator !() const noexcept { return isNull(); } + T *data() const noexcept { return d == nullptr || d->strongref.load() == 0 ? nullptr : value; } - inline QWeakPointer() Q_DECL_NOTHROW : d(nullptr), value(nullptr) { } + inline QWeakPointer() noexcept : d(nullptr), value(nullptr) { } inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; } #ifndef QT_NO_QOBJECT @@ -586,26 +586,26 @@ public: { return *this = QWeakPointer(ptr); } #endif - QWeakPointer(const QWeakPointer &other) Q_DECL_NOTHROW : d(other.d), value(other.value) + QWeakPointer(const QWeakPointer &other) noexcept : d(other.d), value(other.value) { if (d) d->weakref.ref(); } #ifdef Q_COMPILER_RVALUE_REFS - QWeakPointer(QWeakPointer &&other) Q_DECL_NOTHROW + QWeakPointer(QWeakPointer &&other) noexcept : d(other.d), value(other.value) { other.d = nullptr; other.value = nullptr; } - QWeakPointer &operator=(QWeakPointer &&other) Q_DECL_NOTHROW + QWeakPointer &operator=(QWeakPointer &&other) noexcept { QWeakPointer moved(std::move(other)); swap(moved); return *this; } #endif - QWeakPointer &operator=(const QWeakPointer &other) Q_DECL_NOTHROW + QWeakPointer &operator=(const QWeakPointer &other) noexcept { QWeakPointer copy(other); swap(copy); return *this; } - void swap(QWeakPointer &other) Q_DECL_NOTHROW + void swap(QWeakPointer &other) noexcept { qSwap(this->d, other.d); qSwap(this->value, other.value); @@ -633,11 +633,11 @@ public: } template <class X> - bool operator==(const QWeakPointer<X> &o) const Q_DECL_NOTHROW + bool operator==(const QWeakPointer<X> &o) const noexcept { return d == o.d && value == static_cast<const T *>(o.value); } template <class X> - bool operator!=(const QWeakPointer<X> &o) const Q_DECL_NOTHROW + bool operator!=(const QWeakPointer<X> &o) const noexcept { return !(*this == o); } template <class X> @@ -653,11 +653,11 @@ public: } template <class X> - bool operator==(const QSharedPointer<X> &o) const Q_DECL_NOTHROW + bool operator==(const QSharedPointer<X> &o) const noexcept { return d == o.d; } template <class X> - bool operator!=(const QSharedPointer<X> &o) const Q_DECL_NOTHROW + bool operator!=(const QSharedPointer<X> &o) const noexcept { return !(*this == o); } inline void clear() { *this = QWeakPointer(); } @@ -739,92 +739,92 @@ public: // operator== and operator!= // template <class T, class X> -bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW +bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) noexcept { return ptr1.data() == ptr2.data(); } template <class T, class X> -bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW +bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) noexcept { return ptr1.data() != ptr2.data(); } template <class T, class X> -bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2) Q_DECL_NOTHROW +bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2) noexcept { return ptr1.data() == ptr2; } template <class T, class X> -bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW +bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2) noexcept { return ptr1 == ptr2.data(); } template <class T, class X> -bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2) Q_DECL_NOTHROW +bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2) noexcept { return !(ptr1 == ptr2); } template <class T, class X> -bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2) Q_DECL_NOTHROW +bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2) noexcept { return !(ptr2 == ptr1); } template <class T, class X> -bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) Q_DECL_NOTHROW +bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) noexcept { return ptr2 == ptr1; } template <class T, class X> -bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) Q_DECL_NOTHROW +bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2) noexcept { return ptr2 != ptr1; } template<class T> -inline bool operator==(const QSharedPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator==(const QSharedPointer<T> &lhs, std::nullptr_t) noexcept { return lhs.isNull(); } template<class T> -inline bool operator!=(const QSharedPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator!=(const QSharedPointer<T> &lhs, std::nullptr_t) noexcept { return !lhs.isNull(); } template<class T> -inline bool operator==(std::nullptr_t, const QSharedPointer<T> &rhs) Q_DECL_NOTHROW +inline bool operator==(std::nullptr_t, const QSharedPointer<T> &rhs) noexcept { return rhs.isNull(); } template<class T> -inline bool operator!=(std::nullptr_t, const QSharedPointer<T> &rhs) Q_DECL_NOTHROW +inline bool operator!=(std::nullptr_t, const QSharedPointer<T> &rhs) noexcept { return !rhs.isNull(); } template<class T> -inline bool operator==(const QWeakPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator==(const QWeakPointer<T> &lhs, std::nullptr_t) noexcept { return lhs.isNull(); } template<class T> -inline bool operator!=(const QWeakPointer<T> &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator!=(const QWeakPointer<T> &lhs, std::nullptr_t) noexcept { return !lhs.isNull(); } template<class T> -inline bool operator==(std::nullptr_t, const QWeakPointer<T> &rhs) Q_DECL_NOTHROW +inline bool operator==(std::nullptr_t, const QWeakPointer<T> &rhs) noexcept { return rhs.isNull(); } template<class T> -inline bool operator!=(std::nullptr_t, const QWeakPointer<T> &rhs) Q_DECL_NOTHROW +inline bool operator!=(std::nullptr_t, const QWeakPointer<T> &rhs) noexcept { return !rhs.isNull(); } diff --git a/src/corelib/tools/qsize.cpp b/src/corelib/tools/qsize.cpp index 3e97947ad2..fe508ad459 100644 --- a/src/corelib/tools/qsize.cpp +++ b/src/corelib/tools/qsize.cpp @@ -163,7 +163,7 @@ QT_BEGIN_NAMESPACE \sa setWidth(), setHeight(), transposed() */ -void QSize::transpose() Q_DECL_NOTHROW +void QSize::transpose() noexcept { qSwap(wd, ht); } @@ -222,7 +222,7 @@ void QSize::transpose() Q_DECL_NOTHROW Return a size scaled to a rectangle with the given size \a s, according to the specified \a mode. */ -QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW +QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept { if (mode == Qt::IgnoreAspectRatio || wd == 0 || ht == 0) { return s; @@ -594,7 +594,7 @@ QDebug operator<<(QDebug dbg, const QSize &s) \sa setWidth(), setHeight(), transposed() */ -void QSizeF::transpose() Q_DECL_NOTHROW +void QSizeF::transpose() noexcept { qSwap(wd, ht); } @@ -653,7 +653,7 @@ void QSizeF::transpose() Q_DECL_NOTHROW Returns a size scaled to a rectangle with the given size \a s, according to the specified \a mode. */ -QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW +QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept { if (mode == Qt::IgnoreAspectRatio || qIsNull(wd) || qIsNull(ht)) { return s; diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h index bb29dca7c4..4114609856 100644 --- a/src/corelib/tools/qsize.h +++ b/src/corelib/tools/qsize.h @@ -52,46 +52,46 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QSize { public: - Q_DECL_CONSTEXPR QSize() Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QSize(int w, int h) Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline bool isNull() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isEmpty() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline int width() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline int height() const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) Q_DECL_NOTHROW; - void transpose() Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize transposed() const Q_DECL_NOTHROW; - - inline void scale(int w, int h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; - inline void scale(const QSize &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QSize scaled(int w, int h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; - - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize expandedTo(const QSize &) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize boundedTo(const QSize &) const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline int &rwidth() Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline int &rheight() Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline QSize &operator+=(const QSize &) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QSize &operator-=(const QSize &) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QSize &operator*=(qreal c) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QSize() noexcept; + Q_DECL_CONSTEXPR QSize(int w, int h) noexcept; + + Q_DECL_CONSTEXPR inline bool isNull() const noexcept; + Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept; + Q_DECL_CONSTEXPR inline bool isValid() const noexcept; + + Q_DECL_CONSTEXPR inline int width() const noexcept; + Q_DECL_CONSTEXPR inline int height() const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) noexcept; + void transpose() noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize transposed() const noexcept; + + inline void scale(int w, int h, Qt::AspectRatioMode mode) noexcept; + inline void scale(const QSize &s, Qt::AspectRatioMode mode) noexcept; + Q_REQUIRED_RESULT QSize scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept; + Q_REQUIRED_RESULT QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept; + + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize expandedTo(const QSize &) const noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSize boundedTo(const QSize &) const noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline int &rwidth() noexcept; + Q_DECL_RELAXED_CONSTEXPR inline int &rheight() noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline QSize &operator+=(const QSize &) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QSize &operator-=(const QSize &) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QSize &operator*=(qreal c) noexcept; inline QSize &operator/=(qreal c); - friend inline Q_DECL_CONSTEXPR bool operator==(const QSize &, const QSize &) Q_DECL_NOTHROW; - friend inline Q_DECL_CONSTEXPR bool operator!=(const QSize &, const QSize &) Q_DECL_NOTHROW; - friend inline Q_DECL_CONSTEXPR const QSize operator+(const QSize &, const QSize &) Q_DECL_NOTHROW; - friend inline Q_DECL_CONSTEXPR const QSize operator-(const QSize &, const QSize &) Q_DECL_NOTHROW; - friend inline Q_DECL_CONSTEXPR const QSize operator*(const QSize &, qreal) Q_DECL_NOTHROW; - friend inline Q_DECL_CONSTEXPR const QSize operator*(qreal, const QSize &) Q_DECL_NOTHROW; + friend inline Q_DECL_CONSTEXPR bool operator==(const QSize &, const QSize &) noexcept; + friend inline Q_DECL_CONSTEXPR bool operator!=(const QSize &, const QSize &) noexcept; + friend inline Q_DECL_CONSTEXPR const QSize operator+(const QSize &, const QSize &) noexcept; + friend inline Q_DECL_CONSTEXPR const QSize operator-(const QSize &, const QSize &) noexcept; + friend inline Q_DECL_CONSTEXPR const QSize operator*(const QSize &, qreal) noexcept; + friend inline Q_DECL_CONSTEXPR const QSize operator*(qreal, const QSize &) noexcept; friend inline const QSize operator/(const QSize &, qreal); #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - Q_REQUIRED_RESULT CGSize toCGSize() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT CGSize toCGSize() const noexcept; #endif private: @@ -114,74 +114,74 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSize &); QSize inline functions *****************************************************************************/ -Q_DECL_CONSTEXPR inline QSize::QSize() Q_DECL_NOTHROW : wd(-1), ht(-1) {} +Q_DECL_CONSTEXPR inline QSize::QSize() noexcept : wd(-1), ht(-1) {} -Q_DECL_CONSTEXPR inline QSize::QSize(int w, int h) Q_DECL_NOTHROW : wd(w), ht(h) {} +Q_DECL_CONSTEXPR inline QSize::QSize(int w, int h) noexcept : wd(w), ht(h) {} -Q_DECL_CONSTEXPR inline bool QSize::isNull() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QSize::isNull() const noexcept { return wd==0 && ht==0; } -Q_DECL_CONSTEXPR inline bool QSize::isEmpty() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QSize::isEmpty() const noexcept { return wd<1 || ht<1; } -Q_DECL_CONSTEXPR inline bool QSize::isValid() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QSize::isValid() const noexcept { return wd>=0 && ht>=0; } -Q_DECL_CONSTEXPR inline int QSize::width() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QSize::width() const noexcept { return wd; } -Q_DECL_CONSTEXPR inline int QSize::height() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int QSize::height() const noexcept { return ht; } -Q_DECL_RELAXED_CONSTEXPR inline void QSize::setWidth(int w) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QSize::setWidth(int w) noexcept { wd = w; } -Q_DECL_RELAXED_CONSTEXPR inline void QSize::setHeight(int h) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QSize::setHeight(int h) noexcept { ht = h; } -Q_DECL_CONSTEXPR inline QSize QSize::transposed() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSize QSize::transposed() const noexcept { return QSize(ht, wd); } -inline void QSize::scale(int w, int h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW +inline void QSize::scale(int w, int h, Qt::AspectRatioMode mode) noexcept { scale(QSize(w, h), mode); } -inline void QSize::scale(const QSize &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW +inline void QSize::scale(const QSize &s, Qt::AspectRatioMode mode) noexcept { *this = scaled(s, mode); } -inline QSize QSize::scaled(int w, int h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW +inline QSize QSize::scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept { return scaled(QSize(w, h), mode); } -Q_DECL_RELAXED_CONSTEXPR inline int &QSize::rwidth() Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline int &QSize::rwidth() noexcept { return wd; } -Q_DECL_RELAXED_CONSTEXPR inline int &QSize::rheight() Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline int &QSize::rheight() noexcept { return ht; } -Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator+=(const QSize &s) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator+=(const QSize &s) noexcept { wd+=s.wd; ht+=s.ht; return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator-=(const QSize &s) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator-=(const QSize &s) noexcept { wd-=s.wd; ht-=s.ht; return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator*=(qreal c) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QSize &QSize::operator*=(qreal c) noexcept { wd = qRound(wd*c); ht = qRound(ht*c); return *this; } -Q_DECL_CONSTEXPR inline bool operator==(const QSize &s1, const QSize &s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(const QSize &s1, const QSize &s2) noexcept { return s1.wd == s2.wd && s1.ht == s2.ht; } -Q_DECL_CONSTEXPR inline bool operator!=(const QSize &s1, const QSize &s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(const QSize &s1, const QSize &s2) noexcept { return s1.wd != s2.wd || s1.ht != s2.ht; } -Q_DECL_CONSTEXPR inline const QSize operator+(const QSize & s1, const QSize & s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSize operator+(const QSize & s1, const QSize & s2) noexcept { return QSize(s1.wd+s2.wd, s1.ht+s2.ht); } -Q_DECL_CONSTEXPR inline const QSize operator-(const QSize &s1, const QSize &s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSize operator-(const QSize &s1, const QSize &s2) noexcept { return QSize(s1.wd-s2.wd, s1.ht-s2.ht); } -Q_DECL_CONSTEXPR inline const QSize operator*(const QSize &s, qreal c) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSize operator*(const QSize &s, qreal c) noexcept { return QSize(qRound(s.wd*c), qRound(s.ht*c)); } -Q_DECL_CONSTEXPR inline const QSize operator*(qreal c, const QSize &s) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSize operator*(qreal c, const QSize &s) noexcept { return QSize(qRound(s.wd*c), qRound(s.ht*c)); } inline QSize &QSize::operator/=(qreal c) @@ -197,12 +197,12 @@ inline const QSize operator/(const QSize &s, qreal c) return QSize(qRound(s.wd/c), qRound(s.ht/c)); } -Q_DECL_CONSTEXPR inline QSize QSize::expandedTo(const QSize & otherSize) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSize QSize::expandedTo(const QSize & otherSize) const noexcept { return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); } -Q_DECL_CONSTEXPR inline QSize QSize::boundedTo(const QSize & otherSize) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSize QSize::boundedTo(const QSize & otherSize) const noexcept { return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); } @@ -215,50 +215,50 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QSize &); class Q_CORE_EXPORT QSizeF { public: - Q_DECL_CONSTEXPR QSizeF() Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QSizeF(const QSize &sz) Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR QSizeF(qreal w, qreal h) Q_DECL_NOTHROW; - - inline bool isNull() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isEmpty() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW; - - Q_DECL_CONSTEXPR inline qreal width() const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline qreal height() const Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) Q_DECL_NOTHROW; - void transpose() Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF transposed() const Q_DECL_NOTHROW; - - inline void scale(qreal w, qreal h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; - inline void scale(const QSizeF &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; - - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF expandedTo(const QSizeF &) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF boundedTo(const QSizeF &) const Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline qreal &rwidth() Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline qreal &rheight() Q_DECL_NOTHROW; - - Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator+=(const QSizeF &) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator-=(const QSizeF &) Q_DECL_NOTHROW; - Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator*=(qreal c) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QSizeF() noexcept; + Q_DECL_CONSTEXPR QSizeF(const QSize &sz) noexcept; + Q_DECL_CONSTEXPR QSizeF(qreal w, qreal h) noexcept; + + inline bool isNull() const noexcept; + Q_DECL_CONSTEXPR inline bool isEmpty() const noexcept; + Q_DECL_CONSTEXPR inline bool isValid() const noexcept; + + Q_DECL_CONSTEXPR inline qreal width() const noexcept; + Q_DECL_CONSTEXPR inline qreal height() const noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) noexcept; + void transpose() noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF transposed() const noexcept; + + inline void scale(qreal w, qreal h, Qt::AspectRatioMode mode) noexcept; + inline void scale(const QSizeF &s, Qt::AspectRatioMode mode) noexcept; + Q_REQUIRED_RESULT QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept; + Q_REQUIRED_RESULT QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept; + + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF expandedTo(const QSizeF &) const noexcept; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QSizeF boundedTo(const QSizeF &) const noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline qreal &rwidth() noexcept; + Q_DECL_RELAXED_CONSTEXPR inline qreal &rheight() noexcept; + + Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator+=(const QSizeF &) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator-=(const QSizeF &) noexcept; + Q_DECL_RELAXED_CONSTEXPR inline QSizeF &operator*=(qreal c) noexcept; inline QSizeF &operator/=(qreal c); - friend Q_DECL_CONSTEXPR inline bool operator==(const QSizeF &, const QSizeF &) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline bool operator!=(const QSizeF &, const QSizeF &) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline const QSizeF operator+(const QSizeF &, const QSizeF &) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline const QSizeF operator-(const QSizeF &, const QSizeF &) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline const QSizeF operator*(const QSizeF &, qreal) Q_DECL_NOTHROW; - friend Q_DECL_CONSTEXPR inline const QSizeF operator*(qreal, const QSizeF &) Q_DECL_NOTHROW; + friend Q_DECL_CONSTEXPR inline bool operator==(const QSizeF &, const QSizeF &) noexcept; + friend Q_DECL_CONSTEXPR inline bool operator!=(const QSizeF &, const QSizeF &) noexcept; + friend Q_DECL_CONSTEXPR inline const QSizeF operator+(const QSizeF &, const QSizeF &) noexcept; + friend Q_DECL_CONSTEXPR inline const QSizeF operator-(const QSizeF &, const QSizeF &) noexcept; + friend Q_DECL_CONSTEXPR inline const QSizeF operator*(const QSizeF &, qreal) noexcept; + friend Q_DECL_CONSTEXPR inline const QSizeF operator*(qreal, const QSizeF &) noexcept; friend inline const QSizeF operator/(const QSizeF &, qreal); - Q_DECL_CONSTEXPR inline QSize toSize() const Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR inline QSize toSize() const noexcept; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - Q_REQUIRED_RESULT static QSizeF fromCGSize(CGSize size) Q_DECL_NOTHROW; - Q_REQUIRED_RESULT CGSize toCGSize() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT static QSizeF fromCGSize(CGSize size) noexcept; + Q_REQUIRED_RESULT CGSize toCGSize() const noexcept; #endif private: @@ -282,76 +282,76 @@ Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSizeF &); QSizeF inline functions *****************************************************************************/ -Q_DECL_CONSTEXPR inline QSizeF::QSizeF() Q_DECL_NOTHROW : wd(-1.), ht(-1.) {} +Q_DECL_CONSTEXPR inline QSizeF::QSizeF() noexcept : wd(-1.), ht(-1.) {} -Q_DECL_CONSTEXPR inline QSizeF::QSizeF(const QSize &sz) Q_DECL_NOTHROW : wd(sz.width()), ht(sz.height()) {} +Q_DECL_CONSTEXPR inline QSizeF::QSizeF(const QSize &sz) noexcept : wd(sz.width()), ht(sz.height()) {} -Q_DECL_CONSTEXPR inline QSizeF::QSizeF(qreal w, qreal h) Q_DECL_NOTHROW : wd(w), ht(h) {} +Q_DECL_CONSTEXPR inline QSizeF::QSizeF(qreal w, qreal h) noexcept : wd(w), ht(h) {} -inline bool QSizeF::isNull() const Q_DECL_NOTHROW +inline bool QSizeF::isNull() const noexcept { return qIsNull(wd) && qIsNull(ht); } -Q_DECL_CONSTEXPR inline bool QSizeF::isEmpty() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QSizeF::isEmpty() const noexcept { return wd <= 0. || ht <= 0.; } -Q_DECL_CONSTEXPR inline bool QSizeF::isValid() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool QSizeF::isValid() const noexcept { return wd >= 0. && ht >= 0.; } -Q_DECL_CONSTEXPR inline qreal QSizeF::width() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QSizeF::width() const noexcept { return wd; } -Q_DECL_CONSTEXPR inline qreal QSizeF::height() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline qreal QSizeF::height() const noexcept { return ht; } -Q_DECL_RELAXED_CONSTEXPR inline void QSizeF::setWidth(qreal w) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QSizeF::setWidth(qreal w) noexcept { wd = w; } -Q_DECL_RELAXED_CONSTEXPR inline void QSizeF::setHeight(qreal h) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline void QSizeF::setHeight(qreal h) noexcept { ht = h; } -Q_DECL_CONSTEXPR inline QSizeF QSizeF::transposed() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSizeF QSizeF::transposed() const noexcept { return QSizeF(ht, wd); } -inline void QSizeF::scale(qreal w, qreal h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW +inline void QSizeF::scale(qreal w, qreal h, Qt::AspectRatioMode mode) noexcept { scale(QSizeF(w, h), mode); } -inline void QSizeF::scale(const QSizeF &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW +inline void QSizeF::scale(const QSizeF &s, Qt::AspectRatioMode mode) noexcept { *this = scaled(s, mode); } -inline QSizeF QSizeF::scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW +inline QSizeF QSizeF::scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const noexcept { return scaled(QSizeF(w, h), mode); } -Q_DECL_RELAXED_CONSTEXPR inline qreal &QSizeF::rwidth() Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline qreal &QSizeF::rwidth() noexcept { return wd; } -Q_DECL_RELAXED_CONSTEXPR inline qreal &QSizeF::rheight() Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline qreal &QSizeF::rheight() noexcept { return ht; } -Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator+=(const QSizeF &s) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator+=(const QSizeF &s) noexcept { wd += s.wd; ht += s.ht; return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator-=(const QSizeF &s) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator-=(const QSizeF &s) noexcept { wd -= s.wd; ht -= s.ht; return *this; } -Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator*=(qreal c) Q_DECL_NOTHROW +Q_DECL_RELAXED_CONSTEXPR inline QSizeF &QSizeF::operator*=(qreal c) noexcept { wd *= c; ht *= c; return *this; } -Q_DECL_CONSTEXPR inline bool operator==(const QSizeF &s1, const QSizeF &s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(const QSizeF &s1, const QSizeF &s2) noexcept { return qFuzzyCompare(s1.wd, s2.wd) && qFuzzyCompare(s1.ht, s2.ht); } -Q_DECL_CONSTEXPR inline bool operator!=(const QSizeF &s1, const QSizeF &s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(const QSizeF &s1, const QSizeF &s2) noexcept { return !qFuzzyCompare(s1.wd, s2.wd) || !qFuzzyCompare(s1.ht, s2.ht); } -Q_DECL_CONSTEXPR inline const QSizeF operator+(const QSizeF & s1, const QSizeF & s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSizeF operator+(const QSizeF & s1, const QSizeF & s2) noexcept { return QSizeF(s1.wd+s2.wd, s1.ht+s2.ht); } -Q_DECL_CONSTEXPR inline const QSizeF operator-(const QSizeF &s1, const QSizeF &s2) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSizeF operator-(const QSizeF &s1, const QSizeF &s2) noexcept { return QSizeF(s1.wd-s2.wd, s1.ht-s2.ht); } -Q_DECL_CONSTEXPR inline const QSizeF operator*(const QSizeF &s, qreal c) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSizeF operator*(const QSizeF &s, qreal c) noexcept { return QSizeF(s.wd*c, s.ht*c); } -Q_DECL_CONSTEXPR inline const QSizeF operator*(qreal c, const QSizeF &s) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline const QSizeF operator*(qreal c, const QSizeF &s) noexcept { return QSizeF(s.wd*c, s.ht*c); } inline QSizeF &QSizeF::operator/=(qreal c) @@ -367,17 +367,17 @@ inline const QSizeF operator/(const QSizeF &s, qreal c) return QSizeF(s.wd/c, s.ht/c); } -Q_DECL_CONSTEXPR inline QSizeF QSizeF::expandedTo(const QSizeF & otherSize) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSizeF QSizeF::expandedTo(const QSizeF & otherSize) const noexcept { return QSizeF(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); } -Q_DECL_CONSTEXPR inline QSizeF QSizeF::boundedTo(const QSizeF & otherSize) const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSizeF QSizeF::boundedTo(const QSizeF & otherSize) const noexcept { return QSizeF(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); } -Q_DECL_CONSTEXPR inline QSize QSizeF::toSize() const Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline QSize QSizeF::toSize() const noexcept { return QSize(qRound(wd), qRound(ht)); } diff --git a/src/corelib/tools/qstack.h b/src/corelib/tools/qstack.h index bf04935b50..e59212aa2a 100644 --- a/src/corelib/tools/qstack.h +++ b/src/corelib/tools/qstack.h @@ -50,7 +50,7 @@ class QStack : public QVector<T> { public: // compiler-generated special member functions are fine! - inline void swap(QStack<T> &other) Q_DECL_NOTHROW { QVector<T>::swap(other); } // prevent QVector<->QStack swaps + inline void swap(QStack<T> &other) noexcept { QVector<T>::swap(other); } // prevent QVector<->QStack swaps inline void push(const T &t) { QVector<T>::append(t); } T pop(); T &top(); diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 65519d1f98..74debd8cfa 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -155,7 +155,7 @@ static inline bool qt_ends_with(QStringView haystack, QStringView needle, Qt::Ca static inline bool qt_ends_with(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs); static inline bool qt_ends_with(QStringView haystack, QChar needle, Qt::CaseSensitivity cs); -qsizetype QtPrivate::qustrlen(const ushort *str) Q_DECL_NOTHROW +qsizetype QtPrivate::qustrlen(const ushort *str) noexcept { qsizetype result = 0; @@ -453,7 +453,7 @@ static Q_ALWAYS_INLINE __m128i mm_load8_zero_extend(const void *ptr) // Note: ptr on output may be off by one and point to a preceding US-ASCII // character. Usually harmless. -bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW +bool qt_is_ascii(const char *&ptr, const char *end) noexcept { #if defined(__SSE2__) // Testing for the high bit can be done efficiently with just PMOVMSKB @@ -509,7 +509,7 @@ bool qt_is_ascii(const char *&ptr, const char *end) Q_DECL_NOTHROW return true; } -bool QtPrivate::isAscii(QLatin1String s) Q_DECL_NOTHROW +bool QtPrivate::isAscii(QLatin1String s) noexcept { const char *ptr = s.begin(); const char *end = s.end(); @@ -536,7 +536,7 @@ static bool isAscii(const QChar *&ptr, const QChar *end) return true; } -bool QtPrivate::isAscii(QStringView s) Q_DECL_NOTHROW +bool QtPrivate::isAscii(QStringView s) noexcept { const QChar *ptr = s.begin(); const QChar *end = s.end(); @@ -544,7 +544,7 @@ bool QtPrivate::isAscii(QStringView s) Q_DECL_NOTHROW return isAscii(ptr, end); } -bool QtPrivate::isLatin1(QStringView s) Q_DECL_NOTHROW +bool QtPrivate::isLatin1(QStringView s) noexcept { const QChar *ptr = s.begin(); const QChar *end = s.end(); @@ -584,7 +584,7 @@ bool QtPrivate::isLatin1(QStringView s) Q_DECL_NOTHROW } // conversion between Latin 1 and UTF-16 -void qt_from_latin1(ushort *dst, const char *str, size_t size) Q_DECL_NOTHROW +void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept { /* SIMD: * Unpacking with SSE has been shown to improve performance on recent CPUs @@ -1141,7 +1141,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, size_t l) } template <typename Number> -Q_DECL_CONSTEXPR int lencmp(Number lhs, Number rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR int lencmp(Number lhs, Number rhs) noexcept { return lhs == rhs ? 0 : lhs > rhs ? 1 : @@ -1165,7 +1165,7 @@ static int ucstrcmp(const QChar *a, size_t alen, const char *b, size_t blen) return cmp ? cmp : lencmp(alen, blen); } -static int qt_compare_strings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +static int qt_compare_strings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs) noexcept { if (cs == Qt::CaseSensitive) return ucstrcmp(lhs.begin(), lhs.size(), rhs.begin(), rhs.size()); @@ -1173,7 +1173,7 @@ static int qt_compare_strings(QStringView lhs, QStringView rhs, Qt::CaseSensitiv return ucstricmp(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } -static int qt_compare_strings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +static int qt_compare_strings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept { if (cs == Qt::CaseSensitive) return ucstrcmp(lhs.begin(), lhs.size(), rhs.begin(), rhs.size()); @@ -1181,12 +1181,12 @@ static int qt_compare_strings(QStringView lhs, QLatin1String rhs, Qt::CaseSensit return ucstricmp(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } -static int qt_compare_strings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +static int qt_compare_strings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs) noexcept { return -qt_compare_strings(rhs, lhs, cs); } -static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept { if (cs == Qt::CaseInsensitive) return qstrnicmp(lhs.data(), lhs.size(), rhs.data(), rhs.size()); @@ -1211,7 +1211,7 @@ static int qt_compare_strings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSens of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with QString::localeAwareCompare(). */ -int QtPrivate::compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +int QtPrivate::compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs) noexcept { return qt_compare_strings(lhs, rhs, cs); } @@ -1231,7 +1231,7 @@ int QtPrivate::compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitiv of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with QString::localeAwareCompare(). */ -int QtPrivate::compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +int QtPrivate::compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept { return qt_compare_strings(lhs, rhs, cs); } @@ -1251,7 +1251,7 @@ int QtPrivate::compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensit of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with QString::localeAwareCompare(). */ -int QtPrivate::compareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +int QtPrivate::compareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs) noexcept { return qt_compare_strings(lhs, rhs, cs); } @@ -1271,7 +1271,7 @@ int QtPrivate::compareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensit of the characters and is very fast, but is not what a human would expect. Consider sorting user-visible strings with QString::localeAwareCompare(). */ -int QtPrivate::compareStrings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +int QtPrivate::compareStrings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept { return qt_compare_strings(lhs, rhs, cs); } @@ -2367,7 +2367,7 @@ void QString::expand(int i) string. */ -QString &QString::operator=(const QString &other) Q_DECL_NOTHROW +QString &QString::operator=(const QString &other) noexcept { other.d->ref.ref(); if (!d->ref.deref()) @@ -3353,7 +3353,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs) expect. Consider sorting user-interface strings with localeAwareCompare(). */ -bool operator==(const QString &s1, const QString &s2) Q_DECL_NOTHROW +bool operator==(const QString &s1, const QString &s2) noexcept { if (s1.d->size != s2.d->size) return false; @@ -3366,7 +3366,7 @@ bool operator==(const QString &s1, const QString &s2) Q_DECL_NOTHROW Returns \c true if this string is equal to \a other; otherwise returns \c false. */ -bool QString::operator==(QLatin1String other) const Q_DECL_NOTHROW +bool QString::operator==(QLatin1String other) const noexcept { if (d->size != other.size()) return false; @@ -3418,7 +3418,7 @@ bool QString::operator==(QLatin1String other) const Q_DECL_NOTHROW expect. Consider sorting user-interface strings using the QString::localeAwareCompare() function. */ -bool operator<(const QString &s1, const QString &s2) Q_DECL_NOTHROW +bool operator<(const QString &s1, const QString &s2) noexcept { return qt_compare_strings(s1, s2, Qt::CaseSensitive) < 0; } @@ -3429,7 +3429,7 @@ bool operator<(const QString &s1, const QString &s2) Q_DECL_NOTHROW Returns \c true if this string is lexically less than the parameter string called \a other; otherwise returns \c false. */ -bool QString::operator<(QLatin1String other) const Q_DECL_NOTHROW +bool QString::operator<(QLatin1String other) const noexcept { return qt_compare_strings(*this, other, Qt::CaseSensitive) < 0; } @@ -3538,7 +3538,7 @@ bool QString::operator<(QLatin1String other) const Q_DECL_NOTHROW Returns \c true if this string is lexically greater than the parameter string \a other; otherwise returns \c false. */ -bool QString::operator>(QLatin1String other) const Q_DECL_NOTHROW +bool QString::operator>(QLatin1String other) const noexcept { return qt_compare_strings(*this, other, Qt::CaseSensitive) > 0; } @@ -5668,7 +5668,7 @@ QString QString::simplified_helper(QString &str) namespace { template <typename StringView> - StringView qt_trimmed(StringView s) Q_DECL_NOTHROW + StringView qt_trimmed(StringView s) noexcept { auto begin = s.begin(); auto end = s.end(); @@ -5692,12 +5692,12 @@ namespace { \sa QString::trimmed(), QStringView::trimmed(), QLatin1String::trimmed() */ -QStringView QtPrivate::trimmed(QStringView s) Q_DECL_NOTHROW +QStringView QtPrivate::trimmed(QStringView s) noexcept { return qt_trimmed(s); } -QLatin1String QtPrivate::trimmed(QLatin1String s) Q_DECL_NOTHROW +QLatin1String QtPrivate::trimmed(QLatin1String s) noexcept { return qt_trimmed(s); } @@ -6235,7 +6235,7 @@ QString& QString::fill(QChar ch, int size) Same as compare(*this, \a other, \a cs). */ -int QString::compare(const QString &other, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +int QString::compare(const QString &other, Qt::CaseSensitivity cs) const noexcept { return qt_compare_strings(*this, other, cs); } @@ -6246,7 +6246,7 @@ int QString::compare(const QString &other, Qt::CaseSensitivity cs) const Q_DECL_ \since 4.5 */ int QString::compare_helper(const QChar *data1, int length1, const QChar *data2, int length2, - Qt::CaseSensitivity cs) Q_DECL_NOTHROW + Qt::CaseSensitivity cs) noexcept { Q_ASSERT(length1 >= 0); Q_ASSERT(length2 >= 0); @@ -6261,7 +6261,7 @@ int QString::compare_helper(const QChar *data1, int length1, const QChar *data2, Same as compare(*this, \a other, \a cs). */ -int QString::compare(QLatin1String other, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +int QString::compare(QLatin1String other, Qt::CaseSensitivity cs) const noexcept { return qt_compare_strings(*this, other, cs); } @@ -6307,7 +6307,7 @@ int QString::compare_helper(const QChar *data1, int length1, const char *data2, \since 4.5 */ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, - Qt::CaseSensitivity cs) Q_DECL_NOTHROW + Qt::CaseSensitivity cs) noexcept { Q_ASSERT(length1 >= 0); Q_ASSERT(data1 || length1 == 0); @@ -6801,7 +6801,7 @@ static void append_utf8(QString &qs, const char *cs, int len) qs.resize(newEnd - qs.constData()); } -static uint parse_flag_characters(const char * &c) Q_DECL_NOTHROW +static uint parse_flag_characters(const char * &c) noexcept { uint flags = QLocaleData::ZeroPadExponent; while (true) { @@ -6838,7 +6838,7 @@ static int parse_field_width(const char * &c) enum LengthMod { lm_none, lm_hh, lm_h, lm_l, lm_ll, lm_L, lm_j, lm_z, lm_t }; -static inline bool can_consume(const char * &c, char ch) Q_DECL_NOTHROW +static inline bool can_consume(const char * &c, char ch) noexcept { if (*c == ch) { ++c; @@ -6847,7 +6847,7 @@ static inline bool can_consume(const char * &c, char ch) Q_DECL_NOTHROW return false; } -static LengthMod parse_length_modifier(const char * &c) Q_DECL_NOTHROW +static LengthMod parse_length_modifier(const char * &c) noexcept { switch (*c++) { case 'h': return can_consume(c, 'h') ? lm_hh : lm_h; @@ -8810,7 +8810,7 @@ namespace { struct Part { Part() : stringRef(), number(0) {} - Part(const QString &s, int pos, int len, int num = -1) Q_DECL_NOTHROW + Part(const QString &s, int pos, int len, int num = -1) noexcept : stringRef(&s, pos, len), number(num) {} QStringRef stringRef; @@ -10379,7 +10379,7 @@ QString QStringRef::toString() const { Returns \c true if string reference \a s1 is lexically equal to string reference \a s2; otherwise returns \c false. */ -bool operator==(const QStringRef &s1,const QStringRef &s2) Q_DECL_NOTHROW +bool operator==(const QStringRef &s1,const QStringRef &s2) noexcept { return s1.size() == s2.size() && qt_compare_strings(s1, s2, Qt::CaseSensitive) == 0; } @@ -10389,7 +10389,7 @@ bool operator==(const QStringRef &s1,const QStringRef &s2) Q_DECL_NOTHROW Returns \c true if string \a s1 is lexically equal to string reference \a s2; otherwise returns \c false. */ -bool operator==(const QString &s1,const QStringRef &s2) Q_DECL_NOTHROW +bool operator==(const QString &s1,const QStringRef &s2) noexcept { return s1.size() == s2.size() && qt_compare_strings(s1, s2, Qt::CaseSensitive) == 0; } @@ -10399,7 +10399,7 @@ bool operator==(const QString &s1,const QStringRef &s2) Q_DECL_NOTHROW Returns \c true if string \a s1 is lexically equal to string reference \a s2; otherwise returns \c false. */ -bool operator==(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW +bool operator==(QLatin1String s1, const QStringRef &s2) noexcept { if (s1.size() != s2.size()) return false; @@ -10418,7 +10418,7 @@ bool operator==(QLatin1String s1, const QStringRef &s2) Q_DECL_NOTHROW expect. Consider sorting user-interface strings using the QString::localeAwareCompare() function. */ -bool operator<(const QStringRef &s1,const QStringRef &s2) Q_DECL_NOTHROW +bool operator<(const QStringRef &s1,const QStringRef &s2) noexcept { return qt_compare_strings(s1, s2, Qt::CaseSensitive) < 0; } @@ -11553,7 +11553,7 @@ static inline qsizetype qt_string_count(QStringView haystack, QChar ch, } template <typename Haystack, typename Needle> -bool qt_starts_with_impl(Haystack haystack, Needle needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool qt_starts_with_impl(Haystack haystack, Needle needle, Qt::CaseSensitivity cs) noexcept { if (haystack.isNull()) return needle.isNull(); // historical behavior, consider changing in ### Qt 6. @@ -11605,28 +11605,28 @@ static inline bool qt_starts_with(QStringView haystack, QChar needle, Qt::CaseSe \sa QtPrivate::endsWith(), QString::endsWith(), QStringView::endsWith(), QLatin1String::endsWith() */ -bool QtPrivate::startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept { return qt_starts_with_impl(haystack, needle, cs); } -bool QtPrivate::startsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::startsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept { return qt_starts_with_impl(haystack, needle, cs); } -bool QtPrivate::startsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::startsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept { return qt_starts_with_impl(haystack, needle, cs); } -bool QtPrivate::startsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::startsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept { return qt_starts_with_impl(haystack, needle, cs); } template <typename Haystack, typename Needle> -bool qt_ends_with_impl(Haystack haystack, Needle needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool qt_ends_with_impl(Haystack haystack, Needle needle, Qt::CaseSensitivity cs) noexcept { if (haystack.isNull()) return needle.isNull(); // historical behavior, consider changing in ### Qt 6. @@ -11678,22 +11678,22 @@ static inline bool qt_ends_with(QStringView haystack, QChar needle, Qt::CaseSens \sa QtPrivate::startsWith(), QString::endsWith(), QStringView::endsWith(), QLatin1String::endsWith() */ -bool QtPrivate::endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept { return qt_ends_with_impl(haystack, needle, cs); } -bool QtPrivate::endsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::endsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept { return qt_ends_with_impl(haystack, needle, cs); } -bool QtPrivate::endsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::endsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept { return qt_ends_with_impl(haystack, needle, cs); } -bool QtPrivate::endsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +bool QtPrivate::endsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept { return qt_ends_with_impl(haystack, needle, cs); } @@ -11707,7 +11707,7 @@ bool QtPrivate::endsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseS position \a from. Returns -1 if \a ch could not be found. */ -qsizetype QtPrivate::findChar(QStringView str, QChar ch, qsizetype from, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +qsizetype QtPrivate::findChar(QStringView str, QChar ch, qsizetype from, Qt::CaseSensitivity cs) noexcept { if (from < 0) from = qMax(from + str.size(), qsizetype(0)); @@ -11731,7 +11731,7 @@ qsizetype QtPrivate::findChar(QStringView str, QChar ch, qsizetype from, Qt::Cas return -1; } -qsizetype QtPrivate::findString(QStringView haystack0, qsizetype from, QStringView needle0, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +qsizetype QtPrivate::findString(QStringView haystack0, qsizetype from, QStringView needle0, Qt::CaseSensitivity cs) noexcept { const qsizetype l = haystack0.size(); const qsizetype sl = needle0.size(); @@ -11806,7 +11806,7 @@ qsizetype QtPrivate::findString(QStringView haystack0, qsizetype from, QStringVi return -1; } -qsizetype QtPrivate::findString(QStringView haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +qsizetype QtPrivate::findString(QStringView haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs) noexcept { if (haystack.size() < needle.size()) return -1; @@ -12271,7 +12271,7 @@ QString QString::toHtmlEscaped() const /*! \internal */ -void QAbstractConcatenable::appendLatin1To(const char *a, int len, QChar *out) Q_DECL_NOTHROW +void QAbstractConcatenable::appendLatin1To(const char *a, int len, QChar *out) noexcept { qt_from_latin1(reinterpret_cast<ushort *>(out), a, uint(len)); } diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index e9a205dfdf..a526a6537a 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -91,19 +91,19 @@ template <typename T> class QVector; class QLatin1String { public: - Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(nullptr) {} - Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) Q_DECL_NOTHROW : m_size(s ? int(strlen(s)) : 0), m_data(s) {} + Q_DECL_CONSTEXPR inline QLatin1String() noexcept : m_size(0), m_data(nullptr) {} + Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) noexcept : m_size(s ? int(strlen(s)) : 0), m_data(s) {} Q_DECL_CONSTEXPR explicit QLatin1String(const char *f, const char *l) : QLatin1String(f, int(l - f)) {} - Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) Q_DECL_NOTHROW : m_size(sz), m_data(s) {} - inline explicit QLatin1String(const QByteArray &s) Q_DECL_NOTHROW : m_size(int(qstrnlen(s.constData(), s.size()))), m_data(s.constData()) {} + Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s, int sz) noexcept : m_size(sz), m_data(s) {} + inline explicit QLatin1String(const QByteArray &s) noexcept : m_size(int(qstrnlen(s.constData(), s.size()))), m_data(s.constData()) {} - Q_DECL_CONSTEXPR const char *latin1() const Q_DECL_NOTHROW { return m_data; } - Q_DECL_CONSTEXPR int size() const Q_DECL_NOTHROW { return m_size; } - Q_DECL_CONSTEXPR const char *data() const Q_DECL_NOTHROW { return m_data; } + Q_DECL_CONSTEXPR const char *latin1() const noexcept { return m_data; } + Q_DECL_CONSTEXPR int size() const noexcept { return m_size; } + Q_DECL_CONSTEXPR const char *data() const noexcept { return m_data; } - Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOTHROW { return !data(); } - Q_DECL_CONSTEXPR bool isEmpty() const Q_DECL_NOTHROW { return !size(); } + Q_DECL_CONSTEXPR bool isNull() const noexcept { return !data(); } + Q_DECL_CONSTEXPR bool isEmpty() const noexcept { return !size(); } Q_DECL_CONSTEXPR QLatin1Char at(int i) const { return Q_ASSERT(i >= 0), Q_ASSERT(i < size()), QLatin1Char(m_data[i]); } @@ -112,22 +112,22 @@ public: Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QLatin1Char front() const { return at(0); } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QLatin1Char back() const { return at(size() - 1); } - Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::startsWith(*this, s, cs); } - Q_REQUIRED_RESULT bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::startsWith(*this, s, cs); } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool startsWith(QChar c) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool startsWith(QChar c) const noexcept { return !isEmpty() && front() == c; } - Q_REQUIRED_RESULT inline bool startsWith(QChar c, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); } - Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::endsWith(*this, s, cs); } - Q_REQUIRED_RESULT bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::endsWith(*this, s, cs); } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool endsWith(QChar c) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool endsWith(QChar c) const noexcept { return !isEmpty() && back() == c; } - Q_REQUIRED_RESULT inline bool endsWith(QChar c, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); } using value_type = const char; @@ -138,18 +138,18 @@ public: using difference_type = int; // violates Container concept requirements using size_type = int; // violates Container concept requirements - Q_DECL_CONSTEXPR const_iterator begin() const Q_DECL_NOTHROW { return data(); } - Q_DECL_CONSTEXPR const_iterator cbegin() const Q_DECL_NOTHROW { return data(); } - Q_DECL_CONSTEXPR const_iterator end() const Q_DECL_NOTHROW { return data() + size(); } - Q_DECL_CONSTEXPR const_iterator cend() const Q_DECL_NOTHROW { return data() + size(); } + Q_DECL_CONSTEXPR const_iterator begin() const noexcept { return data(); } + Q_DECL_CONSTEXPR const_iterator cbegin() const noexcept { return data(); } + Q_DECL_CONSTEXPR const_iterator end() const noexcept { return data() + size(); } + Q_DECL_CONSTEXPR const_iterator cend() const noexcept { return data() + size(); } using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = reverse_iterator; - const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } - const_reverse_iterator crend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } Q_DECL_CONSTEXPR QLatin1String mid(int pos) const { return Q_ASSERT(pos >= 0), Q_ASSERT(pos <= size()), QLatin1String(m_data + pos, m_size - pos); } @@ -167,14 +167,14 @@ public: Q_DECL_RELAXED_CONSTEXPR void truncate(int n) { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size = n; } - Q_REQUIRED_RESULT QLatin1String trimmed() const Q_DECL_NOTHROW { return QtPrivate::trimmed(*this); } + Q_REQUIRED_RESULT QLatin1String trimmed() const noexcept { return QtPrivate::trimmed(*this); } - inline bool operator==(const QString &s) const Q_DECL_NOTHROW; - inline bool operator!=(const QString &s) const Q_DECL_NOTHROW; - inline bool operator>(const QString &s) const Q_DECL_NOTHROW; - inline bool operator<(const QString &s) const Q_DECL_NOTHROW; - inline bool operator>=(const QString &s) const Q_DECL_NOTHROW; - inline bool operator<=(const QString &s) const Q_DECL_NOTHROW; + inline bool operator==(const QString &s) const noexcept; + inline bool operator!=(const QString &s) const noexcept; + inline bool operator>(const QString &s) const noexcept; + inline bool operator<(const QString &s) const noexcept; + inline bool operator>=(const QString &s) const noexcept; + inline bool operator<=(const QString &s) const noexcept; #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) inline QT_ASCII_CAST_WARN bool operator==(const char *s) const; @@ -204,15 +204,15 @@ typedef QLatin1String QLatin1Literal; // // QLatin1String inline implementations // -inline bool QtPrivate::isLatin1(QLatin1String) Q_DECL_NOTHROW +inline bool QtPrivate::isLatin1(QLatin1String) noexcept { return true; } // // QStringView members that require QLatin1String: // -bool QStringView::startsWith(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +bool QStringView::startsWith(QLatin1String s, Qt::CaseSensitivity cs) const noexcept { return QtPrivate::startsWith(*this, s, cs); } -bool QStringView::endsWith(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +bool QStringView::endsWith(QLatin1String s, Qt::CaseSensitivity cs) const noexcept { return QtPrivate::endsWith(*this, s, cs); } class Q_CORE_EXPORT QString @@ -220,22 +220,22 @@ class Q_CORE_EXPORT QString public: typedef QStringData Data; - inline QString() Q_DECL_NOTHROW; + inline QString() noexcept; explicit QString(const QChar *unicode, int size = -1); QString(QChar c); QString(int size, QChar c); inline QString(QLatin1String latin1); - inline QString(const QString &) Q_DECL_NOTHROW; + inline QString(const QString &) noexcept; inline ~QString(); QString &operator=(QChar c); - QString &operator=(const QString &) Q_DECL_NOTHROW; + QString &operator=(const QString &) noexcept; QString &operator=(QLatin1String latin1); #ifdef Q_COMPILER_RVALUE_REFS - inline QString(QString && other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); } - inline QString &operator=(QString &&other) Q_DECL_NOTHROW + inline QString(QString && other) noexcept : d(other.d) { other.d = Data::sharedNull(); } + inline QString &operator=(QString &&other) noexcept { qSwap(d, other.d); return *this; } #endif - inline void swap(QString &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + inline void swap(QString &other) noexcept { qSwap(d, other.d); } inline int size() const { return d->size; } inline int count() const { return d->size; } inline int length() const; @@ -399,7 +399,7 @@ public: bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool startsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; #endif - Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::startsWith(*this, s, cs); } bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; @@ -408,7 +408,7 @@ public: bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool endsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; #endif - Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::endsWith(*this, s, cs); } bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; @@ -613,25 +613,25 @@ public: inline QString &setUtf16(const ushort *utf16, int size); #if QT_STRINGVIEW_LEVEL < 2 - int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; - inline int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; + int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + inline int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; #endif - int compare(QLatin1String other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; - inline int compare(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; + int compare(QLatin1String other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + inline int compare(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; static inline int compare(const QString &s1, const QString &s2, - Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept { return s1.compare(s2, cs); } static inline int compare(const QString &s1, QLatin1String s2, - Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept { return s1.compare(s2, cs); } static inline int compare(QLatin1String s1, const QString &s2, - Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept { return -s2.compare(s1, cs); } static int compare(const QString &s1, const QStringRef &s2, - Qt::CaseSensitivity = Qt::CaseSensitive) Q_DECL_NOTHROW; + Qt::CaseSensitivity = Qt::CaseSensitive) noexcept; int localeAwareCompare(const QString& s) const; static int localeAwareCompare(const QString& s1, const QString& s2) @@ -671,19 +671,19 @@ public: static QString number(qulonglong, int base=10); static QString number(double, char f='g', int prec=6); - friend Q_CORE_EXPORT bool operator==(const QString &s1, const QString &s2) Q_DECL_NOTHROW; - friend Q_CORE_EXPORT bool operator<(const QString &s1, const QString &s2) Q_DECL_NOTHROW; - friend inline bool operator>(const QString &s1, const QString &s2) Q_DECL_NOTHROW { return s2 < s1; } - friend inline bool operator!=(const QString &s1, const QString &s2) Q_DECL_NOTHROW { return !(s1 == s2); } - friend inline bool operator<=(const QString &s1, const QString &s2) Q_DECL_NOTHROW { return !(s1 > s2); } - friend inline bool operator>=(const QString &s1, const QString &s2) Q_DECL_NOTHROW { return !(s1 < s2); } + friend Q_CORE_EXPORT bool operator==(const QString &s1, const QString &s2) noexcept; + friend Q_CORE_EXPORT bool operator<(const QString &s1, const QString &s2) noexcept; + friend inline bool operator>(const QString &s1, const QString &s2) noexcept { return s2 < s1; } + friend inline bool operator!=(const QString &s1, const QString &s2) noexcept { return !(s1 == s2); } + friend inline bool operator<=(const QString &s1, const QString &s2) noexcept { return !(s1 > s2); } + friend inline bool operator>=(const QString &s1, const QString &s2) noexcept { return !(s1 < s2); } - bool operator==(QLatin1String s) const Q_DECL_NOTHROW; - bool operator<(QLatin1String s) const Q_DECL_NOTHROW; - bool operator>(QLatin1String s) const Q_DECL_NOTHROW; - inline bool operator!=(QLatin1String s) const Q_DECL_NOTHROW { return !operator==(s); } - inline bool operator<=(QLatin1String s) const Q_DECL_NOTHROW { return !operator>(s); } - inline bool operator>=(QLatin1String s) const Q_DECL_NOTHROW { return !operator<(s); } + bool operator==(QLatin1String s) const noexcept; + bool operator<(QLatin1String s) const noexcept; + bool operator>(QLatin1String s) const noexcept; + inline bool operator!=(QLatin1String s) const noexcept { return !operator==(s); } + inline bool operator<=(QLatin1String s) const noexcept { return !operator>(s); } + inline bool operator>=(QLatin1String s) const noexcept { return !operator<(s); } // ASCII compatibility #if defined(QT_RESTRICTED_CAST_FROM_ASCII) @@ -844,15 +844,15 @@ private: Data *d; - friend inline bool operator==(QChar, const QString &) Q_DECL_NOTHROW; - friend inline bool operator< (QChar, const QString &) Q_DECL_NOTHROW; - friend inline bool operator> (QChar, const QString &) Q_DECL_NOTHROW; - friend inline bool operator==(QChar, const QStringRef &) Q_DECL_NOTHROW; - friend inline bool operator< (QChar, const QStringRef &) Q_DECL_NOTHROW; - friend inline bool operator> (QChar, const QStringRef &) Q_DECL_NOTHROW; - friend inline bool operator==(QChar, QLatin1String) Q_DECL_NOTHROW; - friend inline bool operator< (QChar, QLatin1String) Q_DECL_NOTHROW; - friend inline bool operator> (QChar, QLatin1String) Q_DECL_NOTHROW; + friend inline bool operator==(QChar, const QString &) noexcept; + friend inline bool operator< (QChar, const QString &) noexcept; + friend inline bool operator> (QChar, const QString &) noexcept; + friend inline bool operator==(QChar, const QStringRef &) noexcept; + friend inline bool operator< (QChar, const QStringRef &) noexcept; + friend inline bool operator> (QChar, const QStringRef &) noexcept; + friend inline bool operator==(QChar, QLatin1String) noexcept; + friend inline bool operator< (QChar, QLatin1String) noexcept; + friend inline bool operator> (QChar, QLatin1String) noexcept; void reallocData(uint alloc, bool grow = false); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) @@ -861,13 +861,13 @@ private: QString multiArg(int numArgs, const QString **args) const; static int compare_helper(const QChar *data1, int length1, const QChar *data2, int length2, - Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; static int compare_helper(const QChar *data1, int length1, const char *data2, int length2, Qt::CaseSensitivity cs = Qt::CaseSensitive); static int compare_helper(const QChar *data1, int length1, QLatin1String s2, - Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; static int localeAwareCompare_helper(const QChar *data1, int length1, const QChar *data2, int length2); static QString toLower_helper(const QString &str); @@ -956,7 +956,7 @@ inline bool QString::isDetached() const { return !d->ref.isShared(); } inline void QString::clear() { if (!isNull()) *this = QString(); } -inline QString::QString(const QString &other) Q_DECL_NOTHROW : d(other.d) +inline QString::QString(const QString &other) noexcept : d(other.d) { Q_ASSERT(&other != this); d->ref.ref(); } inline int QString::capacity() const { return d->alloc ? d->alloc - 1 : 0; } @@ -1128,7 +1128,7 @@ inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); } inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); } -inline QString::QString() Q_DECL_NOTHROW : d(Data::sharedNull()) {} +inline QString::QString() noexcept : d(Data::sharedNull()) {} inline QString::~QString() { if (!d->ref.deref()) Data::deallocate(d); } inline void QString::reserve(int asize) @@ -1200,34 +1200,34 @@ QT_DEPRECATED_X("use !QString::isNull()") inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); } #endif -inline bool operator==(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW +inline bool operator==(QLatin1String s1, QLatin1String s2) noexcept { return s1.size() == s2.size() && (!s1.size() || !memcmp(s1.latin1(), s2.latin1(), s1.size())); } -inline bool operator!=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW +inline bool operator!=(QLatin1String s1, QLatin1String s2) noexcept { return !operator==(s1, s2); } -inline bool operator<(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW +inline bool operator<(QLatin1String s1, QLatin1String s2) noexcept { const int len = qMin(s1.size(), s2.size()); const int r = len ? memcmp(s1.latin1(), s2.latin1(), len) : 0; return r < 0 || (r == 0 && s1.size() < s2.size()); } -inline bool operator>(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW +inline bool operator>(QLatin1String s1, QLatin1String s2) noexcept { return operator<(s2, s1); } -inline bool operator<=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW +inline bool operator<=(QLatin1String s1, QLatin1String s2) noexcept { return !operator>(s1, s2); } -inline bool operator>=(QLatin1String s1, QLatin1String s2) Q_DECL_NOTHROW +inline bool operator>=(QLatin1String s1, QLatin1String s2) noexcept { return !operator<(s1, s2); } -inline bool QLatin1String::operator==(const QString &s) const Q_DECL_NOTHROW +inline bool QLatin1String::operator==(const QString &s) const noexcept { return s == *this; } -inline bool QLatin1String::operator!=(const QString &s) const Q_DECL_NOTHROW +inline bool QLatin1String::operator!=(const QString &s) const noexcept { return s != *this; } -inline bool QLatin1String::operator>(const QString &s) const Q_DECL_NOTHROW +inline bool QLatin1String::operator>(const QString &s) const noexcept { return s < *this; } -inline bool QLatin1String::operator<(const QString &s) const Q_DECL_NOTHROW +inline bool QLatin1String::operator<(const QString &s) const noexcept { return s > *this; } -inline bool QLatin1String::operator>=(const QString &s) const Q_DECL_NOTHROW +inline bool QLatin1String::operator>=(const QString &s) const noexcept { return s <= *this; } -inline bool QLatin1String::operator<=(const QString &s) const Q_DECL_NOTHROW +inline bool QLatin1String::operator<=(const QString &s) const noexcept { return s >= *this; } #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) @@ -1434,14 +1434,14 @@ public: #if QT_VERSION < QT_VERSION_CHECK(6,0,0) // ### Qt 6: remove all of these, the implicit ones are fine - QStringRef(const QStringRef &other) Q_DECL_NOTHROW + QStringRef(const QStringRef &other) noexcept :m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {} #ifdef Q_COMPILER_RVALUE_REFS - QStringRef(QStringRef &&other) Q_DECL_NOTHROW : m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {} - QStringRef &operator=(QStringRef &&other) Q_DECL_NOTHROW { return *this = other; } + QStringRef(QStringRef &&other) noexcept : m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {} + QStringRef &operator=(QStringRef &&other) noexcept { return *this = other; } #endif - QStringRef &operator=(const QStringRef &other) Q_DECL_NOTHROW + QStringRef &operator=(const QStringRef &other) noexcept { m_string = other.m_string; m_position = other.m_position; m_size = other.m_size; return *this; @@ -1484,8 +1484,8 @@ public: Q_REQUIRED_RESULT QStringRef chopped(int n) const { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return left(size() - n); } - void truncate(int pos) Q_DECL_NOTHROW { m_size = qBound(0, pos, m_size); } - void chop(int n) Q_DECL_NOTHROW + void truncate(int pos) noexcept { m_size = qBound(0, pos, m_size); } + void chop(int n) noexcept { if (n >= m_size) m_size = 0; @@ -1495,7 +1495,7 @@ public: bool isRightToLeft() const; - Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::startsWith(*this, s, cs); } bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; @@ -1504,7 +1504,7 @@ public: bool startsWith(const QStringRef &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; #endif - Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::endsWith(*this, s, cs); } bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; @@ -1567,19 +1567,19 @@ public: inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const; #endif - int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; - int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; - int compare(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; + int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + int compare(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) int compare(const QByteArray &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return QString::compare_helper(unicode(), size(), s.data(), qstrnlen(s.data(), s.size()), cs); } #endif static int compare(const QStringRef &s1, const QString &s2, - Qt::CaseSensitivity = Qt::CaseSensitive) Q_DECL_NOTHROW; + Qt::CaseSensitivity = Qt::CaseSensitive) noexcept; static int compare(const QStringRef &s1, const QStringRef &s2, - Qt::CaseSensitivity = Qt::CaseSensitive) Q_DECL_NOTHROW; + Qt::CaseSensitivity = Qt::CaseSensitive) noexcept; static int compare(const QStringRef &s1, QLatin1String s2, - Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; + Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; int localeAwareCompare(const QString &s) const; int localeAwareCompare(const QStringRef &s) const; @@ -1610,162 +1610,162 @@ inline QStringRef::QStringRef(const QString *aString) :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){} // QStringRef <> QStringRef -Q_CORE_EXPORT bool operator==(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW; -inline bool operator!=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW +Q_CORE_EXPORT bool operator==(const QStringRef &s1, const QStringRef &s2) noexcept; +inline bool operator!=(const QStringRef &s1, const QStringRef &s2) noexcept { return !(s1 == s2); } -Q_CORE_EXPORT bool operator<(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW; -inline bool operator>(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW +Q_CORE_EXPORT bool operator<(const QStringRef &s1, const QStringRef &s2) noexcept; +inline bool operator>(const QStringRef &s1, const QStringRef &s2) noexcept { return s2 < s1; } -inline bool operator<=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW +inline bool operator<=(const QStringRef &s1, const QStringRef &s2) noexcept { return !(s1 > s2); } -inline bool operator>=(const QStringRef &s1, const QStringRef &s2) Q_DECL_NOTHROW +inline bool operator>=(const QStringRef &s1, const QStringRef &s2) noexcept { return !(s1 < s2); } // QString <> QStringRef -Q_CORE_EXPORT bool operator==(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW; -inline bool operator!=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) != 0; } -inline bool operator< (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) < 0; } -inline bool operator> (const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) > 0; } -inline bool operator<=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) <= 0; } -inline bool operator>=(const QString &lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return lhs.compare(rhs) >= 0; } - -inline bool operator==(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs == lhs; } -inline bool operator!=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs != lhs; } -inline bool operator< (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs > lhs; } -inline bool operator> (const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs < lhs; } -inline bool operator<=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs >= lhs; } -inline bool operator>=(const QStringRef &lhs, const QString &rhs) Q_DECL_NOTHROW { return rhs <= lhs; } +Q_CORE_EXPORT bool operator==(const QString &lhs, const QStringRef &rhs) noexcept; +inline bool operator!=(const QString &lhs, const QStringRef &rhs) noexcept { return lhs.compare(rhs) != 0; } +inline bool operator< (const QString &lhs, const QStringRef &rhs) noexcept { return lhs.compare(rhs) < 0; } +inline bool operator> (const QString &lhs, const QStringRef &rhs) noexcept { return lhs.compare(rhs) > 0; } +inline bool operator<=(const QString &lhs, const QStringRef &rhs) noexcept { return lhs.compare(rhs) <= 0; } +inline bool operator>=(const QString &lhs, const QStringRef &rhs) noexcept { return lhs.compare(rhs) >= 0; } + +inline bool operator==(const QStringRef &lhs, const QString &rhs) noexcept { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, const QString &rhs) noexcept { return rhs != lhs; } +inline bool operator< (const QStringRef &lhs, const QString &rhs) noexcept { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, const QString &rhs) noexcept { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, const QString &rhs) noexcept { return rhs >= lhs; } +inline bool operator>=(const QStringRef &lhs, const QString &rhs) noexcept { return rhs <= lhs; } #if QT_STRINGVIEW_LEVEL < 2 -inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const noexcept { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } #endif -inline int QString::compare(QStringView s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +inline int QString::compare(QStringView s, Qt::CaseSensitivity cs) const noexcept { return -s.compare(*this, cs); } -inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs) noexcept { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const noexcept { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const noexcept { return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); } -inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW +inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const noexcept { return QString::compare_helper(constData(), length(), s, cs); } -inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs) noexcept { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs) noexcept { return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); } -inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) Q_DECL_NOTHROW +inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs) noexcept { return QString::compare_helper(s1.constData(), s1.length(), s2, cs); } // QLatin1String <> QStringRef -Q_CORE_EXPORT bool operator==(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW; -inline bool operator!=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) != 0; } -inline bool operator< (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) > 0; } -inline bool operator> (QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) < 0; } -inline bool operator<=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) >= 0; } -inline bool operator>=(QLatin1String lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return rhs.compare(lhs) <= 0; } - -inline bool operator==(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs == lhs; } -inline bool operator!=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs != lhs; } -inline bool operator< (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs > lhs; } -inline bool operator> (const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs < lhs; } -inline bool operator<=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs >= lhs; } -inline bool operator>=(const QStringRef &lhs, QLatin1String rhs) Q_DECL_NOTHROW { return rhs <= lhs; } +Q_CORE_EXPORT bool operator==(QLatin1String lhs, const QStringRef &rhs) noexcept; +inline bool operator!=(QLatin1String lhs, const QStringRef &rhs) noexcept { return rhs.compare(lhs) != 0; } +inline bool operator< (QLatin1String lhs, const QStringRef &rhs) noexcept { return rhs.compare(lhs) > 0; } +inline bool operator> (QLatin1String lhs, const QStringRef &rhs) noexcept { return rhs.compare(lhs) < 0; } +inline bool operator<=(QLatin1String lhs, const QStringRef &rhs) noexcept { return rhs.compare(lhs) >= 0; } +inline bool operator>=(QLatin1String lhs, const QStringRef &rhs) noexcept { return rhs.compare(lhs) <= 0; } + +inline bool operator==(const QStringRef &lhs, QLatin1String rhs) noexcept { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, QLatin1String rhs) noexcept { return rhs != lhs; } +inline bool operator< (const QStringRef &lhs, QLatin1String rhs) noexcept { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, QLatin1String rhs) noexcept { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, QLatin1String rhs) noexcept { return rhs >= lhs; } +inline bool operator>=(const QStringRef &lhs, QLatin1String rhs) noexcept { return rhs <= lhs; } // QChar <> QString -inline bool operator==(QChar lhs, const QString &rhs) Q_DECL_NOTHROW +inline bool operator==(QChar lhs, const QString &rhs) noexcept { return rhs.size() == 1 && lhs == rhs.front(); } -inline bool operator< (QChar lhs, const QString &rhs) Q_DECL_NOTHROW +inline bool operator< (QChar lhs, const QString &rhs) noexcept { return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; } -inline bool operator> (QChar lhs, const QString &rhs) Q_DECL_NOTHROW +inline bool operator> (QChar lhs, const QString &rhs) noexcept { return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; } -inline bool operator!=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } -inline bool operator<=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs > rhs); } -inline bool operator>=(QChar lhs, const QString &rhs) Q_DECL_NOTHROW { return !(lhs < rhs); } +inline bool operator!=(QChar lhs, const QString &rhs) noexcept { return !(lhs == rhs); } +inline bool operator<=(QChar lhs, const QString &rhs) noexcept { return !(lhs > rhs); } +inline bool operator>=(QChar lhs, const QString &rhs) noexcept { return !(lhs < rhs); } -inline bool operator==(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; } -inline bool operator!=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); } -inline bool operator< (const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; } -inline bool operator> (const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; } -inline bool operator<=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); } -inline bool operator>=(const QString &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); } +inline bool operator==(const QString &lhs, QChar rhs) noexcept { return rhs == lhs; } +inline bool operator!=(const QString &lhs, QChar rhs) noexcept { return !(rhs == lhs); } +inline bool operator< (const QString &lhs, QChar rhs) noexcept { return rhs > lhs; } +inline bool operator> (const QString &lhs, QChar rhs) noexcept { return rhs < lhs; } +inline bool operator<=(const QString &lhs, QChar rhs) noexcept { return !(rhs < lhs); } +inline bool operator>=(const QString &lhs, QChar rhs) noexcept { return !(rhs > lhs); } // QChar <> QStringRef -inline bool operator==(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW +inline bool operator==(QChar lhs, const QStringRef &rhs) noexcept { return rhs.size() == 1 && lhs == rhs.front(); } -inline bool operator< (QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW +inline bool operator< (QChar lhs, const QStringRef &rhs) noexcept { return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) < 0; } -inline bool operator> (QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW +inline bool operator> (QChar lhs, const QStringRef &rhs) noexcept { return QString::compare_helper(&lhs, 1, rhs.data(), rhs.size()) > 0; } -inline bool operator!=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } -inline bool operator<=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs > rhs); } -inline bool operator>=(QChar lhs, const QStringRef &rhs) Q_DECL_NOTHROW { return !(lhs < rhs); } +inline bool operator!=(QChar lhs, const QStringRef &rhs) noexcept { return !(lhs == rhs); } +inline bool operator<=(QChar lhs, const QStringRef &rhs) noexcept { return !(lhs > rhs); } +inline bool operator>=(QChar lhs, const QStringRef &rhs) noexcept { return !(lhs < rhs); } -inline bool operator==(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; } -inline bool operator!=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); } -inline bool operator< (const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; } -inline bool operator> (const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; } -inline bool operator<=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); } -inline bool operator>=(const QStringRef &lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); } +inline bool operator==(const QStringRef &lhs, QChar rhs) noexcept { return rhs == lhs; } +inline bool operator!=(const QStringRef &lhs, QChar rhs) noexcept { return !(rhs == lhs); } +inline bool operator< (const QStringRef &lhs, QChar rhs) noexcept { return rhs > lhs; } +inline bool operator> (const QStringRef &lhs, QChar rhs) noexcept { return rhs < lhs; } +inline bool operator<=(const QStringRef &lhs, QChar rhs) noexcept { return !(rhs < lhs); } +inline bool operator>=(const QStringRef &lhs, QChar rhs) noexcept { return !(rhs > lhs); } // QChar <> QLatin1String -inline bool operator==(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW +inline bool operator==(QChar lhs, QLatin1String rhs) noexcept { return rhs.size() == 1 && lhs == rhs.front(); } -inline bool operator< (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW +inline bool operator< (QChar lhs, QLatin1String rhs) noexcept { return QString::compare_helper(&lhs, 1, rhs) < 0; } -inline bool operator> (QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW +inline bool operator> (QChar lhs, QLatin1String rhs) noexcept { return QString::compare_helper(&lhs, 1, rhs) > 0; } -inline bool operator!=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } -inline bool operator<=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs > rhs); } -inline bool operator>=(QChar lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs < rhs); } +inline bool operator!=(QChar lhs, QLatin1String rhs) noexcept { return !(lhs == rhs); } +inline bool operator<=(QChar lhs, QLatin1String rhs) noexcept { return !(lhs > rhs); } +inline bool operator>=(QChar lhs, QLatin1String rhs) noexcept { return !(lhs < rhs); } -inline bool operator==(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs == lhs; } -inline bool operator!=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs == lhs); } -inline bool operator< (QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs > lhs; } -inline bool operator> (QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return rhs < lhs; } -inline bool operator<=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs < lhs); } -inline bool operator>=(QLatin1String lhs, QChar rhs) Q_DECL_NOTHROW { return !(rhs > lhs); } +inline bool operator==(QLatin1String lhs, QChar rhs) noexcept { return rhs == lhs; } +inline bool operator!=(QLatin1String lhs, QChar rhs) noexcept { return !(rhs == lhs); } +inline bool operator< (QLatin1String lhs, QChar rhs) noexcept { return rhs > lhs; } +inline bool operator> (QLatin1String lhs, QChar rhs) noexcept { return rhs < lhs; } +inline bool operator<=(QLatin1String lhs, QChar rhs) noexcept { return !(rhs < lhs); } +inline bool operator>=(QLatin1String lhs, QChar rhs) noexcept { return !(rhs > lhs); } // QStringView <> QStringView -inline bool operator==(QStringView lhs, QStringView rhs) Q_DECL_NOTHROW { return lhs.size() == rhs.size() && QtPrivate::compareStrings(lhs, rhs) == 0; } -inline bool operator!=(QStringView lhs, QStringView rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } -inline bool operator< (QStringView lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) < 0; } -inline bool operator<=(QStringView lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) <= 0; } -inline bool operator> (QStringView lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) > 0; } -inline bool operator>=(QStringView lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) >= 0; } +inline bool operator==(QStringView lhs, QStringView rhs) noexcept { return lhs.size() == rhs.size() && QtPrivate::compareStrings(lhs, rhs) == 0; } +inline bool operator!=(QStringView lhs, QStringView rhs) noexcept { return !(lhs == rhs); } +inline bool operator< (QStringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) < 0; } +inline bool operator<=(QStringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <= 0; } +inline bool operator> (QStringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) > 0; } +inline bool operator>=(QStringView lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >= 0; } // QStringView <> QChar -inline bool operator==(QStringView lhs, QChar rhs) Q_DECL_NOTHROW { return lhs == QStringView(&rhs, 1); } -inline bool operator!=(QStringView lhs, QChar rhs) Q_DECL_NOTHROW { return lhs != QStringView(&rhs, 1); } -inline bool operator< (QStringView lhs, QChar rhs) Q_DECL_NOTHROW { return lhs < QStringView(&rhs, 1); } -inline bool operator<=(QStringView lhs, QChar rhs) Q_DECL_NOTHROW { return lhs <= QStringView(&rhs, 1); } -inline bool operator> (QStringView lhs, QChar rhs) Q_DECL_NOTHROW { return lhs > QStringView(&rhs, 1); } -inline bool operator>=(QStringView lhs, QChar rhs) Q_DECL_NOTHROW { return lhs >= QStringView(&rhs, 1); } - -inline bool operator==(QChar lhs, QStringView rhs) Q_DECL_NOTHROW { return QStringView(&lhs, 1) == rhs; } -inline bool operator!=(QChar lhs, QStringView rhs) Q_DECL_NOTHROW { return QStringView(&lhs, 1) != rhs; } -inline bool operator< (QChar lhs, QStringView rhs) Q_DECL_NOTHROW { return QStringView(&lhs, 1) < rhs; } -inline bool operator<=(QChar lhs, QStringView rhs) Q_DECL_NOTHROW { return QStringView(&lhs, 1) <= rhs; } -inline bool operator> (QChar lhs, QStringView rhs) Q_DECL_NOTHROW { return QStringView(&lhs, 1) > rhs; } -inline bool operator>=(QChar lhs, QStringView rhs) Q_DECL_NOTHROW { return QStringView(&lhs, 1) >= rhs; } +inline bool operator==(QStringView lhs, QChar rhs) noexcept { return lhs == QStringView(&rhs, 1); } +inline bool operator!=(QStringView lhs, QChar rhs) noexcept { return lhs != QStringView(&rhs, 1); } +inline bool operator< (QStringView lhs, QChar rhs) noexcept { return lhs < QStringView(&rhs, 1); } +inline bool operator<=(QStringView lhs, QChar rhs) noexcept { return lhs <= QStringView(&rhs, 1); } +inline bool operator> (QStringView lhs, QChar rhs) noexcept { return lhs > QStringView(&rhs, 1); } +inline bool operator>=(QStringView lhs, QChar rhs) noexcept { return lhs >= QStringView(&rhs, 1); } + +inline bool operator==(QChar lhs, QStringView rhs) noexcept { return QStringView(&lhs, 1) == rhs; } +inline bool operator!=(QChar lhs, QStringView rhs) noexcept { return QStringView(&lhs, 1) != rhs; } +inline bool operator< (QChar lhs, QStringView rhs) noexcept { return QStringView(&lhs, 1) < rhs; } +inline bool operator<=(QChar lhs, QStringView rhs) noexcept { return QStringView(&lhs, 1) <= rhs; } +inline bool operator> (QChar lhs, QStringView rhs) noexcept { return QStringView(&lhs, 1) > rhs; } +inline bool operator>=(QChar lhs, QStringView rhs) noexcept { return QStringView(&lhs, 1) >= rhs; } // QStringView <> QLatin1String -inline bool operator==(QStringView lhs, QLatin1String rhs) Q_DECL_NOTHROW { return lhs.size() == rhs.size() && QtPrivate::compareStrings(lhs, rhs) == 0; } -inline bool operator!=(QStringView lhs, QLatin1String rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } -inline bool operator< (QStringView lhs, QLatin1String rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) < 0; } -inline bool operator<=(QStringView lhs, QLatin1String rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) <= 0; } -inline bool operator> (QStringView lhs, QLatin1String rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) > 0; } -inline bool operator>=(QStringView lhs, QLatin1String rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) >= 0; } - -inline bool operator==(QLatin1String lhs, QStringView rhs) Q_DECL_NOTHROW { return lhs.size() == rhs.size() && QtPrivate::compareStrings(lhs, rhs) == 0; } -inline bool operator!=(QLatin1String lhs, QStringView rhs) Q_DECL_NOTHROW { return !(lhs == rhs); } -inline bool operator< (QLatin1String lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) < 0; } -inline bool operator<=(QLatin1String lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) <= 0; } -inline bool operator> (QLatin1String lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) > 0; } -inline bool operator>=(QLatin1String lhs, QStringView rhs) Q_DECL_NOTHROW { return QtPrivate::compareStrings(lhs, rhs) >= 0; } +inline bool operator==(QStringView lhs, QLatin1String rhs) noexcept { return lhs.size() == rhs.size() && QtPrivate::compareStrings(lhs, rhs) == 0; } +inline bool operator!=(QStringView lhs, QLatin1String rhs) noexcept { return !(lhs == rhs); } +inline bool operator< (QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) < 0; } +inline bool operator<=(QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <= 0; } +inline bool operator> (QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) > 0; } +inline bool operator>=(QStringView lhs, QLatin1String rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >= 0; } + +inline bool operator==(QLatin1String lhs, QStringView rhs) noexcept { return lhs.size() == rhs.size() && QtPrivate::compareStrings(lhs, rhs) == 0; } +inline bool operator!=(QLatin1String lhs, QStringView rhs) noexcept { return !(lhs == rhs); } +inline bool operator< (QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) < 0; } +inline bool operator<=(QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) <= 0; } +inline bool operator> (QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) > 0; } +inline bool operator>=(QLatin1String lhs, QStringView rhs) noexcept { return QtPrivate::compareStrings(lhs, rhs) >= 0; } #if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII) // QStringRef <> QByteArray diff --git a/src/corelib/tools/qstringalgorithms.h b/src/corelib/tools/qstringalgorithms.h index e94f725598..8e7fc0af9b 100644 --- a/src/corelib/tools/qstringalgorithms.h +++ b/src/corelib/tools/qstringalgorithms.h @@ -56,31 +56,31 @@ template <typename T> class QVector; namespace QtPrivate { -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const ushort *str) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const ushort *str) noexcept; Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION const ushort *qustrchr(QStringView str, ushort ch) noexcept; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool startsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool endsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findChar(QStringView str, QChar ch, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findChar(QStringView str, QChar ch, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype findString(QStringView haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QStringView trimmed(QStringView s) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QLatin1String trimmed(QLatin1String s) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QStringView trimmed(QStringView s) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION QLatin1String trimmed(QLatin1String s) noexcept; Q_REQUIRED_RESULT Q_CORE_EXPORT QByteArray convertToLatin1(QStringView str); Q_REQUIRED_RESULT Q_CORE_EXPORT QByteArray convertToUtf8(QStringView str); @@ -88,10 +88,10 @@ Q_REQUIRED_RESULT Q_CORE_EXPORT QByteArray convertToLocal8Bit(QStringView str); Q_REQUIRED_RESULT Q_CORE_EXPORT QVector<uint> convertToUcs4(QStringView str); Q_REQUIRED_RESULT Q_CORE_EXPORT bool isRightToLeft(QStringView string); -Q_REQUIRED_RESULT Q_CORE_EXPORT bool isAscii(QLatin1String s) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT Q_CORE_EXPORT bool isAscii(QStringView s) Q_DECL_NOTHROW; -Q_REQUIRED_RESULT bool isLatin1(QLatin1String s) Q_DECL_NOTHROW; // in qstring.h -Q_REQUIRED_RESULT Q_CORE_EXPORT bool isLatin1(QStringView s) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT bool isAscii(QLatin1String s) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT bool isAscii(QStringView s) noexcept; +Q_REQUIRED_RESULT bool isLatin1(QLatin1String s) noexcept; // in qstring.h +Q_REQUIRED_RESULT Q_CORE_EXPORT bool isLatin1(QStringView s) noexcept; } // namespace QtPRivate diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index 8afc83819b..cf443ec369 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -124,7 +124,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ -void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) Q_DECL_NOTHROW +void QAbstractConcatenable::convertFromAscii(const char *a, int len, QChar *&out) noexcept { if (Q_UNLIKELY(len == -1)) { if (!a) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 1d96d70637..79ed10c7a8 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -58,12 +58,12 @@ QT_BEGIN_NAMESPACE struct Q_CORE_EXPORT QAbstractConcatenable { protected: - static void convertFromAscii(const char *a, int len, QChar *&out) Q_DECL_NOTHROW; - static inline void convertFromAscii(char a, QChar *&out) Q_DECL_NOTHROW + static void convertFromAscii(const char *a, int len, QChar *&out) noexcept; + static inline void convertFromAscii(char a, QChar *&out) noexcept { *out++ = QLatin1Char(a); } - static void appendLatin1To(const char *a, int len, QChar *out) Q_DECL_NOTHROW; + static void appendLatin1To(const char *a, int len, QChar *out) noexcept; }; template <typename T> struct QConcatenable {}; diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index b6c48488df..6387161269 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -100,11 +100,11 @@ class QStringList : public QList<QString> { #endif public: - inline QStringList() Q_DECL_NOTHROW { } + inline QStringList() noexcept { } inline explicit QStringList(const QString &i) { append(i); } inline QStringList(const QList<QString> &l) : QList<QString>(l) { } #ifdef Q_COMPILER_RVALUE_REFS - inline QStringList(QList<QString> &&l) Q_DECL_NOTHROW : QList<QString>(std::move(l)) { } + inline QStringList(QList<QString> &&l) noexcept : QList<QString>(std::move(l)) { } #endif #ifdef Q_COMPILER_INITIALIZER_LISTS inline QStringList(std::initializer_list<QString> args) : QList<QString>(args) { } @@ -113,7 +113,7 @@ public: QStringList &operator=(const QList<QString> &other) { QList<QString>::operator=(other); return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QStringList &operator=(QList<QString> &&other) Q_DECL_NOTHROW + QStringList &operator=(QList<QString> &&other) noexcept { QList<QString>::operator=(std::move(other)); return *this; } #endif diff --git a/src/corelib/tools/qstringliteral.h b/src/corelib/tools/qstringliteral.h index 64296b89fc..603f19c0b4 100644 --- a/src/corelib/tools/qstringliteral.h +++ b/src/corelib/tools/qstringliteral.h @@ -63,7 +63,7 @@ Q_STATIC_ASSERT_X(sizeof(qunicodechar) == 2, #define QT_UNICODE_LITERAL(str) u"" str #define QStringLiteral(str) \ - ([]() Q_DECL_NOEXCEPT -> QString { \ + ([]() noexcept -> QString { \ enum { Size = sizeof(QT_UNICODE_LITERAL(str))/2 - 1 }; \ static const QStaticStringData<Size> qstring_literal = { \ Q_STATIC_STRING_DATA_HEADER_INITIALIZER(Size), \ diff --git a/src/corelib/tools/qstringview.h b/src/corelib/tools/qstringview.h index 4a900b5e89..5b6d63b71c 100644 --- a/src/corelib/tools/qstringview.h +++ b/src/corelib/tools/qstringview.h @@ -139,13 +139,13 @@ private: using if_compatible_qstring_like = typename std::enable_if<std::is_same<T, QString>::value || std::is_same<T, QStringRef>::value, bool>::type; template <typename Char, size_t N> - static Q_DECL_CONSTEXPR qsizetype lengthHelperArray(const Char (&)[N]) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR qsizetype lengthHelperArray(const Char (&)[N]) noexcept { return qsizetype(N - 1); } template <typename Char> - static qsizetype lengthHelperPointer(const Char *str) Q_DECL_NOTHROW + static qsizetype lengthHelperPointer(const Char *str) noexcept { #if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) if (__builtin_constant_p(*str)) { @@ -157,21 +157,21 @@ private: #endif return QtPrivate::qustrlen(reinterpret_cast<const ushort *>(str)); } - static qsizetype lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW + static qsizetype lengthHelperPointer(const QChar *str) noexcept { return QtPrivate::qustrlen(reinterpret_cast<const ushort *>(str)); } template <typename Char> - static const storage_type *castHelper(const Char *str) Q_DECL_NOTHROW + static const storage_type *castHelper(const Char *str) noexcept { return reinterpret_cast<const storage_type*>(str); } - static Q_DECL_CONSTEXPR const storage_type *castHelper(const storage_type *str) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR const storage_type *castHelper(const storage_type *str) noexcept { return str; } public: - Q_DECL_CONSTEXPR QStringView() Q_DECL_NOTHROW + Q_DECL_CONSTEXPR QStringView() noexcept : m_size(0), m_data(nullptr) {} - Q_DECL_CONSTEXPR QStringView(std::nullptr_t) Q_DECL_NOTHROW + Q_DECL_CONSTEXPR QStringView(std::nullptr_t) noexcept : QStringView() {} template <typename Char, if_compatible_char<Char> = true> @@ -185,38 +185,38 @@ public: #ifdef Q_CLANG_QDOC template <typename Char, size_t N> - Q_DECL_CONSTEXPR QStringView(const Char (&array)[N]) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QStringView(const Char (&array)[N]) noexcept; template <typename Char> - Q_DECL_CONSTEXPR QStringView(const Char *str) Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR QStringView(const Char *str) noexcept; #else template <typename Array, if_compatible_array<Array> = true> - Q_DECL_CONSTEXPR QStringView(const Array &str) Q_DECL_NOTHROW + Q_DECL_CONSTEXPR QStringView(const Array &str) noexcept : QStringView(str, lengthHelperArray(str)) {} template <typename Pointer, if_compatible_pointer<Pointer> = true> - Q_DECL_CONSTEXPR QStringView(const Pointer &str) Q_DECL_NOTHROW + Q_DECL_CONSTEXPR QStringView(const Pointer &str) noexcept : QStringView(str, str ? lengthHelperPointer(str) : 0) {} #endif #ifdef Q_CLANG_QDOC - QStringView(const QString &str) Q_DECL_NOTHROW; - QStringView(const QStringRef &str) Q_DECL_NOTHROW; + QStringView(const QString &str) noexcept; + QStringView(const QStringRef &str) noexcept; #else template <typename String, if_compatible_qstring_like<String> = true> - QStringView(const String &str) Q_DECL_NOTHROW + QStringView(const String &str) noexcept : QStringView(str.isNull() ? nullptr : str.data(), qsizetype(str.size())) {} #endif template <typename StdBasicString, if_compatible_string<StdBasicString> = true> - QStringView(const StdBasicString &str) Q_DECL_NOTHROW + QStringView(const StdBasicString &str) noexcept : QStringView(str.data(), qsizetype(str.size())) {} Q_REQUIRED_RESULT inline QString toString() const; // defined in qstring.h - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const Q_DECL_NOTHROW { return m_size; } - Q_REQUIRED_RESULT const_pointer data() const Q_DECL_NOTHROW { return reinterpret_cast<const_pointer>(m_data); } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const Q_DECL_NOTHROW { return m_data; } + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const noexcept { return m_size; } + Q_REQUIRED_RESULT const_pointer data() const noexcept { return reinterpret_cast<const_pointer>(m_data); } + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const noexcept { return m_data; } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qsizetype n) const { return Q_ASSERT(n >= 0), Q_ASSERT(n < size()), QChar(m_data[n]); } @@ -248,28 +248,28 @@ public: Q_DECL_RELAXED_CONSTEXPR void chop(qsizetype n) { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size -= n; } - Q_REQUIRED_RESULT QStringView trimmed() const Q_DECL_NOTHROW { return QtPrivate::trimmed(*this); } + Q_REQUIRED_RESULT QStringView trimmed() const noexcept { return QtPrivate::trimmed(*this); } - Q_REQUIRED_RESULT int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::compareStrings(*this, other, cs); } - Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::startsWith(*this, s, cs); } - Q_REQUIRED_RESULT inline bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT bool startsWith(QChar c) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + Q_REQUIRED_RESULT bool startsWith(QChar c) const noexcept { return !empty() && front() == c; } - Q_REQUIRED_RESULT bool startsWith(QChar c, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); } - Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept { return QtPrivate::endsWith(*this, s, cs); } - Q_REQUIRED_RESULT inline bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; - Q_REQUIRED_RESULT bool endsWith(QChar c) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; + Q_REQUIRED_RESULT bool endsWith(QChar c) const noexcept { return !empty() && back() == c; } - Q_REQUIRED_RESULT bool endsWith(QChar c, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); } - Q_REQUIRED_RESULT bool isRightToLeft() const Q_DECL_NOTHROW + Q_REQUIRED_RESULT bool isRightToLeft() const noexcept { return QtPrivate::isRightToLeft(*this); } Q_REQUIRED_RESULT Q_CORE_EXPORT int toWCharArray(wchar_t *array) const; @@ -277,24 +277,24 @@ public: // // STL compatibility API: // - Q_REQUIRED_RESULT const_iterator begin() const Q_DECL_NOTHROW { return data(); } - Q_REQUIRED_RESULT const_iterator end() const Q_DECL_NOTHROW { return data() + size(); } - Q_REQUIRED_RESULT const_iterator cbegin() const Q_DECL_NOTHROW { return begin(); } - Q_REQUIRED_RESULT const_iterator cend() const Q_DECL_NOTHROW { return end(); } - Q_REQUIRED_RESULT const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - Q_REQUIRED_RESULT const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } - Q_REQUIRED_RESULT const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return rbegin(); } - Q_REQUIRED_RESULT const_reverse_iterator crend() const Q_DECL_NOTHROW { return rend(); } - - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool empty() const Q_DECL_NOTHROW { return size() == 0; } + Q_REQUIRED_RESULT const_iterator begin() const noexcept { return data(); } + Q_REQUIRED_RESULT const_iterator end() const noexcept { return data() + size(); } + Q_REQUIRED_RESULT const_iterator cbegin() const noexcept { return begin(); } + Q_REQUIRED_RESULT const_iterator cend() const noexcept { return end(); } + Q_REQUIRED_RESULT const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + Q_REQUIRED_RESULT const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + Q_REQUIRED_RESULT const_reverse_iterator crbegin() const noexcept { return rbegin(); } + Q_REQUIRED_RESULT const_reverse_iterator crend() const noexcept { return rend(); } + + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool empty() const noexcept { return size() == 0; } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar front() const { return Q_ASSERT(!empty()), QChar(m_data[0]); } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar back() const { return Q_ASSERT(!empty()), QChar(m_data[m_size - 1]); } // // Qt compatibility API: // - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOTHROW { return !m_data; } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool isEmpty() const Q_DECL_NOTHROW { return empty(); } + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool isNull() const noexcept { return !m_data; } + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR bool isEmpty() const noexcept { return empty(); } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR int length() const /* not nothrow! */ { return Q_ASSERT(int(size()) == size()), int(size()); } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar first() const { return front(); } @@ -308,7 +308,7 @@ Q_DECLARE_TYPEINFO(QStringView, Q_PRIMITIVE_TYPE); template <typename QStringLike, typename std::enable_if< std::is_same<QStringLike, QString>::value || std::is_same<QStringLike, QStringRef>::value, bool>::type = true> -inline QStringView qToStringViewIgnoringNull(const QStringLike &s) Q_DECL_NOTHROW +inline QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept { return QStringView(s.data(), s.size()); } QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index cbc6b50c98..ef323de14a 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -317,7 +317,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); Create a null/invalid time zone instance. */ -QTimeZone::QTimeZone() Q_DECL_NOTHROW +QTimeZone::QTimeZone() noexcept : d(0) { } diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index 29d8a4dbe5..ca98986ec1 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -89,7 +89,7 @@ public: }; typedef QVector<OffsetData> OffsetDataList; - QTimeZone() Q_DECL_NOTHROW; + QTimeZone() noexcept; explicit QTimeZone(const QByteArray &ianaId); explicit QTimeZone(int offsetSeconds); /*implicit*/ QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, @@ -100,10 +100,10 @@ public: QTimeZone &operator=(const QTimeZone &other); #ifdef Q_COMPILER_RVALUE_REFS - QTimeZone &operator=(QTimeZone &&other) Q_DECL_NOTHROW { swap(other); return *this; } + QTimeZone &operator=(QTimeZone &&other) noexcept { swap(other); return *this; } #endif - void swap(QTimeZone &other) Q_DECL_NOTHROW + void swap(QTimeZone &other) noexcept { d.swap(other.d); } bool operator==(const QTimeZone &other) const; diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 24a9a00f11..b5e9286f6a 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -282,9 +282,9 @@ struct QTzTransitionRule quint8 abbreviationIndex; }; Q_DECLARE_TYPEINFO(QTzTransitionRule, Q_PRIMITIVE_TYPE); -Q_DECL_CONSTEXPR inline bool operator==(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator==(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) noexcept { return lhs.stdOffset == rhs.stdOffset && lhs.dstOffset == rhs.dstOffset && lhs.abbreviationIndex == rhs.abbreviationIndex; } -Q_DECL_CONSTEXPR inline bool operator!=(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline bool operator!=(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) noexcept { return !operator==(lhs, rhs); } class Q_AUTOTEST_EXPORT QTzTimeZonePrivate final : public QTimeZonePrivate diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index f75a61977d..6105c93a23 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -467,7 +467,7 @@ struct PosixZone static PosixZone invalid() { return {QString(), InvalidOffset}; } static PosixZone parse(const char *&pos, const char *end); - bool hasValidOffset() const Q_DECL_NOTHROW { return offset != InvalidOffset; } + bool hasValidOffset() const noexcept { return offset != InvalidOffset; } }; } // unnamed namespace diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h index 17d2ab852a..b239987871 100644 --- a/src/corelib/tools/qtools_p.h +++ b/src/corelib/tools/qtools_p.h @@ -57,17 +57,17 @@ QT_BEGIN_NAMESPACE namespace QtMiscUtils { -Q_DECL_CONSTEXPR inline char toHexUpper(uint value) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline char toHexUpper(uint value) noexcept { return "0123456789ABCDEF"[value & 0xF]; } -Q_DECL_CONSTEXPR inline char toHexLower(uint value) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline char toHexLower(uint value) noexcept { return "0123456789abcdef"[value & 0xF]; } -Q_DECL_CONSTEXPR inline int fromHex(uint c) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int fromHex(uint c) noexcept { return ((c >= '0') && (c <= '9')) ? int(c - '0') : ((c >= 'A') && (c <= 'F')) ? int(c - 'A' + 10) : @@ -75,12 +75,12 @@ Q_DECL_CONSTEXPR inline int fromHex(uint c) Q_DECL_NOTHROW /* otherwise */ -1; } -Q_DECL_CONSTEXPR inline char toOct(uint value) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline char toOct(uint value) noexcept { return '0' + char(value & 0x7); } -Q_DECL_CONSTEXPR inline int fromOct(uint c) Q_DECL_NOTHROW +Q_DECL_CONSTEXPR inline int fromOct(uint c) noexcept { return ((c >= '0') && (c <= '7')) ? int(c - '0') : -1; } @@ -98,9 +98,9 @@ struct CalculateGrowingBlockSizeResult { // implemented in qbytearray.cpp size_t Q_CORE_EXPORT Q_DECL_CONST_FUNCTION -qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize = 0) Q_DECL_NOTHROW; +qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize = 0) noexcept; CalculateGrowingBlockSizeResult Q_CORE_EXPORT Q_DECL_CONST_FUNCTION -qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize = 0) Q_DECL_NOTHROW ; +qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize = 0) noexcept ; QT_END_NAMESPACE diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp index 4c4821802d..d57b39ff1f 100644 --- a/src/corelib/tools/qunicodetables.cpp +++ b/src/corelib/tools/qunicodetables.cpp @@ -8803,42 +8803,42 @@ static const Properties uc_properties[] = { { 12, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 12, 0 } }; -Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(uint ucs4) noexcept { return uc_properties + GET_PROP_INDEX(ucs4); } -Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) noexcept { return uc_properties + GET_PROP_INDEX_UCS2(ucs2); } -Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) noexcept { return qGetProp(ucs4); } -Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW +Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) noexcept { return qGetProp(ucs2); } -Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW +Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) noexcept { return static_cast<GraphemeBreakClass>(qGetProp(ucs4)->graphemeBreakClass); } -Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW +Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) noexcept { return static_cast<WordBreakClass>(qGetProp(ucs4)->wordBreakClass); } -Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW +Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) noexcept { return static_cast<SentenceBreakClass>(qGetProp(ucs4)->sentenceBreakClass); } -Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW +Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) noexcept { return static_cast<LineBreakClass>(qGetProp(ucs4)->lineBreakClass); } diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index 3f2e91a9b2..cb7a211cb6 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -93,8 +93,8 @@ struct Properties { ushort script : 8; }; -Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) Q_DECL_NOTHROW; -Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) Q_DECL_NOTHROW; +Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) noexcept; +Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2) noexcept; struct LowercaseTraits { @@ -209,20 +209,20 @@ enum LineBreakClass { NumLineBreakClasses }; -Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) Q_DECL_NOTHROW; -inline GraphemeBreakClass graphemeBreakClass(QChar ch) Q_DECL_NOTHROW +Q_CORE_EXPORT GraphemeBreakClass QT_FASTCALL graphemeBreakClass(uint ucs4) noexcept; +inline GraphemeBreakClass graphemeBreakClass(QChar ch) noexcept { return graphemeBreakClass(ch.unicode()); } -Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) Q_DECL_NOTHROW; -inline WordBreakClass wordBreakClass(QChar ch) Q_DECL_NOTHROW +Q_CORE_EXPORT WordBreakClass QT_FASTCALL wordBreakClass(uint ucs4) noexcept; +inline WordBreakClass wordBreakClass(QChar ch) noexcept { return wordBreakClass(ch.unicode()); } -Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) Q_DECL_NOTHROW; -inline SentenceBreakClass sentenceBreakClass(QChar ch) Q_DECL_NOTHROW +Q_CORE_EXPORT SentenceBreakClass QT_FASTCALL sentenceBreakClass(uint ucs4) noexcept; +inline SentenceBreakClass sentenceBreakClass(QChar ch) noexcept { return sentenceBreakClass(ch.unicode()); } -Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) Q_DECL_NOTHROW; -inline LineBreakClass lineBreakClass(QChar ch) Q_DECL_NOTHROW +Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4) noexcept; +inline LineBreakClass lineBreakClass(QChar ch) noexcept { return lineBreakClass(ch.unicode()); } } // namespace QUnicodeTables diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 9762ec1b5b..2de21e92fa 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -65,18 +65,18 @@ class QVector Data *d; public: - inline QVector() Q_DECL_NOTHROW : d(Data::sharedNull()) { } + inline QVector() noexcept : d(Data::sharedNull()) { } explicit QVector(int size); QVector(int size, const T &t); inline QVector(const QVector<T> &v); inline ~QVector() { if (!d->ref.deref()) freeData(d); } QVector<T> &operator=(const QVector<T> &v); #if defined(Q_COMPILER_RVALUE_REFS) || defined(Q_CLANG_QDOC) - QVector(QVector<T> &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); } - QVector<T> &operator=(QVector<T> &&other) Q_DECL_NOTHROW + QVector(QVector<T> &&other) noexcept : d(other.d) { other.d = Data::sharedNull(); } + QVector<T> &operator=(QVector<T> &&other) noexcept { QVector moved(std::move(other)); swap(moved); return *this; } #endif - void swap(QVector<T> &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QVector<T> &other) noexcept { qSwap(d, other.d); } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QVector(std::initializer_list<T> args); QVector<T> &operator=(std::initializer_list<T> args); @@ -209,29 +209,29 @@ public: typedef std::reverse_iterator<const_iterator> const_reverse_iterator; #if !defined(QT_STRICT_ITERATORS) || defined(Q_CLANG_QDOC) inline iterator begin() { detach(); return d->begin(); } - inline const_iterator begin() const Q_DECL_NOTHROW { return d->constBegin(); } - inline const_iterator cbegin() const Q_DECL_NOTHROW { return d->constBegin(); } - inline const_iterator constBegin() const Q_DECL_NOTHROW { return d->constBegin(); } + inline const_iterator begin() const noexcept { return d->constBegin(); } + inline const_iterator cbegin() const noexcept { return d->constBegin(); } + inline const_iterator constBegin() const noexcept { return d->constBegin(); } inline iterator end() { detach(); return d->end(); } - inline const_iterator end() const Q_DECL_NOTHROW { return d->constEnd(); } - inline const_iterator cend() const Q_DECL_NOTHROW { return d->constEnd(); } - inline const_iterator constEnd() const Q_DECL_NOTHROW { return d->constEnd(); } + inline const_iterator end() const noexcept { return d->constEnd(); } + inline const_iterator cend() const noexcept { return d->constEnd(); } + inline const_iterator constEnd() const noexcept { return d->constEnd(); } #else inline iterator begin(iterator = iterator()) { detach(); return d->begin(); } - inline const_iterator begin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constBegin(); } - inline const_iterator cbegin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constBegin(); } - inline const_iterator constBegin(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constBegin(); } + inline const_iterator begin(const_iterator = const_iterator()) const noexcept { return d->constBegin(); } + inline const_iterator cbegin(const_iterator = const_iterator()) const noexcept { return d->constBegin(); } + inline const_iterator constBegin(const_iterator = const_iterator()) const noexcept { return d->constBegin(); } inline iterator end(iterator = iterator()) { detach(); return d->end(); } - inline const_iterator end(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constEnd(); } - inline const_iterator cend(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constEnd(); } - inline const_iterator constEnd(const_iterator = const_iterator()) const Q_DECL_NOTHROW { return d->constEnd(); } + inline const_iterator end(const_iterator = const_iterator()) const noexcept { return d->constEnd(); } + inline const_iterator cend(const_iterator = const_iterator()) const noexcept { return d->constEnd(); } + inline const_iterator constEnd(const_iterator = const_iterator()) const noexcept { return d->constEnd(); } #endif reverse_iterator rbegin() { return reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } - const_reverse_iterator rbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator rend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } - const_reverse_iterator crbegin() const Q_DECL_NOTHROW { return const_reverse_iterator(end()); } - const_reverse_iterator crend() const Q_DECL_NOTHROW { return const_reverse_iterator(begin()); } + const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); } + const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); } + const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); } iterator insert(iterator before, int n, const T &x); inline iterator insert(iterator before, const T &x) { return insert(before, 1, x); } inline iterator insert(iterator before, T &&x); diff --git a/src/corelib/tools/qversionnumber.cpp b/src/corelib/tools/qversionnumber.cpp index b96e48252e..6fcb9f50e9 100644 --- a/src/corelib/tools/qversionnumber.cpp +++ b/src/corelib/tools/qversionnumber.cpp @@ -235,7 +235,7 @@ QVersionNumber QVersionNumber::normalized() const \sa commonPrefix() */ -bool QVersionNumber::isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHROW +bool QVersionNumber::isPrefixOf(const QVersionNumber &other) const noexcept { if (segmentCount() > other.segmentCount()) return false; @@ -259,7 +259,7 @@ bool QVersionNumber::isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHRO \snippet qversionnumber/main.cpp 1 */ -int QVersionNumber::compare(const QVersionNumber &v1, const QVersionNumber &v2) Q_DECL_NOTHROW +int QVersionNumber::compare(const QVersionNumber &v1, const QVersionNumber &v2) noexcept { int commonlen; diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index 1bfb4aab39..d51947c091 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -87,7 +87,7 @@ class QVersionNumber }; // set the InlineSegmentMarker and set length to zero - SegmentStorage() Q_DECL_NOTHROW : dummy(1) {} + SegmentStorage() noexcept : dummy(1) {} SegmentStorage(const QVector<int> &seg) { @@ -120,13 +120,13 @@ class QVersionNumber } #ifdef Q_COMPILER_RVALUE_REFS - SegmentStorage(SegmentStorage &&other) Q_DECL_NOTHROW + SegmentStorage(SegmentStorage &&other) noexcept : dummy(other.dummy) { other.dummy = 1; } - SegmentStorage &operator=(SegmentStorage &&other) Q_DECL_NOTHROW + SegmentStorage &operator=(SegmentStorage &&other) noexcept { qSwap(dummy, other.dummy); return *this; @@ -153,10 +153,10 @@ class QVersionNumber ~SegmentStorage() { if (isUsingPointer()) delete pointer_segments; } - bool isUsingPointer() const Q_DECL_NOTHROW + bool isUsingPointer() const noexcept { return (inline_segments[InlineSegmentMarker] & 1) == 0; } - int size() const Q_DECL_NOTHROW + int size() const noexcept { return isUsingPointer() ? pointer_segments->size() : (inline_segments[InlineSegmentMarker] >> 1); } void setInlineSize(int len) @@ -218,7 +218,7 @@ class QVersionNumber } m_segments; public: - inline QVersionNumber() Q_DECL_NOTHROW + inline QVersionNumber() noexcept : m_segments() {} inline explicit QVersionNumber(const QVector<int> &seg) @@ -248,34 +248,34 @@ public: inline explicit QVersionNumber(int maj, int min, int mic) { m_segments.setSegments(3, maj, min, mic); } - Q_REQUIRED_RESULT inline bool isNull() const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline bool isNull() const noexcept { return segmentCount() == 0; } - Q_REQUIRED_RESULT inline bool isNormalized() const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline bool isNormalized() const noexcept { return isNull() || segmentAt(segmentCount() - 1) != 0; } - Q_REQUIRED_RESULT inline int majorVersion() const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline int majorVersion() const noexcept { return segmentAt(0); } - Q_REQUIRED_RESULT inline int minorVersion() const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline int minorVersion() const noexcept { return segmentAt(1); } - Q_REQUIRED_RESULT inline int microVersion() const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline int microVersion() const noexcept { return segmentAt(2); } Q_REQUIRED_RESULT Q_CORE_EXPORT QVersionNumber normalized() const; Q_REQUIRED_RESULT Q_CORE_EXPORT QVector<int> segments() const; - Q_REQUIRED_RESULT inline int segmentAt(int index) const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline int segmentAt(int index) const noexcept { return (m_segments.size() > index) ? m_segments.at(index) : 0; } - Q_REQUIRED_RESULT inline int segmentCount() const Q_DECL_NOTHROW + Q_REQUIRED_RESULT inline int segmentCount() const noexcept { return m_segments.size(); } - Q_REQUIRED_RESULT Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const noexcept; - Q_REQUIRED_RESULT Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) Q_DECL_NOTHROW; + Q_REQUIRED_RESULT Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) noexcept; Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2); @@ -299,22 +299,22 @@ Q_DECLARE_TYPEINFO(QVersionNumber, Q_MOVABLE_TYPE); Q_CORE_EXPORT QDebug operator<<(QDebug, const QVersionNumber &version); #endif -Q_REQUIRED_RESULT inline bool operator> (const QVersionNumber &lhs, const QVersionNumber &rhs) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool operator> (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept { return QVersionNumber::compare(lhs, rhs) > 0; } -Q_REQUIRED_RESULT inline bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept { return QVersionNumber::compare(lhs, rhs) >= 0; } -Q_REQUIRED_RESULT inline bool operator< (const QVersionNumber &lhs, const QVersionNumber &rhs) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool operator< (const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept { return QVersionNumber::compare(lhs, rhs) < 0; } -Q_REQUIRED_RESULT inline bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept { return QVersionNumber::compare(lhs, rhs) <= 0; } -Q_REQUIRED_RESULT inline bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept { return QVersionNumber::compare(lhs, rhs) == 0; } -Q_REQUIRED_RESULT inline bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs) Q_DECL_NOTHROW +Q_REQUIRED_RESULT inline bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs) noexcept { return QVersionNumber::compare(lhs, rhs) != 0; } QT_END_NAMESPACE |