summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* QtCore: Use QDebugStateSaver in (almost) all QDebug operator<<Kai Koehne2015-02-091-4/+6
| | | | | | | | | Unify the behavior of the different operator<< by always using QDebugStateSaver (appending an optional space at exit), and making sure that the space(), nospace() setting isn't 'leaked'. Change-Id: I38e4f82fa6f7419d8b5edfc4dc37495af497e8ac Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Remove support for QT_QLOCALE_USES_FCVT.Erik Verbruggen2015-01-281-25/+0
| | | | | | | We expect floating-point math to be IEEE754 compliant. Change-Id: I2b257177f2ef5fce38ac4d8fd76f746dc7b9fc15 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Observe QLocale::RejectGroupSeparator in QInt/DoubleValidator.Friedemann Kleint2014-11-201-2/+2
| | | | | | | | Pass it as additional boolean parameter to QLocaleData::validateChars(). Task-number: QTBUG-42522 Change-Id: I4b2367f4e2fdcbd17e343d215edad57e6687697a Reviewed-by: Mitch Curtis <mitch.curtis@digia.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>
* Document behavioral dependencies to ICU in QLocaleKai Koehne2014-05-131-0/+14
| | | | | | | | | | On Windows, Qt5Core does not link against ICU anymore. So it's worthwhile to point out that QLocale::toUpper(), QLocale::toLower() will just fall back to QString equivalents / "C"-locale conversions. Change-Id: Icadc20f3033aa39fcee93e61e082562945951c08 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Centralize the merging toFloat conversionsThiago Macieira2014-02-161-22/+2
| | | | | | | | The QByteArray version was missing the overflow check that the other versions had. Change-Id: I03cd92e5e5a84c038bee1f1ee217e93e9d9a675a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Centralize the handling of all the toXxx (integral) functionsThiago Macieira2014-02-141-80/+47
| | | | | | | By way of templates. This makes the code a lot cleaner. Change-Id: Ie369561c7631b0d34d76a6852883716cc0aa89d4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocalePrivate: merge removeGroupSeparators into numberToCLocaleThiago Macieira2014-02-141-7/+52
| | | | | | | | This version will parse the string only once and will not do any memmove. This is more efficient. Change-Id: I59026ad0fa61cc3f16146bdcd622fc54cbd8a321 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocalePrivate: move the stringToXxx to QLocaleDataThiago Macieira2014-02-141-34/+34
| | | | | | | | | Along with some more helper functions. There are two more functions used in QIntValidator Change-Id: I469ef40426cbb73ab515454bd5ecb12d944f5c0a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocalePrivate: move the xxxToString functions to QLocaleDataThiago Macieira2014-02-141-56/+48
| | | | | | | | | | | Those functions do not need any of extra QLocale settings in QLocalePrivate, so we can move them easily, along with their flags. It's also very convenient that we can now bypass completely QLocale when formatting numbers to strings. Change-Id: I8cae64e8e2056a6b2d716758e4be79f746644732 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge the pairs of stringTo{Double,LongLong,UnsLongLong}Thiago Macieira2014-02-141-56/+12
| | | | | | | | | | The difference between them was simply whether they operated on QString or QStringRef. So drop down to what's common between them: a pointer and a length (or two pointers, but numberToCLocale already operates on a pointer and a length). Change-Id: Ie7c8955ac13d6023761e6d3bafe7ab04bd6984e1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove duplicated trimming of a stringThiago Macieira2014-02-141-49/+13
| | | | | | | | | No need to do it in QLocalePrivate::xxxToDouble() because numberToCLocale() already does it for us. Centralized code = better code. Change-Id: Ifecf9119556d4465582212b5be773c18edd13563 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ensure QLocale's shared C-locale QLocalePrivate is never deletedTor Arne Vestbø2013-11-041-3/+7
| | | | | | | | | | | | | | | | | Other static data such as QTextStream might be initialized before the static C-locale, in which case QLocale would adopt c_private and bump the ref-count to 2, only to see it reset back to 1 when the c_locale's static initialization happened. The result was that at application shutdown the ref-count would fall down to 0, and we tried deleting the static data. This issue was observed with clang in a debug build, where the c_private is initialized at runtime. Change-Id: If05221a5e87886e1805ad3c1b1520483f425c0fb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QDateTime - Split QDateTimeParser into a separate fileJohn Layt2013-09-091-0/+1
| | | | | | | | | | | | | Not strictly needed yet, but helps to reduce the size of QDateTime and make it easier to read a major re-write. Imposes separation of parser which will be needed if we make QLocale always use the system backends, after which only QDateTimeEdit widget will need the parser and it can be moved there. Change-Id: I6a5e9a3edf6fe8ff2340af6afecd8ba4bfde9dd4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QLocale - Improve date formatterJohn Layt2013-09-051-76/+61
| | | | | | | | | | | | | | | | Modify the QLocale date formatter to be consistent with the QDateTime date formatter and able to replace the QDateTime formatter in a subsequent change. Fix the treatment of negative years. The internal QLocale::timeZone() has been replaced by the QDateTime::timeZoneAbbreviation() to ensure the correct tz for the date/time is used rather than always the current system default. Change-Id: I2ef26700856e2e69b979069226aa504ecbb50071 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QLocale: Minor code dde-uplicationKonstantin Ritt2013-08-141-8/+6
| | | | | Change-Id: Ie48111a8f76798eb706d6a4036c7965d32ed542b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocalePrivate: remove unused dataPointerForIndex functionThiago Macieira2013-05-081-13/+0
| | | | | | Change-Id: I0cd3f8a526e11c3df53fe0cbb063e01c5a3564f9 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QLocale: cache the QLocalePrivate for the default QLocaleThiago Macieira2013-05-011-6/+9
| | | | | Change-Id: I6f05da4d426a0aa685dd9f2fd0020e413a4bebad Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocale: cache the C locale's privateThiago Macieira2013-05-011-1/+14
| | | | | Change-Id: I81bbfeffebb5b7fc29d67bb7127beaf13838ac9f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix QLocale::standaloneMonthName when d->m_data == systemData()Albert Astals Cid2013-05-011-1/+1
| | | | | | | | | | | | | | | | | At the moment if d->m_data == systemData() it calls systemLocale()->query but forgets about the standalone part so you get the wrong data This patch introduces the new enums so that backends can implement properly the standaloneMonthName feature properly. At the moment the Windows and Mac ones still return the monthName, the Unix and Blackberry ones return the data we store in months_data Change-Id: Idc5a50b04ab1f914f16c7385be1dca2e027feae3 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Mehdi Fekari <mfekari@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QLocalePrivate PODThiago Macieira2013-04-301-5/+5
| | | | | | | | | QSharedDataPointer does not actually need a class derived from QSharedData. All it needs is a member called "ref". Change-Id: I2f7fe4cc143478ef7ef64681eada16e2d4c2e63a Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* QLocalePrivate: remove QLocalePrivate::m_indexThiago Macieira2013-04-301-22/+7
| | | | | | | | | | | | | It's not used anywhere, so we don't need to cache the locale data index. We already have the pointer to the QLocaleData anyway. This saves us a few roundtrips calculating the index from the data pointer only to get the data pointer again. Change-Id: I6905d20a382ddcb9fb04cc886a17499b467f905a Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Move the code that creates QLocalePrivate to separate functionsThiago Macieira2013-04-301-27/+33
| | | | | | | | | | | | Direct benefit is that the code between the two QLocale constructors taking language, country and (maybe) scripts is merged. This will also allow us to cache the QLocale::c() result. Change-Id: Ia46c5a37764dc287bfcd3a52a022ac413c53a582 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove QLocalePrivate::m_localeIDhjk2013-04-231-30/+30
| | | | | | | | | | | | | | It was only used for toUpper/toLower but always computed in the constructor, including QString::toLatin1 conversion and allocations. This needlessly slows down all other uses, including supposedly "cheap" operations QString::toDouble, or accesses inside QResourceFileEngine. The benchmarks indicates that doing it always when needed is bearable. There's still a lot of improvement potential on these code paths. Change-Id: I88b637ee11f9f7ea614f8da4ec5df0bf40664fce Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QLocale: Report textDirection() by looking to the locale scriptKonstantin Ritt2013-03-301-13/+20
| | | | | Change-Id: Ic562b0301271ba414d5d3ff75a308d84bd288f56 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge branch 'dev' into stableOswald Buddenhagen2013-03-201-16/+310
|\ | | | | | | | | | | | | | | | | | | | | | | This starts Qt 5.1 release cycle Conflicts: src/gui/text/qfontdatabase.cpp src/gui/text/qharfbuzz_copy_p.h src/widgets/kernel/qapplication.cpp src/widgets/kernel/qcoreapplication.cpp Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
| * QLocalePrivate: Add convenience language/script/country to code helpersKonstantin Ritt2013-03-191-10/+10
| | | | | | | | | | | | Change-Id: Id9126a95f1b3a75f510e642ab08c68cefaf3d142 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: John Layt <jlayt@kde.org>
| * QLocale: Added QStringRef overloads to toInt(), toUInt(), etc...Keith Gardner2013-02-181-0/+276
| | | | | | | | | | | | | | | | | | | | Added the following function overloads to QLocale: toShort, toUShort, toInt, toUInt, toLong, toULong, toLongLong, toULongLong, toFloat, and toDouble. Change-Id: I8cd90ca08b88338b08a73a72492f4c91c4f46ea4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QLocalePrivate: Generalized numberToCLocale.Keith Gardner2013-02-161-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | Modified QLocalPrivate::numberToCLocale to take a const QChar * and an integer instead of a QString. This allows for passing QStrings and QStringRefs into the same function. Updated the QLocalePrivate::stringToDouble, QLocalePrivate::stringToLongLong, and QLocalePrivate::stringToUnsLongLong to use this new function signature. Change-Id: Ifee5dfcd9b743e1d3b9123a65007c89e8ed93e83 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Correct QLocale(const QString &) documentation.Mitch Curtis2013-03-071-2/+2
|/ | | | | Change-Id: I6430ff2636083204fa12437980626260f848e269 Reviewed-by: Jerome Pasion <jerome.pasion@digia.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>
* QLocale: Report RTL text direction for pa_Arab and uz_ArabKonstantin Ritt2012-12-101-9/+16
| | | | | Change-Id: I97c785c9cbf550ef1ab330a4905ff7ae97ee6a30 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocale: Fix matchingLocales() behavior if script or country is not Any*Konstantin Ritt2012-11-251-13/+18
| | | | | | | | | | | Since the documentation doesn't mention the search should be done by language only, consider the current behavior incorrect. As of now, it is possible to get a list of locales by Country or Script as well. Also fix countriesForLanguage() to be in-sync with matchingLocales(). Change-Id: I6a09ca459120143565fa6099d2b823df1fed7c25 Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
* [SIC] QLocale: Update some language names with their modern valuesKonstantin Ritt2012-11-241-2/+2
| | | | | | | | Some of them were incorrectly spelled (for a while) Change-Id: I871968e3bbdd2172f4c4dfb6e74729c05e7e8e01 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: Fix toCurrencyString() didn't respect group separator optionKonstantin Ritt2012-11-231-4/+3
| | | | | | Change-Id: Icda43d71d600d77fe1ed4fcde1ef4478ef29c1d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
* Use likelySubtags to instantiate a locale id from it's short formKonstantin Ritt2012-11-211-29/+136
| | | | | | | | | ...just like described in http://www.unicode.org/reports/tr35/#Likely_Subtags. This is much more effective than current "guessing" algorithm + makes it possible to instantiate a locale by the script or territory code only. Change-Id: I674f8476e65b01c56960b6e83a1a346df0715274 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [SIC/BIC] QLocale: update enums up to CLRD 1.9.1Konstantin Ritt2012-11-211-3/+18
| | | | | | | | | | This patch adds some missing codes (two-letter ones only), removes an outdated ones, and updates some names. The legacy language codes are handled in QLocalePrivate::codeToLanguage() (fortunately, there are only 4 of such codes). Change-Id: Iff50aecd1c762b6399cd151aebb955f341d366c6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Output leading zeroes for yyyy date formats in QLocale::toString().Mitch Curtis2012-10-241-1/+1
| | | | | | | | | | Converting the date 1 January 0001 to a string in the format "dd MMMM yyyy" currently results in the string "01 January 1", but it should be "01 January 0001". Task-number: QTBUG-27287 Change-Id: Ia025da7343d1c36aaee34c47c6db551a6e89595f Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Make the "\internal" qdoc command stand on its own lineLaszlo Papp2012-08-151-1/+3
| | | | | | | | | | The qdoc manual currently claims that the command must stand on its own line. The change follows the consistency with the rest and how the example looks like inside the qdoc manual for this command. Change-Id: I6b653dc95cf9d84e4adf32220dace5d313678419 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Remove references to nonexistent QLocale::setDefaultLocale() in docs.Mitch Curtis2012-07-251-1/+1
| | | | | | | | | Should be QLocale::setDefault(). Task-number: QTBUG-23210 Change-Id: I0f5e6cc431f568c9b8c4be1411b7b47835304d0b Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Speed up QCoreApplication construction a bitHarald Fernengel2012-07-101-2/+2
| | | | | | | | Remove all QString conversions during QCoreApplication construction on Linux. Saves multiple mallocs. Change-Id: Ia8ba071a750dd6a08dcf14ef3ecc424f70a3098d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor the ICU code for QLocaleLars Knoll2012-06-101-56/+35
| | | | | | | | | | | | | | | | | Clean up the ICU code and make it thread-safe. Add a QIcuData structure to QLocalePrivate, that contains ICU specific data. Link against ICU directly, greatly simplifying the code. Also fix a bug in the locale specific case conversion code that would cause it to fail and fall back to the QString code if the output string was larger than the input. Change-Id: Ie67e5ea14fa204ebc5887d7aaeb1a4f3ecaf8697 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename QSystemLocale::fallbackLocale() to QSystemLocale::fallbackUiLocale()Mike FABIAN2012-06-061-2/+2
| | | | | | | | | | Suggested by Oswald Buddenhagen. This function is about the (main) UI language, not about other locale features like number formatting etc. It not in the public API anymore in Qt 5.0 so it can be renamed. Change-Id: I2a23892c67e5813de4c0e57330749568777e9ee6 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Pashto uses Arabic script and is written right to leftMike FABIAN2012-06-021-0/+1
| | | | | | | | | QLocale::textDirection() was missing Pashto as a right to left language. Change-Id: I1623abf711597a26f283a86708dc756696790b7d Reviewed-by: Lars Knoll Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Divehi is written right to leftLars Knoll2012-05-091-1/+2
| | | | | | | | QLocale::textDirection() was missing Divehi as a right to left language. Change-Id: Ib2395afe0e1dfbac23cb607dbf7833e6c12b2ce9 Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
* QLocale: Clean up QLocalePrivate implementationJohn Layt2012-04-241-229/+238
| | | | | | | | | | | | | | In Qt4 QLocalePrivate is a struct returned by a d() method. This will be unsuitable for the planned change to use ICU and may cause BIC issues. This change makes QLocalePrivate a class and creates a new struct QLocaleData to hold the data index. Further clean-ups are possible but are left for later. Change-Id: Ie316a07790f74674a3b520b735dff72695cc4060 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-4/+4
| | | | | | | | | | | | 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>
* Make QLocale::toULongLong return the proper type: qulonglongThiago Macieira2012-04-051-3/+1
| | | | | | | | Task-number: QTBUG-25143 Change-Id: Ia8fd588c25d11fe31acd57fd34a90d51dace248c Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: John Layt <jlayt@kde.org>