From 872bff5b24ded4a5dfecad96df907f32830a980a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 31 Oct 2016 16:07:53 -0700 Subject: Enable a given SIMD feature if the compiler has enabled it Change-Id: I09100678ff4443e6be06fffd1482c08125adc0a4 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/tools/qsimd_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index f6164e2297..d5d887598e 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -169,7 +169,7 @@ || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \ && !defined(QT_BOOTSTRAPPED) # define QT_COMPILER_SUPPORTS_SIMD_ALWAYS -# define QT_COMPILER_SUPPORTS_HERE(x) QT_COMPILER_SUPPORTS(x) +# define QT_COMPILER_SUPPORTS_HERE(x) (__ ## x ## __) || QT_COMPILER_SUPPORTS(x) # if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) /* GCC requires attributes for a function */ # define QT_FUNCTION_TARGET(x) __attribute__((__target__(QT_FUNCTION_TARGET_STRING_ ## x))) -- cgit v1.2.3 From f497dea73080c2d8910bd5b6d74c9a6226db0c92 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 27 Mar 2017 13:19:15 +0200 Subject: Doc: Clarify the porting notes from QRegExp to QRegularExpression Add a small table to illustrate the results exactMatch() and split out the part on partial matching to a separate section since it is less common. Change-Id: Ifbd5c3cbd1d8c0ee9e8b2d58ed13f40776b03762 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Leena Miettinen --- src/corelib/tools/qregularexpression.cpp | 35 ++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index f1fac093b0..88b696f53a 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -445,19 +445,25 @@ QT_BEGIN_NAMESPACE Other differences are outlined below. - \section2 Exact matching + \section2 Porting from QRegExp::exactMatch() QRegExp::exactMatch() in Qt 4 served two purposes: it exactly matched a regular expression against a subject string, and it implemented partial - matching. In fact, if an exact match was not found, one could still find - out how much of the subject string was matched by the regular expression - by calling QRegExp::matchedLength(). If the returned length was equal - to the subject string's length, then one could desume that a partial match - was found. + matching. - QRegularExpression supports partial matching explicitly by means of the - appropriate MatchType. If instead you simply want to be sure that the - subject string matches the regular expression exactly, you can wrap the + \section3 Porting from QRegExp's Exact Matching + + Exact matching indicates whether the regular expression matches the entire + subject string. For example, the classes yield on the subject string \c{"abc123"}: + + \table + \header \li \li QRegExp::exactMatch() \li QRegularExpressionMatch::hasMatch() + \row \li \c{"\\d+"} \li \b false \li \b true + \row \li \c{"[a-z]+\\d+"} \li \b true \li \b true + \endtable + + Exact matching is not reflected in QRegularExpression. If you want to be + sure that the subject string matches the regular expression exactly, you can wrap the pattern between a couple of anchoring expressions. Simply putting the pattern between the \c{^} and the \c{$} anchors is enough in most cases: @@ -479,6 +485,17 @@ QT_BEGIN_NAMESPACE Note the usage of the non-capturing group in order to preserve the meaning of the branch operator inside the pattern. + \section3 Porting from QRegExp's Partial Matching + + When using QRegExp::exactMatch(), if an exact match was not found, one + could still find out how much of the subject string was matched by the + regular expression by calling QRegExp::matchedLength(). If the returned length + was equal to the subject string's length, then one could conclude that a partial + match was found. + + QRegularExpression supports partial matching explicitly by means of the + appropriate MatchType. + \section2 Global matching Due to limitations of the QRegExp API it was impossible to implement global -- cgit v1.2.3 From 75cdf654bcc192ba73a8834e507583a59140e7e4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 7 Apr 2017 13:12:05 -0700 Subject: QMap: fix UB (invalid cast) in QMapData::end() The end() pointer, like in all other containers, is a sentinel value that must never be dereferenced. But unlike array-based containers, end() in QMap is not "last element plus one", but points to a base class of Node, not a full Node. Therefore, the casting from QMapNodeBase to QMapNode must not be a static_cast, reinterpret_cast is required. libstdc++-v3's red-black tree had the exact same problem: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60734 Change-Id: I43f05fedf0b44314a2dafffd14b33697861ae589 Reviewed-by: Marc Mutz --- src/corelib/tools/qmap.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 3f4f034b4e..da77ba4458 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -209,8 +209,10 @@ struct QMapData : public QMapDataBase Node *root() const { return static_cast(header.left); } - const Node *end() const { return static_cast(&header); } - Node *end() { return static_cast(&header); } + // using reinterpret_cast because QMapDataBase::header is not + // actually a QMapNode. + const Node *end() const { return reinterpret_cast(&header); } + Node *end() { return reinterpret_cast(&header); } const Node *begin() const { if (root()) return static_cast(mostLeftNode); return end(); } Node *begin() { if (root()) return static_cast(mostLeftNode); return end(); } -- cgit v1.2.3 From d5f62f7bc7895815546cd2f6be9605486907018d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 10 Apr 2017 08:37:08 -0700 Subject: Ask MS runtime to reload the timezone details if they've changed POSIX documents that localtime() ensures that tzset() has been called, but the wording could be understood to mean that it only needs to do so the first time. Anyway, we're sure that the MS runtime only gets the timezone information from the Control Panel once. That means Qt-based applications will not react to a change in the timezone. Attempt to do that by moving tzset() out of the #if, to apply to all operating systems. Task-number: QTBUG-60043 Change-Id: I6ab535fb61094af19fc1fffd14b413541fe5a64c Reviewed-by: Edward Welbourne --- src/corelib/tools/qdatetime.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index a4a7aabacb..bcdbc5af2a 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2287,10 +2287,11 @@ static bool qt_localtime(qint64 msecsSinceEpoch, QDate *localDate, QTime *localT tm local; bool valid = false; -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // localtime() is required to work as if tzset() was called before it. // localtime_r() does not have this requirement, so make an explicit call. + // The explicit call should also request the timezone info be re-parsed. qt_tzset(); +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // Use the reentrant version of localtime() where available // as is thread-safe and doesn't use a shared static data area tm *res = 0; -- cgit v1.2.3 From 11ed95ac9c12ee2b20b5c6f6be68d0b6387c0e70 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 30 Mar 2017 19:13:58 +0200 Subject: Improve QStringBuilder docs - Mention you can build QByteArrays, too - Nicer list of types that can be used, separate for QByteArray and QString Change-Id: Ia91445f0cb4872bab12a55f4812c283e9c38dba4 Reviewed-by: Edward Welbourne Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qstringbuilder.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index de12de19cb..70152a9202 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE \reentrant \since 4.6 - \brief The QStringBuilder class is a template class that provides a facility to build up QStrings from smaller chunks. + \brief The QStringBuilder class is a template class that provides a facility to build up QStrings and QByteArrays from smaller chunks. \ingroup tools \ingroup shared @@ -58,22 +58,34 @@ QT_BEGIN_NAMESPACE To build a QString by multiple concatenations, QString::operator+() - is typically used. This causes \e{n - 1} reallocations when building - a string from \e{n} chunks. + is typically used. This causes \e{n - 1} allocations when building + a string from \e{n} chunks. The same is true for QByteArray. QStringBuilder uses expression templates to collect the individual chunks, compute the total size, allocate the required amount of - memory for the final QString object, and copy the chunks into the + memory for the final string object, and copy the chunks into the allocated memory. The QStringBuilder class is not to be used explicitly in user code. Instances of the class are created as return values of the - operator%() function, acting on objects of type QString, - QLatin1String, QStringRef, QChar, QCharRef, - QLatin1Char, and \c char. + operator%() function, acting on objects of the following types: + + For building QStrings: + + \li QString, QStringRef, + \li QChar, QCharRef, QLatin1Char, + \li QLatin1String, + \li QByteArray, \c char, \c{const char[]}. + + The types in the last list point are only available when + QT_NO_CAST_FROM_ASCII is not defined. + + For building QByteArrays: + + \li QByteArray, \c char, \c{const char[]}. Concatenating strings with operator%() generally yields better - performance then using \c QString::operator+() on the same chunks + performance than using \c QString::operator+() on the same chunks if there are three or more of them, and performs equally well in other cases. -- cgit v1.2.3 From feaaca456b1b9f5f6ba84f0aa3cb7e93dfb862cf Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 12 Apr 2017 14:12:10 +0100 Subject: QLocale: do not test for Q_OS_MAC before including qglobal.h Found by clazy. Change-Id: I66b6698c309720891db83626e18c5e1baca19091 Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index c183224c82..c23c84534f 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -38,13 +38,13 @@ ** ****************************************************************************/ +#include "qglobal.h" + #if !defined(QWS) && defined(Q_OS_MAC) # include "private/qcore_mac_p.h" # include #endif -#include "qglobal.h" - #include "qplatformdefs.h" #include "qdatastream.h" -- cgit v1.2.3 From 3bea9450e90a6c8db1554faa5b467186e63b31a0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 31 Oct 2016 16:07:53 -0700 Subject: Update the Clang support for SIMD code generation Clang 3.8 has support for __attribute__((target(xxx))) and its SIMD headers can be included unconditionally. Change-Id: Ic15b7ff417c8412893e5fffd14b5b42b950b48d7 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/tools/qsimd_p.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index d5d887598e..28253b3ae9 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -166,10 +166,11 @@ # define __MIPS_DSPR2__ # endif #elif (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \ - || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \ + || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && Q_CC_GNU >= 409) \ + || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 308)) \ && !defined(QT_BOOTSTRAPPED) # define QT_COMPILER_SUPPORTS_SIMD_ALWAYS -# define QT_COMPILER_SUPPORTS_HERE(x) (__ ## x ## __) || QT_COMPILER_SUPPORTS(x) +# define QT_COMPILER_SUPPORTS_HERE(x) ((__ ## x ## __) || QT_COMPILER_SUPPORTS(x)) # if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) /* GCC requires attributes for a function */ # define QT_FUNCTION_TARGET(x) __attribute__((__target__(QT_FUNCTION_TARGET_STRING_ ## x))) -- cgit v1.2.3 From d1210281e41008ce2e3510aa5cfb3ebea1c57734 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Mon, 17 Apr 2017 00:35:38 +0300 Subject: Fix undefined behavior in QSharedPointer::create() Initialize a deleter for a new object, created by QSharedPointer::create(), only after the object is actually constructed. [ChangeLog][QtCore][QSharedPointer] Fixed undefined behavior when creating an object with QSharedPointer::create() and its conscructor throws an exception. Task-number: QTBUG-49824 Change-Id: I07f77a78ff468d9b45b8ef133278e8cdd96a0647 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qsharedpointer_impl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 5738413bfb..373fc3a662 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -260,6 +260,7 @@ namespace QtSharedPointer { internalSafetyCheckRemove(self); deleter(self); } + static void noDeleter(ExternalRefCountData *) { } static inline ExternalRefCountData *create(T **ptr, DestroyerFn destroy) { @@ -433,11 +434,13 @@ public: # else typename Private::DestroyerFn destroy = &Private::deleter; # endif + typename Private::DestroyerFn noDestroy = &Private::noDeleter; QSharedPointer result(Qt::Uninitialized); - result.d = Private::create(&result.value, destroy); + result.d = Private::create(&result.value, noDestroy); // now initialize the data new (result.data()) T(std::forward(arguments)...); + result.d->destroyer = destroy; result.d->setQObjectShared(result.value, true); # ifdef QT_SHAREDPOINTER_TRACK_POINTERS internalSafetyCheckAdd(result.d, result.value); -- cgit v1.2.3 From 870964895baadd013570d626d9e8ebc9d57fee94 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 18 Apr 2017 15:30:44 -0700 Subject: Don't disable Q_REQUIRED_RESULT with Clang and ICC They're not affected by the GCC bug noted in the comment. Change-Id: I7814054a102a407d876ffffd14b69e8a8e2527f1 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qbytearray.h | 2 +- src/corelib/tools/qstring.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 06a50e5990..a0e5c5478b 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -243,7 +243,7 @@ public: void chop(int n); #if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC) -# if defined(Q_CC_GNU) +# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) // required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941 # pragma push_macro("Q_REQUIRED_RESULT") # undef Q_REQUIRED_RESULT diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 1bd436c387..09a3bcb521 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -383,7 +383,7 @@ public: QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT; #if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC) -# if defined(Q_CC_GNU) +# if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) // required due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941 # pragma push_macro("Q_REQUIRED_RESULT") # undef Q_REQUIRED_RESULT -- cgit v1.2.3 From 3dcc075f4a5efce348a6fa00cf5a0adef97b1089 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 18 Apr 2017 16:22:46 -0700 Subject: Move Q_REQUIRED_RESULT to its correct position That's before the return type or static, inline, constexpr or such keywords (if any). Perl Script: s/^(\s+)(.*) Q_REQUIRED_RESULT(;)?(\s*\/\/.*)?$/\1Q_REQUIRED_RESULT \2\3\4/ Change-Id: I7814054a102a407d876ffffd14b6a16182f159e2 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qarraydata.h | 14 +-- src/corelib/tools/qarraydatapointer.h | 2 +- src/corelib/tools/qbytearray.h | 56 ++++----- src/corelib/tools/qdatetime.h | 20 ++-- src/corelib/tools/qline.h | 18 +-- src/corelib/tools/qpoint.h | 6 +- src/corelib/tools/qrect.h | 46 ++++---- src/corelib/tools/qsize.h | 26 ++--- src/corelib/tools/qstring.h | 202 ++++++++++++++++----------------- src/corelib/tools/qtimezoneprivate_p.h | 4 +- src/corelib/tools/qversionnumber.h | 28 ++--- 11 files changed, 210 insertions(+), 212 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index bc20932cca..88f0cfb0ea 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -112,12 +112,10 @@ struct Q_CORE_EXPORT QArrayData return result; } - static QArrayData *allocate(size_t objectSize, size_t alignment, - size_t capacity, AllocationOptions options = Default) - Q_DECL_NOTHROW Q_REQUIRED_RESULT; - static QArrayData *reallocateUnaligned(QArrayData *data, size_t objectSize, - size_t newCapacity, AllocationOptions newOptions = Default) - Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT static QArrayData *allocate(size_t objectSize, size_t alignment, + size_t capacity, AllocationOptions options = Default) Q_DECL_NOTHROW; + Q_REQUIRED_RESULT static QArrayData *reallocateUnaligned(QArrayData *data, size_t objectSize, + size_t newCapacity, AllocationOptions newOptions = Default) Q_DECL_NOTHROW; static void deallocate(QArrayData *data, size_t objectSize, size_t alignment) Q_DECL_NOTHROW; @@ -217,8 +215,8 @@ struct QTypedArrayData class AlignmentDummy { QArrayData header; T data; }; - static QTypedArrayData *allocate(size_t capacity, - AllocationOptions options = Default) Q_REQUIRED_RESULT + Q_REQUIRED_RESULT static QTypedArrayData *allocate(size_t capacity, + AllocationOptions options = Default) { Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData)); return static_cast(QArrayData::allocate(sizeof(T), diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index b97dde5a61..51cfa6e849 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -174,7 +174,7 @@ public: } private: - Data *clone(QArrayData::AllocationOptions options) const Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Data *clone(QArrayData::AllocationOptions options) const { Data *x = Data::allocate(d->detachCapacity(d->size), options); Q_CHECK_PTR(x); diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index a0e5c5478b..03bb9b5747 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -227,9 +227,9 @@ public: int count(const char *a) const; int count(const QByteArray &a) const; - QByteArray left(int len) const Q_REQUIRED_RESULT; - QByteArray right(int len) const Q_REQUIRED_RESULT; - QByteArray mid(int index, int len = -1) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QByteArray left(int len) const; + Q_REQUIRED_RESULT QByteArray right(int len) const; + Q_REQUIRED_RESULT QByteArray mid(int index, int len = -1) const; bool startsWith(const QByteArray &a) const; bool startsWith(char c) const; @@ -250,34 +250,34 @@ public: # define Q_REQUIRED_RESULT # define Q_REQUIRED_RESULT_pushed # endif - Q_ALWAYS_INLINE QByteArray toLower() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() const & { return toLower_helper(*this); } - Q_ALWAYS_INLINE QByteArray toLower() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toLower() && { return toLower_helper(*this); } - Q_ALWAYS_INLINE QByteArray toUpper() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() const & { return toUpper_helper(*this); } - Q_ALWAYS_INLINE QByteArray toUpper() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray toUpper() && { return toUpper_helper(*this); } - Q_ALWAYS_INLINE QByteArray trimmed() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() const & { return trimmed_helper(*this); } - Q_ALWAYS_INLINE QByteArray trimmed() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray trimmed() && { return trimmed_helper(*this); } - Q_ALWAYS_INLINE QByteArray simplified() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() const & { return simplified_helper(*this); } - Q_ALWAYS_INLINE QByteArray simplified() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QByteArray simplified() && { return simplified_helper(*this); } # ifdef Q_REQUIRED_RESULT_pushed # pragma pop_macro("Q_REQUIRED_RESULT") # endif #else - QByteArray toLower() const Q_REQUIRED_RESULT; - QByteArray toUpper() const Q_REQUIRED_RESULT; - QByteArray trimmed() const Q_REQUIRED_RESULT; - QByteArray simplified() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QByteArray toLower() const; + Q_REQUIRED_RESULT QByteArray toUpper() const; + Q_REQUIRED_RESULT QByteArray trimmed() const; + Q_REQUIRED_RESULT QByteArray simplified() const; #endif - QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const Q_REQUIRED_RESULT; - QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QByteArray leftJustified(int width, char fill = ' ', bool truncate = false) const; + Q_REQUIRED_RESULT QByteArray rightJustified(int width, char fill = ' ', bool truncate = false) const; QByteArray &prepend(char c); QByteArray &prepend(int count, char c); @@ -312,7 +312,7 @@ public: QList split(char sep) const; - QByteArray repeated(int times) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QByteArray repeated(int times) const; #ifndef QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARN QByteArray &append(const QString &s); @@ -362,16 +362,16 @@ public: QByteArray &setNum(double, char f = 'g', int prec = 6); QByteArray &setRawData(const char *a, uint n); // ### Qt 6: use an int - static QByteArray number(int, int base = 10) Q_REQUIRED_RESULT; - static QByteArray number(uint, int base = 10) Q_REQUIRED_RESULT; - static QByteArray number(qlonglong, int base = 10) Q_REQUIRED_RESULT; - static QByteArray number(qulonglong, int base = 10) Q_REQUIRED_RESULT; - static QByteArray number(double, char f = 'g', int prec = 6) Q_REQUIRED_RESULT; - static QByteArray fromRawData(const char *, int size) Q_REQUIRED_RESULT; - static QByteArray fromBase64(const QByteArray &base64, Base64Options options) Q_REQUIRED_RESULT; - static QByteArray fromBase64(const QByteArray &base64) Q_REQUIRED_RESULT; // ### Qt6 merge with previous - static QByteArray fromHex(const QByteArray &hexEncoded) Q_REQUIRED_RESULT; - static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%') Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT static QByteArray number(int, int base = 10); + Q_REQUIRED_RESULT static QByteArray number(uint, int base = 10); + Q_REQUIRED_RESULT static QByteArray number(qlonglong, int base = 10); + Q_REQUIRED_RESULT static QByteArray number(qulonglong, int base = 10); + Q_REQUIRED_RESULT static QByteArray number(double, char f = 'g', int prec = 6); + Q_REQUIRED_RESULT static QByteArray fromRawData(const char *, int size); + Q_REQUIRED_RESULT static QByteArray fromBase64(const QByteArray &base64, Base64Options options); + Q_REQUIRED_RESULT static QByteArray fromBase64(const QByteArray &base64); // ### Qt6 merge with previous + Q_REQUIRED_RESULT static QByteArray fromHex(const QByteArray &hexEncoded); + Q_REQUIRED_RESULT static QByteArray fromPercentEncoding(const QByteArray &pctEncoded, char percent = '%'); #if defined(Q_OS_DARWIN) || defined(Q_QDOC) static QByteArray fromCFData(CFDataRef data); diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index c7f14ed40a..2518dc7301 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -103,9 +103,9 @@ QT_DEPRECATED inline bool setYMD(int y, int m, int d) #endif // < Qt 6 void getDate(int *year, int *month, int *day) const; - QDate addDays(qint64 days) const Q_REQUIRED_RESULT; - QDate addMonths(int months) const Q_REQUIRED_RESULT; - QDate addYears(int years) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QDate addDays(qint64 days) const; + Q_REQUIRED_RESULT QDate addMonths(int months) const; + Q_REQUIRED_RESULT QDate addYears(int years) const; qint64 daysTo(const QDate &) const; Q_DECL_CONSTEXPR bool operator==(const QDate &other) const { return jd == other.jd; } @@ -166,9 +166,9 @@ public: #endif bool setHMS(int h, int m, int s, int ms = 0); - QTime addSecs(int secs) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QTime addSecs(int secs) const; int secsTo(const QTime &) const; - QTime addMSecs(int ms) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QTime addMSecs(int ms) const; int msecsTo(const QTime &) const; Q_DECL_CONSTEXPR bool operator==(const QTime &other) const { return mds == other.mds; } @@ -297,11 +297,11 @@ public: QString toString(Qt::DateFormat f = Qt::TextDate) const; QString toString(const QString &format) const; #endif - QDateTime addDays(qint64 days) const Q_REQUIRED_RESULT; - QDateTime addMonths(int months) const Q_REQUIRED_RESULT; - QDateTime addYears(int years) const Q_REQUIRED_RESULT; - QDateTime addSecs(qint64 secs) const Q_REQUIRED_RESULT; - QDateTime addMSecs(qint64 msecs) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QDateTime addDays(qint64 days) const; + Q_REQUIRED_RESULT QDateTime addMonths(int months) const; + Q_REQUIRED_RESULT QDateTime addYears(int years) const; + Q_REQUIRED_RESULT QDateTime addSecs(qint64 secs) const; + Q_REQUIRED_RESULT QDateTime addMSecs(qint64 msecs) const; QDateTime toTimeSpec(Qt::TimeSpec spec) const; inline QDateTime toLocalTime() const { return toTimeSpec(Qt::LocalTime); } diff --git a/src/corelib/tools/qline.h b/src/corelib/tools/qline.h index 5b5ca3b4c8..6361c1af9f 100644 --- a/src/corelib/tools/qline.h +++ b/src/corelib/tools/qline.h @@ -73,10 +73,10 @@ public: inline void translate(const QPoint &p); inline void translate(int dx, int dy); - Q_DECL_CONSTEXPR inline QLine translated(const QPoint &p) const Q_REQUIRED_RESULT; - Q_DECL_CONSTEXPR inline QLine translated(int dx, int dy) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLine translated(const QPoint &p) const; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLine translated(int dx, int dy) const; - Q_DECL_CONSTEXPR inline QPoint center() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QPoint center() const; inline void setP1(const QPoint &p1); inline void setP2(const QPoint &p2); @@ -221,7 +221,7 @@ public: Q_DECL_CONSTEXPR inline QLineF(qreal x1, qreal y1, qreal x2, qreal y2); Q_DECL_CONSTEXPR inline QLineF(const QLine &line) : pt1(line.p1()), pt2(line.p2()) { } - static QLineF fromPolar(qreal length, qreal angle) Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT static QLineF fromPolar(qreal length, qreal angle); Q_DECL_CONSTEXPR bool isNull() const; @@ -245,8 +245,8 @@ public: qreal angleTo(const QLineF &l) const; - QLineF unitVector() const Q_REQUIRED_RESULT; - Q_DECL_CONSTEXPR inline QLineF normalVector() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QLineF unitVector() const; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF normalVector() const; // ### Qt 6: rename intersects() or intersection() and rename IntersectType IntersectionType IntersectType intersect(const QLineF &l, QPointF *intersectionPoint) const; @@ -257,10 +257,10 @@ public: inline void translate(const QPointF &p); inline void translate(qreal dx, qreal dy); - Q_DECL_CONSTEXPR inline QLineF translated(const QPointF &p) const Q_REQUIRED_RESULT; - Q_DECL_CONSTEXPR inline QLineF translated(qreal dx, qreal dy) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF translated(const QPointF &p) const; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QLineF translated(qreal dx, qreal dy) const; - Q_DECL_CONSTEXPR inline QPointF center() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QPointF center() const; inline void setP1(const QPointF &p1); inline void setP2(const QPointF &p2); diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index 7b1004897a..0f3e0c3517 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) - CGPoint toCGPoint() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT CGPoint toCGPoint() const Q_DECL_NOTHROW; #endif private: @@ -256,8 +256,8 @@ public: Q_DECL_CONSTEXPR QPoint toPoint() const; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - static QPointF fromCGPoint(CGPoint point) Q_DECL_NOTHROW Q_REQUIRED_RESULT; - CGPoint toCGPoint() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT static QPointF fromCGPoint(CGPoint point) Q_DECL_NOTHROW; + Q_REQUIRED_RESULT CGPoint toCGPoint() const Q_DECL_NOTHROW; #endif private: diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index 4030cccbd5..19ff87b420 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -70,7 +70,7 @@ public: 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; - QRect normalized() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; @@ -104,9 +104,9 @@ public: 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_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_REQUIRED_RESULT; + 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; @@ -118,7 +118,7 @@ public: 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_DECL_CONSTEXPR inline QRect adjusted(int x1, int y1, int x2, int y2) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; @@ -136,8 +136,8 @@ public: 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; - inline QRect united(const QRect &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; - inline QRect intersected(const QRect &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; @@ -146,15 +146,15 @@ public: Q_DECL_RELAXED_CONSTEXPR inline QRect &operator-=(const QMargins &margins) Q_DECL_NOTHROW; #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED QRect unite(const QRect &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return united(r); } - QT_DEPRECATED QRect intersect(const QRect &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return intersected(r); } + 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); } #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; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - CGRect toCGRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT CGRect toCGRect() const Q_DECL_NOTHROW; #endif private: @@ -520,7 +520,7 @@ public: 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; - QRectF normalized() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; } @@ -560,10 +560,10 @@ public: 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_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_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_DECL_CONSTEXPR inline QRectF transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; @@ -575,7 +575,7 @@ public: 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_DECL_CONSTEXPR inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; @@ -592,8 +592,8 @@ public: 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; - inline QRectF united(const QRectF &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; - inline QRectF intersected(const QRectF &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; @@ -602,19 +602,19 @@ public: Q_DECL_RELAXED_CONSTEXPR inline QRectF &operator-=(const QMarginsF &margins) Q_DECL_NOTHROW; #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED QRectF unite(const QRectF &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return united(r); } - QT_DEPRECATED QRectF intersect(const QRectF &r) const Q_DECL_NOTHROW Q_REQUIRED_RESULT { return intersected(r); } + 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); } #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; - Q_DECL_CONSTEXPR inline QRect toRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; - QRect toAlignedRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline QRect toRect() const Q_DECL_NOTHROW; + Q_REQUIRED_RESULT QRect toAlignedRect() const Q_DECL_NOTHROW; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - static QRectF fromCGRect(CGRect rect) Q_DECL_NOTHROW Q_REQUIRED_RESULT; - CGRect toCGRect() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT static QRectF fromCGRect(CGRect rect) Q_DECL_NOTHROW; + Q_REQUIRED_RESULT CGRect toCGRect() const Q_DECL_NOTHROW; #endif private: diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h index cd5f8adbf5..bb29dca7c4 100644 --- a/src/corelib/tools/qsize.h +++ b/src/corelib/tools/qsize.h @@ -64,15 +64,15 @@ public: 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_DECL_CONSTEXPR inline QSize transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; - 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_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_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_REQUIRED_RESULT; + 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; @@ -91,7 +91,7 @@ public: friend inline const QSize operator/(const QSize &, qreal); #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT CGSize toCGSize() const Q_DECL_NOTHROW; #endif private: @@ -228,15 +228,15 @@ public: 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_DECL_CONSTEXPR inline QSizeF transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + 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; - 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_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_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_REQUIRED_RESULT; + 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; @@ -257,8 +257,8 @@ public: Q_DECL_CONSTEXPR inline QSize toSize() const Q_DECL_NOTHROW; #if defined(Q_OS_DARWIN) || defined(Q_QDOC) - static QSizeF fromCGSize(CGSize size) Q_DECL_NOTHROW Q_REQUIRED_RESULT; - CGSize toCGSize() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT static QSizeF fromCGSize(CGSize size) Q_DECL_NOTHROW; + Q_REQUIRED_RESULT CGSize toCGSize() const Q_DECL_NOTHROW; #endif private: diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 09a3bcb521..f81a58813d 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -261,47 +261,47 @@ public: const QChar operator[](uint i) const; QCharRef operator[](uint i); - QString arg(qlonglong a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(qulonglong a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(long a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(ulong a, int fieldwidth=0, int base=10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(int a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(uint a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(short a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(ushort a, int fieldWidth = 0, int base = 10, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(char a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(QChar a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(const QString &a, int fieldWidth = 0, - QChar fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2, const QString &a3) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2, const QString &a3, - const QString &a4) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2, const QString &a3, - const QString &a4, const QString &a5) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2, const QString &a3, - const QString &a4, const QString &a5, const QString &a6) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2, const QString &a3, + Q_REQUIRED_RESULT QString arg(qlonglong a, int fieldwidth=0, int base=10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(qulonglong a, int fieldwidth=0, int base=10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(long a, int fieldwidth=0, int base=10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(ulong a, int fieldwidth=0, int base=10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(int a, int fieldWidth = 0, int base = 10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(uint a, int fieldWidth = 0, int base = 10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(short a, int fieldWidth = 0, int base = 10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(ushort a, int fieldWidth = 0, int base = 10, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(char a, int fieldWidth = 0, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(QChar a, int fieldWidth = 0, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(const QString &a, int fieldWidth = 0, + QChar fillChar = QLatin1Char(' ')) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a4, const QString &a5, const QString &a6) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3, const QString &a4, const QString &a5, const QString &a6, - const QString &a7) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a7) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3, const QString &a4, const QString &a5, const QString &a6, - const QString &a7, const QString &a8) const Q_REQUIRED_RESULT; - QString arg(const QString &a1, const QString &a2, const QString &a3, + const QString &a7, const QString &a8) const; + Q_REQUIRED_RESULT QString arg(const QString &a1, const QString &a2, const QString &a3, const QString &a4, const QString &a5, const QString &a6, - const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT; + const QString &a7, const QString &a8, const QString &a9) const; QString &vsprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(2, 0); QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3); @@ -363,12 +363,12 @@ public: #ifndef QT_NO_REGULAREXPRESSION QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const; #endif - QString left(int n) const Q_REQUIRED_RESULT; - QString right(int n) const Q_REQUIRED_RESULT; - QString mid(int position, int n = -1) const Q_REQUIRED_RESULT; - QStringRef leftRef(int n) const Q_REQUIRED_RESULT; - QStringRef rightRef(int n) const Q_REQUIRED_RESULT; - QStringRef midRef(int position, int n = -1) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QString left(int n) const; + Q_REQUIRED_RESULT QString right(int n) const; + Q_REQUIRED_RESULT QString mid(int position, int n = -1) const; + Q_REQUIRED_RESULT QStringRef leftRef(int n) const; + Q_REQUIRED_RESULT QStringRef rightRef(int n) const; + Q_REQUIRED_RESULT QStringRef midRef(int position, int n = -1) const; bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool startsWith(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; @@ -379,8 +379,8 @@ public: bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool endsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; - QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT; - QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const; + Q_REQUIRED_RESULT QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const; #if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC) # if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) @@ -390,37 +390,37 @@ public: # define Q_REQUIRED_RESULT # define Q_REQUIRED_RESULT_pushed # endif - Q_ALWAYS_INLINE QString toLower() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() const & { return toLower_helper(*this); } - Q_ALWAYS_INLINE QString toLower() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toLower() && { return toLower_helper(*this); } - Q_ALWAYS_INLINE QString toUpper() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() const & { return toUpper_helper(*this); } - Q_ALWAYS_INLINE QString toUpper() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toUpper() && { return toUpper_helper(*this); } - Q_ALWAYS_INLINE QString toCaseFolded() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() const & { return toCaseFolded_helper(*this); } - Q_ALWAYS_INLINE QString toCaseFolded() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString toCaseFolded() && { return toCaseFolded_helper(*this); } - Q_ALWAYS_INLINE QString trimmed() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() const & { return trimmed_helper(*this); } - Q_ALWAYS_INLINE QString trimmed() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString trimmed() && { return trimmed_helper(*this); } - Q_ALWAYS_INLINE QString simplified() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() const & { return simplified_helper(*this); } - Q_ALWAYS_INLINE QString simplified() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT Q_ALWAYS_INLINE QString simplified() && { return simplified_helper(*this); } # ifdef Q_REQUIRED_RESULT_pushed # pragma pop_macro("Q_REQUIRED_RESULT") # endif #else - QString toLower() const Q_REQUIRED_RESULT; - QString toUpper() const Q_REQUIRED_RESULT; - QString toCaseFolded() const Q_REQUIRED_RESULT; - QString trimmed() const Q_REQUIRED_RESULT; - QString simplified() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QString toLower() const; + Q_REQUIRED_RESULT QString toUpper() const; + Q_REQUIRED_RESULT QString toCaseFolded() const; + Q_REQUIRED_RESULT QString trimmed() const; + Q_REQUIRED_RESULT QString simplified() const; #endif - QString toHtmlEscaped() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QString toHtmlEscaped() const; QString &insert(int i, QChar c); QString &insert(int i, const QChar *uc, int len); @@ -479,21 +479,21 @@ public: enum SplitBehavior { KeepEmptyParts, SkipEmptyParts }; - QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; - QVector splitRef(const QString &sep, SplitBehavior behavior = KeepEmptyParts, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; - QStringList split(QChar sep, SplitBehavior behavior = KeepEmptyParts, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; - QVector splitRef(QChar sep, SplitBehavior behavior = KeepEmptyParts, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + Q_REQUIRED_RESULT QVector splitRef(const QString &sep, SplitBehavior behavior = KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + Q_REQUIRED_RESULT QStringList split(QChar sep, SplitBehavior behavior = KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + Q_REQUIRED_RESULT QVector splitRef(QChar sep, SplitBehavior behavior = KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; #ifndef QT_NO_REGEXP - QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; - QVector splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const; + Q_REQUIRED_RESULT QVector splitRef(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const; #endif #ifndef QT_NO_REGULAREXPRESSION - QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; - QVector splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const; + Q_REQUIRED_RESULT QVector splitRef(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const; #endif enum NormalizationForm { NormalizationForm_D, @@ -501,31 +501,31 @@ public: NormalizationForm_KD, NormalizationForm_KC }; - QString normalized(NormalizationForm mode, QChar::UnicodeVersion version = QChar::Unicode_Unassigned) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QString normalized(NormalizationForm mode, QChar::UnicodeVersion version = QChar::Unicode_Unassigned) const; - QString repeated(int times) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QString repeated(int times) const; const ushort *utf16() const; #if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QSTRING_COMPAT_CPP) && !defined(Q_CLANG_QDOC) - QByteArray toLatin1() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QByteArray toLatin1() const & { return toLatin1_helper(*this); } - QByteArray toLatin1() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QByteArray toLatin1() && { return toLatin1_helper_inplace(*this); } - QByteArray toUtf8() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QByteArray toUtf8() const & { return toUtf8_helper(*this); } - QByteArray toUtf8() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QByteArray toUtf8() && { return toUtf8_helper(*this); } - QByteArray toLocal8Bit() const & Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QByteArray toLocal8Bit() const & { return toLocal8Bit_helper(isNull() ? nullptr : constData(), size()); } - QByteArray toLocal8Bit() && Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QByteArray toLocal8Bit() && { return toLocal8Bit_helper(isNull() ? nullptr : constData(), size()); } #else - QByteArray toLatin1() const Q_REQUIRED_RESULT; - QByteArray toUtf8() const Q_REQUIRED_RESULT; - QByteArray toLocal8Bit() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QByteArray toLatin1() const; + Q_REQUIRED_RESULT QByteArray toUtf8() const; + Q_REQUIRED_RESULT QByteArray toLocal8Bit() const; #endif - QVector toUcs4() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QVector toUcs4() const; // note - this are all inline so we can benefit from strlen() compile time optimizations static inline QString fromLatin1(const char *str, int size = -1) @@ -563,12 +563,12 @@ public: { return fromLatin1(str, size); } QT_DEPRECATED static inline QString fromAscii(const QByteArray &str) { return fromLatin1(str); } - QByteArray toAscii() const Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QByteArray toAscii() const { return toLatin1(); } #endif inline int toWCharArray(wchar_t *array) const; - static inline QString fromWCharArray(const wchar_t *string, int size = -1) Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT static inline QString fromWCharArray(const wchar_t *string, int size = -1); QString &setRawData(const QChar *unicode, int size); QString &setUnicode(const QChar *unicode, int size); @@ -1425,14 +1425,14 @@ public: int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; int count(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; - QVector split(const QString &sep, QString::SplitBehavior behavior = QString::KeepEmptyParts, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; - QVector split(QChar sep, QString::SplitBehavior behavior = QString::KeepEmptyParts, - Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QVector split(const QString &sep, QString::SplitBehavior behavior = QString::KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + Q_REQUIRED_RESULT QVector split(QChar sep, QString::SplitBehavior behavior = QString::KeepEmptyParts, + Qt::CaseSensitivity cs = Qt::CaseSensitive) const; - QStringRef left(int n) const Q_REQUIRED_RESULT; - QStringRef right(int n) const Q_REQUIRED_RESULT; - QStringRef mid(int pos, int n = -1) const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QStringRef left(int n) const; + Q_REQUIRED_RESULT QStringRef right(int n) const; + Q_REQUIRED_RESULT QStringRef mid(int pos, int n = -1) const; void truncate(int pos) Q_DECL_NOTHROW { m_size = qBound(0, pos, m_size); } void chop(int n) Q_DECL_NOTHROW @@ -1478,13 +1478,13 @@ public: inline const_reverse_iterator crend() const { return rend(); } #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED QByteArray toAscii() const Q_REQUIRED_RESULT + Q_REQUIRED_RESULT QT_DEPRECATED QByteArray toAscii() const { return toLatin1(); } #endif - QByteArray toLatin1() const Q_REQUIRED_RESULT; - QByteArray toUtf8() const Q_REQUIRED_RESULT; - QByteArray toLocal8Bit() const Q_REQUIRED_RESULT; - QVector toUcs4() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QByteArray toLatin1() const; + Q_REQUIRED_RESULT QByteArray toUtf8() const; + Q_REQUIRED_RESULT QByteArray toLocal8Bit() const; + Q_REQUIRED_RESULT QVector toUcs4() const; inline void clear() { m_string = Q_NULLPTR; m_position = m_size = 0; } QString toString() const; @@ -1526,7 +1526,7 @@ public: static int localeAwareCompare(const QStringRef &s1, const QString &s2); static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2); - QStringRef trimmed() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT QStringRef trimmed() const; short toShort(bool *ok = Q_NULLPTR, int base = 10) const; ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const; int toInt(bool *ok = Q_NULLPTR, int base = 10) const; diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 0038908160..74b79dce16 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -154,12 +154,12 @@ public: QLocale::Country country); // returns "UTC" QString and QByteArray - static inline QString utcQString() Q_REQUIRED_RESULT + Q_REQUIRED_RESULT static inline QString utcQString() { return QStringLiteral("UTC"); } - static inline QByteArray utcQByteArray() Q_REQUIRED_RESULT + Q_REQUIRED_RESULT static inline QByteArray utcQByteArray() { return QByteArrayLiteral("UTC"); } diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index 2aaa6201f7..d3cf743a67 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -248,39 +248,39 @@ public: inline explicit QVersionNumber(int maj, int min, int mic) { m_segments.setSegments(3, maj, min, mic); } - inline bool isNull() const Q_DECL_NOTHROW Q_REQUIRED_RESULT + Q_REQUIRED_RESULT inline bool isNull() const Q_DECL_NOTHROW { return segmentCount() == 0; } - inline bool isNormalized() const Q_DECL_NOTHROW Q_REQUIRED_RESULT + Q_REQUIRED_RESULT inline bool isNormalized() const Q_DECL_NOTHROW { return isNull() || segmentAt(segmentCount() - 1) != 0; } - inline int majorVersion() const Q_DECL_NOTHROW Q_REQUIRED_RESULT + Q_REQUIRED_RESULT inline int majorVersion() const Q_DECL_NOTHROW { return segmentAt(0); } - inline int minorVersion() const Q_DECL_NOTHROW Q_REQUIRED_RESULT + Q_REQUIRED_RESULT inline int minorVersion() const Q_DECL_NOTHROW { return segmentAt(1); } - inline int microVersion() const Q_DECL_NOTHROW Q_REQUIRED_RESULT + Q_REQUIRED_RESULT inline int microVersion() const Q_DECL_NOTHROW { return segmentAt(2); } - Q_CORE_EXPORT QVersionNumber normalized() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_CORE_EXPORT QVersionNumber normalized() const; - Q_CORE_EXPORT QVector segments() const Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_CORE_EXPORT QVector segments() const; - inline int segmentAt(int index) const Q_DECL_NOTHROW Q_REQUIRED_RESULT + Q_REQUIRED_RESULT inline int segmentAt(int index) const Q_DECL_NOTHROW { return (m_segments.size() > index) ? m_segments.at(index) : 0; } - inline int segmentCount() const Q_DECL_NOTHROW Q_REQUIRED_RESULT + Q_REQUIRED_RESULT inline int segmentCount() const Q_DECL_NOTHROW { return m_segments.size(); } - Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_CORE_EXPORT bool isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHROW; - Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_CORE_EXPORT static int compare(const QVersionNumber &v1, const QVersionNumber &v2) Q_DECL_NOTHROW; - Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2) Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2); - Q_CORE_EXPORT QString toString() const Q_REQUIRED_RESULT; - Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR) Q_REQUIRED_RESULT; + Q_REQUIRED_RESULT Q_CORE_EXPORT QString toString() const; + Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR); private: #ifndef QT_NO_DATASTREAM -- cgit v1.2.3 From 126c4eae84fee0e5bc4e9c6db167d92e87b7f612 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 30 Mar 2017 19:49:32 +0200 Subject: Split Q_COMPILER_UNICODE_STRINGS: add Q_STDLIB_UNICODE_STRINGS Since commit bf2160e72cd8840a8e604438cbdc807483ac980a, we can rely on charNN_t support in all compilers except MSVC 2013, and since that commit, we use (in 5.10, not 5.9, yet) !defined(Q_OS_WIN) || defined(Q_COMPILER_UNICODE_STRINGS) when we only need charNN_t, the type, as opposed to its library support (u16string, char_traits, ...). This patch splits the Q_C_UNICODE_STRINGS macro into two, adding Q_STDLIB_UNICODE_STRINGS for when we need std::uNNstring, leaving Q_C_UNICODE_STRINGS for when we need just charNN_t support. In QDebug, when constructing a QChar out of a char16_t, cast to ushort first, since QChar(char16_t) was only officially introduced in Qt 5.10. [ChangeLog][Potentially Source-Incompatible Changes] The internal Q_COMPILER_UNICODE_STRINGS macro is now defined if the compiler supports charNN_t, even if the standard library does not. To check for availability of std::uNNstring, use the new Q_STDLIB_UNICODE_STRINGS macro. Change-Id: I8f210fd7f1799fe21faf54506475a759b1f76a59 Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index f81a58813d..109b68c544 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -756,7 +756,7 @@ public: static inline QString fromStdWString(const std::wstring &s); inline std::wstring toStdWString() const; -#if defined(Q_COMPILER_UNICODE_STRINGS) || defined(Q_QDOC) +#if defined(Q_STDLIB_UNICODE_STRINGS) || defined(Q_QDOC) static inline QString fromStdU16String(const std::u16string &s); inline std::u16string toStdU16String() const; static inline QString fromStdU32String(const std::u32string &s); @@ -1339,7 +1339,7 @@ inline std::wstring QString::toStdWString() const inline QString QString::fromStdWString(const std::wstring &s) { return fromWCharArray(s.data(), int(s.size())); } -#if defined(Q_COMPILER_UNICODE_STRINGS) +#if defined(Q_STDLIB_UNICODE_STRINGS) inline QString QString::fromStdU16String(const std::u16string &s) { return fromUtf16(s.data(), int(s.size())); } -- cgit v1.2.3