summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qstring/tst_qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QString::lastIndexOf: fix off-by-one for zero length matchesGiuseppe D'Angelo2020-12-101-1/+1
| | | | | | | | | | | | Otherwise, it would report that lastIndexOf of an empty pattern in an empty string doesn't exist. Next commit adds extensive autotests; for now, disable a broken autotest (which already features a comment about why it's broken). Change-Id: I9a0e5c0142007f81f5cf93e356c8bd82f00066f7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit be83ff65c424cff1036e7da19d6175826d9f7ed9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add unit test for QString::insert(negativeint, QChar)Andreas Buhr2020-11-201-0/+1
| | | | | | | | | | | QString::insert(qsizetype, QChar) can insert at negative positions, then counting from the end of the string. Coverage analysis revealed we do not have a unit test for this. This patch adds a unit test. Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 7b0fd207756d367db768c3cb546fa439c15bbac8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add unit test for QString::replace with out-of-bounds positionAndreas Buhr2020-11-191-0/+10
| | | | | | | | | | | QString::replace(pos, len, *unicode, size) can handle positions which are outside of the this-string. In that case, it is a no-op. Coverage analysis revealed we do not have a unit test for this. This patch adds one. Change-Id: Id4a407e860fff0d5c7c0a200c379e5e3961c86d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Fix logic error in QString::replace(ch, after, cs)Andreas Buhr2020-11-191-0/+11
| | | | | | | | | | Coverage analysis showed that an if-branch marked "Q_LIKELY" was never taken. It turns out the code was incorrect, but behaved correctly. This patch fixes the logic and adds a unit test. Pick-to: 5.15 Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change QString formatting of negative numbers in non-base-10Andreas Buhr2020-11-191-0/+64
| | | | | | | | | | | | | | | | | | | For bases other than 10, negative numbers have been converted to QString by casting them to an unsigned number and converting that. Thus QString::number(-17, 16) returned "0xffffffffffffffef", for example. This patch changes the behavior so that negative numbers are converted like positive numbers. Additinally, this patch adds unit tests for QString::number. [ChangeLog][Important Behavior Changes] Changed QString::number(integer, base) for negative numbers and bases other than 10 to return the string corresponding to the absolute value, prefixed by "-". Fixes: QTBUG-53706 Change-Id: I0ad3ca3f035d553860b262f5bec17dc81714d8ac Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QChar: make construction from integral explicitGiuseppe D'Angelo2020-11-151-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QChar should not be convertible from any integral type except from char16_t, short and possibly char (since it's a direct superset). David provided the perfect example: if (str == 123) { ~~~ } compiles, with 123 implicitly converted to QChar (str == "123" was meant instead). But similarly one can construct other scenarios where QString(123) gets accidentally used (instead of QString::number(123)), like QString s; s += 123;. Add a macro to revert to the implicit constructors, for backwards compatibility. The breaks are mostly in tests that "abuse" of integers (arithmetic, etc.). Maybe it's time for user-defined literals for QChar/QString, but that is left for another commit. [ChangeLog][Potentially Source-Incompatible Changes][QChar] QChar constructors from integral types are now by default explicit. It is recommended to use explicit conversions, QLatin1Char, QChar::fromUcs4 instead of implicit conversions. The old behavior can be restored by defining the QT_IMPLICIT_QCHAR_CONSTRUCTION macro. Change-Id: I6175f6ab9bcf1956f6f97ab0c9d9d5aaf777296d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix strange capacity check in tst_QString::append_special_casesAndrei Golubev2020-10-211-1/+2
| | | | | | | | | | | We cannot rely on "QString a; a.insert(0, u'A');" to give a.capacity() >= 3, this is clearly an implementation detail. Changed the check to a meaningful one Task-number: QTBUG-87416 Change-Id: I2e017c1292d360e32b85b903361027485c08ea74 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Change QString::fromLatin1 and friends to use QByteArrayViewLars Knoll2020-10-051-19/+20
| | | | | | | | | | | | Also adjust the QString constructor from QByteArray to ignore \0 characters in the string (and not terminate conversion there). [ChangeLog][QtCore][QString] Constructing a QString from a QByteArray will not stop at intermediate '\0' (null) characters in the string as in Qt 5, but will convert all characters in the byte array. Change-Id: I1f6bfefe76dfa9072b165903fec7aa4af1abd882 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use UTF-8 when converting 8 bit data in QTextStreamLars Knoll2020-09-151-1/+9
| | | | | | | | | This was overlooked when doing the conversion to use UTF-8 as the standard 8 bit encoding for text. Fixes: QTBUG-54942 Change-Id: Ib7b1b75b4d694648ab7143f6930b6bb1dcad19c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove deprecated APILars Knoll2020-09-151-4/+4
| | | | | | | And replace it's few remaining usages Change-Id: I2dfbbaa5259acfece028606bef1e872c5692f9fe Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Purge Q_{STDLIB,COMPILER}_UNICODE_STRINGSEdward Welbourne2020-09-141-18/+2
| | | | | | | | | These were now always defined, hence redundant. Leave the #define in place so that we can verify we actually do always define it, in a #else of an existing #if check on it. Change-Id: Iea4c3dbc8f9982268bcf81da5ef17fe2ebf5c462 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove '\0' space reservation logic in QStringAndrei Golubev2020-09-101-1/+2
| | | | | | | | | Changed QString to use implicit element reserved by QArrayData Task-number: QTBUG-84320 Change-Id: If517500b3f0e71bb8d2989c64815a634aa8dd554 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use checked string iteration in case conversionsEdward Welbourne2020-08-291-0/+28
| | | | | | | | | | | | | | | | | | The Unicode table code can only be safely called on valid code-points. So code that calls it must only pass it valid Unicode data. The string iterator's Unchecked Unchecked methods only provide this guarantee when the string being iterated is guaranteed to be valid UTF-16; while client code should only use QString, QStringView and friends on valid UTF-16 data, we have no way to be sure they have respected that. So take the few extra cycles to actually check validity in the course of iterating strings, when the resulting code-points are to be passed to the Unicode table look-ups. Add tests that case mapping doesn't access Unicode tables out of range (it'll trigger the new assertion). Added some comments to qchar.h that helped me understand surrogates. Change-Id: Iec2c3106bf1a875bdaa1d622f6cf94d7007e281e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Prepend optimize QStringAndrei Golubev2020-08-291-0/+103
| | | | | | | | Added prepend optimization to QString Task-number: QTBUG-84320 Change-Id: Iaa8df790a10c56ecceb06f7143718fb94874ce76 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move QStringRef and remains to Qt5CompatKarsten Heimrich2020-08-201-428/+40
| | | | | | | | | Export some private functions from QUtf8 to resolve undefined symbols in Qt5Compat after moving QStringRef. Task-number: QTBUG-84437 Change-Id: I9046dcb14ed520d8868a511d79da6e721e26f72b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace Qt CONSTEXPR defines with constexprAllan Sandfeld Jensen2020-08-141-2/+2
| | | | | | | | Both normal and relaxed constexpr are required by our new minimum of C++17. Change-Id: Ic028b88a2e7a6cb7d5925f3133b9d54859a81744 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Implement UTF-16 to UTF-8 case-insensitive compare and make publicThiago Macieira2020-08-051-2/+28
| | | | | Change-Id: Ied637aece2a7427b8a2dfffd16116cf3645c6359 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString::vasprintf: fix 't' modifier for integers on 64-bitThiago Macieira2020-07-311-25/+35
| | | | | | | | | | | | | ‘t’ Specifies that the argument is a ‘ptrdiff_t’. This modifier was introduced in ISO C99. We use qsizetype, which is the same width as ptrdiff_t, so it makes no difference in va_arg(). Change-Id: Iea47e0f8fc8b40378df7fffd16255730109413a5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move QRegExp and its remaining mentions out of QtCoreSona Kurazyan2020-07-131-1/+1
| | | | | | Task-number: QTBUG-85235 Change-Id: Ibd6c98d952c1bb9916b64715c6430fb0d3fe3843 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QList instead of QVector in corelib testsJarek Kobus2020-07-071-17/+11
| | | | | | Task-number: QTBUG-84469 Change-Id: Ic80fde5517aed363f17d0da55cadcc958c3c8895 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port QString to qsizetypeLars Knoll2020-07-061-21/+21
| | | | | | Change-Id: Id9477ccfabadd578546bb265a9483f128efb6736 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of QArrayData::sharedNull()Lars Knoll2020-07-061-1/+1
| | | | | | | | Remove the last places where those got used and avoid allocations when we resize to 0. Change-Id: Ib553f4e7ce7cc24c31da15a55a86d18bdf1cc5c3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of shared null for QByteArray, QString and QVectorLars Knoll2020-07-061-3/+3
| | | | | | | | | | | | | | As a side effect, data() can now return a nullptr. This has the potential to cause crashes in existig code. To work around this, return an empty string from QString::data() and QByteArray::data() for now. For Qt 6 (and once all our internal issues are fixed), data() will by default return a nullptr for a null QString, but we'll offer a #define to enable backwards compatible behavior. Change-Id: I4f66d97ff1dce3eb99a239f1eab9106fa9b1741a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QByteArray's methods taking QString and their usesSona Kurazyan2020-06-251-8/+0
| | | | | | | | | | [ChangeLog][QtCore][QByteArray] Remove method overloads taking QString as argument, all of which were equivalent to passing the toUtf8() of the string instead. Change-Id: I9251733a9b3711153b2faddbbc907672a7cba190 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString: add char8_t overload of fromUtf8()Marc Mutz2020-06-231-0/+6
| | | | | | | | | | | | | Use the overload-with-template trick from P1423 to avoid ambiguities when existing callers pass 0 or nullptr. Add a qdoc-ignored macro to hide the fact that the overload is a template. [ChangeLog][QtCore][QString] Added char8_t overload of fromUtf8(). Change-Id: Iaa2d365bfa161ef36cc73fa3bad50aabf34d01db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove most overloads taking a QStringRef from the QString APILars Knoll2020-06-111-8/+0
| | | | | | | | | | Add QStringView overloads where they were missing. This keeps things almost 100% source compatible. Task-number: QTBUG-84319 Change-Id: Ica8ee773b2ce655e9597097786117959e34b236e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QStringView::split() methodsLars Knoll2020-06-011-13/+37
| | | | | | | | | | | | | Since QString::split() is not going away in Qt 6, we should aim to provide API symmetry here, and ease porting existing code from QString(Ref) to use QStringView. This is easier than having to port everything to use tokenize() at the same time. tokenize() will however lead to better performance and thus should be preferred. Change-Id: I1eb43300a90167c6e9389ab56f416f2bf7edf506 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Adjust resize() behavior of QString and QByteArray to match Qt 5Lars Knoll2020-05-211-1/+3
| | | | | | | | | | | | | resize() to a smaller size does not reallocate in Qt 5 if the container is not shared. Match this here. As a drive-by also fix resize calls on raw data strings to ensure they are null terminated after the resize. Change-Id: Ic4d8830e86ed3f247020d7ece3217cebd344ae96 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QString: fix an aliasing issue in remove(QString)Marc Mutz2020-05-151-0/+10
| | | | | | | | | | | Even in Qt 5, remove() can be passed an alias to *this. In Qt 6, with the advent of substring sharing, this will become even more pronounced. Use the same fix as was already used in QString::insert(). Pick-to: 5.15 Change-Id: I1a0d3d99fd7dff6e727661646d2cbfdc94df2682 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Enforce that statically allocated array-like containers have 0 capacityGiuseppe D'Angelo2020-05-141-0/+4
| | | | | | | | | | | | | | | | It has been the case for both QStringLiteral and QByteArrayLiteral since Qt 5.0, and Q_ARRAY_LITERAL since Qt 6.0. Since it's definitely surprising, add a note in the docs, which is "somehow" consistent with the interpretation of capacity as the biggest possible size before we reallocate. Since it's 0, any manipulation of the size will cause a reallocation. (Alternatively: the capacity() is for how many elements memory was requested from the free store. No memory was allocated, so 0...) Task-number: QTBUG-84069 Change-Id: I5c7d21a22d1bd8b8d9b71143e33d537ca0224acd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QRegExp support from QString and StringListLars Knoll2020-05-141-120/+2
| | | | | | | | | | Replacement methods do now exist in QRegExp, or for QRegularExpression when porting to it. Remove all autotests associated with the old methods. Change-Id: I3ff1e0da4b53adb64d5a48a30aecd8b960f5e633 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of some QTextCodec leftoversLars Knoll2020-05-141-2/+0
| | | | | | | There's no real dependency to QTextCodec in those files anymore. Change-Id: Ifaf19ab554fd108fa26095db4e2bd4a3e9ea427f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: remove op+=(char) and op+=(QChar::SpecialCharacter)Marc Mutz2020-05-131-2/+12
| | | | | | | | | | | | | | | | | | | The former messes in bad ways with the overload set (it, fatally, attracts char16_t, e.g.). The latter was probably added in response to ambiguities between (char) and (QChar). While it's harmless now, remove it, since it no longer pulls its weight. The no-ascii warning is now coming from QChar(char), so the protection isn't lost. [ChangeLog][QtCore][QString] The += operators taking char and QChar::SpecialCharacter have been removed as they cause adding a char16_t to QString to call the char overload, losing information. The append() function was not affected. Change-Id: I57116314bcc71c0d9476159513c0c10048239db3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Sweep of int-ish → char-ish types near calls to QString::fromU*()Marc Mutz2020-05-121-19/+19
| | | | | | | | | | | | The fromUtf16(ushort*) and fromUcs4(uint*) overloads are going to be deprecated. Use the newer fromUtf16(char16_t*) and fromUcs4(char32_t*) overloads. As a drive-by, use std::end()/std::size() where applicable. Change-Id: I5a93e38cae4a2e33d49c90d06c5f14f7cb7ce90c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove useless codeLars Knoll2020-05-011-8/+0
| | | | | | | | | We don't rely on a latin1 locale anymore for the test, and the other code was not doing anything. Change-Id: I08bc08d200c9e037884d8b680dfbb24c129f3d2e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QString: add append, op+=, prepend, insert taking QStringViewMarc Mutz2020-04-241-0/+25
| | | | | | | | | [ChangeLog][QtCore][QString] Now supports appending, prepending and inserting QStringViews. Change-Id: I7538c050c67590f27d91443eda0b94a4b80b62f2 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove QString::from/toAscii()Lars Knoll2020-04-161-29/+0
| | | | | | | These methods have been deprecated since 5.0 Change-Id: I3ceed57a364ea59a63ccc51452ab3b4da7140ce4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make QLocale(QString) explicitLars Knoll2020-04-011-2/+2
| | | | | | | | We should not implicitly convert a QString to a QLocale object. It can easily create unwanted side effects. Change-Id: I7bd9b4a4e4512c0e60176ee4d241d172f00fdc32 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-03-041-0/+3
|\ | | | | | | Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
| * Suppress warnings where QString and its tests use SplitBehaviorEdward Welbourne2020-03-031-0/+3
| | | | | | | | | | | | | | | | This is a follow-up to commit 895939c7f91d0c8424a0638c42d05cb42293a142 to fix deprecation warnings it added. Change-Id: I3d86655ec2c84c1bdcac9c70436075fc78f2f781 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-261-0/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/bearermonitor/CMakeLists.txt examples/network/CMakeLists.txt src/corelib/tools/qlinkedlist.h src/sql/kernel/qsqldriver_p.h src/sql/kernel/qsqlresult_p.h src/widgets/kernel/qwidget.cpp src/widgets/kernel/qwidget_p.h tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp tests/auto/tools/moc/allmocs_baseline_in.json Change-Id: I21a3c34570ae79ea9d30107fae71759d7eac17d9
| * Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-02-181-0/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qlinkedlist.h src/plugins/platforms/wasm/qwasmintegration.cpp src/plugins/platforms/wasm/qwasmscreen.cpp Change-Id: Iefca7f9f4966bdc20e7052aca736874861055738
| | * Only read the first BOM as a BOM; the rest are ZWNBS !Edward Welbourne2020-02-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QUtf32::convertToUnicode() was forgetting to set headerdone when it dealt with the header (for contrast, Utf16::convertToUnicode() does). Fixes: QTBUG-62011 Change-Id: Ia254782ce0967a6cf9ce0e81eb06d41521150eed Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Move old tst_QLocale::negativeZero() to tst_QString::number()Edward Welbourne2020-01-301-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | It was more complex than it needed to be and was a test of QString, not of QLocale. This leaves tst_QLocale::negativeZero() available to now test how QLocale handles negative zero. Change-Id: Ic9aae250c29f579e6d60fba8404b38673a3b489f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-01-151-40/+79
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/network/access/spdy/tst_spdy.cpp Change-Id: I3196c5f7b34f2ffc9ef1e690d02d5b9bb3270a74
| * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-01-131-40/+79
| |\| | | | | | | | | | Change-Id: I50f70a789ab1438b40d4408be72c090fa00b801f
| | * QString::isLower/isUpper: redo the implementationGiuseppe D'Angelo2020-01-111-40/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use QStringIterator rather than indexed loops. This fixes handling of non-BMP code points (which may be lower or uppercase, see the test). Change also the semantics of the functions, adopting Unicode §3.13 definitions: a string is lowercase/uppercase if it's equal to its own toLower/toUpper folding. As a side effect, empty strings are now correctly reported to be lowercase AND uppercase. [ChangeLog][Important Behavior Changes] The semantics of QString::isLower() and QString::isUpper() have been changed to match the Unicode specification. Now lowercase (resp. uppercase) strings are allowed to contain any character; a string is considered lowercase (resp. uppercase) if it's equal to its own toLower() (resp. toUpper()) folding. Previously, a non-letter character would make the string not lowercase nor uppercase, and the mere presence of an uppercase (resp. lowercase) letter would make isLower() (resp. isUpper()) return false, even if the letter wouldn't change under case folding. As a consequence, now empty strings are lowercase and uppercase. [ChangeLog][QtCore][QString] Fixed a number of bugs of QString::isLower() and QString::isUpper(). Empty strings are now correctly reported to be lowercase (resp. uppercase), and strings containing code points outside the BMP are now correctly handled. Note that the behavior of these functions has also been changed. Change-Id: Iba1398279a072399a9f21295fe75f6e414f3f813 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-01-041-0/+48
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h Make QVector(DataPointer dd) public to be able to properly merge 5b4b437b30b320e2cd7c9a566999a39772e5d431 from 5.15 into dev. src/widgets/kernel/qapplication.cpp tests/auto/tools/moc/allmocs_baseline_in.json Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
| * | Introduce QString(View)::isValidUtf16Giuseppe D'Angelo2019-12-201-0/+48
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString(View)s can be built or manipulated in ways that make them contain/refer to improperly encoded UTF-16 data. Problem is, we don't have public APIs to check whether a string contains valid UTF-16. This knowledge is precious if the string is to be fed in algorithms, regular expressions, etc. that expect validated input (e.g. QRegularExpression can be faster if it can assume valid UTF-16, otherwise it has to employ extra checks). Add a function that does the validation. [ChangeLog][QtCore][QStringView] Added QStringView::isValidUtf16. [ChangeLog][QtCore][QString] Added QString::isValidUtf16. Change-Id: Idd699183f6ec08013046c76c6a5a7c524b6c6fbc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>