summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstringalgorithms_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Track modifications of white space in QString::simplified().Friedemann Kleint2015-03-121-4/+6
| | | | | | | | | | 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-1/+1
| | | | | | | | 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-21/+13
| | | | | | | | | | | | | | | | | | 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>
* Fix MSVC warning about unused value in qstringalgorithms_p.h.Friedemann Kleint2014-11-261-1/+1
| | | | | | | | | | | | | qstringalgorithms_p.h(144) : warning C4189: 'newlen' : local variable is initialized but not referenced MSVC mistakenly reports the variable as unused since it is referenced only in a logical and-expression depending on the template-type deduced compile-time constant bool isConst. Change-Id: I84cfc681054f554a4243b6ce659dac16141f7564 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add rvalue-ref qualified {QString,QByteArray}::{simplified,trimmed}Thiago Macieira2014-11-021-3/+24
| | | | | | | | | | | | | | | | | | | | 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>
* Simplify and unify Q{ByteArray,String{,Ref}}::{simplify,trimmed}Thiago Macieira2014-08-191-0/+135
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>