summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.h
Commit message (Collapse)AuthorAgeFilesLines
...
* | | 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>
* | | QStringRef: add missing relational operators against QLatin1String/QStringMarc Mutz2016-03-161-15/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Equality and inequality were already provided. Missing were the less/greater than (or equal) operators. Added. Moved existing functions around and more similar to the new ones, to make the whole code section a bit more manageable. [ChangeLog][QtCore][QStringRef] Added missing operator{<,>,<=,>=} comparing against QLatin1String and QString. Change-Id: Idb3c4fa9b38421637987226f3cc1b77f5d4a6309 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | QLatin1String: add at()/op[]/mid()/right()/left()Marc Mutz2016-02-191-0/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QLatin1String can be used as a string-view-like type. When attempting to do so in uic, mid() and at() were found to be missing. Added the others for completeness. Use the new functions in uic, for which they were originally conceived. [ChangeLog][QtCore][QLatin1String] Added at(), operator[](), mid(), right(), left(). Change-Id: I4cfe3e9ed1157dedee754b2012d9678fe72b161e Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/devLiang Qi2016-01-261-9/+9
|\ \
| * | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-9/+9
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| | * Revert "QString: preserve embedded NULs when converting from QByteArray"Marc Mutz2016-01-121-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | QStringRef: add missing op[]Marc Mutz2016-01-261-0/+1
| | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QStringRef] Added subscript operator. Change-Id: Ia85d5efcb7747d2961ba55922ddabe6a46bdf20b Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.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-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QString: add resize(int, QChar)Marc Mutz2015-12-281-0/+1
| | | | | | | | | | | | | | | | | | | | 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-6/+1
|\| | | | | | | | | | | | | | | | | | | | | | | 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-6/+1
| | | | | | | | | | | | | | | | | | 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>
* | QString: mark relational operators (and compare()) nothrowMarc Mutz2015-12-131-49/+50
| | | | | | | | | | | | | | Saves ~3K in QtCore text size on GCC 4.9 Linux AMD64 relase builds. Change-Id: I74171ba5499de200b9584660241ca1fae4bcad79 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Add an else clause that clears the return value.Rolland Dudemaine2015-12-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | This avoids several warnings with the GHS toolchain, in the form: warning #111-D: statement is unreachable This is because the sizeof() equality test is statically determined, but the following code is not discarded automatically. It is when using an explicit else clause. Change-Id: Ic0584aafc72f70badcf5285ab635f9d99eac161a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-231-26/+27
|\| | | | | | | | | | | | | | | | | | | | | | | | | 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
| * QLatin1String: add some nothrowMarc Mutz2015-10-201-24/+24
| | | | | | | | | | Change-Id: I488fe7c4122febf46caa6487d92f61391edd41a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QLatin1String: add default ctorMarc Mutz2015-10-201-0/+1
| | | | | | | | | | | | | | | | | | | | A pending change in uic depends on this. [ChangeLog][QtCore][QLatin1String] Added default constructor. Change-Id: Ie6f5dfc7b38683a488b0ff7f31404800ef5ee188 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-4/+4
|\| | | | | | | | | | | | | | | | | 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-4/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | QByteArray::operator< and friends had their logic reversed. Task-number: QTBUG-48350 Change-Id: I625209cc922b47e78dfb8de9fe100411f285a628 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Mark ref-qualified members as always inlineThiago Macieira2015-10-071-10/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | MSVC and ICC on Windows always make calls to the dllexport'ed out-of- line copy of an inline function when compiling in debug mode. This creates an incompatibility when a compiler that understands ref- qualified member functions (such as ICC) is used to compile code using a DLL that was compiled with a compiler that doesn't understand (such as MSVC 2013). Task-number: QTBUG-48349 Change-Id: I42e7ef1a481840699a8dffff14053b7998a2a6bb Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QStringRef: make nothrow move-assign- and -constructibleMarc Mutz2015-07-221-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | The move special members were inhibited by the presence of a non-trivial copy constructor/assignment operator and destructor. Restore them. While we're at it, move all the special member functions we should not have defined into an #if QT_VERSION block. Change-Id: I873a99bfefe03e0fb02676e3431fd51f8c8f0adc Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QString: add {const_,reverse_iterator}, {c,}r{begin,end}()Marc Mutz2015-07-071-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | QtCore: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-011-23/+23
| | | | | | | | | | | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Task-number: QTBUG-45291 Change-Id: I0cc388ef9faf45cbcf425ad0dc77db3060c104a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QStringRef: add truncate()Marc Mutz2015-06-191-0/+2
| | | | | | | | | | | | | | | | | | | | Missing part of QString API. [ChangeLog][QtCore][QStringRef] Added truncate(int). Change-Id: I49e218daf8f47fcd3dad131155e0abc8e2a133e5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-031-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qnamespace.qdoc src/corelib/io/qwindowspipereader.cpp src/corelib/io/qwindowspipereader_p.h src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/plugins/platforms/xcb/qxcbconnection.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/tools/qmake/tst_qmake.cpp tests/manual/touch/main.cpp Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
| * Add Q_REQUIRED_RESULT in several placesSérgio Martins2015-05-041-1/+1
| | | | | | | | | | | | Change-Id: Icda3000f1d9f0d41612a50a816aa5de5e32028d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Add missing QString::prepend(QStringRef)/(const QChar*,int) overloadsMarc Mutz2015-04-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | QString: preserve embedded NULs when converting from QByteArrayMarc Mutz2015-04-021-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Long live QString::asprintf()!Marc Mutz2015-02-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | asprintf() is a GNU extension that prints into a string it allocates internally. Arguably, that's a better name for QString::sprintf() since it also allocates memory internally. The main problem with QString::sprintf() isn't that it's dangerous to use (it is), but that it's not static. It also returns a reference instead of by-value, breaking RVO. There is a comment about removing this function completely in Qt 6.0, but it remains the only printf-style function in Qt that can allocate the target string, so it's vital for logging, e.g., and the recommended replacement code (http://linux.die.net/man/3/vsnprintf) is a nightmare. So this patch adds static (v)asprintf() methods to replace it. Further patches will fix up all in-tree callers and finally deprecate the old (v)sprintf(). Test coverage is provided through the existing tests of sprintf(), which is implemented in terms of asprintf(). Arguably, the in-tree callers show that QByteArray would benefit from having an asprintf(), too, as most of the in-tree code works around its lack with calls to to{Latin1,Local8Bit}() after using the QString version. [ChangeLog][QtCore][QString] Added asprintf(), vasprintf(). Change-Id: I8510f8d67c22230653ec0f1c252c01bc95f3c386 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>