summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/qstringlist/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QStringList: add filter(QStringMatcher) overloadAhmad Samir2023-10-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that users can pass a QStringMatcher to do the matching, change the existing overload to not use QStringMatcher. Thanks to Giuseppe D'Angelo for the idea of passing a QStringMatcher to filter instead of using a magic number to decide whether to use QStringMatcher or not. Results of running filter() and filter_stringMatcher, times are in msecs and this was compiled with gcc -O3: Without With QStringMatcher list10 0.00022 0.000089 list20 0.00040 0.00014 list30 0.00058 0.00018 list40 0.000770 0.00023 list50 0.00094 0.00027 list70 0.0012 0.00037 list80 0.0014 0.00041 list100 0.0018 0.00050 list300 0.0054 0.0014 list500 0.0091 0.0023 list700 0.012 0.0032 list900 0.016 0.0041 list10000 0.17 0.045 Drive-by change: optimize tst_QStringList::populateList(). [ChangeLog][QtCore][QStringList] Added filter(const QStringMatcher &) overload, which may be faster for large lists and/or lists with very long strings. [ChangeLog][Possible Performance Changes][QtCore][QStringList] Changed the implementation of filter(QStringView) overload to not use QStringMatcher by default. Using QStringMatcher adds overhead, so it is beneficial/faster when searching for a pattern in large lists and/or lists with long strings, otherwise using plain string comparison is faster. If using QStringMatcher makes a difference in your code, you can use the newly added filter(QStringMatcher) overload. Change-Id: I7bb1262706d673f0ce0d9b7699f03c995ce28677 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Brush up the container code snippetsFriedemann Kleint2023-05-041-1/+1
| | | | | | | | | | | | | | | | | | | | - Bring iterator loops into a consistent form using auto and creating and end variable, use cbegin()/cend() where suitable - Use (std::)endl instead of Qt::endl for iostreams - Fix removed container conversion API (QList::fromSet, QSet::toList()) - Use range-based for instead of foreach - Use initializer lists - Use qPrintable(QString) for output to std::ostream - Use qsizetype - Remove some unused snippets Complements f6b137bdc43d4021cbbe602759dbcced2e04d638. Pick-to: 6.5 Change-Id: I8a167099cdb224f45b984fa834d46269144a7ef0 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Documentation: Fix information on how to iterate over listsFriedemann Kleint2022-11-241-18/+0
| | | | | | | | | | | | Remove the outdated code used for QStringList and point QStringList and QList to the containers page. Pick-to: 6.4 6.2 Task-number: QTBUG-108687 Change-Id: I6fae6410ca759f91da85832ddb9f24e8a0ce202b Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-49/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* 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>
* Remove QRegExp support from QString and StringListLars Knoll2020-05-141-14/+0
| | | | | | | | | | 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>
* Prefix textstream operators with Qt::Lars Knoll2019-05-021-3/+3
| | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Doc: Advocate use of std::initializer_list constructor in Q[String]ListKai Koehne2018-04-231-4/+7
| | | | | | | | | We're relying on C++11 since a while, so lets not advertise creating lists of strings with operator<<() anymore. Change-Id: I14a3442ff852ac2c106d90c63504eb9ebb737609 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Doc: update QStringList doc with missing QRegularExpression referenceSamuel Gaist2017-01-231-1/+1
| | | | | | | | | The documentation of QStringList is missing some mention of QRegularExpression as well as still using QRegExp in some sample code. This patch fixes that. Change-Id: I4a7c9fe8e5ae7c73497192bb71d1fa66ee864bd2 Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* Unify license header usage.Jani Heikkinen2016-03-291-3/+13
| | | | | | | | | Update files using old header.LGPL3 to header.LGPL Update files using old FDL template to use new one Update files using old BSD template to use new one Change-Id: I36a78272516f9953d02956522f285b40adfc8915 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Examples/Doc snippets: Fix single-character string literals.Friedemann Kleint2015-10-131-1/+1
| | | | | | | Use character literals where applicable. Change-Id: I79fa5018f05735201ae35ee94ba0d356fcad1056 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Updated BSD licensed file headersJani Heikkinen2015-02-151-3/+3
| | | | | Change-Id: I6441ff931dbd33b698d762e6f6784898f3f60fe7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-5/+5
| | | | | | | | | | | | | | | | | | 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>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QStringList: adapt documentation to cover new join(QChar) overloadMarc Mutz2012-09-221-2/+2
| | | | | Change-Id: Ia73501e1e8a562cfab750d1796fb597cd89eab74 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-6/+6
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-0/+170
This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>