tools/qchar.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtCore module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/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 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42// Don't define it while compiling this module, or USERS of Qt will -
43// not be able to link. -
44#ifdef QT_NO_CAST_FROM_ASCII -
45# undef QT_NO_CAST_FROM_ASCII -
46#endif -
47#ifdef QT_NO_CAST_TO_ASCII -
48# undef QT_NO_CAST_TO_ASCII -
49#endif -
50#include "qchar.h" -
51 -
52#include "qdatastream.h" -
53 -
54#include "qunicodetables_p.h" -
55#include "qunicodetables.cpp" -
56 -
57QT_BEGIN_NAMESPACE -
58 -
59#define FLAG(x) (1 << (x)) -
60 -
61/*! -
62 \class QLatin1Char -
63 \inmodule QtCore -
64 \brief The QLatin1Char class provides an 8-bit ASCII/Latin-1 character. -
65 -
66 \ingroup string-processing -
67 -
68 This class is only useful to construct a QChar with 8-bit character. -
69 -
70 \sa QChar, QLatin1String, QString -
71*/ -
72 -
73/*! -
74 \fn const char QLatin1Char::toLatin1() const -
75 -
76 Converts a Latin-1 character to an 8-bit ASCII representation of the character. -
77*/ -
78 -
79/*! -
80 \fn const ushort QLatin1Char::unicode() const -
81 -
82 Converts a Latin-1 character to an 16-bit-encoded Unicode representation -
83 of the character. -
84*/ -
85 -
86/*! -
87 \fn QLatin1Char::QLatin1Char(char c) -
88 -
89 Constructs a Latin-1 character for \a c. This constructor should be -
90 used when the encoding of the input character is known to be Latin-1. -
91*/ -
92 -
93/*! -
94 \class QChar -
95 \inmodule QtCore -
96 \brief The QChar class provides a 16-bit Unicode character. -
97 -
98 \ingroup string-processing -
99 \reentrant -
100 -
101 In Qt, Unicode characters are 16-bit entities without any markup -
102 or structure. This class represents such an entity. It is -
103 lightweight, so it can be used everywhere. Most compilers treat -
104 it like a \c{unsigned short}. -
105 -
106 QChar provides a full complement of testing/classification -
107 functions, converting to and from other formats, converting from -
108 composed to decomposed Unicode, and trying to compare and -
109 case-convert if you ask it to. -
110 -
111 The classification functions include functions like those in the -
112 standard C++ header \<cctype\> (formerly \<ctype.h\>), but -
113 operating on the full range of Unicode characters, not just for the ASCII -
114 range. They all return true if the character is a certain type of character; -
115 otherwise they return false. These classification functions are -
116 isNull() (returns true if the character is '\\0'), isPrint() -
117 (true if the character is any sort of printable character, -
118 including whitespace), isPunct() (any sort of punctation), -
119 isMark() (Unicode Mark), isLetter() (a letter), isNumber() (any -
120 sort of numeric character, not just 0-9), isLetterOrNumber(), and -
121 isDigit() (decimal digits). All of these are wrappers around -
122 category() which return the Unicode-defined category of each -
123 character. Some of these also calculate the derived properties -
124 (for example isSpace() returns true if the character is of category -
125 Separator_* or an exceptional code point from Other_Control category). -
126 -
127 QChar also provides direction(), which indicates the "natural" -
128 writing direction of this character. The joining() function -
129 indicates how the character joins with it's neighbors (needed -
130 mostly for Arabic) and finally hasMirrored(), which indicates -
131 whether the character needs to be mirrored when it is printed in -
132 it's "unnatural" writing direction. -
133 -
134 Composed Unicode characters (like \a ring) can be converted to -
135 decomposed Unicode ("a" followed by "ring above") by using decomposition(). -
136 -
137 In Unicode, comparison is not necessarily possible and case -
138 conversion is very difficult at best. Unicode, covering the -
139 "entire" world, also includes most of the world's case and -
140 sorting problems. operator==() and friends will do comparison -
141 based purely on the numeric Unicode value (code point) of the -
142 characters, and toUpper() and toLower() will do case changes when -
143 the character has a well-defined uppercase/lowercase equivalent. -
144 For locale-dependent comparisons, use QString::localeAwareCompare(). -
145 -
146 The conversion functions include unicode() (to a scalar), -
147 toLatin1() (to scalar, but converts all non-Latin-1 characters to -
148 0), row() (gives the Unicode row), cell() (gives the Unicode -
149 cell), digitValue() (gives the integer value of any of the -
150 numerous digit characters), and a host of constructors. -
151 -
152 QChar provides constructors and cast operators that make it easy -
153 to convert to and from traditional 8-bit \c{char}s. If you -
154 defined \c QT_NO_CAST_FROM_ASCII and \c QT_NO_CAST_TO_ASCII, as -
155 explained in the QString documentation, you will need to -
156 explicitly call fromLatin1(), or use QLatin1Char, -
157 to construct a QChar from an 8-bit \c char, and you will need to -
158 call toLatin1() to get the 8-bit value back. -
159 -
160 For more information see -
161 \l{http://www.unicode.org/ucd/}{"About the Unicode Character Database"}. -
162 -
163 \sa Unicode, QString, QLatin1Char -
164*/ -
165 -
166/*! -
167 \enum QChar::UnicodeVersion -
168 -
169 Specifies which version of the \l{http://www.unicode.org/}{Unicode standard} -
170 introduced a certain character. -
171 -
172 \value Unicode_1_1 Version 1.1 -
173 \value Unicode_2_0 Version 2.0 -
174 \value Unicode_2_1_2 Version 2.1.2 -
175 \value Unicode_3_0 Version 3.0 -
176 \value Unicode_3_1 Version 3.1 -
177 \value Unicode_3_2 Version 3.2 -
178 \value Unicode_4_0 Version 4.0 -
179 \value Unicode_4_1 Version 4.1 -
180 \value Unicode_5_0 Version 5.0 -
181 \value Unicode_5_1 Version 5.1 -
182 \value Unicode_5_2 Version 5.2 -
183 \value Unicode_6_0 Version 6.0 -
184 \value Unicode_6_1 Version 6.1 -
185 \value Unicode_6_2 Version 6.2 -
186 \value Unicode_Unassigned The value is not assigned to any character -
187 in version 6.2 of Unicode. -
188 -
189 \sa unicodeVersion(), currentUnicodeVersion() -
190*/ -
191 -
192/*! -
193 \enum QChar::Category -
194 -
195 This enum maps the Unicode character categories. -
196 -
197 The following characters are normative in Unicode: -
198 -
199 \value Mark_NonSpacing Unicode class name Mn -
200 -
201 \value Mark_SpacingCombining Unicode class name Mc -
202 -
203 \value Mark_Enclosing Unicode class name Me -
204 -
205 \value Number_DecimalDigit Unicode class name Nd -
206 -
207 \value Number_Letter Unicode class name Nl -
208 -
209 \value Number_Other Unicode class name No -
210 -
211 \value Separator_Space Unicode class name Zs -
212 -
213 \value Separator_Line Unicode class name Zl -
214 -
215 \value Separator_Paragraph Unicode class name Zp -
216 -
217 \value Other_Control Unicode class name Cc -
218 -
219 \value Other_Format Unicode class name Cf -
220 -
221 \value Other_Surrogate Unicode class name Cs -
222 -
223 \value Other_PrivateUse Unicode class name Co -
224 -
225 \value Other_NotAssigned Unicode class name Cn -
226 -
227 -
228 The following categories are informative in Unicode: -
229 -
230 \value Letter_Uppercase Unicode class name Lu -
231 -
232 \value Letter_Lowercase Unicode class name Ll -
233 -
234 \value Letter_Titlecase Unicode class name Lt -
235 -
236 \value Letter_Modifier Unicode class name Lm -
237 -
238 \value Letter_Other Unicode class name Lo -
239 -
240 \value Punctuation_Connector Unicode class name Pc -
241 -
242 \value Punctuation_Dash Unicode class name Pd -
243 -
244 \value Punctuation_Open Unicode class name Ps -
245 -
246 \value Punctuation_Close Unicode class name Pe -
247 -
248 \value Punctuation_InitialQuote Unicode class name Pi -
249 -
250 \value Punctuation_FinalQuote Unicode class name Pf -
251 -
252 \value Punctuation_Other Unicode class name Po -
253 -
254 \value Symbol_Math Unicode class name Sm -
255 -
256 \value Symbol_Currency Unicode class name Sc -
257 -
258 \value Symbol_Modifier Unicode class name Sk -
259 -
260 \value Symbol_Other Unicode class name So -
261 -
262 \sa category() -
263*/ -
264 -
265/*! -
266 \enum QChar::Direction -
267 -
268 This enum type defines the Unicode direction attributes. See the -
269 \l{http://www.unicode.org/}{Unicode Standard} for a description -
270 of the values. -
271 -
272 In order to conform to C/C++ naming conventions "Dir" is prepended -
273 to the codes used in the Unicode Standard. -
274 -
275 \value DirAL -
276 \value DirAN -
277 \value DirB -
278 \value DirBN -
279 \value DirCS -
280 \value DirEN -
281 \value DirES -
282 \value DirET -
283 \value DirL -
284 \value DirLRE -
285 \value DirLRO -
286 \value DirNSM -
287 \value DirON -
288 \value DirPDF -
289 \value DirR -
290 \value DirRLE -
291 \value DirRLO -
292 \value DirS -
293 \value DirWS -
294 -
295 \sa direction() -
296*/ -
297 -
298/*! -
299 \enum QChar::Decomposition -
300 -
301 This enum type defines the Unicode decomposition attributes. See -
302 the \l{http://www.unicode.org/}{Unicode Standard} for a -
303 description of the values. -
304 -
305 \value NoDecomposition -
306 \value Canonical -
307 \value Circle -
308 \value Compat -
309 \value Final -
310 \value Font -
311 \value Fraction -
312 \value Initial -
313 \value Isolated -
314 \value Medial -
315 \value Narrow -
316 \value NoBreak -
317 \value Small -
318 \value Square -
319 \value Sub -
320 \value Super -
321 \value Vertical -
322 \value Wide -
323 -
324 \sa decomposition() -
325*/ -
326 -
327/*! -
328 \enum QChar::Joining -
329 -
330 This enum type defines the Unicode joining attributes. See the -
331 \l{http://www.unicode.org/}{Unicode Standard} for a description -
332 of the values. -
333 -
334 \value Center -
335 \value Dual -
336 \value OtherJoining -
337 \value Right -
338 -
339 \sa joining() -
340*/ -
341 -
342/*! -
343 \enum QChar::CombiningClass -
344 -
345 \internal -
346 -
347 This enum type defines names for some of the Unicode combining -
348 classes. See the \l{http://www.unicode.org/}{Unicode Standard} -
349 for a description of the values. -
350 -
351 \value Combining_Above -
352 \value Combining_AboveAttached -
353 \value Combining_AboveLeft -
354 \value Combining_AboveLeftAttached -
355 \value Combining_AboveRight -
356 \value Combining_AboveRightAttached -
357 \value Combining_Below -
358 \value Combining_BelowAttached -
359 \value Combining_BelowLeft -
360 \value Combining_BelowLeftAttached -
361 \value Combining_BelowRight -
362 \value Combining_BelowRightAttached -
363 \value Combining_DoubleAbove -
364 \value Combining_DoubleBelow -
365 \value Combining_IotaSubscript -
366 \value Combining_Left -
367 \value Combining_LeftAttached -
368 \value Combining_Right -
369 \value Combining_RightAttached -
370*/ -
371 -
372/*! -
373 \enum QChar::SpecialCharacter -
374 -
375 \value Null A QChar with this value isNull(). -
376 \value Tabulation Character tabulation. -
377 \value LineFeed -
378 \value CarriageReturn -
379 \value Space -
380 \value Nbsp Non-breaking space. -
381 \value ReplacementCharacter The character shown when a font has no glyph -
382 for a certain codepoint. A special question mark character is often -
383 used. Codecs use this codepoint when input data cannot be -
384 represented in Unicode. -
385 \value ObjectReplacementCharacter Used to represent an object such as an -
386 image when such objects cannot be presented. -
387 \value ByteOrderMark -
388 \value ByteOrderSwapped -
389 \value ParagraphSeparator -
390 \value LineSeparator -
391 \value LastValidCodePoint -
392*/ -
393 -
394/*! -
395 \fn void QChar::setCell(uchar cell) -
396 \internal -
397*/ -
398 -
399/*! -
400 \fn void QChar::setRow(uchar row) -
401 \internal -
402*/ -
403 -
404/*! -
405 \fn QChar::QChar() -
406 -
407 Constructs a null QChar ('\\0'). -
408 -
409 \sa isNull() -
410*/ -
411 -
412/*! -
413 \fn QChar::QChar(QLatin1Char ch) -
414 -
415 Constructs a QChar corresponding to ASCII/Latin-1 character \a ch. -
416*/ -
417 -
418/*! -
419 \fn QChar::QChar(SpecialCharacter ch) -
420 -
421 Constructs a QChar for the predefined character value \a ch. -
422*/ -
423 -
424/*! -
425 \fn QChar::QChar(char ch) -
426 -
427 Constructs a QChar corresponding to ASCII/Latin-1 character \a ch. -
428*/ -
429 -
430/*! -
431 \fn QChar::QChar(uchar ch) -
432 -
433 Constructs a QChar corresponding to ASCII/Latin-1 character \a ch. -
434*/ -
435 -
436/*! -
437 \fn QChar::QChar(uchar cell, uchar row) -
438 -
439 Constructs a QChar for Unicode cell \a cell in row \a row. -
440 -
441 \sa cell(), row() -
442*/ -
443 -
444/*! -
445 \fn QChar::QChar(ushort code) -
446 -
447 Constructs a QChar for the character with Unicode code point \a code. -
448*/ -
449 -
450/*! -
451 \fn QChar::QChar(short code) -
452 -
453 Constructs a QChar for the character with Unicode code point \a code. -
454*/ -
455 -
456/*! -
457 \fn QChar::QChar(uint code) -
458 -
459 Constructs a QChar for the character with Unicode code point \a code. -
460*/ -
461 -
462/*! -
463 \fn QChar::QChar(int code) -
464 -
465 Constructs a QChar for the character with Unicode code point \a code. -
466*/ -
467 -
468/*! -
469 \fn bool QChar::isNull() const -
470 -
471 Returns true if the character is the Unicode character 0x0000 -
472 ('\\0'); otherwise returns false. -
473*/ -
474 -
475/*! -
476 \fn uchar QChar::cell() const -
477 -
478 Returns the cell (least significant byte) of the Unicode character. -
479 -
480 \sa row() -
481*/ -
482 -
483/*! -
484 \fn uchar QChar::row() const -
485 -
486 Returns the row (most significant byte) of the Unicode character. -
487 -
488 \sa cell() -
489*/ -
490 -
491/*! -
492 \fn bool QChar::isPrint() const -
493 -
494 Returns true if the character is a printable character; otherwise -
495 returns false. This is any character not of category Other_*. -
496 -
497 Note that this gives no indication of whether the character is -
498 available in a particular font. -
499*/ -
500 -
501/*! -
502 \overload -
503 \since 5.0 -
504 -
505 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
506 a printable character; otherwise returns false. -
507 This is any character not of category Other_*. -
508 -
509 Note that this gives no indication of whether the character is -
510 available in a particular font. -
511*/ -
512bool QChar::isPrint(uint ucs4) -
513{ -
514 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3483
0-3483
515 return false;
never executed: return false;
0
516 const int test = FLAG(Other_Control) |
executed (the execution status of this line is deduced): const int test = (1 << (Other_Control)) |
-
517 FLAG(Other_Format) |
executed (the execution status of this line is deduced): (1 << (Other_Format)) |
-
518 FLAG(Other_Surrogate) |
executed (the execution status of this line is deduced): (1 << (Other_Surrogate)) |
-
519 FLAG(Other_PrivateUse) |
executed (the execution status of this line is deduced): (1 << (Other_PrivateUse)) |
-
520 FLAG(Other_NotAssigned);
executed (the execution status of this line is deduced): (1 << (Other_NotAssigned));
-
521 return !(FLAG(qGetProp(ucs4)->category) & test);
executed: return !((1 << (qGetProp(ucs4)->category)) & test);
Execution Count:3483
3483
522} -
523 -
524/*! -
525 \fn bool QChar::isSpace() const -
526 -
527 Returns true if the character is a separator character -
528 (Separator_* categories or certain code points from Other_Control category); -
529 otherwise returns false. -
530*/ -
531 -
532/*! -
533 \fn bool QChar::isSpace(uint ucs4) -
534 \overload -
535 \since 5.0 -
536 -
537 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
538 a separator character (Separator_* categories or certain code points -
539 from Other_Control category); otherwise returns false. -
540*/ -
541 -
542/*! -
543 \internal -
544*/ -
545bool QT_FASTCALL QChar::isSpace_helper(uint ucs4) -
546{ -
547 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:670103
0-670103
548 return false;
never executed: return false;
0
549 const int test = FLAG(Separator_Space) |
executed (the execution status of this line is deduced): const int test = (1 << (Separator_Space)) |
-
550 FLAG(Separator_Line) |
executed (the execution status of this line is deduced): (1 << (Separator_Line)) |
-
551 FLAG(Separator_Paragraph);
executed (the execution status of this line is deduced): (1 << (Separator_Paragraph));
-
552 return FLAG(qGetProp(ucs4)->category) & test;
executed: return (1 << (qGetProp(ucs4)->category)) & test;
Execution Count:670103
670103
553} -
554 -
555/*! -
556 \fn bool QChar::isMark() const -
557 -
558 Returns true if the character is a mark (Mark_* categories); -
559 otherwise returns false. -
560 -
561 See QChar::Category for more information regarding marks. -
562*/ -
563 -
564/*! -
565 \overload -
566 \since 5.0 -
567 -
568 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
569 a mark (Mark_* categories); otherwise returns false. -
570*/ -
571bool QChar::isMark(uint ucs4) -
572{ -
573 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16403
0-16403
574 return false;
never executed: return false;
0
575 const int test = FLAG(Mark_NonSpacing) |
executed (the execution status of this line is deduced): const int test = (1 << (Mark_NonSpacing)) |
-
576 FLAG(Mark_SpacingCombining) |
executed (the execution status of this line is deduced): (1 << (Mark_SpacingCombining)) |
-
577 FLAG(Mark_Enclosing);
executed (the execution status of this line is deduced): (1 << (Mark_Enclosing));
-
578 return FLAG(qGetProp(ucs4)->category) & test;
executed: return (1 << (qGetProp(ucs4)->category)) & test;
Execution Count:16403
16403
579} -
580 -
581/*! -
582 \fn bool QChar::isPunct() const -
583 -
584 Returns true if the character is a punctuation mark (Punctuation_* -
585 categories); otherwise returns false. -
586*/ -
587 -
588/*! -
589 \overload -
590 \since 5.0 -
591 -
592 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
593 a punctuation mark (Punctuation_* categories); otherwise returns false. -
594*/ -
595bool QChar::isPunct(uint ucs4) -
596{ -
597 if (ucs4 > LastValidCodePoint)
never evaluated: ucs4 > LastValidCodePoint
0
598 return false;
never executed: return false;
0
599 const int test = FLAG(Punctuation_Connector) |
never executed (the execution status of this line is deduced): const int test = (1 << (Punctuation_Connector)) |
-
600 FLAG(Punctuation_Dash) |
never executed (the execution status of this line is deduced): (1 << (Punctuation_Dash)) |
-
601 FLAG(Punctuation_Open) |
never executed (the execution status of this line is deduced): (1 << (Punctuation_Open)) |
-
602 FLAG(Punctuation_Close) |
never executed (the execution status of this line is deduced): (1 << (Punctuation_Close)) |
-
603 FLAG(Punctuation_InitialQuote) |
never executed (the execution status of this line is deduced): (1 << (Punctuation_InitialQuote)) |
-
604 FLAG(Punctuation_FinalQuote) |
never executed (the execution status of this line is deduced): (1 << (Punctuation_FinalQuote)) |
-
605 FLAG(Punctuation_Other);
never executed (the execution status of this line is deduced): (1 << (Punctuation_Other));
-
606 return FLAG(qGetProp(ucs4)->category) & test;
never executed: return (1 << (qGetProp(ucs4)->category)) & test;
0
607} -
608 -
609/*! -
610 \fn bool QChar::isSymbol() const -
611 -
612 Returns true if the character is a symbol (Symbol_* categories); -
613 otherwise returns false. -
614*/ -
615 -
616/*! -
617 \overload -
618 \since 5.0 -
619 -
620 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
621 a symbol (Symbol_* categories); otherwise returns false. -
622*/ -
623bool QChar::isSymbol(uint ucs4) -
624{ -
625 if (ucs4 > LastValidCodePoint)
never evaluated: ucs4 > LastValidCodePoint
0
626 return false;
never executed: return false;
0
627 const int test = FLAG(Symbol_Math) |
never executed (the execution status of this line is deduced): const int test = (1 << (Symbol_Math)) |
-
628 FLAG(Symbol_Currency) |
never executed (the execution status of this line is deduced): (1 << (Symbol_Currency)) |
-
629 FLAG(Symbol_Modifier) |
never executed (the execution status of this line is deduced): (1 << (Symbol_Modifier)) |
-
630 FLAG(Symbol_Other);
never executed (the execution status of this line is deduced): (1 << (Symbol_Other));
-
631 return FLAG(qGetProp(ucs4)->category) & test;
never executed: return (1 << (qGetProp(ucs4)->category)) & test;
0
632} -
633 -
634/*! -
635 \fn bool QChar::isLetter() const -
636 -
637 Returns true if the character is a letter (Letter_* categories); -
638 otherwise returns false. -
639*/ -
640 -
641/*! -
642 \fn bool QChar::isLetter(uint ucs4) -
643 \overload -
644 \since 5.0 -
645 -
646 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
647 a letter (Letter_* categories); otherwise returns false. -
648*/ -
649 -
650/*! -
651 \internal -
652*/ -
653bool QT_FASTCALL QChar::isLetter_helper(uint ucs4) -
654{ -
655 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:128
0-128
656 return false;
never executed: return false;
0
657 const int test = FLAG(Letter_Uppercase) |
executed (the execution status of this line is deduced): const int test = (1 << (Letter_Uppercase)) |
-
658 FLAG(Letter_Lowercase) |
executed (the execution status of this line is deduced): (1 << (Letter_Lowercase)) |
-
659 FLAG(Letter_Titlecase) |
executed (the execution status of this line is deduced): (1 << (Letter_Titlecase)) |
-
660 FLAG(Letter_Modifier) |
executed (the execution status of this line is deduced): (1 << (Letter_Modifier)) |
-
661 FLAG(Letter_Other);
executed (the execution status of this line is deduced): (1 << (Letter_Other));
-
662 return FLAG(qGetProp(ucs4)->category) & test;
executed: return (1 << (qGetProp(ucs4)->category)) & test;
Execution Count:128
128
663} -
664 -
665/*! -
666 \fn bool QChar::isNumber() const -
667 -
668 Returns true if the character is a number (Number_* categories, -
669 not just 0-9); otherwise returns false. -
670 -
671 \sa isDigit() -
672*/ -
673 -
674/*! -
675 \fn bool QChar::isNumber(uint ucs4) -
676 \overload -
677 \since 5.0 -
678 -
679 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
680 a number (Number_* categories, not just 0-9); otherwise returns false. -
681 -
682 \sa isDigit() -
683*/ -
684 -
685/*! -
686 \internal -
687*/ -
688bool QT_FASTCALL QChar::isNumber_helper(uint ucs4) -
689{ -
690 if (ucs4 > LastValidCodePoint)
never evaluated: ucs4 > LastValidCodePoint
0
691 return false;
never executed: return false;
0
692 const int test = FLAG(Number_DecimalDigit) |
never executed (the execution status of this line is deduced): const int test = (1 << (Number_DecimalDigit)) |
-
693 FLAG(Number_Letter) |
never executed (the execution status of this line is deduced): (1 << (Number_Letter)) |
-
694 FLAG(Number_Other);
never executed (the execution status of this line is deduced): (1 << (Number_Other));
-
695 return FLAG(qGetProp(ucs4)->category) & test;
never executed: return (1 << (qGetProp(ucs4)->category)) & test;
0
696} -
697 -
698/*! -
699 \fn bool QChar::isLetterOrNumber() const -
700 -
701 Returns true if the character is a letter or number (Letter_* or -
702 Number_* categories); otherwise returns false. -
703*/ -
704 -
705/*! -
706 \fn bool QChar::isLetterOrNumber(uint ucs4) -
707 \overload -
708 \since 5.0 -
709 -
710 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
711 a letter or number (Letter_* or Number_* categories); otherwise returns false. -
712*/ -
713 -
714/*! -
715 \internal -
716*/ -
717bool QT_FASTCALL QChar::isLetterOrNumber_helper(uint ucs4) -
718{ -
719 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
720 return false;
never executed: return false;
0
721 const int test = FLAG(Letter_Uppercase) |
executed (the execution status of this line is deduced): const int test = (1 << (Letter_Uppercase)) |
-
722 FLAG(Letter_Lowercase) |
executed (the execution status of this line is deduced): (1 << (Letter_Lowercase)) |
-
723 FLAG(Letter_Titlecase) |
executed (the execution status of this line is deduced): (1 << (Letter_Titlecase)) |
-
724 FLAG(Letter_Modifier) |
executed (the execution status of this line is deduced): (1 << (Letter_Modifier)) |
-
725 FLAG(Letter_Other) |
executed (the execution status of this line is deduced): (1 << (Letter_Other)) |
-
726 FLAG(Number_DecimalDigit) |
executed (the execution status of this line is deduced): (1 << (Number_DecimalDigit)) |
-
727 FLAG(Number_Letter) |
executed (the execution status of this line is deduced): (1 << (Number_Letter)) |
-
728 FLAG(Number_Other);
executed (the execution status of this line is deduced): (1 << (Number_Other));
-
729 return FLAG(qGetProp(ucs4)->category) & test;
executed: return (1 << (qGetProp(ucs4)->category)) & test;
Execution Count:65536
65536
730} -
731 -
732/*! -
733 \fn bool QChar::isDigit() const -
734 -
735 Returns true if the character is a decimal digit -
736 (Number_DecimalDigit); otherwise returns false. -
737 -
738 \sa isNumber() -
739*/ -
740 -
741/*! -
742 \fn bool QChar::isDigit(uint ucs4) -
743 \overload -
744 \since 5.0 -
745 -
746 Returns true if the UCS-4-encoded character specified by \a ucs4 is -
747 a decimal digit (Number_DecimalDigit); otherwise returns false. -
748 -
749 \sa isNumber() -
750*/ -
751 -
752/*! -
753 \fn bool QChar::isNonCharacter() const -
754 \since 5.0 -
755 -
756 Returns true if the QChar is a non-character; false otherwise. -
757 -
758 Unicode has a certain number of code points that are classified -
759 as "non-characters:" that is, they can be used for internal purposes -
760 in applications but cannot be used for text interchange. -
761 Those are the last two entries each Unicode Plane ([0xfffe..0xffff], -
762 [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef]. -
763*/ -
764 -
765/*! -
766 \fn bool QChar::isHighSurrogate() const -
767 -
768 Returns true if the QChar is the high part of a UTF16 surrogate -
769 (for example if its code point is in range [0xd800..0xdbff]); false otherwise. -
770*/ -
771 -
772/*! -
773 \fn bool QChar::isLowSurrogate() const -
774 -
775 Returns true if the QChar is the low part of a UTF16 surrogate -
776 (for example if its code point is in range [0xdc00..0xdfff]); false otherwise. -
777*/ -
778 -
779/*! -
780 \fn bool QChar::isSurrogate() const -
781 \since 5.0 -
782 -
783 Returns true if the QChar contains a code point that is in either -
784 the high or the low part of the UTF-16 surrogate range -
785 (for example if its code point is in range [0xd800..0xdfff]); false otherwise. -
786*/ -
787 -
788/*! -
789 \fn static bool QChar::isNonCharacter(uint ucs4) -
790 \overload -
791 \since 5.0 -
792 -
793 Returns true if the UCS-4-encoded character specified by \a ucs4 -
794 is a non-character; false otherwise. -
795 -
796 Unicode has a certain number of code points that are classified -
797 as "non-characters:" that is, they can be used for internal purposes -
798 in applications but cannot be used for text interchange. -
799 Those are the last two entries each Unicode Plane ([0xfffe..0xffff], -
800 [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef]. -
801*/ -
802 -
803/*! -
804 \fn static bool QChar::isHighSurrogate(uint ucs4) -
805 \overload -
806 -
807 Returns true if the UCS-4-encoded character specified by \a ucs4 -
808 is the high part of a UTF16 surrogate -
809 (for example if its code point is in range [0xd800..0xdbff]); false otherwise. -
810*/ -
811 -
812/*! -
813 \fn static bool QChar::isLowSurrogate(uint ucs4) -
814 \overload -
815 -
816 Returns true if the UCS-4-encoded character specified by \a ucs4 -
817 is the low part of a UTF16 surrogate -
818 (for example if its code point is in range [0xdc00..0xdfff]); false otherwise. -
819*/ -
820 -
821/*! -
822 \fn static bool QChar::isSurrogate(uint ucs4) -
823 \overload -
824 \since 5.0 -
825 -
826 Returns true if the UCS-4-encoded character specified by \a ucs4 -
827 contains a code point that is in either the high or the low part of the -
828 UTF-16 surrogate range (for example if its code point is in range [0xd800..0xdfff]); -
829 false otherwise. -
830*/ -
831 -
832/*! -
833 \fn static bool QChar::requiresSurrogates(uint ucs4) -
834 -
835 Returns true if the UCS-4-encoded character specified by \a ucs4 -
836 can be split into the high and low parts of a UTF16 surrogate -
837 (for example if its code point is greater than or equals to 0x10000); -
838 false otherwise. -
839*/ -
840 -
841/*! -
842 \fn static uint QChar::surrogateToUcs4(ushort high, ushort low) -
843 -
844 Converts a UTF16 surrogate pair with the given \a high and \a low values -
845 to it's UCS-4-encoded code point. -
846*/ -
847 -
848/*! -
849 \fn static uint QChar::surrogateToUcs4(QChar high, QChar low) -
850 \overload -
851 -
852 Converts a UTF16 surrogate pair (\a high, \a low) to it's UCS-4-encoded code point. -
853*/ -
854 -
855/*! -
856 \fn static ushort QChar::highSurrogate(uint ucs4) -
857 -
858 Returns the high surrogate part of a UCS-4-encoded code point. -
859 The returned result is undefined if \a ucs4 is smaller than 0x10000. -
860*/ -
861 -
862/*! -
863 \fn static ushort QChar::lowSurrogate(uint ucs4) -
864 -
865 Returns the low surrogate part of a UCS-4-encoded code point. -
866 The returned result is undefined if \a ucs4 is smaller than 0x10000. -
867*/ -
868 -
869/*! -
870 \fn int QChar::digitValue() const -
871 -
872 Returns the numeric value of the digit, or -1 if the character is not a digit. -
873*/ -
874 -
875/*! -
876 \overload -
877 Returns the numeric value of the digit specified by the UCS-4-encoded -
878 character, \a ucs4, or -1 if the character is not a digit. -
879*/ -
880int QChar::digitValue(uint ucs4) -
881{ -
882 if (ucs4 > LastValidCodePoint)
evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:89440073
1-89440073
883 return -1;
executed: return -1;
Execution Count:1
1
884 return qGetProp(ucs4)->digitValue;
executed: return qGetProp(ucs4)->digitValue;
Execution Count:89440073
89440073
885} -
886 -
887/*! -
888 \fn QChar::Category QChar::category() const -
889 -
890 Returns the character's category. -
891*/ -
892 -
893/*! -
894 \overload -
895 Returns the category of the UCS-4-encoded character specified by \a ucs4. -
896*/ -
897QChar::Category QChar::category(uint ucs4) -
898{ -
899 if (ucs4 > LastValidCodePoint)
evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3863089
1-3863089
900 return QChar::Other_NotAssigned;
executed: return QChar::Other_NotAssigned;
Execution Count:1
1
901 return (QChar::Category) qGetProp(ucs4)->category;
executed: return (QChar::Category) qGetProp(ucs4)->category;
Execution Count:3863089
3863089
902} -
903 -
904/*! -
905 \fn QChar::Direction QChar::direction() const -
906 -
907 Returns the character's direction. -
908*/ -
909 -
910/*! -
911 \overload -
912 Returns the direction of the UCS-4-encoded character specified by \a ucs4. -
913*/ -
914QChar::Direction QChar::direction(uint ucs4) -
915{ -
916 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1126419
0-1126419
917 return QChar::DirL;
never executed: return QChar::DirL;
0
918 return (QChar::Direction) qGetProp(ucs4)->direction;
executed: return (QChar::Direction) qGetProp(ucs4)->direction;
Execution Count:1126419
1126419
919} -
920 -
921/*! -
922 \fn QChar::Joining QChar::joining() const -
923 -
924 Returns information about the joining properties of the character -
925 (needed for certain languages such as Arabic). -
926*/ -
927 -
928/*! -
929 \overload -
930 Returns information about the joining properties of the UCS-4-encoded -
931 character specified by \a ucs4 (needed for certain languages such as Arabic). -
932*/ -
933QChar::Joining QChar::joining(uint ucs4) -
934{ -
935 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1880
0-1880
936 return QChar::OtherJoining;
never executed: return QChar::OtherJoining;
0
937 return (QChar::Joining) qGetProp(ucs4)->joining;
executed: return (QChar::Joining) qGetProp(ucs4)->joining;
Execution Count:1880
1880
938} -
939 -
940/*! -
941 \fn bool QChar::hasMirrored() const -
942 -
943 Returns true if the character should be reversed if the text -
944 direction is reversed; otherwise returns false. -
945 -
946 A bit faster equivalent of (ch.mirroredChar() != ch). -
947 -
948 \sa mirroredChar() -
949*/ -
950 -
951/*! -
952 \overload -
953 \since 5.0 -
954 -
955 Returns true if the UCS-4-encoded character specified by \a ucs4 -
956 should be reversed if the text direction is reversed; otherwise returns false. -
957 -
958 A bit faster equivalent of (QChar::mirroredChar(ucs4) != ucs4). -
959 -
960 \sa mirroredChar() -
961*/ -
962bool QChar::hasMirrored(uint ucs4) -
963{ -
964 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
965 return false;
never executed: return false;
0
966 return qGetProp(ucs4)->mirrorDiff != 0;
executed: return qGetProp(ucs4)->mirrorDiff != 0;
Execution Count:4
4
967} -
968 -
969/*! -
970 \fn bool QChar::isLower() const -
971 -
972 Returns true if the character is a lowercase letter, for example -
973 category() is Letter_Lowercase. -
974 -
975 \sa isUpper(), toLower(), toUpper() -
976*/ -
977 -
978/*! -
979 \fn static bool QChar::isLower(uint ucs4) -
980 \overload -
981 \since 5.0 -
982 -
983 Returns true if the UCS-4-encoded character specified by \a ucs4 -
984 is a lowercase letter, for example category() is Letter_Lowercase. -
985 -
986 \sa isUpper(), toLower(), toUpper() -
987*/ -
988 -
989/*! -
990 \fn bool QChar::isUpper() const -
991 -
992 Returns true if the character is an uppercase letter, for example -
993 category() is Letter_Uppercase. -
994 -
995 \sa isLower(), toUpper(), toLower() -
996*/ -
997 -
998/*! -
999 \fn static bool QChar::isUpper(uint ucs4) -
1000 \overload -
1001 \since 5.0 -
1002 -
1003 Returns true if the UCS-4-encoded character specified by \a ucs4 -
1004 is an uppercase letter, for example category() is Letter_Uppercase. -
1005 -
1006 \sa isLower(), toUpper(), toLower() -
1007*/ -
1008 -
1009/*! -
1010 \fn bool QChar::isTitleCase() const -
1011 -
1012 Returns true if the character is a titlecase letter, for example -
1013 category() is Letter_Titlecase. -
1014 -
1015 \sa isLower(), toUpper(), toLower(), toTitleCase() -
1016*/ -
1017 -
1018/*! -
1019 \fn static bool QChar::isTitleCase(uint ucs4) -
1020 \overload -
1021 \since 5.0 -
1022 -
1023 Returns true if the UCS-4-encoded character specified by \a ucs4 -
1024 is a titlecase letter, for example category() is Letter_Titlecase. -
1025 -
1026 \sa isLower(), toUpper(), toLower(), toTitleCase() -
1027*/ -
1028/*! -
1029 \fn QChar QChar::mirroredChar() const -
1030 -
1031 Returns the mirrored character if this character is a mirrored -
1032 character; otherwise returns the character itself. -
1033 -
1034 \sa hasMirrored() -
1035*/ -
1036 -
1037/*! -
1038 \overload -
1039 Returns the mirrored character if the UCS-4-encoded character specified -
1040 by \a ucs4 is a mirrored character; otherwise returns the character itself. -
1041 -
1042 \sa hasMirrored() -
1043*/ -
1044uint QChar::mirroredChar(uint ucs4) -
1045{ -
1046 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1172
0-1172
1047 return ucs4;
never executed: return ucs4;
0
1048 return ucs4 + qGetProp(ucs4)->mirrorDiff;
executed: return ucs4 + qGetProp(ucs4)->mirrorDiff;
Execution Count:1172
1172
1049} -
1050 -
1051 -
1052// constants for Hangul (de)composition, see UAX #15 -
1053enum { -
1054 Hangul_SBase = 0xac00, -
1055 Hangul_LBase = 0x1100, -
1056 Hangul_VBase = 0x1161, -
1057 Hangul_TBase = 0x11a7, -
1058 Hangul_LCount = 19, -
1059 Hangul_VCount = 21, -
1060 Hangul_TCount = 28, -
1061 Hangul_NCount = Hangul_VCount * Hangul_TCount, -
1062 Hangul_SCount = Hangul_LCount * Hangul_NCount -
1063}; -
1064 -
1065// buffer has to have a length of 3. It's needed for Hangul decomposition -
1066static const unsigned short * QT_FASTCALL decompositionHelper -
1067 (uint ucs4, int *length, int *tag, unsigned short *buffer) -
1068{ -
1069 if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) {
evaluated: ucs4 >= Hangul_SBase
TRUEFALSE
yes
Evaluation Count:173403
yes
Evaluation Count:993556
evaluated: ucs4 < Hangul_SBase + Hangul_SCount
TRUEFALSE
yes
Evaluation Count:135326
yes
Evaluation Count:38077
38077-993556
1070 // compute Hangul syllable decomposition as per UAX #15 -
1071 const uint SIndex = ucs4 - Hangul_SBase;
executed (the execution status of this line is deduced): const uint SIndex = ucs4 - Hangul_SBase;
-
1072 buffer[0] = Hangul_LBase + SIndex / Hangul_NCount; // L
executed (the execution status of this line is deduced): buffer[0] = Hangul_LBase + SIndex / Hangul_NCount;
-
1073 buffer[1] = Hangul_VBase + (SIndex % Hangul_NCount) / Hangul_TCount; // V
executed (the execution status of this line is deduced): buffer[1] = Hangul_VBase + (SIndex % Hangul_NCount) / Hangul_TCount;
-
1074 buffer[2] = Hangul_TBase + SIndex % Hangul_TCount; // T
executed (the execution status of this line is deduced): buffer[2] = Hangul_TBase + SIndex % Hangul_TCount;
-
1075 *length = buffer[2] == Hangul_TBase ? 2 : 3;
evaluated: buffer[2] == Hangul_TBase
TRUEFALSE
yes
Evaluation Count:6041
yes
Evaluation Count:129285
6041-129285
1076 *tag = QChar::Canonical;
executed (the execution status of this line is deduced): *tag = QChar::Canonical;
-
1077 return buffer;
executed: return buffer;
Execution Count:135326
135326
1078 } -
1079 -
1080 const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);
evaluated: ucs4 < 0x3400
TRUEFALSE
yes
Evaluation Count:967293
yes
Evaluation Count:64340
64340-967293
1081 if (index == 0xffff) {
evaluated: index == 0xffff
TRUEFALSE
yes
Evaluation Count:962997
yes
Evaluation Count:68636
68636-962997
1082 *length = 0;
executed (the execution status of this line is deduced): *length = 0;
-
1083 *tag = QChar::NoDecomposition;
executed (the execution status of this line is deduced): *tag = QChar::NoDecomposition;
-
1084 return 0;
executed: return 0;
Execution Count:962997
962997
1085 } -
1086 -
1087 const unsigned short *decomposition = uc_decomposition_map+index;
executed (the execution status of this line is deduced): const unsigned short *decomposition = uc_decomposition_map+index;
-
1088 *tag = (*decomposition) & 0xff;
executed (the execution status of this line is deduced): *tag = (*decomposition) & 0xff;
-
1089 *length = (*decomposition) >> 8;
executed (the execution status of this line is deduced): *length = (*decomposition) >> 8;
-
1090 return decomposition+1;
executed: return decomposition+1;
Execution Count:68636
68636
1091} -
1092 -
1093/*! -
1094 Decomposes a character into it's constituent parts. Returns an empty string -
1095 if no decomposition exists. -
1096*/ -
1097QString QChar::decomposition() const -
1098{ -
1099 return QChar::decomposition(ucs);
never executed: return QChar::decomposition(ucs);
0
1100} -
1101 -
1102/*! -
1103 \overload -
1104 Decomposes the UCS-4-encoded character specified by \a ucs4 into it's -
1105 constituent parts. Returns an empty string if no decomposition exists. -
1106*/ -
1107QString QChar::decomposition(uint ucs4) -
1108{ -
1109 unsigned short buffer[3];
executed (the execution status of this line is deduced): unsigned short buffer[3];
-
1110 int length;
executed (the execution status of this line is deduced): int length;
-
1111 int tag;
executed (the execution status of this line is deduced): int tag;
-
1112 const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer);
executed (the execution status of this line is deduced): const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer);
-
1113 return QString(reinterpret_cast<const QChar *>(d), length);
executed: return QString(reinterpret_cast<const QChar *>(d), length);
Execution Count:5
5
1114} -
1115 -
1116/*! -
1117 \fn QChar::Decomposition QChar::decompositionTag() const -
1118 -
1119 Returns the tag defining the composition of the character. Returns -
1120 QChar::NoDecomposition if no decomposition exists. -
1121*/ -
1122 -
1123/*! -
1124 \overload -
1125 Returns the tag defining the composition of the UCS-4-encoded character -
1126 specified by \a ucs4. Returns QChar::NoDecomposition if no decomposition exists. -
1127*/ -
1128QChar::Decomposition QChar::decompositionTag(uint ucs4) -
1129{ -
1130 if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount)
evaluated: ucs4 >= Hangul_SBase
TRUEFALSE
yes
Evaluation Count:22368
yes
Evaluation Count:6
evaluated: ucs4 < Hangul_SBase + Hangul_SCount
TRUEFALSE
yes
Evaluation Count:22344
yes
Evaluation Count:24
6-22368
1131 return QChar::Canonical;
executed: return QChar::Canonical;
Execution Count:22344
22344
1132 const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);
evaluated: ucs4 < 0x3400
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:24
6-24
1133 if (index == 0xffff)
evaluated: index == 0xffff
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:4
4-26
1134 return QChar::NoDecomposition;
executed: return QChar::NoDecomposition;
Execution Count:26
26
1135 return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);
executed: return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);
Execution Count:4
4
1136} -
1137 -
1138/*! -
1139 \fn unsigned char QChar::combiningClass() const -
1140 -
1141 Returns the combining class for the character as defined in the -
1142 Unicode standard. This is mainly useful as a positioning hint for -
1143 marks attached to a base character. -
1144 -
1145 The Qt text rendering engine uses this information to correctly -
1146 position non-spacing marks around a base character. -
1147*/ -
1148 -
1149/*! -
1150 \overload -
1151 Returns the combining class for the UCS-4-encoded character specified by -
1152 \a ucs4, as defined in the Unicode standard. -
1153*/ -
1154unsigned char QChar::combiningClass(uint ucs4) -
1155{ -
1156 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
1157 return 0;
never executed: return 0;
0
1158 return (unsigned char) qGetProp(ucs4)->combiningClass;
executed: return (unsigned char) qGetProp(ucs4)->combiningClass;
Execution Count:19
19
1159} -
1160 -
1161/*! -
1162 \fn QChar::UnicodeVersion QChar::unicodeVersion() const -
1163 -
1164 Returns the Unicode version that introduced this character. -
1165*/ -
1166 -
1167/*! -
1168 \overload -
1169 Returns the Unicode version that introduced the character specified in -
1170 its UCS-4-encoded form as \a ucs4. -
1171*/ -
1172QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) -
1173{ -
1174 if (ucs4 > LastValidCodePoint)
evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1178694
1-1178694
1175 return QChar::Unicode_Unassigned;
executed: return QChar::Unicode_Unassigned;
Execution Count:1
1
1176 return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;
executed: return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;
Execution Count:1178694
1178694
1177} -
1178 -
1179/*! -
1180 Returns the most recent supported Unicode version. -
1181*/ -
1182QChar::UnicodeVersion QChar::currentUnicodeVersion() -
1183{ -
1184 return UNICODE_DATA_VERSION;
executed: return QChar::Unicode_6_2;
Execution Count:356431
356431
1185} -
1186 -
1187 -
1188template <typename T> -
1189static inline T toLowerCase_helper(T uc) -
1190{ -
1191 const QUnicodeTables::Properties *p = qGetProp(uc);
executed (the execution status of this line is deduced): const QUnicodeTables::Properties *p = qGetProp(uc);
-
1192 if (p->lowerCaseSpecial) {
evaluated: p->lowerCaseSpecial
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2671207
6-2671207
1193 const ushort *specialCase = specialCaseMap + p->lowerCaseDiff;
executed (the execution status of this line is deduced): const ushort *specialCase = specialCaseMap + p->lowerCaseDiff;
-
1194 return (*specialCase == 1) ? specialCase[1] : uc;
executed: return (*specialCase == 1) ? specialCase[1] : uc;
Execution Count:6
6
1195 } -
1196 return uc + p->lowerCaseDiff;
executed: return uc + p->lowerCaseDiff;
Execution Count:2671207
2671207
1197} -
1198 -
1199template <typename T> -
1200static inline T toUpperCase_helper(T uc) -
1201{ -
1202 const QUnicodeTables::Properties *p = qGetProp(uc);
executed (the execution status of this line is deduced): const QUnicodeTables::Properties *p = qGetProp(uc);
-
1203 if (p->upperCaseSpecial) {
evaluated: p->upperCaseSpecial
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:899110
7-899110
1204 const ushort *specialCase = specialCaseMap + p->upperCaseDiff;
executed (the execution status of this line is deduced): const ushort *specialCase = specialCaseMap + p->upperCaseDiff;
-
1205 return (*specialCase == 1) ? specialCase[1] : uc;
executed: return (*specialCase == 1) ? specialCase[1] : uc;
Execution Count:7
7
1206 } -
1207 return uc + p->upperCaseDiff;
executed: return uc + p->upperCaseDiff;
Execution Count:899110
899110
1208} -
1209 -
1210template <typename T> -
1211static inline T toTitleCase_helper(T uc) -
1212{ -
1213 const QUnicodeTables::Properties *p = qGetProp(uc);
executed (the execution status of this line is deduced): const QUnicodeTables::Properties *p = qGetProp(uc);
-
1214 if (p->titleCaseSpecial) {
evaluated: p->titleCaseSpecial
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:48
7-48
1215 const ushort *specialCase = specialCaseMap + p->titleCaseDiff;
executed (the execution status of this line is deduced): const ushort *specialCase = specialCaseMap + p->titleCaseDiff;
-
1216 return (*specialCase == 1) ? specialCase[1] : uc;
executed: return (*specialCase == 1) ? specialCase[1] : uc;
Execution Count:7
7
1217 } -
1218 return uc + p->titleCaseDiff;
executed: return uc + p->titleCaseDiff;
Execution Count:48
48
1219} -
1220 -
1221template <typename T> -
1222static inline T toCaseFolded_helper(T uc) -
1223{ -
1224 const QUnicodeTables::Properties *p = qGetProp(uc);
executed (the execution status of this line is deduced): const QUnicodeTables::Properties *p = qGetProp(uc);
-
1225 if (p->caseFoldSpecial) {
evaluated: p->caseFoldSpecial
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:23160228
9-23160228
1226 const ushort *specialCase = specialCaseMap + p->caseFoldDiff;
executed (the execution status of this line is deduced): const ushort *specialCase = specialCaseMap + p->caseFoldDiff;
-
1227 return (*specialCase == 1) ? specialCase[1] : uc;
executed: return (*specialCase == 1) ? specialCase[1] : uc;
Execution Count:9
9
1228 } -
1229 return uc + p->caseFoldDiff;
executed: return uc + p->caseFoldDiff;
Execution Count:23160228
23160228
1230} -
1231 -
1232/*! -
1233 \fn QChar QChar::toLower() const -
1234 -
1235 Returns the lowercase equivalent if the character is uppercase or titlecase; -
1236 otherwise returns the character itself. -
1237*/ -
1238 -
1239/*! -
1240 \overload -
1241 Returns the lowercase equivalent of the UCS-4-encoded character specified -
1242 by \a ucs4 if the character is uppercase or titlecase; otherwise returns -
1243 the character itself. -
1244*/ -
1245uint QChar::toLower(uint ucs4) -
1246{ -
1247 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2671209
0-2671209
1248 return ucs4;
never executed: return ucs4;
0
1249 return toLowerCase_helper<uint>(ucs4);
executed: return toLowerCase_helper<uint>(ucs4);
Execution Count:2671212
2671212
1250} -
1251 -
1252/*! -
1253 \fn QChar QChar::toUpper() const -
1254 -
1255 Returns the uppercase equivalent if the character is lowercase or titlecase; -
1256 otherwise returns the character itself. -
1257*/ -
1258 -
1259/*! -
1260 \overload -
1261 Returns the uppercase equivalent of the UCS-4-encoded character specified -
1262 by \a ucs4 if the character is lowercase or titlecase; otherwise returns -
1263 the character itself. -
1264*/ -
1265uint QChar::toUpper(uint ucs4) -
1266{ -
1267 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:899117
0-899117
1268 return ucs4;
never executed: return ucs4;
0
1269 return toUpperCase_helper<uint>(ucs4);
executed: return toUpperCase_helper<uint>(ucs4);
Execution Count:899117
899117
1270} -
1271 -
1272/*! -
1273 \fn QChar QChar::toTitleCase() const -
1274 -
1275 Returns the title case equivalent if the character is lowercase or uppercase; -
1276 otherwise returns the character itself. -
1277*/ -
1278 -
1279/*! -
1280 \overload -
1281 Returns the title case equivalent of the UCS-4-encoded character specified -
1282 by \a ucs4 if the character is lowercase or uppercase; otherwise returns -
1283 the character itself. -
1284*/ -
1285uint QChar::toTitleCase(uint ucs4) -
1286{ -
1287 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
1288 return ucs4;
never executed: return ucs4;
0
1289 return toTitleCase_helper<uint>(ucs4);
executed: return toTitleCase_helper<uint>(ucs4);
Execution Count:55
55
1290} -
1291 -
1292static inline uint foldCase(const ushort *ch, const ushort *start) -
1293{ -
1294 uint c = *ch;
executed (the execution status of this line is deduced): uint c = *ch;
-
1295 if (QChar(c).isLowSurrogate() && ch > start && QChar(*(ch - 1)).isHighSurrogate())
partially evaluated: QChar(c).isLowSurrogate()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:74620
never evaluated: ch > start
never evaluated: QChar(*(ch - 1)).isHighSurrogate()
0-74620
1296 c = QChar::surrogateToUcs4(*(ch - 1), c);
never executed: c = QChar::surrogateToUcs4(*(ch - 1), c);
0
1297 return toCaseFolded_helper<uint>(c);
executed: return toCaseFolded_helper<uint>(c);
Execution Count:74620
74620
1298} -
1299 -
1300static inline uint foldCase(uint ch, uint &last) -
1301{ -
1302 uint c = ch;
executed (the execution status of this line is deduced): uint c = ch;
-
1303 if (QChar(c).isLowSurrogate() && QChar(last).isHighSurrogate())
evaluated: QChar(c).isLowSurrogate()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:22959662
partially evaluated: QChar(last).isHighSurrogate()
TRUEFALSE
yes
Evaluation Count:24
no
Evaluation Count:0
0-22959662
1304 c = QChar::surrogateToUcs4(last, c);
executed: c = QChar::surrogateToUcs4(last, c);
Execution Count:24
24
1305 last = ch;
executed (the execution status of this line is deduced): last = ch;
-
1306 return toCaseFolded_helper<uint>(c);
executed: return toCaseFolded_helper<uint>(c);
Execution Count:22959686
22959686
1307} -
1308 -
1309static inline ushort foldCase(ushort ch) -
1310{ -
1311 return toCaseFolded_helper<ushort>(ch);
executed: return toCaseFolded_helper<ushort>(ch);
Execution Count:60345
60345
1312} -
1313 -
1314/*! -
1315 \fn QChar QChar::toCaseFolded() const -
1316 -
1317 Returns the case folded equivalent of the character. -
1318 For most Unicode characters this is the same as toLowerCase(). -
1319*/ -
1320 -
1321/*! -
1322 \overload -
1323 Returns the case folded equivalent of the UCS-4-encoded character specified -
1324 by \a ucs4. For most Unicode characters this is the same as toLowerCase(). -
1325*/ -
1326uint QChar::toCaseFolded(uint ucs4) -
1327{ -
1328 if (ucs4 > LastValidCodePoint)
partially evaluated: ucs4 > LastValidCodePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65586
0-65586
1329 return ucs4;
never executed: return ucs4;
0
1330 return toCaseFolded_helper<uint>(ucs4);
executed: return toCaseFolded_helper<uint>(ucs4);
Execution Count:65586
65586
1331} -
1332 -
1333/*! -
1334 \fn char QChar::toLatin1() const -
1335 -
1336 Returns the Latin-1 character equivalent to the QChar, or 0. This -
1337 is mainly useful for non-internationalized software. -
1338 -
1339 \note It is not possible to distinguish a non-Latin-1 character from a Latin-1 0 -
1340 (NUL) character. Prefer to use unicode(), which does not have this ambiguity. -
1341 -
1342 \sa unicode() -
1343*/ -
1344 -
1345/*! -
1346 \fn QChar QChar::fromLatin1(char) -
1347 -
1348 Converts the Latin-1 character \a c to its equivalent QChar. This -
1349 is mainly useful for non-internationalized software. -
1350 -
1351 An alternative is to use QLatin1Char. -
1352 -
1353 \sa toLatin1(), unicode() -
1354*/ -
1355 -
1356/*! -
1357 \fn char QChar::toAscii() const -
1358 \deprecated -
1359 -
1360 Returns the Latin-1 character value of the QChar, or 0 if the character is not -
1361 representable. -
1362 -
1363 The main purpose of this function is to preserve ASCII characters used -
1364 in C strings. This is mainly useful for developers of non-internationalized -
1365 software. -
1366 -
1367 \note It is not possible to distinguish a non-Latin 1 character from an ASCII 0 -
1368 (NUL) character. Prefer to use unicode(), which does not have this ambiguity. -
1369 -
1370 \note This function does not check whether the character value is inside -
1371 the valid range of US-ASCII. -
1372 -
1373 \sa toLatin1(), unicode() -
1374*/ -
1375 -
1376/*! -
1377 \fn QChar QChar::fromAscii(char) -
1378 \deprecated -
1379 -
1380 Converts the ASCII character \a c to it's equivalent QChar. This -
1381 is mainly useful for non-internationalized software. -
1382 -
1383 An alternative is to use QLatin1Char. -
1384 -
1385 \sa fromLatin1(), unicode() -
1386*/ -
1387 -
1388#ifndef QT_NO_DATASTREAM -
1389/*! -
1390 \relates QChar -
1391 -
1392 Writes the char \a chr to the stream \a out. -
1393 -
1394 \sa {Serializing Qt Data Types} -
1395*/ -
1396QDataStream &operator<<(QDataStream &out, QChar chr) -
1397{ -
1398 out << quint16(chr.unicode());
executed (the execution status of this line is deduced): out << quint16(chr.unicode());
-
1399 return out;
executed: return out;
Execution Count:5
5
1400} -
1401 -
1402/*! -
1403 \relates QChar -
1404 -
1405 Reads a char from the stream \a in into char \a chr. -
1406 -
1407 \sa {Serializing Qt Data Types} -
1408*/ -
1409QDataStream &operator>>(QDataStream &in, QChar &chr) -
1410{ -
1411 quint16 u;
executed (the execution status of this line is deduced): quint16 u;
-
1412 in >> u;
executed (the execution status of this line is deduced): in >> u;
-
1413 chr.unicode() = ushort(u);
executed (the execution status of this line is deduced): chr.unicode() = ushort(u);
-
1414 return in;
executed: return in;
Execution Count:9
9
1415} -
1416#endif // QT_NO_DATASTREAM -
1417 -
1418/*! -
1419 \fn ushort & QChar::unicode() -
1420 -
1421 Returns a reference to the numeric Unicode value of the QChar. -
1422*/ -
1423 -
1424/*! -
1425 \fn ushort QChar::unicode() const -
1426 -
1427 Returns the numeric Unicode value of the QChar. -
1428*/ -
1429 -
1430/***************************************************************************** -
1431 Documentation of QChar related functions -
1432 *****************************************************************************/ -
1433 -
1434/*! -
1435 \fn bool operator==(QChar c1, QChar c2) -
1436 -
1437 \relates QChar -
1438 -
1439 Returns true if \a c1 and \a c2 are the same Unicode character; -
1440 otherwise returns false. -
1441*/ -
1442 -
1443/*! -
1444 \fn int operator!=(QChar c1, QChar c2) -
1445 -
1446 \relates QChar -
1447 -
1448 Returns true if \a c1 and \a c2 are not the same Unicode -
1449 character; otherwise returns false. -
1450*/ -
1451 -
1452/*! -
1453 \fn int operator<=(QChar c1, QChar c2) -
1454 -
1455 \relates QChar -
1456 -
1457 Returns true if the numeric Unicode value of \a c1 is less than -
1458 or equal to that of \a c2; otherwise returns false. -
1459*/ -
1460 -
1461/*! -
1462 \fn int operator>=(QChar c1, QChar c2) -
1463 -
1464 \relates QChar -
1465 -
1466 Returns true if the numeric Unicode value of \a c1 is greater than -
1467 or equal to that of \a c2; otherwise returns false. -
1468*/ -
1469 -
1470/*! -
1471 \fn int operator<(QChar c1, QChar c2) -
1472 -
1473 \relates QChar -
1474 -
1475 Returns true if the numeric Unicode value of \a c1 is less than -
1476 that of \a c2; otherwise returns false. -
1477*/ -
1478 -
1479/*! -
1480 \fn int operator>(QChar c1, QChar c2) -
1481 -
1482 \relates QChar -
1483 -
1484 Returns true if the numeric Unicode value of \a c1 is greater than -
1485 that of \a c2; otherwise returns false. -
1486*/ -
1487 -
1488 -
1489// --------------------------------------------------------------------------- -
1490 -
1491 -
1492static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, int from) -
1493{ -
1494 int length;
executed (the execution status of this line is deduced): int length;
-
1495 int tag;
executed (the execution status of this line is deduced): int tag;
-
1496 unsigned short buffer[3];
executed (the execution status of this line is deduced): unsigned short buffer[3];
-
1497 -
1498 QString &s = *str;
executed (the execution status of this line is deduced): QString &s = *str;
-
1499 -
1500 const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data());
executed (the execution status of this line is deduced): const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data());
-
1501 const unsigned short *uc = utf16 + s.length();
executed (the execution status of this line is deduced): const unsigned short *uc = utf16 + s.length();
-
1502 while (uc != utf16 + from) {
evaluated: uc != utf16 + from
TRUEFALSE
yes
Evaluation Count:1166955
yes
Evaluation Count:356558
356558-1166955
1503 uint ucs4 = *(--uc);
executed (the execution status of this line is deduced): uint ucs4 = *(--uc);
-
1504 if (QChar(ucs4).isLowSurrogate() && uc != utf16) {
evaluated: QChar(ucs4).isLowSurrogate()
TRUEFALSE
yes
Evaluation Count:23071
yes
Evaluation Count:1143884
partially evaluated: uc != utf16
TRUEFALSE
yes
Evaluation Count:23071
no
Evaluation Count:0
0-1143884
1505 ushort high = *(uc - 1);
executed (the execution status of this line is deduced): ushort high = *(uc - 1);
-
1506 if (QChar(high).isHighSurrogate()) {
partially evaluated: QChar(high).isHighSurrogate()
TRUEFALSE
yes
Evaluation Count:23071
no
Evaluation Count:0
0-23071
1507 --uc;
executed (the execution status of this line is deduced): --uc;
-
1508 ucs4 = QChar::surrogateToUcs4(high, ucs4);
executed (the execution status of this line is deduced): ucs4 = QChar::surrogateToUcs4(high, ucs4);
-
1509 }
executed: }
Execution Count:23071
23071
1510 }
executed: }
Execution Count:23071
23071
1511 -
1512 if (QChar::unicodeVersion(ucs4) > version)
evaluated: QChar::unicodeVersion(ucs4) > version
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1166954
1-1166954
1513 continue;
executed: continue;
Execution Count:1
1
1514 -
1515 const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer);
executed (the execution status of this line is deduced): const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer);
-
1516 if (!d || (canonical && tag != QChar::Canonical))
evaluated: !d
TRUEFALSE
yes
Evaluation Count:962997
yes
Evaluation Count:203957
evaluated: canonical
TRUEFALSE
yes
Evaluation Count:101286
yes
Evaluation Count:102671
evaluated: tag != QChar::Canonical
TRUEFALSE
yes
Evaluation Count:22028
yes
Evaluation Count:79258
22028-962997
1517 continue;
executed: continue;
Execution Count:985025
985025
1518 -
1519 int pos = uc - utf16;
executed (the execution status of this line is deduced): int pos = uc - utf16;
-
1520 s.replace(pos, QChar::requiresSurrogates(ucs4) ? 2 : 1, reinterpret_cast<const QChar *>(d), length);
executed (the execution status of this line is deduced): s.replace(pos, QChar::requiresSurrogates(ucs4) ? 2 : 1, reinterpret_cast<const QChar *>(d), length);
-
1521 // since the replace invalidates the pointers and we do decomposition recursive -
1522 utf16 = reinterpret_cast<unsigned short *>(s.data());
executed (the execution status of this line is deduced): utf16 = reinterpret_cast<unsigned short *>(s.data());
-
1523 uc = utf16 + pos + length;
executed (the execution status of this line is deduced): uc = utf16 + pos + length;
-
1524 }
executed: }
Execution Count:181929
181929
1525}
executed: }
Execution Count:356558
356558
1526 -
1527 -
1528struct UCS2Pair { -
1529 ushort u1; -
1530 ushort u2; -
1531}; -
1532 -
1533inline bool operator<(ushort u1, const UCS2Pair &ligature) -
1534{ return u1 < ligature.u1; }
executed: return u1 < ligature.u1;
Execution Count:20274
20274
1535inline bool operator<(const UCS2Pair &ligature, ushort u1) -
1536{ return ligature.u1 < u1; }
executed: return ligature.u1 < u1;
Execution Count:104407
104407
1537 -
1538struct UCS2SurrogatePair { -
1539 UCS2Pair p1; -
1540 UCS2Pair p2; -
1541}; -
1542 -
1543inline bool operator<(uint u1, const UCS2SurrogatePair &ligature) -
1544{ return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2); }
executed: return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2);
Execution Count:50
50
1545inline bool operator<(const UCS2SurrogatePair &ligature, uint u1) -
1546{ return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1; }
executed: return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1;
Execution Count:100
100
1547 -
1548static uint inline ligatureHelper(uint u1, uint u2) -
1549{ -
1550 if (u1 >= Hangul_LBase && u1 <= Hangul_SBase + Hangul_SCount) {
evaluated: u1 >= Hangul_LBase
TRUEFALSE
yes
Evaluation Count:228108
yes
Evaluation Count:62104
evaluated: u1 <= Hangul_SBase + Hangul_SCount
TRUEFALSE
yes
Evaluation Count:227908
yes
Evaluation Count:200
200-228108
1551 // compute Hangul syllable composition as per UAX #15 -
1552 // hangul L-V pair -
1553 const uint LIndex = u1 - Hangul_LBase;
executed (the execution status of this line is deduced): const uint LIndex = u1 - Hangul_LBase;
-
1554 if (LIndex < Hangul_LCount) {
evaluated: LIndex < Hangul_LCount
TRUEFALSE
yes
Evaluation Count:113318
yes
Evaluation Count:114590
113318-114590
1555 const uint VIndex = u2 - Hangul_VBase;
executed (the execution status of this line is deduced): const uint VIndex = u2 - Hangul_VBase;
-
1556 if (VIndex < Hangul_VCount)
evaluated: VIndex < Hangul_VCount
TRUEFALSE
yes
Evaluation Count:112910
yes
Evaluation Count:408
408-112910
1557 return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount;
executed: return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount;
Execution Count:112910
112910
1558 }
executed: }
Execution Count:408
408
1559 // hangul LV-T pair -
1560 const uint SIndex = u1 - Hangul_SBase;
executed (the execution status of this line is deduced): const uint SIndex = u1 - Hangul_SBase;
-
1561 if (SIndex < Hangul_SCount && (SIndex % Hangul_TCount) == 0) {
evaluated: SIndex < Hangul_SCount
TRUEFALSE
yes
Evaluation Count:108815
yes
Evaluation Count:6183
evaluated: (SIndex % Hangul_TCount) == 0
TRUEFALSE
yes
Evaluation Count:108801
yes
Evaluation Count:14
14-108815
1562 const uint TIndex = u2 - Hangul_TBase;
executed (the execution status of this line is deduced): const uint TIndex = u2 - Hangul_TBase;
-
1563 if (TIndex <= Hangul_TCount)
evaluated: TIndex <= Hangul_TCount
TRUEFALSE
yes
Evaluation Count:107744
yes
Evaluation Count:1057
1057-107744
1564 return u1 + TIndex;
executed: return u1 + TIndex;
Execution Count:107744
107744
1565 }
executed: }
Execution Count:1057
1057
1566 }
executed: }
Execution Count:7254
7254
1567 -
1568 const unsigned short index = GET_LIGATURE_INDEX(u2);
evaluated: u2 < 0x3100
TRUEFALSE
yes
Evaluation Count:66618
yes
Evaluation Count:2940
2940-66618
1569 if (index == 0xffff)
evaluated: index == 0xffff
TRUEFALSE
yes
Evaluation Count:49204
yes
Evaluation Count:20354
20354-49204
1570 return 0;
executed: return 0;
Execution Count:49204
49204
1571 const unsigned short *ligatures = uc_ligature_map+index;
executed (the execution status of this line is deduced): const unsigned short *ligatures = uc_ligature_map+index;
-
1572 ushort length = *ligatures++;
executed (the execution status of this line is deduced): ushort length = *ligatures++;
-
1573 if (QChar::requiresSurrogates(u1)) {
evaluated: QChar::requiresSurrogates(u1)
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:20304
50-20304
1574 const UCS2SurrogatePair *data = reinterpret_cast<const UCS2SurrogatePair *>(ligatures);
executed (the execution status of this line is deduced): const UCS2SurrogatePair *data = reinterpret_cast<const UCS2SurrogatePair *>(ligatures);
-
1575 const UCS2SurrogatePair *r = qBinaryFind(data, data + length, u1);
executed (the execution status of this line is deduced): const UCS2SurrogatePair *r = qBinaryFind(data, data + length, u1);
-
1576 if (r != data + length)
partially evaluated: r != data + length
TRUEFALSE
yes
Evaluation Count:50
no
Evaluation Count:0
0-50
1577 return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2);
executed: return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2);
Execution Count:50
50
1578 } else {
never executed: }
0
1579 const UCS2Pair *data = reinterpret_cast<const UCS2Pair *>(ligatures);
executed (the execution status of this line is deduced): const UCS2Pair *data = reinterpret_cast<const UCS2Pair *>(ligatures);
-
1580 const UCS2Pair *r = qBinaryFind(data, data + length, ushort(u1));
executed (the execution status of this line is deduced): const UCS2Pair *r = qBinaryFind(data, data + length, ushort(u1));
-
1581 if (r != data + length)
evaluated: r != data + length
TRUEFALSE
yes
Evaluation Count:17203
yes
Evaluation Count:3101
3101-17203
1582 return r->u2;
executed: return r->u2;
Execution Count:17203
17203
1583 }
executed: }
Execution Count:3101
3101
1584 -
1585 return 0;
executed: return 0;
Execution Count:3101
3101
1586} -
1587 -
1588static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) -
1589{ -
1590 QString &s = *str;
executed (the execution status of this line is deduced): QString &s = *str;
-
1591 -
1592 if (from < 0 || s.length() - from < 2)
partially evaluated: from < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:178342
evaluated: s.length() - from < 2
TRUEFALSE
yes
Evaluation Count:29255
yes
Evaluation Count:149087
0-178342
1593 return;
executed: return;
Execution Count:29255
29255
1594 -
1595 int starter = 0; // starter position
executed (the execution status of this line is deduced): int starter = 0;
-
1596 uint stcode = 0; // starter code point
executed (the execution status of this line is deduced): uint stcode = 0;
-
1597 int next = -1;
executed (the execution status of this line is deduced): int next = -1;
-
1598 int lastCombining = 0;
executed (the execution status of this line is deduced): int lastCombining = 0;
-
1599 -
1600 int pos = from;
executed (the execution status of this line is deduced): int pos = from;
-
1601 while (pos < s.length()) {
evaluated: pos < s.length()
TRUEFALSE
yes
Evaluation Count:463581
yes
Evaluation Count:149087
149087-463581
1602 int i = pos;
executed (the execution status of this line is deduced): int i = pos;
-
1603 uint uc = s.at(pos).unicode();
executed (the execution status of this line is deduced): uint uc = s.at(pos).unicode();
-
1604 if (QChar(uc).isHighSurrogate() && pos < s.length()-1) {
evaluated: QChar(uc).isHighSurrogate()
TRUEFALSE
yes
Evaluation Count:6565
yes
Evaluation Count:457016
partially evaluated: pos < s.length()-1
TRUEFALSE
yes
Evaluation Count:6565
no
Evaluation Count:0
0-457016
1605 ushort low = s.at(pos+1).unicode();
executed (the execution status of this line is deduced): ushort low = s.at(pos+1).unicode();
-
1606 if (QChar(low).isLowSurrogate()) {
partially evaluated: QChar(low).isLowSurrogate()
TRUEFALSE
yes
Evaluation Count:6565
no
Evaluation Count:0
0-6565
1607 uc = QChar::surrogateToUcs4(uc, low);
executed (the execution status of this line is deduced): uc = QChar::surrogateToUcs4(uc, low);
-
1608 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
1609 }
executed: }
Execution Count:6565
6565
1610 }
executed: }
Execution Count:6565
6565
1611 -
1612 const QUnicodeTables::Properties *p = qGetProp(uc);
executed (the execution status of this line is deduced): const QUnicodeTables::Properties *p = qGetProp(uc);
-
1613 if (p->unicodeVersion > version) {
evaluated: p->unicodeVersion > version
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:463580
1-463580
1614 starter = -1;
executed (the execution status of this line is deduced): starter = -1;
-
1615 next = -1; // to prevent i == next
executed (the execution status of this line is deduced): next = -1;
-
1616 lastCombining = 255; // to prevent combining > lastCombining
executed (the execution status of this line is deduced): lastCombining = 255;
-
1617 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
1618 continue;
executed: continue;
Execution Count:1
1
1619 } -
1620 -
1621 int combining = p->combiningClass;
executed (the execution status of this line is deduced): int combining = p->combiningClass;
-
1622 if (i == next || combining > lastCombining) {
evaluated: i == next
TRUEFALSE
yes
Evaluation Count:260655
yes
Evaluation Count:202925
evaluated: combining > lastCombining
TRUEFALSE
yes
Evaluation Count:29557
yes
Evaluation Count:173368
29557-260655
1623 Q_ASSERT(starter >= from);
executed (the execution status of this line is deduced): qt_noop();
-
1624 // allowed to form ligature with S -
1625 uint ligature = ligatureHelper(stcode, uc);
executed (the execution status of this line is deduced): uint ligature = ligatureHelper(stcode, uc);
-
1626 if (ligature) {
evaluated: ligature
TRUEFALSE
yes
Evaluation Count:237907
yes
Evaluation Count:52305
52305-237907
1627 stcode = ligature;
executed (the execution status of this line is deduced): stcode = ligature;
-
1628 QChar *d = s.data();
executed (the execution status of this line is deduced): QChar *d = s.data();
-
1629 // ligatureHelper() never changes planes -
1630 if (QChar::requiresSurrogates(ligature)) {
evaluated: QChar::requiresSurrogates(ligature)
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:237857
50-237857
1631 d[starter] = QChar::highSurrogate(ligature);
executed (the execution status of this line is deduced): d[starter] = QChar::highSurrogate(ligature);
-
1632 d[starter + 1] = QChar::lowSurrogate(ligature);
executed (the execution status of this line is deduced): d[starter + 1] = QChar::lowSurrogate(ligature);
-
1633 s.remove(i, 2);
executed (the execution status of this line is deduced): s.remove(i, 2);
-
1634 } else {
executed: }
Execution Count:50
50
1635 d[starter] = ligature;
executed (the execution status of this line is deduced): d[starter] = ligature;
-
1636 s.remove(i, 1);
executed (the execution status of this line is deduced): s.remove(i, 1);
-
1637 }
executed: }
Execution Count:237857
237857
1638 continue;
executed: continue;
Execution Count:237907
237907
1639 } -
1640 }
executed: }
Execution Count:52305
52305
1641 if (combining == 0) {
evaluated: combining == 0
TRUEFALSE
yes
Evaluation Count:174308
yes
Evaluation Count:51365
51365-174308
1642 starter = i;
executed (the execution status of this line is deduced): starter = i;
-
1643 stcode = uc;
executed (the execution status of this line is deduced): stcode = uc;
-
1644 next = pos + 1;
executed (the execution status of this line is deduced): next = pos + 1;
-
1645 }
executed: }
Execution Count:174308
174308
1646 lastCombining = combining;
executed (the execution status of this line is deduced): lastCombining = combining;
-
1647 -
1648 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
1649 }
executed: }
Execution Count:225673
225673
1650}
executed: }
Execution Count:149087
149087
1651 -
1652 -
1653static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, int from) -
1654{ -
1655 QString &s = *str;
executed (the execution status of this line is deduced): QString &s = *str;
-
1656 const int l = s.length()-1;
executed (the execution status of this line is deduced): const int l = s.length()-1;
-
1657 -
1658 uint u1, u2;
executed (the execution status of this line is deduced): uint u1, u2;
-
1659 ushort c1, c2;
executed (the execution status of this line is deduced): ushort c1, c2;
-
1660 -
1661 int pos = from;
executed (the execution status of this line is deduced): int pos = from;
-
1662 while (pos < l) {
evaluated: pos < l
TRUEFALSE
yes
Evaluation Count:325085
yes
Evaluation Count:325284
325085-325284
1663 int p2 = pos+1;
executed (the execution status of this line is deduced): int p2 = pos+1;
-
1664 u1 = s.at(pos).unicode();
executed (the execution status of this line is deduced): u1 = s.at(pos).unicode();
-
1665 if (QChar(u1).isHighSurrogate()) {
evaluated: QChar(u1).isHighSurrogate()
TRUEFALSE
yes
Evaluation Count:10720
yes
Evaluation Count:314365
10720-314365
1666 ushort low = s.at(p2).unicode();
executed (the execution status of this line is deduced): ushort low = s.at(p2).unicode();
-
1667 if (QChar(low).isLowSurrogate()) {
partially evaluated: QChar(low).isLowSurrogate()
TRUEFALSE
yes
Evaluation Count:10720
no
Evaluation Count:0
0-10720
1668 u1 = QChar::surrogateToUcs4(u1, low);
executed (the execution status of this line is deduced): u1 = QChar::surrogateToUcs4(u1, low);
-
1669 if (p2 >= l)
evaluated: p2 >= l
TRUEFALSE
yes
Evaluation Count:9868
yes
Evaluation Count:852
852-9868
1670 break;
executed: break;
Execution Count:9868
9868
1671 ++p2;
executed (the execution status of this line is deduced): ++p2;
-
1672 }
executed: }
Execution Count:852
852
1673 }
executed: }
Execution Count:852
852
1674 c1 = 0;
executed (the execution status of this line is deduced): c1 = 0;
-
1675 -
1676 advance:
code before this statement executed: advance:
Execution Count:315217
315217
1677 u2 = s.at(p2).unicode();
executed (the execution status of this line is deduced): u2 = s.at(p2).unicode();
-
1678 if (QChar(u2).isHighSurrogate() && p2 < l) {
evaluated: QChar(u2).isHighSurrogate()
TRUEFALSE
yes
Evaluation Count:3416
yes
Evaluation Count:448135
partially evaluated: p2 < l
TRUEFALSE
yes
Evaluation Count:3416
no
Evaluation Count:0
0-448135
1679 ushort low = s.at(p2+1).unicode();
executed (the execution status of this line is deduced): ushort low = s.at(p2+1).unicode();
-
1680 if (QChar(low).isLowSurrogate()) {
partially evaluated: QChar(low).isLowSurrogate()
TRUEFALSE
yes
Evaluation Count:3416
no
Evaluation Count:0
0-3416
1681 u2 = QChar::surrogateToUcs4(u2, low);
executed (the execution status of this line is deduced): u2 = QChar::surrogateToUcs4(u2, low);
-
1682 ++p2;
executed (the execution status of this line is deduced): ++p2;
-
1683 }
executed: }
Execution Count:3416
3416
1684 }
executed: }
Execution Count:3416
3416
1685 -
1686 c2 = 0;
executed (the execution status of this line is deduced): c2 = 0;
-
1687 { -
1688 const QUnicodeTables::Properties *p = qGetProp(u2);
executed (the execution status of this line is deduced): const QUnicodeTables::Properties *p = qGetProp(u2);
-
1689 if (p->unicodeVersion <= version)
evaluated: p->unicodeVersion <= version
TRUEFALSE
yes
Evaluation Count:451550
yes
Evaluation Count:1
1-451550
1690 c2 = p->combiningClass;
executed: c2 = p->combiningClass;
Execution Count:451550
451550
1691 } -
1692 if (c2 == 0) {
evaluated: c2 == 0
TRUEFALSE
yes
Evaluation Count:270223
yes
Evaluation Count:181328
181328-270223
1693 pos = p2+1;
executed (the execution status of this line is deduced): pos = p2+1;
-
1694 continue;
executed: continue;
Execution Count:270223
270223
1695 } -
1696 -
1697 if (c1 == 0) {
evaluated: c1 == 0
TRUEFALSE
yes
Evaluation Count:73638
yes
Evaluation Count:107690
73638-107690
1698 const QUnicodeTables::Properties *p = qGetProp(u1);
executed (the execution status of this line is deduced): const QUnicodeTables::Properties *p = qGetProp(u1);
-
1699 if (p->unicodeVersion <= version)
partially evaluated: p->unicodeVersion <= version
TRUEFALSE
yes
Evaluation Count:73638
no
Evaluation Count:0
0-73638
1700 c1 = p->combiningClass;
executed: c1 = p->combiningClass;
Execution Count:73638
73638
1701 }
executed: }
Execution Count:73638
73638
1702 -
1703 if (c1 > c2) {
evaluated: c1 > c2
TRUEFALSE
yes
Evaluation Count:23588
yes
Evaluation Count:157740
23588-157740
1704 QChar *uc = s.data();
executed (the execution status of this line is deduced): QChar *uc = s.data();
-
1705 int p = pos;
executed (the execution status of this line is deduced): int p = pos;
-
1706 // exchange characters -
1707 if (!QChar::requiresSurrogates(u2)) {
evaluated: !QChar::requiresSurrogates(u2)
TRUEFALSE
yes
Evaluation Count:23268
yes
Evaluation Count:320
320-23268
1708 uc[p++] = u2;
executed (the execution status of this line is deduced): uc[p++] = u2;
-
1709 } else {
executed: }
Execution Count:23268
23268
1710 uc[p++] = QChar::highSurrogate(u2);
executed (the execution status of this line is deduced): uc[p++] = QChar::highSurrogate(u2);
-
1711 uc[p++] = QChar::lowSurrogate(u2);
executed (the execution status of this line is deduced): uc[p++] = QChar::lowSurrogate(u2);
-
1712 }
executed: }
Execution Count:320
320
1713 if (!QChar::requiresSurrogates(u1)) {
evaluated: !QChar::requiresSurrogates(u1)
TRUEFALSE
yes
Evaluation Count:23352
yes
Evaluation Count:236
236-23352
1714 uc[p++] = u1;
executed (the execution status of this line is deduced): uc[p++] = u1;
-
1715 } else {
executed: }
Execution Count:23352
23352
1716 uc[p++] = QChar::highSurrogate(u1);
executed (the execution status of this line is deduced): uc[p++] = QChar::highSurrogate(u1);
-
1717 uc[p++] = QChar::lowSurrogate(u1);
executed (the execution status of this line is deduced): uc[p++] = QChar::lowSurrogate(u1);
-
1718 }
executed: }
Execution Count:236
236
1719 if (pos > 0)
evaluated: pos > 0
TRUEFALSE
yes
Evaluation Count:23576
yes
Evaluation Count:12
12-23576
1720 --pos;
executed: --pos;
Execution Count:23576
23576
1721 if (pos > 0 && s.at(pos).isLowSurrogate())
evaluated: pos > 0
TRUEFALSE
yes
Evaluation Count:12876
yes
Evaluation Count:10712
evaluated: s.at(pos).isLowSurrogate()
TRUEFALSE
yes
Evaluation Count:452
yes
Evaluation Count:12424
452-12876
1722 --pos;
executed: --pos;
Execution Count:452
452
1723 } else {
executed: }
Execution Count:23588
23588
1724 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
1725 if (QChar::requiresSurrogates(u1))
evaluated: QChar::requiresSurrogates(u1)
TRUEFALSE
yes
Evaluation Count:3192
yes
Evaluation Count:154548
3192-154548
1726 ++pos;
executed: ++pos;
Execution Count:3192
3192
1727 -
1728 u1 = u2;
executed (the execution status of this line is deduced): u1 = u2;
-
1729 c1 = c2; // != 0
executed (the execution status of this line is deduced): c1 = c2;
-
1730 p2 = pos + 1;
executed (the execution status of this line is deduced): p2 = pos + 1;
-
1731 if (QChar::requiresSurrogates(u1))
evaluated: QChar::requiresSurrogates(u1)
TRUEFALSE
yes
Evaluation Count:3016
yes
Evaluation Count:154724
3016-154724
1732 ++p2;
executed: ++p2;
Execution Count:3016
3016
1733 if (p2 > l)
evaluated: p2 > l
TRUEFALSE
yes
Evaluation Count:21406
yes
Evaluation Count:136334
21406-136334
1734 break;
executed: break;
Execution Count:21406
21406
1735 -
1736 goto advance;
executed: goto advance;
Execution Count:136334
136334
1737 } -
1738 } -
1739}
executed: }
Execution Count:356558
356558
1740 -
1741QT_END_NAMESPACE -
1742 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial