summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.h
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-04-201-115/+115
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h src/corelib/tools/qdatetime.h src/corelib/tools/qstring.h src/corelib/tools/qversionnumber.h src/plugins/platforms/android/qandroidplatformintegration.cpp tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp Change-Id: Iefd92a435e687a76cd593099e40d9a9620a1454d
| * Split Q_COMPILER_UNICODE_STRINGS: add Q_STDLIB_UNICODE_STRINGSMarc Mutz2017-04-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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<char16_t>, ...). 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 <thiago.macieira@intel.com>
| * Move Q_REQUIRED_RESULT to its correct positionThiago Macieira2017-04-201-101/+101
| | | | | | | | | | | | | | | | | | | | | | 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) <ogoffart@woboq.com>
| * Don't disable Q_REQUIRED_RESULT with Clang and ICCThiago Macieira2017-04-201-1/+1
| | | | | | | | | | | | | | They're not affected by the GCC bug noted in the comment. Change-Id: I7814054a102a407d876ffffd14b69e8a8e2527f1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QLatin1String: add chopped(), chop(), and truncate()Marc Mutz2017-04-181-0/+7
| | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QLatin1String] Added chopped(), chop(), truncate(). Change-Id: I69b31aae560e94a120d7e8a36e06ea957ccd2003 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QByteArray, QString, QStringRef: Add chopped()Marc Mutz2017-04-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have two functions to get a substring without doing some calculations involving size(): - mid(p): mid(p, size() - p) - right(n) : mid(size() - n, n) (left does not involve size(), so isn't in that set). What was missing was a name for - f(n): mid(0, size() - n) As an action, it's called chop(), so call the transformation version chopped(). I made chopped(n), n < 0 or n > size(), undefined, because QString(Ref) ::left() is broken[1], while the QByteArray implementation is not. This is the only way to get consistent behavior among the three classes. I's also the correct thing to do. [1] instead of returning the empty string for negative indexes, it returns the whole string. [ChangeLog][QtCore][QString/QStringRef/QByteArray] Added chopped(n), a const version of chop(n). Change-Id: I6c2c5b16e0060fa924ced5860f21f2d0f23bd023 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* | Array-backed containers: add shrink_to_fit for STL compatibilityGiuseppe D'Angelo2017-04-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Side note: QHash has squeeze(), but there's no shrink_to_fit on std::unordered_map. [ChangeLog][QtCore][QByteArray] Added shrink_to_fit(). [ChangeLog][QtCore][QString] Added shrink_to_fit(). [ChangeLog][QtCore][QVarLengthArray] Added shrink_to_fit(). [ChangeLog][QtCore][QVector] Added shrink_to_fit(). Change-Id: Ifd7d28c9bed70727be6308f0191a188201784f61 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Mark qCompareStrings() functions pureMarc Mutz2017-04-091-4/+4
| | | | | | | | | | Change-Id: I73945aceeb1e3e2794c285ca6379bee3d94013a6 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Add front()/back() to QString, QStringRef, QByteArray and QLatin1StringMarc Mutz2017-04-071-0/+12
| | | | | | | | | | | | | | | | | | | | | | These STL-compatibility functions are present on our generic containers, but not on the string classes. [ChangeLog][QtCore][QString/QStringRef/QByteArray/QLatin1String] Added front() and back() for STL compatibility. Change-Id: I536019396b319abd1e2daf9c64ebab4e7a35b334 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add qConvertTo{Utf8,Latin1,Local8Bit,Ucs4}() and corresponding QStringView ↵Marc Mutz2017-04-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | methods Like the qt_compare_strings()/qCompareStrings() split, distinguish between the internal and exported functions. Because of the circular dependency between qstring.h and qvector.h, the inline toUcs4() function has to be in qvector.h. At some point, we need to refactor the headers so qvector.h is lower in the dependency chain than qstring.h. It's not the first time this bites. Change-Id: Ief9f3bd92c83cdd1f31c51c700f42e146916eefd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Optimize comparisons of QChar with QLatin1String, QString, and QStringRefMarc Mutz2017-04-071-3/+3
| | | | | | | | | | | | | | | | | | Instead of blindly calling the general compare function with a 1-char string, compare size() and front() to 1 and the QChar, respectively. Change-Id: I6c83c0772d16294ce6dd7eb058513d717208d6cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QString: add QStringView/QLatin1String overload of (non-multi) arg()Marc Mutz2017-04-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the new overload directly in QXmlStream*. Saves 129B in QtCore text size on optimized GCC 6.1 Linux AMD64 builds, even though we added two more functions. [ChangeLog][QtCore][QString] Added arg(QStringView), arg(QLatin1String) overloads. Change-Id: Idf7236dcab763824593f34182e4e0b16b5ed4321 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QStringView: add some relational operatorsMarc Mutz2017-03-301-0/+38
| | | | | | | | | | | | | | | | | | | | This is not the complete set, since we don't yet have qCompareStrings() for UTF-8 strings, but relational operators are so important that we need _something_ before we have _everything_. Change-Id: I213b741e5b91f09aa1f0c6c21f64d764fceb27a1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* | Long live qCompareStrings()!Marc Mutz2017-03-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These free functions are designed to solve the problem that we currently have QString::compare(QString, QString), but we have no QString::compare(QStringRef, QString), even though we have QString::compare(QStringRef). A compare(QString, QStringRef) only exists in QStringRef. This makes writing generic code tedious and error prone. Notably absent are comparisons involving char* and QByteArray. These will be added when we add QUtf8String, the UTF-8 counterpart to QLatin1String. Change-Id: I2dd7c4b1a1e0883ef0091396ee8c190012f4efba Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Long live QStringView!Marc Mutz2017-03-241-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QStringView is a simple container for (const QChar*, int) and (const char16_t*, size_t). It acts as a replacement interface type for const QString and const QStringRef, and enables passing all kinds of string-like types to functions otherwise expecting const QString& - without the need to convert to QString first. The use of this new class is guarded by a macro that enables three levels of QStringView support: 1. offer QStringView, overload some functions taking QString with QStringView 2. like 1, but remove all overloads of functions taking QStringRef, leaving only the function taking QStringView. Do this only where QStringRef overloads tradionally existed. 3. like 2, but replace functions taking QString, too. This is done in order to measure the impact of QStringView on code size and execution speed, and to help guide the decision of which level to choose for Qt 6. This first patch adds QStringView with most of its planned constructors, but not much more than iterators and isNull()/isEmpty(). Further patches will add support for QStringView to QStringBuilder, add QStringView overloads of functions taking QString, and add the complete API of const QString to QStringView. [ChangeLog][QtCore][QStringView] New class, superseding const QString and QStringRef as function parameters, accepting a wide variety of UTF-16 string data sources, e.g. u"string", std::u16string{,_view}, and, on Windows, L"string", std::wstring{,_view} without converting to QString first. Change-Id: Iac273e46b2c61ec2c31b3dacebb29500599d6898 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Use fromUtf8() instead of fromLatin1() for QT_RESTRICTED_CAST_FROM_ASCIIhjk2017-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The change does not change legally observable behavior as the result of using QT_RESTRICTED_CAST_FROM_ASCII is only defined for (a part of) the 7-bit range where Latin1 and UTF-8 are the same. This change does not intend to lift the 7-bit restriction on string literals for which the use of QT_RESTRICTED_CAST_FROM_ASCII is well-defined even though in practice it works now for any UTF-8, which is the presumed encoding outside that range nowadays. Change-Id: If9a4199235396a43f8f26d7591907b21120823ef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-201-1/+9
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
| * Deprecate QString::nullMarc Mutz2017-03-121-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a Qt 3 compatibility vehicle, and as such inherits the now-alien property to distinguish empty and null strings. Particularly worrisome is the following asymmetry: QString("") == QString::null // false QString("") == QString(QString::null) // true Instead of fixing this behavior, recognize that people might use it as a weird way to call isNull(), albeit one that once was idiomatic, and simply deprecate everything that deals with QString::null. [ChangeLog][QtCore][QString] QString::null is now deprecated. When used to construct a QString, use QString() instead. When used to compare to a QString, replace with QString::isNull(). Change-Id: I9f7e84a92522c75666da15f49324c500ae93af42 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* | Make Q_ASSERT() usable in constexpr functionsMarc Mutz2017-03-161-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need Q_ASSERT in (C++11) constexpr functions, and the only way to inject them in C++11 is to use the comma operator. E.g. in QLatin1String: constexpr QLatin1Char at(int i) const { return assert(1 >= 0), assert(i < size()), m_data[i]; } The main problem with our existing Q_ASSERT is that while it is a ternary expression in active mode, it was a statement in passive mode. This is easily fixed by dropping the do-while loop and leaving just its parenthesized exit condition. Add a cast to void, too, ensuring that Q_ASSERT has type void in both passive and active modes. But even in C++14 constexpr functions, which accept several statements, Q_ASSERT needs to have a path through its conditionals that is constexpr, but neither qt_assert(_x) nor qt_noop() are constexpr. Nor can they be in C++11 (no void returns in C++11 constexpr functions). I fixed this by replacing qt_noop() with static_cast<void>(0). The void cast is required so both 2nd and 3rd arguments to the ternary are void (mixing void and non-void branches in the ternary is only allowed if the void leg is a throw-expression[1]). As a drive-by, adjust to style guide, remove overparenthesization and reverse the conditional in the ternary. Apply it to QLatin1String where we had the problem that constexpr functions had a narrow constract. [1] should probably be extended to any [[noreturn]] void function, e.g. std::terminate(). [ChangeLog][QtCore][QtGlobal] Q_ASSERT() and Q_ASSERT_X() now always expand to expressions of type void that are usable in constexpr contexts. This makes them usable in both C++11 and C++14 constexpr functions. Change-Id: I09c396bc0034ac344cfaadc6f8cbeb1b7b0cbabc Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QLatin1String: add iteratorsMarc Mutz2017-03-071-0/+21
| | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QLatin1String] Added iterators, {c,}{r,}{begin,end}(). Change-Id: I0222a3ff44f2aa827c737e2fa3cfbb8aad69b5a7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-02-171-30/+15
|\| | | | | | | | | | | | | Conflicts: qmake/Makefile.unix Change-Id: Ia18e391198222eef34ffa2df6f683e052058d032
| * Clean up QStringLiteral definitionMarc Mutz2017-02-151-28/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We require lambda support in the compiler since Qt 5.7, so drop the guard macro. Apart from MSVC 2013, all our supported compiler also support char16_t: - VxWorks uses GCC 4.8, which supports char16_t since 4.5. - ICC supports char16_t since v12.1; we require v14+. - ONX uses a GCC which supports char16_t in the compiler, but is equipped with a stdlib that does not sport char16_t support, which is why we revoke its Q_C_UNICODE_STRINGS in qcompilerdetection.h. But we don't need stdlib support, we only need the core language feature. This is the only platform where this patch actually changes something. It removes the, rather unfair, pessimization of the platform which could have supported the static-storage- duration implementation of QStringLiteral instead of the fallback, which uses dynamic memory (QString::fromUtf8()). - GCC and Clang support char16_t since 4.5 and 3.0, resp., which is far below our minimum compiler requirements in effect since Qt 5.7. - On Windows, MSVC supports char16_t since 2015 only, and we still support 2013, but on Windows, wchar_t is the same size as char16_t, so instead of u"str" we can fall back to L"str". So simplify the implementation of QStringLiteral by assuming that all these feature are present, adding noexcept to the lambda to make noexcept() queries return true. This allows us to guarantee: [ChangeLog][QtCore] QStringLiteral is now guaranteed to be evaluated at compile-time. The last platform (QNX) to use the QString::fromUtf8() fallback has been ported to allocate the string data statically, too. Change-Id: I7920d7a77001e5c5550e7c7d57ceb7c51c9eb443 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QString(Ref): make toLatin1()/toLocal8Bit() null handling consistentMarc Mutz2017-02-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Systematic testing in tst_QStringApiSymmetry revealed a bug in QStringRef::toLatin1(): a null input did not result in a null output, but an empty one. This is fixed, for consistency with QString::toLatin1(), and QString(Ref)::toUtf8(), which behaved correctly already. The same bug was found in QString(Ref)::toLocal8Bit(), which is particularly hideous, as it's documented to fall back to toLatin1(), which preserves null inputs. Fixed, too. [ChangeLog][QtCore][QString] toLocal8Bit() now preserves nullness of the input QString (outputs null QByteArray). [ChangeLog][QtCore][QStringRef] toLocal8Bit() and toLatin1() now preserve nullness of the input QStringRef (output null QByteArrays). Change-Id: I7026211922c287e03d07e89edbad2987aa646e51 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QLatin1String: add missing isNull(), isEmpty()Marc Mutz2017-02-091-0/+3
|/ | | | | | | | | | All Qt string containers have them, so tst_qstringapisymmetry pointed out their absence. [ChangeLog][QtCore][QLatin1String] Added isEmpty(), isNull(). Change-Id: I5ed27ed036c29a7d0f041910fce6c27d9270dd26 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* qdoc: Ignore Q_COMPILER_REF_QUALIFIERS for nowMartin Smith2016-12-041-2/+2
| | | | | | | | | | | | | | | | | Q_COMPILER_REF_QUALIFIERS is not yet supported on all platforms, so clangqdoc must ignore functions that are defined only when it is defined. This change adds && !defined(Q_CLANG_QDOC) to some #if defined(Q_COMPILER_REF_QUALIFIERS) tests to allow clangqdoc to use old declarations. Note that Q_CLANG_QDOC should also be used instead of Q_QDOC from now on, so that we know that uses of Q_QDOC have been examined to see if they are still required for clangqdoc. Change-Id: I910be70df63eca09985728c7b9eba473aed141ba Reviewed-by: Martin Smith <martin.smith@qt.io>
* QStringRef: add isRightToLeft()Anton Kudryavtsev2016-10-251-0/+2
| | | | | | | | isRightToLeft() was missing in the API. Change-Id: I49bc30e4c50f5693eb613c200587acba85074f33 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QStringRef: add constBegin() and constEnd()Anton Kudryavtsev2016-10-241-0/+2
| | | | | | | | | | | These methods were missing in the API. constBegin, constEnd are the more Qt-ish names. Also it makes porting client code from QString to QStringRef easier. Change-Id: I3fce1d206073d26259fe0fa44d0f7ca718504ec3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Nitpick: fix style in QtCore codeAnton Kudryavtsev2016-10-191-2/+4
| | | | | Change-Id: I60b3539f6c8cc36e4ad6988799d3cf9c565bdb21 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-211-11/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5971b88e is not needed in new configure. This merge also reverts "fix QMAKE_DEFAULT_*DIRS resolution with apple SDK", 2c9d15d7, because it breaks iOS build with new configure system. Conflicts: mkspecs/features/default_pre.prf mkspecs/features/mac/toolchain.prf mkspecs/features/toolchain.prf src/dbus/qdbusconnection.cpp src/plugins/sqldrivers/mysql/qsql_mysql.cpp src/sql/drivers/mysql/qsql_mysql.cpp src/widgets/widgets/qmenubar.cpp src/widgets/widgets/qmenubar_p.h tools/configure/configureapp.cpp tools/configure/environment.cpp tools/configure/environment.h Change-Id: I995533dd334211ebd25912db05b639d6f908aaec
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-161-11/+12
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp Change-Id: I0af32ee55936d523cbd259b6fe82eb9c409f9074
| | * Suppress ICC warning #111 about unreachable code in toWCharArrayThiago Macieira2016-09-151-0/+1
| | | | | | | | | | | | | | | | | | | | | qstring.h(961): warning #111: statement is unreachable Change-Id: I33dc971f005a4848bb8ffffd14748ae03dadefc9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * QLatin1String: Fix UB (nullptr passed) in relational operatorsMarc Mutz2016-09-151-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by UBSan: qstring.h:1160:44: runtime error: null pointer passed as argument 1, which is declared to never be null qstring.h:1160:44: runtime error: null pointer passed as argument 2, which is declared to never be null Fix by avoiding the memcmp() calls if there's a chance that they might be called with nullptr. While at it, also implement !=, >, <=, >= in terms of ==, <, and add a test, because this particular UB was not fingered by any of the QtCore test cases, but by a Qt3D one. Change-Id: I413792dcc8431ef14f0c79f26e89a3e9fab69465 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Nitpick: fix style in QtCore code added since 5.7Thiago Macieira2016-09-151-1/+2
| | | | | | | | | | | | | | | | | | Change-Id: I9093948278414644a416fffd147400f99fc9f844 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-07-191-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakebuiltins.cpp qmake/library/qmakeevaluator.cpp qmake/library/qmakeevaluator.h qmake/project.h QMakeEvaluator: * evaluateConditional(): one side changed return type, the other changed a parameter type. * split_value_list(): one side changed a parameter adjacent to where ... * expandVariableReferences(): ... the other killed one overload and changed the survivor src/corelib/io/qlockfile_unix.cpp One side changed a #if condition, the other moved NETBSD's part of what it controlled. src/corelib/tools/qdatetime.cpp One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the other moved it from the private class to the public one, in the midst of the "short date-time" optimization, which confused diff entirely. One side changed a QStringLiteral to QLatin1String, the other rewrote adjoining code. src/network/kernel/qauthenticator.cpp Both rewrote a line, equivalently; kept the dev version. src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h One side changed #if-ery that the other removed. tools/configure/configureapp.cpp One side added a check to -target parsing; the other killed -target. tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml tests/auto/testlib/selftests/expected_cmptest.xunitxml Regenerated using generate_expected_output.py I note that quite a few other expected_* come out changed, now. There was no git-conflict in src/widgets/kernel/qformlayout.cpp but it didn't compile; one side removed some unused methods; the other found uses for one of them. Put FixedColumnMatrix<>::removeRow(int) back for its new user. Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
| * | Remove (private) QString::expand(), port to (new) QString::resize(int, QChar)Marc Mutz2016-07-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We cannot really remove the function, since it's called from inline code (QCharRef::op=(QChar)), but we can schedule it for removal in Qt 6, and inline it into existing in-tree callers. Change-Id: I3499f101dcb5ae908726b3673bf3526a04408db6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QStringRef: add chop()Anton Kudryavtsev2016-07-071-0/+6
| | | | | | | | | | | | | | | | | | | | | chop() was missing in the API. Change-Id: I15af86c8f218cf159b8ce19bbeb2ffa6201f98cf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QString: add some missing overloaded operator+Anton Kudryavtsev2016-06-291-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | to keep compatibility with and without using QT_USE_QSTRINGBUILDER. Change-Id: If8218fe0693cdb7ad1250beb272e0e7c356bbf4a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QStringRef: add missing relational operators against QByteArrayMarc Mutz2016-06-081-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QStringRef op QByteArray was ambiguous between bool QStringRef::operator op(const char*) const bool operator op(const QStringRef&, const QString&) QByteArray op QStringRef was ambiguous between bool operator op(const QString&, const QStringRef&) bool operator op(const char*, const QStringRef&) Fix by providing more overloads. [ChangeLog][QtCore] Disambiguated the relational operators comparing QByteArray with QStringRef (and vice versa). Change-Id: I1cfa9ecfdd8b4102e652593faf35f6098289bc34 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QString: fix QChar <> QLatin1String relational operators for non-US-ASCIIMarc Mutz2016-06-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation used the QString::compare_helper(QChar*, int, char*, int) overload, which, however, interprets the rhs as a UTF-8 sequence, not as Latin-1. Fix by using the (QChar*, int, QLatin1String) overload. Extend the test to cover this case, too. Change-Id: I59b26d63d0caec036b80ef8818c75d0cebe519d2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Properly forward-declare the Apple types with Q_QDOCOlivier Goffart2016-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | They are needed for the header to be parsed properly with clang based qdoc. While we are at it, change the condition from Q_OS_MAC to Q_OS_DARWIN Change-Id: I2a2f9c1159f47795d9811023d67c86fec1866846 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | darwin: Simplify conversion function declarations in headersTor Arne Vestbø2016-05-031-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to include Q_QDOC in the forward-declarations of the native types, and Q_FORWARD_DECLARE_OBJC_CLASS works in non-Objective-C mode as well, which means we can declare the Objective-C versions of the functions without guards. Change-Id: I32089c496b4f7ce47f0388ba3f65e0b091d1e9ee Reviewed-by: Martin Smith <martin.smith@theqtcompany.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-111-11/+17
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
| * | QStringRef: add missing {c,}r{begin,end}()Marc Mutz2016-04-071-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most containers have them in Qt 5.7, so add them to QStringRef, too. Brush up the docs, use the const_iterator typedef in the API, for consistency with QString's docs. [ChangeLog][QtCore][QStringRef] Added reverse iterators, rbegin(), rend(), crbegin(), crend(). Change-Id: I3d2884a1b2faae02c610ab3871552b65bc6e2521 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-071-6/+6
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qftp.cpp src/widgets/itemviews/qheaderview.cpp src/widgets/itemviews/qlistview.cpp tests/auto/network/access/qftp/tst_qftp.cpp Change-Id: I9f928f25d45d8944dd60bb583f649fc1615bc5d9
| | * QStringRef: fix some QStringRef <> const char * relational operatorsMarc Mutz2016-04-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Their implementations were swapped. Found while extending tst_qstringapisymmetry, which only exists in dev, so test will be added to dev once this change has merged up. [ChangeLog][QtCore][QStringRef] Fixed relational operators against (const char*) to return the correct result. Change-Id: I3f331037571b9a543a6885802836b768143d1c1a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | | QChar: optimize comparison with QString{,Ref}Marc Mutz2016-04-051-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of relying on the QString relational operators to implicitly convert the QChar to a QString, add relational operator overloads that compare the QChar without first turning it into a QString, saving one memory allocation per comparison, and allowing to mark the operation as nothrow. Consequently, in tst_QStringBinOps, verify now that all relational operations are noexcept. The added overloads make QChar ==/!= int comparisons ambiguous. De-ambiguate by providing a constrained template that matches int and nothing but int (otherwise, the QChar and the int versions would compete for a QChar::SpecialCharacter argument, and end up creating new ambiguities). This solution may not be perfect, but it can be easily extended should more ambiguities crop up. The existing overload deals with all patterns found in qtbase. Change-Id: I4156d918e9b9134c1da684b8b69e0ee526ad24e3 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | QChar: add missing relational operators against QLatin1String/QStringRefMarc Mutz2016-04-051-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For QChar <> QStringRef, equality and inequality were already provided (via QChar -> QString implicit conversions, to be fixed in a separate patch). Missing were the less/greater than (or equal) operators. Added. For QChar <> QLatin1String, all relational operators were missing. Added, too. [ChangeLog][QtCore][QChar] Added missing operator{<,>,<=,>=} comparing against QLatin1String and QStringRef. [ChangeLog][QtCore][QChar] Added missing operator{==,!=} comparing against QLatin1String. Change-Id: I9941fe7e7281ea560b3bd5970cb9651ffadc1495 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Mark declaration of QString::compare(QStringRef, Qt::CaseSensitivity) inline.Friedemann Kleint2016-03-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes MinGW errors: qstring.h:1597:12: error: 'int QString::compare(const QStringRef&, Qt::CaseSensitivity) const' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW Amends changes 8005fa3524916a56a555f44d4418eb1cd12db645, 4e07ded04c0ca7ea62121786664bb564d0f7974e Change-Id: I5ec296258a8ea9f38b8a8d7b7d44066b7f103c37 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Forward declare the Objective C types for the documentation.Olivier Goffart2016-03-181-2/+2
| | | | | | | | | | | | | | | | | | | | | Required for clang doc parsing. Change-Id: Ia00717377e9524efae1266d1a01b2ef0e064b11e Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* | | QString: Reorder inline functions.Friedemann Kleint2016-03-171-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure the compiler knows the definition of QString::compare(QStringRef, Qt::CaseSensitivity) from where it is referenced. Fixes MinGW errors: qstring.h:1597:12: error: 'int QString::compare(const QStringRef&, Qt::CaseSensitivity) const' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW Amends change 8005fa3524916a56a555f44d4418eb1cd12db645. Change-Id: I3bb31a79305d338c0abdfdcb365e281443b4546e Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>