summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-121-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure src/corelib/io/qprocess_wince.cpp src/plugins/platforms/windows/qwindowstheme.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qtimezone/BLACKLIST tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
| * Remove includes to qdatetime_p.h that aren't necessaryThiago Macieira2016-05-081-1/+0
| | | | | | | | | | | | | | | | Since I'm changing QDateTime's privates, it's easier to know what may be depending on it or not. Change-Id: Id5480807d25e49e78b79ffff144a53018d057e19 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-031-3/+3
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/double-conversion/include/double-conversion/utils.h src/corelib/global/qnamespace.qdoc src/corelib/tools/qsimd_p.h tests/auto/corelib/io/qfile/tst_qfile.cpp Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-131-3/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/testlib/qtestcase.cpp src/testlib/qtestcase.qdoc Change-Id: Ied3c471dbc9a076c8de33d673bd557e88575609d
| | * QDateTimeParser: mediate QLocale's meddling via a setter.Edward Welbourne2016-04-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The former has (for now) nothing private, so QLocale got away with setting its .defaultLocale explicitly; provide a setter method by which it can do that, to allow scope for later encapsulation. Change-Id: I77fc5fc8f868fc7cf8d51eb1c5d18926c61cbf78 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Remove dynamic loading of functions that are present in Windows Vista onwards.Friedemann Kleint2016-04-191-1/+0
|/ / | | | | | | | | | | | | | | Invoke functions directly and add libraries accordingly. Task-number: QTBUG-51673 Change-Id: Ie19d1fc6aa932d6e93a7d310048e4c162fb81046 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
* | toCurrencyString() - Add missing documentationDan Cape2016-04-081-1/+7
| | | | | | | | | | | | | | | | Documentation was missing for the new toCurrencyString() function that adds a precision value. Change-Id: I16c10cdd18dfc37839fccb907470b0942f100e5d Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | Re-generate QLocale data from CLDR v29Konstantin Ritt2016-04-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | * A bunch of fixes and additions to the locale data * Add new scripts from Unicode 8.0 and 9.0 * Map some potentially useful languages and territories [ChangeLog][QtCore] QLocale data updated to CLDR v29 Change-Id: I759ccb27fe19be2722be913c5c2e6aa5f36e5c14 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QLocalePrivate: add overloaded codeToScript() and codeToLanguage()Anton Kudryavtsev2016-03-311-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | ... for QStringRef and QChar array. Now we can use QStringRef arg or QChar array arg to avoid unnecessary allocations. Also mark these functions as Q_DECL_NOTHROW. Change-Id: Ibe75346d80cc413e303fad886ecb82dbdb89af24 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QLocalePrivate: overload codeToCountry() for QStringRef and QChar arrayAnton Kudryavtsev2016-03-311-2/+1
| | | | | | | | | | | | | | | | | | | | Now we can use QStringRef arg or QChar array arg to avoid unnecessary allocations. Also mark these functions as Q_DECL_NOTHROW. Change-Id: I22b08a054051e80e3f76bb543d860f3dcb6caa4f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Don't use Q_GLOBAL_STATIC for trivial type QLocaleDataSérgio Martins2016-02-031-2/+2
| | | | | | | | | | Change-Id: I9435295a753d7dabea202fde876786d876a295fa Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/devLiang Qi2016-01-261-0/+7
|\ \
| * | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-0/+7
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| | * [Android]: Java uses some deprecated locale codes so account for theseAndy Shaw2016-01-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three deprecated language codes that Java still uses for the locale so we need to account for these inside QLocale by mapping them to the right language. Task-number: QTBUG-49632 Change-Id: Ib66b3f2763e085f7384228f2490b048bb56be259 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
|/ / | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | 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>
* | Add ability to specify precision of float/double currency stringsDan Cape2016-01-131-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new overload function that allows the developer to specify the desired precision. Until 6.0, it will require the symbol and precision to be passed to it. Once Qt is at version 6.0, it will replace the overload function that requires a value and optionally a symbol. [ChangeLog][QtCore][QLocale] Added an overload for toCurrencyString() that allows the decimal precision to be specified. Change-Id: I1fb7dde3583f46de2ed20ec2a7abaeca23a903ef Task-number: QTBUG-46595 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Mark QLocale as sharedMarc Mutz2016-01-121-0/+8
| | | | | | | | | | | | | | | | It was already movable, so it's BC. Only needed to add nothrow member-swap and nothrow move assignment. Change-Id: Iefedb877078da8ee075eb67185eef221143ddec1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Centralize dropping of trailing zeroes when converting doublesUlf Hermann2015-11-241-6/+1
| | | | | | | | | | | | | | | | | | We're never interested in trailing zeroes, unless the number is exactly 0. qdtoa would return an empty string if the result was exactly '0', which is also fixed by this change. Change-Id: I3ba2f7e835b92d54d9008ad03fdf6ce5fb3af8a4 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Add flags to omit/reject padding in scientific notation exponentsUlf Hermann2015-11-231-41/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The EcmaScript format for printing doubles in exponent form differs from Qt's format only in this aspect. EcmaScript explicitly prohibits leading zeroes in exponents. It is thus worthwhile to add those flags in order to be able to generate and parse doubles in compliance with EcmaScript. [ChangeLog][QtCore][QLocale] Additional flags in QLocale::NumberOption allow generating and parsing doubles in EcmaScript compliant format. Change-Id: Ia7b82c2e67bb8b80bd890014ff5cd4563faf2a03 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Interpret precision == -128 as "shortest" double conversionUlf Hermann2015-11-231-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | Also use this for converting doubles with QVariant. We generally want exact results there, rather than adding rounding errors whenever we convert. [ChangeLog][QtCore][QLocale] Added special value for double conversion precision to get shortest accurate representation. Change-Id: I905b8a103f39adf31d24b6ce2c8a283cf271b597 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Replace qdtoa and qstrtod implementation by a 3rdparty libraryUlf Hermann2015-11-021-108/+53
|/ | | | | | | | | | | | | | | | | This also fixes the underlying cause of QTBUG-44039 and QTBUG-43885. You can choose between system, qt, and no libdouble-conversion support. If you choose "no", snprintf_l and sscanf_l will be used. By default, system double conversion is used if the system provides a double-conversion library. Otherwise the bundled libdouble-conversion is built. sscanf_l and snprintf_l are not used by default as the planned "shortest" conversion mode to produce the shortest possible string will give less precise results when implemented with snprintf_l. Change-Id: I8ca08a0fca5c54cf7009e48e771385614f6aa031 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* The C locale should omit group separators by defaultLars Knoll2015-10-191-2/+3
| | | | | | | | | | | | | Numbers formatted in the C locale should not use group separators by default. [ChangeLog][QtCore][QLocale] The C locale does not use group separators when formatting numbers any more. Task-number: QTBUG-4044 Task-number: QTBUG-3068 Change-Id: Ia647a72efc11fecd66d22f9253562b1d4ef58168 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: remove (harmless) dead codeThiago Macieira2015-10-011-6/+6
| | | | | | | | | | On line 92 and on line 146, len == 2 or len == 3, so uc1 and uc2 cannot be 0, ever. Found by Coverity, CID 11013 and CID 11012. Change-Id: I42e7ef1a481840699a8dffff1407edefd3e7aa4f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Be more forgiving about arguments to QString::arg(double).Christian Kandeler2015-09-241-2/+2
| | | | | | | | | The arguments for the width and precision parameters, that is. There's no reason to crash if a user sets e.g. a precision of -2. Task-number: QTBUG-46838 Change-Id: I4afc004a1b8aa1306fd996360b16117b2b643640 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * QLocale: Fix example return value for uiLanguages()Kai Koehne2015-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | The documentation (correctly) states that the first item in the list is the most preferred one. Anyhow, then it doesn't make much sense to list "en_US" after "en". Change-Id: Ib88e5c97d4329b444d1cb49eeb49eaed2ddedad3 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Add qHash(QLocale)Marc Mutz2015-06-301-0/+16
| | | | | | | | | | | | | | | | | | | | | | QLocales can be compared for equality, so qHash should be overloaded, too. [ChangeLog][QtCore][QLocale] Added qHash(QLocale). Change-Id: Ia0fdf1207b842b9bb20b8f9ab0165016915debf4 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QLocale: Exclude null-byte in QString generated from script_code_list.Milian Wolff2015-04-241-1/+1
|/ | | | | Change-Id: I2b9b85dd052360ea6bd96f18180b1b97cf4daaeb Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Update CLDR to v27Konstantin Ritt2015-03-271-3/+9
| | | | | | | | | | | | | + A bunch of fixes in the locale data + New scripts from Unicode 7.0 + New locales - Some locales disappeared (aa_DJ, aa_ER, st_LS, ss_SZ, swc_CD, tn_BW) - Some locales lost their contents (i.e. en_Dsrt_US) [ChangeLog][QtCore] QLocale data updated to CLDR v.27 Change-Id: Iba8c7884f8087e577cbb25a8fc106dd7bd3ebb5d Reviewed-by: Lars Knoll <lars.knoll@digia.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>
* 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>