summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcollator_macx.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move text-related code out of corelib/tools/ to corelib/text/Edward Welbourne2019-07-101-152/+0
| | | | | | | | This includes byte array, string, char, unicode, locale, collation and regular expressions. Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Clean up the QCollator code and commentsEdward Welbourne2019-03-081-6/+6
| | | | | | | | Broke over-long lines. Reflowed documentation, refined a phrasing, corrected some out of date details and typos. Change-Id: Ic3835bb198bd062f85b3c466b56dc9636d4d3fe4 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Report status codes in warnings about API failuresEdward Welbourne2019-03-081-10/+6
| | | | | | | | Also reuse the status variable, since the value saved in the one previously declared int was an OSStatus, too. Change-Id: I8e8fe308ae71df51e8057d89bc76cab0c6bbedb2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Extend QCollator to support QStringViewEdward Welbourne2019-03-081-14/+4
| | | | | | | | | | This enables some simplification of the existing implementations. Refined wording of the documentation in the process. [ChangeLog][QtCore][QCollator] Added support for QStringView. Change-Id: Idffaae8d109173d47c7be076828f4b58dc334957 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Handle QCollator with locale C by delegating to QStringEdward Welbourne2018-12-111-0/+20
| | | | | | | | | | | | | | | | | | | | | | 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>
* macOS/iOS: Correctly ignore punctuation in QCollatorAndy Shaw2017-06-131-1/+1
| | | | | | | | | | | | | | When punctuation is ignored then the kUCCollatePunctionSignificantMask should not be set. This was originally thought to not be working due to a bug on the Apple platforms, but this is not the case. [ChangeLog][Platform Specific Changes][macOS][iOS] QCollator now respects the ignorePunctuation property on Apple based platforms correctly. Task-number: QTBUG-41978 Change-Id: I62044076387d6e4479f4aaef3c2f48f49dbd160e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QCollatorSortKey: add some std::moveMarc Mutz2017-02-131-1/+1
| | | | | | | | | | | | | | | | 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>
* QCollator: don't pipe bcp47Name() through QStringMarc Mutz2017-02-071-1/+4
| | | | | | | | | | | | | | | | | | | Give QCollator access to QLocalePrivate::bcp47Name(), to avoid both the latin-1 -> UTF-16 conversion in QLocale::bcp47Name(), as well all as - the replace('-', '_').toLatin1() call in ICU - the toLocal8Bit() call in macOS - the toUtf8() call in Windows implementations of QCollatorPrivate::init(). This is safe, since, according to https://tools.ietf.org/html/bcp47, a BCP47 name only contains US-ASCII (ALPHA used, which is defined by https://tools.ietf.org/html/rfc5234 to be [a-zA-Z] only). Change-Id: Id56befb1b5a7983494d848cdabf7ebeda377cf9f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QtCore: use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Saves ~750b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I8bf3e46cd5a6b2cae0ceb3e355a50f61925c63d3 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-13/+19
| | | | | | | | | | | 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-6/+6
| | | | | | | | | | | | | | | | | | 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-18/+10
| | | | | | | | | - 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-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * OS X - QCollator::compare() returns wrong results.Timur Pocheptsov2014-08-191-2/+2
| | | | | | | | | | | | | | | | | | kUCCollateDigitsAsNumberMask works only if kUCCollateDigitsOverrideMask is also set. Update 0: - test added. Task-number: QTBUG-40777 Change-Id: I48bfec78f5f8439a51f8d749f0fc4397a72b29f2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix several issues in QCollatorLars Knoll2014-09-101-62/+30
|/ | | | | | | | | | | | | 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>
* Fix case insensitive comparisons using QCollatorLars Knoll2014-06-121-3/+6
| | | | | | | | | | | | In ICU the strength parameter decides whether a comparison is case sensitive or not. Fix mac comparison code. It can't have worked before. Added some basic automated testing for QCollator. Change-Id: I2646c464fd22ccd3a93c461fa3dba4bd1d4c7b4b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QCollatorSortKey: inline operator<Marc Mutz2013-11-171-5/+0
| | | | | | | | | | | | | This code was duplicated in every qcollator_platform.cpp and identical everywhere, except in _icu, which uses a QByteArray m_key and the implementation used QByteArray::operator<, which is semantically and probably code-wise identical to what the other implementations did (after inlining). Inlining this function removes a potential maintenance problem and increases speed without violating encapsulation. Change-Id: If3e9d38a7d4326b49f0611a9f4187c53960e8a03 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Don't use Mac OS X QCollator backend on iOSTor Arne Vestbø2013-09-161-0/+179
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>