| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qchar.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | // Don't define it while compiling this module, or USERS of Qt will | - | ||||||||||||||||||
| 41 | // not be able to link. | - | ||||||||||||||||||
| 42 | #ifdef QT_NO_CAST_FROM_ASCII | - | ||||||||||||||||||
| 43 | # undef QT_NO_CAST_FROM_ASCII | - | ||||||||||||||||||
| 44 | #endif | - | ||||||||||||||||||
| 45 | #ifdef QT_NO_CAST_TO_ASCII | - | ||||||||||||||||||
| 46 | # undef QT_NO_CAST_TO_ASCII | - | ||||||||||||||||||
| 47 | #endif | - | ||||||||||||||||||
| 48 | #include "qchar.h" | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | #include "qdatastream.h" | - | ||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | #include "qunicodetables_p.h" | - | ||||||||||||||||||
| 53 | #include "qunicodetables.cpp" | - | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | #include <algorithm> | - | ||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | #define FLAG(x) (1 << (x)) | - | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | /*! | - | ||||||||||||||||||
| 62 | \class QLatin1Char | - | ||||||||||||||||||
| 63 | \inmodule QtCore | - | ||||||||||||||||||
| 64 | \brief The QLatin1Char class provides an 8-bit ASCII/Latin-1 character. | - | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | \ingroup string-processing | - | ||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | This class is only useful to construct a QChar with 8-bit character. | - | ||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | \sa QChar, QLatin1String, QString | - | ||||||||||||||||||
| 71 | */ | - | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | /*! | - | ||||||||||||||||||
| 74 | \fn const char QLatin1Char::toLatin1() const | - | ||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | Converts a Latin-1 character to an 8-bit ASCII representation of the character. | - | ||||||||||||||||||
| 77 | */ | - | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | /*! | - | ||||||||||||||||||
| 80 | \fn const ushort QLatin1Char::unicode() const | - | ||||||||||||||||||
| 81 | - | |||||||||||||||||||
| 82 | Converts a Latin-1 character to an 16-bit-encoded Unicode representation | - | ||||||||||||||||||
| 83 | of the character. | - | ||||||||||||||||||
| 84 | */ | - | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | /*! | - | ||||||||||||||||||
| 87 | \fn QLatin1Char::QLatin1Char(char c) | - | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | Constructs a Latin-1 character for \a c. This constructor should be | - | ||||||||||||||||||
| 90 | used when the encoding of the input character is known to be Latin-1. | - | ||||||||||||||||||
| 91 | */ | - | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | /*! | - | ||||||||||||||||||
| 94 | \class QChar | - | ||||||||||||||||||
| 95 | \inmodule QtCore | - | ||||||||||||||||||
| 96 | \brief The QChar class provides a 16-bit Unicode character. | - | ||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | \ingroup string-processing | - | ||||||||||||||||||
| 99 | \reentrant | - | ||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | In Qt, Unicode characters are 16-bit entities without any markup | - | ||||||||||||||||||
| 102 | or structure. This class represents such an entity. It is | - | ||||||||||||||||||
| 103 | lightweight, so it can be used everywhere. Most compilers treat | - | ||||||||||||||||||
| 104 | it like a \c{unsigned short}. | - | ||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | QChar provides a full complement of testing/classification | - | ||||||||||||||||||
| 107 | functions, converting to and from other formats, converting from | - | ||||||||||||||||||
| 108 | composed to decomposed Unicode, and trying to compare and | - | ||||||||||||||||||
| 109 | case-convert if you ask it to. | - | ||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | The classification functions include functions like those in the | - | ||||||||||||||||||
| 112 | standard C++ header \<cctype\> (formerly \<ctype.h\>), but | - | ||||||||||||||||||
| 113 | operating on the full range of Unicode characters, not just for the ASCII | - | ||||||||||||||||||
| 114 | range. They all return true if the character is a certain type of character; | - | ||||||||||||||||||
| 115 | otherwise they return false. These classification functions are | - | ||||||||||||||||||
| 116 | isNull() (returns \c true if the character is '\\0'), isPrint() | - | ||||||||||||||||||
| 117 | (true if the character is any sort of printable character, | - | ||||||||||||||||||
| 118 | including whitespace), isPunct() (any sort of punctation), | - | ||||||||||||||||||
| 119 | isMark() (Unicode Mark), isLetter() (a letter), isNumber() (any | - | ||||||||||||||||||
| 120 | sort of numeric character, not just 0-9), isLetterOrNumber(), and | - | ||||||||||||||||||
| 121 | isDigit() (decimal digits). All of these are wrappers around | - | ||||||||||||||||||
| 122 | category() which return the Unicode-defined category of each | - | ||||||||||||||||||
| 123 | character. Some of these also calculate the derived properties | - | ||||||||||||||||||
| 124 | (for example isSpace() returns \c true if the character is of category | - | ||||||||||||||||||
| 125 | Separator_* or an exceptional code point from Other_Control category). | - | ||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | QChar also provides direction(), which indicates the "natural" | - | ||||||||||||||||||
| 128 | writing direction of this character. The joiningType() function | - | ||||||||||||||||||
| 129 | indicates how the character joins with it's neighbors (needed | - | ||||||||||||||||||
| 130 | mostly for Arabic or Syriac) and finally hasMirrored(), which indicates | - | ||||||||||||||||||
| 131 | whether the character needs to be mirrored when it is printed in | - | ||||||||||||||||||
| 132 | it's "unnatural" writing direction. | - | ||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | Composed Unicode characters (like \a ring) can be converted to | - | ||||||||||||||||||
| 135 | decomposed Unicode ("a" followed by "ring above") by using decomposition(). | - | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | In Unicode, comparison is not necessarily possible and case | - | ||||||||||||||||||
| 138 | conversion is very difficult at best. Unicode, covering the | - | ||||||||||||||||||
| 139 | "entire" world, also includes most of the world's case and | - | ||||||||||||||||||
| 140 | sorting problems. operator==() and friends will do comparison | - | ||||||||||||||||||
| 141 | based purely on the numeric Unicode value (code point) of the | - | ||||||||||||||||||
| 142 | characters, and toUpper() and toLower() will do case changes when | - | ||||||||||||||||||
| 143 | the character has a well-defined uppercase/lowercase equivalent. | - | ||||||||||||||||||
| 144 | For locale-dependent comparisons, use QString::localeAwareCompare(). | - | ||||||||||||||||||
| 145 | - | |||||||||||||||||||
| 146 | The conversion functions include unicode() (to a scalar), | - | ||||||||||||||||||
| 147 | toLatin1() (to scalar, but converts all non-Latin-1 characters to | - | ||||||||||||||||||
| 148 | 0), row() (gives the Unicode row), cell() (gives the Unicode | - | ||||||||||||||||||
| 149 | cell), digitValue() (gives the integer value of any of the | - | ||||||||||||||||||
| 150 | numerous digit characters), and a host of constructors. | - | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | QChar provides constructors and cast operators that make it easy | - | ||||||||||||||||||
| 153 | to convert to and from traditional 8-bit \c{char}s. If you | - | ||||||||||||||||||
| 154 | defined \c QT_NO_CAST_FROM_ASCII and \c QT_NO_CAST_TO_ASCII, as | - | ||||||||||||||||||
| 155 | explained in the QString documentation, you will need to | - | ||||||||||||||||||
| 156 | explicitly call fromLatin1(), or use QLatin1Char, | - | ||||||||||||||||||
| 157 | to construct a QChar from an 8-bit \c char, and you will need to | - | ||||||||||||||||||
| 158 | call toLatin1() to get the 8-bit value back. | - | ||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | For more information see | - | ||||||||||||||||||
| 161 | \l{http://www.unicode.org/ucd/}{"About the Unicode Character Database"}. | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | \sa Unicode, QString, QLatin1Char | - | ||||||||||||||||||
| 164 | */ | - | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | /*! | - | ||||||||||||||||||
| 167 | \enum QChar::UnicodeVersion | - | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | Specifies which version of the \l{http://www.unicode.org/}{Unicode standard} | - | ||||||||||||||||||
| 170 | introduced a certain character. | - | ||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | \value Unicode_1_1 Version 1.1 | - | ||||||||||||||||||
| 173 | \value Unicode_2_0 Version 2.0 | - | ||||||||||||||||||
| 174 | \value Unicode_2_1_2 Version 2.1.2 | - | ||||||||||||||||||
| 175 | \value Unicode_3_0 Version 3.0 | - | ||||||||||||||||||
| 176 | \value Unicode_3_1 Version 3.1 | - | ||||||||||||||||||
| 177 | \value Unicode_3_2 Version 3.2 | - | ||||||||||||||||||
| 178 | \value Unicode_4_0 Version 4.0 | - | ||||||||||||||||||
| 179 | \value Unicode_4_1 Version 4.1 | - | ||||||||||||||||||
| 180 | \value Unicode_5_0 Version 5.0 | - | ||||||||||||||||||
| 181 | \value Unicode_5_1 Version 5.1 | - | ||||||||||||||||||
| 182 | \value Unicode_5_2 Version 5.2 | - | ||||||||||||||||||
| 183 | \value Unicode_6_0 Version 6.0 | - | ||||||||||||||||||
| 184 | \value Unicode_6_1 Version 6.1 | - | ||||||||||||||||||
| 185 | \value Unicode_6_2 Version 6.2 | - | ||||||||||||||||||
| 186 | \value Unicode_6_3 Version 6.3 Since Qt 5.3 | - | ||||||||||||||||||
| 187 | \value Unicode_7_0 Version 7.0 Since Qt 5.5 | - | ||||||||||||||||||
| 188 | \value Unicode_8_0 Version 8.0 Since Qt 5.6 | - | ||||||||||||||||||
| 189 | \value Unicode_Unassigned The value is not assigned to any character | - | ||||||||||||||||||
| 190 | in version 8.0 of Unicode. | - | ||||||||||||||||||
| 191 | - | |||||||||||||||||||
| 192 | \sa unicodeVersion(), currentUnicodeVersion() | - | ||||||||||||||||||
| 193 | */ | - | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | /*! | - | ||||||||||||||||||
| 196 | \enum QChar::Category | - | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | This enum maps the Unicode character categories. | - | ||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | The following characters are normative in Unicode: | - | ||||||||||||||||||
| 201 | - | |||||||||||||||||||
| 202 | \value Mark_NonSpacing Unicode class name Mn | - | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | \value Mark_SpacingCombining Unicode class name Mc | - | ||||||||||||||||||
| 205 | - | |||||||||||||||||||
| 206 | \value Mark_Enclosing Unicode class name Me | - | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | \value Number_DecimalDigit Unicode class name Nd | - | ||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | \value Number_Letter Unicode class name Nl | - | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | \value Number_Other Unicode class name No | - | ||||||||||||||||||
| 213 | - | |||||||||||||||||||
| 214 | \value Separator_Space Unicode class name Zs | - | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | \value Separator_Line Unicode class name Zl | - | ||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | \value Separator_Paragraph Unicode class name Zp | - | ||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | \value Other_Control Unicode class name Cc | - | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | \value Other_Format Unicode class name Cf | - | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | \value Other_Surrogate Unicode class name Cs | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | \value Other_PrivateUse Unicode class name Co | - | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | \value Other_NotAssigned Unicode class name Cn | - | ||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | The following categories are informative in Unicode: | - | ||||||||||||||||||
| 232 | - | |||||||||||||||||||
| 233 | \value Letter_Uppercase Unicode class name Lu | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | \value Letter_Lowercase Unicode class name Ll | - | ||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | \value Letter_Titlecase Unicode class name Lt | - | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | \value Letter_Modifier Unicode class name Lm | - | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | \value Letter_Other Unicode class name Lo | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | \value Punctuation_Connector Unicode class name Pc | - | ||||||||||||||||||
| 244 | - | |||||||||||||||||||
| 245 | \value Punctuation_Dash Unicode class name Pd | - | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | \value Punctuation_Open Unicode class name Ps | - | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | \value Punctuation_Close Unicode class name Pe | - | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | \value Punctuation_InitialQuote Unicode class name Pi | - | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | \value Punctuation_FinalQuote Unicode class name Pf | - | ||||||||||||||||||
| 254 | - | |||||||||||||||||||
| 255 | \value Punctuation_Other Unicode class name Po | - | ||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | \value Symbol_Math Unicode class name Sm | - | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | \value Symbol_Currency Unicode class name Sc | - | ||||||||||||||||||
| 260 | - | |||||||||||||||||||
| 261 | \value Symbol_Modifier Unicode class name Sk | - | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | \value Symbol_Other Unicode class name So | - | ||||||||||||||||||
| 264 | - | |||||||||||||||||||
| 265 | \sa category() | - | ||||||||||||||||||
| 266 | */ | - | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | /*! | - | ||||||||||||||||||
| 269 | \enum QChar::Script | - | ||||||||||||||||||
| 270 | \since 5.1 | - | ||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | This enum type defines the Unicode script property values. | - | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | For details about the Unicode script property values see | - | ||||||||||||||||||
| 275 | \l{http://www.unicode.org/reports/tr24/}{Unicode Standard Annex #24}. | - | ||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | In order to conform to C/C++ naming conventions "Script_" is prepended | - | ||||||||||||||||||
| 278 | to the codes used in the Unicode Standard. | - | ||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | \value Script_Unknown For unassigned, private-use, noncharacter, and surrogate code points. | - | ||||||||||||||||||
| 281 | \value Script_Inherited For characters that may be used with multiple scripts | - | ||||||||||||||||||
| 282 | and that inherit their script from the preceding characters. | - | ||||||||||||||||||
| 283 | These include nonspacing marks, enclosing marks, | - | ||||||||||||||||||
| 284 | and zero width joiner/non-joiner characters. | - | ||||||||||||||||||
| 285 | \value Script_Common For characters that may be used with multiple scripts | - | ||||||||||||||||||
| 286 | and that do not inherit their script from the preceding characters. | - | ||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | \value Script_Latin | - | ||||||||||||||||||
| 289 | \value Script_Greek | - | ||||||||||||||||||
| 290 | \value Script_Cyrillic | - | ||||||||||||||||||
| 291 | \value Script_Armenian | - | ||||||||||||||||||
| 292 | \value Script_Hebrew | - | ||||||||||||||||||
| 293 | \value Script_Arabic | - | ||||||||||||||||||
| 294 | \value Script_Syriac | - | ||||||||||||||||||
| 295 | \value Script_Thaana | - | ||||||||||||||||||
| 296 | \value Script_Devanagari | - | ||||||||||||||||||
| 297 | \value Script_Bengali | - | ||||||||||||||||||
| 298 | \value Script_Gurmukhi | - | ||||||||||||||||||
| 299 | \value Script_Gujarati | - | ||||||||||||||||||
| 300 | \value Script_Oriya | - | ||||||||||||||||||
| 301 | \value Script_Tamil | - | ||||||||||||||||||
| 302 | \value Script_Telugu | - | ||||||||||||||||||
| 303 | \value Script_Kannada | - | ||||||||||||||||||
| 304 | \value Script_Malayalam | - | ||||||||||||||||||
| 305 | \value Script_Sinhala | - | ||||||||||||||||||
| 306 | \value Script_Thai | - | ||||||||||||||||||
| 307 | \value Script_Lao | - | ||||||||||||||||||
| 308 | \value Script_Tibetan | - | ||||||||||||||||||
| 309 | \value Script_Myanmar | - | ||||||||||||||||||
| 310 | \value Script_Georgian | - | ||||||||||||||||||
| 311 | \value Script_Hangul | - | ||||||||||||||||||
| 312 | \value Script_Ethiopic | - | ||||||||||||||||||
| 313 | \value Script_Cherokee | - | ||||||||||||||||||
| 314 | \value Script_CanadianAboriginal | - | ||||||||||||||||||
| 315 | \value Script_Ogham | - | ||||||||||||||||||
| 316 | \value Script_Runic | - | ||||||||||||||||||
| 317 | \value Script_Khmer | - | ||||||||||||||||||
| 318 | \value Script_Mongolian | - | ||||||||||||||||||
| 319 | \value Script_Hiragana | - | ||||||||||||||||||
| 320 | \value Script_Katakana | - | ||||||||||||||||||
| 321 | \value Script_Bopomofo | - | ||||||||||||||||||
| 322 | \value Script_Han | - | ||||||||||||||||||
| 323 | \value Script_Yi | - | ||||||||||||||||||
| 324 | \value Script_OldItalic | - | ||||||||||||||||||
| 325 | \value Script_Gothic | - | ||||||||||||||||||
| 326 | \value Script_Deseret | - | ||||||||||||||||||
| 327 | \value Script_Tagalog | - | ||||||||||||||||||
| 328 | \value Script_Hanunoo | - | ||||||||||||||||||
| 329 | \value Script_Buhid | - | ||||||||||||||||||
| 330 | \value Script_Tagbanwa | - | ||||||||||||||||||
| 331 | \value Script_Coptic | - | ||||||||||||||||||
| 332 | \value Script_Limbu | - | ||||||||||||||||||
| 333 | \value Script_TaiLe | - | ||||||||||||||||||
| 334 | \value Script_LinearB | - | ||||||||||||||||||
| 335 | \value Script_Ugaritic | - | ||||||||||||||||||
| 336 | \value Script_Shavian | - | ||||||||||||||||||
| 337 | \value Script_Osmanya | - | ||||||||||||||||||
| 338 | \value Script_Cypriot | - | ||||||||||||||||||
| 339 | \value Script_Braille | - | ||||||||||||||||||
| 340 | \value Script_Buginese | - | ||||||||||||||||||
| 341 | \value Script_NewTaiLue | - | ||||||||||||||||||
| 342 | \value Script_Glagolitic | - | ||||||||||||||||||
| 343 | \value Script_Tifinagh | - | ||||||||||||||||||
| 344 | \value Script_SylotiNagri | - | ||||||||||||||||||
| 345 | \value Script_OldPersian | - | ||||||||||||||||||
| 346 | \value Script_Kharoshthi | - | ||||||||||||||||||
| 347 | \value Script_Balinese | - | ||||||||||||||||||
| 348 | \value Script_Cuneiform | - | ||||||||||||||||||
| 349 | \value Script_Phoenician | - | ||||||||||||||||||
| 350 | \value Script_PhagsPa | - | ||||||||||||||||||
| 351 | \value Script_Nko | - | ||||||||||||||||||
| 352 | \value Script_Sundanese | - | ||||||||||||||||||
| 353 | \value Script_Lepcha | - | ||||||||||||||||||
| 354 | \value Script_OlChiki | - | ||||||||||||||||||
| 355 | \value Script_Vai | - | ||||||||||||||||||
| 356 | \value Script_Saurashtra | - | ||||||||||||||||||
| 357 | \value Script_KayahLi | - | ||||||||||||||||||
| 358 | \value Script_Rejang | - | ||||||||||||||||||
| 359 | \value Script_Lycian | - | ||||||||||||||||||
| 360 | \value Script_Carian | - | ||||||||||||||||||
| 361 | \value Script_Lydian | - | ||||||||||||||||||
| 362 | \value Script_Cham | - | ||||||||||||||||||
| 363 | \value Script_TaiTham | - | ||||||||||||||||||
| 364 | \value Script_TaiViet | - | ||||||||||||||||||
| 365 | \value Script_Avestan | - | ||||||||||||||||||
| 366 | \value Script_EgyptianHieroglyphs | - | ||||||||||||||||||
| 367 | \value Script_Samaritan | - | ||||||||||||||||||
| 368 | \value Script_Lisu | - | ||||||||||||||||||
| 369 | \value Script_Bamum | - | ||||||||||||||||||
| 370 | \value Script_Javanese | - | ||||||||||||||||||
| 371 | \value Script_MeeteiMayek | - | ||||||||||||||||||
| 372 | \value Script_ImperialAramaic | - | ||||||||||||||||||
| 373 | \value Script_OldSouthArabian | - | ||||||||||||||||||
| 374 | \value Script_InscriptionalParthian | - | ||||||||||||||||||
| 375 | \value Script_InscriptionalPahlavi | - | ||||||||||||||||||
| 376 | \value Script_OldTurkic | - | ||||||||||||||||||
| 377 | \value Script_Kaithi | - | ||||||||||||||||||
| 378 | \value Script_Batak | - | ||||||||||||||||||
| 379 | \value Script_Brahmi | - | ||||||||||||||||||
| 380 | \value Script_Mandaic | - | ||||||||||||||||||
| 381 | \value Script_Chakma | - | ||||||||||||||||||
| 382 | \value Script_MeroiticCursive | - | ||||||||||||||||||
| 383 | \value Script_MeroiticHieroglyphs | - | ||||||||||||||||||
| 384 | \value Script_Miao | - | ||||||||||||||||||
| 385 | \value Script_Sharada | - | ||||||||||||||||||
| 386 | \value Script_SoraSompeng | - | ||||||||||||||||||
| 387 | \value Script_Takri | - | ||||||||||||||||||
| 388 | \value Script_CaucasianAlbanian | - | ||||||||||||||||||
| 389 | \value Script_BassaVah | - | ||||||||||||||||||
| 390 | \value Script_Duployan | - | ||||||||||||||||||
| 391 | \value Script_Elbasan | - | ||||||||||||||||||
| 392 | \value Script_Grantha | - | ||||||||||||||||||
| 393 | \value Script_PahawhHmong | - | ||||||||||||||||||
| 394 | \value Script_Khojki | - | ||||||||||||||||||
| 395 | \value Script_LinearA | - | ||||||||||||||||||
| 396 | \value Script_Mahajani | - | ||||||||||||||||||
| 397 | \value Script_Manichaean | - | ||||||||||||||||||
| 398 | \value Script_MendeKikakui | - | ||||||||||||||||||
| 399 | \value Script_Modi | - | ||||||||||||||||||
| 400 | \value Script_Mro | - | ||||||||||||||||||
| 401 | \value Script_OldNorthArabian | - | ||||||||||||||||||
| 402 | \value Script_Nabataean | - | ||||||||||||||||||
| 403 | \value Script_Palmyrene | - | ||||||||||||||||||
| 404 | \value Script_PauCinHau | - | ||||||||||||||||||
| 405 | \value Script_OldPermic | - | ||||||||||||||||||
| 406 | \value Script_PsalterPahlavi | - | ||||||||||||||||||
| 407 | \value Script_Siddham | - | ||||||||||||||||||
| 408 | \value Script_Khudawadi | - | ||||||||||||||||||
| 409 | \value Script_Tirhuta | - | ||||||||||||||||||
| 410 | \value Script_WarangCiti | - | ||||||||||||||||||
| 411 | \value Script_Ahom | - | ||||||||||||||||||
| 412 | \value Script_AnatolianHieroglyphs | - | ||||||||||||||||||
| 413 | \value Script_Hatran | - | ||||||||||||||||||
| 414 | \value Script_Multani | - | ||||||||||||||||||
| 415 | \value Script_OldHungarian | - | ||||||||||||||||||
| 416 | \value Script_SignWriting | - | ||||||||||||||||||
| 417 | - | |||||||||||||||||||
| 418 | \omitvalue ScriptCount | - | ||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | \sa script() | - | ||||||||||||||||||
| 421 | */ | - | ||||||||||||||||||
| 422 | - | |||||||||||||||||||
| 423 | /*! | - | ||||||||||||||||||
| 424 | \enum QChar::Direction | - | ||||||||||||||||||
| 425 | - | |||||||||||||||||||
| 426 | This enum type defines the Unicode direction attributes. See the | - | ||||||||||||||||||
| 427 | \l{http://www.unicode.org/}{Unicode Standard} for a description | - | ||||||||||||||||||
| 428 | of the values. | - | ||||||||||||||||||
| 429 | - | |||||||||||||||||||
| 430 | In order to conform to C/C++ naming conventions "Dir" is prepended | - | ||||||||||||||||||
| 431 | to the codes used in the Unicode Standard. | - | ||||||||||||||||||
| 432 | - | |||||||||||||||||||
| 433 | \value DirAL | - | ||||||||||||||||||
| 434 | \value DirAN | - | ||||||||||||||||||
| 435 | \value DirB | - | ||||||||||||||||||
| 436 | \value DirBN | - | ||||||||||||||||||
| 437 | \value DirCS | - | ||||||||||||||||||
| 438 | \value DirEN | - | ||||||||||||||||||
| 439 | \value DirES | - | ||||||||||||||||||
| 440 | \value DirET | - | ||||||||||||||||||
| 441 | \value DirFSI Since Qt 5.3 | - | ||||||||||||||||||
| 442 | \value DirL | - | ||||||||||||||||||
| 443 | \value DirLRE | - | ||||||||||||||||||
| 444 | \value DirLRI Since Qt 5.3 | - | ||||||||||||||||||
| 445 | \value DirLRO | - | ||||||||||||||||||
| 446 | \value DirNSM | - | ||||||||||||||||||
| 447 | \value DirON | - | ||||||||||||||||||
| 448 | \value DirPDF | - | ||||||||||||||||||
| 449 | \value DirPDI Since Qt 5.3 | - | ||||||||||||||||||
| 450 | \value DirR | - | ||||||||||||||||||
| 451 | \value DirRLE | - | ||||||||||||||||||
| 452 | \value DirRLI Since Qt 5.3 | - | ||||||||||||||||||
| 453 | \value DirRLO | - | ||||||||||||||||||
| 454 | \value DirS | - | ||||||||||||||||||
| 455 | \value DirWS | - | ||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | \sa direction() | - | ||||||||||||||||||
| 458 | */ | - | ||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | /*! | - | ||||||||||||||||||
| 461 | \enum QChar::Decomposition | - | ||||||||||||||||||
| 462 | - | |||||||||||||||||||
| 463 | This enum type defines the Unicode decomposition attributes. See | - | ||||||||||||||||||
| 464 | the \l{http://www.unicode.org/}{Unicode Standard} for a | - | ||||||||||||||||||
| 465 | description of the values. | - | ||||||||||||||||||
| 466 | - | |||||||||||||||||||
| 467 | \value NoDecomposition | - | ||||||||||||||||||
| 468 | \value Canonical | - | ||||||||||||||||||
| 469 | \value Circle | - | ||||||||||||||||||
| 470 | \value Compat | - | ||||||||||||||||||
| 471 | \value Final | - | ||||||||||||||||||
| 472 | \value Font | - | ||||||||||||||||||
| 473 | \value Fraction | - | ||||||||||||||||||
| 474 | \value Initial | - | ||||||||||||||||||
| 475 | \value Isolated | - | ||||||||||||||||||
| 476 | \value Medial | - | ||||||||||||||||||
| 477 | \value Narrow | - | ||||||||||||||||||
| 478 | \value NoBreak | - | ||||||||||||||||||
| 479 | \value Small | - | ||||||||||||||||||
| 480 | \value Square | - | ||||||||||||||||||
| 481 | \value Sub | - | ||||||||||||||||||
| 482 | \value Super | - | ||||||||||||||||||
| 483 | \value Vertical | - | ||||||||||||||||||
| 484 | \value Wide | - | ||||||||||||||||||
| 485 | - | |||||||||||||||||||
| 486 | \sa decomposition() | - | ||||||||||||||||||
| 487 | */ | - | ||||||||||||||||||
| 488 | - | |||||||||||||||||||
| 489 | /*! | - | ||||||||||||||||||
| 490 | \enum QChar::JoiningType | - | ||||||||||||||||||
| 491 | since 5.3 | - | ||||||||||||||||||
| 492 | - | |||||||||||||||||||
| 493 | This enum type defines the Unicode joining type attributes. See the | - | ||||||||||||||||||
| 494 | \l{http://www.unicode.org/}{Unicode Standard} for a description of the values. | - | ||||||||||||||||||
| 495 | - | |||||||||||||||||||
| 496 | In order to conform to C/C++ naming conventions "Joining_" is prepended | - | ||||||||||||||||||
| 497 | to the codes used in the Unicode Standard. | - | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | \value Joining_None | - | ||||||||||||||||||
| 500 | \value Joining_Causing | - | ||||||||||||||||||
| 501 | \value Joining_Dual | - | ||||||||||||||||||
| 502 | \value Joining_Right | - | ||||||||||||||||||
| 503 | \value Joining_Left | - | ||||||||||||||||||
| 504 | \value Joining_Transparent | - | ||||||||||||||||||
| 505 | - | |||||||||||||||||||
| 506 | \sa joiningType() | - | ||||||||||||||||||
| 507 | */ | - | ||||||||||||||||||
| 508 | - | |||||||||||||||||||
| 509 | #if QT_DEPRECATED_SINCE(5, 3) | - | ||||||||||||||||||
| 510 | /*! | - | ||||||||||||||||||
| 511 | \enum QChar::Joining | - | ||||||||||||||||||
| 512 | \deprecated in 5.3, use JoiningType instead. | - | ||||||||||||||||||
| 513 | - | |||||||||||||||||||
| 514 | This enum type defines the Unicode joining attributes. See the | - | ||||||||||||||||||
| 515 | \l{http://www.unicode.org/}{Unicode Standard} for a description | - | ||||||||||||||||||
| 516 | of the values. | - | ||||||||||||||||||
| 517 | - | |||||||||||||||||||
| 518 | \value Center | - | ||||||||||||||||||
| 519 | \value Dual | - | ||||||||||||||||||
| 520 | \value OtherJoining | - | ||||||||||||||||||
| 521 | \value Right | - | ||||||||||||||||||
| 522 | - | |||||||||||||||||||
| 523 | \sa joining() | - | ||||||||||||||||||
| 524 | */ | - | ||||||||||||||||||
| 525 | #endif | - | ||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | /*! | - | ||||||||||||||||||
| 528 | \enum QChar::CombiningClass | - | ||||||||||||||||||
| 529 | - | |||||||||||||||||||
| 530 | \internal | - | ||||||||||||||||||
| 531 | - | |||||||||||||||||||
| 532 | This enum type defines names for some of the Unicode combining | - | ||||||||||||||||||
| 533 | classes. See the \l{http://www.unicode.org/}{Unicode Standard} | - | ||||||||||||||||||
| 534 | for a description of the values. | - | ||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | \value Combining_Above | - | ||||||||||||||||||
| 537 | \value Combining_AboveAttached | - | ||||||||||||||||||
| 538 | \value Combining_AboveLeft | - | ||||||||||||||||||
| 539 | \value Combining_AboveLeftAttached | - | ||||||||||||||||||
| 540 | \value Combining_AboveRight | - | ||||||||||||||||||
| 541 | \value Combining_AboveRightAttached | - | ||||||||||||||||||
| 542 | \value Combining_Below | - | ||||||||||||||||||
| 543 | \value Combining_BelowAttached | - | ||||||||||||||||||
| 544 | \value Combining_BelowLeft | - | ||||||||||||||||||
| 545 | \value Combining_BelowLeftAttached | - | ||||||||||||||||||
| 546 | \value Combining_BelowRight | - | ||||||||||||||||||
| 547 | \value Combining_BelowRightAttached | - | ||||||||||||||||||
| 548 | \value Combining_DoubleAbove | - | ||||||||||||||||||
| 549 | \value Combining_DoubleBelow | - | ||||||||||||||||||
| 550 | \value Combining_IotaSubscript | - | ||||||||||||||||||
| 551 | \value Combining_Left | - | ||||||||||||||||||
| 552 | \value Combining_LeftAttached | - | ||||||||||||||||||
| 553 | \value Combining_Right | - | ||||||||||||||||||
| 554 | \value Combining_RightAttached | - | ||||||||||||||||||
| 555 | */ | - | ||||||||||||||||||
| 556 | - | |||||||||||||||||||
| 557 | /*! | - | ||||||||||||||||||
| 558 | \enum QChar::SpecialCharacter | - | ||||||||||||||||||
| 559 | - | |||||||||||||||||||
| 560 | \value Null A QChar with this value isNull(). | - | ||||||||||||||||||
| 561 | \value Tabulation Character tabulation. | - | ||||||||||||||||||
| 562 | \value LineFeed | - | ||||||||||||||||||
| 563 | \value CarriageReturn | - | ||||||||||||||||||
| 564 | \value Space | - | ||||||||||||||||||
| 565 | \value Nbsp Non-breaking space. | - | ||||||||||||||||||
| 566 | \value SoftHyphen | - | ||||||||||||||||||
| 567 | \value ReplacementCharacter The character shown when a font has no glyph | - | ||||||||||||||||||
| 568 | for a certain codepoint. A special question mark character is often | - | ||||||||||||||||||
| 569 | used. Codecs use this codepoint when input data cannot be | - | ||||||||||||||||||
| 570 | represented in Unicode. | - | ||||||||||||||||||
| 571 | \value ObjectReplacementCharacter Used to represent an object such as an | - | ||||||||||||||||||
| 572 | image when such objects cannot be presented. | - | ||||||||||||||||||
| 573 | \value ByteOrderMark | - | ||||||||||||||||||
| 574 | \value ByteOrderSwapped | - | ||||||||||||||||||
| 575 | \value ParagraphSeparator | - | ||||||||||||||||||
| 576 | \value LineSeparator | - | ||||||||||||||||||
| 577 | \value LastValidCodePoint | - | ||||||||||||||||||
| 578 | */ | - | ||||||||||||||||||
| 579 | - | |||||||||||||||||||
| 580 | /*! | - | ||||||||||||||||||
| 581 | \fn void QChar::setCell(uchar cell) | - | ||||||||||||||||||
| 582 | \internal | - | ||||||||||||||||||
| 583 | */ | - | ||||||||||||||||||
| 584 | - | |||||||||||||||||||
| 585 | /*! | - | ||||||||||||||||||
| 586 | \fn void QChar::setRow(uchar row) | - | ||||||||||||||||||
| 587 | \internal | - | ||||||||||||||||||
| 588 | */ | - | ||||||||||||||||||
| 589 | - | |||||||||||||||||||
| 590 | /*! | - | ||||||||||||||||||
| 591 | \fn QChar::QChar() | - | ||||||||||||||||||
| 592 | - | |||||||||||||||||||
| 593 | Constructs a null QChar ('\\0'). | - | ||||||||||||||||||
| 594 | - | |||||||||||||||||||
| 595 | \sa isNull() | - | ||||||||||||||||||
| 596 | */ | - | ||||||||||||||||||
| 597 | - | |||||||||||||||||||
| 598 | /*! | - | ||||||||||||||||||
| 599 | \fn QChar::QChar(QLatin1Char ch) | - | ||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | Constructs a QChar corresponding to ASCII/Latin-1 character \a ch. | - | ||||||||||||||||||
| 602 | */ | - | ||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | /*! | - | ||||||||||||||||||
| 605 | \fn QChar::QChar(SpecialCharacter ch) | - | ||||||||||||||||||
| 606 | - | |||||||||||||||||||
| 607 | Constructs a QChar for the predefined character value \a ch. | - | ||||||||||||||||||
| 608 | */ | - | ||||||||||||||||||
| 609 | - | |||||||||||||||||||
| 610 | /*! | - | ||||||||||||||||||
| 611 | \fn QChar::QChar(char ch) | - | ||||||||||||||||||
| 612 | - | |||||||||||||||||||
| 613 | Constructs a QChar corresponding to ASCII/Latin-1 character \a ch. | - | ||||||||||||||||||
| 614 | - | |||||||||||||||||||
| 615 | \note This constructor is not available when \c QT_NO_CAST_FROM_ASCII | - | ||||||||||||||||||
| 616 | is defined. | - | ||||||||||||||||||
| 617 | - | |||||||||||||||||||
| 618 | \sa QT_NO_CAST_FROM_ASCII | - | ||||||||||||||||||
| 619 | */ | - | ||||||||||||||||||
| 620 | - | |||||||||||||||||||
| 621 | /*! | - | ||||||||||||||||||
| 622 | \fn QChar::QChar(uchar ch) | - | ||||||||||||||||||
| 623 | - | |||||||||||||||||||
| 624 | Constructs a QChar corresponding to ASCII/Latin-1 character \a ch. | - | ||||||||||||||||||
| 625 | - | |||||||||||||||||||
| 626 | \note This constructor is not available when \c QT_NO_CAST_FROM_ASCII | - | ||||||||||||||||||
| 627 | is defined. | - | ||||||||||||||||||
| 628 | - | |||||||||||||||||||
| 629 | \sa QT_NO_CAST_FROM_ASCII | - | ||||||||||||||||||
| 630 | */ | - | ||||||||||||||||||
| 631 | - | |||||||||||||||||||
| 632 | /*! | - | ||||||||||||||||||
| 633 | \fn QChar::QChar(uchar cell, uchar row) | - | ||||||||||||||||||
| 634 | - | |||||||||||||||||||
| 635 | Constructs a QChar for Unicode cell \a cell in row \a row. | - | ||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | \sa cell(), row() | - | ||||||||||||||||||
| 638 | */ | - | ||||||||||||||||||
| 639 | - | |||||||||||||||||||
| 640 | /*! | - | ||||||||||||||||||
| 641 | \fn QChar::QChar(ushort code) | - | ||||||||||||||||||
| 642 | - | |||||||||||||||||||
| 643 | Constructs a QChar for the character with Unicode code point \a code. | - | ||||||||||||||||||
| 644 | */ | - | ||||||||||||||||||
| 645 | - | |||||||||||||||||||
| 646 | /*! | - | ||||||||||||||||||
| 647 | \fn QChar::QChar(short code) | - | ||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | Constructs a QChar for the character with Unicode code point \a code. | - | ||||||||||||||||||
| 650 | */ | - | ||||||||||||||||||
| 651 | - | |||||||||||||||||||
| 652 | /*! | - | ||||||||||||||||||
| 653 | \fn QChar::QChar(uint code) | - | ||||||||||||||||||
| 654 | - | |||||||||||||||||||
| 655 | Constructs a QChar for the character with Unicode code point \a code. | - | ||||||||||||||||||
| 656 | */ | - | ||||||||||||||||||
| 657 | - | |||||||||||||||||||
| 658 | /*! | - | ||||||||||||||||||
| 659 | \fn QChar::QChar(int code) | - | ||||||||||||||||||
| 660 | - | |||||||||||||||||||
| 661 | Constructs a QChar for the character with Unicode code point \a code. | - | ||||||||||||||||||
| 662 | */ | - | ||||||||||||||||||
| 663 | - | |||||||||||||||||||
| 664 | /*! | - | ||||||||||||||||||
| 665 | \fn bool QChar::isNull() const | - | ||||||||||||||||||
| 666 | - | |||||||||||||||||||
| 667 | Returns \c true if the character is the Unicode character 0x0000 | - | ||||||||||||||||||
| 668 | ('\\0'); otherwise returns \c false. | - | ||||||||||||||||||
| 669 | */ | - | ||||||||||||||||||
| 670 | - | |||||||||||||||||||
| 671 | /*! | - | ||||||||||||||||||
| 672 | \fn uchar QChar::cell() const | - | ||||||||||||||||||
| 673 | - | |||||||||||||||||||
| 674 | Returns the cell (least significant byte) of the Unicode character. | - | ||||||||||||||||||
| 675 | - | |||||||||||||||||||
| 676 | \sa row() | - | ||||||||||||||||||
| 677 | */ | - | ||||||||||||||||||
| 678 | - | |||||||||||||||||||
| 679 | /*! | - | ||||||||||||||||||
| 680 | \fn uchar QChar::row() const | - | ||||||||||||||||||
| 681 | - | |||||||||||||||||||
| 682 | Returns the row (most significant byte) of the Unicode character. | - | ||||||||||||||||||
| 683 | - | |||||||||||||||||||
| 684 | \sa cell() | - | ||||||||||||||||||
| 685 | */ | - | ||||||||||||||||||
| 686 | - | |||||||||||||||||||
| 687 | /*! | - | ||||||||||||||||||
| 688 | \fn bool QChar::isPrint() const | - | ||||||||||||||||||
| 689 | - | |||||||||||||||||||
| 690 | Returns \c true if the character is a printable character; otherwise | - | ||||||||||||||||||
| 691 | returns \c false. This is any character not of category Other_*. | - | ||||||||||||||||||
| 692 | - | |||||||||||||||||||
| 693 | Note that this gives no indication of whether the character is | - | ||||||||||||||||||
| 694 | available in a particular font. | - | ||||||||||||||||||
| 695 | */ | - | ||||||||||||||||||
| 696 | - | |||||||||||||||||||
| 697 | /*! | - | ||||||||||||||||||
| 698 | \overload | - | ||||||||||||||||||
| 699 | \since 5.0 | - | ||||||||||||||||||
| 700 | - | |||||||||||||||||||
| 701 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 702 | a printable character; otherwise returns \c false. | - | ||||||||||||||||||
| 703 | This is any character not of category Other_*. | - | ||||||||||||||||||
| 704 | - | |||||||||||||||||||
| 705 | Note that this gives no indication of whether the character is | - | ||||||||||||||||||
| 706 | available in a particular font. | - | ||||||||||||||||||
| 707 | */ | - | ||||||||||||||||||
| 708 | bool QChar::isPrint(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 709 | { | - | ||||||||||||||||||
| 710 | if (ucs4 > LastValidCodePoint)
| 0-206544 | ||||||||||||||||||
| 711 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 712 | const int test = FLAG(Other_Control) | | - | ||||||||||||||||||
| 713 | FLAG(Other_Format) | | - | ||||||||||||||||||
| 714 | FLAG(Other_Surrogate) | | - | ||||||||||||||||||
| 715 | FLAG(Other_PrivateUse) | | - | ||||||||||||||||||
| 716 | FLAG(Other_NotAssigned); | - | ||||||||||||||||||
| 717 | return !(FLAG(qGetProp(ucs4)->category) & test); executed 206544 times by 79 tests: return !((1 << (qGetProp(ucs4)->category)) & test);Executed by:
| 206544 | ||||||||||||||||||
| 718 | } | - | ||||||||||||||||||
| 719 | - | |||||||||||||||||||
| 720 | /*! | - | ||||||||||||||||||
| 721 | \fn bool QChar::isSpace() const | - | ||||||||||||||||||
| 722 | - | |||||||||||||||||||
| 723 | Returns \c true if the character is a separator character | - | ||||||||||||||||||
| 724 | (Separator_* categories or certain code points from Other_Control category); | - | ||||||||||||||||||
| 725 | otherwise returns \c false. | - | ||||||||||||||||||
| 726 | */ | - | ||||||||||||||||||
| 727 | - | |||||||||||||||||||
| 728 | /*! | - | ||||||||||||||||||
| 729 | \fn bool QChar::isSpace(uint ucs4) | - | ||||||||||||||||||
| 730 | \overload | - | ||||||||||||||||||
| 731 | \since 5.0 | - | ||||||||||||||||||
| 732 | - | |||||||||||||||||||
| 733 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 734 | a separator character (Separator_* categories or certain code points | - | ||||||||||||||||||
| 735 | from Other_Control category); otherwise returns \c false. | - | ||||||||||||||||||
| 736 | */ | - | ||||||||||||||||||
| 737 | - | |||||||||||||||||||
| 738 | /*! | - | ||||||||||||||||||
| 739 | \internal | - | ||||||||||||||||||
| 740 | */ | - | ||||||||||||||||||
| 741 | bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 742 | { | - | ||||||||||||||||||
| 743 | if (ucs4 > LastValidCodePoint)
| 0-315775 | ||||||||||||||||||
| 744 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 745 | const int test = FLAG(Separator_Space) | | - | ||||||||||||||||||
| 746 | FLAG(Separator_Line) | | - | ||||||||||||||||||
| 747 | FLAG(Separator_Paragraph); | - | ||||||||||||||||||
| 748 | return FLAG(qGetProp(ucs4)->category) & test; executed 315775 times by 44 tests: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 315775 | ||||||||||||||||||
| 749 | } | - | ||||||||||||||||||
| 750 | - | |||||||||||||||||||
| 751 | /*! | - | ||||||||||||||||||
| 752 | \fn bool QChar::isMark() const | - | ||||||||||||||||||
| 753 | - | |||||||||||||||||||
| 754 | Returns \c true if the character is a mark (Mark_* categories); | - | ||||||||||||||||||
| 755 | otherwise returns \c false. | - | ||||||||||||||||||
| 756 | - | |||||||||||||||||||
| 757 | See QChar::Category for more information regarding marks. | - | ||||||||||||||||||
| 758 | */ | - | ||||||||||||||||||
| 759 | - | |||||||||||||||||||
| 760 | /*! | - | ||||||||||||||||||
| 761 | \overload | - | ||||||||||||||||||
| 762 | \since 5.0 | - | ||||||||||||||||||
| 763 | - | |||||||||||||||||||
| 764 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 765 | a mark (Mark_* categories); otherwise returns \c false. | - | ||||||||||||||||||
| 766 | */ | - | ||||||||||||||||||
| 767 | bool QChar::isMark(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 768 | { | - | ||||||||||||||||||
| 769 | if (ucs4 > LastValidCodePoint)
| 0-16148 | ||||||||||||||||||
| 770 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 771 | const int test = FLAG(Mark_NonSpacing) | | - | ||||||||||||||||||
| 772 | FLAG(Mark_SpacingCombining) | | - | ||||||||||||||||||
| 773 | FLAG(Mark_Enclosing); | - | ||||||||||||||||||
| 774 | return FLAG(qGetProp(ucs4)->category) & test; executed 16148 times by 3 tests: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 16148 | ||||||||||||||||||
| 775 | } | - | ||||||||||||||||||
| 776 | - | |||||||||||||||||||
| 777 | /*! | - | ||||||||||||||||||
| 778 | \fn bool QChar::isPunct() const | - | ||||||||||||||||||
| 779 | - | |||||||||||||||||||
| 780 | Returns \c true if the character is a punctuation mark (Punctuation_* | - | ||||||||||||||||||
| 781 | categories); otherwise returns \c false. | - | ||||||||||||||||||
| 782 | */ | - | ||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | /*! | - | ||||||||||||||||||
| 785 | \overload | - | ||||||||||||||||||
| 786 | \since 5.0 | - | ||||||||||||||||||
| 787 | - | |||||||||||||||||||
| 788 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 789 | a punctuation mark (Punctuation_* categories); otherwise returns \c false. | - | ||||||||||||||||||
| 790 | */ | - | ||||||||||||||||||
| 791 | bool QChar::isPunct(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 792 | { | - | ||||||||||||||||||
| 793 | if (ucs4 > LastValidCodePoint)
| 0 | ||||||||||||||||||
| 794 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 795 | const int test = FLAG(Punctuation_Connector) | | - | ||||||||||||||||||
| 796 | FLAG(Punctuation_Dash) | | - | ||||||||||||||||||
| 797 | FLAG(Punctuation_Open) | | - | ||||||||||||||||||
| 798 | FLAG(Punctuation_Close) | | - | ||||||||||||||||||
| 799 | FLAG(Punctuation_InitialQuote) | | - | ||||||||||||||||||
| 800 | FLAG(Punctuation_FinalQuote) | | - | ||||||||||||||||||
| 801 | FLAG(Punctuation_Other); | - | ||||||||||||||||||
| 802 | return FLAG(qGetProp(ucs4)->category) & test; never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 | ||||||||||||||||||
| 803 | } | - | ||||||||||||||||||
| 804 | - | |||||||||||||||||||
| 805 | /*! | - | ||||||||||||||||||
| 806 | \fn bool QChar::isSymbol() const | - | ||||||||||||||||||
| 807 | - | |||||||||||||||||||
| 808 | Returns \c true if the character is a symbol (Symbol_* categories); | - | ||||||||||||||||||
| 809 | otherwise returns \c false. | - | ||||||||||||||||||
| 810 | */ | - | ||||||||||||||||||
| 811 | - | |||||||||||||||||||
| 812 | /*! | - | ||||||||||||||||||
| 813 | \overload | - | ||||||||||||||||||
| 814 | \since 5.0 | - | ||||||||||||||||||
| 815 | - | |||||||||||||||||||
| 816 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 817 | a symbol (Symbol_* categories); otherwise returns \c false. | - | ||||||||||||||||||
| 818 | */ | - | ||||||||||||||||||
| 819 | bool QChar::isSymbol(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 820 | { | - | ||||||||||||||||||
| 821 | if (ucs4 > LastValidCodePoint)
| 0 | ||||||||||||||||||
| 822 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 823 | const int test = FLAG(Symbol_Math) | | - | ||||||||||||||||||
| 824 | FLAG(Symbol_Currency) | | - | ||||||||||||||||||
| 825 | FLAG(Symbol_Modifier) | | - | ||||||||||||||||||
| 826 | FLAG(Symbol_Other); | - | ||||||||||||||||||
| 827 | return FLAG(qGetProp(ucs4)->category) & test; never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 | ||||||||||||||||||
| 828 | } | - | ||||||||||||||||||
| 829 | - | |||||||||||||||||||
| 830 | /*! | - | ||||||||||||||||||
| 831 | \fn bool QChar::isLetter() const | - | ||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | Returns \c true if the character is a letter (Letter_* categories); | - | ||||||||||||||||||
| 834 | otherwise returns \c false. | - | ||||||||||||||||||
| 835 | */ | - | ||||||||||||||||||
| 836 | - | |||||||||||||||||||
| 837 | /*! | - | ||||||||||||||||||
| 838 | \fn bool QChar::isLetter(uint ucs4) | - | ||||||||||||||||||
| 839 | \overload | - | ||||||||||||||||||
| 840 | \since 5.0 | - | ||||||||||||||||||
| 841 | - | |||||||||||||||||||
| 842 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 843 | a letter (Letter_* categories); otherwise returns \c false. | - | ||||||||||||||||||
| 844 | */ | - | ||||||||||||||||||
| 845 | - | |||||||||||||||||||
| 846 | /*! | - | ||||||||||||||||||
| 847 | \internal | - | ||||||||||||||||||
| 848 | */ | - | ||||||||||||||||||
| 849 | bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 850 | { | - | ||||||||||||||||||
| 851 | if (ucs4 > LastValidCodePoint)
| 0-128 | ||||||||||||||||||
| 852 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 853 | const int test = FLAG(Letter_Uppercase) | | - | ||||||||||||||||||
| 854 | FLAG(Letter_Lowercase) | | - | ||||||||||||||||||
| 855 | FLAG(Letter_Titlecase) | | - | ||||||||||||||||||
| 856 | FLAG(Letter_Modifier) | | - | ||||||||||||||||||
| 857 | FLAG(Letter_Other); | - | ||||||||||||||||||
| 858 | return FLAG(qGetProp(ucs4)->category) & test; executed 128 times by 1 test: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 128 | ||||||||||||||||||
| 859 | } | - | ||||||||||||||||||
| 860 | - | |||||||||||||||||||
| 861 | /*! | - | ||||||||||||||||||
| 862 | \fn bool QChar::isNumber() const | - | ||||||||||||||||||
| 863 | - | |||||||||||||||||||
| 864 | Returns \c true if the character is a number (Number_* categories, | - | ||||||||||||||||||
| 865 | not just 0-9); otherwise returns \c false. | - | ||||||||||||||||||
| 866 | - | |||||||||||||||||||
| 867 | \sa isDigit() | - | ||||||||||||||||||
| 868 | */ | - | ||||||||||||||||||
| 869 | - | |||||||||||||||||||
| 870 | /*! | - | ||||||||||||||||||
| 871 | \fn bool QChar::isNumber(uint ucs4) | - | ||||||||||||||||||
| 872 | \overload | - | ||||||||||||||||||
| 873 | \since 5.0 | - | ||||||||||||||||||
| 874 | - | |||||||||||||||||||
| 875 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 876 | a number (Number_* categories, not just 0-9); otherwise returns \c false. | - | ||||||||||||||||||
| 877 | - | |||||||||||||||||||
| 878 | \sa isDigit() | - | ||||||||||||||||||
| 879 | */ | - | ||||||||||||||||||
| 880 | - | |||||||||||||||||||
| 881 | /*! | - | ||||||||||||||||||
| 882 | \internal | - | ||||||||||||||||||
| 883 | */ | - | ||||||||||||||||||
| 884 | bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 885 | { | - | ||||||||||||||||||
| 886 | if (ucs4 > LastValidCodePoint)
| 0 | ||||||||||||||||||
| 887 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 888 | const int test = FLAG(Number_DecimalDigit) | | - | ||||||||||||||||||
| 889 | FLAG(Number_Letter) | | - | ||||||||||||||||||
| 890 | FLAG(Number_Other); | - | ||||||||||||||||||
| 891 | return FLAG(qGetProp(ucs4)->category) & test; never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 | ||||||||||||||||||
| 892 | } | - | ||||||||||||||||||
| 893 | - | |||||||||||||||||||
| 894 | /*! | - | ||||||||||||||||||
| 895 | \fn bool QChar::isLetterOrNumber() const | - | ||||||||||||||||||
| 896 | - | |||||||||||||||||||
| 897 | Returns \c true if the character is a letter or number (Letter_* or | - | ||||||||||||||||||
| 898 | Number_* categories); otherwise returns \c false. | - | ||||||||||||||||||
| 899 | */ | - | ||||||||||||||||||
| 900 | - | |||||||||||||||||||
| 901 | /*! | - | ||||||||||||||||||
| 902 | \fn bool QChar::isLetterOrNumber(uint ucs4) | - | ||||||||||||||||||
| 903 | \overload | - | ||||||||||||||||||
| 904 | \since 5.0 | - | ||||||||||||||||||
| 905 | - | |||||||||||||||||||
| 906 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 907 | a letter or number (Letter_* or Number_* categories); otherwise returns \c false. | - | ||||||||||||||||||
| 908 | */ | - | ||||||||||||||||||
| 909 | - | |||||||||||||||||||
| 910 | /*! | - | ||||||||||||||||||
| 911 | \internal | - | ||||||||||||||||||
| 912 | */ | - | ||||||||||||||||||
| 913 | bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 914 | { | - | ||||||||||||||||||
| 915 | if (ucs4 > LastValidCodePoint)
| 0-81818 | ||||||||||||||||||
| 916 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 917 | const int test = FLAG(Letter_Uppercase) | | - | ||||||||||||||||||
| 918 | FLAG(Letter_Lowercase) | | - | ||||||||||||||||||
| 919 | FLAG(Letter_Titlecase) | | - | ||||||||||||||||||
| 920 | FLAG(Letter_Modifier) | | - | ||||||||||||||||||
| 921 | FLAG(Letter_Other) | | - | ||||||||||||||||||
| 922 | FLAG(Number_DecimalDigit) | | - | ||||||||||||||||||
| 923 | FLAG(Number_Letter) | | - | ||||||||||||||||||
| 924 | FLAG(Number_Other); | - | ||||||||||||||||||
| 925 | return FLAG(qGetProp(ucs4)->category) & test; executed 81818 times by 36 tests: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 81818 | ||||||||||||||||||
| 926 | } | - | ||||||||||||||||||
| 927 | - | |||||||||||||||||||
| 928 | /*! | - | ||||||||||||||||||
| 929 | \fn bool QChar::isDigit() const | - | ||||||||||||||||||
| 930 | - | |||||||||||||||||||
| 931 | Returns \c true if the character is a decimal digit | - | ||||||||||||||||||
| 932 | (Number_DecimalDigit); otherwise returns \c false. | - | ||||||||||||||||||
| 933 | - | |||||||||||||||||||
| 934 | \sa isNumber() | - | ||||||||||||||||||
| 935 | */ | - | ||||||||||||||||||
| 936 | - | |||||||||||||||||||
| 937 | /*! | - | ||||||||||||||||||
| 938 | \fn bool QChar::isDigit(uint ucs4) | - | ||||||||||||||||||
| 939 | \overload | - | ||||||||||||||||||
| 940 | \since 5.0 | - | ||||||||||||||||||
| 941 | - | |||||||||||||||||||
| 942 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 is | - | ||||||||||||||||||
| 943 | a decimal digit (Number_DecimalDigit); otherwise returns \c false. | - | ||||||||||||||||||
| 944 | - | |||||||||||||||||||
| 945 | \sa isNumber() | - | ||||||||||||||||||
| 946 | */ | - | ||||||||||||||||||
| 947 | - | |||||||||||||||||||
| 948 | /*! | - | ||||||||||||||||||
| 949 | \fn bool QChar::isNonCharacter() const | - | ||||||||||||||||||
| 950 | \since 5.0 | - | ||||||||||||||||||
| 951 | - | |||||||||||||||||||
| 952 | Returns \c true if the QChar is a non-character; false otherwise. | - | ||||||||||||||||||
| 953 | - | |||||||||||||||||||
| 954 | Unicode has a certain number of code points that are classified | - | ||||||||||||||||||
| 955 | as "non-characters:" that is, they can be used for internal purposes | - | ||||||||||||||||||
| 956 | in applications but cannot be used for text interchange. | - | ||||||||||||||||||
| 957 | Those are the last two entries each Unicode Plane ([0xfffe..0xffff], | - | ||||||||||||||||||
| 958 | [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef]. | - | ||||||||||||||||||
| 959 | */ | - | ||||||||||||||||||
| 960 | - | |||||||||||||||||||
| 961 | /*! | - | ||||||||||||||||||
| 962 | \fn bool QChar::isHighSurrogate() const | - | ||||||||||||||||||
| 963 | - | |||||||||||||||||||
| 964 | Returns \c true if the QChar is the high part of a UTF16 surrogate | - | ||||||||||||||||||
| 965 | (for example if its code point is in range [0xd800..0xdbff]); false otherwise. | - | ||||||||||||||||||
| 966 | */ | - | ||||||||||||||||||
| 967 | - | |||||||||||||||||||
| 968 | /*! | - | ||||||||||||||||||
| 969 | \fn bool QChar::isLowSurrogate() const | - | ||||||||||||||||||
| 970 | - | |||||||||||||||||||
| 971 | Returns \c true if the QChar is the low part of a UTF16 surrogate | - | ||||||||||||||||||
| 972 | (for example if its code point is in range [0xdc00..0xdfff]); false otherwise. | - | ||||||||||||||||||
| 973 | */ | - | ||||||||||||||||||
| 974 | - | |||||||||||||||||||
| 975 | /*! | - | ||||||||||||||||||
| 976 | \fn bool QChar::isSurrogate() const | - | ||||||||||||||||||
| 977 | \since 5.0 | - | ||||||||||||||||||
| 978 | - | |||||||||||||||||||
| 979 | Returns \c true if the QChar contains a code point that is in either | - | ||||||||||||||||||
| 980 | the high or the low part of the UTF-16 surrogate range | - | ||||||||||||||||||
| 981 | (for example if its code point is in range [0xd800..0xdfff]); false otherwise. | - | ||||||||||||||||||
| 982 | */ | - | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | /*! | - | ||||||||||||||||||
| 985 | \fn static bool QChar::isNonCharacter(uint ucs4) | - | ||||||||||||||||||
| 986 | \overload | - | ||||||||||||||||||
| 987 | \since 5.0 | - | ||||||||||||||||||
| 988 | - | |||||||||||||||||||
| 989 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 990 | is a non-character; false otherwise. | - | ||||||||||||||||||
| 991 | - | |||||||||||||||||||
| 992 | Unicode has a certain number of code points that are classified | - | ||||||||||||||||||
| 993 | as "non-characters:" that is, they can be used for internal purposes | - | ||||||||||||||||||
| 994 | in applications but cannot be used for text interchange. | - | ||||||||||||||||||
| 995 | Those are the last two entries each Unicode Plane ([0xfffe..0xffff], | - | ||||||||||||||||||
| 996 | [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef]. | - | ||||||||||||||||||
| 997 | */ | - | ||||||||||||||||||
| 998 | - | |||||||||||||||||||
| 999 | /*! | - | ||||||||||||||||||
| 1000 | \fn static bool QChar::isHighSurrogate(uint ucs4) | - | ||||||||||||||||||
| 1001 | \overload | - | ||||||||||||||||||
| 1002 | - | |||||||||||||||||||
| 1003 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1004 | is the high part of a UTF16 surrogate | - | ||||||||||||||||||
| 1005 | (for example if its code point is in range [0xd800..0xdbff]); false otherwise. | - | ||||||||||||||||||
| 1006 | */ | - | ||||||||||||||||||
| 1007 | - | |||||||||||||||||||
| 1008 | /*! | - | ||||||||||||||||||
| 1009 | \fn static bool QChar::isLowSurrogate(uint ucs4) | - | ||||||||||||||||||
| 1010 | \overload | - | ||||||||||||||||||
| 1011 | - | |||||||||||||||||||
| 1012 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1013 | is the low part of a UTF16 surrogate | - | ||||||||||||||||||
| 1014 | (for example if its code point is in range [0xdc00..0xdfff]); false otherwise. | - | ||||||||||||||||||
| 1015 | */ | - | ||||||||||||||||||
| 1016 | - | |||||||||||||||||||
| 1017 | /*! | - | ||||||||||||||||||
| 1018 | \fn static bool QChar::isSurrogate(uint ucs4) | - | ||||||||||||||||||
| 1019 | \overload | - | ||||||||||||||||||
| 1020 | \since 5.0 | - | ||||||||||||||||||
| 1021 | - | |||||||||||||||||||
| 1022 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1023 | contains a code point that is in either the high or the low part of the | - | ||||||||||||||||||
| 1024 | UTF-16 surrogate range (for example if its code point is in range [0xd800..0xdfff]); | - | ||||||||||||||||||
| 1025 | false otherwise. | - | ||||||||||||||||||
| 1026 | */ | - | ||||||||||||||||||
| 1027 | - | |||||||||||||||||||
| 1028 | /*! | - | ||||||||||||||||||
| 1029 | \fn static bool QChar::requiresSurrogates(uint ucs4) | - | ||||||||||||||||||
| 1030 | - | |||||||||||||||||||
| 1031 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1032 | can be split into the high and low parts of a UTF16 surrogate | - | ||||||||||||||||||
| 1033 | (for example if its code point is greater than or equals to 0x10000); | - | ||||||||||||||||||
| 1034 | false otherwise. | - | ||||||||||||||||||
| 1035 | */ | - | ||||||||||||||||||
| 1036 | - | |||||||||||||||||||
| 1037 | /*! | - | ||||||||||||||||||
| 1038 | \fn static uint QChar::surrogateToUcs4(ushort high, ushort low) | - | ||||||||||||||||||
| 1039 | - | |||||||||||||||||||
| 1040 | Converts a UTF16 surrogate pair with the given \a high and \a low values | - | ||||||||||||||||||
| 1041 | to it's UCS-4-encoded code point. | - | ||||||||||||||||||
| 1042 | */ | - | ||||||||||||||||||
| 1043 | - | |||||||||||||||||||
| 1044 | /*! | - | ||||||||||||||||||
| 1045 | \fn static uint QChar::surrogateToUcs4(QChar high, QChar low) | - | ||||||||||||||||||
| 1046 | \overload | - | ||||||||||||||||||
| 1047 | - | |||||||||||||||||||
| 1048 | Converts a UTF16 surrogate pair (\a high, \a low) to it's UCS-4-encoded code point. | - | ||||||||||||||||||
| 1049 | */ | - | ||||||||||||||||||
| 1050 | - | |||||||||||||||||||
| 1051 | /*! | - | ||||||||||||||||||
| 1052 | \fn static ushort QChar::highSurrogate(uint ucs4) | - | ||||||||||||||||||
| 1053 | - | |||||||||||||||||||
| 1054 | Returns the high surrogate part of a UCS-4-encoded code point. | - | ||||||||||||||||||
| 1055 | The returned result is undefined if \a ucs4 is smaller than 0x10000. | - | ||||||||||||||||||
| 1056 | */ | - | ||||||||||||||||||
| 1057 | - | |||||||||||||||||||
| 1058 | /*! | - | ||||||||||||||||||
| 1059 | \fn static ushort QChar::lowSurrogate(uint ucs4) | - | ||||||||||||||||||
| 1060 | - | |||||||||||||||||||
| 1061 | Returns the low surrogate part of a UCS-4-encoded code point. | - | ||||||||||||||||||
| 1062 | The returned result is undefined if \a ucs4 is smaller than 0x10000. | - | ||||||||||||||||||
| 1063 | */ | - | ||||||||||||||||||
| 1064 | - | |||||||||||||||||||
| 1065 | /*! | - | ||||||||||||||||||
| 1066 | \fn int QChar::digitValue() const | - | ||||||||||||||||||
| 1067 | - | |||||||||||||||||||
| 1068 | Returns the numeric value of the digit, or -1 if the character is not a digit. | - | ||||||||||||||||||
| 1069 | */ | - | ||||||||||||||||||
| 1070 | - | |||||||||||||||||||
| 1071 | /*! | - | ||||||||||||||||||
| 1072 | \overload | - | ||||||||||||||||||
| 1073 | Returns the numeric value of the digit specified by the UCS-4-encoded | - | ||||||||||||||||||
| 1074 | character, \a ucs4, or -1 if the character is not a digit. | - | ||||||||||||||||||
| 1075 | */ | - | ||||||||||||||||||
| 1076 | int QChar::digitValue(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1077 | { | - | ||||||||||||||||||
| 1078 | if (ucs4 > LastValidCodePoint)
| 1-5797012 | ||||||||||||||||||
| 1079 | return -1; executed 1 time by 1 test: return -1;Executed by:
| 1 | ||||||||||||||||||
| 1080 | return qGetProp(ucs4)->digitValue; executed 5797012 times by 430 tests: return qGetProp(ucs4)->digitValue;Executed by:
| 5797012 | ||||||||||||||||||
| 1081 | } | - | ||||||||||||||||||
| 1082 | - | |||||||||||||||||||
| 1083 | /*! | - | ||||||||||||||||||
| 1084 | \fn QChar::Category QChar::category() const | - | ||||||||||||||||||
| 1085 | - | |||||||||||||||||||
| 1086 | Returns the character's category. | - | ||||||||||||||||||
| 1087 | */ | - | ||||||||||||||||||
| 1088 | - | |||||||||||||||||||
| 1089 | /*! | - | ||||||||||||||||||
| 1090 | \overload | - | ||||||||||||||||||
| 1091 | Returns the category of the UCS-4-encoded character specified by \a ucs4. | - | ||||||||||||||||||
| 1092 | */ | - | ||||||||||||||||||
| 1093 | QChar::Category QChar::category(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1094 | { | - | ||||||||||||||||||
| 1095 | if (ucs4 > LastValidCodePoint)
| 1-9539049 | ||||||||||||||||||
| 1096 | return QChar::Other_NotAssigned; executed 1 time by 1 test: return QChar::Other_NotAssigned;Executed by:
| 1 | ||||||||||||||||||
| 1097 | return (QChar::Category) qGetProp(ucs4)->category; executed 9539049 times by 132 tests: return (QChar::Category) qGetProp(ucs4)->category;Executed by:
| 9539049 | ||||||||||||||||||
| 1098 | } | - | ||||||||||||||||||
| 1099 | - | |||||||||||||||||||
| 1100 | /*! | - | ||||||||||||||||||
| 1101 | \fn QChar::Direction QChar::direction() const | - | ||||||||||||||||||
| 1102 | - | |||||||||||||||||||
| 1103 | Returns the character's direction. | - | ||||||||||||||||||
| 1104 | */ | - | ||||||||||||||||||
| 1105 | - | |||||||||||||||||||
| 1106 | /*! | - | ||||||||||||||||||
| 1107 | \overload | - | ||||||||||||||||||
| 1108 | Returns the direction of the UCS-4-encoded character specified by \a ucs4. | - | ||||||||||||||||||
| 1109 | */ | - | ||||||||||||||||||
| 1110 | QChar::Direction QChar::direction(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1111 | { | - | ||||||||||||||||||
| 1112 | if (ucs4 > LastValidCodePoint)
| 0-1879525 | ||||||||||||||||||
| 1113 | return QChar::DirL; never executed: return QChar::DirL; | 0 | ||||||||||||||||||
| 1114 | return (QChar::Direction) qGetProp(ucs4)->direction; executed 1879525 times by 104 tests: return (QChar::Direction) qGetProp(ucs4)->direction;Executed by:
| 1879525 | ||||||||||||||||||
| 1115 | } | - | ||||||||||||||||||
| 1116 | - | |||||||||||||||||||
| 1117 | /*! | - | ||||||||||||||||||
| 1118 | \fn QChar::JoiningType QChar::joiningType() const | - | ||||||||||||||||||
| 1119 | \since 5.3 | - | ||||||||||||||||||
| 1120 | - | |||||||||||||||||||
| 1121 | Returns information about the joining type attributes of the character | - | ||||||||||||||||||
| 1122 | (needed for certain languages such as Arabic or Syriac). | - | ||||||||||||||||||
| 1123 | */ | - | ||||||||||||||||||
| 1124 | - | |||||||||||||||||||
| 1125 | /*! | - | ||||||||||||||||||
| 1126 | \overload | - | ||||||||||||||||||
| 1127 | \since 5.3 | - | ||||||||||||||||||
| 1128 | - | |||||||||||||||||||
| 1129 | Returns information about the joining type attributes of the UCS-4-encoded | - | ||||||||||||||||||
| 1130 | character specified by \a ucs4 | - | ||||||||||||||||||
| 1131 | (needed for certain languages such as Arabic or Syriac). | - | ||||||||||||||||||
| 1132 | */ | - | ||||||||||||||||||
| 1133 | QChar::JoiningType QChar::joiningType(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1134 | { | - | ||||||||||||||||||
| 1135 | if (ucs4 > LastValidCodePoint)
| 0-2169 | ||||||||||||||||||
| 1136 | return QChar::Joining_None; never executed: return QChar::Joining_None; | 0 | ||||||||||||||||||
| 1137 | return QChar::JoiningType(qGetProp(ucs4)->joining); executed 2169 times by 14 tests: return QChar::JoiningType(qGetProp(ucs4)->joining);Executed by:
| 2169 | ||||||||||||||||||
| 1138 | } | - | ||||||||||||||||||
| 1139 | - | |||||||||||||||||||
| 1140 | #if QT_DEPRECATED_SINCE(5, 3) | - | ||||||||||||||||||
| 1141 | /*! | - | ||||||||||||||||||
| 1142 | \fn QChar::Joining QChar::joining() const | - | ||||||||||||||||||
| 1143 | \deprecated in 5.3, use joiningType() instead. | - | ||||||||||||||||||
| 1144 | - | |||||||||||||||||||
| 1145 | Returns information about the joining properties of the character | - | ||||||||||||||||||
| 1146 | (needed for certain languages such as Arabic). | - | ||||||||||||||||||
| 1147 | */ | - | ||||||||||||||||||
| 1148 | - | |||||||||||||||||||
| 1149 | /*! | - | ||||||||||||||||||
| 1150 | \overload | - | ||||||||||||||||||
| 1151 | \deprecated in 5.3, use joiningType() instead. | - | ||||||||||||||||||
| 1152 | - | |||||||||||||||||||
| 1153 | Returns information about the joining properties of the UCS-4-encoded | - | ||||||||||||||||||
| 1154 | character specified by \a ucs4 (needed for certain languages such as Arabic). | - | ||||||||||||||||||
| 1155 | */ | - | ||||||||||||||||||
| 1156 | QChar::Joining QChar::joining(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1157 | { | - | ||||||||||||||||||
| 1158 | if (ucs4 > LastValidCodePoint)
| 0 | ||||||||||||||||||
| 1159 | return QChar::OtherJoining; never executed: return QChar::OtherJoining; | 0 | ||||||||||||||||||
| 1160 | switch (qGetProp(ucs4)->joining) { | - | ||||||||||||||||||
| 1161 | case QChar::Joining_Causing: return QChar::Center; never executed: return QChar::Center;never executed: case QChar::Joining_Causing: | 0 | ||||||||||||||||||
| 1162 | case QChar::Joining_Dual: return QChar::Dual; never executed: return QChar::Dual;never executed: case QChar::Joining_Dual: | 0 | ||||||||||||||||||
| 1163 | case QChar::Joining_Right: return QChar::Right; never executed: return QChar::Right;never executed: case QChar::Joining_Right: | 0 | ||||||||||||||||||
| 1164 | default: break; never executed: break;never executed: default: | 0 | ||||||||||||||||||
| 1165 | } | - | ||||||||||||||||||
| 1166 | return QChar::OtherJoining; never executed: return QChar::OtherJoining; | 0 | ||||||||||||||||||
| 1167 | } | - | ||||||||||||||||||
| 1168 | #endif | - | ||||||||||||||||||
| 1169 | - | |||||||||||||||||||
| 1170 | /*! | - | ||||||||||||||||||
| 1171 | \fn bool QChar::hasMirrored() const | - | ||||||||||||||||||
| 1172 | - | |||||||||||||||||||
| 1173 | Returns \c true if the character should be reversed if the text | - | ||||||||||||||||||
| 1174 | direction is reversed; otherwise returns \c false. | - | ||||||||||||||||||
| 1175 | - | |||||||||||||||||||
| 1176 | A bit faster equivalent of (ch.mirroredChar() != ch). | - | ||||||||||||||||||
| 1177 | - | |||||||||||||||||||
| 1178 | \sa mirroredChar() | - | ||||||||||||||||||
| 1179 | */ | - | ||||||||||||||||||
| 1180 | - | |||||||||||||||||||
| 1181 | /*! | - | ||||||||||||||||||
| 1182 | \overload | - | ||||||||||||||||||
| 1183 | \since 5.0 | - | ||||||||||||||||||
| 1184 | - | |||||||||||||||||||
| 1185 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1186 | should be reversed if the text direction is reversed; otherwise returns \c false. | - | ||||||||||||||||||
| 1187 | - | |||||||||||||||||||
| 1188 | A bit faster equivalent of (QChar::mirroredChar(ucs4) != ucs4). | - | ||||||||||||||||||
| 1189 | - | |||||||||||||||||||
| 1190 | \sa mirroredChar() | - | ||||||||||||||||||
| 1191 | */ | - | ||||||||||||||||||
| 1192 | bool QChar::hasMirrored(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1193 | { | - | ||||||||||||||||||
| 1194 | if (ucs4 > LastValidCodePoint)
| 0-4 | ||||||||||||||||||
| 1195 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 1196 | return qGetProp(ucs4)->mirrorDiff != 0; executed 4 times by 1 test: return qGetProp(ucs4)->mirrorDiff != 0;Executed by:
| 4 | ||||||||||||||||||
| 1197 | } | - | ||||||||||||||||||
| 1198 | - | |||||||||||||||||||
| 1199 | /*! | - | ||||||||||||||||||
| 1200 | \fn bool QChar::isLower() const | - | ||||||||||||||||||
| 1201 | - | |||||||||||||||||||
| 1202 | Returns \c true if the character is a lowercase letter, for example | - | ||||||||||||||||||
| 1203 | category() is Letter_Lowercase. | - | ||||||||||||||||||
| 1204 | - | |||||||||||||||||||
| 1205 | \sa isUpper(), toLower(), toUpper() | - | ||||||||||||||||||
| 1206 | */ | - | ||||||||||||||||||
| 1207 | - | |||||||||||||||||||
| 1208 | /*! | - | ||||||||||||||||||
| 1209 | \fn static bool QChar::isLower(uint ucs4) | - | ||||||||||||||||||
| 1210 | \overload | - | ||||||||||||||||||
| 1211 | \since 5.0 | - | ||||||||||||||||||
| 1212 | - | |||||||||||||||||||
| 1213 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1214 | is a lowercase letter, for example category() is Letter_Lowercase. | - | ||||||||||||||||||
| 1215 | - | |||||||||||||||||||
| 1216 | \sa isUpper(), toLower(), toUpper() | - | ||||||||||||||||||
| 1217 | */ | - | ||||||||||||||||||
| 1218 | - | |||||||||||||||||||
| 1219 | /*! | - | ||||||||||||||||||
| 1220 | \fn bool QChar::isUpper() const | - | ||||||||||||||||||
| 1221 | - | |||||||||||||||||||
| 1222 | Returns \c true if the character is an uppercase letter, for example | - | ||||||||||||||||||
| 1223 | category() is Letter_Uppercase. | - | ||||||||||||||||||
| 1224 | - | |||||||||||||||||||
| 1225 | \sa isLower(), toUpper(), toLower() | - | ||||||||||||||||||
| 1226 | */ | - | ||||||||||||||||||
| 1227 | - | |||||||||||||||||||
| 1228 | /*! | - | ||||||||||||||||||
| 1229 | \fn static bool QChar::isUpper(uint ucs4) | - | ||||||||||||||||||
| 1230 | \overload | - | ||||||||||||||||||
| 1231 | \since 5.0 | - | ||||||||||||||||||
| 1232 | - | |||||||||||||||||||
| 1233 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1234 | is an uppercase letter, for example category() is Letter_Uppercase. | - | ||||||||||||||||||
| 1235 | - | |||||||||||||||||||
| 1236 | \sa isLower(), toUpper(), toLower() | - | ||||||||||||||||||
| 1237 | */ | - | ||||||||||||||||||
| 1238 | - | |||||||||||||||||||
| 1239 | /*! | - | ||||||||||||||||||
| 1240 | \fn bool QChar::isTitleCase() const | - | ||||||||||||||||||
| 1241 | - | |||||||||||||||||||
| 1242 | Returns \c true if the character is a titlecase letter, for example | - | ||||||||||||||||||
| 1243 | category() is Letter_Titlecase. | - | ||||||||||||||||||
| 1244 | - | |||||||||||||||||||
| 1245 | \sa isLower(), toUpper(), toLower(), toTitleCase() | - | ||||||||||||||||||
| 1246 | */ | - | ||||||||||||||||||
| 1247 | - | |||||||||||||||||||
| 1248 | /*! | - | ||||||||||||||||||
| 1249 | \fn static bool QChar::isTitleCase(uint ucs4) | - | ||||||||||||||||||
| 1250 | \overload | - | ||||||||||||||||||
| 1251 | \since 5.0 | - | ||||||||||||||||||
| 1252 | - | |||||||||||||||||||
| 1253 | Returns \c true if the UCS-4-encoded character specified by \a ucs4 | - | ||||||||||||||||||
| 1254 | is a titlecase letter, for example category() is Letter_Titlecase. | - | ||||||||||||||||||
| 1255 | - | |||||||||||||||||||
| 1256 | \sa isLower(), toUpper(), toLower(), toTitleCase() | - | ||||||||||||||||||
| 1257 | */ | - | ||||||||||||||||||
| 1258 | /*! | - | ||||||||||||||||||
| 1259 | \fn QChar QChar::mirroredChar() const | - | ||||||||||||||||||
| 1260 | - | |||||||||||||||||||
| 1261 | Returns the mirrored character if this character is a mirrored | - | ||||||||||||||||||
| 1262 | character; otherwise returns the character itself. | - | ||||||||||||||||||
| 1263 | - | |||||||||||||||||||
| 1264 | \sa hasMirrored() | - | ||||||||||||||||||
| 1265 | */ | - | ||||||||||||||||||
| 1266 | - | |||||||||||||||||||
| 1267 | /*! | - | ||||||||||||||||||
| 1268 | \overload | - | ||||||||||||||||||
| 1269 | Returns the mirrored character if the UCS-4-encoded character specified | - | ||||||||||||||||||
| 1270 | by \a ucs4 is a mirrored character; otherwise returns the character itself. | - | ||||||||||||||||||
| 1271 | - | |||||||||||||||||||
| 1272 | \sa hasMirrored() | - | ||||||||||||||||||
| 1273 | */ | - | ||||||||||||||||||
| 1274 | uint QChar::mirroredChar(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1275 | { | - | ||||||||||||||||||
| 1276 | if (ucs4 > LastValidCodePoint)
| 0-129532 | ||||||||||||||||||
| 1277 | return ucs4; never executed: return ucs4; | 0 | ||||||||||||||||||
| 1278 | return ucs4 + qGetProp(ucs4)->mirrorDiff; executed 129532 times by 12 tests: return ucs4 + qGetProp(ucs4)->mirrorDiff;Executed by:
| 129532 | ||||||||||||||||||
| 1279 | } | - | ||||||||||||||||||
| 1280 | - | |||||||||||||||||||
| 1281 | - | |||||||||||||||||||
| 1282 | // constants for Hangul (de)composition, see UAX #15 | - | ||||||||||||||||||
| 1283 | enum { | - | ||||||||||||||||||
| 1284 | Hangul_SBase = 0xac00, | - | ||||||||||||||||||
| 1285 | Hangul_LBase = 0x1100, | - | ||||||||||||||||||
| 1286 | Hangul_VBase = 0x1161, | - | ||||||||||||||||||
| 1287 | Hangul_TBase = 0x11a7, | - | ||||||||||||||||||
| 1288 | Hangul_LCount = 19, | - | ||||||||||||||||||
| 1289 | Hangul_VCount = 21, | - | ||||||||||||||||||
| 1290 | Hangul_TCount = 28, | - | ||||||||||||||||||
| 1291 | Hangul_NCount = Hangul_VCount * Hangul_TCount, | - | ||||||||||||||||||
| 1292 | Hangul_SCount = Hangul_LCount * Hangul_NCount | - | ||||||||||||||||||
| 1293 | }; | - | ||||||||||||||||||
| 1294 | - | |||||||||||||||||||
| 1295 | // buffer has to have a length of 3. It's needed for Hangul decomposition | - | ||||||||||||||||||
| 1296 | static const unsigned short * QT_FASTCALL decompositionHelper | - | ||||||||||||||||||
| 1297 | (uint ucs4, int *length, int *tag, unsigned short *buffer) | - | ||||||||||||||||||
| 1298 | { | - | ||||||||||||||||||
| 1299 | if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) {
| 21808-507118 | ||||||||||||||||||
| 1300 | // compute Hangul syllable decomposition as per UAX #15 | - | ||||||||||||||||||
| 1301 | const uint SIndex = ucs4 - Hangul_SBase; | - | ||||||||||||||||||
| 1302 | buffer[0] = Hangul_LBase + SIndex / Hangul_NCount; // L | - | ||||||||||||||||||
| 1303 | buffer[1] = Hangul_VBase + (SIndex % Hangul_NCount) / Hangul_TCount; // V | - | ||||||||||||||||||
| 1304 | buffer[2] = Hangul_TBase + SIndex % Hangul_TCount; // T | - | ||||||||||||||||||
| 1305 | *length = buffer[2] == Hangul_TBase ? 2 : 3;
| 3573-64643 | ||||||||||||||||||
| 1306 | *tag = QChar::Canonical; | - | ||||||||||||||||||
| 1307 | return buffer; executed 68216 times by 1 test: return buffer;Executed by:
| 68216 | ||||||||||||||||||
| 1308 | } | - | ||||||||||||||||||
| 1309 | - | |||||||||||||||||||
| 1310 | const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);
| 0-499564 | ||||||||||||||||||
| 1311 | if (index == 0xffff) {
| 37886-491040 | ||||||||||||||||||
| 1312 | *length = 0; | - | ||||||||||||||||||
| 1313 | *tag = QChar::NoDecomposition; | - | ||||||||||||||||||
| 1314 | return 0; executed 491040 times by 3 tests: return 0;Executed by:
| 491040 | ||||||||||||||||||
| 1315 | } | - | ||||||||||||||||||
| 1316 | - | |||||||||||||||||||
| 1317 | const unsigned short *decomposition = uc_decomposition_map+index; | - | ||||||||||||||||||
| 1318 | *tag = (*decomposition) & 0xff; | - | ||||||||||||||||||
| 1319 | *length = (*decomposition) >> 8; | - | ||||||||||||||||||
| 1320 | return decomposition+1; executed 37886 times by 3 tests: return decomposition+1;Executed by:
| 37886 | ||||||||||||||||||
| 1321 | } | - | ||||||||||||||||||
| 1322 | - | |||||||||||||||||||
| 1323 | /*! | - | ||||||||||||||||||
| 1324 | Decomposes a character into it's constituent parts. Returns an empty string | - | ||||||||||||||||||
| 1325 | if no decomposition exists. | - | ||||||||||||||||||
| 1326 | */ | - | ||||||||||||||||||
| 1327 | QString QChar::decomposition() const | - | ||||||||||||||||||
| 1328 | { | - | ||||||||||||||||||
| 1329 | return QChar::decomposition(ucs); never executed: return QChar::decomposition(ucs); | 0 | ||||||||||||||||||
| 1330 | } | - | ||||||||||||||||||
| 1331 | - | |||||||||||||||||||
| 1332 | /*! | - | ||||||||||||||||||
| 1333 | \overload | - | ||||||||||||||||||
| 1334 | Decomposes the UCS-4-encoded character specified by \a ucs4 into it's | - | ||||||||||||||||||
| 1335 | constituent parts. Returns an empty string if no decomposition exists. | - | ||||||||||||||||||
| 1336 | */ | - | ||||||||||||||||||
| 1337 | QString QChar::decomposition(uint ucs4) | - | ||||||||||||||||||
| 1338 | { | - | ||||||||||||||||||
| 1339 | unsigned short buffer[3]; | - | ||||||||||||||||||
| 1340 | int length; | - | ||||||||||||||||||
| 1341 | int tag; | - | ||||||||||||||||||
| 1342 | const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer); | - | ||||||||||||||||||
| 1343 | return QString(reinterpret_cast<const QChar *>(d), length); executed 5 times by 1 test: return QString(reinterpret_cast<const QChar *>(d), length);Executed by:
| 5 | ||||||||||||||||||
| 1344 | } | - | ||||||||||||||||||
| 1345 | - | |||||||||||||||||||
| 1346 | /*! | - | ||||||||||||||||||
| 1347 | \fn QChar::Decomposition QChar::decompositionTag() const | - | ||||||||||||||||||
| 1348 | - | |||||||||||||||||||
| 1349 | Returns the tag defining the composition of the character. Returns | - | ||||||||||||||||||
| 1350 | QChar::NoDecomposition if no decomposition exists. | - | ||||||||||||||||||
| 1351 | */ | - | ||||||||||||||||||
| 1352 | - | |||||||||||||||||||
| 1353 | /*! | - | ||||||||||||||||||
| 1354 | \overload | - | ||||||||||||||||||
| 1355 | Returns the tag defining the composition of the UCS-4-encoded character | - | ||||||||||||||||||
| 1356 | specified by \a ucs4. Returns QChar::NoDecomposition if no decomposition exists. | - | ||||||||||||||||||
| 1357 | */ | - | ||||||||||||||||||
| 1358 | QChar::Decomposition QChar::decompositionTag(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1359 | { | - | ||||||||||||||||||
| 1360 | if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount)
| 24-1275746 | ||||||||||||||||||
| 1361 | return QChar::Canonical; executed 22344 times by 1 test: return QChar::Canonical;Executed by:
| 22344 | ||||||||||||||||||
| 1362 | const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);
| 0-1275746 | ||||||||||||||||||
| 1363 | if (index == 0xffff)
| 55674-1220096 | ||||||||||||||||||
| 1364 | return QChar::NoDecomposition; executed 1220096 times by 85 tests: return QChar::NoDecomposition;Executed by:
| 1220096 | ||||||||||||||||||
| 1365 | return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff); executed 55674 times by 7 tests: return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);Executed by:
| 55674 | ||||||||||||||||||
| 1366 | } | - | ||||||||||||||||||
| 1367 | - | |||||||||||||||||||
| 1368 | /*! | - | ||||||||||||||||||
| 1369 | \fn unsigned char QChar::combiningClass() const | - | ||||||||||||||||||
| 1370 | - | |||||||||||||||||||
| 1371 | Returns the combining class for the character as defined in the | - | ||||||||||||||||||
| 1372 | Unicode standard. This is mainly useful as a positioning hint for | - | ||||||||||||||||||
| 1373 | marks attached to a base character. | - | ||||||||||||||||||
| 1374 | - | |||||||||||||||||||
| 1375 | The Qt text rendering engine uses this information to correctly | - | ||||||||||||||||||
| 1376 | position non-spacing marks around a base character. | - | ||||||||||||||||||
| 1377 | */ | - | ||||||||||||||||||
| 1378 | - | |||||||||||||||||||
| 1379 | /*! | - | ||||||||||||||||||
| 1380 | \overload | - | ||||||||||||||||||
| 1381 | Returns the combining class for the UCS-4-encoded character specified by | - | ||||||||||||||||||
| 1382 | \a ucs4, as defined in the Unicode standard. | - | ||||||||||||||||||
| 1383 | */ | - | ||||||||||||||||||
| 1384 | unsigned char QChar::combiningClass(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1385 | { | - | ||||||||||||||||||
| 1386 | if (ucs4 > LastValidCodePoint)
| 0-5518214 | ||||||||||||||||||
| 1387 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
| 1388 | return (unsigned char) qGetProp(ucs4)->combiningClass; executed 5518214 times by 112 tests: return (unsigned char) qGetProp(ucs4)->combiningClass;Executed by:
| 5518214 | ||||||||||||||||||
| 1389 | } | - | ||||||||||||||||||
| 1390 | - | |||||||||||||||||||
| 1391 | /*! | - | ||||||||||||||||||
| 1392 | \fn QChar::Script QChar::script() const | - | ||||||||||||||||||
| 1393 | \since 5.1 | - | ||||||||||||||||||
| 1394 | - | |||||||||||||||||||
| 1395 | Returns the Unicode script property value for this character. | - | ||||||||||||||||||
| 1396 | */ | - | ||||||||||||||||||
| 1397 | - | |||||||||||||||||||
| 1398 | /*! | - | ||||||||||||||||||
| 1399 | \overload | - | ||||||||||||||||||
| 1400 | \since 5.1 | - | ||||||||||||||||||
| 1401 | - | |||||||||||||||||||
| 1402 | Returns the Unicode script property value for the character specified in | - | ||||||||||||||||||
| 1403 | its UCS-4-encoded form as \a ucs4. | - | ||||||||||||||||||
| 1404 | */ | - | ||||||||||||||||||
| 1405 | QChar::Script QChar::script(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1406 | { | - | ||||||||||||||||||
| 1407 | if (ucs4 > LastValidCodePoint)
| 0-2639 | ||||||||||||||||||
| 1408 | return QChar::Script_Unknown; never executed: return QChar::Script_Unknown; | 0 | ||||||||||||||||||
| 1409 | return (QChar::Script) qGetProp(ucs4)->script; executed 2639 times by 62 tests: return (QChar::Script) qGetProp(ucs4)->script;Executed by:
| 2639 | ||||||||||||||||||
| 1410 | } | - | ||||||||||||||||||
| 1411 | - | |||||||||||||||||||
| 1412 | /*! | - | ||||||||||||||||||
| 1413 | \fn QChar::UnicodeVersion QChar::unicodeVersion() const | - | ||||||||||||||||||
| 1414 | - | |||||||||||||||||||
| 1415 | Returns the Unicode version that introduced this character. | - | ||||||||||||||||||
| 1416 | */ | - | ||||||||||||||||||
| 1417 | - | |||||||||||||||||||
| 1418 | /*! | - | ||||||||||||||||||
| 1419 | \overload | - | ||||||||||||||||||
| 1420 | Returns the Unicode version that introduced the character specified in | - | ||||||||||||||||||
| 1421 | its UCS-4-encoded form as \a ucs4. | - | ||||||||||||||||||
| 1422 | */ | - | ||||||||||||||||||
| 1423 | QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1424 | { | - | ||||||||||||||||||
| 1425 | if (ucs4 > LastValidCodePoint)
| 1-609469 | ||||||||||||||||||
| 1426 | return QChar::Unicode_Unassigned; executed 1 time by 1 test: return QChar::Unicode_Unassigned;Executed by:
| 1 | ||||||||||||||||||
| 1427 | return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion; executed 609469 times by 6 tests: return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;Executed by:
| 609469 | ||||||||||||||||||
| 1428 | } | - | ||||||||||||||||||
| 1429 | - | |||||||||||||||||||
| 1430 | /*! | - | ||||||||||||||||||
| 1431 | Returns the most recent supported Unicode version. | - | ||||||||||||||||||
| 1432 | */ | - | ||||||||||||||||||
| 1433 | QChar::UnicodeVersion QChar::currentUnicodeVersion() Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1434 | { | - | ||||||||||||||||||
| 1435 | return UNICODE_DATA_VERSION; executed 565704 times by 4 tests: return QChar::Unicode_8_0;Executed by:
| 565704 | ||||||||||||||||||
| 1436 | } | - | ||||||||||||||||||
| 1437 | - | |||||||||||||||||||
| 1438 | - | |||||||||||||||||||
| 1439 | template <typename Traits, typename T> | - | ||||||||||||||||||
| 1440 | Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1441 | { | - | ||||||||||||||||||
| 1442 | const QUnicodeTables::Properties *prop = qGetProp(uc); | - | ||||||||||||||||||
| 1443 | - | |||||||||||||||||||
| 1444 | if (Q_UNLIKELY(Traits::caseSpecial(prop))) {
| 347-11269411 | ||||||||||||||||||
| 1445 | const ushort *specialCase = specialCaseMap + Traits::caseDiff(prop); | - | ||||||||||||||||||
| 1446 | // so far, there are no special cases beyond BMP (guaranteed by the qunicodetables generator) | - | ||||||||||||||||||
| 1447 | return *specialCase == 1 ? specialCase[1] : uc; executed 347 times by 5 tests: return *specialCase == 1 ? specialCase[1] : uc;Executed by:
| 347 | ||||||||||||||||||
| 1448 | } | - | ||||||||||||||||||
| 1449 | - | |||||||||||||||||||
| 1450 | return uc + Traits::caseDiff(prop); executed 11269411 times by 226 tests: return uc + Traits::caseDiff(prop);Executed by:
| 11269411 | ||||||||||||||||||
| 1451 | } | - | ||||||||||||||||||
| 1452 | - | |||||||||||||||||||
| 1453 | /*! | - | ||||||||||||||||||
| 1454 | \fn QChar QChar::toLower() const | - | ||||||||||||||||||
| 1455 | - | |||||||||||||||||||
| 1456 | Returns the lowercase equivalent if the character is uppercase or titlecase; | - | ||||||||||||||||||
| 1457 | otherwise returns the character itself. | - | ||||||||||||||||||
| 1458 | */ | - | ||||||||||||||||||
| 1459 | - | |||||||||||||||||||
| 1460 | /*! | - | ||||||||||||||||||
| 1461 | \overload | - | ||||||||||||||||||
| 1462 | Returns the lowercase equivalent of the UCS-4-encoded character specified | - | ||||||||||||||||||
| 1463 | by \a ucs4 if the character is uppercase or titlecase; otherwise returns | - | ||||||||||||||||||
| 1464 | the character itself. | - | ||||||||||||||||||
| 1465 | */ | - | ||||||||||||||||||
| 1466 | uint QChar::toLower(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1467 | { | - | ||||||||||||||||||
| 1468 | if (ucs4 > LastValidCodePoint)
| 0-5516452 | ||||||||||||||||||
| 1469 | return ucs4; never executed: return ucs4; | 0 | ||||||||||||||||||
| 1470 | return convertCase_helper<QUnicodeTables::LowercaseTraits>(ucs4); executed 5516452 times by 94 tests: return convertCase_helper<QUnicodeTables::LowercaseTraits>(ucs4);Executed by:
| 5516452 | ||||||||||||||||||
| 1471 | } | - | ||||||||||||||||||
| 1472 | - | |||||||||||||||||||
| 1473 | /*! | - | ||||||||||||||||||
| 1474 | \fn QChar QChar::toUpper() const | - | ||||||||||||||||||
| 1475 | - | |||||||||||||||||||
| 1476 | Returns the uppercase equivalent if the character is lowercase or titlecase; | - | ||||||||||||||||||
| 1477 | otherwise returns the character itself. | - | ||||||||||||||||||
| 1478 | */ | - | ||||||||||||||||||
| 1479 | - | |||||||||||||||||||
| 1480 | /*! | - | ||||||||||||||||||
| 1481 | \overload | - | ||||||||||||||||||
| 1482 | Returns the uppercase equivalent of the UCS-4-encoded character specified | - | ||||||||||||||||||
| 1483 | by \a ucs4 if the character is lowercase or titlecase; otherwise returns | - | ||||||||||||||||||
| 1484 | the character itself. | - | ||||||||||||||||||
| 1485 | */ | - | ||||||||||||||||||
| 1486 | uint QChar::toUpper(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1487 | { | - | ||||||||||||||||||
| 1488 | if (ucs4 > LastValidCodePoint)
| 0-2026370 | ||||||||||||||||||
| 1489 | return ucs4; never executed: return ucs4; | 0 | ||||||||||||||||||
| 1490 | return convertCase_helper<QUnicodeTables::UppercaseTraits>(ucs4); executed 2026370 times by 187 tests: return convertCase_helper<QUnicodeTables::UppercaseTraits>(ucs4);Executed by:
| 2026370 | ||||||||||||||||||
| 1491 | } | - | ||||||||||||||||||
| 1492 | - | |||||||||||||||||||
| 1493 | /*! | - | ||||||||||||||||||
| 1494 | \fn QChar QChar::toTitleCase() const | - | ||||||||||||||||||
| 1495 | - | |||||||||||||||||||
| 1496 | Returns the title case equivalent if the character is lowercase or uppercase; | - | ||||||||||||||||||
| 1497 | otherwise returns the character itself. | - | ||||||||||||||||||
| 1498 | */ | - | ||||||||||||||||||
| 1499 | - | |||||||||||||||||||
| 1500 | /*! | - | ||||||||||||||||||
| 1501 | \overload | - | ||||||||||||||||||
| 1502 | Returns the title case equivalent of the UCS-4-encoded character specified | - | ||||||||||||||||||
| 1503 | by \a ucs4 if the character is lowercase or uppercase; otherwise returns | - | ||||||||||||||||||
| 1504 | the character itself. | - | ||||||||||||||||||
| 1505 | */ | - | ||||||||||||||||||
| 1506 | uint QChar::toTitleCase(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1507 | { | - | ||||||||||||||||||
| 1508 | if (ucs4 > LastValidCodePoint)
| 0-50 | ||||||||||||||||||
| 1509 | return ucs4; never executed: return ucs4; | 0 | ||||||||||||||||||
| 1510 | return convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4); executed 50 times by 2 tests: return convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4);Executed by:
| 50 | ||||||||||||||||||
| 1511 | } | - | ||||||||||||||||||
| 1512 | - | |||||||||||||||||||
| 1513 | static inline uint foldCase(const ushort *ch, const ushort *start) | - | ||||||||||||||||||
| 1514 | { | - | ||||||||||||||||||
| 1515 | uint ucs4 = *ch; | - | ||||||||||||||||||
| 1516 | if (QChar::isLowSurrogate(ucs4) && ch > start && QChar::isHighSurrogate(*(ch - 1)))
| 0-46351 | ||||||||||||||||||
| 1517 | ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4); never executed: ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4); | 0 | ||||||||||||||||||
| 1518 | return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4); executed 46351 times by 25 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
| 46351 | ||||||||||||||||||
| 1519 | } | - | ||||||||||||||||||
| 1520 | - | |||||||||||||||||||
| 1521 | static inline uint foldCase(uint ch, uint &last) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1522 | { | - | ||||||||||||||||||
| 1523 | uint ucs4 = ch; | - | ||||||||||||||||||
| 1524 | if (QChar::isLowSurrogate(ucs4) && QChar::isHighSurrogate(last))
| 0-3463562 | ||||||||||||||||||
| 1525 | ucs4 = QChar::surrogateToUcs4(last, ucs4); executed 28 times by 2 tests: ucs4 = QChar::surrogateToUcs4(last, ucs4);Executed by:
| 28 | ||||||||||||||||||
| 1526 | last = ch; | - | ||||||||||||||||||
| 1527 | return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4); executed 3463590 times by 170 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
| 3463590 | ||||||||||||||||||
| 1528 | } | - | ||||||||||||||||||
| 1529 | - | |||||||||||||||||||
| 1530 | static inline ushort foldCase(ushort ch) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1531 | { | - | ||||||||||||||||||
| 1532 | return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch); executed 151362 times by 53 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);Executed by:
| 151362 | ||||||||||||||||||
| 1533 | } | - | ||||||||||||||||||
| 1534 | - | |||||||||||||||||||
| 1535 | /*! | - | ||||||||||||||||||
| 1536 | \fn QChar QChar::toCaseFolded() const | - | ||||||||||||||||||
| 1537 | - | |||||||||||||||||||
| 1538 | Returns the case folded equivalent of the character. | - | ||||||||||||||||||
| 1539 | For most Unicode characters this is the same as toLower(). | - | ||||||||||||||||||
| 1540 | */ | - | ||||||||||||||||||
| 1541 | - | |||||||||||||||||||
| 1542 | /*! | - | ||||||||||||||||||
| 1543 | \overload | - | ||||||||||||||||||
| 1544 | Returns the case folded equivalent of the UCS-4-encoded character specified | - | ||||||||||||||||||
| 1545 | by \a ucs4. For most Unicode characters this is the same as toLower(). | - | ||||||||||||||||||
| 1546 | */ | - | ||||||||||||||||||
| 1547 | uint QChar::toCaseFolded(uint ucs4) Q_DECL_NOTHROW | - | ||||||||||||||||||
| 1548 | { | - | ||||||||||||||||||
| 1549 | if (ucs4 > LastValidCodePoint)
| 0-65583 | ||||||||||||||||||
| 1550 | return ucs4; never executed: return ucs4; | 0 | ||||||||||||||||||
| 1551 | return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4); executed 65583 times by 2 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
| 65583 | ||||||||||||||||||
| 1552 | } | - | ||||||||||||||||||
| 1553 | - | |||||||||||||||||||
| 1554 | /*! | - | ||||||||||||||||||
| 1555 | \fn char QChar::toLatin1() const | - | ||||||||||||||||||
| 1556 | - | |||||||||||||||||||
| 1557 | Returns the Latin-1 character equivalent to the QChar, or 0. This | - | ||||||||||||||||||
| 1558 | is mainly useful for non-internationalized software. | - | ||||||||||||||||||
| 1559 | - | |||||||||||||||||||
| 1560 | \note It is not possible to distinguish a non-Latin-1 character from a Latin-1 0 | - | ||||||||||||||||||
| 1561 | (NUL) character. Prefer to use unicode(), which does not have this ambiguity. | - | ||||||||||||||||||
| 1562 | - | |||||||||||||||||||
| 1563 | \sa unicode() | - | ||||||||||||||||||
| 1564 | */ | - | ||||||||||||||||||
| 1565 | - | |||||||||||||||||||
| 1566 | /*! | - | ||||||||||||||||||
| 1567 | \fn QChar QChar::fromLatin1(char) | - | ||||||||||||||||||
| 1568 | - | |||||||||||||||||||
| 1569 | Converts the Latin-1 character \a c to its equivalent QChar. This | - | ||||||||||||||||||
| 1570 | is mainly useful for non-internationalized software. | - | ||||||||||||||||||
| 1571 | - | |||||||||||||||||||
| 1572 | An alternative is to use QLatin1Char. | - | ||||||||||||||||||
| 1573 | - | |||||||||||||||||||
| 1574 | \sa toLatin1(), unicode() | - | ||||||||||||||||||
| 1575 | */ | - | ||||||||||||||||||
| 1576 | - | |||||||||||||||||||
| 1577 | /*! | - | ||||||||||||||||||
| 1578 | \fn char QChar::toAscii() const | - | ||||||||||||||||||
| 1579 | \deprecated | - | ||||||||||||||||||
| 1580 | - | |||||||||||||||||||
| 1581 | Returns the Latin-1 character value of the QChar, or 0 if the character is not | - | ||||||||||||||||||
| 1582 | representable. | - | ||||||||||||||||||
| 1583 | - | |||||||||||||||||||
| 1584 | The main purpose of this function is to preserve ASCII characters used | - | ||||||||||||||||||
| 1585 | in C strings. This is mainly useful for developers of non-internationalized | - | ||||||||||||||||||
| 1586 | software. | - | ||||||||||||||||||
| 1587 | - | |||||||||||||||||||
| 1588 | \note It is not possible to distinguish a non-Latin 1 character from an ASCII 0 | - | ||||||||||||||||||
| 1589 | (NUL) character. Prefer to use unicode(), which does not have this ambiguity. | - | ||||||||||||||||||
| 1590 | - | |||||||||||||||||||
| 1591 | \note This function does not check whether the character value is inside | - | ||||||||||||||||||
| 1592 | the valid range of US-ASCII. | - | ||||||||||||||||||
| 1593 | - | |||||||||||||||||||
| 1594 | \sa toLatin1(), unicode() | - | ||||||||||||||||||
| 1595 | */ | - | ||||||||||||||||||
| 1596 | - | |||||||||||||||||||
| 1597 | /*! | - | ||||||||||||||||||
| 1598 | \fn QChar QChar::fromAscii(char) | - | ||||||||||||||||||
| 1599 | \deprecated | - | ||||||||||||||||||
| 1600 | - | |||||||||||||||||||
| 1601 | Converts the ASCII character \a c to it's equivalent QChar. This | - | ||||||||||||||||||
| 1602 | is mainly useful for non-internationalized software. | - | ||||||||||||||||||
| 1603 | - | |||||||||||||||||||
| 1604 | An alternative is to use QLatin1Char. | - | ||||||||||||||||||
| 1605 | - | |||||||||||||||||||
| 1606 | \sa fromLatin1(), unicode() | - | ||||||||||||||||||
| 1607 | */ | - | ||||||||||||||||||
| 1608 | - | |||||||||||||||||||
| 1609 | #ifndef QT_NO_DATASTREAM | - | ||||||||||||||||||
| 1610 | /*! | - | ||||||||||||||||||
| 1611 | \relates QChar | - | ||||||||||||||||||
| 1612 | - | |||||||||||||||||||
| 1613 | Writes the char \a chr to the stream \a out. | - | ||||||||||||||||||
| 1614 | - | |||||||||||||||||||
| 1615 | \sa {Serializing Qt Data Types} | - | ||||||||||||||||||
| 1616 | */ | - | ||||||||||||||||||
| 1617 | QDataStream &operator<<(QDataStream &out, QChar chr) | - | ||||||||||||||||||
| 1618 | { | - | ||||||||||||||||||
| 1619 | out << quint16(chr.unicode()); | - | ||||||||||||||||||
| 1620 | return out; executed 5 times by 2 tests: return out;Executed by:
| 5 | ||||||||||||||||||
| 1621 | } | - | ||||||||||||||||||
| 1622 | - | |||||||||||||||||||
| 1623 | /*! | - | ||||||||||||||||||
| 1624 | \relates QChar | - | ||||||||||||||||||
| 1625 | - | |||||||||||||||||||
| 1626 | Reads a char from the stream \a in into char \a chr. | - | ||||||||||||||||||
| 1627 | - | |||||||||||||||||||
| 1628 | \sa {Serializing Qt Data Types} | - | ||||||||||||||||||
| 1629 | */ | - | ||||||||||||||||||
| 1630 | QDataStream &operator>>(QDataStream &in, QChar &chr) | - | ||||||||||||||||||
| 1631 | { | - | ||||||||||||||||||
| 1632 | quint16 u; | - | ||||||||||||||||||
| 1633 | in >> u; | - | ||||||||||||||||||
| 1634 | chr.unicode() = ushort(u); | - | ||||||||||||||||||
| 1635 | return in; executed 9 times by 2 tests: return in;Executed by:
| 9 | ||||||||||||||||||
| 1636 | } | - | ||||||||||||||||||
| 1637 | #endif // QT_NO_DATASTREAM | - | ||||||||||||||||||
| 1638 | - | |||||||||||||||||||
| 1639 | /*! | - | ||||||||||||||||||
| 1640 | \fn ushort & QChar::unicode() | - | ||||||||||||||||||
| 1641 | - | |||||||||||||||||||
| 1642 | Returns a reference to the numeric Unicode value of the QChar. | - | ||||||||||||||||||
| 1643 | */ | - | ||||||||||||||||||
| 1644 | - | |||||||||||||||||||
| 1645 | /*! | - | ||||||||||||||||||
| 1646 | \fn ushort QChar::unicode() const | - | ||||||||||||||||||
| 1647 | - | |||||||||||||||||||
| 1648 | Returns the numeric Unicode value of the QChar. | - | ||||||||||||||||||
| 1649 | */ | - | ||||||||||||||||||
| 1650 | - | |||||||||||||||||||
| 1651 | /***************************************************************************** | - | ||||||||||||||||||
| 1652 | Documentation of QChar related functions | - | ||||||||||||||||||
| 1653 | *****************************************************************************/ | - | ||||||||||||||||||
| 1654 | - | |||||||||||||||||||
| 1655 | /*! | - | ||||||||||||||||||
| 1656 | \fn bool operator==(QChar c1, QChar c2) | - | ||||||||||||||||||
| 1657 | - | |||||||||||||||||||
| 1658 | \relates QChar | - | ||||||||||||||||||
| 1659 | - | |||||||||||||||||||
| 1660 | Returns \c true if \a c1 and \a c2 are the same Unicode character; | - | ||||||||||||||||||
| 1661 | otherwise returns \c false. | - | ||||||||||||||||||
| 1662 | */ | - | ||||||||||||||||||
| 1663 | - | |||||||||||||||||||
| 1664 | /*! | - | ||||||||||||||||||
| 1665 | \fn int operator!=(QChar c1, QChar c2) | - | ||||||||||||||||||
| 1666 | - | |||||||||||||||||||
| 1667 | \relates QChar | - | ||||||||||||||||||
| 1668 | - | |||||||||||||||||||
| 1669 | Returns \c true if \a c1 and \a c2 are not the same Unicode | - | ||||||||||||||||||
| 1670 | character; otherwise returns \c false. | - | ||||||||||||||||||
| 1671 | */ | - | ||||||||||||||||||
| 1672 | - | |||||||||||||||||||
| 1673 | /*! | - | ||||||||||||||||||
| 1674 | \fn int operator<=(QChar c1, QChar c2) | - | ||||||||||||||||||
| 1675 | - | |||||||||||||||||||
| 1676 | \relates QChar | - | ||||||||||||||||||
| 1677 | - | |||||||||||||||||||
| 1678 | Returns \c true if the numeric Unicode value of \a c1 is less than | - | ||||||||||||||||||
| 1679 | or equal to that of \a c2; otherwise returns \c false. | - | ||||||||||||||||||
| 1680 | */ | - | ||||||||||||||||||
| 1681 | - | |||||||||||||||||||
| 1682 | /*! | - | ||||||||||||||||||
| 1683 | \fn int operator>=(QChar c1, QChar c2) | - | ||||||||||||||||||
| 1684 | - | |||||||||||||||||||
| 1685 | \relates QChar | - | ||||||||||||||||||
| 1686 | - | |||||||||||||||||||
| 1687 | Returns \c true if the numeric Unicode value of \a c1 is greater than | - | ||||||||||||||||||
| 1688 | or equal to that of \a c2; otherwise returns \c false. | - | ||||||||||||||||||
| 1689 | */ | - | ||||||||||||||||||
| 1690 | - | |||||||||||||||||||
| 1691 | /*! | - | ||||||||||||||||||
| 1692 | \fn int operator<(QChar c1, QChar c2) | - | ||||||||||||||||||
| 1693 | - | |||||||||||||||||||
| 1694 | \relates QChar | - | ||||||||||||||||||
| 1695 | - | |||||||||||||||||||
| 1696 | Returns \c true if the numeric Unicode value of \a c1 is less than | - | ||||||||||||||||||
| 1697 | that of \a c2; otherwise returns \c false. | - | ||||||||||||||||||
| 1698 | */ | - | ||||||||||||||||||
| 1699 | - | |||||||||||||||||||
| 1700 | /*! | - | ||||||||||||||||||
| 1701 | \fn int operator>(QChar c1, QChar c2) | - | ||||||||||||||||||
| 1702 | - | |||||||||||||||||||
| 1703 | \relates QChar | - | ||||||||||||||||||
| 1704 | - | |||||||||||||||||||
| 1705 | Returns \c true if the numeric Unicode value of \a c1 is greater than | - | ||||||||||||||||||
| 1706 | that of \a c2; otherwise returns \c false. | - | ||||||||||||||||||
| 1707 | */ | - | ||||||||||||||||||
| 1708 | - | |||||||||||||||||||
| 1709 | - | |||||||||||||||||||
| 1710 | // --------------------------------------------------------------------------- | - | ||||||||||||||||||
| 1711 | - | |||||||||||||||||||
| 1712 | - | |||||||||||||||||||
| 1713 | static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, int from) | - | ||||||||||||||||||
| 1714 | { | - | ||||||||||||||||||
| 1715 | int length; | - | ||||||||||||||||||
| 1716 | int tag; | - | ||||||||||||||||||
| 1717 | unsigned short buffer[3]; | - | ||||||||||||||||||
| 1718 | - | |||||||||||||||||||
| 1719 | QString &s = *str; | - | ||||||||||||||||||
| 1720 | - | |||||||||||||||||||
| 1721 | const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data()); | - | ||||||||||||||||||
| 1722 | const unsigned short *uc = utf16 + s.length(); | - | ||||||||||||||||||
| 1723 | while (uc != utf16 + from) {
| 166051-597138 | ||||||||||||||||||
| 1724 | uint ucs4 = *(--uc); | - | ||||||||||||||||||
| 1725 | if (QChar(ucs4).isLowSurrogate() && uc != utf16) {
| 0-583903 | ||||||||||||||||||
| 1726 | ushort high = *(uc - 1); | - | ||||||||||||||||||
| 1727 | if (QChar(high).isHighSurrogate()) {
| 0-13235 | ||||||||||||||||||
| 1728 | --uc; | - | ||||||||||||||||||
| 1729 | ucs4 = QChar::surrogateToUcs4(high, ucs4); | - | ||||||||||||||||||
| 1730 | } executed 13235 times by 1 test: end of blockExecuted by:
| 13235 | ||||||||||||||||||
| 1731 | } executed 13235 times by 1 test: end of blockExecuted by:
| 13235 | ||||||||||||||||||
| 1732 | - | |||||||||||||||||||
| 1733 | if (QChar::unicodeVersion(ucs4) > version)
| 1-597137 | ||||||||||||||||||
| 1734 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||
| 1735 | - | |||||||||||||||||||
| 1736 | const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer); | - | ||||||||||||||||||
| 1737 | if (!d || (canonical && tag != QChar::Canonical))
| 46-491040 | ||||||||||||||||||
| 1738 | continue; executed 491086 times by 3 tests: continue;Executed by:
| 491086 | ||||||||||||||||||
| 1739 | - | |||||||||||||||||||
| 1740 | int pos = uc - utf16; | - | ||||||||||||||||||
| 1741 | s.replace(pos, QChar::requiresSurrogates(ucs4) ? 2 : 1, reinterpret_cast<const QChar *>(d), length); | - | ||||||||||||||||||
| 1742 | // since the replace invalidates the pointers and we do decomposition recursive | - | ||||||||||||||||||
| 1743 | utf16 = reinterpret_cast<unsigned short *>(s.data()); | - | ||||||||||||||||||
| 1744 | uc = utf16 + pos + length; | - | ||||||||||||||||||
| 1745 | } executed 106051 times by 3 tests: end of blockExecuted by:
| 106051 | ||||||||||||||||||
| 1746 | } executed 166051 times by 3 tests: end of blockExecuted by:
| 166051 | ||||||||||||||||||
| 1747 | - | |||||||||||||||||||
| 1748 | - | |||||||||||||||||||
| 1749 | struct UCS2Pair { | - | ||||||||||||||||||
| 1750 | ushort u1; | - | ||||||||||||||||||
| 1751 | ushort u2; | - | ||||||||||||||||||
| 1752 | }; | - | ||||||||||||||||||
| 1753 | - | |||||||||||||||||||
| 1754 | inline bool operator<(const UCS2Pair &ligature1, const UCS2Pair &ligature2) | - | ||||||||||||||||||
| 1755 | { never executed: return ligature1.u1 < ligature2.u1; }return ligature1.u1 < ligature2.u1;never executed: return ligature1.u1 < ligature2.u1; | 0 | ||||||||||||||||||
| 1756 | inline bool operator<(ushort u1, const UCS2Pair &ligature) | - | ||||||||||||||||||
| 1757 | { never executed: return u1 < ligature.u1; }return u1 < ligature.u1;never executed: return u1 < ligature.u1; | 0 | ||||||||||||||||||
| 1758 | inline bool operator<(const UCS2Pair &ligature, ushort u1) | - | ||||||||||||||||||
| 1759 | { executed 60862 times by 2 tests: return ligature.u1 < u1; }return ligature.u1 < u1;Executed by:
executed 60862 times by 2 tests: return ligature.u1 < u1;Executed by:
| 60862 | ||||||||||||||||||
| 1760 | - | |||||||||||||||||||
| 1761 | struct UCS2SurrogatePair { | - | ||||||||||||||||||
| 1762 | UCS2Pair p1; | - | ||||||||||||||||||
| 1763 | UCS2Pair p2; | - | ||||||||||||||||||
| 1764 | }; | - | ||||||||||||||||||
| 1765 | - | |||||||||||||||||||
| 1766 | inline bool operator<(const UCS2SurrogatePair &ligature1, const UCS2SurrogatePair &ligature2) | - | ||||||||||||||||||
| 1767 | { never executed: return QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2); }return QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2);never executed: return QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2); | 0 | ||||||||||||||||||
| 1768 | inline bool operator<(uint u1, const UCS2SurrogatePair &ligature) | - | ||||||||||||||||||
| 1769 | { never executed: return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2); }return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2);never executed: return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2); | 0 | ||||||||||||||||||
| 1770 | inline bool operator<(const UCS2SurrogatePair &ligature, uint u1) | - | ||||||||||||||||||
| 1771 | { executed 76 times by 1 test: return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1; }return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1;Executed by:
executed 76 times by 1 test: return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1;Executed by:
| 76 | ||||||||||||||||||
| 1772 | - | |||||||||||||||||||
| 1773 | static uint inline ligatureHelper(uint u1, uint u2) | - | ||||||||||||||||||
| 1774 | { | - | ||||||||||||||||||
| 1775 | if (u1 >= Hangul_LBase && u1 <= Hangul_SBase + Hangul_SCount) {
| 164-93226 | ||||||||||||||||||
| 1776 | // compute Hangul syllable composition as per UAX #15 | - | ||||||||||||||||||
| 1777 | // hangul L-V pair | - | ||||||||||||||||||
| 1778 | const uint LIndex = u1 - Hangul_LBase; | - | ||||||||||||||||||
| 1779 | if (LIndex < Hangul_LCount) {
| 46152-46910 | ||||||||||||||||||
| 1780 | const uint VIndex = u2 - Hangul_VBase; | - | ||||||||||||||||||
| 1781 | if (VIndex < Hangul_VCount)
| 352-45800 | ||||||||||||||||||
| 1782 | return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount; executed 45800 times by 1 test: return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount;Executed by:
| 45800 | ||||||||||||||||||
| 1783 | } executed 352 times by 1 test: end of blockExecuted by:
| 352 | ||||||||||||||||||
| 1784 | // hangul LV-T pair | - | ||||||||||||||||||
| 1785 | const uint SIndex = u1 - Hangul_SBase; | - | ||||||||||||||||||
| 1786 | if (SIndex < Hangul_SCount && (SIndex % Hangul_TCount) == 0) {
| 10-44129 | ||||||||||||||||||
| 1787 | const uint TIndex = u2 - Hangul_TBase; | - | ||||||||||||||||||
| 1788 | if (TIndex <= Hangul_TCount)
| 1017-43102 | ||||||||||||||||||
| 1789 | return u1 + TIndex; executed 43102 times by 1 test: return u1 + TIndex;Executed by:
| 43102 | ||||||||||||||||||
| 1790 | } executed 1017 times by 1 test: end of blockExecuted by:
| 1017 | ||||||||||||||||||
| 1791 | } executed 4160 times by 2 tests: end of blockExecuted by:
| 4160 | ||||||||||||||||||
| 1792 | - | |||||||||||||||||||
| 1793 | const unsigned short index = GET_LIGATURE_INDEX(u2);
| 572-43175 | ||||||||||||||||||
| 1794 | if (index == 0xffff)
| 12117-33574 | ||||||||||||||||||
| 1795 | return 0; executed 33574 times by 2 tests: return 0;Executed by:
| 33574 | ||||||||||||||||||
| 1796 | const unsigned short *ligatures = uc_ligature_map+index; | - | ||||||||||||||||||
| 1797 | ushort length = *ligatures++; | - | ||||||||||||||||||
| 1798 | if (QChar::requiresSurrogates(u1)) {
| 48-12069 | ||||||||||||||||||
| 1799 | const UCS2SurrogatePair *data = reinterpret_cast<const UCS2SurrogatePair *>(ligatures); | - | ||||||||||||||||||
| 1800 | const UCS2SurrogatePair *r = std::lower_bound(data, data + length, u1); | - | ||||||||||||||||||
| 1801 | if (r != data + length && QChar::surrogateToUcs4(r->p1.u1, r->p1.u2) == u1)
| 0-48 | ||||||||||||||||||
| 1802 | return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2); executed 48 times by 1 test: return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2);Executed by:
| 48 | ||||||||||||||||||
| 1803 | } else { never executed: end of block | 0 | ||||||||||||||||||
| 1804 | const UCS2Pair *data = reinterpret_cast<const UCS2Pair *>(ligatures); | - | ||||||||||||||||||
| 1805 | const UCS2Pair *r = std::lower_bound(data, data + length, ushort(u1)); | - | ||||||||||||||||||
| 1806 | if (r != data + length && r->u1 == ushort(u1))
| 30-12039 | ||||||||||||||||||
| 1807 | return r->u2; executed 8485 times by 2 tests: return r->u2;Executed by:
| 8485 | ||||||||||||||||||
| 1808 | } executed 3584 times by 2 tests: end of blockExecuted by:
| 3584 | ||||||||||||||||||
| 1809 | - | |||||||||||||||||||
| 1810 | return 0; executed 3584 times by 2 tests: return 0;Executed by:
| 3584 | ||||||||||||||||||
| 1811 | } | - | ||||||||||||||||||
| 1812 | - | |||||||||||||||||||
| 1813 | static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) | - | ||||||||||||||||||
| 1814 | { | - | ||||||||||||||||||
| 1815 | QString &s = *str; | - | ||||||||||||||||||
| 1816 | - | |||||||||||||||||||
| 1817 | if (from < 0 || s.length() - from < 2)
| 0-74383 | ||||||||||||||||||
| 1818 | return; executed 9562 times by 3 tests: return;Executed by:
| 9562 | ||||||||||||||||||
| 1819 | - | |||||||||||||||||||
| 1820 | uint stcode = 0; // starter code point | - | ||||||||||||||||||
| 1821 | int starter = -1; // starter position | - | ||||||||||||||||||
| 1822 | int next = -1; // to prevent i == next | - | ||||||||||||||||||
| 1823 | int lastCombining = 255; // to prevent combining > lastCombining | - | ||||||||||||||||||
| 1824 | - | |||||||||||||||||||
| 1825 | int pos = from; | - | ||||||||||||||||||
| 1826 | while (pos < s.length()) {
| 64821-218622 | ||||||||||||||||||
| 1827 | int i = pos; | - | ||||||||||||||||||
| 1828 | uint uc = s.at(pos).unicode(); | - | ||||||||||||||||||
| 1829 | if (QChar(uc).isHighSurrogate() && pos < s.length()-1) {
| 0-216420 | ||||||||||||||||||
| 1830 | ushort low = s.at(pos+1).unicode(); | - | ||||||||||||||||||
| 1831 | if (QChar(low).isLowSurrogate()) {
| 0-2202 | ||||||||||||||||||
| 1832 | uc = QChar::surrogateToUcs4(uc, low); | - | ||||||||||||||||||
| 1833 | ++pos; | - | ||||||||||||||||||
| 1834 | } executed 2202 times by 1 test: end of blockExecuted by:
| 2202 | ||||||||||||||||||
| 1835 | } executed 2202 times by 1 test: end of blockExecuted by:
| 2202 | ||||||||||||||||||
| 1836 | - | |||||||||||||||||||
| 1837 | const QUnicodeTables::Properties *p = qGetProp(uc); | - | ||||||||||||||||||
| 1838 | if (p->unicodeVersion > version) {
| 1-218621 | ||||||||||||||||||
| 1839 | starter = -1; | - | ||||||||||||||||||
| 1840 | next = -1; // to prevent i == next | - | ||||||||||||||||||
| 1841 | lastCombining = 255; // to prevent combining > lastCombining | - | ||||||||||||||||||
| 1842 | ++pos; | - | ||||||||||||||||||
| 1843 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||
| 1844 | } | - | ||||||||||||||||||
| 1845 | - | |||||||||||||||||||
| 1846 | int combining = p->combiningClass; | - | ||||||||||||||||||
| 1847 | if ((i == next || combining > lastCombining) && starter >= from) {
| 20-134593 | ||||||||||||||||||
| 1848 | // allowed to form ligature with S | - | ||||||||||||||||||
| 1849 | uint ligature = ligatureHelper(stcode, uc); | - | ||||||||||||||||||
| 1850 | if (ligature) {
| 37158-97435 | ||||||||||||||||||
| 1851 | stcode = ligature; | - | ||||||||||||||||||
| 1852 | QChar *d = s.data(); | - | ||||||||||||||||||
| 1853 | // ligatureHelper() never changes planes | - | ||||||||||||||||||
| 1854 | if (QChar::requiresSurrogates(ligature)) {
| 48-97387 | ||||||||||||||||||
| 1855 | d[starter] = QChar::highSurrogate(ligature); | - | ||||||||||||||||||
| 1856 | d[starter + 1] = QChar::lowSurrogate(ligature); | - | ||||||||||||||||||
| 1857 | s.remove(i, 2); | - | ||||||||||||||||||
| 1858 | } else { executed 48 times by 1 test: end of blockExecuted by:
| 48 | ||||||||||||||||||
| 1859 | d[starter] = ligature; | - | ||||||||||||||||||
| 1860 | s.remove(i, 1); | - | ||||||||||||||||||
| 1861 | } executed 97387 times by 2 tests: end of blockExecuted by:
| 97387 | ||||||||||||||||||
| 1862 | continue; executed 97435 times by 2 tests: continue;Executed by:
| 97435 | ||||||||||||||||||
| 1863 | } | - | ||||||||||||||||||
| 1864 | } executed 37158 times by 2 tests: end of blockExecuted by:
| 37158 | ||||||||||||||||||
| 1865 | if (combining == 0) {
| 39313-81873 | ||||||||||||||||||
| 1866 | starter = i; | - | ||||||||||||||||||
| 1867 | stcode = uc; | - | ||||||||||||||||||
| 1868 | next = pos + 1; | - | ||||||||||||||||||
| 1869 | } executed 81873 times by 2 tests: end of blockExecuted by:
| 81873 | ||||||||||||||||||
| 1870 | lastCombining = combining; | - | ||||||||||||||||||
| 1871 | - | |||||||||||||||||||
| 1872 | ++pos; | - | ||||||||||||||||||
| 1873 | } executed 121186 times by 2 tests: end of blockExecuted by:
| 121186 | ||||||||||||||||||
| 1874 | } executed 64821 times by 2 tests: end of blockExecuted by:
| 64821 | ||||||||||||||||||
| 1875 | - | |||||||||||||||||||
| 1876 | - | |||||||||||||||||||
| 1877 | static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, int from) | - | ||||||||||||||||||
| 1878 | { | - | ||||||||||||||||||
| 1879 | QString &s = *str; | - | ||||||||||||||||||
| 1880 | const int l = s.length()-1; | - | ||||||||||||||||||
| 1881 | - | |||||||||||||||||||
| 1882 | uint u1, u2; | - | ||||||||||||||||||
| 1883 | ushort c1, c2; | - | ||||||||||||||||||
| 1884 | - | |||||||||||||||||||
| 1885 | int pos = from; | - | ||||||||||||||||||
| 1886 | while (pos < l) {
| 155015-174900 | ||||||||||||||||||
| 1887 | int p2 = pos+1; | - | ||||||||||||||||||
| 1888 | u1 = s.at(pos).unicode(); | - | ||||||||||||||||||
| 1889 | if (QChar(u1).isHighSurrogate()) {
| 1554-173346 | ||||||||||||||||||
| 1890 | ushort low = s.at(p2).unicode(); | - | ||||||||||||||||||
| 1891 | if (QChar(low).isLowSurrogate()) {
| 0-1554 | ||||||||||||||||||
| 1892 | u1 = QChar::surrogateToUcs4(u1, low); | - | ||||||||||||||||||
| 1893 | if (p2 >= l)
| 448-1106 | ||||||||||||||||||
| 1894 | break; executed 448 times by 1 test: break;Executed by:
| 448 | ||||||||||||||||||
| 1895 | ++p2; | - | ||||||||||||||||||
| 1896 | } executed 1106 times by 1 test: end of blockExecuted by:
| 1106 | ||||||||||||||||||
| 1897 | } executed 1106 times by 1 test: end of blockExecuted by:
| 1106 | ||||||||||||||||||
| 1898 | c1 = 0; | - | ||||||||||||||||||
| 1899 | - | |||||||||||||||||||
| 1900 | advance: code before this statement executed 174452 times by 2 tests: advance:Executed by:
| 174452 | ||||||||||||||||||
| 1901 | u2 = s.at(p2).unicode(); | - | ||||||||||||||||||
| 1902 | if (QChar(u2).isHighSurrogate() && p2 < l) {
| 0-259567 | ||||||||||||||||||
| 1903 | ushort low = s.at(p2+1).unicode(); | - | ||||||||||||||||||
| 1904 | if (QChar(low).isLowSurrogate()) {
| 0-3518 | ||||||||||||||||||
| 1905 | u2 = QChar::surrogateToUcs4(u2, low); | - | ||||||||||||||||||
| 1906 | ++p2; | - | ||||||||||||||||||
| 1907 | } executed 3518 times by 1 test: end of blockExecuted by:
| 3518 | ||||||||||||||||||
| 1908 | } executed 3518 times by 1 test: end of blockExecuted by:
| 3518 | ||||||||||||||||||
| 1909 | - | |||||||||||||||||||
| 1910 | c2 = 0; | - | ||||||||||||||||||
| 1911 | { | - | ||||||||||||||||||
| 1912 | const QUnicodeTables::Properties *p = qGetProp(u2); | - | ||||||||||||||||||
| 1913 | if (p->unicodeVersion <= version)
| 0-263085 | ||||||||||||||||||
| 1914 | c2 = p->combiningClass; executed 263085 times by 2 tests: c2 = p->combiningClass;Executed by:
| 263085 | ||||||||||||||||||
| 1915 | } | - | ||||||||||||||||||
| 1916 | if (c2 == 0) {
| 124633-138452 | ||||||||||||||||||
| 1917 | pos = p2+1; | - | ||||||||||||||||||
| 1918 | continue; executed 138452 times by 2 tests: continue;Executed by:
| 138452 | ||||||||||||||||||
| 1919 | } | - | ||||||||||||||||||
| 1920 | - | |||||||||||||||||||
| 1921 | if (c1 == 0) {
| 52188-72445 | ||||||||||||||||||
| 1922 | const QUnicodeTables::Properties *p = qGetProp(u1); | - | ||||||||||||||||||
| 1923 | if (p->unicodeVersion <= version)
| 1-52187 | ||||||||||||||||||
| 1924 | c1 = p->combiningClass; executed 52187 times by 2 tests: c1 = p->combiningClass;Executed by:
| 52187 | ||||||||||||||||||
| 1925 | } executed 52188 times by 2 tests: end of blockExecuted by:
| 52188 | ||||||||||||||||||
| 1926 | - | |||||||||||||||||||
| 1927 | if (c1 > c2) {
| 25412-99221 | ||||||||||||||||||
| 1928 | QChar *uc = s.data(); | - | ||||||||||||||||||
| 1929 | int p = pos; | - | ||||||||||||||||||
| 1930 | // exchange characters | - | ||||||||||||||||||
| 1931 | if (!QChar::requiresSurrogates(u2)) {
| 516-24896 | ||||||||||||||||||
| 1932 | uc[p++] = u2; | - | ||||||||||||||||||
| 1933 | } else { executed 24896 times by 1 test: end of blockExecuted by:
| 24896 | ||||||||||||||||||
| 1934 | uc[p++] = QChar::highSurrogate(u2); | - | ||||||||||||||||||
| 1935 | uc[p++] = QChar::lowSurrogate(u2); | - | ||||||||||||||||||
| 1936 | } executed 516 times by 1 test: end of blockExecuted by:
| 516 | ||||||||||||||||||
| 1937 | if (!QChar::requiresSurrogates(u1)) {
| 432-24980 | ||||||||||||||||||
| 1938 | uc[p++] = u1; | - | ||||||||||||||||||
| 1939 | } else { executed 24980 times by 1 test: end of blockExecuted by:
| 24980 | ||||||||||||||||||
| 1940 | uc[p++] = QChar::highSurrogate(u1); | - | ||||||||||||||||||
| 1941 | uc[p++] = QChar::lowSurrogate(u1); | - | ||||||||||||||||||
| 1942 | } executed 432 times by 1 test: end of blockExecuted by:
| 432 | ||||||||||||||||||
| 1943 | if (pos > 0)
| 12-25400 | ||||||||||||||||||
| 1944 | --pos; executed 25400 times by 1 test: --pos;Executed by:
| 25400 | ||||||||||||||||||
| 1945 | if (pos > 0 && s.at(pos).isLowSurrogate())
| 844-14708 | ||||||||||||||||||
| 1946 | --pos; executed 844 times by 1 test: --pos;Executed by:
| 844 | ||||||||||||||||||
| 1947 | } else { executed 25412 times by 1 test: end of blockExecuted by:
| 25412 | ||||||||||||||||||
| 1948 | ++pos; | - | ||||||||||||||||||
| 1949 | if (QChar::requiresSurrogates(u1))
| 3308-95913 | ||||||||||||||||||
| 1950 | ++pos; executed 3308 times by 1 test: ++pos;Executed by:
| 3308 | ||||||||||||||||||
| 1951 | - | |||||||||||||||||||
| 1952 | u1 = u2; | - | ||||||||||||||||||
| 1953 | c1 = c2; // != 0 | - | ||||||||||||||||||
| 1954 | p2 = pos + 1; | - | ||||||||||||||||||
| 1955 | if (QChar::requiresSurrogates(u1))
| 2822-96399 | ||||||||||||||||||
| 1956 | ++p2; executed 2822 times by 1 test: ++p2;Executed by:
| 2822 | ||||||||||||||||||
| 1957 | if (p2 > l)
| 10588-88633 | ||||||||||||||||||
| 1958 | break; executed 10588 times by 2 tests: break;Executed by:
| 10588 | ||||||||||||||||||
| 1959 | - | |||||||||||||||||||
| 1960 | goto advance; executed 88633 times by 2 tests: goto advance;Executed by:
| 88633 | ||||||||||||||||||
| 1961 | } | - | ||||||||||||||||||
| 1962 | } | - | ||||||||||||||||||
| 1963 | } executed 166051 times by 3 tests: end of blockExecuted by:
| 166051 | ||||||||||||||||||
| 1964 | - | |||||||||||||||||||
| 1965 | // returns true if the text is in a desired Normalization Form already; false otherwise. | - | ||||||||||||||||||
| 1966 | // sets lastStable to the position of the last stable code point | - | ||||||||||||||||||
| 1967 | static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationForm mode, int from, int *lastStable) | - | ||||||||||||||||||
| 1968 | { | - | ||||||||||||||||||
| 1969 | Q_STATIC_ASSERT(QString::NormalizationForm_D == 0); | - | ||||||||||||||||||
| 1970 | Q_STATIC_ASSERT(QString::NormalizationForm_C == 1); | - | ||||||||||||||||||
| 1971 | Q_STATIC_ASSERT(QString::NormalizationForm_KD == 2); | - | ||||||||||||||||||
| 1972 | Q_STATIC_ASSERT(QString::NormalizationForm_KC == 3); | - | ||||||||||||||||||
| 1973 | - | |||||||||||||||||||
| 1974 | enum { NFQC_YES = 0, NFQC_NO = 1, NFQC_MAYBE = 3 }; | - | ||||||||||||||||||
| 1975 | - | |||||||||||||||||||
| 1976 | const ushort *string = reinterpret_cast<const ushort *>(str->constData()); | - | ||||||||||||||||||
| 1977 | int length = str->length(); | - | ||||||||||||||||||
| 1978 | - | |||||||||||||||||||
| 1979 | // this avoids one out of bounds check in the loop | - | ||||||||||||||||||
| 1980 | while (length > from && QChar::isHighSurrogate(string[length - 1]))
| 1-566027 | ||||||||||||||||||
| 1981 | --length; executed 1 time by 1 test: --length;Executed by:
| 1 | ||||||||||||||||||
| 1982 | - | |||||||||||||||||||
| 1983 | uchar lastCombining = 0; | - | ||||||||||||||||||
| 1984 | for (int i = from; i < length; ++i) {
| 399976-1037340 | ||||||||||||||||||
| 1985 | int pos = i; | - | ||||||||||||||||||
| 1986 | uint uc = string[i]; | - | ||||||||||||||||||
| 1987 | if (uc < 0x80) {
| 49201-988139 | ||||||||||||||||||
| 1988 | // ASCII characters are stable code points | - | ||||||||||||||||||
| 1989 | lastCombining = 0; | - | ||||||||||||||||||
| 1990 | *lastStable = pos; | - | ||||||||||||||||||
| 1991 | continue; executed 49201 times by 6 tests: continue;Executed by:
| 49201 | ||||||||||||||||||
| 1992 | } | - | ||||||||||||||||||
| 1993 | - | |||||||||||||||||||
| 1994 | if (QChar::isHighSurrogate(uc)) {
| 23838-964301 | ||||||||||||||||||
| 1995 | ushort low = string[i + 1]; | - | ||||||||||||||||||
| 1996 | if (!QChar::isLowSurrogate(low)) {
| 1-23837 | ||||||||||||||||||
| 1997 | // treat surrogate like stable code point | - | ||||||||||||||||||
| 1998 | lastCombining = 0; | - | ||||||||||||||||||
| 1999 | *lastStable = pos; | - | ||||||||||||||||||
| 2000 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||
| 2001 | } | - | ||||||||||||||||||
| 2002 | ++i; | - | ||||||||||||||||||
| 2003 | uc = QChar::surrogateToUcs4(uc, low); | - | ||||||||||||||||||
| 2004 | } executed 23837 times by 3 tests: end of blockExecuted by:
| 23837 | ||||||||||||||||||
| 2005 | - | |||||||||||||||||||
| 2006 | const QUnicodeTables::Properties *p = qGetProp(uc); | - | ||||||||||||||||||
| 2007 | - | |||||||||||||||||||
| 2008 | if (p->combiningClass < lastCombining && p->combiningClass > 0)
| 2746-979710 | ||||||||||||||||||
| 2009 | return false; executed 5682 times by 1 test: return false;Executed by:
| 5682 | ||||||||||||||||||
| 2010 | - | |||||||||||||||||||
| 2011 | const uchar check = (p->nfQuickCheck >> (mode << 1)) & 0x03; | - | ||||||||||||||||||
| 2012 | if (check != NFQC_YES)
| 160369-822087 | ||||||||||||||||||
| 2013 | return false; // ### can we quick check NFQC_MAYBE ? executed 160369 times by 3 tests: return false;Executed by:
| 160369 | ||||||||||||||||||
| 2014 | - | |||||||||||||||||||
| 2015 | lastCombining = p->combiningClass; | - | ||||||||||||||||||
| 2016 | if (lastCombining == 0)
| 87788-734299 | ||||||||||||||||||
| 2017 | *lastStable = pos; executed 734299 times by 9 tests: *lastStable = pos;Executed by:
| 734299 | ||||||||||||||||||
| 2018 | } executed 822087 times by 9 tests: end of blockExecuted by:
| 822087 | ||||||||||||||||||
| 2019 | - | |||||||||||||||||||
| 2020 | if (length != str->length()) // low surrogate parts at the end of text
| 1-399975 | ||||||||||||||||||
| 2021 | *lastStable = str->length() - 1; executed 1 time by 1 test: *lastStable = str->length() - 1;Executed by:
| 1 | ||||||||||||||||||
| 2022 | - | |||||||||||||||||||
| 2023 | return true; executed 399976 times by 9 tests: return true;Executed by:
| 399976 | ||||||||||||||||||
| 2024 | } | - | ||||||||||||||||||
| 2025 | - | |||||||||||||||||||
| 2026 | QT_END_NAMESPACE | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |