summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcollator_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Move text-related code out of corelib/tools/ to corelib/text/Edward Welbourne2019-07-101-148/+0
| | | | | | | | This includes byte array, string, char, unicode, locale, collation and regular expressions. Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-12-131-0/+1
|\ | | | | | | Change-Id: I0fe623517af28e408b642c879efd59f633ab63ac
| * Handle QCollator with locale C by delegating to QStringEdward Welbourne2018-12-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the C locale was treated as English because each back-end takes the locale's bcp47Name(), which maps C to en. However, the C locale has its own rules; which QString helpfully implements; so we can delegate to it in this case. Extended this to sort keys, where possible. Clean up existing implementations in the process. Extended tst_QCollator::compare() with some cases to check this. That required wrapping the test's calls to collator.compare() in a sign canonicalizer, since it can return any -ve for < or +ve for >, not just -1 and +1 for these cases (and it'd be rash to hard-code specific negative and positive values, as they may vary between backends). [ChangeLog][QtCore][QCollator] Added support for collation in the C locale, albeit this is only well-defined for ASCII. Collation sort keys remain unsupported on Darwin. Fixes: QTBUG-58621 Change-Id: I327010d90f09bd1b1816f5590cb124e3d423e61d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Use Q_DISABLE_COPY_MOVE for private classesFriedemann Kleint2018-12-121-2/+2
|/ | | | | Change-Id: I3cfcfba892ff4a0ab4e31f308620b445162bb17b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Ignore a smaller type in the posix form of QCollatorEdward Welbourne2018-08-131-2/+2
| | | | | | | | | | | | It ignores its CollatorType, so we can use bool for it and save a few bytes in QCollatorPrivate. The member using CollatorType follows three existing bool members: a boolean will fit there, while an int requires 1-byte padding and its 4-byte payload. Pointed out by Thiago Macieira. Change-Id: I10c8ea6f1b735b1b872c509f18fd6a93e24c9b86 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use suitable abstraction for the null value of CollatorTypeEdward Welbourne2018-08-131-3/+7
| | | | | | | | | | QCollatorPrivate defines a back-end-specific CollatorType and sets a member of this type to 0; but ICU's version really wants a nullptr not 0. So provide a named constant of the type, that's the NoCollator value for use there. Change-Id: Iad4d2f803ff4807ea568755efe00b9a92f1a8eeb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Supply locale to QCollatorPrivate via its constructorEdward Welbourne2018-08-131-5/+4
| | | | | | | | | | | | | | Both places that new'd it were then setting its locale themselves; they might as well do it tidily by passing it to the constructor. There's also no need to cleanup() in the constructor; every back-end is a no-op when collator has its initial value. Tidied up the class declaration in the process: * moved {con,de}structor to be first methods * comment on the two methods back-ends provide Change-Id: I041669637935e68141e002156552af8b475ba36e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCollatorPrivate: initialize in declarations rather than constructorEdward Welbourne2018-08-131-12/+6
| | | | | Change-Id: If5f240418e6a538ef44af973929b5c84e63b70d8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCollatorSortKey: add some std::moveMarc Mutz2017-02-131-2/+3
| | | | | | | | | | | | | | | | All implementations of QCollator::sortKey() can benefit from moving their CollatorKeyType into the QCollatorSortKeyPrivate on construction. So make the QCollatorSortKeyPrivate ctor a perfect forwarder for its m_key member, and add std::move() calls where they were missing (in all but one case, lvalues were passed). Make the ctor explicit, as it should have been from the beginning. Change-Id: I2a1cdda5fd23990ace019b963df895c621a1fa85 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Un-export QCollator{SortKey,}PrivateMarc Mutz2017-02-061-2/+2
| | | | | | | | This is private API, and used nowhere else except in qcollator*, so don't export these classes. Change-Id: I217fde97c60ab0a3e19774ed5a6eed8b156fff1d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Properly use QT_CONFIG macro to check for ICULars Knoll2016-11-291-3/+3
| | | | | | | And remove the QT_USE_ICU define. Change-Id: I8134ee18af7c90ed7070926ca31b3a57b3ec37dd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Make sure all private headers in Qt Core include qglobal_p.hThiago Macieira2016-06-251-0/+1
| | | | | | | | | | | | The rule was: - if the header included qglobal.h, turn that into qglobal_p.h - otherwise, insert the #include after the "We mean it" warning qglobal_p.h currently only includes qglobal.h. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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>
* 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>
* 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>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-231-0/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| * Add missing private headers warningSamuel Gaist2014-09-041-0/+11
| | | | | | | | | | Change-Id: I7a4dd22ea3bcebf4c3ec3ad731628fd8f3c247e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix Windows ICU build break in QCollator after commit c17563ec.Michael Brüning2014-09-161-1/+1
| | | | | | | | | | | | | | | | It used LCID without including qt_windows.h while QT_USE_ICU was defined. Change-Id: I3d4cf0e6bd0e299729d23d9a36c5a87adde774c9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix several issues in QCollatorLars Knoll2014-09-101-7/+24
|/ | | | | | | | | | | | | Refactor the code and move more things into the cross platform code path. Make sure the flags survive changing the locale of QCollator. Use the correct locale on Windows, WinRT and OS X. We now pass all QCollator autotests on these platforms. Task-number: QTBUG-40778 Change-Id: Ic2d3334b5018c323a35a3ea8fc1d7ab5f99b4e62 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't use Mac OS X QCollator backend on iOSTor Arne Vestbø2013-09-161-2/+2
| | | | | | | | | We don't have CoreServices on iOS, which hosts the UC* APIs. Change-Id: I95b1b173e57665c2fc2cdc1701f8ad57cdc0e567 Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QCollator more flexible to use in different platformsAleix Pol2013-09-131-0/+122
| | | | | | | | | | | | | | | | | So far we've known that we want QCollator as public API. It hasn't been possible yet due to the strong dependency that QCollator used to have on ICU. This patch adds collation support for the platforms where ICU is not the best option by using native collation API. Namely Windows and Mac OS X. Additionally a fallback POSIX back-end is added, so that we can make sure it will work on any posix-compliant platform. Change-Id: Ia1734acbf5f596698a81f2af927cc15636e4c908 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make the QCollator class publicLars Knoll2013-09-131-120/+0
| | | | | | | | The class missed the feature freeze for Qt 5.0, but has been ready for quite a while. So make it public in time for Qt 5.2. Change-Id: I9ac3f579ff5e371925fad40684762fff7ee4abd8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.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>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | 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>
* compile without CamelCase headersOswald Buddenhagen2012-09-111-2/+2
| | | | | | | | for faster bootstrapping without a full syncqt run Change-Id: I648f0a8fb09be021590c46e8e5e15667a316c817 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Fix missing or improper include guard in headersSergio Ahumada2012-09-091-3/+3
| | | | | | | | Use an include guard in headers to ensure the header is not included more than once. Make the header guard match its file name. Change-Id: Icf7d7d4bed91443b3b21ef5d4219dbd260dffef3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add proper collation support to QtLars Knoll2012-06-101-0/+124
QString::localeAwareCompare() has always been a broken way to support collation. The current implementation is not even thread safe. This adds a proper collation class that fixes the problems and finally allows Qt to sort properly according to locale rules. The class is private for now, but is intendent to be made public with 5.1 Change-Id: Idb4e75ff68a398c9813af622af884a90898d2be9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>