summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring/tst_qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| | * Revert "QString: preserve embedded NULs when converting from QByteArray"Marc Mutz2016-01-121-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit e486d69133178ccce7c75cf48201ab28efb20e44. It broke too many users, even though all of them deserved to be broken. The new functionality will be provided by differently-named functions, where possible (problem: equality operators). I did not revert the fix for the off-by-one error in tst_qtextdocumentfragment.cpp. I also didn't revert the change in the inequality relational operators, since for all strings s1, s2 and s2' where s2' is s2 truncated at the first NUL, s1 < s2 ⟺ s1 < s2' (since NUL < c for any c != 0), and, trivially, for ≤, >, ≥, too. This does not hold for = and ≠, of course, since "foo\0bar" ≠ "foo". [ChangeLog][Important Behavior Changes][EDITORIAL] Reverted: All conversions from QByteArray to QString now preserve embedded NULs... Change-Id: If4b47048b39ae5be6ed08e6d91809626a67ea7f5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Updated license headersJani Heikkinen2016-01-211-17/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QString: add resize(int, QChar)Marc Mutz2015-12-281-0/+17
| | | | | | | | | | | | | | | | | | | | This will be used in QTextStream to speed up padding processing. [ChangeLog][QtCore][QString] Added resize(int, QChar) overload. Change-Id: Id51f8cdacb167310157100b05cacf20e9a5d2716 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-181-0/+66
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/painting.pri src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro tests/auto/corelib/tools/qlocale/test/test.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp tools/configure/environment.cpp Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
| * QString: where possible, re-use existing capacity in op(QChar/QL1S)Marc Mutz2015-12-081-0/+66
| | | | | | | | | | | | | | | | | | If the LHS is detached and has existing capacity that is large enough to hold the RHS, re-use the memory instead of allocating a new buffer and throwing away the old. Change-Id: I53d42825da92c264c7301e8e771cba9fb35c321b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Long live qUtf16Printable()Marc Mutz2015-11-211-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString::asprintf() has the ability to take a ushort* array as obtained from QString::utf16() and insert that into the output with an %ls conversion. But no-one ever used this, because just passing QString::utf16() to QString::asprintf() creates a warning about wchar_t* expected, but ushort* provided. The new qUtf16Printable() macro adds the necessary casts (via void* to prevent any "type-punned pointer" warnings) to make passing QString::utf16() to QString::asprintf() work silently. This should greatly reduce the need to do a round-trip via utf-8 just to print the contents of a QString. [ChangeLog][QtCore] Added qUtf16Printable(). Change-Id: I7ddd8d2b2a2191c9faa26aca95d49850d94b287c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | tst_QString: add checks for sprintf's %lsMarc Mutz2015-11-201-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... at the cost of a bunch of warnings about ushort*/wchar_t*. It wasn't checked at all, which isn't really a solution, either. Split off the %s checks into a separate function, which makes obvious the sorry state of sprintf non-%s, non-%d testing that's left. Change-Id: I6312f984bacfb568b609e34b5218b3ab9a9765c4 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-11-181-0/+16
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/network/kernel/qnetworkinterface_winrt.cpp tools/configure/configureapp.cpp Change-Id: I47df00a01597d2e63b334b492b3b4221b29f58ea
| * QString: Fix in-place toUpper/Lower when there's size expansionThiago Macieira2015-11-181-0/+16
| | | | | | | | | | | | | | | | | | | | When that happens, we need to detach (in-place conversion won't work), so we recurse back into the same function, but the template version that does detaching. Task-number: QTBUG-49181 Change-Id: Idba8c29717f34c70a58fffff1412fea3acc95f98 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Replace qdtoa and qstrtod implementation by a 3rdparty libraryUlf Hermann2015-11-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes the underlying cause of QTBUG-44039 and QTBUG-43885. You can choose between system, qt, and no libdouble-conversion support. If you choose "no", snprintf_l and sscanf_l will be used. By default, system double conversion is used if the system provides a double-conversion library. Otherwise the bundled libdouble-conversion is built. sscanf_l and snprintf_l are not used by default as the planned "shortest" conversion mode to produce the shortest possible string will give less precise results when implemented with snprintf_l. Change-Id: I8ca08a0fca5c54cf7009e48e771385614f6aa031 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | tst_qstring: Enable previously disabled test for Q_CC_MINGW.Friedemann Kleint2015-10-271-6/+0
| | | | | | | | | | | | | | gcc 4.8 now supports all printf()-formats. Change-Id: Idead5ff77c3825c642615eceed110c1252869e90 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-231-1/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf configure src/corelib/global/qglobal.h src/tools/qdoc/node.cpp src/tools/qdoc/qdocdatabase.cpp tests/auto/corelib/io/qsettings/tst_qsettings.cpp tools/configure/configureapp.cpp Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
| * The C locale should omit group separators by defaultLars Knoll2015-10-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Numbers formatted in the C locale should not use group separators by default. [ChangeLog][QtCore][QLocale] The C locale does not use group separators when formatting numbers any more. Task-number: QTBUG-4044 Task-number: QTBUG-3068 Change-Id: Ia647a72efc11fecd66d22f9253562b1d4ef58168 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | tests/auto/corelib: Remove some placeholder formatting.Friedemann Kleint2015-10-221-1/+1
| | | | | | | | | | | | | | | | Use QByteArray/QString addition instead in loops and for test row names. Change-Id: Ieffb429efdc14aa5932b3fcdef5a18e13a62d35f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-0/+16
|\| | | | | | | | | | | | | | | | | Conflicts: tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/io/qprocess/tst_qprocess.cpp tests/auto/corelib/tools/qversionnumber/qversionnumber.pro Change-Id: Ia93ce500349d96a2fbf0b4a37b73f088cc505c6e
| * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-0/+16
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| | * Fix comparisons between QByteArray and QString.Christian Kandeler2015-09-281-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | QByteArray::operator< and friends had their logic reversed. Task-number: QTBUG-48350 Change-Id: I625209cc922b47e78dfb8de9fe100411f285a628 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Tests: Use QCOMPARE() with QLatin1String() for QString values.Friedemann Kleint2015-10-141-196/+197
| | | | | | | | | | | | | | | | | | | | | Prefer QCOMPARE over QVERIFY for equality and use QLatin1String(). Change-Id: If226a0fc7b25be3e6774c7e36ca1e6f99234e5dd Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | Tests: Fix single-character string literals.Friedemann Kleint2015-10-131-1/+1
|/ / | | | | | | | | | | | | Use character literals where applicable. Change-Id: I1a026c320079ee5ca6f70be835d5a541deee2dd1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QString: add {const_,reverse_iterator}, {c,}r{begin,end}()Marc Mutz2015-07-071-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | Had to mark {,c,const}{begin,end}() inline, since they are, and mingw complains about inconsistent dllimport attributes. [ChangeLog][QtCore][QString] Added rbegin(), crbegin(), rend(), crend(), and reverse_iterator and const_reverse_iterator typedefs. Task-number: QTBUG-25919 Change-Id: I1d48729c76e510c1e49c0e5dc41691aa662fdf21 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * Replace MAC OS X with OS XNico Vertriest2015-06-301-1/+1
| | | | | | | | | | | | Task-number: QTBUG-46374 Change-Id: I7bc633ab551740bd328a24b0ccae1d534af47138 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | Add missing QString::prepend(QStringRef)/(const QChar*,int) overloadsMarc Mutz2015-04-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | QString::append(QStringRef) exists, and so should prepend(). QString::append(const QChar *,int) exists, and so should prepend(). [ChangeLog][QtCore][QString] Added prepend(QStringRef) and prepent(const QChar *, int) overloads. Change-Id: I3eca41045f7c481be473507e23e92690f3ed7ba3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Add QString::insert() overloads for QStringRef, const char*, QByteArrayMarc Mutz2015-04-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | The corresponding QString::append() overloads exists, and so should insert(). [ChangeLog][QtCore][QString] Added insert(int, QStringRef), insert(int, const char*) and insert(int, QByteArray). Change-Id: I1cf43fe8908319e2a57415945718b72e69ca0fb3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | tst_QString: refactor the op+= testsMarc Mutz2015-04-021-4/+29
| | | | | | | | | | | | | | ... using the framework developed for testing QString::append. Change-Id: I29011eba6438bf9b3daad354cbec4b8e2b98ed81 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | tst_QString: refactor the insert testsMarc Mutz2015-04-021-2/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is tedious to test all the overloads of QString::insert, so get the help of the compiler to do it. The framework was originally developed for testing append. This change showed that the insert(int, QStringRef), insert(int, const char*) and insert(int, QByteArray) overloads were missing. They will be added in a separate commit. Change-Id: I609b8a05203f8a1ea12827d1798313ace5b719f2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | tst_QString: refactor the prepend testsMarc Mutz2015-04-021-10/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | It is tedious to test all the overloads of QString::prepend, so get the help of the compiler to do it. The framework was originally developed for testing append. This change showed that prepend(QStringRef) and prepend(const QChar*, int) overloads were missing. They will be added in a separate commit. Change-Id: Ic3d6ad011bedc6ee7d5024094d7c3529b1b9d669 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | tst_QString: refactor the append testsMarc Mutz2015-04-021-12/+203
| | | | | | | | | | | | | | | | | | | | It is tedious to test all the overloads of QString::append(), so get the help of the compiler to do it. The framework developed for this will be used in subsequent commits for prepend and insert, too. Change-Id: I89df581b6d037a5af80b34dd6b5d37ac7484c774 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString: preserve embedded NULs when converting from QByteArrayMarc Mutz2015-04-021-37/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unearthed an off-by-one error in a QByteArray::fromRawData() call in tst_qtextdocumentfragment. Fixed by porting to QStringLiteral. [ChangeLog][Important Behavior Changes] All conversions from QByteArray to QString now preserve embedded NULs. This is done in order to provide a faster conversion from QByteArray to QString that does not involve a call to strlen. If you need the old behavior, convert from QByteArray::constData() instead. If you are porting from Qt 4, we suggest to make your source compile with QT_NO_CAST_FROM_BYTEARRAY before porting to Qt 5. Change-Id: Ibca40f503920fee6f3a5f0d74a04b38b8849796f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString::from{Utf8,Latin1,Local8Bit}(QByteArray): preserve nullness of argumentMarc Mutz2015-04-021-0/+30
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, calling these functions with a null QByteArray will return a non-null QString because QByteArray::data() never returns nullptr. This behavior leads to inconsistencies between QString::append overloads, in particular the QByteArray vs. all others (null + null test always returns a null QString, except for the QByteArray overload before this change). It also is inconsistent with the const char* overloads of these methods, which explicitly preserve nullness (as verified by test cases). Fixed by an explicit check for nullness and return of null QString. Alternative would have been to check for nullness and pass nullptr instead of ba.data() to the _helper() functions, which do the correct thing in that case. But since we'd have the check anyway and with the chosen strategy we can avoid a call to a non-inline method, I opted against that. [ChangeLog][QtCore][QString] fromLatin1(), fromAscii(), fromUtf8() and fromLocal8Bit() now return a null QString when called with a null QByteArray. Change-Id: I5f2c0bad27fb73c7d535085af0271823bf6ed1da Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Track modifications of white space in QString::simplified().Friedemann Kleint2015-03-121-0/+2
| | | | | | | | | | The existing check fails to detect the case where white space characters other than the space character are replaced by space characters without the length actually changing and returns the original string. Task-number: QTBUG-44936 Change-Id: Ice6faa975f8b41f185c76f6d0d4ff81603e25eb3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStringAlgorithms::simplified_helper: add missing check for detachedThiago Macieira2015-03-071-0/+9
| | | | | | | | Otherwise, we modify shared strings that happened to be rvalues. Task-number: QTBUG-44706 Change-Id: Ia0aac2f09e9245339951ffff13c85bfc912f03d1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Remove support for QT_QLOCALE_USES_FCVT.Erik Verbruggen2015-01-281-2/+0
| | | | | | | We expect floating-point math to be IEEE754 compliant. Change-Id: I2b257177f2ef5fce38ac4d8fd76f746dc7b9fc15 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add conversion functions for C++11 u16string and u32stringAllan Sandfeld Jensen2015-01-241-0/+23
| | | | | | | | | | | The patch adds convenience functions for working on C++11's new char width specific unicode strings u16string and u32string. [ChangeLog][QtCore][QString] Added methods for convenient conversion to and from std::u16string and std::u32string. Change-Id: I67c082e4755c592d61daaaaa70c8867ef0b23dcb Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Remove duplicated NAN/INF logic from tst_qstringAllan Sandfeld Jensen2015-01-211-72/+3
| | | | | | | | | | Qt already has solutions for cross platform isnan and isinf logic. We should use that instead of duplicating it. This should also fix compiling tst_qstring on MinGW with C++11. Change-Id: I7b691fd47701a8f07e1a1fe08a95a0aca43ccca1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Use the new warning enabling/disabling macros in qtbaseThiago Macieira2014-12-031-7/+3
| | | | | | Change-Id: I91ff06644e8047c2ca483f9768b46c1372eb6171 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-241-0/+22
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
| * Fix QString::section() behavior on negative and out-of-range indexesAlex Trotsenko2014-11-201-0/+22
| | | | | | | | | | Change-Id: I3bff6ba73b15ee810bb11b2902d11244c3205b2a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add rvalue-ref qualified {QString,QByteArray}::{simplified,trimmed}Thiago Macieira2014-11-021-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Of the const overloads that return a QString or a QByteArray, this is one that gains the most benefit. It happens often in constructs like: QByteArray s = x.readLine().trimmed(); After this change, 41 out of 103 calls to trimmed become rvalue in Qt and 272 out of 441 in Qt Creator. For simplified, the numbers are 27 out of 69 in Qt and 10 out of 19 in Qt Creator. Other candidates are left, right, and mid, but there are exactly zero uses of left, right and mid on an xvalue QString or QByteArray in Qt. I'm being lazy and using qstring_compat.cpp to store the QByteArray compat methods. Change-Id: I4e410fc1adc4c761bb07cc3d43b348a65befa9f6 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-19/+11
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* | tst_QString: also test section(QChar) overloadMarc Mutz2014-09-121-0/+2
| | | | | | | | | | Change-Id: I5d631cdd33501ac10e3e4184518d3c70b20984d7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString:add (last)indexOf overload with QRegularExpressionMatch outputSamuel Gaist2014-08-271-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds indexOf and lastIndexOf with QRegularExpressionMatch output overloads to QString. This allows to get the match corresponding to the index returned. [ChangeLog][QtCore][QString] Added support for retrieving the QRegularExpressionMatch to indexOf and lastIndexOf. Change-Id: Ia0ae2d3ff78864c7053ffa397874aca1d2b1c35c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | tst_QString: Use a non-empty string for lastIndexOfInvalidRegexSamuel Gaist2014-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | Testing using an empty string doesn't ensure that the regexp gets validated. The function may return earlier thus making the test useless. This patch adds a text to search in so that no early optimization avoids the regexp validation part Change-Id: If24b77385dde44a922d43e5ae1d7a5393d24f640 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add test case for indexOf using an invalid QRegularExpressionSamuel Gaist2014-08-261-0/+7
| | | | | | | | | | Change-Id: I3677d0ecd406388a8f1eb65ec013595904da4c2d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Simplify and unify Q{ByteArray,String{,Ref}}::{simplify,trimmed}Thiago Macieira2014-08-191-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a side effect, QString::simplified() will always return a detached copy, even if it's the same contents. QStringRef::trimmed() can use the same calculation algorithm but can't use the trimmed_helper() template function due to its lack of a constructor taking begin pointer and size (std::string_view could do it). That constructor can't be added because QStringRef always refers to an existing QString, not to data in memory. Change-Id: Ib966c1741819c68c6bac5fcbb00f8ac818b3ccab Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add rvalue-ref qualified QString::to{Upper,Lower,CaseFolded}Thiago Macieira2014-08-191-0/+2
|/ | | | | | | | | | | | This is even more common than the QByteArray equivalents. Qt Qt Creator const & && const & && toLower 71 50 45 26 toUpper 35 8 46 35 Change-Id: I8b797d2321b22ce414c23656c5f1709ac649c423 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add QString::splitRef functions.Jędrzej Nowacki2014-07-311-15/+123
| | | | | | | | | | | | The functions can be used to optimize code that do not need to use the split results as QString directly. [ChangeLog][QtCore] QString can now split a string to a list of QStringRef. Change-Id: Ic2dc929e1fba82f9a060e37c51068a301cb5b866 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>