Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | bool QChar::isPrint(uint ucs4) | - |
7 | { | - |
8 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:3483 |
| 0-3483 |
9 | return false; never executed: return false; | 0 |
10 | const int test = (1 << (Other_Control)) | | - |
11 | (1 << (Other_Format)) | | - |
12 | (1 << (Other_Surrogate)) | | - |
13 | (1 << (Other_PrivateUse)) | | - |
14 | (1 << (Other_NotAssigned)); | - |
15 | return !((1 << (qGetProp(ucs4)->category)) & test); executed: return !((1 << (qGetProp(ucs4)->category)) & test); Execution Count:3483 | 3483 |
16 | } | - |
17 | bool QChar::isSpace_helper(uint ucs4) | - |
18 | { | - |
19 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:670103 |
| 0-670103 |
20 | return false; never executed: return false; | 0 |
21 | const int test = (1 << (Separator_Space)) | | - |
22 | (1 << (Separator_Line)) | | - |
23 | (1 << (Separator_Paragraph)); | - |
24 | return (1 << (qGetProp(ucs4)->category)) & test; executed: return (1 << (qGetProp(ucs4)->category)) & test; Execution Count:670103 | 670103 |
25 | } | - |
26 | bool QChar::isMark(uint ucs4) | - |
27 | { | - |
28 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:16403 |
| 0-16403 |
29 | return false; never executed: return false; | 0 |
30 | const int test = (1 << (Mark_NonSpacing)) | | - |
31 | (1 << (Mark_SpacingCombining)) | | - |
32 | (1 << (Mark_Enclosing)); | - |
33 | return (1 << (qGetProp(ucs4)->category)) & test; executed: return (1 << (qGetProp(ucs4)->category)) & test; Execution Count:16403 | 16403 |
34 | } | - |
35 | bool QChar::isPunct(uint ucs4) | - |
36 | { | - |
37 | if (ucs4 > LastValidCodePoint) never evaluated: ucs4 > LastValidCodePoint | 0 |
38 | return false; never executed: return false; | 0 |
39 | const int test = (1 << (Punctuation_Connector)) | | - |
40 | (1 << (Punctuation_Dash)) | | - |
41 | (1 << (Punctuation_Open)) | | - |
42 | (1 << (Punctuation_Close)) | | - |
43 | (1 << (Punctuation_InitialQuote)) | | - |
44 | (1 << (Punctuation_FinalQuote)) | | - |
45 | (1 << (Punctuation_Other)); | - |
46 | return (1 << (qGetProp(ucs4)->category)) & test; never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 |
47 | } | - |
48 | bool QChar::isSymbol(uint ucs4) | - |
49 | { | - |
50 | if (ucs4 > LastValidCodePoint) never evaluated: ucs4 > LastValidCodePoint | 0 |
51 | return false; never executed: return false; | 0 |
52 | const int test = (1 << (Symbol_Math)) | | - |
53 | (1 << (Symbol_Currency)) | | - |
54 | (1 << (Symbol_Modifier)) | | - |
55 | (1 << (Symbol_Other)); | - |
56 | return (1 << (qGetProp(ucs4)->category)) & test; never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 |
57 | } | - |
58 | bool QChar::isLetter_helper(uint ucs4) | - |
59 | { | - |
60 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:128 |
| 0-128 |
61 | return false; never executed: return false; | 0 |
62 | const int test = (1 << (Letter_Uppercase)) | | - |
63 | (1 << (Letter_Lowercase)) | | - |
64 | (1 << (Letter_Titlecase)) | | - |
65 | (1 << (Letter_Modifier)) | | - |
66 | (1 << (Letter_Other)); | - |
67 | return (1 << (qGetProp(ucs4)->category)) & test; executed: return (1 << (qGetProp(ucs4)->category)) & test; Execution Count:128 | 128 |
68 | } | - |
69 | bool QChar::isNumber_helper(uint ucs4) | - |
70 | { | - |
71 | if (ucs4 > LastValidCodePoint) never evaluated: ucs4 > LastValidCodePoint | 0 |
72 | return false; never executed: return false; | 0 |
73 | const int test = (1 << (Number_DecimalDigit)) | | - |
74 | (1 << (Number_Letter)) | | - |
75 | (1 << (Number_Other)); | - |
76 | return (1 << (qGetProp(ucs4)->category)) & test; never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 |
77 | } | - |
78 | bool QChar::isLetterOrNumber_helper(uint ucs4) | - |
79 | { | - |
80 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:65536 |
| 0-65536 |
81 | return false; never executed: return false; | 0 |
82 | const int test = (1 << (Letter_Uppercase)) | | - |
83 | (1 << (Letter_Lowercase)) | | - |
84 | (1 << (Letter_Titlecase)) | | - |
85 | (1 << (Letter_Modifier)) | | - |
86 | (1 << (Letter_Other)) | | - |
87 | (1 << (Number_DecimalDigit)) | | - |
88 | (1 << (Number_Letter)) | | - |
89 | (1 << (Number_Other)); | - |
90 | return (1 << (qGetProp(ucs4)->category)) & test; executed: return (1 << (qGetProp(ucs4)->category)) & test; Execution Count:65536 | 65536 |
91 | } | - |
92 | int QChar::digitValue(uint ucs4) | - |
93 | { | - |
94 | if (ucs4 > LastValidCodePoint) evaluated: ucs4 > LastValidCodePoint yes Evaluation Count:1 | yes Evaluation Count:89440073 |
| 1-89440073 |
95 | return -1; executed: return -1; Execution Count:1 | 1 |
96 | return qGetProp(ucs4)->digitValue; executed: return qGetProp(ucs4)->digitValue; Execution Count:89440073 | 89440073 |
97 | } | - |
98 | QChar::Category QChar::category(uint ucs4) | - |
99 | { | - |
100 | if (ucs4 > LastValidCodePoint) evaluated: ucs4 > LastValidCodePoint yes Evaluation Count:1 | yes Evaluation Count:3863089 |
| 1-3863089 |
101 | return QChar::Other_NotAssigned; executed: return QChar::Other_NotAssigned; Execution Count:1 | 1 |
102 | return (QChar::Category) qGetProp(ucs4)->category; executed: return (QChar::Category) qGetProp(ucs4)->category; Execution Count:3863089 | 3863089 |
103 | } | - |
104 | QChar::Direction QChar::direction(uint ucs4) | - |
105 | { | - |
106 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:1126419 |
| 0-1126419 |
107 | return QChar::DirL; never executed: return QChar::DirL; | 0 |
108 | return (QChar::Direction) qGetProp(ucs4)->direction; executed: return (QChar::Direction) qGetProp(ucs4)->direction; Execution Count:1126419 | 1126419 |
109 | } | - |
110 | QChar::Joining QChar::joining(uint ucs4) | - |
111 | { | - |
112 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:1880 |
| 0-1880 |
113 | return QChar::OtherJoining; never executed: return QChar::OtherJoining; | 0 |
114 | return (QChar::Joining) qGetProp(ucs4)->joining; executed: return (QChar::Joining) qGetProp(ucs4)->joining; Execution Count:1880 | 1880 |
115 | } | - |
116 | bool QChar::hasMirrored(uint ucs4) | - |
117 | { | - |
118 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
119 | return false; never executed: return false; | 0 |
120 | return qGetProp(ucs4)->mirrorDiff != 0; executed: return qGetProp(ucs4)->mirrorDiff != 0; Execution Count:4 | 4 |
121 | } | - |
122 | uint QChar::mirroredChar(uint ucs4) | - |
123 | { | - |
124 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:1172 |
| 0-1172 |
125 | return ucs4; never executed: return ucs4; | 0 |
126 | return ucs4 + qGetProp(ucs4)->mirrorDiff; executed: return ucs4 + qGetProp(ucs4)->mirrorDiff; Execution Count:1172 | 1172 |
127 | } | - |
128 | | - |
129 | | - |
130 | | - |
131 | enum { | - |
132 | Hangul_SBase = 0xac00, | - |
133 | Hangul_LBase = 0x1100, | - |
134 | Hangul_VBase = 0x1161, | - |
135 | Hangul_TBase = 0x11a7, | - |
136 | Hangul_LCount = 19, | - |
137 | Hangul_VCount = 21, | - |
138 | Hangul_TCount = 28, | - |
139 | Hangul_NCount = Hangul_VCount * Hangul_TCount, | - |
140 | Hangul_SCount = Hangul_LCount * Hangul_NCount | - |
141 | }; | - |
142 | | - |
143 | | - |
144 | static const unsigned short * decompositionHelper | - |
145 | (uint ucs4, int *length, int *tag, unsigned short *buffer) | - |
146 | { | - |
147 | if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) { evaluated: ucs4 >= Hangul_SBase yes Evaluation Count:173403 | yes Evaluation Count:993556 |
evaluated: ucs4 < Hangul_SBase + Hangul_SCount yes Evaluation Count:135326 | yes Evaluation Count:38077 |
| 38077-993556 |
148 | | - |
149 | const uint SIndex = ucs4 - Hangul_SBase; | - |
150 | buffer[0] = Hangul_LBase + SIndex / Hangul_NCount; | - |
151 | buffer[1] = Hangul_VBase + (SIndex % Hangul_NCount) / Hangul_TCount; | - |
152 | buffer[2] = Hangul_TBase + SIndex % Hangul_TCount; | - |
153 | *length = buffer[2] == Hangul_TBase ? 2 : 3; evaluated: buffer[2] == Hangul_TBase yes Evaluation Count:6041 | yes Evaluation Count:129285 |
| 6041-129285 |
154 | *tag = QChar::Canonical; | - |
155 | return buffer; executed: return buffer; Execution Count:135326 | 135326 |
156 | } | - |
157 | | - |
158 | const unsigned short index = (ucs4 < 0x3400 ? (uc_decomposition_trie[uc_decomposition_trie[ucs4>>4] + (ucs4 & 0xf)]) : (ucs4 < 0x30000 ? uc_decomposition_trie[uc_decomposition_trie[((ucs4 - 0x3400)>>8) + 0x340] + (ucs4 & 0xff)] : 0xffff)); evaluated: ucs4 < 0x3400 yes Evaluation Count:967293 | yes Evaluation Count:64340 |
| 64340-967293 |
159 | if (index == 0xffff) { evaluated: index == 0xffff yes Evaluation Count:962997 | yes Evaluation Count:68636 |
| 68636-962997 |
160 | *length = 0; | - |
161 | *tag = QChar::NoDecomposition; | - |
162 | return 0; executed: return 0; Execution Count:962997 | 962997 |
163 | } | - |
164 | | - |
165 | const unsigned short *decomposition = uc_decomposition_map+index; | - |
166 | *tag = (*decomposition) & 0xff; | - |
167 | *length = (*decomposition) >> 8; | - |
168 | return decomposition+1; executed: return decomposition+1; Execution Count:68636 | 68636 |
169 | } | - |
170 | | - |
171 | | - |
172 | | - |
173 | | - |
174 | | - |
175 | QString QChar::decomposition() const | - |
176 | { | - |
177 | return QChar::decomposition(ucs); never executed: return QChar::decomposition(ucs); | 0 |
178 | } | - |
179 | | - |
180 | | - |
181 | | - |
182 | | - |
183 | | - |
184 | | - |
185 | QString QChar::decomposition(uint ucs4) | - |
186 | { | - |
187 | unsigned short buffer[3]; | - |
188 | int length; | - |
189 | int tag; | - |
190 | const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer); | - |
191 | return QString(reinterpret_cast<const QChar *>(d), length); executed: return QString(reinterpret_cast<const QChar *>(d), length); Execution Count:5 | 5 |
192 | } | - |
193 | QChar::Decomposition QChar::decompositionTag(uint ucs4) | - |
194 | { | - |
195 | if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) evaluated: ucs4 >= Hangul_SBase yes Evaluation Count:22368 | yes Evaluation Count:6 |
evaluated: ucs4 < Hangul_SBase + Hangul_SCount yes Evaluation Count:22344 | yes Evaluation Count:24 |
| 6-22368 |
196 | return QChar::Canonical; executed: return QChar::Canonical; Execution Count:22344 | 22344 |
197 | const unsigned short index = (ucs4 < 0x3400 ? (uc_decomposition_trie[uc_decomposition_trie[ucs4>>4] + (ucs4 & 0xf)]) : (ucs4 < 0x30000 ? uc_decomposition_trie[uc_decomposition_trie[((ucs4 - 0x3400)>>8) + 0x340] + (ucs4 & 0xff)] : 0xffff)); evaluated: ucs4 < 0x3400 yes Evaluation Count:6 | yes Evaluation Count:24 |
| 6-24 |
198 | if (index == 0xffff) evaluated: index == 0xffff yes Evaluation Count:26 | yes Evaluation Count:4 |
| 4-26 |
199 | return QChar::NoDecomposition; executed: return QChar::NoDecomposition; Execution Count:26 | 26 |
200 | return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff); executed: return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff); Execution Count:4 | 4 |
201 | } | - |
202 | unsigned char QChar::combiningClass(uint ucs4) | - |
203 | { | - |
204 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:19 |
| 0-19 |
205 | return 0; never executed: return 0; | 0 |
206 | return (unsigned char) qGetProp(ucs4)->combiningClass; executed: return (unsigned char) qGetProp(ucs4)->combiningClass; Execution Count:19 | 19 |
207 | } | - |
208 | QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) | - |
209 | { | - |
210 | if (ucs4 > LastValidCodePoint) evaluated: ucs4 > LastValidCodePoint yes Evaluation Count:1 | yes Evaluation Count:1178694 |
| 1-1178694 |
211 | return QChar::Unicode_Unassigned; executed: return QChar::Unicode_Unassigned; Execution Count:1 | 1 |
212 | return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion; executed: return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion; Execution Count:1178694 | 1178694 |
213 | } | - |
214 | | - |
215 | | - |
216 | | - |
217 | | - |
218 | QChar::UnicodeVersion QChar::currentUnicodeVersion() | - |
219 | { | - |
220 | return QChar::Unicode_6_2; executed: return QChar::Unicode_6_2; Execution Count:356431 | 356431 |
221 | } | - |
222 | | - |
223 | | - |
224 | template <typename T> | - |
225 | static inline T toLowerCase_helper(T uc) | - |
226 | { | - |
227 | const QUnicodeTables::Properties *p = qGetProp(uc); | - |
228 | if (p->lowerCaseSpecial) { evaluated: p->lowerCaseSpecial yes Evaluation Count:6 | yes Evaluation Count:2671207 |
| 6-2671207 |
229 | const ushort *specialCase = specialCaseMap + p->lowerCaseDiff; | - |
230 | return (*specialCase == 1) ? specialCase[1] : uc; executed: return (*specialCase == 1) ? specialCase[1] : uc; Execution Count:6 | 6 |
231 | } | - |
232 | return uc + p->lowerCaseDiff; executed: return uc + p->lowerCaseDiff; Execution Count:2671207 | 2671207 |
233 | } | - |
234 | | - |
235 | template <typename T> | - |
236 | static inline T toUpperCase_helper(T uc) | - |
237 | { | - |
238 | const QUnicodeTables::Properties *p = qGetProp(uc); | - |
239 | if (p->upperCaseSpecial) { evaluated: p->upperCaseSpecial yes Evaluation Count:7 | yes Evaluation Count:899110 |
| 7-899110 |
240 | const ushort *specialCase = specialCaseMap + p->upperCaseDiff; | - |
241 | return (*specialCase == 1) ? specialCase[1] : uc; executed: return (*specialCase == 1) ? specialCase[1] : uc; Execution Count:7 | 7 |
242 | } | - |
243 | return uc + p->upperCaseDiff; executed: return uc + p->upperCaseDiff; Execution Count:899110 | 899110 |
244 | } | - |
245 | | - |
246 | template <typename T> | - |
247 | static inline T toTitleCase_helper(T uc) | - |
248 | { | - |
249 | const QUnicodeTables::Properties *p = qGetProp(uc); | - |
250 | if (p->titleCaseSpecial) { evaluated: p->titleCaseSpecial yes Evaluation Count:7 | yes Evaluation Count:48 |
| 7-48 |
251 | const ushort *specialCase = specialCaseMap + p->titleCaseDiff; | - |
252 | return (*specialCase == 1) ? specialCase[1] : uc; executed: return (*specialCase == 1) ? specialCase[1] : uc; Execution Count:7 | 7 |
253 | } | - |
254 | return uc + p->titleCaseDiff; executed: return uc + p->titleCaseDiff; Execution Count:48 | 48 |
255 | } | - |
256 | | - |
257 | template <typename T> | - |
258 | static inline T toCaseFolded_helper(T uc) | - |
259 | { | - |
260 | const QUnicodeTables::Properties *p = qGetProp(uc); | - |
261 | if (p->caseFoldSpecial) { evaluated: p->caseFoldSpecial yes Evaluation Count:9 | yes Evaluation Count:23160228 |
| 9-23160228 |
262 | const ushort *specialCase = specialCaseMap + p->caseFoldDiff; | - |
263 | return (*specialCase == 1) ? specialCase[1] : uc; executed: return (*specialCase == 1) ? specialCase[1] : uc; Execution Count:9 | 9 |
264 | } | - |
265 | return uc + p->caseFoldDiff; executed: return uc + p->caseFoldDiff; Execution Count:23160228 | 23160228 |
266 | } | - |
267 | uint QChar::toLower(uint ucs4) | - |
268 | { | - |
269 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:2671209 |
| 0-2671209 |
270 | return ucs4; never executed: return ucs4; | 0 |
271 | return toLowerCase_helper<uint>(ucs4); executed: return toLowerCase_helper<uint>(ucs4); Execution Count:2671212 | 2671212 |
272 | } | - |
273 | uint QChar::toUpper(uint ucs4) | - |
274 | { | - |
275 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:899117 |
| 0-899117 |
276 | return ucs4; never executed: return ucs4; | 0 |
277 | return toUpperCase_helper<uint>(ucs4); executed: return toUpperCase_helper<uint>(ucs4); Execution Count:899117 | 899117 |
278 | } | - |
279 | uint QChar::toTitleCase(uint ucs4) | - |
280 | { | - |
281 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
282 | return ucs4; never executed: return ucs4; | 0 |
283 | return toTitleCase_helper<uint>(ucs4); executed: return toTitleCase_helper<uint>(ucs4); Execution Count:55 | 55 |
284 | } | - |
285 | | - |
286 | static inline uint foldCase(const ushort *ch, const ushort *start) | - |
287 | { | - |
288 | uint c = *ch; | - |
289 | if (QChar(c).isLowSurrogate() && ch > start && QChar(*(ch - 1)).isHighSurrogate()) partially evaluated: QChar(c).isLowSurrogate() no Evaluation Count:0 | yes Evaluation Count:74620 |
never evaluated: ch > start never evaluated: QChar(*(ch - 1)).isHighSurrogate() | 0-74620 |
290 | c = QChar::surrogateToUcs4(*(ch - 1), c); never executed: c = QChar::surrogateToUcs4(*(ch - 1), c); | 0 |
291 | return toCaseFolded_helper<uint>(c); executed: return toCaseFolded_helper<uint>(c); Execution Count:74620 | 74620 |
292 | } | - |
293 | | - |
294 | static inline uint foldCase(uint ch, uint &last) | - |
295 | { | - |
296 | uint c = ch; | - |
297 | if (QChar(c).isLowSurrogate() && QChar(last).isHighSurrogate()) evaluated: QChar(c).isLowSurrogate() yes Evaluation Count:24 | yes Evaluation Count:22959662 |
partially evaluated: QChar(last).isHighSurrogate() yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-22959662 |
298 | c = QChar::surrogateToUcs4(last, c); executed: c = QChar::surrogateToUcs4(last, c); Execution Count:24 | 24 |
299 | last = ch; | - |
300 | return toCaseFolded_helper<uint>(c); executed: return toCaseFolded_helper<uint>(c); Execution Count:22959686 | 22959686 |
301 | } | - |
302 | | - |
303 | static inline ushort foldCase(ushort ch) | - |
304 | { | - |
305 | return toCaseFolded_helper<ushort>(ch); executed: return toCaseFolded_helper<ushort>(ch); Execution Count:60345 | 60345 |
306 | } | - |
307 | uint QChar::toCaseFolded(uint ucs4) | - |
308 | { | - |
309 | if (ucs4 > LastValidCodePoint) partially evaluated: ucs4 > LastValidCodePoint no Evaluation Count:0 | yes Evaluation Count:65586 |
| 0-65586 |
310 | return ucs4; never executed: return ucs4; | 0 |
311 | return toCaseFolded_helper<uint>(ucs4); executed: return toCaseFolded_helper<uint>(ucs4); Execution Count:65586 | 65586 |
312 | } | - |
313 | QDataStream &operator<<(QDataStream &out, QChar chr) | - |
314 | { | - |
315 | out << quint16(chr.unicode()); | - |
316 | return out; executed: return out; Execution Count:5 | 5 |
317 | } | - |
318 | QDataStream &operator>>(QDataStream &in, QChar &chr) | - |
319 | { | - |
320 | quint16 u; | - |
321 | in >> u; | - |
322 | chr.unicode() = ushort(u); | - |
323 | return in; executed: return in; Execution Count:9 | 9 |
324 | } | - |
325 | static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, int from) | - |
326 | { | - |
327 | int length; | - |
328 | int tag; | - |
329 | unsigned short buffer[3]; | - |
330 | | - |
331 | QString &s = *str; | - |
332 | | - |
333 | const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data()); | - |
334 | const unsigned short *uc = utf16 + s.length(); | - |
335 | while (uc != utf16 + from) { evaluated: uc != utf16 + from yes Evaluation Count:1166955 | yes Evaluation Count:356558 |
| 356558-1166955 |
336 | uint ucs4 = *(--uc); | - |
337 | if (QChar(ucs4).isLowSurrogate() && uc != utf16) { evaluated: QChar(ucs4).isLowSurrogate() yes Evaluation Count:23071 | yes Evaluation Count:1143884 |
partially evaluated: uc != utf16 yes Evaluation Count:23071 | no Evaluation Count:0 |
| 0-1143884 |
338 | ushort high = *(uc - 1); | - |
339 | if (QChar(high).isHighSurrogate()) { partially evaluated: QChar(high).isHighSurrogate() yes Evaluation Count:23071 | no Evaluation Count:0 |
| 0-23071 |
340 | --uc; | - |
341 | ucs4 = QChar::surrogateToUcs4(high, ucs4); | - |
342 | } executed: } Execution Count:23071 | 23071 |
343 | } executed: } Execution Count:23071 | 23071 |
344 | | - |
345 | if (QChar::unicodeVersion(ucs4) > version) evaluated: QChar::unicodeVersion(ucs4) > version yes Evaluation Count:1 | yes Evaluation Count:1166954 |
| 1-1166954 |
346 | continue; executed: continue; Execution Count:1 | 1 |
347 | | - |
348 | const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer); | - |
349 | if (!d || (canonical && tag != QChar::Canonical)) evaluated: !d yes Evaluation Count:962997 | yes Evaluation Count:203957 |
evaluated: canonical yes Evaluation Count:101286 | yes Evaluation Count:102671 |
evaluated: tag != QChar::Canonical yes Evaluation Count:22028 | yes Evaluation Count:79258 |
| 22028-962997 |
350 | continue; executed: continue; Execution Count:985025 | 985025 |
351 | | - |
352 | int pos = uc - utf16; | - |
353 | s.replace(pos, QChar::requiresSurrogates(ucs4) ? 2 : 1, reinterpret_cast<const QChar *>(d), length); | - |
354 | | - |
355 | utf16 = reinterpret_cast<unsigned short *>(s.data()); | - |
356 | uc = utf16 + pos + length; | - |
357 | } executed: } Execution Count:181929 | 181929 |
358 | } executed: } Execution Count:356558 | 356558 |
359 | | - |
360 | | - |
361 | struct UCS2Pair { | - |
362 | ushort u1; | - |
363 | ushort u2; | - |
364 | }; | - |
365 | | - |
366 | inline bool operator<(ushort u1, const UCS2Pair &ligature) | - |
367 | { return u1 < ligature.u1; } executed: return u1 < ligature.u1; Execution Count:20274 | 20274 |
368 | inline bool operator<(const UCS2Pair &ligature, ushort u1) | - |
369 | { return ligature.u1 < u1; } executed: return ligature.u1 < u1; Execution Count:104407 | 104407 |
370 | | - |
371 | struct UCS2SurrogatePair { | - |
372 | UCS2Pair p1; | - |
373 | UCS2Pair p2; | - |
374 | }; | - |
375 | | - |
376 | inline bool operator<(uint u1, const UCS2SurrogatePair &ligature) | - |
377 | { 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 |
378 | inline bool operator<(const UCS2SurrogatePair &ligature, uint u1) | - |
379 | { 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 |
380 | | - |
381 | static uint inline ligatureHelper(uint u1, uint u2) | - |
382 | { | - |
383 | if (u1 >= Hangul_LBase && u1 <= Hangul_SBase + Hangul_SCount) { evaluated: u1 >= Hangul_LBase yes Evaluation Count:228108 | yes Evaluation Count:62104 |
evaluated: u1 <= Hangul_SBase + Hangul_SCount yes Evaluation Count:227908 | yes Evaluation Count:200 |
| 200-228108 |
384 | | - |
385 | | - |
386 | const uint LIndex = u1 - Hangul_LBase; | - |
387 | if (LIndex < Hangul_LCount) { evaluated: LIndex < Hangul_LCount yes Evaluation Count:113318 | yes Evaluation Count:114590 |
| 113318-114590 |
388 | const uint VIndex = u2 - Hangul_VBase; | - |
389 | if (VIndex < Hangul_VCount) evaluated: VIndex < Hangul_VCount yes Evaluation Count:112910 | yes Evaluation Count:408 |
| 408-112910 |
390 | return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount; executed: return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount; Execution Count:112910 | 112910 |
391 | } executed: } Execution Count:408 | 408 |
392 | | - |
393 | const uint SIndex = u1 - Hangul_SBase; | - |
394 | if (SIndex < Hangul_SCount && (SIndex % Hangul_TCount) == 0) { evaluated: SIndex < Hangul_SCount yes Evaluation Count:108815 | yes Evaluation Count:6183 |
evaluated: (SIndex % Hangul_TCount) == 0 yes Evaluation Count:108801 | yes Evaluation Count:14 |
| 14-108815 |
395 | const uint TIndex = u2 - Hangul_TBase; | - |
396 | if (TIndex <= Hangul_TCount) evaluated: TIndex <= Hangul_TCount yes Evaluation Count:107744 | yes Evaluation Count:1057 |
| 1057-107744 |
397 | return u1 + TIndex; executed: return u1 + TIndex; Execution Count:107744 | 107744 |
398 | } executed: } Execution Count:1057 | 1057 |
399 | } executed: } Execution Count:7254 | 7254 |
400 | | - |
401 | const unsigned short index = (u2 < 0x3100 ? (uc_ligature_trie[uc_ligature_trie[u2>>5] + (u2 & 0x1f)]) : (u2 < 0x12000 ? uc_ligature_trie[uc_ligature_trie[((u2 - 0x3100)>>8) + 0x188] + (u2 & 0xff)] : 0xffff)); evaluated: u2 < 0x3100 yes Evaluation Count:66618 | yes Evaluation Count:2940 |
| 2940-66618 |
402 | if (index == 0xffff) evaluated: index == 0xffff yes Evaluation Count:49204 | yes Evaluation Count:20354 |
| 20354-49204 |
403 | return 0; executed: return 0; Execution Count:49204 | 49204 |
404 | const unsigned short *ligatures = uc_ligature_map+index; | - |
405 | ushort length = *ligatures++; | - |
406 | if (QChar::requiresSurrogates(u1)) { evaluated: QChar::requiresSurrogates(u1) yes Evaluation Count:50 | yes Evaluation Count:20304 |
| 50-20304 |
407 | const UCS2SurrogatePair *data = reinterpret_cast<const UCS2SurrogatePair *>(ligatures); | - |
408 | const UCS2SurrogatePair *r = qBinaryFind(data, data + length, u1); | - |
409 | if (r != data + length) partially evaluated: r != data + length yes Evaluation Count:50 | no Evaluation Count:0 |
| 0-50 |
410 | return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2); executed: return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2); Execution Count:50 | 50 |
411 | } else { | 0 |
412 | const UCS2Pair *data = reinterpret_cast<const UCS2Pair *>(ligatures); | - |
413 | const UCS2Pair *r = qBinaryFind(data, data + length, ushort(u1)); | - |
414 | if (r != data + length) evaluated: r != data + length yes Evaluation Count:17203 | yes Evaluation Count:3101 |
| 3101-17203 |
415 | return r->u2; executed: return r->u2; Execution Count:17203 | 17203 |
416 | } executed: } Execution Count:3101 | 3101 |
417 | | - |
418 | return 0; executed: return 0; Execution Count:3101 | 3101 |
419 | } | - |
420 | | - |
421 | static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) | - |
422 | { | - |
423 | QString &s = *str; | - |
424 | | - |
425 | if (from < 0 || s.length() - from < 2) partially evaluated: from < 0 no Evaluation Count:0 | yes Evaluation Count:178342 |
evaluated: s.length() - from < 2 yes Evaluation Count:29255 | yes Evaluation Count:149087 |
| 0-178342 |
426 | return; executed: return; Execution Count:29255 | 29255 |
427 | | - |
428 | int starter = 0; | - |
429 | uint stcode = 0; | - |
430 | int next = -1; | - |
431 | int lastCombining = 0; | - |
432 | | - |
433 | int pos = from; | - |
434 | while (pos < s.length()) { evaluated: pos < s.length() yes Evaluation Count:463581 | yes Evaluation Count:149087 |
| 149087-463581 |
435 | int i = pos; | - |
436 | uint uc = s.at(pos).unicode(); | - |
437 | if (QChar(uc).isHighSurrogate() && pos < s.length()-1) { evaluated: QChar(uc).isHighSurrogate() yes Evaluation Count:6565 | yes Evaluation Count:457016 |
partially evaluated: pos < s.length()-1 yes Evaluation Count:6565 | no Evaluation Count:0 |
| 0-457016 |
438 | ushort low = s.at(pos+1).unicode(); | - |
439 | if (QChar(low).isLowSurrogate()) { partially evaluated: QChar(low).isLowSurrogate() yes Evaluation Count:6565 | no Evaluation Count:0 |
| 0-6565 |
440 | uc = QChar::surrogateToUcs4(uc, low); | - |
441 | ++pos; | - |
442 | } executed: } Execution Count:6565 | 6565 |
443 | } executed: } Execution Count:6565 | 6565 |
444 | | - |
445 | const QUnicodeTables::Properties *p = qGetProp(uc); | - |
446 | if (p->unicodeVersion > version) { evaluated: p->unicodeVersion > version yes Evaluation Count:1 | yes Evaluation Count:463580 |
| 1-463580 |
447 | starter = -1; | - |
448 | next = -1; | - |
449 | lastCombining = 255; | - |
450 | ++pos; | - |
451 | continue; executed: continue; Execution Count:1 | 1 |
452 | } | - |
453 | | - |
454 | int combining = p->combiningClass; | - |
455 | if (i == next || combining > lastCombining) { evaluated: i == next yes Evaluation Count:260655 | yes Evaluation Count:202925 |
evaluated: combining > lastCombining yes Evaluation Count:29557 | yes Evaluation Count:173368 |
| 29557-260655 |
456 | qt_noop(); | - |
457 | | - |
458 | uint ligature = ligatureHelper(stcode, uc); | - |
459 | if (ligature) { evaluated: ligature yes Evaluation Count:237907 | yes Evaluation Count:52305 |
| 52305-237907 |
460 | stcode = ligature; | - |
461 | QChar *d = s.data(); | - |
462 | | - |
463 | if (QChar::requiresSurrogates(ligature)) { evaluated: QChar::requiresSurrogates(ligature) yes Evaluation Count:50 | yes Evaluation Count:237857 |
| 50-237857 |
464 | d[starter] = QChar::highSurrogate(ligature); | - |
465 | d[starter + 1] = QChar::lowSurrogate(ligature); | - |
466 | s.remove(i, 2); | - |
467 | } else { executed: } Execution Count:50 | 50 |
468 | d[starter] = ligature; | - |
469 | s.remove(i, 1); | - |
470 | } executed: } Execution Count:237857 | 237857 |
471 | continue; executed: continue; Execution Count:237907 | 237907 |
472 | } | - |
473 | } executed: } Execution Count:52305 | 52305 |
474 | if (combining == 0) { evaluated: combining == 0 yes Evaluation Count:174308 | yes Evaluation Count:51365 |
| 51365-174308 |
475 | starter = i; | - |
476 | stcode = uc; | - |
477 | next = pos + 1; | - |
478 | } executed: } Execution Count:174308 | 174308 |
479 | lastCombining = combining; | - |
480 | | - |
481 | ++pos; | - |
482 | } executed: } Execution Count:225673 | 225673 |
483 | } executed: } Execution Count:149087 | 149087 |
484 | | - |
485 | | - |
486 | static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, int from) | - |
487 | { | - |
488 | QString &s = *str; | - |
489 | const int l = s.length()-1; | - |
490 | | - |
491 | uint u1, u2; | - |
492 | ushort c1, c2; | - |
493 | | - |
494 | int pos = from; | - |
495 | while (pos < l) { evaluated: pos < l yes Evaluation Count:325085 | yes Evaluation Count:325284 |
| 325085-325284 |
496 | int p2 = pos+1; | - |
497 | u1 = s.at(pos).unicode(); | - |
498 | if (QChar(u1).isHighSurrogate()) { evaluated: QChar(u1).isHighSurrogate() yes Evaluation Count:10720 | yes Evaluation Count:314365 |
| 10720-314365 |
499 | ushort low = s.at(p2).unicode(); | - |
500 | if (QChar(low).isLowSurrogate()) { partially evaluated: QChar(low).isLowSurrogate() yes Evaluation Count:10720 | no Evaluation Count:0 |
| 0-10720 |
501 | u1 = QChar::surrogateToUcs4(u1, low); | - |
502 | if (p2 >= l) evaluated: p2 >= l yes Evaluation Count:9868 | yes Evaluation Count:852 |
| 852-9868 |
503 | break; executed: break; Execution Count:9868 | 9868 |
504 | ++p2; | - |
505 | } executed: } Execution Count:852 | 852 |
506 | } executed: } Execution Count:852 | 852 |
507 | c1 = 0; | - |
508 | | - |
509 | advance: code before this statement executed: advance: Execution Count:315217 | 315217 |
510 | u2 = s.at(p2).unicode(); | - |
511 | if (QChar(u2).isHighSurrogate() && p2 < l) { evaluated: QChar(u2).isHighSurrogate() yes Evaluation Count:3416 | yes Evaluation Count:448135 |
partially evaluated: p2 < l yes Evaluation Count:3416 | no Evaluation Count:0 |
| 0-448135 |
512 | ushort low = s.at(p2+1).unicode(); | - |
513 | if (QChar(low).isLowSurrogate()) { partially evaluated: QChar(low).isLowSurrogate() yes Evaluation Count:3416 | no Evaluation Count:0 |
| 0-3416 |
514 | u2 = QChar::surrogateToUcs4(u2, low); | - |
515 | ++p2; | - |
516 | } executed: } Execution Count:3416 | 3416 |
517 | } executed: } Execution Count:3416 | 3416 |
518 | | - |
519 | c2 = 0; | - |
520 | { | - |
521 | const QUnicodeTables::Properties *p = qGetProp(u2); | - |
522 | if (p->unicodeVersion <= version) evaluated: p->unicodeVersion <= version yes Evaluation Count:451550 | yes Evaluation Count:1 |
| 1-451550 |
523 | c2 = p->combiningClass; executed: c2 = p->combiningClass; Execution Count:451550 | 451550 |
524 | } | - |
525 | if (c2 == 0) { evaluated: c2 == 0 yes Evaluation Count:270223 | yes Evaluation Count:181328 |
| 181328-270223 |
526 | pos = p2+1; | - |
527 | continue; executed: continue; Execution Count:270223 | 270223 |
528 | } | - |
529 | | - |
530 | if (c1 == 0) { evaluated: c1 == 0 yes Evaluation Count:73638 | yes Evaluation Count:107690 |
| 73638-107690 |
531 | const QUnicodeTables::Properties *p = qGetProp(u1); | - |
532 | if (p->unicodeVersion <= version) partially evaluated: p->unicodeVersion <= version yes Evaluation Count:73638 | no Evaluation Count:0 |
| 0-73638 |
533 | c1 = p->combiningClass; executed: c1 = p->combiningClass; Execution Count:73638 | 73638 |
534 | } executed: } Execution Count:73638 | 73638 |
535 | | - |
536 | if (c1 > c2) { evaluated: c1 > c2 yes Evaluation Count:23588 | yes Evaluation Count:157740 |
| 23588-157740 |
537 | QChar *uc = s.data(); | - |
538 | int p = pos; | - |
539 | | - |
540 | if (!QChar::requiresSurrogates(u2)) { evaluated: !QChar::requiresSurrogates(u2) yes Evaluation Count:23268 | yes Evaluation Count:320 |
| 320-23268 |
541 | uc[p++] = u2; | - |
542 | } else { executed: } Execution Count:23268 | 23268 |
543 | uc[p++] = QChar::highSurrogate(u2); | - |
544 | uc[p++] = QChar::lowSurrogate(u2); | - |
545 | } executed: } Execution Count:320 | 320 |
546 | if (!QChar::requiresSurrogates(u1)) { evaluated: !QChar::requiresSurrogates(u1) yes Evaluation Count:23352 | yes Evaluation Count:236 |
| 236-23352 |
547 | uc[p++] = u1; | - |
548 | } else { executed: } Execution Count:23352 | 23352 |
549 | uc[p++] = QChar::highSurrogate(u1); | - |
550 | uc[p++] = QChar::lowSurrogate(u1); | - |
551 | } executed: } Execution Count:236 | 236 |
552 | if (pos > 0) evaluated: pos > 0 yes Evaluation Count:23576 | yes Evaluation Count:12 |
| 12-23576 |
553 | --pos; executed: --pos; Execution Count:23576 | 23576 |
554 | if (pos > 0 && s.at(pos).isLowSurrogate()) evaluated: pos > 0 yes Evaluation Count:12876 | yes Evaluation Count:10712 |
evaluated: s.at(pos).isLowSurrogate() yes Evaluation Count:452 | yes Evaluation Count:12424 |
| 452-12876 |
555 | --pos; executed: --pos; Execution Count:452 | 452 |
556 | } else { executed: } Execution Count:23588 | 23588 |
557 | ++pos; | - |
558 | if (QChar::requiresSurrogates(u1)) evaluated: QChar::requiresSurrogates(u1) yes Evaluation Count:3192 | yes Evaluation Count:154548 |
| 3192-154548 |
559 | ++pos; executed: ++pos; Execution Count:3192 | 3192 |
560 | | - |
561 | u1 = u2; | - |
562 | c1 = c2; | - |
563 | p2 = pos + 1; | - |
564 | if (QChar::requiresSurrogates(u1)) evaluated: QChar::requiresSurrogates(u1) yes Evaluation Count:3016 | yes Evaluation Count:154724 |
| 3016-154724 |
565 | ++p2; executed: ++p2; Execution Count:3016 | 3016 |
566 | if (p2 > l) evaluated: p2 > l yes Evaluation Count:21406 | yes Evaluation Count:136334 |
| 21406-136334 |
567 | break; executed: break; Execution Count:21406 | 21406 |
568 | | - |
569 | goto advance; executed: goto advance; Execution Count:136334 | 136334 |
570 | } | - |
571 | } | - |
572 | } executed: } Execution Count:356558 | 356558 |
573 | | - |
574 | | - |
575 | | - |
| | |