summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qchar.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add QChar::Script enumKonstantin Ritt2012-12-201-0/+147
|/ | | | | | | | | | | | | | | ...where the values are not aliased to Common script. The old QUnicodeTables::Script enum was retained for compatibility reasons until Qt internals are updated to use QChar::script(). Using QChar::Script instead of QUnicodeTables::Script would improve both the text analysis (itemization, boundary finding) and the text shaping quality. This also a required step for switching to Hurfbuzz-NG. /* This adds 6668 more .rodata bytes */ Change-Id: I5aa3d12c550528d0052542436990f8d0779ea8e5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Add documentation for ucs4 overloads.Frederik Gladhorn2012-10-161-11/+43
| | | | | Change-Id: Ibacd8f260950db195a17cffe8396e8460f227eb9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
* Update the Unicode Data and Algorithms up to Unicode 6.2Konstantin Ritt2012-10-091-1/+2
| | | | | | | | | | | | | Version 6.2 of the Unicode Standard is a special release dedicated to the early publication of the newly encoded Turkish lira sign. In addition, there are some significant changes to the Unicode algorithms for text segmentation and line breaking to improve breaking for emoji symbols. For more details, see http://www.unicode.org/versions/Unicode6.2.0/ Change-Id: I21cfd4f307e41b41a19d36cce87f7a44c2661bc2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> 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>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+2
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Fix a couple of qdoc errorsLars Knoll2012-08-181-1/+1
| | | | | Change-Id: I79f689e08ed4a496052529af38fca72c3d4e04cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update the qunicodetables generator to deal with UCD 6.1 filesKonstantin Ritt2012-06-101-1/+5
| | | | | Change-Id: If22018ff83cfc6b9c984f689648da038fce11d84 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix a bug in the case conversion codeLars Knoll2012-06-011-8/+4
| | | | | | | | | | | Chars that have a case conversion that converts them into several characters can't be handled by QChar::toUpper() etc and should get ignored. The code didn't do that correctly. Change-Id: I281d122e90bf49187b6449088d2fccef2ef75e86 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate {QString,QStringRef,QChar}::{to,from}AsciiThiago Macieira2012-05-221-0/+2
| | | | | | | | | | | | Make them call exactly their Latin 1 counterparts. For the QString functions that take a single char, also use fromAscii directly. Change-Id: I87645aba6ab9cde34c1df3cbc3a979fbd9e91f9d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* add some more widely-used QChar::SpecialCharacter enum valuesKonstantin Ritt2012-05-171-0/+4
| | | | | | Change-Id: Iad58f4366ba6cd6da29a268c56c8a4bc4cf0329c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QChar: add isSurrogate() and isNonCharacter() to the public APIKonstantin Ritt2012-05-161-25/+75
| | | | | | | | + QChar::LastValidCodePoint enum value that supercede the UNICODE_LAST_CODEPOINT macro replace uses of hardcoded values with the new API; remove leftovers Change-Id: I1395c9840b85fcb6b08e241b131794a98773c952 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QChar: add missing UCS-4 overloads, get rid of UCS-2 onesKonstantin Ritt2012-05-161-156/+155
| | | | | | | | | | inline all non-static members to a static ones (declared with QT_FASTCALL), ushort converts automatically to uint and the conversion cost is minimal. Task-Number: QTBUG-13052 Change-Id: I189a6f205736766adcd3de2d61cee71f30cc64f3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* stop ignoring unassigned codepointsKonstantin Ritt2012-05-041-5/+4
| | | | | | | | | | in Unicode 5.1, it was clarified that unassigned codepoints normally should not be excluded from the process; moreover, unassigned codepoints assumed to be starters in decomposition by default Change-Id: Ic4a61ec3759ee62b6843c81045e1d611d0684ead Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* add support for non-BMP ligaturesKonstantin Ritt2012-05-041-15/+50
| | | | | | | | | | | | | | | | | | | | | > http://www.unicode.org/versions/Unicode5.2.0/ D. Character Additions: There are three new characters in the newly-encoded Kaithi script that will require changes in implementations which make hard-coded assumptions about composition during normalization. Most new characters added to the standard with decompositions cannot be generated by the operations toNFC() or toNFKC), but these three can. Implementers should check their code carefully to ensure that it handles these three characters correctly. U+1109A KAITHI LETTER DDDHA U+1109C KAITHI LETTER RHA U+110AB KAITHI LETTER VA UCD 6.1 adds two more of them: U+1112E CHAKMA VOWEL SIGN O U+1112F CHAKMA VOWEL SIGN AU Change-Id: I781a26848078d8b83a182b0fd4e681be2a6d9a27 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove references to to/fromAscii in QString and QByteArray main docsThiago Macieira2012-05-031-4/+4
| | | | | | | | | | | | Those functions are about to be deprecated and shouldn't be referred to in the main documentation. Since they were temporarily changed to mean UTF-8, this is not a behaviour change. The next commit will update the code to match the documentation. Change-Id: Ia8c2843c7f2b478f5691fe0224d5e631d94b1af6 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* optimize QChar::decomposition()Konstantin Ritt2012-04-251-27/+32
| | | | | | | | | | * by not using QString::fromUtf16() as we know for sure that the data is 'raw' UCS-2; * it's safe to avoid a check for > UNICODE_LAST_CODEPOINT as GET_DECOMPOSITION_INDEX macro already does a similar check Change-Id: Ifb660efc51c664d06733ac8ed46d54278520da06 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* workaround issue where casing diff overflows signed shortKonstantin Ritt2012-04-241-10/+25
| | | | | | | | | | | | | | | | | | | there are two such codepoints were added in the Unicode 5.1: U+1D79 LATIN SMALL LETTER INSULAR G U+A77D LATIN CAPITAL LETTER INSULAR G two more of them were added in the Unicode 6.0: U+0265 LATIN SMALL LETTER TURNED H U+A78D LATIN CAPITAL LETTER TURNED H and two more were added in the Unicode 6.1: U+0266 LATIN SMALL LETTER H WITH HOOK U+A7AA LATIN CAPITAL LETTER H WITH HOOK we map them like special cases with length == 1 (note: all are in BMP which is checked explicitly in the generator) Change-Id: I8a34164eb3ee2e575b7799cc12d4b96ad5bcd9c6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QChar: reduce code duplication by inlining some methodsKonstantin Ritt2012-04-241-85/+69
| | | | | | | | | using templates for toLower()/toUpper()/toTitleCase()/toCaseFolded() makes the upcoming patches smaller and thus easier to review Change-Id: Ideb23e8669dbc2fe9ea3f129bf0137e1805ece11 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* optimize canonicalOrderHelper() for generic caseKonstantin Ritt2012-04-191-5/+21
| | | | | | | | | | | if there is no need to swap codepoints A and B, then we proceeding with advance to the next codepoint B that becomes A, and some next codepoint C becomes B; in such case we can easily skip the re-calculations for A by using previously calculated results for B Change-Id: I5c63589c274acaddf0f6a4cb1e0608d352a0c1b3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* fix QChar::decompositionTag() returns wrong result for Hangul syllablesKonstantin Ritt2012-04-171-0/+2
| | | | | Change-Id: I28e7b14b6a90aa539f8a50107737a66b3484fc00 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* fix QChar::isPrint() returns an incorrect result.Konstantin Ritt2012-04-171-4/+12
| | | | | | | | results are now equals to results of ICU's u_isprint() for the entire set of the Unicode code points Change-Id: I763f4b37cccd285eb01543d486f25bd7ea011241 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QChar: documentation fixesKonstantin Ritt2012-04-131-1/+18
| | | | | | Change-Id: Ic4b58ab811e53cf175ebaf0a67c40c56678f0f35 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QChar: optimize some methods a bit for general caseKonstantin Ritt2012-04-111-2/+9
| | | | | | | | | | | | by reordering and regrouping conditions so that they lead to result earlier in most-common usecases (l.letters, spaces and puncts, u.letters, other); there are no title cased letters in range [0..127] -> use this in isTitleCase(); test for 0xa0 (nbsp) early in isSpace() as it is quite common in HTML, etc.; add early test to isNumber(). Change-Id: Ib415f34cb1212d9ccf8753de2d1beaece1aa2243 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* fix digitValue() returned 0 instead of -1 for invalid ucs4 charactersKonstantin Ritt2012-04-111-1/+1
| | | | | | | | | Task-number: QTBUG-20318 Change-Id: I96c4c2b042bad478b7c704669e7ea0d574d3b22f Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* remove CODEC_FOR_C_STRINGS leftoversKonstantin Ritt2012-04-101-9/+1
| | | | | Change-Id: Iaafb945882e3f6ad6d39f7eefb62b83ff50a9ba8 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Remove custom text codec for C strings.Robin Burchell2012-02-221-47/+16
| | | | | | | | | | This setting is extremely harmful, as code cannot know whether or not to expect it. It also made the behaviour of QString::fromAscii and ::toAscii unintuitive, and caused a lot of people to make mistakes with it. Change-Id: I2f429fa7ef93bd75bb93a7f64c56db15b7283388 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* replace 'const QChar &' with 'QChar ' for QChar and QStringRitt Konstantin2011-10-261-1/+1
| | | | | | | | Merge-request: 69 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Change-Id: I61f5a54b783252029fcad95677958fa6a2130d01 Reviewed-by: Olivier Goffart <ogoffart@kde.org>
* Remove stale documentation.Casper van Donderen2011-10-181-7/+0
| | | | | Change-Id: I85139e0334b648bee0d18129cef9387dcc6c3222 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Boost performance of QChar::isSpaceKent Hansen2011-09-151-4/+9
| | | | | | | | | | | | | | | | | | | | | Make it inline; add fast checks for typical spaces; add fallback function that uses the fastcall calling convention. On ia32, this change makes isSpace ~340x faster for ascii spaces, ~170x faster for non-space ascii characters, and ~1.3x faster for non-ascii characters. Note that this change is NOT binary compatible. Also add an autotest with expected results from before the optimization, to ensure that the behavior is the same. Change-Id: I9438d0ad3c9ba2e80560c4bee7eed05115265798 Reviewed-on: http://codereview.qt-project.org/4905 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Boost performance of QChar::isLetterOrNumberKent Hansen2011-09-151-2/+9
| | | | | | | | | | | | | | | | | | | | | | Make it inline; add fast checks for ascii letters and digits; add fallback function that uses the fastcall calling convention. On ia32, this change makes isLetterOrNumber ~120x faster for ascii letters and digits, ~150x faster for non-letter/digit ascii characters, and ~1.3x faster for non-ascii characters. Note that this change is NOT binary compatible. Also add an autotest with expected results from before the optimization, to ensure that the behavior is the same. Change-Id: Ia4e13692f4dd79f6aa0b96da29449e0487971b0e Reviewed-on: http://codereview.qt-project.org/4904 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Boost performance of QChar::isLetterKent Hansen2011-09-151-2/+9
| | | | | | | | | | | | | | | | | | | | | Make it inline; add fast checks for ascii letters; add fallback function that uses the fastcall calling convention. On ia32, this change makes isLetter ~370x faster for ascii letters, ~250x faster for non-letter ascii characters, and ~1.5x faster for non-ascii characters. Note that this change is NOT binary compatible. Also add an autotest with expected results from before the optimization, to ensure that the behavior is the same. Change-Id: I06f8d3d43114537cee5567e670898cef6494c20a Reviewed-on: http://codereview.qt-project.org/4903 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Boost performance of QChar::isDigitKent Hansen2011-09-151-2/+9
| | | | | | | | | | | | | | | | | | | | | | Make it inline; add fast checks for ascii digits; add fallback function that uses the fastcall calling convention. On ia32, this change makes isDigit ~370x faster for ascii digit characters, ~250x faster for non-digit ascii characters, and ~1.5x faster for non-ascii characters. Note that this change is NOT binary compatible. Also add an autotest with expected results from before the optimization, to ensure that the behavior is the same. Change-Id: I718fadecda3f591d6f4c22374d8e476f4724fd83 Reviewed-on: http://codereview.qt-project.org/4902 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* omit unassigned (and too recent) codepoints from the text Normalization processRitt Konstantin2011-09-011-5/+13
| | | | | | | | | | | | | | | http://www.unicode.org/reports/tr15/#Guaranteeing_Process_Stability: > handle any code points that were not defined in the earlier version > as if they were unassigned: such code points will not decompose or compose, > and their Canonical_Combining_Class value will be zero. since QChar::Unicode_Unassigned value is 0, it's less than any other QChar::UnicodeVersion value and must ba handled explicitly Change-Id: I6df025b4173d407660adae77ec5eeb98d15cb8ce Reviewed-on: http://codereview.qt.nokia.com/4084 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* remove Qt3 leftoversRitt Konstantin2011-07-221-11/+2
| | | | | | | | | | Merge-request: 22 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com> Change-Id: I5d25fb05894d9baa645f97946e1f9aaa1622c876 Reviewed-on: http://codereview.qt.nokia.com/1925 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
* minor improvements to QChar documentationRitt Konstantin2011-07-211-68/+42
| | | | | | | | | | Merge-request: 22 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com> Change-Id: Ib70922f98385888c084ccd3224a9bb12ca766ccf Reviewed-on: http://codereview.qt.nokia.com/1926 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
* Doc: Removed documentation for deleted code.David Boddie2011-07-211-36/+0
| | | | | | | Change-Id: Icdbc05decac3dfe3fc18ce073c494e1fce4ea347 Reviewed-on: http://codereview.qt.nokia.com/1824 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: David Boddie
* drop a dead QChar::Punctuation_Dask enum valueRitt Konstantin2011-07-131-2/+0
| | | | | | Change-Id: I22c67ff7c08ab514a646bad86eb8cd0f41099e9c Reviewed-on: http://codereview.qt.nokia.com/1585 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* drop an obsolete QChar::NoCategory enum valueRitt Konstantin2011-07-131-3/+1
| | | | | | | | | | | | there is no such category in the Unicode specs. the QChar::NoCategory was a subject of bugs since it was introduced. int 4.6 it's meaning was limited to mention ucs4 > UNICODE_LAST_CODEPOINT only (which is useless anyways) in order to preserve the old (wrong) behavior. fix it now for qtbase Change-Id: I630534824e071090b39772881e747c1fdb758719 Reviewed-on: http://codereview.qt.nokia.com/1584 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove Qt 4.3 binary compatibility for MSVCThiago Macieira2011-07-111-4/+0
| | | | | | | | | | | | | | | When we removed the useless "const" in the return type, we broke compatibility with a few compilers that include the return type in the mangling. We don't need that anymore in Qt 5. This change should have had a ### Qt5 mark everywhere, not just in a comment in qstring.cpp. Change-Id: I8839f8dc540b34e57a3efdb160a1c015f7328422 Merge-request: 13 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com> Reviewed-on: http://codereview.qt.nokia.com/1385 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+1654
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12