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