Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | int qFindString(const QChar *haystack, int haystackLen, int from, | - |
18 | const QChar *needle, int needleLen, Qt::CaseSensitivity cs); | - |
19 | int qFindStringBoyerMoore(const QChar *haystack, int haystackLen, int from, | - |
20 | const QChar *needle, int needleLen, Qt::CaseSensitivity cs); | - |
21 | static inline int qt_last_index_of(const QChar *haystack, int haystackLen, QChar needle, | - |
22 | int from, Qt::CaseSensitivity cs); | - |
23 | static inline int qt_string_count(const QChar *haystack, int haystackLen, | - |
24 | const QChar *needle, int needleLen, | - |
25 | Qt::CaseSensitivity cs); | - |
26 | static inline int qt_string_count(const QChar *haystack, int haystackLen, | - |
27 | QChar needle, Qt::CaseSensitivity cs); | - |
28 | static inline int qt_find_latin1_string(const QChar *hay, int size, QLatin1String needle, | - |
29 | int from, Qt::CaseSensitivity cs); | - |
30 | static inline bool qt_starts_with(const QChar *haystack, int haystackLen, | - |
31 | const QChar *needle, int needleLen, Qt::CaseSensitivity cs); | - |
32 | static inline bool qt_starts_with(const QChar *haystack, int haystackLen, | - |
33 | QLatin1String needle, Qt::CaseSensitivity cs); | - |
34 | static inline bool qt_ends_with(const QChar *haystack, int haystackLen, | - |
35 | const QChar *needle, int needleLen, Qt::CaseSensitivity cs); | - |
36 | static inline bool qt_ends_with(const QChar *haystack, int haystackLen, | - |
37 | QLatin1String needle, Qt::CaseSensitivity cs); | - |
38 | | - |
39 | | - |
40 | static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const ushort *be) | - |
41 | { | - |
42 | if (a == b) evaluated: a == b yes Evaluation Count:1049 | yes Evaluation Count:3726630 |
| 1049-3726630 |
43 | return (ae - be); executed: return (ae - be); Execution Count:1049 | 1049 |
44 | if (a == 0) partially evaluated: a == 0 no Evaluation Count:0 | yes Evaluation Count:3726630 |
| 0-3726630 |
45 | return 1; never executed: return 1; | 0 |
46 | if (b == 0) partially evaluated: b == 0 no Evaluation Count:0 | yes Evaluation Count:3726630 |
| 0-3726630 |
47 | return -1; never executed: return -1; | 0 |
48 | | - |
49 | const ushort *e = ae; | - |
50 | if (be - b < ae - a) evaluated: be - b < ae - a yes Evaluation Count:1170138 | yes Evaluation Count:2556492 |
| 1170138-2556492 |
51 | e = a + (be - b); executed: e = a + (be - b); Execution Count:1170138 | 1170138 |
52 | | - |
53 | uint alast = 0; | - |
54 | uint blast = 0; | - |
55 | while (a < e) { evaluated: a < e yes Evaluation Count:11418531 | yes Evaluation Count:289973 |
| 289973-11418531 |
56 | | - |
57 | | - |
58 | | - |
59 | int diff = foldCase(*a, alast) - foldCase(*b, blast); | - |
60 | if ((diff)) evaluated: (diff) yes Evaluation Count:3436657 | yes Evaluation Count:7981874 |
| 3436657-7981874 |
61 | return diff; executed: return diff; Execution Count:3436657 | 3436657 |
62 | ++a; | - |
63 | ++b; | - |
64 | } executed: } Execution Count:7981874 | 7981874 |
65 | if (a == ae) { evaluated: a == ae yes Evaluation Count:284761 | yes Evaluation Count:5212 |
| 5212-284761 |
66 | if (b == be) evaluated: b == be yes Evaluation Count:279159 | yes Evaluation Count:5602 |
| 5602-279159 |
67 | return 0; executed: return 0; Execution Count:279159 | 279159 |
68 | return -1; executed: return -1; Execution Count:5602 | 5602 |
69 | } | - |
70 | return 1; executed: return 1; Execution Count:5212 | 5212 |
71 | } | - |
72 | | - |
73 | | - |
74 | static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b, const uchar *be) | - |
75 | { | - |
76 | if (a == 0) { partially evaluated: a == 0 no Evaluation Count:0 | yes Evaluation Count:6136 |
| 0-6136 |
77 | if (b == 0) | 0 |
78 | return 0; never executed: return 0; | 0 |
79 | return 1; never executed: return 1; | 0 |
80 | } | - |
81 | if (b == 0) partially evaluated: b == 0 no Evaluation Count:0 | yes Evaluation Count:6136 |
| 0-6136 |
82 | return -1; never executed: return -1; | 0 |
83 | | - |
84 | const ushort *e = ae; | - |
85 | if (be - b < ae - a) evaluated: be - b < ae - a yes Evaluation Count:1848 | yes Evaluation Count:4288 |
| 1848-4288 |
86 | e = a + (be - b); executed: e = a + (be - b); Execution Count:1848 | 1848 |
87 | | - |
88 | while (a < e) { evaluated: a < e yes Evaluation Count:28325 | yes Evaluation Count:1573 |
| 1573-28325 |
89 | int diff = foldCase(*a) - foldCase(*b); | - |
90 | if ((diff)) evaluated: (diff) yes Evaluation Count:4563 | yes Evaluation Count:23762 |
| 4563-23762 |
91 | return diff; executed: return diff; Execution Count:4563 | 4563 |
92 | ++a; | - |
93 | ++b; | - |
94 | } executed: } Execution Count:23762 | 23762 |
95 | if (a == ae) { evaluated: a == ae yes Evaluation Count:1470 | yes Evaluation Count:103 |
| 103-1470 |
96 | if (b == be) evaluated: b == be yes Evaluation Count:1376 | yes Evaluation Count:94 |
| 94-1376 |
97 | return 0; executed: return 0; Execution Count:1376 | 1376 |
98 | return -1; executed: return -1; Execution Count:94 | 94 |
99 | } | - |
100 | return 1; executed: return 1; Execution Count:103 | 103 |
101 | } | - |
102 | | - |
103 | | - |
104 | static int ucstrncmp(const QChar *a, const QChar *b, int l) | - |
105 | { | - |
106 | while (l-- && *a == *b) evaluated: l-- yes Evaluation Count:3282005 | yes Evaluation Count:61774 |
evaluated: *a == *b yes Evaluation Count:2781761 | yes Evaluation Count:500298 |
| 61774-3282005 |
107 | a++,b++; executed: a++,b++; Execution Count:2781728 | 2781728 |
108 | if (l==-1) evaluated: l==-1 yes Evaluation Count:61774 | yes Evaluation Count:500280 |
| 61774-500280 |
109 | return 0; executed: return 0; Execution Count:61774 | 61774 |
110 | return a->unicode() - b->unicode(); executed: return a->unicode() - b->unicode(); Execution Count:500279 | 500279 |
111 | } | - |
112 | | - |
113 | | - |
114 | static int ucstrcmp(const QChar *a, int alen, const QChar *b, int blen) | - |
115 | { | - |
116 | if (a == b && alen == blen) evaluated: a == b yes Evaluation Count:9711 | yes Evaluation Count:558799 |
evaluated: alen == blen yes Evaluation Count:9710 | yes Evaluation Count:1 |
| 1-558799 |
117 | return 0; executed: return 0; Execution Count:9710 | 9710 |
118 | int l = qMin(alen, blen); | - |
119 | int cmp = ucstrncmp(a, b, l); | - |
120 | return cmp ? cmp : (alen-blen); executed: return cmp ? cmp : (alen-blen); Execution Count:558862 | 558862 |
121 | } | - |
122 | | - |
123 | | - |
124 | static int ucstrnicmp(const ushort *a, const ushort *b, int l) | - |
125 | { | - |
126 | return ucstricmp(a, a + l, b, b + l); executed: return ucstricmp(a, a + l, b, b + l); Execution Count:1157 | 1157 |
127 | } | - |
128 | static bool qMemEquals(const quint16 *a, const quint16 *b, int length) | - |
129 | { | - |
130 | if (a == b || !length) evaluated: a == b yes Evaluation Count:570467 | yes Evaluation Count:1703185 |
evaluated: !length yes Evaluation Count:27820 | yes Evaluation Count:1675377 |
| 27820-1703185 |
131 | return true; executed: return true; Execution Count:598287 | 598287 |
132 | | - |
133 | register union { | - |
134 | const quint16 *w; | - |
135 | const quint32 *d; | - |
136 | quintptr value; | - |
137 | } sa, sb; | - |
138 | sa.w = a; | - |
139 | sb.w = b; | - |
140 | | - |
141 | | - |
142 | if ((sa.value & 2) == (sb.value & 2)) { evaluated: (sa.value & 2) == (sb.value & 2) yes Evaluation Count:1581597 | yes Evaluation Count:93775 |
| 93775-1581597 |
143 | | - |
144 | if (sa.value & 2) { evaluated: sa.value & 2 yes Evaluation Count:7120 | yes Evaluation Count:1574476 |
| 7120-1574476 |
145 | | - |
146 | | - |
147 | if (*sa.w != *sb.w) evaluated: *sa.w != *sb.w yes Evaluation Count:6662 | yes Evaluation Count:458 |
| 458-6662 |
148 | return false; executed: return false; Execution Count:6662 | 6662 |
149 | --length; | - |
150 | ++sa.w; | - |
151 | ++sb.w; | - |
152 | | - |
153 | | - |
154 | } executed: } Execution Count:458 | 458 |
155 | | - |
156 | | - |
157 | | - |
158 | register const quint32 *e = sa.d + (length >> 1); | - |
159 | for ( ; sa.d != e; ++sa.d, ++sb.d) { evaluated: sa.d != e yes Evaluation Count:13198465 | yes Evaluation Count:1456167 |
| 1456167-13198465 |
160 | if (*sa.d != *sb.d) evaluated: *sa.d != *sb.d yes Evaluation Count:118771 | yes Evaluation Count:13079704 |
| 118771-13079704 |
161 | return false; executed: return false; Execution Count:118769 | 118769 |
162 | } executed: } Execution Count:13079710 | 13079710 |
163 | | - |
164 | | - |
165 | return (length & 1) ? *sa.w == *sb.w : true; executed: return (length & 1) ? *sa.w == *sb.w : true; Execution Count:1456166 | 1456166 |
166 | } else { | - |
167 | | - |
168 | register const quint16 *e = sa.w + length; | - |
169 | for ( ; sa.w != e; ++sa.w, ++sb.w) { evaluated: sa.w != e yes Evaluation Count:433343 | yes Evaluation Count:42385 |
| 42385-433343 |
170 | if (*sa.w != *sb.w) evaluated: *sa.w != *sb.w yes Evaluation Count:51390 | yes Evaluation Count:381953 |
| 51390-381953 |
171 | return false; executed: return false; Execution Count:51390 | 51390 |
172 | } executed: } Execution Count:381953 | 381953 |
173 | } executed: } Execution Count:42385 | 42385 |
174 | return true; executed: return true; Execution Count:42385 | 42385 |
175 | } | - |
176 | static int findChar(const QChar *str, int len, QChar ch, int from, | - |
177 | Qt::CaseSensitivity cs) | - |
178 | { | - |
179 | const ushort *s = (const ushort *)str; | - |
180 | ushort c = ch.unicode(); | - |
181 | if (from < 0) evaluated: from < 0 yes Evaluation Count:1 | yes Evaluation Count:285536 |
| 1-285536 |
182 | from = qMax(from + len, 0); executed: from = qMax(from + len, 0); Execution Count:1 | 1 |
183 | if (from < len) { evaluated: from < len yes Evaluation Count:282857 | yes Evaluation Count:2688 |
| 2688-282857 |
184 | const ushort *n = s + from - 1; | - |
185 | const ushort *e = s + len; | - |
186 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:282394 | yes Evaluation Count:459 |
| 459-282394 |
187 | while (++n != e) evaluated: ++n != e yes Evaluation Count:2182609 | yes Evaluation Count:156907 |
| 156907-2182609 |
188 | if (*n == c) evaluated: *n == c yes Evaluation Count:125520 | yes Evaluation Count:2057167 |
| 125520-2057167 |
189 | return n - s; executed: return n - s; Execution Count:125520 | 125520 |
190 | } else { executed: } Execution Count:156903 | 156903 |
191 | c = foldCase(c); | - |
192 | while (++n != e) evaluated: ++n != e yes Evaluation Count:797 | yes Evaluation Count:125 |
| 125-797 |
193 | if (foldCase(*n) == c) evaluated: foldCase(*n) == c yes Evaluation Count:334 | yes Evaluation Count:463 |
| 334-463 |
194 | return n - s; executed: return n - s; Execution Count:334 | 334 |
195 | } executed: } Execution Count:125 | 125 |
196 | } | - |
197 | return -1; executed: return -1; Execution Count:159717 | 159717 |
198 | } | - |
199 | | - |
200 | | - |
201 | | - |
202 | | - |
203 | | - |
204 | | - |
205 | inline bool qIsUpper(char ch) | - |
206 | { | - |
207 | return ch >= 'A' && ch <= 'Z'; executed: return ch >= 'A' && ch <= 'Z'; Execution Count:120486 | 120486 |
208 | } | - |
209 | | - |
210 | inline bool qIsDigit(char ch) | - |
211 | { | - |
212 | return ch >= '0' && ch <= '9'; executed: return ch >= '0' && ch <= '9'; Execution Count:67327 | 67327 |
213 | } | - |
214 | | - |
215 | inline char qToLower(char ch) | - |
216 | { | - |
217 | if (ch >= 'A' && ch <= 'Z') partially evaluated: ch >= 'A' yes Evaluation Count:120486 | no Evaluation Count:0 |
evaluated: ch <= 'Z' yes Evaluation Count:4992 | yes Evaluation Count:115494 |
| 0-120486 |
218 | return ch - 'A' + 'a'; executed: return ch - 'A' + 'a'; Execution Count:4992 | 4992 |
219 | else | - |
220 | return ch; executed: return ch; Execution Count:115494 | 115494 |
221 | } | - |
222 | | - |
223 | | - |
224 | const QString::Null QString::null = { }; | - |
225 | int QString::toUcs4_helper(const ushort *uc, int length, uint *out) | - |
226 | { | - |
227 | int i = 0; | - |
228 | for (; i < length; ++i) { evaluated: i < length yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
229 | uint u = uc[i]; | - |
230 | if (QChar::isHighSurrogate(u) && i + 1 < length) { partially evaluated: QChar::isHighSurrogate(u) no Evaluation Count:0 | yes Evaluation Count:5 |
never evaluated: i + 1 < length | 0-5 |
231 | ushort low = uc[i+1]; | - |
232 | if (QChar::isLowSurrogate(low)) { never evaluated: QChar::isLowSurrogate(low) | 0 |
233 | ++i; | - |
234 | u = QChar::surrogateToUcs4(u, low); | - |
235 | } | 0 |
236 | } | 0 |
237 | *out++ = u; | - |
238 | } executed: } Execution Count:5 | 5 |
239 | return i; executed: return i; Execution Count:1 | 1 |
240 | } | - |
241 | QString::QString(const QChar *unicode, int size) | - |
242 | { | - |
243 | if (!unicode) { evaluated: !unicode yes Evaluation Count:3041 | yes Evaluation Count:3814996 |
| 3041-3814996 |
244 | d = Data::sharedNull(); | - |
245 | } else { executed: } Execution Count:3041 | 3041 |
246 | if (size < 0) { evaluated: size < 0 yes Evaluation Count:100648 | yes Evaluation Count:3714330 |
| 100648-3714330 |
247 | size = 0; | - |
248 | while (unicode[size] != 0) evaluated: unicode[size] != 0 yes Evaluation Count:2157297 | yes Evaluation Count:100648 |
| 100648-2157297 |
249 | ++size; executed: ++size; Execution Count:2157297 | 2157297 |
250 | } executed: } Execution Count:100648 | 100648 |
251 | if (!size) { evaluated: !size yes Evaluation Count:215285 | yes Evaluation Count:3599731 |
| 215285-3599731 |
252 | d = Data::allocate(0); | - |
253 | } else { executed: } Execution Count:215276 | 215276 |
254 | d = Data::allocate(size + 1); | - |
255 | do { if (!(d)) qBadAlloc(); } while (0); partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:3599759 |
never executed: qBadAlloc(); executed: } Execution Count:3599783 partially evaluated: !(d) no Evaluation Count:0 | yes Evaluation Count:3599805 |
| 0-3599805 |
256 | d->size = size; | - |
257 | memcpy(d->data(), unicode, size * sizeof(QChar)); | - |
258 | d->data()[size] = '\0'; | - |
259 | } executed: } Execution Count:3599771 | 3599771 |
260 | } | - |
261 | } | - |
262 | | - |
263 | | - |
264 | | - |
265 | | - |
266 | | - |
267 | | - |
268 | | - |
269 | QString::QString(int size, QChar ch) | - |
270 | { | - |
271 | if (size <= 0) { evaluated: size <= 0 yes Evaluation Count:20756 | yes Evaluation Count:168287 |
| 20756-168287 |
272 | d = Data::allocate(0); | - |
273 | } else { executed: } Execution Count:20756 | 20756 |
274 | d = Data::allocate(size + 1); | - |
275 | do { if (!(d)) qBadAlloc(); } while (0); partially evaluated: !(d) no Evaluation Count:0 | yes Evaluation Count:168287 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:168287 |
never executed: qBadAlloc(); executed: } Execution Count:168287 | 0-168287 |
276 | d->size = size; | - |
277 | d->data()[size] = '\0'; | - |
278 | ushort *i = d->data() + size; | - |
279 | ushort *b = d->data(); | - |
280 | const ushort value = ch.unicode(); | - |
281 | while (i != b) evaluated: i != b yes Evaluation Count:341143 | yes Evaluation Count:168287 |
| 168287-341143 |
282 | *--i = value; executed: *--i = value; Execution Count:341143 | 341143 |
283 | } executed: } Execution Count:168287 | 168287 |
284 | } | - |
285 | | - |
286 | | - |
287 | | - |
288 | | - |
289 | | - |
290 | | - |
291 | | - |
292 | QString::QString(int size, Qt::Initialization) | - |
293 | { | - |
294 | d = Data::allocate(size + 1); | - |
295 | do { if (!(d)) qBadAlloc(); } while (0); partially evaluated: !(d) no Evaluation Count:0 | yes Evaluation Count:51660926 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:51660904 |
never executed: qBadAlloc(); executed: } Execution Count:51660914 | 0-51660926 |
296 | d->size = size; | - |
297 | d->data()[size] = '\0'; | - |
298 | } executed: } Execution Count:51660928 | 51660928 |
299 | QString::QString(QChar ch) | - |
300 | { | - |
301 | d = Data::allocate(2); | - |
302 | do { if (!(d)) qBadAlloc(); } while (0); partially evaluated: !(d) no Evaluation Count:0 | yes Evaluation Count:718604 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:718604 |
never executed: qBadAlloc(); executed: } Execution Count:718604 | 0-718604 |
303 | d->size = 1; | - |
304 | d->data()[0] = ch.unicode(); | - |
305 | d->data()[1] = '\0'; | - |
306 | } executed: } Execution Count:718604 | 718604 |
307 | void QString::resize(int size) | - |
308 | { | - |
309 | if (size < 0) evaluated: size < 0 yes Evaluation Count:9 | yes Evaluation Count:91730716 |
| 9-91730716 |
310 | size = 0; executed: size = 0; Execution Count:9 | 9 |
311 | | - |
312 | if (((d)->offset != sizeof(QStringData)) && !d->ref.isShared() && size < d->size) { evaluated: ((d)->offset != sizeof(QStringData)) yes Evaluation Count:2 | yes Evaluation Count:91730700 |
partially evaluated: !d->ref.isShared() yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: size < d->size yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-91730700 |
313 | d->size = size; | - |
314 | return; executed: return; Execution Count:2 | 2 |
315 | } | - |
316 | | - |
317 | if (size == 0 && !d->capacityReserved) { evaluated: size == 0 yes Evaluation Count:481180 | yes Evaluation Count:91249517 |
evaluated: !d->capacityReserved yes Evaluation Count:19913 | yes Evaluation Count:461267 |
| 19913-91249517 |
318 | Data *x = Data::allocate(0); | - |
319 | if (!d->ref.deref()) evaluated: !d->ref.deref() yes Evaluation Count:7619 | yes Evaluation Count:12294 |
| 7619-12294 |
320 | Data::deallocate(d); executed: Data::deallocate(d); Execution Count:7619 | 7619 |
321 | d = x; | - |
322 | } else { executed: } Execution Count:19913 | 19913 |
323 | if (d->ref.isShared() || uint(size) + 1u > d->alloc evaluated: d->ref.isShared() yes Evaluation Count:394975 | yes Evaluation Count:91315867 |
evaluated: uint(size) + 1u > d->alloc yes Evaluation Count:395279 | yes Evaluation Count:90920665 |
| 394975-91315867 |
324 | || (!d->capacityReserved && size < d->size evaluated: !d->capacityReserved yes Evaluation Count:90176811 | yes Evaluation Count:743901 |
evaluated: size < d->size yes Evaluation Count:48837770 | yes Evaluation Count:41339036 |
| 743901-90176811 |
325 | && uint(size) + 1u < uint(d->alloc >> 1))) evaluated: uint(size) + 1u < uint(d->alloc >> 1) yes Evaluation Count:92475 | yes Evaluation Count:48745298 |
| 92475-48745298 |
326 | reallocData(uint(size) + 1u, true); executed: reallocData(uint(size) + 1u, true); Execution Count:882729 | 882729 |
327 | if (d->alloc) { partially evaluated: d->alloc yes Evaluation Count:91710859 | no Evaluation Count:0 |
| 0-91710859 |
328 | d->size = size; | - |
329 | d->data()[size] = '\0'; | - |
330 | } executed: } Execution Count:91710866 | 91710866 |
331 | } executed: } Execution Count:91710881 | 91710881 |
332 | } | - |
333 | void QString::reallocData(uint alloc, bool grow) | - |
334 | { | - |
335 | if (grow) evaluated: grow yes Evaluation Count:2634415 | yes Evaluation Count:588402 |
| 588402-2634415 |
336 | alloc = qAllocMore(alloc * sizeof(QChar), sizeof(Data)) / sizeof(QChar); executed: alloc = qAllocMore(alloc * sizeof(QChar), sizeof(Data)) / sizeof(QChar); Execution Count:2634415 | 2634415 |
337 | | - |
338 | if (d->ref.isShared() || ((d)->offset != sizeof(QStringData))) { evaluated: d->ref.isShared() yes Evaluation Count:1521369 | yes Evaluation Count:1701451 |
evaluated: ((d)->offset != sizeof(QStringData)) yes Evaluation Count:796 | yes Evaluation Count:1700663 |
| 796-1701451 |
339 | Data::AllocationOptions allocOptions(d->capacityReserved ? Data::CapacityReserved : 0); | - |
340 | Data *x = Data::allocate(alloc, allocOptions); | - |
341 | do { if (!(x)) qBadAlloc(); } while (0); partially evaluated: !(x) no Evaluation Count:0 | yes Evaluation Count:1522190 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1522169 |
never executed: qBadAlloc(); executed: } Execution Count:1522170 | 0-1522190 |
342 | x->size = qMin(int(alloc) - 1, d->size); | - |
343 | ::memcpy(x->data(), d->data(), x->size * sizeof(QChar)); | - |
344 | x->data()[x->size] = 0; | - |
345 | if (!d->ref.deref()) evaluated: !d->ref.deref() yes Evaluation Count:796 | yes Evaluation Count:1521403 |
| 796-1521403 |
346 | Data::deallocate(d); executed: Data::deallocate(d); Execution Count:796 | 796 |
347 | d = x; | - |
348 | } else { executed: } Execution Count:1522186 | 1522186 |
349 | Data *p = static_cast<Data *>(::realloc(d, sizeof(Data) + alloc * sizeof(QChar))); | - |
350 | do { if (!(p)) qBadAlloc(); } while (0); partially evaluated: !(p) no Evaluation Count:0 | yes Evaluation Count:1700667 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:1700664 |
never executed: qBadAlloc(); executed: } Execution Count:1700664 | 0-1700667 |
351 | d = p; | - |
352 | d->alloc = alloc; | - |
353 | d->offset = sizeof(QStringData); | - |
354 | } executed: } Execution Count:1700670 | 1700670 |
355 | } | - |
356 | | - |
357 | void QString::expand(int i) | - |
358 | { | - |
359 | int sz = d->size; | - |
360 | resize(qMax(i + 1, sz)); | - |
361 | if (d->size - 1 > sz) { evaluated: d->size - 1 > sz yes Evaluation Count:167151 | yes Evaluation Count:530180 |
| 167151-530180 |
362 | ushort *n = d->data() + d->size - 1; | - |
363 | ushort *e = d->data() + sz; | - |
364 | while (n != e) evaluated: n != e yes Evaluation Count:1384177 | yes Evaluation Count:167151 |
| 167151-1384177 |
365 | * --n = ' '; executed: * --n = ' '; Execution Count:1384177 | 1384177 |
366 | } executed: } Execution Count:167151 | 167151 |
367 | } executed: } Execution Count:697331 | 697331 |
368 | QString &QString::operator=(const QString &other) | - |
369 | { | - |
370 | other.d->ref.ref(); | - |
371 | if (!d->ref.deref()) evaluated: !d->ref.deref() yes Evaluation Count:748699 | yes Evaluation Count:4527777 |
| 748699-4527777 |
372 | Data::deallocate(d); executed: Data::deallocate(d); Execution Count:748699 | 748699 |
373 | d = other.d; | - |
374 | return *this; executed: return *this; Execution Count:5276974 | 5276974 |
375 | } | - |
376 | QString &QString::operator=(QChar ch) | - |
377 | { | - |
378 | return operator=(QString(ch)); executed: return operator=(QString(ch)); Execution Count:68832 | 68832 |
379 | } | - |
380 | QString &QString::insert(int i, QLatin1String str) | - |
381 | { | - |
382 | const uchar *s = (const uchar *)str.latin1(); | - |
383 | if (i < 0 || !s || !(*s)) partially evaluated: i < 0 no Evaluation Count:0 | yes Evaluation Count:820 |
evaluated: !s yes Evaluation Count:1 | yes Evaluation Count:819 |
evaluated: !(*s) yes Evaluation Count:1 | yes Evaluation Count:818 |
| 0-820 |
384 | return *this; executed: return *this; Execution Count:2 | 2 |
385 | | - |
386 | int len = str.size(); | - |
387 | expand(qMax(d->size, i) + len - 1); | - |
388 | | - |
389 | ::memmove(d->data() + i + len, d->data() + i, (d->size - i - len) * sizeof(QChar)); | - |
390 | for (int j = 0; j < len; ++j) evaluated: j < len yes Evaluation Count:4454 | yes Evaluation Count:818 |
| 818-4454 |
391 | d->data()[i + j] = s[j]; executed: d->data()[i + j] = s[j]; Execution Count:4454 | 4454 |
392 | return *this; executed: return *this; Execution Count:818 | 818 |
393 | } | - |
394 | QString& QString::insert(int i, const QChar *unicode, int size) | - |
395 | { | - |
396 | if (i < 0 || size <= 0) partially evaluated: i < 0 no Evaluation Count:0 | yes Evaluation Count:246354 |
evaluated: size <= 0 yes Evaluation Count:77381 | yes Evaluation Count:168973 |
| 0-246354 |
397 | return *this; executed: return *this; Execution Count:77381 | 77381 |
398 | | - |
399 | const ushort *s = (const ushort *)unicode; | - |
400 | if (s >= d->data() && s < d->data() + d->alloc) { evaluated: s >= d->data() yes Evaluation Count:117491 | yes Evaluation Count:51482 |
evaluated: s < d->data() + d->alloc yes Evaluation Count:3 | yes Evaluation Count:117488 |
| 3-117491 |
401 | | - |
402 | ushort *tmp = static_cast<ushort *>(::malloc(size * sizeof(QChar))); | - |
403 | do { if (!(tmp)) qBadAlloc(); } while (0); partially evaluated: !(tmp) no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:3 |
never executed: qBadAlloc(); executed: } Execution Count:3 | 0-3 |
404 | memcpy(tmp, s, size * sizeof(QChar)); | - |
405 | insert(i, reinterpret_cast<const QChar *>(tmp), size); | - |
406 | ::free(tmp); | - |
407 | return *this; executed: return *this; Execution Count:3 | 3 |
408 | } | - |
409 | | - |
410 | expand(qMax(d->size, i) + size - 1); | - |
411 | | - |
412 | ::memmove(d->data() + i + size, d->data() + i, (d->size - i - size) * sizeof(QChar)); | - |
413 | memcpy(d->data() + i, s, size * sizeof(QChar)); | - |
414 | return *this; executed: return *this; Execution Count:168970 | 168970 |
415 | } | - |
416 | QString& QString::insert(int i, QChar ch) | - |
417 | { | - |
418 | if (i < 0) partially evaluated: i < 0 no Evaluation Count:0 | yes Evaluation Count:518249 |
| 0-518249 |
419 | i += d->size; never executed: i += d->size; | 0 |
420 | if (i < 0) partially evaluated: i < 0 no Evaluation Count:0 | yes Evaluation Count:518249 |
| 0-518249 |
421 | return *this; never executed: return *this; | 0 |
422 | expand(qMax(i, d->size)); | - |
423 | ::memmove(d->data() + i + 1, d->data() + i, (d->size - i - 1) * sizeof(QChar)); | - |
424 | d->data()[i] = ch.unicode(); | - |
425 | return *this; executed: return *this; Execution Count:518248 | 518248 |
426 | } | - |
427 | QString &QString::append(const QString &str) | - |
428 | { | - |
429 | if (str.d != Data::sharedNull()) { evaluated: str.d != Data::sharedNull() yes Evaluation Count:43931838 | yes Evaluation Count:131053 |
| 131053-43931838 |
430 | if (d == Data::sharedNull()) { evaluated: d == Data::sharedNull() yes Evaluation Count:124001 | yes Evaluation Count:43807836 |
| 124001-43807836 |
431 | operator=(str); | - |
432 | } else { executed: } Execution Count:124001 | 124001 |
433 | if (d->ref.isShared() || uint(d->size + str.d->size) + 1u > d->alloc) evaluated: d->ref.isShared() yes Evaluation Count:160976 | yes Evaluation Count:43646861 |
evaluated: uint(d->size + str.d->size) + 1u > d->alloc yes Evaluation Count:467125 | yes Evaluation Count:43179751 |
| 160976-43646861 |
434 | reallocData(uint(d->size + str.d->size) + 1u, true); executed: reallocData(uint(d->size + str.d->size) + 1u, true); Execution Count:628101 | 628101 |
435 | memcpy(d->data() + d->size, str.d->data(), str.d->size * sizeof(QChar)); | - |
436 | d->size += str.d->size; | - |
437 | d->data()[d->size] = '\0'; | - |
438 | } executed: } Execution Count:43807855 | 43807855 |
439 | } | - |
440 | return *this; executed: return *this; Execution Count:44062909 | 44062909 |
441 | } | - |
442 | | - |
443 | | - |
444 | | - |
445 | | - |
446 | | - |
447 | | - |
448 | | - |
449 | QString &QString::append(const QChar *str, int len) | - |
450 | { | - |
451 | if (str && len > 0) { evaluated: str yes Evaluation Count:19671 | yes Evaluation Count:1 |
evaluated: len > 0 yes Evaluation Count:19669 | yes Evaluation Count:2 |
| 1-19671 |
452 | if (d->ref.isShared() || uint(d->size + len) + 1u > d->alloc) evaluated: d->ref.isShared() yes Evaluation Count:1 | yes Evaluation Count:19668 |
evaluated: uint(d->size + len) + 1u > d->alloc yes Evaluation Count:1 | yes Evaluation Count:19667 |
| 1-19668 |
453 | reallocData(uint(d->size + len) + 1u, true); executed: reallocData(uint(d->size + len) + 1u, true); Execution Count:2 | 2 |
454 | memcpy(d->data() + d->size, str, len * sizeof(QChar)); | - |
455 | d->size += len; | - |
456 | d->data()[d->size] = '\0'; | - |
457 | } executed: } Execution Count:19669 | 19669 |
458 | return *this; executed: return *this; Execution Count:19672 | 19672 |
459 | } | - |
460 | | - |
461 | | - |
462 | | - |
463 | | - |
464 | | - |
465 | | - |
466 | QString &QString::append(QLatin1String str) | - |
467 | { | - |
468 | const uchar *s = (const uchar *)str.latin1(); | - |
469 | if (s) { evaluated: s yes Evaluation Count:32277 | yes Evaluation Count:32 |
| 32-32277 |
470 | int len = str.size(); | - |
471 | if (d->ref.isShared() || uint(d->size + len) + 1u > d->alloc) evaluated: d->ref.isShared() yes Evaluation Count:3172 | yes Evaluation Count:29105 |
evaluated: uint(d->size + len) + 1u > d->alloc yes Evaluation Count:7971 | yes Evaluation Count:21134 |
| 3172-29105 |
472 | reallocData(uint(d->size + len) + 1u, true); executed: reallocData(uint(d->size + len) + 1u, true); Execution Count:11143 | 11143 |
473 | ushort *i = d->data() + d->size; | - |
474 | while ((*i++ = *s++)) evaluated: (*i++ = *s++) yes Evaluation Count:250240 | yes Evaluation Count:32292 |
| 32292-250240 |
475 | ; executed: ; Execution Count:250247 | 250247 |
476 | d->size += len; | - |
477 | } executed: } Execution Count:32293 | 32293 |
478 | return *this; executed: return *this; Execution Count:32325 | 32325 |
479 | } | - |
480 | QString &QString::append(QChar ch) | - |
481 | { | - |
482 | if (d->ref.isShared() || uint(d->size) + 2u > d->alloc) evaluated: d->ref.isShared() yes Evaluation Count:118764 | yes Evaluation Count:740220 |
evaluated: uint(d->size) + 2u > d->alloc yes Evaluation Count:285122 | yes Evaluation Count:455098 |
| 118764-740220 |
483 | reallocData(uint(d->size) + 2u, true); executed: reallocData(uint(d->size) + 2u, true); Execution Count:403886 | 403886 |
484 | d->data()[d->size++] = ch.unicode(); | - |
485 | d->data()[d->size] = '\0'; | - |
486 | return *this; executed: return *this; Execution Count:858984 | 858984 |
487 | } | - |
488 | QString &QString::remove(int pos, int len) | - |
489 | { | - |
490 | if (pos < 0) partially evaluated: pos < 0 no Evaluation Count:0 | yes Evaluation Count:250027 |
| 0-250027 |
491 | pos += d->size; never executed: pos += d->size; | 0 |
492 | if (pos < 0 || pos >= d->size) { partially evaluated: pos < 0 no Evaluation Count:0 | yes Evaluation Count:250027 |
partially evaluated: pos >= d->size no Evaluation Count:0 | yes Evaluation Count:250027 |
| 0-250027 |
493 | | - |
494 | } else if (len >= d->size - pos) { evaluated: len >= d->size - pos yes Evaluation Count:122323 | yes Evaluation Count:127704 |
| 0-127704 |
495 | resize(pos); | - |
496 | } else if (len > 0) { evaluated: len > 0 yes Evaluation Count:127703 | yes Evaluation Count:1 |
executed: } Execution Count:122323 | 1-127703 |
497 | detach(); | - |
498 | memmove(d->data() + pos, d->data() + pos + len, | - |
499 | (d->size - pos - len + 1) * sizeof(ushort)); | - |
500 | d->size -= len; | - |
501 | } executed: } Execution Count:127703 | 127703 |
502 | return *this; executed: return *this; Execution Count:250027 | 250027 |
503 | } | - |
504 | QString &QString::remove(const QString &str, Qt::CaseSensitivity cs) | - |
505 | { | - |
506 | if (str.d->size) { evaluated: str.d->size yes Evaluation Count:70 | yes Evaluation Count:4 |
| 4-70 |
507 | int i = 0; | - |
508 | while ((i = indexOf(str, i, cs)) != -1) evaluated: (i = indexOf(str, i, cs)) != -1 yes Evaluation Count:24 | yes Evaluation Count:70 |
| 24-70 |
509 | remove(i, str.d->size); executed: remove(i, str.d->size); Execution Count:24 | 24 |
510 | } executed: } Execution Count:70 | 70 |
511 | return *this; executed: return *this; Execution Count:74 | 74 |
512 | } | - |
513 | QString &QString::remove(QChar ch, Qt::CaseSensitivity cs) | - |
514 | { | - |
515 | int i = 0; | - |
516 | ushort c = ch.unicode(); | - |
517 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:5834 | yes Evaluation Count:11 |
| 11-5834 |
518 | while (i < d->size) evaluated: i < d->size yes Evaluation Count:29866 | yes Evaluation Count:5834 |
| 5834-29866 |
519 | if (d->data()[i] == ch) evaluated: d->data()[i] == ch yes Evaluation Count:1371 | yes Evaluation Count:28495 |
| 1371-28495 |
520 | remove(i, 1); executed: remove(i, 1); Execution Count:1371 | 1371 |
521 | else | - |
522 | i++; executed: i++; Execution Count:28495 | 28495 |
523 | } else { executed: } Execution Count:5834 | 5834 |
524 | c = foldCase(c); | - |
525 | while (i < d->size) evaluated: i < d->size yes Evaluation Count:36 | yes Evaluation Count:11 |
| 11-36 |
526 | if (foldCase(d->data()[i]) == c) evaluated: foldCase(d->data()[i]) == c yes Evaluation Count:14 | yes Evaluation Count:22 |
| 14-22 |
527 | remove(i, 1); executed: remove(i, 1); Execution Count:14 | 14 |
528 | else | - |
529 | i++; executed: i++; Execution Count:22 | 22 |
530 | } executed: } Execution Count:11 | 11 |
531 | return *this; executed: return *this; Execution Count:5845 | 5845 |
532 | } | - |
533 | QString &QString::replace(int pos, int len, const QString &after) | - |
534 | { | - |
535 | QString copy = after; | - |
536 | return replace(pos, len, copy.constData(), copy.length()); executed: return replace(pos, len, copy.constData(), copy.length()); Execution Count:2015276 | 2015276 |
537 | } | - |
538 | QString &QString::replace(int pos, int len, const QChar *unicode, int size) | - |
539 | { | - |
540 | if (pos < 0 || pos > d->size) partially evaluated: pos < 0 no Evaluation Count:0 | yes Evaluation Count:2197238 |
partially evaluated: pos > d->size no Evaluation Count:0 | yes Evaluation Count:2197238 |
| 0-2197238 |
541 | return *this; never executed: return *this; | 0 |
542 | if (len > d->size - pos) evaluated: len > d->size - pos yes Evaluation Count:25 | yes Evaluation Count:2197213 |
| 25-2197213 |
543 | len = d->size - pos; executed: len = d->size - pos; Execution Count:25 | 25 |
544 | | - |
545 | uint index = pos; | - |
546 | replace_helper(&index, 1, len, unicode, size); | - |
547 | return *this; executed: return *this; Execution Count:2197238 | 2197238 |
548 | } | - |
549 | QString &QString::replace(int pos, int len, QChar after) | - |
550 | { | - |
551 | return replace(pos, len, &after, 1); executed: return replace(pos, len, &after, 1); Execution Count:9 | 9 |
552 | } | - |
553 | QString &QString::replace(const QString &before, const QString &after, Qt::CaseSensitivity cs) | - |
554 | { | - |
555 | return replace(before.constData(), before.size(), after.constData(), after.size(), cs); executed: return replace(before.constData(), before.size(), after.constData(), after.size(), cs); Execution Count:157415 | 157415 |
556 | } | - |
557 | | - |
558 | | - |
559 | | - |
560 | | - |
561 | void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen) | - |
562 | { | - |
563 | | - |
564 | | - |
565 | QChar *afterBuffer = const_cast<QChar *>(after); | - |
566 | if (after >= reinterpret_cast<QChar *>(d->data()) && after < reinterpret_cast<QChar *>(d->data()) + d->size) { evaluated: after >= reinterpret_cast<QChar *>(d->data()) yes Evaluation Count:186183 | yes Evaluation Count:2012952 |
evaluated: after < reinterpret_cast<QChar *>(d->data()) + d->size yes Evaluation Count:21 | yes Evaluation Count:186162 |
| 21-2012952 |
567 | afterBuffer = static_cast<QChar *>(::malloc(alen*sizeof(QChar))); | - |
568 | do { if (!(afterBuffer)) qBadAlloc(); } while (0); partially evaluated: !(afterBuffer) no Evaluation Count:0 | yes Evaluation Count:21 |
never executed: qBadAlloc(); executed: } Execution Count:21 partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:21 |
| 0-21 |
569 | ::memcpy(afterBuffer, after, alen*sizeof(QChar)); | - |
570 | } executed: } Execution Count:21 | 21 |
571 | | - |
572 | try { | - |
573 | if (blen == alen) { evaluated: blen == alen yes Evaluation Count:2012781 | yes Evaluation Count:186354 |
| 186354-2012781 |
574 | | - |
575 | detach(); | - |
576 | for (int i = 0; i < nIndices; ++i) evaluated: i < nIndices yes Evaluation Count:2012787 | yes Evaluation Count:2012781 |
| 2012781-2012787 |
577 | memcpy(d->data() + indices[i], afterBuffer, alen * sizeof(QChar)); executed: memcpy(d->data() + indices[i], afterBuffer, alen * sizeof(QChar)); Execution Count:2012787 | 2012787 |
578 | } else if (alen < blen) { evaluated: alen < blen yes Evaluation Count:10629 | yes Evaluation Count:175725 |
executed: } Execution Count:2012781 | 10629-2012781 |
579 | | - |
580 | detach(); | - |
581 | uint to = indices[0]; | - |
582 | if (alen) evaluated: alen yes Evaluation Count:10599 | yes Evaluation Count:30 |
| 30-10599 |
583 | memcpy(d->data()+to, after, alen*sizeof(QChar)); executed: memcpy(d->data()+to, after, alen*sizeof(QChar)); Execution Count:10599 | 10599 |
584 | to += alen; | - |
585 | uint movestart = indices[0] + blen; | - |
586 | for (int i = 1; i < nIndices; ++i) { evaluated: i < nIndices yes Evaluation Count:337 | yes Evaluation Count:10629 |
| 337-10629 |
587 | int msize = indices[i] - movestart; | - |
588 | if (msize > 0) { evaluated: msize > 0 yes Evaluation Count:335 | yes Evaluation Count:2 |
| 2-335 |
589 | memmove(d->data() + to, d->data() + movestart, msize * sizeof(QChar)); | - |
590 | to += msize; | - |
591 | } executed: } Execution Count:335 | 335 |
592 | if (alen) { evaluated: alen yes Evaluation Count:332 | yes Evaluation Count:5 |
| 5-332 |
593 | memcpy(d->data() + to, afterBuffer, alen*sizeof(QChar)); | - |
594 | to += alen; | - |
595 | } executed: } Execution Count:332 | 332 |
596 | movestart = indices[i] + blen; | - |
597 | } executed: } Execution Count:337 | 337 |
598 | int msize = d->size - movestart; | - |
599 | if (msize > 0) evaluated: msize > 0 yes Evaluation Count:1189 | yes Evaluation Count:9440 |
| 1189-9440 |
600 | memmove(d->data() + to, d->data() + movestart, msize * sizeof(QChar)); executed: memmove(d->data() + to, d->data() + movestart, msize * sizeof(QChar)); Execution Count:1189 | 1189 |
601 | resize(d->size - nIndices*(blen-alen)); | - |
602 | } else { executed: } Execution Count:10629 | 10629 |
603 | | - |
604 | int adjust = nIndices*(alen-blen); | - |
605 | int newLen = d->size + adjust; | - |
606 | int moveend = d->size; | - |
607 | resize(newLen); | - |
608 | | - |
609 | while (nIndices) { evaluated: nIndices yes Evaluation Count:175835 | yes Evaluation Count:175725 |
| 175725-175835 |
610 | --nIndices; | - |
611 | int movestart = indices[nIndices] + blen; | - |
612 | int insertstart = indices[nIndices] + nIndices*(alen-blen); | - |
613 | int moveto = insertstart + alen; | - |
614 | memmove(d->data() + moveto, d->data() + movestart, | - |
615 | (moveend - movestart)*sizeof(QChar)); | - |
616 | memcpy(d->data() + insertstart, afterBuffer, alen*sizeof(QChar)); | - |
617 | moveend = movestart-blen; | - |
618 | } executed: } Execution Count:175835 | 175835 |
619 | } executed: } Execution Count:175725 | 175725 |
620 | } catch (const std::bad_alloc &) { | - |
621 | if (afterBuffer != after) never evaluated: afterBuffer != after | 0 |
622 | ::free(afterBuffer); never executed: ::free(afterBuffer); | 0 |
623 | throw; | 0 |
624 | } | - |
625 | if (afterBuffer != after) evaluated: afterBuffer != after yes Evaluation Count:21 | yes Evaluation Count:2199114 |
| 21-2199114 |
626 | ::free(afterBuffer); executed: ::free(afterBuffer); Execution Count:21 | 21 |
627 | } executed: } Execution Count:2199135 | 2199135 |
628 | QString &QString::replace(const QChar *before, int blen, | - |
629 | const QChar *after, int alen, | - |
630 | Qt::CaseSensitivity cs) | - |
631 | { | - |
632 | if (d->size == 0) { evaluated: d->size == 0 yes Evaluation Count:1188 | yes Evaluation Count:161939 |
| 1188-161939 |
633 | if (blen) evaluated: blen yes Evaluation Count:1182 | yes Evaluation Count:6 |
| 6-1182 |
634 | return *this; executed: return *this; Execution Count:1182 | 1182 |
635 | } else { executed: } Execution Count:6 | 6 |
636 | if (cs == Qt::CaseSensitive && before == after && blen == alen) evaluated: cs == Qt::CaseSensitive yes Evaluation Count:161924 | yes Evaluation Count:15 |
evaluated: before == after yes Evaluation Count:3 | yes Evaluation Count:161921 |
partially evaluated: blen == alen yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-161924 |
637 | return *this; executed: return *this; Execution Count:3 | 3 |
638 | } executed: } Execution Count:161936 | 161936 |
639 | if (alen == 0 && blen == 0) evaluated: alen == 0 yes Evaluation Count:20 | yes Evaluation Count:161922 |
evaluated: blen == 0 yes Evaluation Count:3 | yes Evaluation Count:17 |
| 3-161922 |
640 | return *this; executed: return *this; Execution Count:3 | 3 |
641 | | - |
642 | QStringMatcher matcher(before, blen, cs); | - |
643 | | - |
644 | int index = 0; | - |
645 | while (1) { partially evaluated: 1 yes Evaluation Count:161939 | no Evaluation Count:0 |
| 0-161939 |
646 | uint indices[1024]; | - |
647 | uint pos = 0; | - |
648 | while (pos < 1023) { partially evaluated: pos < 1023 yes Evaluation Count:164254 | no Evaluation Count:0 |
| 0-164254 |
649 | index = matcher.indexIn(*this, index); | - |
650 | if (index == -1) evaluated: index == -1 yes Evaluation Count:161939 | yes Evaluation Count:2315 |
| 2315-161939 |
651 | break; executed: break; Execution Count:161939 | 161939 |
652 | indices[pos++] = index; | - |
653 | index += blen; | - |
654 | | - |
655 | if (!blen) evaluated: !blen yes Evaluation Count:10 | yes Evaluation Count:2305 |
| 10-2305 |
656 | index++; executed: index++; Execution Count:10 | 10 |
657 | } executed: } Execution Count:2315 | 2315 |
658 | if (!pos) evaluated: !pos yes Evaluation Count:160062 | yes Evaluation Count:1877 |
| 1877-160062 |
659 | break; executed: break; Execution Count:160062 | 160062 |
660 | | - |
661 | replace_helper(indices, pos, blen, after, alen); | - |
662 | | - |
663 | if (index == -1) partially evaluated: index == -1 yes Evaluation Count:1877 | no Evaluation Count:0 |
| 0-1877 |
664 | break; executed: break; Execution Count:1877 | 1877 |
665 | | - |
666 | index += pos*(alen-blen); | - |
667 | } | 0 |
668 | | - |
669 | return *this; executed: return *this; Execution Count:161939 | 161939 |
670 | } | - |
671 | QString& QString::replace(QChar ch, const QString &after, Qt::CaseSensitivity cs) | - |
672 | { | - |
673 | if (after.d->size == 0) evaluated: after.d->size == 0 yes Evaluation Count:37 | yes Evaluation Count:1805 |
| 37-1805 |
674 | return remove(ch, cs); executed: return remove(ch, cs); Execution Count:37 | 37 |
675 | | - |
676 | if (after.d->size == 1) evaluated: after.d->size == 1 yes Evaluation Count:22 | yes Evaluation Count:1783 |
| 22-1783 |
677 | return replace(ch, after.d->data()[0], cs); executed: return replace(ch, after.d->data()[0], cs); Execution Count:22 | 22 |
678 | | - |
679 | if (d->size == 0) evaluated: d->size == 0 yes Evaluation Count:426 | yes Evaluation Count:1357 |
| 426-1357 |
680 | return *this; executed: return *this; Execution Count:426 | 426 |
681 | | - |
682 | ushort cc = (cs == Qt::CaseSensitive ? ch.unicode() : ch.toCaseFolded().unicode()); evaluated: cs == Qt::CaseSensitive yes Evaluation Count:1353 | yes Evaluation Count:4 |
| 4-1353 |
683 | | - |
684 | int index = 0; | - |
685 | while (1) { partially evaluated: 1 yes Evaluation Count:1377 | no Evaluation Count:0 |
| 0-1377 |
686 | uint indices[1024]; | - |
687 | uint pos = 0; | - |
688 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:1370 | yes Evaluation Count:7 |
| 7-1370 |
689 | while (pos < 1023 && index < d->size) { partially evaluated: pos < 1023 yes Evaluation Count:50967 | no Evaluation Count:0 |
evaluated: index < d->size yes Evaluation Count:49597 | yes Evaluation Count:1370 |
| 0-50967 |
690 | if (d->data()[index] == cc) evaluated: d->data()[index] == cc yes Evaluation Count:27 | yes Evaluation Count:49570 |
| 27-49570 |
691 | indices[pos++] = index; executed: indices[pos++] = index; Execution Count:27 | 27 |
692 | index++; | - |
693 | } executed: } Execution Count:49597 | 49597 |
694 | } else { executed: } Execution Count:1370 | 1370 |
695 | while (pos < 1023 && index < d->size) { partially evaluated: pos < 1023 yes Evaluation Count:29 | no Evaluation Count:0 |
evaluated: index < d->size yes Evaluation Count:22 | yes Evaluation Count:7 |
| 0-29 |
696 | if (QChar::toCaseFolded(d->data()[index]) == cc) evaluated: QChar::toCaseFolded(d->data()[index]) == cc yes Evaluation Count:8 | yes Evaluation Count:14 |
| 8-14 |
697 | indices[pos++] = index; executed: indices[pos++] = index; Execution Count:8 | 8 |
698 | index++; | - |
699 | } executed: } Execution Count:22 | 22 |
700 | } executed: } Execution Count:7 | 7 |
701 | if (!pos) evaluated: !pos yes Evaluation Count:1357 | yes Evaluation Count:20 |
| 20-1357 |
702 | break; executed: break; Execution Count:1357 | 1357 |
703 | | - |
704 | replace_helper(indices, pos, 1, after.constData(), after.d->size); | - |
705 | | - |
706 | if (index == -1) partially evaluated: index == -1 no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
707 | break; | 0 |
708 | | - |
709 | index += pos*(after.d->size - 1); | - |
710 | } executed: } Execution Count:20 | 20 |
711 | return *this; executed: return *this; Execution Count:1357 | 1357 |
712 | } | - |
713 | QString& QString::replace(QChar before, QChar after, Qt::CaseSensitivity cs) | - |
714 | { | - |
715 | ushort a = after.unicode(); | - |
716 | ushort b = before.unicode(); | - |
717 | if (d->size) { evaluated: d->size yes Evaluation Count:28986 | yes Evaluation Count:2 |
| 2-28986 |
718 | detach(); | - |
719 | ushort *i = d->data(); | - |
720 | const ushort *e = i + d->size; | - |
721 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:28964 | yes Evaluation Count:22 |
| 22-28964 |
722 | for (; i != e; ++i) evaluated: i != e yes Evaluation Count:64102 | yes Evaluation Count:28964 |
| 28964-64102 |
723 | if (*i == b) evaluated: *i == b yes Evaluation Count:681 | yes Evaluation Count:63421 |
| 681-63421 |
724 | *i = a; executed: *i = a; Execution Count:681 | 681 |
725 | } else { executed: } Execution Count:28964 | 28964 |
726 | b = foldCase(b); | - |
727 | for (; i != e; ++i) evaluated: i != e yes Evaluation Count:58 | yes Evaluation Count:22 |
| 22-58 |
728 | if (foldCase(*i) == b) evaluated: foldCase(*i) == b yes Evaluation Count:30 | yes Evaluation Count:28 |
| 28-30 |
729 | *i = a; executed: *i = a; Execution Count:30 | 30 |
730 | } executed: } Execution Count:22 | 22 |
731 | } | - |
732 | return *this; executed: return *this; Execution Count:28988 | 28988 |
733 | } | - |
734 | QString &QString::replace(QLatin1String before, QLatin1String after, Qt::CaseSensitivity cs) | - |
735 | { | - |
736 | int alen = after.size(); | - |
737 | QVarLengthArray<ushort> a(alen); | - |
738 | for (int i = 0; i < alen; ++i) evaluated: i < alen yes Evaluation Count:959 | yes Evaluation Count:328 |
| 328-959 |
739 | a[i] = (uchar)after.latin1()[i]; executed: a[i] = (uchar)after.latin1()[i]; Execution Count:959 | 959 |
740 | int blen = before.size(); | - |
741 | QVarLengthArray<ushort> b(blen); | - |
742 | for (int i = 0; i < blen; ++i) evaluated: i < blen yes Evaluation Count:1870 | yes Evaluation Count:328 |
| 328-1870 |
743 | b[i] = (uchar)before.latin1()[i]; executed: b[i] = (uchar)before.latin1()[i]; Execution Count:1870 | 1870 |
744 | return replace((const QChar *)b.data(), blen, (const QChar *)a.data(), alen, cs); executed: return replace((const QChar *)b.data(), blen, (const QChar *)a.data(), alen, cs); Execution Count:328 | 328 |
745 | } | - |
746 | QString &QString::replace(QLatin1String before, const QString &after, Qt::CaseSensitivity cs) | - |
747 | { | - |
748 | int blen = before.size(); | - |
749 | QVarLengthArray<ushort> b(blen); | - |
750 | for (int i = 0; i < blen; ++i) evaluated: i < blen yes Evaluation Count:258 | yes Evaluation Count:129 |
| 129-258 |
751 | b[i] = (uchar)before.latin1()[i]; executed: b[i] = (uchar)before.latin1()[i]; Execution Count:258 | 258 |
752 | return replace((const QChar *)b.data(), blen, after.constData(), after.d->size, cs); executed: return replace((const QChar *)b.data(), blen, after.constData(), after.d->size, cs); Execution Count:129 | 129 |
753 | } | - |
754 | QString &QString::replace(const QString &before, QLatin1String after, Qt::CaseSensitivity cs) | - |
755 | { | - |
756 | int alen = after.size(); | - |
757 | QVarLengthArray<ushort> a(alen); | - |
758 | for (int i = 0; i < alen; ++i) never evaluated: i < alen | 0 |
759 | a[i] = (uchar)after.latin1()[i]; never executed: a[i] = (uchar)after.latin1()[i]; | 0 |
760 | return replace(before.constData(), before.d->size, (const QChar *)a.data(), alen, cs); never executed: return replace(before.constData(), before.d->size, (const QChar *)a.data(), alen, cs); | 0 |
761 | } | - |
762 | QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs) | - |
763 | { | - |
764 | int alen = after.size(); | - |
765 | QVarLengthArray<ushort> a(alen); | - |
766 | for (int i = 0; i < alen; ++i) evaluated: i < alen yes Evaluation Count:14111 | yes Evaluation Count:5255 |
| 5255-14111 |
767 | a[i] = (uchar)after.latin1()[i]; executed: a[i] = (uchar)after.latin1()[i]; Execution Count:14111 | 14111 |
768 | return replace(&c, 1, (const QChar *)a.data(), alen, cs); executed: return replace(&c, 1, (const QChar *)a.data(), alen, cs); Execution Count:5255 | 5255 |
769 | } | - |
770 | bool operator==(const QString &s1, const QString &s2) | - |
771 | { | - |
772 | if (s1.d->size != s2.d->size) evaluated: s1.d->size != s2.d->size yes Evaluation Count:297941 | yes Evaluation Count:2006472 |
| 297941-2006472 |
773 | return false; executed: return false; Execution Count:297941 | 297941 |
774 | | - |
775 | return qMemEquals(s1.d->data(), s2.d->data(), s1.d->size); executed: return qMemEquals(s1.d->data(), s2.d->data(), s1.d->size); Execution Count:2006467 | 2006467 |
776 | } | - |
777 | | - |
778 | | - |
779 | | - |
780 | | - |
781 | bool QString::operator==(QLatin1String other) const | - |
782 | { | - |
783 | if (d->size != other.size()) evaluated: d->size != other.size() yes Evaluation Count:158047 | yes Evaluation Count:69396 |
| 69396-158047 |
784 | return false; executed: return false; Execution Count:158047 | 158047 |
785 | | - |
786 | if (!other.size()) evaluated: !other.size() yes Evaluation Count:7 | yes Evaluation Count:69390 |
| 7-69390 |
787 | return isEmpty(); executed: return isEmpty(); Execution Count:7 | 7 |
788 | | - |
789 | const ushort *uc = d->data(); | - |
790 | const ushort *e = uc + d->size; | - |
791 | const uchar *c = (uchar *)other.latin1(); | - |
792 | | - |
793 | while (uc < e) { evaluated: uc < e yes Evaluation Count:371720 | yes Evaluation Count:54877 |
| 54877-371720 |
794 | if (*uc != *c) evaluated: *uc != *c yes Evaluation Count:14526 | yes Evaluation Count:357199 |
| 14526-357199 |
795 | return false; executed: return false; Execution Count:14526 | 14526 |
796 | ++uc; | - |
797 | ++c; | - |
798 | } executed: } Execution Count:357199 | 357199 |
799 | return true; executed: return true; Execution Count:54877 | 54877 |
800 | } | - |
801 | bool operator<(const QString &s1, const QString &s2) | - |
802 | { | - |
803 | return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0; executed: return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0; Execution Count:220838 | 220838 |
804 | } | - |
805 | | - |
806 | | - |
807 | | - |
808 | | - |
809 | bool QString::operator<(QLatin1String other) const | - |
810 | { | - |
811 | const uchar *c = (uchar *) other.latin1(); | - |
812 | if (!c || *c == 0) evaluated: !c yes Evaluation Count:5 | yes Evaluation Count:1763 |
evaluated: *c == 0 yes Evaluation Count:7 | yes Evaluation Count:1756 |
| 5-1763 |
813 | return false; executed: return false; Execution Count:12 | 12 |
814 | | - |
815 | const ushort *uc = d->data(); | - |
816 | const ushort *e = uc + qMin(d->size, other.size()); | - |
817 | | - |
818 | while (uc < e) { evaluated: uc < e yes Evaluation Count:5020 | yes Evaluation Count:1705 |
| 1705-5020 |
819 | if (*uc != *c) evaluated: *uc != *c yes Evaluation Count:51 | yes Evaluation Count:4969 |
| 51-4969 |
820 | break; executed: break; Execution Count:51 | 51 |
821 | ++uc; | - |
822 | ++c; | - |
823 | } executed: } Execution Count:4969 | 4969 |
824 | return (uc == e ? d->size < other.size() : *uc < *c); executed: return (uc == e ? d->size < other.size() : *uc < *c); Execution Count:1756 | 1756 |
825 | } | - |
826 | bool QString::operator>(QLatin1String other) const | - |
827 | { | - |
828 | const uchar *c = (uchar *) other.latin1(); | - |
829 | if (!c || *c == '\0') evaluated: !c yes Evaluation Count:5 | yes Evaluation Count:70957 |
evaluated: *c == '\0' yes Evaluation Count:13 | yes Evaluation Count:70944 |
| 5-70957 |
830 | return !isEmpty(); executed: return !isEmpty(); Execution Count:18 | 18 |
831 | | - |
832 | const ushort *uc = d->data(); | - |
833 | const ushort *e = uc + qMin(d->size, other.size()); | - |
834 | | - |
835 | while (uc < e) { evaluated: uc < e yes Evaluation Count:223335 | yes Evaluation Count:30677 |
| 30677-223335 |
836 | if (*uc != *c) evaluated: *uc != *c yes Evaluation Count:40267 | yes Evaluation Count:183068 |
| 40267-183068 |
837 | break; executed: break; Execution Count:40267 | 40267 |
838 | ++uc; | - |
839 | ++c; | - |
840 | } executed: } Execution Count:183068 | 183068 |
841 | return (uc == e) ? d->size > other.size() : *uc > *c; executed: return (uc == e) ? d->size > other.size() : *uc > *c; Execution Count:70944 | 70944 |
842 | } | - |
843 | int QString::indexOf(const QString &str, int from, Qt::CaseSensitivity cs) const | - |
844 | { | - |
845 | return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs); executed: return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs); Execution Count:52292 | 52292 |
846 | } | - |
847 | int QString::indexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const | - |
848 | { | - |
849 | return qt_find_latin1_string(unicode(), size(), str, from, cs); executed: return qt_find_latin1_string(unicode(), size(), str, from, cs); Execution Count:3182 | 3182 |
850 | } | - |
851 | | - |
852 | int qFindString( | - |
853 | const QChar *haystack0, int haystackLen, int from, | - |
854 | const QChar *needle0, int needleLen, Qt::CaseSensitivity cs) | - |
855 | { | - |
856 | const int l = haystackLen; | - |
857 | const int sl = needleLen; | - |
858 | if (from < 0) partially evaluated: from < 0 no Evaluation Count:0 | yes Evaluation Count:197059 |
| 0-197059 |
859 | from += l; never executed: from += l; | 0 |
860 | if (uint(sl + from) > (uint)l) evaluated: uint(sl + from) > (uint)l yes Evaluation Count:52364 | yes Evaluation Count:144695 |
| 52364-144695 |
861 | return -1; executed: return -1; Execution Count:52364 | 52364 |
862 | if (!sl) evaluated: !sl yes Evaluation Count:337 | yes Evaluation Count:144358 |
| 337-144358 |
863 | return from; executed: return from; Execution Count:337 | 337 |
864 | if (!l) partially evaluated: !l no Evaluation Count:0 | yes Evaluation Count:144358 |
| 0-144358 |
865 | return -1; never executed: return -1; | 0 |
866 | | - |
867 | if (sl == 1) evaluated: sl == 1 yes Evaluation Count:126240 | yes Evaluation Count:18118 |
| 18118-126240 |
868 | return findChar(haystack0, haystackLen, needle0[0], from, cs); executed: return findChar(haystack0, haystackLen, needle0[0], from, cs); Execution Count:126240 | 126240 |
869 | | - |
870 | | - |
871 | | - |
872 | | - |
873 | | - |
874 | | - |
875 | if (l > 500 && sl > 5) evaluated: l > 500 yes Evaluation Count:228 | yes Evaluation Count:17890 |
evaluated: sl > 5 yes Evaluation Count:208 | yes Evaluation Count:20 |
| 20-17890 |
876 | return qFindStringBoyerMoore(haystack0, haystackLen, from, | 208 |
877 | needle0, needleLen, cs); executed: return qFindStringBoyerMoore(haystack0, haystackLen, from, needle0, needleLen, cs); Execution Count:208 | 208 |
878 | | - |
879 | | - |
880 | | - |
881 | | - |
882 | | - |
883 | | - |
884 | | - |
885 | const ushort *needle = (const ushort *)needle0; | - |
886 | const ushort *haystack = (const ushort *)haystack0 + from; | - |
887 | const ushort *end = (const ushort *)haystack0 + (l-sl); | - |
888 | const int sl_minus_1 = sl-1; | - |
889 | int hashNeedle = 0, hashHaystack = 0, idx; | - |
890 | | - |
891 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:15134 | yes Evaluation Count:2776 |
| 2776-15134 |
892 | for (idx = 0; idx < sl; ++idx) { evaluated: idx < sl yes Evaluation Count:85836 | yes Evaluation Count:15134 |
| 15134-85836 |
893 | hashNeedle = ((hashNeedle<<1) + needle[idx]); | - |
894 | hashHaystack = ((hashHaystack<<1) + haystack[idx]); | - |
895 | } executed: } Execution Count:85836 | 85836 |
896 | hashHaystack -= haystack[sl_minus_1]; | - |
897 | | - |
898 | while (haystack <= end) { evaluated: haystack <= end yes Evaluation Count:204051 | yes Evaluation Count:12080 |
| 12080-204051 |
899 | hashHaystack += haystack[sl_minus_1]; | - |
900 | if (hashHaystack == hashNeedle evaluated: hashHaystack == hashNeedle yes Evaluation Count:3128 | yes Evaluation Count:200923 |
| 3128-200923 |
901 | && ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0) evaluated: ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0 yes Evaluation Count:3054 | yes Evaluation Count:74 |
| 74-3054 |
902 | return haystack - (const ushort *)haystack0; executed: return haystack - (const ushort *)haystack0; Execution Count:3054 | 3054 |
903 | | - |
904 | if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (*haystack) << sl_minus_1; hashHaystack <<= 1; evaluated: sl_minus_1 < (int)sizeof(int) * 8 yes Evaluation Count:199864 | yes Evaluation Count:1133 |
executed: hashHaystack -= (*haystack) << sl_minus_1; Execution Count:199864 | 1133-199864 |
905 | ++haystack; | - |
906 | } executed: } Execution Count:200997 | 200997 |
907 | } else { executed: } Execution Count:12080 | 12080 |
908 | const ushort *haystack_start = (const ushort *)haystack0; | - |
909 | for (idx = 0; idx < sl; ++idx) { evaluated: idx < sl yes Evaluation Count:11184 | yes Evaluation Count:2776 |
| 2776-11184 |
910 | hashNeedle = (hashNeedle<<1) + foldCase(needle + idx, needle); | - |
911 | hashHaystack = (hashHaystack<<1) + foldCase(haystack + idx, haystack_start); | - |
912 | } executed: } Execution Count:11184 | 11184 |
913 | hashHaystack -= foldCase(haystack + sl_minus_1, haystack_start); | - |
914 | | - |
915 | while (haystack <= end) { evaluated: haystack <= end yes Evaluation Count:9857 | yes Evaluation Count:1694 |
| 1694-9857 |
916 | hashHaystack += foldCase(haystack + sl_minus_1, haystack_start); | - |
917 | if (hashHaystack == hashNeedle && ucstrnicmp(needle, haystack, sl) == 0) evaluated: hashHaystack == hashNeedle yes Evaluation Count:1092 | yes Evaluation Count:8765 |
evaluated: ucstrnicmp(needle, haystack, sl) == 0 yes Evaluation Count:1082 | yes Evaluation Count:10 |
| 10-8765 |
918 | return haystack - (const ushort *)haystack0; executed: return haystack - (const ushort *)haystack0; Execution Count:1082 | 1082 |
919 | | - |
920 | if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (foldCase(haystack, haystack_start)) << sl_minus_1; hashHaystack <<= 1; evaluated: sl_minus_1 < (int)sizeof(int) * 8 yes Evaluation Count:8590 | yes Evaluation Count:185 |
executed: hashHaystack -= (foldCase(haystack, haystack_start)) << sl_minus_1; Execution Count:8590 | 185-8590 |
921 | ++haystack; | - |
922 | } executed: } Execution Count:8775 | 8775 |
923 | } executed: } Execution Count:1694 | 1694 |
924 | return -1; executed: return -1; Execution Count:13774 | 13774 |
925 | } | - |
926 | int QString::indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const | - |
927 | { | - |
928 | return findChar(unicode(), length(), ch, from, cs); executed: return findChar(unicode(), length(), ch, from, cs); Execution Count:159222 | 159222 |
929 | } | - |
930 | int QString::indexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const | - |
931 | { | - |
932 | return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs); executed: return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs); Execution Count:392 | 392 |
933 | } | - |
934 | | - |
935 | static int lastIndexOfHelper(const ushort *haystack, int from, const ushort *needle, int sl, Qt::CaseSensitivity cs) | - |
936 | { | - |
937 | | - |
938 | | - |
939 | | - |
940 | | - |
941 | const ushort *end = haystack; | - |
942 | haystack += from; | - |
943 | const int sl_minus_1 = sl-1; | - |
944 | const ushort *n = needle+sl_minus_1; | - |
945 | const ushort *h = haystack+sl_minus_1; | - |
946 | int hashNeedle = 0, hashHaystack = 0, idx; | - |
947 | | - |
948 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:78 | yes Evaluation Count:98 |
| 78-98 |
949 | for (idx = 0; idx < sl; ++idx) { evaluated: idx < sl yes Evaluation Count:1042 | yes Evaluation Count:78 |
| 78-1042 |
950 | hashNeedle = ((hashNeedle<<1) + *(n-idx)); | - |
951 | hashHaystack = ((hashHaystack<<1) + *(h-idx)); | - |
952 | } executed: } Execution Count:1042 | 1042 |
953 | hashHaystack -= *haystack; | - |
954 | | - |
955 | while (haystack >= end) { evaluated: haystack >= end yes Evaluation Count:653 | yes Evaluation Count:17 |
| 17-653 |
956 | hashHaystack += *haystack; | - |
957 | if (hashHaystack == hashNeedle evaluated: hashHaystack == hashNeedle yes Evaluation Count:65 | yes Evaluation Count:588 |
| 65-588 |
958 | && ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0) evaluated: ucstrncmp((const QChar *)needle, (const QChar *)haystack, sl) == 0 yes Evaluation Count:61 | yes Evaluation Count:4 |
| 4-61 |
959 | return haystack - end; executed: return haystack - end; Execution Count:61 | 61 |
960 | --haystack; | - |
961 | if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (haystack[sl]) << sl_minus_1; hashHaystack <<= 1; evaluated: sl_minus_1 < (int)sizeof(int) * 8 yes Evaluation Count:456 | yes Evaluation Count:136 |
executed: hashHaystack -= (haystack[sl]) << sl_minus_1; Execution Count:456 | 136-456 |
962 | } executed: } Execution Count:592 | 592 |
963 | } else { executed: } Execution Count:17 | 17 |
964 | for (idx = 0; idx < sl; ++idx) { evaluated: idx < sl yes Evaluation Count:1086 | yes Evaluation Count:98 |
| 98-1086 |
965 | hashNeedle = ((hashNeedle<<1) + foldCase(n-idx, needle)); | - |
966 | hashHaystack = ((hashHaystack<<1) + foldCase(h-idx, end)); | - |
967 | } executed: } Execution Count:1086 | 1086 |
968 | hashHaystack -= foldCase(haystack, end); | - |
969 | | - |
970 | while (haystack >= end) { evaluated: haystack >= end yes Evaluation Count:649 | yes Evaluation Count:37 |
| 37-649 |
971 | hashHaystack += foldCase(haystack, end); | - |
972 | if (hashHaystack == hashNeedle && ucstrnicmp(needle, haystack, sl) == 0) evaluated: hashHaystack == hashNeedle yes Evaluation Count:65 | yes Evaluation Count:584 |
evaluated: ucstrnicmp(needle, haystack, sl) == 0 yes Evaluation Count:61 | yes Evaluation Count:4 |
| 4-584 |
973 | return haystack - end; executed: return haystack - end; Execution Count:61 | 61 |
974 | --haystack; | - |
975 | if (sl_minus_1 < (int)sizeof(int) * 8) hashHaystack -= (foldCase(haystack + sl, end)) << sl_minus_1; hashHaystack <<= 1; evaluated: sl_minus_1 < (int)sizeof(int) * 8 yes Evaluation Count:452 | yes Evaluation Count:136 |
executed: hashHaystack -= (foldCase(haystack + sl, end)) << sl_minus_1; Execution Count:452 | 136-452 |
976 | } executed: } Execution Count:588 | 588 |
977 | } executed: } Execution Count:37 | 37 |
978 | return -1; executed: return -1; Execution Count:54 | 54 |
979 | } | - |
980 | int QString::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) const | - |
981 | { | - |
982 | const int sl = str.d->size; | - |
983 | if (sl == 1) evaluated: sl == 1 yes Evaluation Count:3220 | yes Evaluation Count:83 |
| 83-3220 |
984 | return lastIndexOf(QChar(str.d->data()[0]), from, cs); executed: return lastIndexOf(QChar(str.d->data()[0]), from, cs); Execution Count:3220 | 3220 |
985 | | - |
986 | const int l = d->size; | - |
987 | if (from < 0) evaluated: from < 0 yes Evaluation Count:60 | yes Evaluation Count:23 |
| 23-60 |
988 | from += l; executed: from += l; Execution Count:60 | 60 |
989 | int delta = l-sl; | - |
990 | if (from == l && sl == 0) evaluated: from == l yes Evaluation Count:6 | yes Evaluation Count:77 |
evaluated: sl == 0 yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3-77 |
991 | return from; executed: return from; Execution Count:3 | 3 |
992 | if (from < 0 || from >= l || delta < 0) evaluated: from < 0 yes Evaluation Count:10 | yes Evaluation Count:70 |
evaluated: from >= l yes Evaluation Count:6 | yes Evaluation Count:64 |
evaluated: delta < 0 yes Evaluation Count:9 | yes Evaluation Count:55 |
| 6-70 |
993 | return -1; executed: return -1; Execution Count:25 | 25 |
994 | if (from > delta) evaluated: from > delta yes Evaluation Count:38 | yes Evaluation Count:17 |
| 17-38 |
995 | from = delta; executed: from = delta; Execution Count:38 | 38 |
996 | | - |
997 | return lastIndexOfHelper(d->data(), from, str.d->data(), str.d->size, cs); executed: return lastIndexOfHelper(d->data(), from, str.d->data(), str.d->size, cs); Execution Count:55 | 55 |
998 | } | - |
999 | int QString::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const | - |
1000 | { | - |
1001 | const int sl = str.size(); | - |
1002 | if (sl == 1) evaluated: sl == 1 yes Evaluation Count:4 | yes Evaluation Count:13 |
| 4-13 |
1003 | return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs); executed: return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs); Execution Count:4 | 4 |
1004 | | - |
1005 | const int l = d->size; | - |
1006 | if (from < 0) partially evaluated: from < 0 no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
1007 | from += l; never executed: from += l; | 0 |
1008 | int delta = l-sl; | - |
1009 | if (from == l && sl == 0) partially evaluated: from == l no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
1010 | return from; never executed: return from; | 0 |
1011 | if (from < 0 || from >= l || delta < 0) partially evaluated: from < 0 no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: from >= l no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: delta < 0 no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
1012 | return -1; never executed: return -1; | 0 |
1013 | if (from > delta) partially evaluated: from > delta yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
1014 | from = delta; executed: from = delta; Execution Count:13 | 13 |
1015 | | - |
1016 | QVarLengthArray<ushort> s(sl); | - |
1017 | for (int i = 0; i < sl; ++i) evaluated: i < sl yes Evaluation Count:39 | yes Evaluation Count:13 |
| 13-39 |
1018 | s[i] = str.latin1()[i]; executed: s[i] = str.latin1()[i]; Execution Count:39 | 39 |
1019 | | - |
1020 | return lastIndexOfHelper(d->data(), from, s.data(), sl, cs); executed: return lastIndexOfHelper(d->data(), from, s.data(), sl, cs); Execution Count:13 | 13 |
1021 | } | - |
1022 | | - |
1023 | | - |
1024 | | - |
1025 | | - |
1026 | | - |
1027 | | - |
1028 | | - |
1029 | int QString::lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const | - |
1030 | { | - |
1031 | return qt_last_index_of(unicode(), size(), ch, from, cs); executed: return qt_last_index_of(unicode(), size(), ch, from, cs); Execution Count:25766 | 25766 |
1032 | } | - |
1033 | int QString::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const | - |
1034 | { | - |
1035 | const int sl = str.size(); | - |
1036 | if (sl == 1) evaluated: sl == 1 yes Evaluation Count:86 | yes Evaluation Count:62 |
| 62-86 |
1037 | return lastIndexOf(str.at(0), from, cs); executed: return lastIndexOf(str.at(0), from, cs); Execution Count:86 | 86 |
1038 | | - |
1039 | const int l = d->size; | - |
1040 | if (from < 0) evaluated: from < 0 yes Evaluation Count:48 | yes Evaluation Count:14 |
| 14-48 |
1041 | from += l; executed: from += l; Execution Count:48 | 48 |
1042 | int delta = l - sl; | - |
1043 | if (from == l && sl == 0) evaluated: from == l yes Evaluation Count:4 | yes Evaluation Count:58 |
evaluated: sl == 0 yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2-58 |
1044 | return from; executed: return from; Execution Count:2 | 2 |
1045 | if (from < 0 || from >= l || delta < 0) evaluated: from < 0 yes Evaluation Count:8 | yes Evaluation Count:52 |
evaluated: from >= l yes Evaluation Count:4 | yes Evaluation Count:48 |
evaluated: delta < 0 yes Evaluation Count:8 | yes Evaluation Count:40 |
| 4-52 |
1046 | return -1; executed: return -1; Execution Count:20 | 20 |
1047 | if (from > delta) evaluated: from > delta yes Evaluation Count:30 | yes Evaluation Count:10 |
| 10-30 |
1048 | from = delta; executed: from = delta; Execution Count:30 | 30 |
1049 | | - |
1050 | return lastIndexOfHelper(d->data(), from, reinterpret_cast<const ushort*>(str.unicode()), | 40 |
1051 | str.size(), cs); executed: return lastIndexOfHelper(d->data(), from, reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs); Execution Count:40 | 40 |
1052 | } | - |
1053 | | - |
1054 | | - |
1055 | struct QStringCapture | - |
1056 | { | - |
1057 | int pos; | - |
1058 | int len; | - |
1059 | int no; | - |
1060 | }; | - |
1061 | QString& QString::replace(const QRegExp &rx, const QString &after) | - |
1062 | { | - |
1063 | QRegExp rx2(rx); | - |
1064 | | - |
1065 | if (isEmpty() && rx2.indexIn(*this) == -1) evaluated: isEmpty() yes Evaluation Count:51962 | yes Evaluation Count:83451 |
evaluated: rx2.indexIn(*this) == -1 yes Evaluation Count:51944 | yes Evaluation Count:18 |
| 18-83451 |
1066 | return *this; executed: return *this; Execution Count:51944 | 51944 |
1067 | | - |
1068 | reallocData(uint(d->size) + 1u); | - |
1069 | | - |
1070 | int index = 0; | - |
1071 | int numCaptures = rx2.captureCount(); | - |
1072 | int al = after.length(); | - |
1073 | QRegExp::CaretMode caretMode = QRegExp::CaretAtZero; | - |
1074 | | - |
1075 | if (numCaptures > 0) { evaluated: numCaptures > 0 yes Evaluation Count:19 | yes Evaluation Count:83450 |
| 19-83450 |
1076 | const QChar *uc = after.unicode(); | - |
1077 | int numBackRefs = 0; | - |
1078 | | - |
1079 | for (int i = 0; i < al - 1; i++) { evaluated: i < al - 1 yes Evaluation Count:141 | yes Evaluation Count:19 |
| 19-141 |
1080 | if (uc[i] == QLatin1Char('\\')) { evaluated: uc[i] == QLatin1Char('\\') yes Evaluation Count:56 | yes Evaluation Count:85 |
| 56-85 |
1081 | int no = uc[i + 1].digitValue(); | - |
1082 | if (no > 0 && no <= numCaptures) evaluated: no > 0 yes Evaluation Count:52 | yes Evaluation Count:4 |
evaluated: no <= numCaptures yes Evaluation Count:50 | yes Evaluation Count:2 |
| 2-52 |
1083 | numBackRefs++; executed: numBackRefs++; Execution Count:50 | 50 |
1084 | } executed: } Execution Count:56 | 56 |
1085 | } executed: } Execution Count:141 | 141 |
1086 | | - |
1087 | | - |
1088 | | - |
1089 | | - |
1090 | if (numBackRefs > 0) { evaluated: numBackRefs > 0 yes Evaluation Count:13 | yes Evaluation Count:6 |
| 6-13 |
1091 | QVarLengthArray<QStringCapture, 16> captures(numBackRefs); | - |
1092 | int j = 0; | - |
1093 | | - |
1094 | for (int i = 0; i < al - 1; i++) { evaluated: i < al - 1 yes Evaluation Count:132 | yes Evaluation Count:13 |
| 13-132 |
1095 | if (uc[i] == QLatin1Char('\\')) { evaluated: uc[i] == QLatin1Char('\\') yes Evaluation Count:52 | yes Evaluation Count:80 |
| 52-80 |
1096 | int no = uc[i + 1].digitValue(); | - |
1097 | if (no > 0 && no <= numCaptures) { evaluated: no > 0 yes Evaluation Count:51 | yes Evaluation Count:1 |
evaluated: no <= numCaptures yes Evaluation Count:50 | yes Evaluation Count:1 |
| 1-51 |
1098 | QStringCapture capture; | - |
1099 | capture.pos = i; | - |
1100 | capture.len = 2; | - |
1101 | | - |
1102 | if (i < al - 2) { evaluated: i < al - 2 yes Evaluation Count:44 | yes Evaluation Count:6 |
| 6-44 |
1103 | int secondDigit = uc[i + 2].digitValue(); | - |
1104 | if (secondDigit != -1 && ((no * 10) + secondDigit) <= numCaptures) { evaluated: secondDigit != -1 yes Evaluation Count:28 | yes Evaluation Count:16 |
evaluated: ((no * 10) + secondDigit) <= numCaptures yes Evaluation Count:6 | yes Evaluation Count:22 |
| 6-28 |
1105 | no = (no * 10) + secondDigit; | - |
1106 | ++capture.len; | - |
1107 | } executed: } Execution Count:6 | 6 |
1108 | } executed: } Execution Count:44 | 44 |
1109 | | - |
1110 | capture.no = no; | - |
1111 | captures[j++] = capture; | - |
1112 | } executed: } Execution Count:50 | 50 |
1113 | } executed: } Execution Count:52 | 52 |
1114 | } executed: } Execution Count:132 | 132 |
1115 | | - |
1116 | while (index <= length()) { partially evaluated: index <= length() yes Evaluation Count:35 | no Evaluation Count:0 |
| 0-35 |
1117 | index = rx2.indexIn(*this, index, caretMode); | - |
1118 | if (index == -1) evaluated: index == -1 yes Evaluation Count:13 | yes Evaluation Count:22 |
| 13-22 |
1119 | break; executed: break; Execution Count:13 | 13 |
1120 | | - |
1121 | QString after2(after); | - |
1122 | for (j = numBackRefs - 1; j >= 0; j--) { evaluated: j >= 0 yes Evaluation Count:58 | yes Evaluation Count:22 |
| 22-58 |
1123 | const QStringCapture &capture = captures[j]; | - |
1124 | after2.replace(capture.pos, capture.len, rx2.cap(capture.no)); | - |
1125 | } executed: } Execution Count:58 | 58 |
1126 | | - |
1127 | replace(index, rx2.matchedLength(), after2); | - |
1128 | index += after2.length(); | - |
1129 | | - |
1130 | | - |
1131 | if (rx2.matchedLength() == 0) partially evaluated: rx2.matchedLength() == 0 no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
1132 | ++index; | 0 |
1133 | | - |
1134 | caretMode = QRegExp::CaretWontMatch; | - |
1135 | } executed: } Execution Count:22 | 22 |
1136 | return *this; executed: return *this; Execution Count:13 | 13 |
1137 | } | - |
1138 | } executed: } Execution Count:6 | 6 |
1139 | | - |
1140 | | - |
1141 | | - |
1142 | | - |
1143 | | - |
1144 | while (index != -1) { evaluated: index != -1 yes Evaluation Count:83456 | yes Evaluation Count:1101 |
| 1101-83456 |
1145 | struct { | - |
1146 | int pos; | - |
1147 | int length; | - |
1148 | } replacements[2048]; | - |
1149 | | - |
1150 | int pos = 0; | - |
1151 | int adjust = 0; | - |
1152 | while (pos < 2047) { partially evaluated: pos < 2047 yes Evaluation Count:84789 | no Evaluation Count:0 |
| 0-84789 |
1153 | index = rx2.indexIn(*this, index, caretMode); | - |
1154 | if (index == -1) evaluated: index == -1 yes Evaluation Count:83456 | yes Evaluation Count:1333 |
| 1333-83456 |
1155 | break; executed: break; Execution Count:83456 | 83456 |
1156 | int ml = rx2.matchedLength(); | - |
1157 | replacements[pos].pos = index; | - |
1158 | replacements[pos++].length = ml; | - |
1159 | index += ml; | - |
1160 | adjust += al - ml; | - |
1161 | | - |
1162 | if (!ml) evaluated: !ml yes Evaluation Count:46 | yes Evaluation Count:1287 |
| 46-1287 |
1163 | index++; executed: index++; Execution Count:46 | 46 |
1164 | } executed: } Execution Count:1333 | 1333 |
1165 | if (!pos) evaluated: !pos yes Evaluation Count:82355 | yes Evaluation Count:1101 |
| 1101-82355 |
1166 | break; executed: break; Execution Count:82355 | 82355 |
1167 | replacements[pos].pos = d->size; | - |
1168 | int newlen = d->size + adjust; | - |
1169 | | - |
1170 | | - |
1171 | | - |
1172 | if (index != -1) partially evaluated: index != -1 no Evaluation Count:0 | yes Evaluation Count:1101 |
| 0-1101 |
1173 | index += adjust; never executed: index += adjust; | 0 |
1174 | QString newstring; | - |
1175 | newstring.reserve(newlen + 1); | - |
1176 | QChar *newuc = newstring.data(); | - |
1177 | QChar *uc = newuc; | - |
1178 | int copystart = 0; | - |
1179 | int i = 0; | - |
1180 | while (i < pos) { evaluated: i < pos yes Evaluation Count:1333 | yes Evaluation Count:1101 |
| 1101-1333 |
1181 | int copyend = replacements[i].pos; | - |
1182 | int size = copyend - copystart; | - |
1183 | memcpy(uc, d->data() + copystart, size * sizeof(QChar)); | - |
1184 | uc += size; | - |
1185 | memcpy(uc, after.d->data(), al * sizeof(QChar)); | - |
1186 | uc += al; | - |
1187 | copystart = copyend + replacements[i].length; | - |
1188 | i++; | - |
1189 | } executed: } Execution Count:1333 | 1333 |
1190 | memcpy(uc, d->data() + copystart, (d->size - copystart) * sizeof(QChar)); | - |
1191 | newstring.resize(newlen); | - |
1192 | *this = newstring; | - |
1193 | caretMode = QRegExp::CaretWontMatch; | - |
1194 | } executed: } Execution Count:1101 | 1101 |
1195 | return *this; executed: return *this; Execution Count:83456 | 83456 |
1196 | } | - |
1197 | QString &QString::replace(const QRegularExpression &re, const QString &after) | - |
1198 | { | - |
1199 | if (!re.isValid()) { partially evaluated: !re.isValid() no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
1200 | QMessageLogger("tools/qstring.cpp", 2951, __PRETTY_FUNCTION__).warning("QString::replace: invalid QRegularExpresssion object"); | - |
1201 | return *this; never executed: return *this; | 0 |
1202 | } | - |
1203 | | - |
1204 | const QString copy(*this); | - |
1205 | QRegularExpressionMatchIterator iterator = re.globalMatch(copy); | - |
1206 | if (!iterator.hasNext()) evaluated: !iterator.hasNext() yes Evaluation Count:12 | yes Evaluation Count:21 |
| 12-21 |
1207 | return *this; executed: return *this; Execution Count:12 | 12 |
1208 | | - |
1209 | reallocData(uint(d->size) + 1u); | - |
1210 | | - |
1211 | int numCaptures = re.captureCount(); | - |
1212 | | - |
1213 | | - |
1214 | | - |
1215 | QVector<QStringCapture> backReferences; | - |
1216 | const int al = after.length(); | - |
1217 | const QChar *ac = after.unicode(); | - |
1218 | | - |
1219 | for (int i = 0; i < al - 1; i++) { evaluated: i < al - 1 yes Evaluation Count:138 | yes Evaluation Count:21 |
| 21-138 |
1220 | if (ac[i] == QLatin1Char('\\')) { evaluated: ac[i] == QLatin1Char('\\') yes Evaluation Count:55 | yes Evaluation Count:83 |
| 55-83 |
1221 | int no = ac[i + 1].digitValue(); | - |
1222 | if (no > 0 && no <= numCaptures) { evaluated: no > 0 yes Evaluation Count:51 | yes Evaluation Count:4 |
evaluated: no <= numCaptures yes Evaluation Count:48 | yes Evaluation Count:3 |
| 3-51 |
1223 | QStringCapture backReference; | - |
1224 | backReference.pos = i; | - |
1225 | backReference.len = 2; | - |
1226 | | - |
1227 | if (i < al - 2) { evaluated: i < al - 2 yes Evaluation Count:43 | yes Evaluation Count:5 |
| 5-43 |
1228 | int secondDigit = ac[i + 2].digitValue(); | - |
1229 | if (secondDigit != -1 && ((no * 10) + secondDigit) <= numCaptures) { evaluated: secondDigit != -1 yes Evaluation Count:28 | yes Evaluation Count:15 |
evaluated: ((no * 10) + secondDigit) <= numCaptures yes Evaluation Count:6 | yes Evaluation Count:22 |
| 6-28 |
1230 | no = (no * 10) + secondDigit; | - |
1231 | ++backReference.len; | - |
1232 | } executed: } Execution Count:6 | 6 |
1233 | } executed: } Execution Count:43 | 43 |
1234 | | - |
1235 | backReference.no = no; | - |
1236 | backReferences.append(backReference); | - |
1237 | } executed: } Execution Count:48 | 48 |
1238 | } executed: } Execution Count:55 | 55 |
1239 | } executed: } Execution Count:138 | 138 |
1240 | | - |
1241 | | - |
1242 | | - |
1243 | | - |
1244 | | - |
1245 | int newLength = 0; | - |
1246 | int lastEnd = 0; | - |
1247 | QVector<QStringRef> chunks; | - |
1248 | while (iterator.hasNext()) { evaluated: iterator.hasNext() yes Evaluation Count:38 | yes Evaluation Count:21 |
| 21-38 |
1249 | QRegularExpressionMatch match = iterator.next(); | - |
1250 | int len; | - |
1251 | | - |
1252 | len = match.capturedStart() - lastEnd; | - |
1253 | if (len > 0) { evaluated: len > 0 yes Evaluation Count:4 | yes Evaluation Count:34 |
| 4-34 |
1254 | chunks << copy.midRef(lastEnd, len); | - |
1255 | newLength += len; | - |
1256 | } executed: } Execution Count:4 | 4 |
1257 | | - |
1258 | lastEnd = 0; | - |
1259 | | - |
1260 | for (QForeachContainer<__typeof__(backReferences)> _container_(backReferences); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QStringCapture &backReference = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1261 | | - |
1262 | len = backReference.pos - lastEnd; | - |
1263 | if (len > 0) { evaluated: len > 0 yes Evaluation Count:28 | yes Evaluation Count:30 |
| 28-30 |
1264 | chunks << after.midRef(lastEnd, len); | - |
1265 | newLength += len; | - |
1266 | } executed: } Execution Count:28 | 28 |
1267 | | - |
1268 | | - |
1269 | len = match.capturedLength(backReference.no); | - |
1270 | if (len > 0) { evaluated: len > 0 yes Evaluation Count:57 | yes Evaluation Count:1 |
| 1-57 |
1271 | chunks << copy.midRef(match.capturedStart(backReference.no), len); | - |
1272 | newLength += len; | - |
1273 | } executed: } Execution Count:57 | 57 |
1274 | | - |
1275 | lastEnd = backReference.pos + backReference.len; | - |
1276 | } executed: } Execution Count:58 | 58 |
1277 | | - |
1278 | | - |
1279 | len = after.length() - lastEnd; | - |
1280 | if (len > 0) { evaluated: len > 0 yes Evaluation Count:27 | yes Evaluation Count:11 |
| 11-27 |
1281 | chunks << after.midRef(lastEnd, len); | - |
1282 | newLength += len; | - |
1283 | } executed: } Execution Count:27 | 27 |
1284 | | - |
1285 | lastEnd = match.capturedEnd(); | - |
1286 | } executed: } Execution Count:38 | 38 |
1287 | | - |
1288 | | - |
1289 | if (copy.length() > lastEnd) { evaluated: copy.length() > lastEnd yes Evaluation Count:7 | yes Evaluation Count:14 |
| 7-14 |
1290 | chunks << copy.midRef(lastEnd); | - |
1291 | newLength += copy.length() - lastEnd; | - |
1292 | } executed: } Execution Count:7 | 7 |
1293 | | - |
1294 | | - |
1295 | resize(newLength); | - |
1296 | int i = 0; | - |
1297 | QChar *uc = data(); | - |
1298 | for (QForeachContainer<__typeof__(chunks)> _container_(chunks); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QStringRef &chunk = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1299 | int len = chunk.length(); | - |
1300 | memcpy(uc + i, chunk.unicode(), len * sizeof(QChar)); | - |
1301 | i += len; | - |
1302 | } executed: } Execution Count:123 | 123 |
1303 | | - |
1304 | return *this; executed: return *this; Execution Count:21 | 21 |
1305 | } | - |
1306 | int QString::count(const QString &str, Qt::CaseSensitivity cs) const | - |
1307 | { | - |
1308 | return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); Execution Count:12 | 12 |
1309 | } | - |
1310 | | - |
1311 | | - |
1312 | | - |
1313 | | - |
1314 | | - |
1315 | | - |
1316 | | - |
1317 | int QString::count(QChar ch, Qt::CaseSensitivity cs) const | - |
1318 | { | - |
1319 | return qt_string_count(unicode(), size(), ch, cs); executed: return qt_string_count(unicode(), size(), ch, cs); Execution Count:3589 | 3589 |
1320 | } | - |
1321 | int QString::count(const QStringRef &str, Qt::CaseSensitivity cs) const | - |
1322 | { | - |
1323 | return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); Execution Count:4 | 4 |
1324 | } | - |
1325 | int QString::indexOf(const QRegExp& rx, int from) const | - |
1326 | { | - |
1327 | QRegExp rx2(rx); | - |
1328 | return rx2.indexIn(*this, from); executed: return rx2.indexIn(*this, from); Execution Count:20295 | 20295 |
1329 | } | - |
1330 | int QString::indexOf(QRegExp& rx, int from) const | - |
1331 | { | - |
1332 | return rx.indexIn(*this, from); executed: return rx.indexIn(*this, from); Execution Count:372 | 372 |
1333 | } | - |
1334 | int QString::lastIndexOf(const QRegExp& rx, int from) const | - |
1335 | { | - |
1336 | QRegExp rx2(rx); | - |
1337 | return rx2.lastIndexIn(*this, from); executed: return rx2.lastIndexIn(*this, from); Execution Count:36 | 36 |
1338 | } | - |
1339 | int QString::lastIndexOf(QRegExp& rx, int from) const | - |
1340 | { | - |
1341 | return rx.lastIndexIn(*this, from); executed: return rx.lastIndexIn(*this, from); Execution Count:36 | 36 |
1342 | } | - |
1343 | int QString::count(const QRegExp& rx) const | - |
1344 | { | - |
1345 | QRegExp rx2(rx); | - |
1346 | int count = 0; | - |
1347 | int index = -1; | - |
1348 | int len = length(); | - |
1349 | while (index < len - 1) { partially evaluated: index < len - 1 yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1350 | index = rx2.indexIn(*this, index + 1); | - |
1351 | if (index == -1) evaluated: index == -1 yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
1352 | break; executed: break; Execution Count:2 | 2 |
1353 | count++; | - |
1354 | } executed: } Execution Count:3 | 3 |
1355 | return count; executed: return count; Execution Count:2 | 2 |
1356 | } | - |
1357 | int QString::indexOf(const QRegularExpression& re, int from) const | - |
1358 | { | - |
1359 | if (!re.isValid()) { partially evaluated: !re.isValid() no Evaluation Count:0 | yes Evaluation Count:64 |
| 0-64 |
1360 | QMessageLogger("tools/qstring.cpp", 3276, __PRETTY_FUNCTION__).warning("QString::indexOf: invalid QRegularExpresssion object"); | - |
1361 | return -1; never executed: return -1; | 0 |
1362 | } | - |
1363 | | - |
1364 | QRegularExpressionMatch match = re.match(*this, from); | - |
1365 | if (match.hasMatch()) evaluated: match.hasMatch() yes Evaluation Count:33 | yes Evaluation Count:31 |
| 31-33 |
1366 | return match.capturedStart(); executed: return match.capturedStart(); Execution Count:33 | 33 |
1367 | | - |
1368 | return -1; executed: return -1; Execution Count:31 | 31 |
1369 | } | - |
1370 | int QString::lastIndexOf(const QRegularExpression &re, int from) const | - |
1371 | { | - |
1372 | if (!re.isValid()) { partially evaluated: !re.isValid() no Evaluation Count:0 | yes Evaluation Count:18 |
| 0-18 |
1373 | QMessageLogger("tools/qstring.cpp", 3302, __PRETTY_FUNCTION__).warning("QString::lastIndexOf: invalid QRegularExpresssion object"); | - |
1374 | return -1; never executed: return -1; | 0 |
1375 | } | - |
1376 | | - |
1377 | int endpos = (from < 0) ? (size() + from + 1) : (from + 1); evaluated: (from < 0) yes Evaluation Count:6 | yes Evaluation Count:12 |
| 6-12 |
1378 | | - |
1379 | QRegularExpressionMatchIterator iterator = re.globalMatch(*this); | - |
1380 | int lastIndex = -1; | - |
1381 | while (iterator.hasNext()) { evaluated: iterator.hasNext() yes Evaluation Count:34 | yes Evaluation Count:13 |
| 13-34 |
1382 | QRegularExpressionMatch match = iterator.next(); | - |
1383 | int start = match.capturedStart(); | - |
1384 | if (start < endpos) evaluated: start < endpos yes Evaluation Count:29 | yes Evaluation Count:5 |
| 5-29 |
1385 | lastIndex = start; executed: lastIndex = start; Execution Count:29 | 29 |
1386 | else | - |
1387 | break; executed: break; Execution Count:5 | 5 |
1388 | } | - |
1389 | | - |
1390 | return lastIndex; executed: return lastIndex; Execution Count:18 | 18 |
1391 | } | - |
1392 | | - |
1393 | | - |
1394 | | - |
1395 | | - |
1396 | | - |
1397 | | - |
1398 | | - |
1399 | bool QString::contains(const QRegularExpression &re) const | - |
1400 | { | - |
1401 | if (!re.isValid()) { partially evaluated: !re.isValid() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1402 | QMessageLogger("tools/qstring.cpp", 3331, __PRETTY_FUNCTION__).warning("QString::contains: invalid QRegularExpresssion object"); | - |
1403 | return false; never executed: return false; | 0 |
1404 | } | - |
1405 | QRegularExpressionMatch match = re.match(*this); | - |
1406 | return match.hasMatch(); executed: return match.hasMatch(); Execution Count:5 | 5 |
1407 | } | - |
1408 | int QString::count(const QRegularExpression &re) const | - |
1409 | { | - |
1410 | if (!re.isValid()) { partially evaluated: !re.isValid() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1411 | QMessageLogger("tools/qstring.cpp", 3353, __PRETTY_FUNCTION__).warning("QString::count: invalid QRegularExpresssion object"); | - |
1412 | return 0; never executed: return 0; | 0 |
1413 | } | - |
1414 | int count = 0; | - |
1415 | int index = -1; | - |
1416 | int len = length(); | - |
1417 | while (index < len - 1) { partially evaluated: index < len - 1 yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1418 | QRegularExpressionMatch match = re.match(*this, index + 1); | - |
1419 | if (!match.hasMatch()) evaluated: !match.hasMatch() yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
1420 | break; executed: break; Execution Count:2 | 2 |
1421 | index = match.capturedStart(); | - |
1422 | count++; | - |
1423 | } executed: } Execution Count:3 | 3 |
1424 | return count; executed: return count; Execution Count:2 | 2 |
1425 | } | - |
1426 | QString QString::section(const QString &sep, int start, int end, SectionFlags flags) const | - |
1427 | { | - |
1428 | QStringList sections = split(sep, KeepEmptyParts, | - |
1429 | (flags & SectionCaseInsensitiveSeps) ? Qt::CaseInsensitive : Qt::CaseSensitive); | - |
1430 | if (sections.isEmpty()) partially evaluated: sections.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1991 |
| 0-1991 |
1431 | return QString(); never executed: return QString(); | 0 |
1432 | if (!(flags & SectionSkipEmpty)) { evaluated: !(flags & SectionSkipEmpty) yes Evaluation Count:192 | yes Evaluation Count:1799 |
| 192-1799 |
1433 | if (start < 0) evaluated: start < 0 yes Evaluation Count:177 | yes Evaluation Count:15 |
| 15-177 |
1434 | start += sections.count(); executed: start += sections.count(); Execution Count:177 | 177 |
1435 | if (end < 0) evaluated: end < 0 yes Evaluation Count:179 | yes Evaluation Count:13 |
| 13-179 |
1436 | end += sections.count(); executed: end += sections.count(); Execution Count:179 | 179 |
1437 | } else { executed: } Execution Count:192 | 192 |
1438 | int skip = 0; | - |
1439 | for (int k=0; k<sections.size(); ++k) { evaluated: k<sections.size() yes Evaluation Count:14488 | yes Evaluation Count:1799 |
| 1799-14488 |
1440 | if (sections.at(k).isEmpty()) evaluated: sections.at(k).isEmpty() yes Evaluation Count:1914 | yes Evaluation Count:12574 |
| 1914-12574 |
1441 | skip++; executed: skip++; Execution Count:1914 | 1914 |
1442 | } executed: } Execution Count:14488 | 14488 |
1443 | if (start < 0) partially evaluated: start < 0 no Evaluation Count:0 | yes Evaluation Count:1799 |
| 0-1799 |
1444 | start += sections.count() - skip; never executed: start += sections.count() - skip; | 0 |
1445 | if (end < 0) evaluated: end < 0 yes Evaluation Count:1792 | yes Evaluation Count:7 |
| 7-1792 |
1446 | end += sections.count() - skip; executed: end += sections.count() - skip; Execution Count:1792 | 1792 |
1447 | } executed: } Execution Count:1799 | 1799 |
1448 | int x = 0; | - |
1449 | QString ret; | - |
1450 | int first_i = start, last_i = end; | - |
1451 | for (int i = 0; x <= end && i < sections.size(); ++i) { evaluated: x <= end yes Evaluation Count:12854 | yes Evaluation Count:1991 |
partially evaluated: i < sections.size() yes Evaluation Count:12854 | no Evaluation Count:0 |
| 0-12854 |
1452 | QString section = sections.at(i); | - |
1453 | const bool empty = section.isEmpty(); | - |
1454 | if (x >= start) { evaluated: x >= start yes Evaluation Count:2029 | yes Evaluation Count:10825 |
| 2029-10825 |
1455 | if(x == start) evaluated: x == start yes Evaluation Count:2014 | yes Evaluation Count:15 |
| 15-2014 |
1456 | first_i = i; executed: first_i = i; Execution Count:2014 | 2014 |
1457 | if(x == end) evaluated: x == end yes Evaluation Count:2014 | yes Evaluation Count:15 |
| 15-2014 |
1458 | last_i = i; executed: last_i = i; Execution Count:2014 | 2014 |
1459 | if(x > start) evaluated: x > start yes Evaluation Count:15 | yes Evaluation Count:2014 |
| 15-2014 |
1460 | ret += sep; executed: ret += sep; Execution Count:15 | 15 |
1461 | ret += section; | - |
1462 | } executed: } Execution Count:2029 | 2029 |
1463 | if (!empty || !(flags & SectionSkipEmpty)) evaluated: !empty yes Evaluation Count:12780 | yes Evaluation Count:74 |
evaluated: !(flags & SectionSkipEmpty) yes Evaluation Count:12 | yes Evaluation Count:62 |
| 12-12780 |
1464 | x++; executed: x++; Execution Count:12792 | 12792 |
1465 | } executed: } Execution Count:12854 | 12854 |
1466 | if((flags & SectionIncludeLeadingSep) && first_i) evaluated: (flags & SectionIncludeLeadingSep) yes Evaluation Count:11 | yes Evaluation Count:1980 |
evaluated: first_i yes Evaluation Count:7 | yes Evaluation Count:4 |
| 4-1980 |
1467 | ret.prepend(sep); executed: ret.prepend(sep); Execution Count:7 | 7 |
1468 | if((flags & SectionIncludeTrailingSep) && last_i < sections.size()-1) evaluated: (flags & SectionIncludeTrailingSep) yes Evaluation Count:8 | yes Evaluation Count:1983 |
evaluated: last_i < sections.size()-1 yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-1983 |
1469 | ret += sep; executed: ret += sep; Execution Count:6 | 6 |
1470 | return ret; executed: return ret; Execution Count:1991 | 1991 |
1471 | } | - |
1472 | | - |
1473 | | - |
1474 | class qt_section_chunk { | - |
1475 | public: | - |
1476 | qt_section_chunk(int l, QString s) { length = l; string = s; } executed: } Execution Count:582 | 582 |
1477 | int length; | - |
1478 | QString string; | - |
1479 | }; | - |
1480 | | - |
1481 | static QString extractSections(const QList<qt_section_chunk> §ions, | - |
1482 | int start, | - |
1483 | int end, | - |
1484 | QString::SectionFlags flags) | - |
1485 | { | - |
1486 | if (start < 0) evaluated: start < 0 yes Evaluation Count:4 | yes Evaluation Count:70 |
| 4-70 |
1487 | start += sections.count(); executed: start += sections.count(); Execution Count:4 | 4 |
1488 | if (end < 0) evaluated: end < 0 yes Evaluation Count:10 | yes Evaluation Count:64 |
| 10-64 |
1489 | end += sections.count(); executed: end += sections.count(); Execution Count:10 | 10 |
1490 | | - |
1491 | QString ret; | - |
1492 | int x = 0; | - |
1493 | int first_i = start, last_i = end; | - |
1494 | for (int i = 0; x <= end && i < sections.size(); ++i) { evaluated: x <= end yes Evaluation Count:344 | yes Evaluation Count:72 |
evaluated: i < sections.size() yes Evaluation Count:342 | yes Evaluation Count:2 |
| 2-344 |
1495 | const qt_section_chunk §ion = sections.at(i); | - |
1496 | const bool empty = (section.length == section.string.length()); | - |
1497 | if (x >= start) { evaluated: x >= start yes Evaluation Count:170 | yes Evaluation Count:172 |
| 170-172 |
1498 | if (x == start) evaluated: x == start yes Evaluation Count:118 | yes Evaluation Count:52 |
| 52-118 |
1499 | first_i = i; executed: first_i = i; Execution Count:118 | 118 |
1500 | if (x == end) evaluated: x == end yes Evaluation Count:118 | yes Evaluation Count:52 |
| 52-118 |
1501 | last_i = i; executed: last_i = i; Execution Count:118 | 118 |
1502 | if (x != start) evaluated: x != start yes Evaluation Count:52 | yes Evaluation Count:118 |
| 52-118 |
1503 | ret += section.string; executed: ret += section.string; Execution Count:52 | 52 |
1504 | else | - |
1505 | ret += section.string.mid(section.length); executed: ret += section.string.mid(section.length); Execution Count:118 | 118 |
1506 | } | - |
1507 | if (!empty || !(flags & QString::SectionSkipEmpty)) evaluated: !empty yes Evaluation Count:170 | yes Evaluation Count:172 |
evaluated: !(flags & QString::SectionSkipEmpty) yes Evaluation Count:48 | yes Evaluation Count:124 |
| 48-172 |
1508 | x++; executed: x++; Execution Count:218 | 218 |
1509 | } executed: } Execution Count:342 | 342 |
1510 | | - |
1511 | if ((flags & QString::SectionIncludeLeadingSep) && first_i < sections.size()) { evaluated: (flags & QString::SectionIncludeLeadingSep) yes Evaluation Count:44 | yes Evaluation Count:30 |
evaluated: first_i < sections.size() yes Evaluation Count:42 | yes Evaluation Count:2 |
| 2-44 |
1512 | const qt_section_chunk §ion = sections.at(first_i); | - |
1513 | ret.prepend(section.string.left(section.length)); | - |
1514 | } executed: } Execution Count:42 | 42 |
1515 | | - |
1516 | if ((flags & QString::SectionIncludeTrailingSep) && last_i+1 <= sections.size()-1) { evaluated: (flags & QString::SectionIncludeTrailingSep) yes Evaluation Count:30 | yes Evaluation Count:44 |
evaluated: last_i+1 <= sections.size()-1 yes Evaluation Count:24 | yes Evaluation Count:6 |
| 6-44 |
1517 | const qt_section_chunk §ion = sections.at(last_i+1); | - |
1518 | ret += section.string.left(section.length); | - |
1519 | } executed: } Execution Count:24 | 24 |
1520 | | - |
1521 | return ret; executed: return ret; Execution Count:74 | 74 |
1522 | } | - |
1523 | QString QString::section(const QRegExp ®, int start, int end, SectionFlags flags) const | - |
1524 | { | - |
1525 | const QChar *uc = unicode(); | - |
1526 | if(!uc) partially evaluated: !uc no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
1527 | return QString(); never executed: return QString(); | 0 |
1528 | | - |
1529 | QRegExp sep(reg); | - |
1530 | sep.setCaseSensitivity((flags & SectionCaseInsensitiveSeps) ? Qt::CaseInsensitive | - |
1531 | : Qt::CaseSensitive); | - |
1532 | | - |
1533 | QList<qt_section_chunk> sections; | - |
1534 | int n = length(), m = 0, last_m = 0, last_len = 0; | - |
1535 | while ((m = sep.indexIn(*this, m)) != -1) { evaluated: (m = sep.indexIn(*this, m)) != -1 yes Evaluation Count:254 | yes Evaluation Count:37 |
| 37-254 |
1536 | sections.append(qt_section_chunk(last_len, QString(uc + last_m, m - last_m))); | - |
1537 | last_m = m; | - |
1538 | last_len = sep.matchedLength(); | - |
1539 | m += qMax(sep.matchedLength(), 1); | - |
1540 | } executed: } Execution Count:254 | 254 |
1541 | sections.append(qt_section_chunk(last_len, QString(uc + last_m, n - last_m))); | - |
1542 | | - |
1543 | return extractSections(sections, start, end, flags); executed: return extractSections(sections, start, end, flags); Execution Count:37 | 37 |
1544 | } | - |
1545 | QString QString::section(const QRegularExpression &re, int start, int end, SectionFlags flags) const | - |
1546 | { | - |
1547 | if (!re.isValid()) { partially evaluated: !re.isValid() no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
1548 | QMessageLogger("tools/qstring.cpp", 3597, __PRETTY_FUNCTION__).warning("QString::section: invalid QRegularExpression object"); | - |
1549 | return QString(); never executed: return QString(); | 0 |
1550 | } | - |
1551 | | - |
1552 | const QChar *uc = unicode(); | - |
1553 | if (!uc) partially evaluated: !uc no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
1554 | return QString(); never executed: return QString(); | 0 |
1555 | | - |
1556 | QRegularExpression sep(re); | - |
1557 | if (flags & SectionCaseInsensitiveSeps) evaluated: flags & SectionCaseInsensitiveSeps yes Evaluation Count:1 | yes Evaluation Count:36 |
| 1-36 |
1558 | sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption); executed: sep.setPatternOptions(sep.patternOptions() | QRegularExpression::CaseInsensitiveOption); Execution Count:1 | 1 |
1559 | | - |
1560 | QList<qt_section_chunk> sections; | - |
1561 | int n = length(), m = 0, last_m = 0, last_len = 0; | - |
1562 | QRegularExpressionMatchIterator iterator = sep.globalMatch(*this); | - |
1563 | while (iterator.hasNext()) { evaluated: iterator.hasNext() yes Evaluation Count:254 | yes Evaluation Count:37 |
| 37-254 |
1564 | QRegularExpressionMatch match = iterator.next(); | - |
1565 | m = match.capturedStart(); | - |
1566 | sections.append(qt_section_chunk(last_len, QString(uc + last_m, m - last_m))); | - |
1567 | last_m = m; | - |
1568 | last_len = match.capturedLength(); | - |
1569 | } executed: } Execution Count:254 | 254 |
1570 | sections.append(qt_section_chunk(last_len, QString(uc + last_m, n - last_m))); | - |
1571 | | - |
1572 | return extractSections(sections, start, end, flags); executed: return extractSections(sections, start, end, flags); Execution Count:37 | 37 |
1573 | } | - |
1574 | QString QString::left(int n) const | - |
1575 | { | - |
1576 | if (n >= d->size || n < 0) evaluated: n >= d->size yes Evaluation Count:80708 | yes Evaluation Count:24846 |
evaluated: n < 0 yes Evaluation Count:210 | yes Evaluation Count:24640 |
| 210-80708 |
1577 | return *this; executed: return *this; Execution Count:80918 | 80918 |
1578 | return QString((const QChar*) d->data(), n); executed: return QString((const QChar*) d->data(), n); Execution Count:24639 | 24639 |
1579 | } | - |
1580 | QString QString::right(int n) const | - |
1581 | { | - |
1582 | if (n >= d->size || n < 0) evaluated: n >= d->size yes Evaluation Count:41 | yes Evaluation Count:3214 |
evaluated: n < 0 yes Evaluation Count:1 | yes Evaluation Count:3213 |
| 1-3214 |
1583 | return *this; executed: return *this; Execution Count:42 | 42 |
1584 | return QString((const QChar*) d->data() + d->size - n, n); executed: return QString((const QChar*) d->data() + d->size - n, n); Execution Count:3213 | 3213 |
1585 | } | - |
1586 | QString QString::mid(int position, int n) const | - |
1587 | { | - |
1588 | if (position > d->size) evaluated: position > d->size yes Evaluation Count:12132 | yes Evaluation Count:346245 |
| 12132-346245 |
1589 | return QString(); executed: return QString(); Execution Count:12132 | 12132 |
1590 | if (position < 0) { evaluated: position < 0 yes Evaluation Count:34 | yes Evaluation Count:346202 |
| 34-346202 |
1591 | if (n < 0 || n + position >= d->size) evaluated: n < 0 yes Evaluation Count:7 | yes Evaluation Count:27 |
evaluated: n + position >= d->size yes Evaluation Count:12 | yes Evaluation Count:15 |
| 7-27 |
1592 | return *this; executed: return *this; Execution Count:19 | 19 |
1593 | if (n + position <= 0) evaluated: n + position <= 0 yes Evaluation Count:11 | yes Evaluation Count:4 |
| 4-11 |
1594 | return QString(); executed: return QString(); Execution Count:11 | 11 |
1595 | | - |
1596 | n += position; | - |
1597 | position = 0; | - |
1598 | } else if (n < 0 || n > d->size - position) evaluated: n < 0 yes Evaluation Count:169959 | yes Evaluation Count:176254 |
evaluated: n > d->size - position yes Evaluation Count:443 | yes Evaluation Count:175824 |
executed: } Execution Count:4 | 4-176254 |
1599 | n = d->size - position; executed: n = d->size - position; Execution Count:170402 | 170402 |
1600 | if (position == 0 && n == d->size) evaluated: position == 0 yes Evaluation Count:114174 | yes Evaluation Count:232054 |
evaluated: n == d->size yes Evaluation Count:89571 | yes Evaluation Count:24604 |
| 24604-232054 |
1601 | return *this; executed: return *this; Execution Count:89567 | 89567 |
1602 | return QString((const QChar*) d->data() + position, n); executed: return QString((const QChar*) d->data() + position, n); Execution Count:256657 | 256657 |
1603 | } | - |
1604 | bool QString::startsWith(const QString& s, Qt::CaseSensitivity cs) const | - |
1605 | { | - |
1606 | return qt_starts_with(isNull() ? 0 : unicode(), size(), | 67803 |
1607 | s.isNull() ? 0 : s.unicode(), s.size(), cs); executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs); Execution Count:67803 | 67803 |
1608 | } | - |
1609 | | - |
1610 | | - |
1611 | | - |
1612 | | - |
1613 | bool QString::startsWith(QLatin1String s, Qt::CaseSensitivity cs) const | - |
1614 | { | - |
1615 | return qt_starts_with(isNull() ? 0 : unicode(), size(), s, cs); executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), s, cs); Execution Count:661429 | 661429 |
1616 | } | - |
1617 | | - |
1618 | | - |
1619 | | - |
1620 | | - |
1621 | | - |
1622 | | - |
1623 | | - |
1624 | bool QString::startsWith(QChar c, Qt::CaseSensitivity cs) const | - |
1625 | { | - |
1626 | return d->size | 70516 |
1627 | && (cs == Qt::CaseSensitive | 70516 |
1628 | ? d->data()[0] == c | 70516 |
1629 | : foldCase(d->data()[0]) == foldCase(c.unicode())); executed: return d->size && (cs == Qt::CaseSensitive ? d->data()[0] == c : foldCase(d->data()[0]) == foldCase(c.unicode())); Execution Count:70516 | 70516 |
1630 | } | - |
1631 | bool QString::startsWith(const QStringRef &s, Qt::CaseSensitivity cs) const | - |
1632 | { | - |
1633 | return qt_starts_with(isNull() ? 0 : unicode(), size(), | 4 |
1634 | s.isNull() ? 0 : s.unicode(), s.size(), cs); executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs); Execution Count:4 | 4 |
1635 | } | - |
1636 | bool QString::endsWith(const QString& s, Qt::CaseSensitivity cs) const | - |
1637 | { | - |
1638 | return qt_ends_with(isNull() ? 0 : unicode(), size(), | 3446 |
1639 | s.isNull() ? 0 : s.unicode(), s.size(), cs); executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs); Execution Count:3446 | 3446 |
1640 | } | - |
1641 | bool QString::endsWith(const QStringRef &s, Qt::CaseSensitivity cs) const | - |
1642 | { | - |
1643 | return qt_ends_with(isNull() ? 0 : unicode(), size(), | 6 |
1644 | s.isNull() ? 0 : s.unicode(), s.size(), cs); executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), s.isNull() ? 0 : s.unicode(), s.size(), cs); Execution Count:6 | 6 |
1645 | } | - |
1646 | | - |
1647 | | - |
1648 | | - |
1649 | | - |
1650 | | - |
1651 | bool QString::endsWith(QLatin1String s, Qt::CaseSensitivity cs) const | - |
1652 | { | - |
1653 | return qt_ends_with(isNull() ? 0 : unicode(), size(), s, cs); executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), s, cs); Execution Count:5488 | 5488 |
1654 | } | - |
1655 | | - |
1656 | | - |
1657 | | - |
1658 | | - |
1659 | | - |
1660 | | - |
1661 | | - |
1662 | bool QString::endsWith(QChar c, Qt::CaseSensitivity cs) const | - |
1663 | { | - |
1664 | return d->size | 34209 |
1665 | && (cs == Qt::CaseSensitive | 34209 |
1666 | ? d->data()[d->size - 1] == c | 34209 |
1667 | : foldCase(d->data()[d->size - 1]) == foldCase(c.unicode())); executed: return d->size && (cs == Qt::CaseSensitive ? d->data()[d->size - 1] == c : foldCase(d->data()[d->size - 1]) == foldCase(c.unicode())); Execution Count:34209 | 34209 |
1668 | } | - |
1669 | | - |
1670 | | - |
1671 | | - |
1672 | static inline __m128i mergeQuestionMarks(__m128i chunk) | - |
1673 | { | - |
1674 | const __m128i questionMark = _mm_set1_epi16('?'); | - |
1675 | const __m128i signedBitOffset = _mm_set1_epi16(0x8000); | - |
1676 | const __m128i thresholdMask = _mm_set1_epi16(0xff + 0x8000); | - |
1677 | | - |
1678 | const __m128i signedChunk = _mm_add_epi16(chunk, signedBitOffset); | - |
1679 | const __m128i offLimitMask = _mm_cmpgt_epi16(signedChunk, thresholdMask); | - |
1680 | | - |
1681 | | - |
1682 | | - |
1683 | | - |
1684 | | - |
1685 | | - |
1686 | | - |
1687 | const __m128i offLimitQuestionMark = _mm_and_si128(offLimitMask, questionMark); | - |
1688 | | - |
1689 | | - |
1690 | | - |
1691 | const __m128i correctBytes = _mm_andnot_si128(offLimitMask, chunk); | - |
1692 | | - |
1693 | | - |
1694 | chunk = _mm_or_si128(correctBytes, offLimitQuestionMark); | - |
1695 | | - |
1696 | | - |
1697 | return chunk; executed: return chunk; Execution Count:6372818 | 6372818 |
1698 | } | - |
1699 | | - |
1700 | | - |
1701 | static QByteArray toLatin1_helper(const QChar *data, int length) | - |
1702 | { | - |
1703 | QByteArray ba; | - |
1704 | if (length) { evaluated: length yes Evaluation Count:4601506 | yes Evaluation Count:86084 |
| 86084-4601506 |
1705 | ba.resize(length); | - |
1706 | const ushort *src = reinterpret_cast<const ushort *>(data); | - |
1707 | uchar *dst = (uchar*) ba.data(); | - |
1708 | | - |
1709 | if (length >= 16) { evaluated: length >= 16 yes Evaluation Count:144118 | yes Evaluation Count:4457403 |
| 144118-4457403 |
1710 | const int chunkCount = length >> 4; | - |
1711 | | - |
1712 | for (int i = 0; i < chunkCount; ++i) { evaluated: i < chunkCount yes Evaluation Count:3186409 | yes Evaluation Count:144122 |
| 144122-3186409 |
1713 | __m128i chunk1 = _mm_loadu_si128((__m128i*)src); | - |
1714 | chunk1 = mergeQuestionMarks(chunk1); | - |
1715 | src += 8; | - |
1716 | | - |
1717 | __m128i chunk2 = _mm_loadu_si128((__m128i*)src); | - |
1718 | chunk2 = mergeQuestionMarks(chunk2); | - |
1719 | src += 8; | - |
1720 | | - |
1721 | | - |
1722 | const __m128i result = _mm_packus_epi16(chunk1, chunk2); | - |
1723 | | - |
1724 | _mm_storeu_si128((__m128i*)dst, result); | - |
1725 | dst += 16; | - |
1726 | } executed: } Execution Count:3186409 | 3186409 |
1727 | length = length % 16; | - |
1728 | } executed: } Execution Count:144122 | 144122 |
1729 | while (length--) { evaluated: length-- yes Evaluation Count:8534680 | yes Evaluation Count:4601511 |
| 4601511-8534680 |
1730 | *dst++ = (*src>0xff) ? '?' : (uchar) *src; evaluated: (*src>0xff) yes Evaluation Count:2590 | yes Evaluation Count:8532091 |
| 2590-8532091 |
1731 | ++src; | - |
1732 | } executed: } Execution Count:8534687 | 8534687 |
1733 | } executed: } Execution Count:4601510 | 4601510 |
1734 | return ba; executed: return ba; Execution Count:4687597 | 4687597 |
1735 | } | - |
1736 | QByteArray QString::toLatin1() const | - |
1737 | { | - |
1738 | return toLatin1_helper(unicode(), length()); executed: return toLatin1_helper(unicode(), length()); Execution Count:4687574 | 4687574 |
1739 | } | - |
1740 | QByteArray QString::toLocal8Bit() const | - |
1741 | { | - |
1742 | | - |
1743 | QTextCodec *localeCodec = QTextCodec::codecForLocale(); | - |
1744 | if (localeCodec) partially evaluated: localeCodec yes Evaluation Count:270823 | no Evaluation Count:0 |
| 0-270823 |
1745 | return localeCodec->fromUnicode(*this); executed: return localeCodec->fromUnicode(*this); Execution Count:270821 | 270821 |
1746 | | - |
1747 | return toLatin1(); never executed: return toLatin1(); | 0 |
1748 | } | - |
1749 | QByteArray QString::toUtf8() const | - |
1750 | { | - |
1751 | if (isNull()) evaluated: isNull() yes Evaluation Count:184 | yes Evaluation Count:24143 |
| 184-24143 |
1752 | return QByteArray(); executed: return QByteArray(); Execution Count:184 | 184 |
1753 | | - |
1754 | return QUtf8::convertFromUnicode(constData(), length(), 0); executed: return QUtf8::convertFromUnicode(constData(), length(), 0); Execution Count:24143 | 24143 |
1755 | } | - |
1756 | QVector<uint> QString::toUcs4() const | - |
1757 | { | - |
1758 | QVector<uint> v(length()); | - |
1759 | uint *a = v.data(); | - |
1760 | int len = toUcs4_helper(d->data(), length(), a); | - |
1761 | v.resize(len); | - |
1762 | return v; never executed: return v; | 0 |
1763 | } | - |
1764 | | - |
1765 | QString::Data *QString::fromLatin1_helper(const char *str, int size) | - |
1766 | { | - |
1767 | Data *d; | - |
1768 | if (!str) { evaluated: !str yes Evaluation Count:21 | yes Evaluation Count:3189227 |
| 21-3189227 |
1769 | d = Data::sharedNull(); | - |
1770 | } else if (size == 0 || (!*str && size < 0)) { evaluated: size == 0 yes Evaluation Count:45261 | yes Evaluation Count:3143966 |
evaluated: !*str yes Evaluation Count:279 | yes Evaluation Count:3143687 |
partially evaluated: size < 0 no Evaluation Count:0 | yes Evaluation Count:279 |
executed: } Execution Count:21 | 0-3143966 |
1771 | d = Data::allocate(0); | - |
1772 | } else { executed: } Execution Count:45261 | 45261 |
1773 | if (size < 0) partially evaluated: size < 0 no Evaluation Count:0 | yes Evaluation Count:3143966 |
| 0-3143966 |
1774 | size = qstrlen(str); never executed: size = qstrlen(str); | 0 |
1775 | d = Data::allocate(size + 1); | - |
1776 | do { if (!(d)) qBadAlloc(); } while (0); partially evaluated: !(d) no Evaluation Count:0 | yes Evaluation Count:3143964 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:3143964 |
never executed: qBadAlloc(); executed: } Execution Count:3143964 | 0-3143964 |
1777 | d->size = size; | - |
1778 | d->data()[size] = '\0'; | - |
1779 | ushort *dst = d->data(); | - |
1780 | | - |
1781 | | - |
1782 | | - |
1783 | | - |
1784 | | - |
1785 | if (size >= 16) { evaluated: size >= 16 yes Evaluation Count:793688 | yes Evaluation Count:2350277 |
| 793688-2350277 |
1786 | int chunkCount = size >> 4; | - |
1787 | const __m128i nullMask = _mm_set1_epi32(0); | - |
1788 | for (int i = 0; i < chunkCount; ++i) { evaluated: i < chunkCount yes Evaluation Count:2379221 | yes Evaluation Count:793688 |
| 793688-2379221 |
1789 | const __m128i chunk = _mm_loadu_si128((__m128i*)str); | - |
1790 | str += 16; | - |
1791 | | - |
1792 | | - |
1793 | const __m128i firstHalf = _mm_unpacklo_epi8(chunk, nullMask); | - |
1794 | _mm_storeu_si128((__m128i*)dst, firstHalf); | - |
1795 | dst += 8; | - |
1796 | | - |
1797 | | - |
1798 | const __m128i secondHalf = _mm_unpackhi_epi8 (chunk, nullMask); | - |
1799 | _mm_storeu_si128((__m128i*)dst, secondHalf); | - |
1800 | dst += 8; | - |
1801 | } executed: } Execution Count:2379221 | 2379221 |
1802 | size = size % 16; | - |
1803 | } executed: } Execution Count:793688 | 793688 |
1804 | | - |
1805 | while (size--) evaluated: size-- yes Evaluation Count:18717988 | yes Evaluation Count:3143962 |
| 3143962-18717988 |
1806 | *dst++ = (uchar)*str++; executed: *dst++ = (uchar)*str++; Execution Count:18717987 | 18717987 |
1807 | } executed: } Execution Count:3143962 | 3143962 |
1808 | return d; executed: return d; Execution Count:3189244 | 3189244 |
1809 | } | - |
1810 | | - |
1811 | QString::Data *QString::fromAscii_helper(const char *str, int size) | - |
1812 | { | - |
1813 | QString s = fromUtf8(str, size); | - |
1814 | s.d->ref.ref(); | - |
1815 | return s.d; executed: return s.d; Execution Count:1653154 | 1653154 |
1816 | } | - |
1817 | QString QString::fromLocal8Bit_helper(const char *str, int size) | - |
1818 | { | - |
1819 | if (!str) partially evaluated: !str no Evaluation Count:0 | yes Evaluation Count:94667 |
| 0-94667 |
1820 | return QString(); never executed: return QString(); | 0 |
1821 | if (size == 0 || (!*str && size < 0)) { evaluated: size == 0 yes Evaluation Count:3073 | yes Evaluation Count:91593 |
evaluated: !*str yes Evaluation Count:3 | yes Evaluation Count:91590 |
partially evaluated: size < 0 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-91593 |
1822 | QStringDataPtr empty = { Data::allocate(0) }; | - |
1823 | return QString(empty); executed: return QString(empty); Execution Count:3073 | 3073 |
1824 | } | - |
1825 | | - |
1826 | if (size < 0) partially evaluated: size < 0 no Evaluation Count:0 | yes Evaluation Count:91593 |
| 0-91593 |
1827 | size = qstrlen(str); never executed: size = qstrlen(str); | 0 |
1828 | QTextCodec *codec = QTextCodec::codecForLocale(); | - |
1829 | if (codec) partially evaluated: codec yes Evaluation Count:91593 | no Evaluation Count:0 |
| 0-91593 |
1830 | return codec->toUnicode(str, size); executed: return codec->toUnicode(str, size); Execution Count:91594 | 91594 |
1831 | | - |
1832 | return fromLatin1(str, size); never executed: return fromLatin1(str, size); | 0 |
1833 | } | - |
1834 | QString QString::fromUtf8_helper(const char *str, int size) | - |
1835 | { | - |
1836 | if (!str) evaluated: !str yes Evaluation Count:4989 | yes Evaluation Count:7429004 |
| 4989-7429004 |
1837 | return QString(); executed: return QString(); Execution Count:4989 | 4989 |
1838 | | - |
1839 | qt_noop(); | - |
1840 | return QUtf8::convertToUnicode(str, size, 0); executed: return QUtf8::convertToUnicode(str, size, 0); Execution Count:7429000 | 7429000 |
1841 | } | - |
1842 | QString QString::fromUtf16(const ushort *unicode, int size) | - |
1843 | { | - |
1844 | if (!unicode) partially evaluated: !unicode no Evaluation Count:0 | yes Evaluation Count:106 |
| 0-106 |
1845 | return QString(); never executed: return QString(); | 0 |
1846 | if (size < 0) { evaluated: size < 0 yes Evaluation Count:69 | yes Evaluation Count:37 |
| 37-69 |
1847 | size = 0; | - |
1848 | while (unicode[size] != 0) evaluated: unicode[size] != 0 yes Evaluation Count:172 | yes Evaluation Count:69 |
| 69-172 |
1849 | ++size; executed: ++size; Execution Count:172 | 172 |
1850 | } executed: } Execution Count:69 | 69 |
1851 | return QUtf16::convertToUnicode((const char *)unicode, size*2, 0); executed: return QUtf16::convertToUnicode((const char *)unicode, size*2, 0); Execution Count:106 | 106 |
1852 | } | - |
1853 | QString QString::fromUcs4(const uint *unicode, int size) | - |
1854 | { | - |
1855 | if (!unicode) partially evaluated: !unicode no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1856 | return QString(); never executed: return QString(); | 0 |
1857 | if (size < 0) { evaluated: size < 0 yes Evaluation Count:2 | yes Evaluation Count:18 |
| 2-18 |
1858 | size = 0; | - |
1859 | while (unicode[size] != 0) evaluated: unicode[size] != 0 yes Evaluation Count:28 | yes Evaluation Count:2 |
| 2-28 |
1860 | ++size; executed: ++size; Execution Count:28 | 28 |
1861 | } executed: } Execution Count:2 | 2 |
1862 | return QUtf32::convertToUnicode((const char *)unicode, size*4, 0); executed: return QUtf32::convertToUnicode((const char *)unicode, size*4, 0); Execution Count:20 | 20 |
1863 | } | - |
1864 | QString& QString::setUnicode(const QChar *unicode, int size) | - |
1865 | { | - |
1866 | resize(size); | - |
1867 | if (unicode && size) | 0 |
1868 | memcpy(d->data(), unicode, size * sizeof(QChar)); never executed: memcpy(d->data(), unicode, size * sizeof(QChar)); | 0 |
1869 | return *this; never executed: return *this; | 0 |
1870 | } | - |
1871 | QString QString::simplified() const | - |
1872 | { | - |
1873 | if (d->size == 0) evaluated: d->size == 0 yes Evaluation Count:1650 | yes Evaluation Count:78429 |
| 1650-78429 |
1874 | return *this; executed: return *this; Execution Count:1650 | 1650 |
1875 | | - |
1876 | const QChar * const start = reinterpret_cast<QChar *>(d->data()); | - |
1877 | const QChar *from = start; | - |
1878 | const QChar *fromEnd = start + d->size; | - |
1879 | for(;;) { | - |
1880 | QChar ch = *from; | - |
1881 | if (!ch.isSpace()) evaluated: !ch.isSpace() yes Evaluation Count:41907 | yes Evaluation Count:210344 |
| 41907-210344 |
1882 | break; executed: break; Execution Count:41907 | 41907 |
1883 | if (++from == fromEnd) { evaluated: ++from == fromEnd yes Evaluation Count:36522 | yes Evaluation Count:173822 |
| 36522-173822 |
1884 | | - |
1885 | QStringDataPtr empty = { Data::allocate(0) }; | - |
1886 | return QString(empty); executed: return QString(empty); Execution Count:36522 | 36522 |
1887 | } | - |
1888 | } executed: } Execution Count:173822 | 173822 |
1889 | | - |
1890 | | - |
1891 | | - |
1892 | while (fromEnd[-1].isSpace()) evaluated: fromEnd[-1].isSpace() yes Evaluation Count:12390 | yes Evaluation Count:41907 |
| 12390-41907 |
1893 | fromEnd--; executed: fromEnd--; Execution Count:12390 | 12390 |
1894 | | - |
1895 | | - |
1896 | const QChar *copyFrom = from; | - |
1897 | int copyCount; | - |
1898 | for(;;) { | - |
1899 | if (++from == fromEnd) { evaluated: ++from == fromEnd yes Evaluation Count:39207 | yes Evaluation Count:677672 |
| 39207-677672 |
1900 | | - |
1901 | return mid(copyFrom - start, from - copyFrom); executed: return mid(copyFrom - start, from - copyFrom); Execution Count:39207 | 39207 |
1902 | } | - |
1903 | QChar ch = *from; | - |
1904 | if (!ch.isSpace()) evaluated: !ch.isSpace() yes Evaluation Count:643642 | yes Evaluation Count:34030 |
| 34030-643642 |
1905 | continue; executed: continue; Execution Count:643642 | 643642 |
1906 | if (ch != QLatin1Char(' ')) { evaluated: ch != QLatin1Char(' ') yes Evaluation Count:1658 | yes Evaluation Count:32372 |
| 1658-32372 |
1907 | copyCount = from - copyFrom; | - |
1908 | break; executed: break; Execution Count:1658 | 1658 |
1909 | } | - |
1910 | ch = *++from; | - |
1911 | if (ch.isSpace()) { evaluated: ch.isSpace() yes Evaluation Count:1042 | yes Evaluation Count:31330 |
| 1042-31330 |
1912 | copyCount = from - copyFrom - 1; | - |
1913 | break; executed: break; Execution Count:1042 | 1042 |
1914 | } | - |
1915 | } executed: } Execution Count:31330 | 31330 |
1916 | | - |
1917 | | - |
1918 | | - |
1919 | | - |
1920 | QString result((fromEnd - from) + copyCount, Qt::Uninitialized); | - |
1921 | QChar *to = reinterpret_cast<QChar *>(result.d->data()); | - |
1922 | ::memcpy(to, copyFrom, copyCount * 2); | - |
1923 | to += copyCount; | - |
1924 | fromEnd--; | - |
1925 | QChar ch; | - |
1926 | for(;;) { | - |
1927 | *to++ = QLatin1Char(' '); | - |
1928 | do { | - |
1929 | ch = *++from; | - |
1930 | } while (ch.isSpace()); evaluated: ch.isSpace() yes Evaluation Count:18816 | yes Evaluation Count:44121 |
executed: } Execution Count:62937 | 18816-62937 |
1931 | if (from == fromEnd) evaluated: from == fromEnd yes Evaluation Count:306 | yes Evaluation Count:43815 |
| 306-43815 |
1932 | break; executed: break; Execution Count:306 | 306 |
1933 | do { | - |
1934 | *to++ = ch; | - |
1935 | ch = *++from; | - |
1936 | if (from == fromEnd) evaluated: from == fromEnd yes Evaluation Count:2394 | yes Evaluation Count:258519 |
| 2394-258519 |
1937 | goto done; executed: goto done; Execution Count:2394 | 2394 |
1938 | } while (!ch.isSpace()); evaluated: !ch.isSpace() yes Evaluation Count:217098 | yes Evaluation Count:41421 |
executed: } Execution Count:258519 | 41421-258519 |
1939 | | - |
1940 | } executed: } Execution Count:41421 | 41421 |
1941 | done: code before this statement executed: done: Execution Count:306 | 306 |
1942 | *to++ = ch; | - |
1943 | result.truncate(to - reinterpret_cast<QChar *>(result.d->data())); | - |
1944 | return result; executed: return result; Execution Count:2700 | 2700 |
1945 | } | - |
1946 | QString QString::trimmed() const | - |
1947 | { | - |
1948 | if (d->size == 0) evaluated: d->size == 0 yes Evaluation Count:2651 | yes Evaluation Count:14010 |
| 2651-14010 |
1949 | return *this; executed: return *this; Execution Count:2651 | 2651 |
1950 | const QChar *s = (const QChar*)d->data(); | - |
1951 | if (!s->isSpace() && !s[d->size-1].isSpace()) evaluated: !s->isSpace() yes Evaluation Count:13277 | yes Evaluation Count:733 |
evaluated: !s[d->size-1].isSpace() yes Evaluation Count:11452 | yes Evaluation Count:1825 |
| 733-13277 |
1952 | return *this; executed: return *this; Execution Count:11452 | 11452 |
1953 | int start = 0; | - |
1954 | int end = d->size - 1; | - |
1955 | while (start<=end && s[start].isSpace()) evaluated: start<=end yes Evaluation Count:4323 | yes Evaluation Count:11 |
evaluated: s[start].isSpace() yes Evaluation Count:1776 | yes Evaluation Count:2547 |
| 11-4323 |
1956 | start++; executed: start++; Execution Count:1776 | 1776 |
1957 | if (start <= end) { evaluated: start <= end yes Evaluation Count:2547 | yes Evaluation Count:11 |
| 11-2547 |
1958 | while (end && s[end].isSpace()) evaluated: end yes Evaluation Count:6593 | yes Evaluation Count:3 |
evaluated: s[end].isSpace() yes Evaluation Count:4049 | yes Evaluation Count:2544 |
| 3-6593 |
1959 | end--; executed: end--; Execution Count:4049 | 4049 |
1960 | } executed: } Execution Count:2547 | 2547 |
1961 | int l = end - start + 1; | - |
1962 | if (l <= 0) { evaluated: l <= 0 yes Evaluation Count:11 | yes Evaluation Count:2547 |
| 11-2547 |
1963 | QStringDataPtr empty = { Data::allocate(0) }; | - |
1964 | return QString(empty); executed: return QString(empty); Execution Count:11 | 11 |
1965 | } | - |
1966 | return QString(s + start, l); executed: return QString(s + start, l); Execution Count:2547 | 2547 |
1967 | } | - |
1968 | void QString::truncate(int pos) | - |
1969 | { | - |
1970 | if (pos < d->size) evaluated: pos < d->size yes Evaluation Count:48682631 | yes Evaluation Count:17790 |
| 17790-48682631 |
1971 | resize(pos); executed: resize(pos); Execution Count:48682634 | 48682634 |
1972 | } executed: } Execution Count:48700431 | 48700431 |
1973 | void QString::chop(int n) | - |
1974 | { | - |
1975 | if (n > 0) evaluated: n > 0 yes Evaluation Count:17183 | yes Evaluation Count:6 |
| 6-17183 |
1976 | resize(d->size - n); executed: resize(d->size - n); Execution Count:17183 | 17183 |
1977 | } executed: } Execution Count:17189 | 17189 |
1978 | QString& QString::fill(QChar ch, int size) | - |
1979 | { | - |
1980 | resize(size < 0 ? d->size : size); | - |
1981 | if (d->size) { evaluated: d->size yes Evaluation Count:11474 | yes Evaluation Count:5399 |
| 5399-11474 |
1982 | QChar *i = (QChar*)d->data() + d->size; | - |
1983 | QChar *b = (QChar*)d->data(); | - |
1984 | while (i != b) evaluated: i != b yes Evaluation Count:2696139 | yes Evaluation Count:11474 |
| 11474-2696139 |
1985 | *--i = ch; executed: *--i = ch; Execution Count:2696139 | 2696139 |
1986 | } executed: } Execution Count:11474 | 11474 |
1987 | return *this; executed: return *this; Execution Count:16873 | 16873 |
1988 | } | - |
1989 | int QString::compare(const QString &other, Qt::CaseSensitivity cs) const | - |
1990 | { | - |
1991 | if (cs == Qt::CaseSensitive) evaluated: cs == Qt::CaseSensitive yes Evaluation Count:152468 | yes Evaluation Count:3726434 |
| 152468-3726434 |
1992 | return ucstrcmp(constData(), length(), other.constData(), other.length()); executed: return ucstrcmp(constData(), length(), other.constData(), other.length()); Execution Count:152468 | 152468 |
1993 | return ucstricmp(d->data(), d->data() + d->size, other.d->data(), other.d->data() + other.d->size); executed: return ucstricmp(d->data(), d->data() + d->size, other.d->data(), other.d->data() + other.d->size); Execution Count:3726434 | 3726434 |
1994 | } | - |
1995 | | - |
1996 | | - |
1997 | | - |
1998 | | - |
1999 | | - |
2000 | int QString::compare_helper(const QChar *data1, int length1, const QChar *data2, int length2, | - |
2001 | Qt::CaseSensitivity cs) | - |
2002 | { | - |
2003 | if (cs == Qt::CaseSensitive) evaluated: cs == Qt::CaseSensitive yes Evaluation Count:194383 | yes Evaluation Count:88 |
| 88-194383 |
2004 | return ucstrcmp(data1, length1, data2, length2); executed: return ucstrcmp(data1, length1, data2, length2); Execution Count:194383 | 194383 |
2005 | register const ushort *s1 = reinterpret_cast<const ushort *>(data1); | - |
2006 | register const ushort *s2 = reinterpret_cast<const ushort *>(data2); | - |
2007 | return ucstricmp(s1, s1 + length1, s2, s2 + length2); executed: return ucstricmp(s1, s1 + length1, s2, s2 + length2); Execution Count:88 | 88 |
2008 | } | - |
2009 | | - |
2010 | | - |
2011 | | - |
2012 | | - |
2013 | | - |
2014 | | - |
2015 | | - |
2016 | int QString::compare(QLatin1String other, Qt::CaseSensitivity cs) const | - |
2017 | { | - |
2018 | return compare_helper(unicode(), length(), other, cs); executed: return compare_helper(unicode(), length(), other, cs); Execution Count:6721 | 6721 |
2019 | } | - |
2020 | int QString::compare_helper(const QChar *data1, int length1, const char *data2, int length2, | - |
2021 | Qt::CaseSensitivity cs) | - |
2022 | { | - |
2023 | | - |
2024 | const QString s2 = QString::fromUtf8(data2, length2 == -1 ? (data2 ? int(strlen(data2)) : -1) : length2); | - |
2025 | return compare_helper(data1, length1, s2.constData(), s2.size(), cs); executed: return compare_helper(data1, length1, s2.constData(), s2.size(), cs); Execution Count:194235 | 194235 |
2026 | } | - |
2027 | int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, | - |
2028 | Qt::CaseSensitivity cs) | - |
2029 | { | - |
2030 | const ushort *uc = reinterpret_cast<const ushort *>(data1); | - |
2031 | const ushort *uce = uc + length1; | - |
2032 | const uchar *c = (uchar *)s2.latin1(); | - |
2033 | | - |
2034 | if (!c) partially evaluated: !c no Evaluation Count:0 | yes Evaluation Count:6779 |
| 0-6779 |
2035 | return length1; never executed: return length1; | 0 |
2036 | | - |
2037 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:643 | yes Evaluation Count:6136 |
| 643-6136 |
2038 | const ushort *e = uc + length1; | - |
2039 | if (s2.size() < length1) evaluated: s2.size() < length1 yes Evaluation Count:339 | yes Evaluation Count:304 |
| 304-339 |
2040 | e = uc + s2.size(); executed: e = uc + s2.size(); Execution Count:339 | 339 |
2041 | while (uc < e) { evaluated: uc < e yes Evaluation Count:717 | yes Evaluation Count:619 |
| 619-717 |
2042 | int diff = *uc - *c; | - |
2043 | if (diff) evaluated: diff yes Evaluation Count:24 | yes Evaluation Count:693 |
| 24-693 |
2044 | return diff; executed: return diff; Execution Count:24 | 24 |
2045 | uc++, c++; | - |
2046 | } executed: } Execution Count:693 | 693 |
2047 | | - |
2048 | if (uc == uce) { evaluated: uc == uce yes Evaluation Count:286 | yes Evaluation Count:333 |
| 286-333 |
2049 | if (c == (const uchar *)s2.latin1() + s2.size()) evaluated: c == (const uchar *)s2.latin1() + s2.size() yes Evaluation Count:269 | yes Evaluation Count:17 |
| 17-269 |
2050 | return 0; executed: return 0; Execution Count:269 | 269 |
2051 | return -1; executed: return -1; Execution Count:17 | 17 |
2052 | } | - |
2053 | return 1; executed: return 1; Execution Count:333 | 333 |
2054 | } else { | - |
2055 | return ucstricmp(uc, uce, c, c + s2.size()); executed: return ucstricmp(uc, uce, c, c + s2.size()); Execution Count:6136 | 6136 |
2056 | } | - |
2057 | } | - |
2058 | int QString::localeAwareCompare(const QString &other) const | - |
2059 | { | - |
2060 | return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); executed: return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); Execution Count:27785 | 27785 |
2061 | } | - |
2062 | | - |
2063 | | - |
2064 | | - |
2065 | | - |
2066 | | - |
2067 | int QString::localeAwareCompare_helper(const QChar *data1, int length1, | - |
2068 | const QChar *data2, int length2) | - |
2069 | { | - |
2070 | | - |
2071 | if (length1 == 0 || length2 == 0) evaluated: length1 == 0 yes Evaluation Count:7 | yes Evaluation Count:27814 |
partially evaluated: length2 == 0 no Evaluation Count:0 | yes Evaluation Count:27814 |
| 0-27814 |
2072 | return ucstrcmp(data1, length1, data2, length2); executed: return ucstrcmp(data1, length1, data2, length2); Execution Count:7 | 7 |
2073 | QCollator collator; | - |
2074 | return collator.compare(data1, length1, data2, length2); executed: return collator.compare(data1, length1, data2, length2); Execution Count:27814 | 27814 |
2075 | } | - |
2076 | const ushort *QString::utf16() const | - |
2077 | { | - |
2078 | if (((d)->offset != sizeof(QStringData))) { partially evaluated: ((d)->offset != sizeof(QStringData)) no Evaluation Count:0 | yes Evaluation Count:117990 |
| 0-117990 |
2079 | | - |
2080 | const_cast<QString*>(this)->reallocData(uint(d->size) + 1u); | - |
2081 | } | 0 |
2082 | return d->data(); executed: return d->data(); Execution Count:117990 | 117990 |
2083 | } | - |
2084 | QString QString::leftJustified(int width, QChar fill, bool truncate) const | - |
2085 | { | - |
2086 | QString result; | - |
2087 | int len = length(); | - |
2088 | int padlen = width - len; | - |
2089 | if (padlen > 0) { evaluated: padlen > 0 yes Evaluation Count:801 | yes Evaluation Count:4209 |
| 801-4209 |
2090 | result.resize(len+padlen); | - |
2091 | if (len) evaluated: len yes Evaluation Count:800 | yes Evaluation Count:1 |
| 1-800 |
2092 | memcpy(result.d->data(), d->data(), sizeof(QChar)*len); executed: memcpy(result.d->data(), d->data(), sizeof(QChar)*len); Execution Count:800 | 800 |
2093 | QChar *uc = (QChar*)result.d->data() + len; | - |
2094 | while (padlen--) evaluated: padlen-- yes Evaluation Count:32176 | yes Evaluation Count:801 |
| 801-32176 |
2095 | * uc++ = fill; executed: * uc++ = fill; Execution Count:32176 | 32176 |
2096 | } else { executed: } Execution Count:801 | 801 |
2097 | if (truncate) evaluated: truncate yes Evaluation Count:4 | yes Evaluation Count:4205 |
| 4-4205 |
2098 | result = left(width); executed: result = left(width); Execution Count:4 | 4 |
2099 | else | - |
2100 | result = *this; executed: result = *this; Execution Count:4205 | 4205 |
2101 | } | - |
2102 | return result; executed: return result; Execution Count:5010 | 5010 |
2103 | } | - |
2104 | QString QString::rightJustified(int width, QChar fill, bool truncate) const | - |
2105 | { | - |
2106 | QString result; | - |
2107 | int len = length(); | - |
2108 | int padlen = width - len; | - |
2109 | if (padlen > 0) { evaluated: padlen > 0 yes Evaluation Count:34039 | yes Evaluation Count:78523 |
| 34039-78523 |
2110 | result.resize(len+padlen); | - |
2111 | QChar *uc = (QChar*)result.d->data(); | - |
2112 | while (padlen--) evaluated: padlen-- yes Evaluation Count:78569 | yes Evaluation Count:34039 |
| 34039-78569 |
2113 | * uc++ = fill; executed: * uc++ = fill; Execution Count:78569 | 78569 |
2114 | if (len) evaluated: len yes Evaluation Count:34038 | yes Evaluation Count:1 |
| 1-34038 |
2115 | memcpy(uc, d->data(), sizeof(QChar)*len); executed: memcpy(uc, d->data(), sizeof(QChar)*len); Execution Count:34038 | 34038 |
2116 | } else { executed: } Execution Count:34039 | 34039 |
2117 | if (truncate) evaluated: truncate yes Evaluation Count:54639 | yes Evaluation Count:23884 |
| 23884-54639 |
2118 | result = left(width); executed: result = left(width); Execution Count:54639 | 54639 |
2119 | else | - |
2120 | result = *this; executed: result = *this; Execution Count:23884 | 23884 |
2121 | } | - |
2122 | return result; executed: return result; Execution Count:112562 | 112562 |
2123 | } | - |
2124 | QString QString::toLower() const | - |
2125 | { | - |
2126 | const ushort *p = d->data(); | - |
2127 | if (!p) partially evaluated: !p no Evaluation Count:0 | yes Evaluation Count:107471 |
| 0-107471 |
2128 | return *this; never executed: return *this; | 0 |
2129 | | - |
2130 | const ushort *e = p + d->size; | - |
2131 | | - |
2132 | while (e != p && QChar::isHighSurrogate(*(e - 1))) evaluated: e != p yes Evaluation Count:105429 | yes Evaluation Count:2044 |
evaluated: QChar::isHighSurrogate(*(e - 1)) yes Evaluation Count:2 | yes Evaluation Count:105427 |
| 2-105429 |
2133 | --e; executed: --e; Execution Count:2 | 2 |
2134 | | - |
2135 | const QUnicodeTables::Properties *prop; | - |
2136 | while (p != e) { evaluated: p != e yes Evaluation Count:203120 | yes Evaluation Count:28184 |
| 28184-203120 |
2137 | if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) { evaluated: QChar::isHighSurrogate(*p) yes Evaluation Count:4 | yes Evaluation Count:203116 |
partially evaluated: QChar::isLowSurrogate(p[1]) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-203116 |
2138 | ushort high = *p++; | - |
2139 | prop = qGetProp(QChar::surrogateToUcs4(high, *p)); | - |
2140 | } else { executed: } Execution Count:4 | 4 |
2141 | prop = qGetProp(*p); | - |
2142 | } executed: } Execution Count:203116 | 203116 |
2143 | if (prop->lowerCaseDiff) { evaluated: prop->lowerCaseDiff yes Evaluation Count:79287 | yes Evaluation Count:123833 |
| 79287-123833 |
2144 | if (QChar::isLowSurrogate(*p)) evaluated: QChar::isLowSurrogate(*p) yes Evaluation Count:4 | yes Evaluation Count:79283 |
| 4-79283 |
2145 | --p; executed: --p; Execution Count:4 | 4 |
2146 | QString s(d->size, Qt::Uninitialized); | - |
2147 | memcpy(s.d->data(), d->data(), (p - d->data())*sizeof(ushort)); | - |
2148 | ushort *pp = s.d->data() + (p - d->data()); | - |
2149 | while (p != e) { evaluated: p != e yes Evaluation Count:644369 | yes Evaluation Count:79287 |
| 79287-644369 |
2150 | if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) { evaluated: QChar::isHighSurrogate(*p) yes Evaluation Count:7 | yes Evaluation Count:644362 |
partially evaluated: QChar::isLowSurrogate(p[1]) yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-644362 |
2151 | *pp = *p++; | - |
2152 | prop = qGetProp(QChar::surrogateToUcs4(*pp++, *p)); | - |
2153 | } else { executed: } Execution Count:7 | 7 |
2154 | prop = qGetProp(*p); | - |
2155 | } executed: } Execution Count:644362 | 644362 |
2156 | if (prop->lowerCaseSpecial) { evaluated: prop->lowerCaseSpecial yes Evaluation Count:1 | yes Evaluation Count:644368 |
| 1-644368 |
2157 | const ushort *specialCase = specialCaseMap + prop->lowerCaseDiff; | - |
2158 | ushort length = *specialCase++; | - |
2159 | int pos = pp - s.d->data(); | - |
2160 | s.resize(s.d->size + length - 1); | - |
2161 | pp = s.d->data() + pos; | - |
2162 | while (length--) evaluated: length-- yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
2163 | *pp++ = *specialCase++; executed: *pp++ = *specialCase++; Execution Count:2 | 2 |
2164 | } else { executed: } Execution Count:1 | 1 |
2165 | *pp++ = *p + prop->lowerCaseDiff; | - |
2166 | } executed: } Execution Count:644368 | 644368 |
2167 | ++p; | - |
2168 | } executed: } Execution Count:644369 | 644369 |
2169 | | - |
2170 | | - |
2171 | while (e != d->data() + d->size) evaluated: e != d->data() + d->size yes Evaluation Count:2 | yes Evaluation Count:79287 |
| 2-79287 |
2172 | *pp++ = *e++; executed: *pp++ = *e++; Execution Count:2 | 2 |
2173 | | - |
2174 | return s; executed: return s; Execution Count:79287 | 79287 |
2175 | } | - |
2176 | ++p; | - |
2177 | } executed: } Execution Count:123833 | 123833 |
2178 | return *this; executed: return *this; Execution Count:28184 | 28184 |
2179 | } | - |
2180 | | - |
2181 | | - |
2182 | | - |
2183 | | - |
2184 | | - |
2185 | QString QString::toCaseFolded() const | - |
2186 | { | - |
2187 | const ushort *p = d->data(); | - |
2188 | if (!p) partially evaluated: !p no Evaluation Count:0 | yes Evaluation Count:131114 |
| 0-131114 |
2189 | return *this; never executed: return *this; | 0 |
2190 | | - |
2191 | const ushort *e = p + d->size; | - |
2192 | | - |
2193 | while (e != p && QChar::isHighSurrogate(*(e - 1))) evaluated: e != p yes Evaluation Count:131110 | yes Evaluation Count:2054 |
evaluated: QChar::isHighSurrogate(*(e - 1)) yes Evaluation Count:2050 | yes Evaluation Count:129060 |
| 2050-131110 |
2194 | --e; executed: --e; Execution Count:2050 | 2050 |
2195 | | - |
2196 | const QUnicodeTables::Properties *prop; | - |
2197 | while (p != e) { evaluated: p != e yes Evaluation Count:129113 | yes Evaluation Count:129061 |
| 129061-129113 |
2198 | if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) { evaluated: QChar::isHighSurrogate(*p) yes Evaluation Count:8 | yes Evaluation Count:129105 |
partially evaluated: QChar::isLowSurrogate(p[1]) yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-129105 |
2199 | ushort high = *p++; | - |
2200 | prop = qGetProp(QChar::surrogateToUcs4(high, *p)); | - |
2201 | } else { executed: } Execution Count:8 | 8 |
2202 | prop = qGetProp(*p); | - |
2203 | } executed: } Execution Count:129105 | 129105 |
2204 | if (prop->caseFoldDiff) { evaluated: prop->caseFoldDiff yes Evaluation Count:2053 | yes Evaluation Count:127060 |
| 2053-127060 |
2205 | if (QChar::isLowSurrogate(*p)) evaluated: QChar::isLowSurrogate(*p) yes Evaluation Count:6 | yes Evaluation Count:2047 |
| 6-2047 |
2206 | --p; executed: --p; Execution Count:6 | 6 |
2207 | QString s(d->size, Qt::Uninitialized); | - |
2208 | memcpy(s.d->data(), d->data(), (p - d->data())*sizeof(ushort)); | - |
2209 | ushort *pp = s.d->data() + (p - d->data()); | - |
2210 | while (p != e) { evaluated: p != e yes Evaluation Count:2081 | yes Evaluation Count:2053 |
| 2053-2081 |
2211 | if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) { evaluated: QChar::isHighSurrogate(*p) yes Evaluation Count:9 | yes Evaluation Count:2072 |
partially evaluated: QChar::isLowSurrogate(p[1]) yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-2072 |
2212 | *pp = *p++; | - |
2213 | prop = qGetProp(QChar::surrogateToUcs4(*pp++, *p)); | - |
2214 | } else { executed: } Execution Count:9 | 9 |
2215 | prop = qGetProp(*p); | - |
2216 | } executed: } Execution Count:2072 | 2072 |
2217 | if (prop->caseFoldSpecial) { evaluated: prop->caseFoldSpecial yes Evaluation Count:8 | yes Evaluation Count:2073 |
| 8-2073 |
2218 | const ushort *specialCase = specialCaseMap + prop->caseFoldDiff; | - |
2219 | ushort length = *specialCase++; | - |
2220 | qt_noop(); | - |
2221 | (void)length; | - |
2222 | *pp++ = *specialCase; | - |
2223 | | - |
2224 | } else { executed: } Execution Count:8 | 8 |
2225 | *pp++ = *p + prop->caseFoldDiff; | - |
2226 | } executed: } Execution Count:2073 | 2073 |
2227 | ++p; | - |
2228 | } executed: } Execution Count:2081 | 2081 |
2229 | | - |
2230 | | - |
2231 | while (e != d->data() + d->size) evaluated: e != d->data() + d->size yes Evaluation Count:2 | yes Evaluation Count:2053 |
| 2-2053 |
2232 | *pp++ = *e++; executed: *pp++ = *e++; Execution Count:2 | 2 |
2233 | | - |
2234 | return s; executed: return s; Execution Count:2053 | 2053 |
2235 | } | - |
2236 | ++p; | - |
2237 | } executed: } Execution Count:127060 | 127060 |
2238 | return *this; executed: return *this; Execution Count:129061 | 129061 |
2239 | } | - |
2240 | QString QString::toUpper() const | - |
2241 | { | - |
2242 | const ushort *p = d->data(); | - |
2243 | if (!p) partially evaluated: !p no Evaluation Count:0 | yes Evaluation Count:8882 |
| 0-8882 |
2244 | return *this; never executed: return *this; | 0 |
2245 | | - |
2246 | const ushort *e = p + d->size; | - |
2247 | | - |
2248 | while (e != p && QChar::isHighSurrogate(*(e - 1))) evaluated: e != p yes Evaluation Count:8882 | yes Evaluation Count:2 |
evaluated: QChar::isHighSurrogate(*(e - 1)) yes Evaluation Count:2 | yes Evaluation Count:8880 |
| 2-8882 |
2249 | --e; executed: --e; Execution Count:2 | 2 |
2250 | | - |
2251 | const QUnicodeTables::Properties *prop; | - |
2252 | while (p != e) { evaluated: p != e yes Evaluation Count:91570 | yes Evaluation Count:3967 |
| 3967-91570 |
2253 | if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) { evaluated: QChar::isHighSurrogate(*p) yes Evaluation Count:4 | yes Evaluation Count:91566 |
partially evaluated: QChar::isLowSurrogate(p[1]) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-91566 |
2254 | ushort high = *p++; | - |
2255 | prop = qGetProp(QChar::surrogateToUcs4(high, *p)); | - |
2256 | } else { executed: } Execution Count:4 | 4 |
2257 | prop = qGetProp(*p); | - |
2258 | } executed: } Execution Count:91566 | 91566 |
2259 | if (prop->upperCaseDiff) { evaluated: prop->upperCaseDiff yes Evaluation Count:4915 | yes Evaluation Count:86655 |
| 4915-86655 |
2260 | if (QChar::isLowSurrogate(*p)) evaluated: QChar::isLowSurrogate(*p) yes Evaluation Count:4 | yes Evaluation Count:4911 |
| 4-4911 |
2261 | --p; executed: --p; Execution Count:4 | 4 |
2262 | QString s(d->size, Qt::Uninitialized); | - |
2263 | memcpy(s.d->data(), d->data(), (p - d->data())*sizeof(ushort)); | - |
2264 | ushort *pp = s.d->data() + (p - d->data()); | - |
2265 | while (p != e) { evaluated: p != e yes Evaluation Count:20285 | yes Evaluation Count:4915 |
| 4915-20285 |
2266 | if (QChar::isHighSurrogate(*p) && QChar::isLowSurrogate(p[1])) { evaluated: QChar::isHighSurrogate(*p) yes Evaluation Count:7 | yes Evaluation Count:20278 |
partially evaluated: QChar::isLowSurrogate(p[1]) yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-20278 |
2267 | *pp = *p++; | - |
2268 | prop = qGetProp(QChar::surrogateToUcs4(*pp++, *p)); | - |
2269 | } else { executed: } Execution Count:7 | 7 |
2270 | prop = qGetProp(*p); | - |
2271 | } executed: } Execution Count:20278 | 20278 |
2272 | if (prop->upperCaseSpecial) { evaluated: prop->upperCaseSpecial yes Evaluation Count:1 | yes Evaluation Count:20284 |
| 1-20284 |
2273 | const ushort *specialCase = specialCaseMap + prop->upperCaseDiff; | - |
2274 | ushort length = *specialCase++; | - |
2275 | int pos = pp - s.d->data(); | - |
2276 | s.resize(s.d->size + length - 1); | - |
2277 | pp = s.d->data() + pos; | - |
2278 | while (length--) evaluated: length-- yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
2279 | *pp++ = *specialCase++; executed: *pp++ = *specialCase++; Execution Count:2 | 2 |
2280 | } else { executed: } Execution Count:1 | 1 |
2281 | *pp++ = *p + prop->upperCaseDiff; | - |
2282 | } executed: } Execution Count:20284 | 20284 |
2283 | ++p; | - |
2284 | } executed: } Execution Count:20285 | 20285 |
2285 | | - |
2286 | | - |
2287 | while (e != d->data() + d->size) evaluated: e != d->data() + d->size yes Evaluation Count:2 | yes Evaluation Count:4915 |
| 2-4915 |
2288 | *pp++ = *e++; executed: *pp++ = *e++; Execution Count:2 | 2 |
2289 | | - |
2290 | return s; executed: return s; Execution Count:4915 | 4915 |
2291 | } | - |
2292 | ++p; | - |
2293 | } executed: } Execution Count:86655 | 86655 |
2294 | return *this; executed: return *this; Execution Count:3967 | 3967 |
2295 | } | - |
2296 | QString &QString::sprintf(const char *cformat, ...) | - |
2297 | { | - |
2298 | va_list ap; | - |
2299 | __builtin_va_start(ap,cformat); | - |
2300 | QString &s = vsprintf(cformat, ap); | - |
2301 | __builtin_va_end(ap); | - |
2302 | return s; executed: return s; Execution Count:12040 | 12040 |
2303 | } | - |
2304 | QString &QString::vsprintf(const char* cformat, va_list ap) | - |
2305 | { | - |
2306 | QLocale locale(QLocale::C); | - |
2307 | | - |
2308 | if (!cformat || !*cformat) { evaluated: !cformat yes Evaluation Count:1 | yes Evaluation Count:13021 |
partially evaluated: !*cformat no Evaluation Count:0 | yes Evaluation Count:13021 |
| 0-13021 |
2309 | | - |
2310 | *this = fromLatin1(""); | - |
2311 | return *this; executed: return *this; Execution Count:1 | 1 |
2312 | } | - |
2313 | | - |
2314 | | - |
2315 | | - |
2316 | QString result; | - |
2317 | const char *c = cformat; | - |
2318 | for (;;) { | - |
2319 | | - |
2320 | while (*c != '\0' && *c != '%') evaluated: *c != '\0' yes Evaluation Count:74663 | yes Evaluation Count:13021 |
evaluated: *c != '%' yes Evaluation Count:59391 | yes Evaluation Count:15272 |
| 13021-74663 |
2321 | result.append(QLatin1Char(*c++)); executed: result.append(QLatin1Char(*c++)); Execution Count:59391 | 59391 |
2322 | | - |
2323 | if (*c == '\0') evaluated: *c == '\0' yes Evaluation Count:13021 | yes Evaluation Count:15272 |
| 13021-15272 |
2324 | break; executed: break; Execution Count:13021 | 13021 |
2325 | | - |
2326 | | - |
2327 | const char *escape_start = c; | - |
2328 | ++c; | - |
2329 | | - |
2330 | if (*c == '\0') { partially evaluated: *c == '\0' no Evaluation Count:0 | yes Evaluation Count:15272 |
| 0-15272 |
2331 | result.append(QLatin1Char('%')); | - |
2332 | break; | 0 |
2333 | } | - |
2334 | if (*c == '%') { evaluated: *c == '%' yes Evaluation Count:1 | yes Evaluation Count:15271 |
| 1-15271 |
2335 | result.append(QLatin1Char('%')); | - |
2336 | ++c; | - |
2337 | continue; executed: continue; Execution Count:1 | 1 |
2338 | } | - |
2339 | | - |
2340 | | - |
2341 | uint flags = 0; | - |
2342 | bool no_more_flags = false; | - |
2343 | do { | - |
2344 | switch (*c) { | - |
2345 | case '#': flags |= QLocalePrivate::Alternate; break; executed: break; Execution Count:4992 | 4992 |
2346 | case '0': flags |= QLocalePrivate::ZeroPadded; break; executed: break; Execution Count:7032 | 7032 |
2347 | case '-': flags |= QLocalePrivate::LeftAdjusted; break; executed: break; Execution Count:4997 | 4997 |
2348 | case ' ': flags |= QLocalePrivate::BlankBeforePositive; break; executed: break; Execution Count:4992 | 4992 |
2349 | case '+': flags |= QLocalePrivate::AlwaysShowSign; break; executed: break; Execution Count:4992 | 4992 |
2350 | case '\'': flags |= QLocalePrivate::ThousandsGroup; break; executed: break; Execution Count:9984 | 9984 |
2351 | default: no_more_flags = true; break; executed: break; Execution Count:15271 | 15271 |
2352 | } | - |
2353 | | - |
2354 | if (!no_more_flags) evaluated: !no_more_flags yes Evaluation Count:36989 | yes Evaluation Count:15271 |
| 15271-36989 |
2355 | ++c; executed: ++c; Execution Count:36989 | 36989 |
2356 | } while (!no_more_flags); evaluated: !no_more_flags yes Evaluation Count:36989 | yes Evaluation Count:15271 |
executed: } Execution Count:52260 | 15271-52260 |
2357 | | - |
2358 | if (*c == '\0') { partially evaluated: *c == '\0' no Evaluation Count:0 | yes Evaluation Count:15271 |
| 0-15271 |
2359 | result.append(QLatin1String(escape_start)); | - |
2360 | break; | 0 |
2361 | } | - |
2362 | | - |
2363 | | - |
2364 | int width = -1; | - |
2365 | if (qIsDigit(*c)) { evaluated: qIsDigit(*c) yes Evaluation Count:9536 | yes Evaluation Count:5735 |
| 5735-9536 |
2366 | QString width_str; | - |
2367 | while (*c != '\0' && qIsDigit(*c)) partially evaluated: *c != '\0' yes Evaluation Count:21572 | no Evaluation Count:0 |
evaluated: qIsDigit(*c) yes Evaluation Count:12036 | yes Evaluation Count:9536 |
| 0-21572 |
2368 | width_str.append(QLatin1Char(*c++)); executed: width_str.append(QLatin1Char(*c++)); Execution Count:12036 | 12036 |
2369 | | - |
2370 | | - |
2371 | | - |
2372 | width = width_str.toInt(); | - |
2373 | } executed: } Execution Count:9536 | 9536 |
2374 | else if (*c == '*') { evaluated: *c == '*' yes Evaluation Count:1 | yes Evaluation Count:5734 |
| 1-5734 |
2375 | width = __builtin_va_arg(ap,int); | - |
2376 | if (width < 0) partially evaluated: width < 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2377 | width = -1; never executed: width = -1; | 0 |
2378 | ++c; | - |
2379 | } executed: } Execution Count:1 | 1 |
2380 | | - |
2381 | if (*c == '\0') { partially evaluated: *c == '\0' no Evaluation Count:0 | yes Evaluation Count:15271 |
| 0-15271 |
2382 | result.append(QLatin1String(escape_start)); | - |
2383 | break; | 0 |
2384 | } | - |
2385 | | - |
2386 | | - |
2387 | int precision = -1; | - |
2388 | if (*c == '.') { evaluated: *c == '.' yes Evaluation Count:9329 | yes Evaluation Count:5942 |
| 5942-9329 |
2389 | ++c; | - |
2390 | if (qIsDigit(*c)) { evaluated: qIsDigit(*c) yes Evaluation Count:9328 | yes Evaluation Count:1 |
| 1-9328 |
2391 | QString precision_str; | - |
2392 | while (*c != '\0' && qIsDigit(*c)) partially evaluated: *c != '\0' yes Evaluation Count:21155 | no Evaluation Count:0 |
evaluated: qIsDigit(*c) yes Evaluation Count:11827 | yes Evaluation Count:9328 |
| 0-21155 |
2393 | precision_str.append(QLatin1Char(*c++)); executed: precision_str.append(QLatin1Char(*c++)); Execution Count:11827 | 11827 |
2394 | | - |
2395 | | - |
2396 | | - |
2397 | precision = precision_str.toInt(); | - |
2398 | } executed: } Execution Count:9328 | 9328 |
2399 | else if (*c == '*') { partially evaluated: *c == '*' yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
2400 | precision = __builtin_va_arg(ap,int); | - |
2401 | if (precision < 0) partially evaluated: precision < 0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2402 | precision = -1; never executed: precision = -1; | 0 |
2403 | ++c; | - |
2404 | } executed: } Execution Count:1 | 1 |
2405 | } | - |
2406 | | - |
2407 | if (*c == '\0') { partially evaluated: *c == '\0' no Evaluation Count:0 | yes Evaluation Count:15271 |
| 0-15271 |
2408 | result.append(QLatin1String(escape_start)); | - |
2409 | break; | 0 |
2410 | } | - |
2411 | | - |
2412 | | - |
2413 | enum LengthMod { lm_none, lm_hh, lm_h, lm_l, lm_ll, lm_L, lm_j, lm_z, lm_t }; | - |
2414 | LengthMod length_mod = lm_none; | - |
2415 | switch (*c) { | - |
2416 | case 'h': | - |
2417 | ++c; | - |
2418 | if (*c == 'h') { never evaluated: *c == 'h' | 0 |
2419 | length_mod = lm_hh; | - |
2420 | ++c; | - |
2421 | } | 0 |
2422 | else | - |
2423 | length_mod = lm_h; never executed: length_mod = lm_h; | 0 |
2424 | break; | 0 |
2425 | | - |
2426 | case 'l': | - |
2427 | ++c; | - |
2428 | if (*c == 'l') { evaluated: *c == 'l' yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
2429 | length_mod = lm_ll; | - |
2430 | ++c; | - |
2431 | } executed: } Execution Count:1 | 1 |
2432 | else | - |
2433 | length_mod = lm_l; executed: length_mod = lm_l; Execution Count:3 | 3 |
2434 | break; executed: break; Execution Count:4 | 4 |
2435 | | - |
2436 | case 'L': | - |
2437 | ++c; | - |
2438 | length_mod = lm_L; | - |
2439 | break; | 0 |
2440 | | - |
2441 | case 'j': | - |
2442 | ++c; | - |
2443 | length_mod = lm_j; | - |
2444 | break; | 0 |
2445 | | - |
2446 | case 'z': | - |
2447 | case 'Z': | - |
2448 | ++c; | - |
2449 | length_mod = lm_z; | - |
2450 | break; executed: break; Execution Count:3 | 3 |
2451 | | - |
2452 | case 't': | - |
2453 | ++c; | - |
2454 | length_mod = lm_t; | - |
2455 | break; | 0 |
2456 | | - |
2457 | default: break; executed: break; Execution Count:15264 | 15264 |
2458 | } | - |
2459 | | - |
2460 | if (*c == '\0') { partially evaluated: *c == '\0' no Evaluation Count:0 | yes Evaluation Count:15271 |
| 0-15271 |
2461 | result.append(QLatin1String(escape_start)); | - |
2462 | break; | 0 |
2463 | } | - |
2464 | | - |
2465 | | - |
2466 | QString subst; | - |
2467 | switch (*c) { | - |
2468 | case 'd': | - |
2469 | case 'i': { | - |
2470 | qint64 i; | - |
2471 | switch (length_mod) { | - |
2472 | case lm_none: i = __builtin_va_arg(ap,int); break; executed: break; Execution Count:2209 | 2209 |
2473 | case lm_hh: i = __builtin_va_arg(ap,int); break; | 0 |
2474 | case lm_h: i = __builtin_va_arg(ap,int); break; | 0 |
2475 | case lm_l: i = __builtin_va_arg(ap,long int); break; executed: break; Execution Count:1 | 1 |
2476 | case lm_ll: i = __builtin_va_arg(ap,qint64); break; | 0 |
2477 | case lm_j: i = __builtin_va_arg(ap,long int); break; | 0 |
2478 | case lm_z: i = __builtin_va_arg(ap,size_t); break; | 0 |
2479 | case lm_t: i = __builtin_va_arg(ap,int); break; | 0 |
2480 | default: i = 0; break; | 0 |
2481 | } | - |
2482 | subst = locale.d->longLongToString(i, precision, 10, width, flags); | - |
2483 | ++c; | - |
2484 | break; executed: break; Execution Count:2210 | 2210 |
2485 | } | - |
2486 | case 'o': | - |
2487 | case 'u': | - |
2488 | case 'x': | - |
2489 | case 'X': { | - |
2490 | quint64 u; | - |
2491 | switch (length_mod) { | - |
2492 | case lm_none: u = __builtin_va_arg(ap,uint); break; executed: break; Execution Count:2046 | 2046 |
2493 | case lm_hh: u = __builtin_va_arg(ap,uint); break; | 0 |
2494 | case lm_h: u = __builtin_va_arg(ap,uint); break; | 0 |
2495 | case lm_l: u = __builtin_va_arg(ap,ulong); break; | 0 |
2496 | case lm_ll: u = __builtin_va_arg(ap,quint64); break; | 0 |
2497 | case lm_z: u = __builtin_va_arg(ap,size_t); break; executed: break; Execution Count:3 | 3 |
2498 | default: u = 0; break; | 0 |
2499 | } | - |
2500 | | - |
2501 | if (qIsUpper(*c)) partially evaluated: qIsUpper(*c) no Evaluation Count:0 | yes Evaluation Count:2049 |
| 0-2049 |
2502 | flags |= QLocalePrivate::CapitalEorX; never executed: flags |= QLocalePrivate::CapitalEorX; | 0 |
2503 | | - |
2504 | int base = 10; | - |
2505 | switch (qToLower(*c)) { | - |
2506 | case 'o': | - |
2507 | base = 8; break; | 0 |
2508 | case 'u': | - |
2509 | base = 10; break; executed: break; Execution Count:6 | 6 |
2510 | case 'x': | - |
2511 | base = 16; break; executed: break; Execution Count:2043 | 2043 |
2512 | default: break; | 0 |
2513 | } | - |
2514 | subst = locale.d->unsLongLongToString(u, precision, base, width, flags); | - |
2515 | ++c; | - |
2516 | break; executed: break; Execution Count:2049 | 2049 |
2517 | } | - |
2518 | case 'E': | - |
2519 | case 'e': | - |
2520 | case 'F': | - |
2521 | case 'f': | - |
2522 | case 'G': | - |
2523 | case 'g': | - |
2524 | case 'A': | - |
2525 | case 'a': { | - |
2526 | double d; | - |
2527 | if (length_mod == lm_L) partially evaluated: length_mod == lm_L no Evaluation Count:0 | yes Evaluation Count:10009 |
| 0-10009 |
2528 | d = __builtin_va_arg(ap,long double); never executed: d = __builtin_va_arg(ap,long double); | 0 |
2529 | else | - |
2530 | d = __builtin_va_arg(ap,double); executed: d = __builtin_va_arg(ap,double); Execution Count:10009 | 10009 |
2531 | | - |
2532 | if (qIsUpper(*c)) evaluated: qIsUpper(*c) yes Evaluation Count:4992 | yes Evaluation Count:5017 |
| 4992-5017 |
2533 | flags |= QLocalePrivate::CapitalEorX; executed: flags |= QLocalePrivate::CapitalEorX; Execution Count:4992 | 4992 |
2534 | | - |
2535 | QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; | - |
2536 | switch (qToLower(*c)) { | - |
2537 | case 'e': form = QLocalePrivate::DFExponent; break; | 0 |
2538 | case 'a': | - |
2539 | case 'f': form = QLocalePrivate::DFDecimal; break; executed: break; Execution Count:16 | 16 |
2540 | case 'g': form = QLocalePrivate::DFSignificantDigits; break; executed: break; Execution Count:9993 | 9993 |
2541 | default: break; | 0 |
2542 | } | - |
2543 | subst = locale.d->doubleToString(d, precision, form, width, flags); | - |
2544 | ++c; | - |
2545 | break; executed: break; Execution Count:10009 | 10009 |
2546 | } | - |
2547 | case 'c': { | - |
2548 | if (length_mod == lm_l) partially evaluated: length_mod == lm_l no Evaluation Count:0 | yes Evaluation Count:120 |
| 0-120 |
2549 | subst = QChar((ushort) __builtin_va_arg(ap,int)); never executed: subst = QChar((ushort) __builtin_va_arg(ap,int)); | 0 |
2550 | else | - |
2551 | subst = QLatin1Char((uchar) __builtin_va_arg(ap,int)); executed: subst = QLatin1Char((uchar) __builtin_va_arg(ap,int)); Execution Count:120 | 120 |
2552 | ++c; | - |
2553 | break; executed: break; Execution Count:120 | 120 |
2554 | } | - |
2555 | case 's': { | - |
2556 | if (length_mod == lm_l) { partially evaluated: length_mod == lm_l no Evaluation Count:0 | yes Evaluation Count:846 |
| 0-846 |
2557 | const ushort *buff = __builtin_va_arg(ap,const ushort*); | - |
2558 | const ushort *ch = buff; | - |
2559 | while (*ch != 0) never evaluated: *ch != 0 | 0 |
2560 | ++ch; | 0 |
2561 | subst.setUtf16(buff, ch - buff); | - |
2562 | } else | 0 |
2563 | subst = QString::fromUtf8(__builtin_va_arg(ap,const char*)); executed: subst = QString::fromUtf8(__builtin_va_arg(ap,const char*)); Execution Count:846 | 846 |
2564 | if (precision != -1) evaluated: precision != -1 yes Evaluation Count:7 | yes Evaluation Count:839 |
| 7-839 |
2565 | subst.truncate(precision); executed: subst.truncate(precision); Execution Count:7 | 7 |
2566 | ++c; | - |
2567 | break; executed: break; Execution Count:846 | 846 |
2568 | } | - |
2569 | case 'p': { | - |
2570 | void *arg = __builtin_va_arg(ap,void*); | - |
2571 | | - |
2572 | | - |
2573 | | - |
2574 | quint64 i = reinterpret_cast<unsigned long>(arg); | - |
2575 | | - |
2576 | flags |= QLocalePrivate::Alternate; | - |
2577 | subst = locale.d->unsLongLongToString(i, precision, 16, width, flags); | - |
2578 | ++c; | - |
2579 | break; executed: break; Execution Count:35 | 35 |
2580 | } | - |
2581 | case 'n': | - |
2582 | switch (length_mod) { | - |
2583 | case lm_hh: { | - |
2584 | signed char *n = __builtin_va_arg(ap,signed char*); | - |
2585 | *n = result.length(); | - |
2586 | break; | 0 |
2587 | } | - |
2588 | case lm_h: { | - |
2589 | short int *n = __builtin_va_arg(ap,short int*); | - |
2590 | *n = result.length(); | - |
2591 | break; | 0 |
2592 | } | - |
2593 | case lm_l: { | - |
2594 | long int *n = __builtin_va_arg(ap,long int*); | - |
2595 | *n = result.length(); | - |
2596 | break; | 0 |
2597 | } | - |
2598 | case lm_ll: { | - |
2599 | qint64 *n = __builtin_va_arg(ap,qint64*); | - |
2600 | volatile uint tmp = result.length(); | - |
2601 | *n = tmp; | - |
2602 | break; executed: break; Execution Count:1 | 1 |
2603 | } | - |
2604 | default: { | - |
2605 | int *n = __builtin_va_arg(ap,int*); | - |
2606 | *n = result.length(); | - |
2607 | break; executed: break; Execution Count:1 | 1 |
2608 | } | - |
2609 | } | - |
2610 | ++c; | - |
2611 | break; executed: break; Execution Count:2 | 2 |
2612 | | - |
2613 | default: | - |
2614 | for (const char *cc = escape_start; cc != c; ++cc) | 0 |
2615 | result.append(QLatin1Char(*cc)); never executed: result.append(QLatin1Char(*cc)); | 0 |
2616 | continue; never executed: continue; | 0 |
2617 | } | - |
2618 | | - |
2619 | if (flags & QLocalePrivate::LeftAdjusted) evaluated: flags & QLocalePrivate::LeftAdjusted yes Evaluation Count:4997 | yes Evaluation Count:10274 |
| 4997-10274 |
2620 | result.append(subst.leftJustified(width)); executed: result.append(subst.leftJustified(width)); Execution Count:4997 | 4997 |
2621 | else | - |
2622 | result.append(subst.rightJustified(width)); executed: result.append(subst.rightJustified(width)); Execution Count:10274 | 10274 |
2623 | } | - |
2624 | | - |
2625 | *this = result; | - |
2626 | | - |
2627 | return *this; executed: return *this; Execution Count:13021 | 13021 |
2628 | } | - |
2629 | qint64 QString::toLongLong(bool *ok, int base) const | - |
2630 | { | - |
2631 | | - |
2632 | | - |
2633 | | - |
2634 | | - |
2635 | | - |
2636 | | - |
2637 | | - |
2638 | QLocale c_locale(QLocale::C); | - |
2639 | return c_locale.d->stringToLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators); executed: return c_locale.d->stringToLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators); Execution Count:84820 | 84820 |
2640 | } | - |
2641 | quint64 QString::toULongLong(bool *ok, int base) const | - |
2642 | { | - |
2643 | | - |
2644 | | - |
2645 | | - |
2646 | | - |
2647 | | - |
2648 | | - |
2649 | | - |
2650 | QLocale c_locale(QLocale::C); | - |
2651 | return c_locale.d->stringToUnsLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators); executed: return c_locale.d->stringToUnsLongLong(*this, base, ok, QLocalePrivate::FailOnGroupSeparators); Execution Count:13106 | 13106 |
2652 | } | - |
2653 | long QString::toLong(bool *ok, int base) const | - |
2654 | { | - |
2655 | qint64 v = toLongLong(ok, base); | - |
2656 | if (v < (-9223372036854775807L - 1L) || v > 9223372036854775807L) { partially evaluated: v < (-9223372036854775807L - 1L) no Evaluation Count:0 | yes Evaluation Count:54 |
partially evaluated: v > 9223372036854775807L no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
2657 | if (ok) | 0 |
2658 | *ok = false; never executed: *ok = false; | 0 |
2659 | v = 0; | - |
2660 | } | 0 |
2661 | return (long)v; executed: return (long)v; Execution Count:54 | 54 |
2662 | } | - |
2663 | ulong QString::toULong(bool *ok, int base) const | - |
2664 | { | - |
2665 | quint64 v = toULongLong(ok, base); | - |
2666 | if (v > (9223372036854775807L * 2UL + 1UL)) { partially evaluated: v > (9223372036854775807L * 2UL + 1UL) no Evaluation Count:0 | yes Evaluation Count:40 |
| 0-40 |
2667 | if (ok) | 0 |
2668 | *ok = false; never executed: *ok = false; | 0 |
2669 | v = 0; | - |
2670 | } | 0 |
2671 | return (ulong)v; executed: return (ulong)v; Execution Count:40 | 40 |
2672 | } | - |
2673 | int QString::toInt(bool *ok, int base) const | - |
2674 | { | - |
2675 | qint64 v = toLongLong(ok, base); | - |
2676 | if (v < (-2147483647 - 1) || v > 2147483647) { evaluated: v < (-2147483647 - 1) yes Evaluation Count:1 | yes Evaluation Count:37045 |
evaluated: v > 2147483647 yes Evaluation Count:9 | yes Evaluation Count:37037 |
| 1-37045 |
2677 | if (ok) evaluated: ok yes Evaluation Count:6 | yes Evaluation Count:4 |
| 4-6 |
2678 | *ok = false; executed: *ok = false; Execution Count:6 | 6 |
2679 | v = 0; | - |
2680 | } executed: } Execution Count:10 | 10 |
2681 | return v; executed: return v; Execution Count:37047 | 37047 |
2682 | } | - |
2683 | uint QString::toUInt(bool *ok, int base) const | - |
2684 | { | - |
2685 | quint64 v = toULongLong(ok, base); | - |
2686 | if (v > (2147483647 * 2U + 1U)) { evaluated: v > (2147483647 * 2U + 1U) yes Evaluation Count:3 | yes Evaluation Count:12847 |
| 3-12847 |
2687 | if (ok) evaluated: ok yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
2688 | *ok = false; executed: *ok = false; Execution Count:2 | 2 |
2689 | v = 0; | - |
2690 | } executed: } Execution Count:3 | 3 |
2691 | return (uint)v; executed: return (uint)v; Execution Count:12850 | 12850 |
2692 | } | - |
2693 | short QString::toShort(bool *ok, int base) const | - |
2694 | { | - |
2695 | long v = toLongLong(ok, base); | - |
2696 | if (v < (-32767 - 1) || v > 32767) { evaluated: v < (-32767 - 1) yes Evaluation Count:3 | yes Evaluation Count:67 |
evaluated: v > 32767 yes Evaluation Count:5 | yes Evaluation Count:62 |
| 3-67 |
2697 | if (ok) evaluated: ok yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
2698 | *ok = false; executed: *ok = false; Execution Count:5 | 5 |
2699 | v = 0; | - |
2700 | } executed: } Execution Count:8 | 8 |
2701 | return (short)v; executed: return (short)v; Execution Count:70 | 70 |
2702 | } | - |
2703 | ushort QString::toUShort(bool *ok, int base) const | - |
2704 | { | - |
2705 | ulong v = toULongLong(ok, base); | - |
2706 | if (v > (32767 * 2 + 1)) { evaluated: v > (32767 * 2 + 1) yes Evaluation Count:7 | yes Evaluation Count:55 |
| 7-55 |
2707 | if (ok) evaluated: ok yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
2708 | *ok = false; executed: *ok = false; Execution Count:4 | 4 |
2709 | v = 0; | - |
2710 | } executed: } Execution Count:7 | 7 |
2711 | return (ushort)v; executed: return (ushort)v; Execution Count:62 | 62 |
2712 | } | - |
2713 | double QString::toDouble(bool *ok) const | - |
2714 | { | - |
2715 | QLocale c_locale(QLocale::C); | - |
2716 | return c_locale.d->stringToDouble(*this, ok, QLocalePrivate::FailOnGroupSeparators); executed: return c_locale.d->stringToDouble(*this, ok, QLocalePrivate::FailOnGroupSeparators); Execution Count:2433 | 2433 |
2717 | } | - |
2718 | float QString::toFloat(bool *ok) const | - |
2719 | { | - |
2720 | bool myOk; | - |
2721 | double d = toDouble(&myOk); | - |
2722 | if (!myOk) { evaluated: !myOk yes Evaluation Count:13 | yes Evaluation Count:18 |
| 13-18 |
2723 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
2724 | *ok = false; executed: *ok = false; Execution Count:13 | 13 |
2725 | return 0.0; executed: return 0.0; Execution Count:13 | 13 |
2726 | } | - |
2727 | if (qIsInf(d)) evaluated: qIsInf(d) yes Evaluation Count:2 | yes Evaluation Count:16 |
| 2-16 |
2728 | return float(d); executed: return float(d); Execution Count:2 | 2 |
2729 | if (d > 3.4028234663852886e+38 || d < -3.4028234663852886e+38) { evaluated: d > 3.4028234663852886e+38 yes Evaluation Count:1 | yes Evaluation Count:15 |
evaluated: d < -3.4028234663852886e+38 yes Evaluation Count:1 | yes Evaluation Count:14 |
| 1-15 |
2730 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2731 | *ok = false; executed: *ok = false; Execution Count:2 | 2 |
2732 | return 0.0; executed: return 0.0; Execution Count:2 | 2 |
2733 | } | - |
2734 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
2735 | *ok = true; executed: *ok = true; Execution Count:14 | 14 |
2736 | return float(d); executed: return float(d); Execution Count:14 | 14 |
2737 | } | - |
2738 | QString &QString::setNum(qlonglong n, int base) | - |
2739 | { | - |
2740 | | - |
2741 | | - |
2742 | | - |
2743 | | - |
2744 | | - |
2745 | | - |
2746 | QLocale locale(QLocale::C); | - |
2747 | *this = locale.d->longLongToString(n, -1, base); | - |
2748 | return *this; executed: return *this; Execution Count:435857 | 435857 |
2749 | } | - |
2750 | | - |
2751 | | - |
2752 | | - |
2753 | | - |
2754 | QString &QString::setNum(qulonglong n, int base) | - |
2755 | { | - |
2756 | | - |
2757 | | - |
2758 | | - |
2759 | | - |
2760 | | - |
2761 | | - |
2762 | QLocale locale(QLocale::C); | - |
2763 | *this = locale.d->unsLongLongToString(n, -1, base); | - |
2764 | return *this; executed: return *this; Execution Count:25889 | 25889 |
2765 | } | - |
2766 | QString &QString::setNum(double n, char f, int prec) | - |
2767 | { | - |
2768 | QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; | - |
2769 | uint flags = 0; | - |
2770 | | - |
2771 | if (qIsUpper(f)) partially evaluated: qIsUpper(f) no Evaluation Count:0 | yes Evaluation Count:1841 |
| 0-1841 |
2772 | flags = QLocalePrivate::CapitalEorX; never executed: flags = QLocalePrivate::CapitalEorX; | 0 |
2773 | f = qToLower(f); | - |
2774 | | - |
2775 | switch (f) { | - |
2776 | case 'f': | - |
2777 | form = QLocalePrivate::DFDecimal; | - |
2778 | break; executed: break; Execution Count:682 | 682 |
2779 | case 'e': | - |
2780 | form = QLocalePrivate::DFExponent; | - |
2781 | break; executed: break; Execution Count:6 | 6 |
2782 | case 'g': | - |
2783 | form = QLocalePrivate::DFSignificantDigits; | - |
2784 | break; executed: break; Execution Count:1153 | 1153 |
2785 | default: | - |
2786 | | - |
2787 | | - |
2788 | | - |
2789 | break; | 0 |
2790 | } | - |
2791 | | - |
2792 | QLocale locale(QLocale::C); | - |
2793 | *this = locale.d->doubleToString(n, prec, form, -1, flags); | - |
2794 | return *this; executed: return *this; Execution Count:1841 | 1841 |
2795 | } | - |
2796 | QString QString::number(long n, int base) | - |
2797 | { | - |
2798 | QString s; | - |
2799 | s.setNum(n, base); | - |
2800 | return s; executed: return s; Execution Count:1 | 1 |
2801 | } | - |
2802 | | - |
2803 | | - |
2804 | | - |
2805 | | - |
2806 | | - |
2807 | | - |
2808 | QString QString::number(ulong n, int base) | - |
2809 | { | - |
2810 | QString s; | - |
2811 | s.setNum(n, base); | - |
2812 | return s; executed: return s; Execution Count:17 | 17 |
2813 | } | - |
2814 | | - |
2815 | | - |
2816 | | - |
2817 | | - |
2818 | QString QString::number(int n, int base) | - |
2819 | { | - |
2820 | QString s; | - |
2821 | s.setNum(n, base); | - |
2822 | return s; executed: return s; Execution Count:376326 | 376326 |
2823 | } | - |
2824 | | - |
2825 | | - |
2826 | | - |
2827 | | - |
2828 | QString QString::number(uint n, int base) | - |
2829 | { | - |
2830 | QString s; | - |
2831 | s.setNum(n, base); | - |
2832 | return s; executed: return s; Execution Count:25718 | 25718 |
2833 | } | - |
2834 | | - |
2835 | | - |
2836 | | - |
2837 | | - |
2838 | QString QString::number(qlonglong n, int base) | - |
2839 | { | - |
2840 | QString s; | - |
2841 | s.setNum(n, base); | - |
2842 | return s; executed: return s; Execution Count:32693 | 32693 |
2843 | } | - |
2844 | | - |
2845 | | - |
2846 | | - |
2847 | | - |
2848 | QString QString::number(qulonglong n, int base) | - |
2849 | { | - |
2850 | QString s; | - |
2851 | s.setNum(n, base); | - |
2852 | return s; executed: return s; Execution Count:150 | 150 |
2853 | } | - |
2854 | QString QString::number(double n, char f, int prec) | - |
2855 | { | - |
2856 | QString s; | - |
2857 | s.setNum(n, f, prec); | - |
2858 | return s; executed: return s; Execution Count:1837 | 1837 |
2859 | } | - |
2860 | QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const | - |
2861 | { | - |
2862 | QStringList list; | - |
2863 | int start = 0; | - |
2864 | int extra = 0; | - |
2865 | int end; | - |
2866 | while ((end = indexOf(sep, start + extra, cs)) != -1) { evaluated: (end = indexOf(sep, start + extra, cs)) != -1 yes Evaluation Count:22632 | yes Evaluation Count:3177 |
| 3177-22632 |
2867 | if (start != end || behavior == KeepEmptyParts) evaluated: start != end yes Evaluation Count:18227 | yes Evaluation Count:4405 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:157 | yes Evaluation Count:4248 |
| 157-18227 |
2868 | list.append(mid(start, end - start)); executed: list.append(mid(start, end - start)); Execution Count:18384 | 18384 |
2869 | start = end + sep.size(); | - |
2870 | extra = (sep.size() == 0 ? 1 : 0); evaluated: sep.size() == 0 yes Evaluation Count:15 | yes Evaluation Count:22617 |
| 15-22617 |
2871 | } executed: } Execution Count:22632 | 22632 |
2872 | if (start != size() || behavior == KeepEmptyParts) evaluated: start != size() yes Evaluation Count:1147 | yes Evaluation Count:2030 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:2019 | yes Evaluation Count:11 |
| 11-2030 |
2873 | list.append(mid(start)); executed: list.append(mid(start)); Execution Count:3166 | 3166 |
2874 | return list; executed: return list; Execution Count:3177 | 3177 |
2875 | } | - |
2876 | | - |
2877 | | - |
2878 | | - |
2879 | | - |
2880 | QStringList QString::split(QChar sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const | - |
2881 | { | - |
2882 | QStringList list; | - |
2883 | int start = 0; | - |
2884 | int end; | - |
2885 | while ((end = indexOf(sep, start, cs)) != -1) { evaluated: (end = indexOf(sep, start, cs)) != -1 yes Evaluation Count:45376 | yes Evaluation Count:12995 |
| 12995-45376 |
2886 | if (start != end || behavior == KeepEmptyParts) evaluated: start != end yes Evaluation Count:38567 | yes Evaluation Count:6809 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:2394 | yes Evaluation Count:4415 |
| 2394-38567 |
2887 | list.append(mid(start, end - start)); executed: list.append(mid(start, end - start)); Execution Count:40961 | 40961 |
2888 | start = end + 1; | - |
2889 | } executed: } Execution Count:45376 | 45376 |
2890 | if (start != size() || behavior == KeepEmptyParts) evaluated: start != size() yes Evaluation Count:12657 | yes Evaluation Count:338 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:204 | yes Evaluation Count:134 |
| 134-12657 |
2891 | list.append(mid(start)); executed: list.append(mid(start)); Execution Count:12861 | 12861 |
2892 | return list; executed: return list; Execution Count:12995 | 12995 |
2893 | } | - |
2894 | QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const | - |
2895 | { | - |
2896 | QRegExp rx2(rx); | - |
2897 | QStringList list; | - |
2898 | int start = 0; | - |
2899 | int extra = 0; | - |
2900 | int end; | - |
2901 | while ((end = rx2.indexIn(*this, start + extra)) != -1) { evaluated: (end = rx2.indexIn(*this, start + extra)) != -1 yes Evaluation Count:2095 | yes Evaluation Count:466 |
| 466-2095 |
2902 | int matchedLen = rx2.matchedLength(); | - |
2903 | if (start != end || behavior == KeepEmptyParts) evaluated: start != end yes Evaluation Count:1777 | yes Evaluation Count:318 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:307 | yes Evaluation Count:11 |
| 11-1777 |
2904 | list.append(mid(start, end - start)); executed: list.append(mid(start, end - start)); Execution Count:2084 | 2084 |
2905 | start = end + matchedLen; | - |
2906 | extra = (matchedLen == 0) ? 1 : 0; evaluated: (matchedLen == 0) yes Evaluation Count:31 | yes Evaluation Count:2064 |
| 31-2064 |
2907 | } executed: } Execution Count:2095 | 2095 |
2908 | if (start != size() || behavior == KeepEmptyParts) evaluated: start != size() yes Evaluation Count:197 | yes Evaluation Count:269 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:263 | yes Evaluation Count:6 |
| 6-269 |
2909 | list.append(mid(start)); executed: list.append(mid(start)); Execution Count:460 | 460 |
2910 | return list; executed: return list; Execution Count:466 | 466 |
2911 | } | - |
2912 | QStringList QString::split(const QRegularExpression &re, SplitBehavior behavior) const | - |
2913 | { | - |
2914 | QStringList list; | - |
2915 | if (!re.isValid()) { partially evaluated: !re.isValid() no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
2916 | QMessageLogger("tools/qstring.cpp", 6452, __PRETTY_FUNCTION__).warning("QString::split: invalid QRegularExpression object"); | - |
2917 | return list; never executed: return list; | 0 |
2918 | } | - |
2919 | | - |
2920 | int start = 0; | - |
2921 | int end = 0; | - |
2922 | QRegularExpressionMatchIterator iterator = re.globalMatch(*this); | - |
2923 | while (iterator.hasNext()) { evaluated: iterator.hasNext() yes Evaluation Count:105 | yes Evaluation Count:27 |
| 27-105 |
2924 | QRegularExpressionMatch match = iterator.next(); | - |
2925 | end = match.capturedStart(); | - |
2926 | if (start != end || behavior == KeepEmptyParts) evaluated: start != end yes Evaluation Count:73 | yes Evaluation Count:32 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:21 | yes Evaluation Count:11 |
| 11-73 |
2927 | list.append(mid(start, end - start)); executed: list.append(mid(start, end - start)); Execution Count:94 | 94 |
2928 | start = match.capturedEnd(); | - |
2929 | } executed: } Execution Count:105 | 105 |
2930 | | - |
2931 | if (start != size() || behavior == KeepEmptyParts) evaluated: start != size() yes Evaluation Count:10 | yes Evaluation Count:17 |
evaluated: behavior == KeepEmptyParts yes Evaluation Count:11 | yes Evaluation Count:6 |
| 6-17 |
2932 | list.append(mid(start)); executed: list.append(mid(start)); Execution Count:21 | 21 |
2933 | | - |
2934 | return list; executed: return list; Execution Count:27 | 27 |
2935 | } | - |
2936 | QString QString::repeated(int times) const | - |
2937 | { | - |
2938 | if (d->size == 0) evaluated: d->size == 0 yes Evaluation Count:5 | yes Evaluation Count:9 |
| 5-9 |
2939 | return *this; executed: return *this; Execution Count:5 | 5 |
2940 | | - |
2941 | if (times <= 1) { evaluated: times <= 1 yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
2942 | if (times == 1) evaluated: times == 1 yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
2943 | return *this; executed: return *this; Execution Count:1 | 1 |
2944 | return QString(); executed: return QString(); Execution Count:3 | 3 |
2945 | } | - |
2946 | | - |
2947 | const int resultSize = times * d->size; | - |
2948 | | - |
2949 | QString result; | - |
2950 | result.reserve(resultSize); | - |
2951 | if (result.d->alloc != uint(resultSize) + 1u) partially evaluated: result.d->alloc != uint(resultSize) + 1u no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
2952 | return QString(); never executed: return QString(); | 0 |
2953 | | - |
2954 | memcpy(result.d->data(), d->data(), d->size * sizeof(ushort)); | - |
2955 | | - |
2956 | int sizeSoFar = d->size; | - |
2957 | ushort *end = result.d->data() + sizeSoFar; | - |
2958 | | - |
2959 | const int halfResultSize = resultSize >> 1; | - |
2960 | while (sizeSoFar <= halfResultSize) { evaluated: sizeSoFar <= halfResultSize yes Evaluation Count:16 | yes Evaluation Count:5 |
| 5-16 |
2961 | memcpy(end, result.d->data(), sizeSoFar * sizeof(ushort)); | - |
2962 | end += sizeSoFar; | - |
2963 | sizeSoFar <<= 1; | - |
2964 | } executed: } Execution Count:16 | 16 |
2965 | memcpy(end, result.d->data(), (resultSize - sizeSoFar) * sizeof(ushort)); | - |
2966 | result.d->data()[resultSize] = '\0'; | - |
2967 | result.d->size = resultSize; | - |
2968 | return result; executed: return result; Execution Count:5 | 5 |
2969 | } | - |
2970 | | - |
2971 | void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::UnicodeVersion version, int from) | - |
2972 | { | - |
2973 | bool simple = true; | - |
2974 | const QChar *p = data->constData(); | - |
2975 | int len = data->length(); | - |
2976 | for (int i = from; i < len; ++i) { evaluated: i < len yes Evaluation Count:400788 | yes Evaluation Count:11129 |
| 11129-400788 |
2977 | if (p[i].unicode() >= 0x80) { evaluated: p[i].unicode() >= 0x80 yes Evaluation Count:356558 | yes Evaluation Count:44230 |
| 44230-356558 |
2978 | simple = false; | - |
2979 | break; executed: break; Execution Count:356558 | 356558 |
2980 | } | - |
2981 | } executed: } Execution Count:44230 | 44230 |
2982 | if (simple) evaluated: simple yes Evaluation Count:11129 | yes Evaluation Count:356558 |
| 11129-356558 |
2983 | return; executed: return; Execution Count:11129 | 11129 |
2984 | | - |
2985 | if (version == QChar::Unicode_Unassigned) { evaluated: version == QChar::Unicode_Unassigned yes Evaluation Count:356431 | yes Evaluation Count:127 |
| 127-356431 |
2986 | version = QChar::currentUnicodeVersion(); | - |
2987 | } else if (int(version) <= NormalizationCorrectionsVersionMax) { partially evaluated: int(version) <= NormalizationCorrectionsVersionMax yes Evaluation Count:127 | no Evaluation Count:0 |
executed: } Execution Count:356431 | 0-356431 |
2988 | const QString &s = *data; | - |
2989 | QChar *d = 0; | - |
2990 | for (int i = 0; i < NumNormalizationCorrections; ++i) { evaluated: i < NumNormalizationCorrections yes Evaluation Count:762 | yes Evaluation Count:127 |
| 127-762 |
2991 | const NormalizationCorrection &n = uc_normalization_corrections[i]; | - |
2992 | if (n.version > version) { evaluated: n.version > version yes Evaluation Count:637 | yes Evaluation Count:125 |
| 125-637 |
2993 | int pos = from; | - |
2994 | if (QChar::requiresSurrogates(n.ucs4)) { evaluated: QChar::requiresSurrogates(n.ucs4) yes Evaluation Count:635 | yes Evaluation Count:2 |
| 2-635 |
2995 | ushort ucs4High = QChar::highSurrogate(n.ucs4); | - |
2996 | ushort ucs4Low = QChar::lowSurrogate(n.ucs4); | - |
2997 | ushort oldHigh = QChar::highSurrogate(n.old_mapping); | - |
2998 | ushort oldLow = QChar::lowSurrogate(n.old_mapping); | - |
2999 | while (pos < s.length() - 1) { evaluated: pos < s.length() - 1 yes Evaluation Count:2325 | yes Evaluation Count:635 |
| 635-2325 |
3000 | if (s.at(pos).unicode() == ucs4High && s.at(pos + 1).unicode() == ucs4Low) { evaluated: s.at(pos).unicode() == ucs4High yes Evaluation Count:2 | yes Evaluation Count:2323 |
partially evaluated: s.at(pos + 1).unicode() == ucs4Low yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2323 |
3001 | if (!d) partially evaluated: !d yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
3002 | d = data->data(); executed: d = data->data(); Execution Count:2 | 2 |
3003 | d[pos] = QChar(oldHigh); | - |
3004 | d[++pos] = QChar(oldLow); | - |
3005 | } executed: } Execution Count:2 | 2 |
3006 | ++pos; | - |
3007 | } executed: } Execution Count:2325 | 2325 |
3008 | } else { executed: } Execution Count:635 | 635 |
3009 | while (pos < s.length()) { evaluated: pos < s.length() yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
3010 | if (s.at(pos).unicode() == n.ucs4) { evaluated: s.at(pos).unicode() == n.ucs4 yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
3011 | if (!d) partially evaluated: !d yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3012 | d = data->data(); executed: d = data->data(); Execution Count:1 | 1 |
3013 | d[pos] = QChar(n.old_mapping); | - |
3014 | } executed: } Execution Count:1 | 1 |
3015 | ++pos; | - |
3016 | } executed: } Execution Count:3 | 3 |
3017 | } executed: } Execution Count:2 | 2 |
3018 | } | - |
3019 | } executed: } Execution Count:762 | 762 |
3020 | } executed: } Execution Count:127 | 127 |
3021 | decomposeHelper(data, mode < QString::NormalizationForm_KD, version, from); | - |
3022 | | - |
3023 | canonicalOrderHelper(data, version, from); | - |
3024 | | - |
3025 | if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD) evaluated: mode == QString::NormalizationForm_D yes Evaluation Count:89109 | yes Evaluation Count:267449 |
evaluated: mode == QString::NormalizationForm_KD yes Evaluation Count:89107 | yes Evaluation Count:178342 |
| 89107-267449 |
3026 | return; executed: return; Execution Count:178216 | 178216 |
3027 | | - |
3028 | composeHelper(data, version, from); | - |
3029 | } executed: } Execution Count:178342 | 178342 |
3030 | | - |
3031 | | - |
3032 | | - |
3033 | | - |
3034 | | - |
3035 | QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersion version) const | - |
3036 | { | - |
3037 | QString copy = *this; | - |
3038 | qt_string_normalize(©, mode, version, 0); | - |
3039 | return copy; executed: return copy; Execution Count:367563 | 367563 |
3040 | } | - |
3041 | | - |
3042 | | - |
3043 | struct ArgEscapeData | - |
3044 | { | - |
3045 | int min_escape; | - |
3046 | int occurrences; | - |
3047 | int locale_occurrences; | - |
3048 | | - |
3049 | int escape_len; | - |
3050 | }; | - |
3051 | | - |
3052 | static ArgEscapeData findArgEscapes(const QString &s) | - |
3053 | { | - |
3054 | const QChar *uc_begin = s.unicode(); | - |
3055 | const QChar *uc_end = uc_begin + s.length(); | - |
3056 | | - |
3057 | ArgEscapeData d; | - |
3058 | | - |
3059 | d.min_escape = 2147483647; | - |
3060 | d.occurrences = 0; | - |
3061 | d.escape_len = 0; | - |
3062 | d.locale_occurrences = 0; | - |
3063 | | - |
3064 | const QChar *c = uc_begin; | - |
3065 | while (c != uc_end) { evaluated: c != uc_end yes Evaluation Count:5524114 | yes Evaluation Count:2238749 |
| 2238749-5524114 |
3066 | while (c != uc_end && c->unicode() != '%') evaluated: c != uc_end yes Evaluation Count:25752598 | yes Evaluation Count:263040 |
evaluated: c->unicode() != '%' yes Evaluation Count:20491550 | yes Evaluation Count:5261072 |
| 263040-25752598 |
3067 | ++c; executed: ++c; Execution Count:20491555 | 20491555 |
3068 | | - |
3069 | if (c == uc_end) evaluated: c == uc_end yes Evaluation Count:263040 | yes Evaluation Count:5261067 |
| 263040-5261067 |
3070 | break; executed: break; Execution Count:263040 | 263040 |
3071 | const QChar *escape_start = c; | - |
3072 | if (++c == uc_end) evaluated: ++c == uc_end yes Evaluation Count:5 | yes Evaluation Count:5261065 |
| 5-5261065 |
3073 | break; executed: break; Execution Count:5 | 5 |
3074 | | - |
3075 | bool locale_arg = false; | - |
3076 | if (c->unicode() == 'L') { evaluated: c->unicode() == 'L' yes Evaluation Count:265 | yes Evaluation Count:5260802 |
| 265-5260802 |
3077 | locale_arg = true; | - |
3078 | if (++c == uc_end) evaluated: ++c == uc_end yes Evaluation Count:16 | yes Evaluation Count:249 |
| 16-249 |
3079 | break; executed: break; Execution Count:16 | 16 |
3080 | } executed: } Execution Count:249 | 249 |
3081 | | - |
3082 | if (c->digitValue() == -1) evaluated: c->digitValue() == -1 yes Evaluation Count:195 | yes Evaluation Count:5260853 |
| 195-5260853 |
3083 | continue; executed: continue; Execution Count:195 | 195 |
3084 | | - |
3085 | int escape = c->digitValue(); | - |
3086 | ++c; | - |
3087 | | - |
3088 | if (c != uc_end && c->digitValue() != -1) { evaluated: c != uc_end yes Evaluation Count:3022111 | yes Evaluation Count:2238747 |
evaluated: c->digitValue() != -1 yes Evaluation Count:94 | yes Evaluation Count:3022017 |
| 94-3022111 |
3089 | escape = (10 * escape) + c->digitValue(); | - |
3090 | ++c; | - |
3091 | } executed: } Execution Count:94 | 94 |
3092 | | - |
3093 | if (escape > d.min_escape) evaluated: escape > d.min_escape yes Evaluation Count:2751858 | yes Evaluation Count:2508998 |
| 2508998-2751858 |
3094 | continue; executed: continue; Execution Count:2751859 | 2751859 |
3095 | | - |
3096 | if (escape < d.min_escape) { evaluated: escape < d.min_escape yes Evaluation Count:2508891 | yes Evaluation Count:106 |
| 106-2508891 |
3097 | d.min_escape = escape; | - |
3098 | d.occurrences = 0; | - |
3099 | d.escape_len = 0; | - |
3100 | d.locale_occurrences = 0; | - |
3101 | } executed: } Execution Count:2508891 | 2508891 |
3102 | | - |
3103 | ++d.occurrences; | - |
3104 | if (locale_arg) evaluated: locale_arg yes Evaluation Count:215 | yes Evaluation Count:2508782 |
| 215-2508782 |
3105 | ++d.locale_occurrences; executed: ++d.locale_occurrences; Execution Count:215 | 215 |
3106 | d.escape_len += c - escape_start; | - |
3107 | } executed: } Execution Count:2508994 | 2508994 |
3108 | return d; executed: return d; Execution Count:2501808 | 2501808 |
3109 | } | - |
3110 | | - |
3111 | static QString replaceArgEscapes(const QString &s, const ArgEscapeData &d, int field_width, | - |
3112 | const QString &arg, const QString &larg, QChar fillChar = QLatin1Char(' ')) | - |
3113 | { | - |
3114 | const QChar *uc_begin = s.unicode(); | - |
3115 | const QChar *uc_end = uc_begin + s.length(); | - |
3116 | | - |
3117 | int abs_field_width = qAbs(field_width); | - |
3118 | int result_len = s.length() | - |
3119 | - d.escape_len | - |
3120 | + (d.occurrences - d.locale_occurrences) | - |
3121 | *qMax(abs_field_width, arg.length()) | - |
3122 | + d.locale_occurrences | - |
3123 | *qMax(abs_field_width, larg.length()); | - |
3124 | | - |
3125 | QString result(result_len, Qt::Uninitialized); | - |
3126 | QChar *result_buff = (QChar*) result.unicode(); | - |
3127 | | - |
3128 | QChar *rc = result_buff; | - |
3129 | const QChar *c = uc_begin; | - |
3130 | int repl_cnt = 0; | - |
3131 | while (c != uc_end) { evaluated: c != uc_end yes Evaluation Count:2516112 | yes Evaluation Count:2501784 |
| 2501784-2516112 |
3132 | | - |
3133 | | - |
3134 | | - |
3135 | | - |
3136 | const QChar *text_start = c; | - |
3137 | | - |
3138 | while (c->unicode() != '%') evaluated: c->unicode() != '%' yes Evaluation Count:13927222 | yes Evaluation Count:2516112 |
| 2516112-13927222 |
3139 | ++c; executed: ++c; Execution Count:13927224 | 13927224 |
3140 | | - |
3141 | const QChar *escape_start = c++; | - |
3142 | | - |
3143 | bool locale_arg = false; | - |
3144 | if (c->unicode() == 'L') { evaluated: c->unicode() == 'L' yes Evaluation Count:215 | yes Evaluation Count:2515893 |
| 215-2515893 |
3145 | locale_arg = true; | - |
3146 | ++c; | - |
3147 | } executed: } Execution Count:215 | 215 |
3148 | | - |
3149 | int escape = c->digitValue(); | - |
3150 | if (escape != -1) { evaluated: escape != -1 yes Evaluation Count:2516049 | yes Evaluation Count:63 |
| 63-2516049 |
3151 | if (c + 1 != uc_end && (c + 1)->digitValue() != -1) { evaluated: c + 1 != uc_end yes Evaluation Count:1680407 | yes Evaluation Count:835655 |
evaluated: (c + 1)->digitValue() != -1 yes Evaluation Count:8 | yes Evaluation Count:1680397 |
| 8-1680407 |
3152 | escape = (10 * escape) + (c + 1)->digitValue(); | - |
3153 | ++c; | - |
3154 | } executed: } Execution Count:8 | 8 |
3155 | } executed: } Execution Count:2516040 | 2516040 |
3156 | | - |
3157 | if (escape != d.min_escape) { evaluated: escape != d.min_escape yes Evaluation Count:14216 | yes Evaluation Count:2501884 |
| 14216-2501884 |
3158 | memcpy(rc, text_start, (c - text_start)*sizeof(QChar)); | - |
3159 | rc += c - text_start; | - |
3160 | } executed: } Execution Count:14216 | 14216 |
3161 | else { | - |
3162 | ++c; | - |
3163 | | - |
3164 | memcpy(rc, text_start, (escape_start - text_start)*sizeof(QChar)); | - |
3165 | rc += escape_start - text_start; | - |
3166 | | - |
3167 | uint pad_chars; | - |
3168 | if (locale_arg) evaluated: locale_arg yes Evaluation Count:214 | yes Evaluation Count:2501672 |
| 214-2501672 |
3169 | pad_chars = qMax(abs_field_width, larg.length()) - larg.length(); executed: pad_chars = qMax(abs_field_width, larg.length()) - larg.length(); Execution Count:214 | 214 |
3170 | else | - |
3171 | pad_chars = qMax(abs_field_width, arg.length()) - arg.length(); executed: pad_chars = qMax(abs_field_width, arg.length()) - arg.length(); Execution Count:2501673 | 2501673 |
3172 | | - |
3173 | if (field_width > 0) { evaluated: field_width > 0 yes Evaluation Count:909 | yes Evaluation Count:2500977 |
| 909-2500977 |
3174 | for (uint i = 0; i < pad_chars; ++i) evaluated: i < pad_chars yes Evaluation Count:4895 | yes Evaluation Count:909 |
| 909-4895 |
3175 | (rc++)->unicode() = fillChar.unicode(); executed: (rc++)->unicode() = fillChar.unicode(); Execution Count:4895 | 4895 |
3176 | } executed: } Execution Count:909 | 909 |
3177 | | - |
3178 | if (locale_arg) { evaluated: locale_arg yes Evaluation Count:214 | yes Evaluation Count:2501670 |
| 214-2501670 |
3179 | memcpy(rc, larg.unicode(), larg.length()*sizeof(QChar)); | - |
3180 | rc += larg.length(); | - |
3181 | } executed: } Execution Count:214 | 214 |
3182 | else { | - |
3183 | memcpy(rc, arg.unicode(), arg.length()*sizeof(QChar)); | - |
3184 | rc += arg.length(); | - |
3185 | } executed: } Execution Count:2501672 | 2501672 |
3186 | | - |
3187 | if (field_width < 0) { evaluated: field_width < 0 yes Evaluation Count:5 | yes Evaluation Count:2501882 |
| 5-2501882 |
3188 | for (uint i = 0; i < pad_chars; ++i) evaluated: i < pad_chars yes Evaluation Count:12 | yes Evaluation Count:5 |
| 5-12 |
3189 | (rc++)->unicode() = fillChar.unicode(); executed: (rc++)->unicode() = fillChar.unicode(); Execution Count:12 | 12 |
3190 | } executed: } Execution Count:5 | 5 |
3191 | | - |
3192 | if (++repl_cnt == d.occurrences) { evaluated: ++repl_cnt == d.occurrences yes Evaluation Count:2501782 | yes Evaluation Count:104 |
| 104-2501782 |
3193 | memcpy(rc, c, (uc_end - c)*sizeof(QChar)); | - |
3194 | rc += uc_end - c; | - |
3195 | qt_noop(); | - |
3196 | c = uc_end; | - |
3197 | } executed: } Execution Count:2501784 | 2501784 |
3198 | } executed: } Execution Count:2501888 | 2501888 |
3199 | } | - |
3200 | qt_noop(); | - |
3201 | | - |
3202 | return result; executed: return result; Execution Count:2501784 | 2501784 |
3203 | } | - |
3204 | QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const | - |
3205 | { | - |
3206 | ArgEscapeData d = findArgEscapes(*this); | - |
3207 | | - |
3208 | if (d.occurrences == 0) { partially evaluated: d.occurrences == 0 no Evaluation Count:0 | yes Evaluation Count:43996 |
| 0-43996 |
3209 | QMessageLogger("tools/qstring.cpp", 6806, __PRETTY_FUNCTION__).warning("QString::arg: Argument missing: %s, %s", toLocal8Bit().data(), | - |
3210 | a.toLocal8Bit().data()); | - |
3211 | return *this; never executed: return *this; | 0 |
3212 | } | - |
3213 | return replaceArgEscapes(*this, d, fieldWidth, a, a, fillChar); executed: return replaceArgEscapes(*this, d, fieldWidth, a, a, fillChar); Execution Count:43996 | 43996 |
3214 | } | - |
3215 | QString QString::arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const | - |
3216 | { | - |
3217 | ArgEscapeData d = findArgEscapes(*this); | - |
3218 | | - |
3219 | if (d.occurrences == 0) { evaluated: d.occurrences == 0 yes Evaluation Count:6 | yes Evaluation Count:2346690 |
| 6-2346690 |
3220 | QMessageLogger("tools/qstring.cpp", 6991, __PRETTY_FUNCTION__).warning() << "QString::arg: Argument missing:" << *this << ',' << a; | - |
3221 | return *this; executed: return *this; Execution Count:6 | 6 |
3222 | } | - |
3223 | | - |
3224 | unsigned flags = QLocalePrivate::NoFlags; | - |
3225 | if (fillChar == QLatin1Char('0')) evaluated: fillChar == QLatin1Char('0') yes Evaluation Count:311 | yes Evaluation Count:2346378 |
| 311-2346378 |
3226 | flags = QLocalePrivate::ZeroPadded; executed: flags = QLocalePrivate::ZeroPadded; Execution Count:311 | 311 |
3227 | | - |
3228 | QString arg; | - |
3229 | if (d.occurrences > d.locale_occurrences) evaluated: d.occurrences > d.locale_occurrences yes Evaluation Count:2346483 | yes Evaluation Count:206 |
| 206-2346483 |
3230 | arg = QLocale::c().d->longLongToString(a, -1, base, fieldWidth, flags); executed: arg = QLocale::c().d->longLongToString(a, -1, base, fieldWidth, flags); Execution Count:2346481 | 2346481 |
3231 | | - |
3232 | QString locale_arg; | - |
3233 | if (d.locale_occurrences > 0) { evaluated: d.locale_occurrences > 0 yes Evaluation Count:206 | yes Evaluation Count:2346476 |
| 206-2346476 |
3234 | QLocale locale; | - |
3235 | if (!(locale.numberOptions() & QLocale::OmitGroupSeparator)) evaluated: !(locale.numberOptions() & QLocale::OmitGroupSeparator) yes Evaluation Count:205 | yes Evaluation Count:1 |
| 1-205 |
3236 | flags |= QLocalePrivate::ThousandsGroup; executed: flags |= QLocalePrivate::ThousandsGroup; Execution Count:205 | 205 |
3237 | locale_arg = locale.d->longLongToString(a, -1, base, fieldWidth, flags); | - |
3238 | } executed: } Execution Count:206 | 206 |
3239 | | - |
3240 | return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); executed: return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); Execution Count:2346682 | 2346682 |
3241 | } | - |
3242 | QString QString::arg(qulonglong a, int fieldWidth, int base, QChar fillChar) const | - |
3243 | { | - |
3244 | ArgEscapeData d = findArgEscapes(*this); | - |
3245 | | - |
3246 | if (d.occurrences == 0) { partially evaluated: d.occurrences == 0 no Evaluation Count:0 | yes Evaluation Count:4542 |
| 0-4542 |
3247 | QMessageLogger("tools/qstring.cpp", 7035, __PRETTY_FUNCTION__).warning() << "QString::arg: Argument missing:" << *this << ',' << a; | - |
3248 | return *this; never executed: return *this; | 0 |
3249 | } | - |
3250 | | - |
3251 | unsigned flags = QLocalePrivate::NoFlags; | - |
3252 | if (fillChar == QLatin1Char('0')) partially evaluated: fillChar == QLatin1Char('0') no Evaluation Count:0 | yes Evaluation Count:4543 |
| 0-4543 |
3253 | flags = QLocalePrivate::ZeroPadded; never executed: flags = QLocalePrivate::ZeroPadded; | 0 |
3254 | | - |
3255 | QString arg; | - |
3256 | if (d.occurrences > d.locale_occurrences) partially evaluated: d.occurrences > d.locale_occurrences yes Evaluation Count:4540 | no Evaluation Count:0 |
| 0-4540 |
3257 | arg = QLocale::c().d->unsLongLongToString(a, -1, base, fieldWidth, flags); executed: arg = QLocale::c().d->unsLongLongToString(a, -1, base, fieldWidth, flags); Execution Count:4540 | 4540 |
3258 | | - |
3259 | QString locale_arg; | - |
3260 | if (d.locale_occurrences > 0) { partially evaluated: d.locale_occurrences > 0 no Evaluation Count:0 | yes Evaluation Count:4539 |
| 0-4539 |
3261 | QLocale locale; | - |
3262 | if (!(locale.numberOptions() & QLocale::OmitGroupSeparator)) never evaluated: !(locale.numberOptions() & QLocale::OmitGroupSeparator) | 0 |
3263 | flags |= QLocalePrivate::ThousandsGroup; never executed: flags |= QLocalePrivate::ThousandsGroup; | 0 |
3264 | locale_arg = locale.d->unsLongLongToString(a, -1, base, fieldWidth, flags); | - |
3265 | } | 0 |
3266 | | - |
3267 | return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); executed: return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); Execution Count:4540 | 4540 |
3268 | } | - |
3269 | QString QString::arg(QChar a, int fieldWidth, QChar fillChar) const | - |
3270 | { | - |
3271 | QString c; | - |
3272 | c += a; | - |
3273 | return arg(c, fieldWidth, fillChar); executed: return arg(c, fieldWidth, fillChar); Execution Count:470 | 470 |
3274 | } | - |
3275 | | - |
3276 | | - |
3277 | | - |
3278 | | - |
3279 | | - |
3280 | | - |
3281 | QString QString::arg(char a, int fieldWidth, QChar fillChar) const | - |
3282 | { | - |
3283 | QString c; | - |
3284 | c += QLatin1Char(a); | - |
3285 | return arg(c, fieldWidth, fillChar); executed: return arg(c, fieldWidth, fillChar); Execution Count:3 | 3 |
3286 | } | - |
3287 | QString QString::arg(double a, int fieldWidth, char fmt, int prec, QChar fillChar) const | - |
3288 | { | - |
3289 | ArgEscapeData d = findArgEscapes(*this); | - |
3290 | | - |
3291 | if (d.occurrences == 0) { partially evaluated: d.occurrences == 0 no Evaluation Count:0 | yes Evaluation Count:106587 |
| 0-106587 |
3292 | QMessageLogger("tools/qstring.cpp", 7147, __PRETTY_FUNCTION__).warning("QString::arg: Argument missing: %s, %g", toLocal8Bit().data(), a); | - |
3293 | return *this; never executed: return *this; | 0 |
3294 | } | - |
3295 | | - |
3296 | unsigned flags = QLocalePrivate::NoFlags; | - |
3297 | if (fillChar == QLatin1Char('0')) evaluated: fillChar == QLatin1Char('0') yes Evaluation Count:2 | yes Evaluation Count:106585 |
| 2-106585 |
3298 | flags = QLocalePrivate::ZeroPadded; executed: flags = QLocalePrivate::ZeroPadded; Execution Count:2 | 2 |
3299 | | - |
3300 | if (qIsUpper(fmt)) partially evaluated: qIsUpper(fmt) no Evaluation Count:0 | yes Evaluation Count:106587 |
| 0-106587 |
3301 | flags |= QLocalePrivate::CapitalEorX; never executed: flags |= QLocalePrivate::CapitalEorX; | 0 |
3302 | fmt = qToLower(fmt); | - |
3303 | | - |
3304 | QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; | - |
3305 | switch (fmt) { | - |
3306 | case 'f': | - |
3307 | form = QLocalePrivate::DFDecimal; | - |
3308 | break; | 0 |
3309 | case 'e': | - |
3310 | form = QLocalePrivate::DFExponent; | - |
3311 | break; | 0 |
3312 | case 'g': | - |
3313 | form = QLocalePrivate::DFSignificantDigits; | - |
3314 | break; executed: break; Execution Count:106587 | 106587 |
3315 | default: | - |
3316 | | - |
3317 | | - |
3318 | | - |
3319 | break; | 0 |
3320 | } | - |
3321 | | - |
3322 | QString arg; | - |
3323 | if (d.occurrences > d.locale_occurrences) evaluated: d.occurrences > d.locale_occurrences yes Evaluation Count:106583 | yes Evaluation Count:4 |
| 4-106583 |
3324 | arg = QLocale::c().d->doubleToString(a, prec, form, fieldWidth, flags); executed: arg = QLocale::c().d->doubleToString(a, prec, form, fieldWidth, flags); Execution Count:106583 | 106583 |
3325 | | - |
3326 | QString locale_arg; | - |
3327 | if (d.locale_occurrences > 0) { evaluated: d.locale_occurrences > 0 yes Evaluation Count:4 | yes Evaluation Count:106583 |
| 4-106583 |
3328 | QLocale locale; | - |
3329 | | - |
3330 | if (!(locale.numberOptions() & QLocale::OmitGroupSeparator)) evaluated: !(locale.numberOptions() & QLocale::OmitGroupSeparator) yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
3331 | flags |= QLocalePrivate::ThousandsGroup; executed: flags |= QLocalePrivate::ThousandsGroup; Execution Count:3 | 3 |
3332 | locale_arg = locale.d->doubleToString(a, prec, form, fieldWidth, flags); | - |
3333 | } executed: } Execution Count:4 | 4 |
3334 | | - |
3335 | return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); executed: return replaceArgEscapes(*this, d, fieldWidth, arg, locale_arg, fillChar); Execution Count:106587 | 106587 |
3336 | } | - |
3337 | | - |
3338 | static int getEscape(const QChar *uc, int *pos, int len, int maxNumber = 999) | - |
3339 | { | - |
3340 | int i = *pos; | - |
3341 | ++i; | - |
3342 | if (i < len && uc[i] == QLatin1Char('L')) partially evaluated: i < len yes Evaluation Count:961114 | no Evaluation Count:0 |
partially evaluated: uc[i] == QLatin1Char('L') no Evaluation Count:0 | yes Evaluation Count:961114 |
| 0-961114 |
3343 | ++i; | 0 |
3344 | if (i < len) { partially evaluated: i < len yes Evaluation Count:961114 | no Evaluation Count:0 |
| 0-961114 |
3345 | int escape = uc[i].unicode() - '0'; | - |
3346 | if (uint(escape) >= 10U) evaluated: uint(escape) >= 10U yes Evaluation Count:8 | yes Evaluation Count:961106 |
| 8-961106 |
3347 | return -1; executed: return -1; Execution Count:8 | 8 |
3348 | ++i; | - |
3349 | while (i < len) { evaluated: i < len yes Evaluation Count:956122 | yes Evaluation Count:5028 |
| 5028-956122 |
3350 | int digit = uc[i].unicode() - '0'; | - |
3351 | if (uint(digit) >= 10U) evaluated: uint(digit) >= 10U yes Evaluation Count:956078 | yes Evaluation Count:44 |
| 44-956078 |
3352 | break; executed: break; Execution Count:956078 | 956078 |
3353 | escape = (escape * 10) + digit; | - |
3354 | ++i; | - |
3355 | } executed: } Execution Count:44 | 44 |
3356 | if (escape <= maxNumber) { evaluated: escape <= maxNumber yes Evaluation Count:961073 | yes Evaluation Count:33 |
| 33-961073 |
3357 | *pos = i; | - |
3358 | return escape; executed: return escape; Execution Count:961073 | 961073 |
3359 | } | - |
3360 | } executed: } Execution Count:33 | 33 |
3361 | return -1; executed: return -1; Execution Count:33 | 33 |
3362 | } | - |
3363 | | - |
3364 | QString QString::multiArg(int numArgs, const QString **args) const | - |
3365 | { | - |
3366 | QString result; | - |
3367 | QMap<int, int> numbersUsed; | - |
3368 | const QChar *uc = (const QChar *) d->data(); | - |
3369 | const int len = d->size; | - |
3370 | const int end = len - 1; | - |
3371 | int lastNumber = -1; | - |
3372 | int i = 0; | - |
3373 | | - |
3374 | | - |
3375 | while (i < end) { evaluated: i < end yes Evaluation Count:5625954 | yes Evaluation Count:161856 |
| 161856-5625954 |
3376 | if (uc[i] == QLatin1Char('%')) { evaluated: uc[i] == QLatin1Char('%') yes Evaluation Count:480557 | yes Evaluation Count:5145397 |
| 480557-5145397 |
3377 | int number = getEscape(uc, &i, len); | - |
3378 | if (number != -1) { evaluated: number != -1 yes Evaluation Count:480551 | yes Evaluation Count:6 |
| 6-480551 |
3379 | numbersUsed.insert(number, -1); | - |
3380 | continue; executed: continue; Execution Count:480551 | 480551 |
3381 | } | - |
3382 | } executed: } Execution Count:6 | 6 |
3383 | ++i; | - |
3384 | } executed: } Execution Count:5145403 | 5145403 |
3385 | | - |
3386 | | - |
3387 | QMap<int, int>::iterator j = numbersUsed.begin(); | - |
3388 | QMap<int, int>::iterator jend = numbersUsed.end(); | - |
3389 | int arg = 0; | - |
3390 | while (j != jend && arg < numArgs) { evaluated: j != jend yes Evaluation Count:480547 | yes Evaluation Count:161829 |
evaluated: arg < numArgs yes Evaluation Count:480520 | yes Evaluation Count:27 |
| 27-480547 |
3391 | *j = arg++; | - |
3392 | lastNumber = j.key(); | - |
3393 | ++j; | - |
3394 | } executed: } Execution Count:480520 | 480520 |
3395 | | - |
3396 | | - |
3397 | if (numArgs > arg) { partially evaluated: numArgs > arg no Evaluation Count:0 | yes Evaluation Count:161856 |
| 0-161856 |
3398 | QMessageLogger("tools/qstring.cpp", 7253, __PRETTY_FUNCTION__).warning("QString::arg: %d argument(s) missing in %s", numArgs - arg, toLocal8Bit().data()); | - |
3399 | numArgs = arg; | - |
3400 | } | 0 |
3401 | | - |
3402 | i = 0; | - |
3403 | while (i < len) { evaluated: i < len yes Evaluation Count:5785328 | yes Evaluation Count:161856 |
| 161856-5785328 |
3404 | if (uc[i] == QLatin1Char('%') && i != end) { evaluated: uc[i] == QLatin1Char('%') yes Evaluation Count:480558 | yes Evaluation Count:5304770 |
evaluated: i != end yes Evaluation Count:480557 | yes Evaluation Count:1 |
| 1-5304770 |
3405 | int number = getEscape(uc, &i, len, lastNumber); | - |
3406 | int arg = numbersUsed[number]; | - |
3407 | if (number != -1 && arg != -1) { evaluated: number != -1 yes Evaluation Count:480522 | yes Evaluation Count:35 |
partially evaluated: arg != -1 yes Evaluation Count:480522 | no Evaluation Count:0 |
| 0-480522 |
3408 | result += *args[arg]; | - |
3409 | continue; executed: continue; Execution Count:480522 | 480522 |
3410 | } | - |
3411 | } executed: } Execution Count:35 | 35 |
3412 | result += uc[i++]; | - |
3413 | } executed: } Execution Count:5304806 | 5304806 |
3414 | return result; executed: return result; Execution Count:161856 | 161856 |
3415 | } | - |
3416 | | - |
3417 | | - |
3418 | | - |
3419 | | - |
3420 | | - |
3421 | | - |
3422 | bool QString::isSimpleText() const | - |
3423 | { | - |
3424 | const ushort *p = d->data(); | - |
3425 | const ushort * const end = p + d->size; | - |
3426 | while (p < end) { | 0 |
3427 | ushort uc = *p; | - |
3428 | | - |
3429 | if (uc > 0x058f && (uc < 0x1100 || uc > 0xfb0f)) { never evaluated: uc > 0x058f never evaluated: uc < 0x1100 never evaluated: uc > 0xfb0f | 0 |
3430 | return false; never executed: return false; | 0 |
3431 | } | - |
3432 | p++; | - |
3433 | } | 0 |
3434 | | - |
3435 | return true; never executed: return true; | 0 |
3436 | } | - |
3437 | | - |
3438 | | - |
3439 | | - |
3440 | | - |
3441 | | - |
3442 | bool QString::isRightToLeft() const | - |
3443 | { | - |
3444 | const ushort *p = d->data(); | - |
3445 | const ushort * const end = p + d->size; | - |
3446 | while (p < end) { evaluated: p < end yes Evaluation Count:305417 | yes Evaluation Count:47969 |
| 47969-305417 |
3447 | uint ucs4 = *p; | - |
3448 | if (QChar::isHighSurrogate(ucs4) && p < end - 1) { evaluated: QChar::isHighSurrogate(ucs4) yes Evaluation Count:3 | yes Evaluation Count:305414 |
partially evaluated: p < end - 1 yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-305414 |
3449 | ushort low = p[1]; | - |
3450 | if (QChar::isLowSurrogate(low)) { partially evaluated: QChar::isLowSurrogate(low) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
3451 | ucs4 = QChar::surrogateToUcs4(ucs4, low); | - |
3452 | ++p; | - |
3453 | } executed: } Execution Count:3 | 3 |
3454 | } executed: } Execution Count:3 | 3 |
3455 | switch (QChar::direction(ucs4)) | - |
3456 | { | - |
3457 | case QChar::DirL: | - |
3458 | return false; executed: return false; Execution Count:37671 | 37671 |
3459 | case QChar::DirR: | - |
3460 | case QChar::DirAL: | - |
3461 | return true; executed: return true; Execution Count:23 | 23 |
3462 | default: | - |
3463 | break; executed: break; Execution Count:267723 | 267723 |
3464 | } | - |
3465 | ++p; | - |
3466 | } executed: } Execution Count:267723 | 267723 |
3467 | return false; executed: return false; Execution Count:47969 | 47969 |
3468 | } | - |
3469 | QString QString::fromRawData(const QChar *unicode, int size) | - |
3470 | { | - |
3471 | Data *x; | - |
3472 | if (!unicode) { evaluated: !unicode yes Evaluation Count:2 | yes Evaluation Count:34043 |
| 2-34043 |
3473 | x = Data::sharedNull(); | - |
3474 | } else if (!size) { partially evaluated: !size no Evaluation Count:0 | yes Evaluation Count:34062 |
executed: } Execution Count:2 | 0-34062 |
3475 | x = Data::allocate(0); | - |
3476 | } else { | 0 |
3477 | x = Data::fromRawData(reinterpret_cast<const ushort *>(unicode), size); | - |
3478 | do { if (!(x)) qBadAlloc(); } while (0); partially evaluated: !(x) no Evaluation Count:0 | yes Evaluation Count:34062 |
partially evaluated: 0 no Evaluation Count:0 | yes Evaluation Count:34054 |
never executed: qBadAlloc(); executed: } Execution Count:34058 | 0-34062 |
3479 | } executed: } Execution Count:34059 | 34059 |
3480 | QStringDataPtr dataPtr = { x }; | - |
3481 | return QString(dataPtr); executed: return QString(dataPtr); Execution Count:34065 | 34065 |
3482 | } | - |
3483 | QString &QString::setRawData(const QChar *unicode, int size) | - |
3484 | { | - |
3485 | if (d->ref.isShared() || d->alloc) { evaluated: d->ref.isShared() yes Evaluation Count:1 | yes Evaluation Count:2 |
evaluated: d->alloc yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-2 |
3486 | *this = fromRawData(unicode, size); | - |
3487 | } else { executed: } Execution Count:2 | 2 |
3488 | if (unicode) { partially evaluated: unicode yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
3489 | d->size = size; | - |
3490 | d->offset = reinterpret_cast<const char *>(unicode) - reinterpret_cast<char *>(d); | - |
3491 | } else { executed: } Execution Count:1 | 1 |
3492 | d->offset = sizeof(QStringData); | - |
3493 | d->size = 0; | - |
3494 | } | 0 |
3495 | } | - |
3496 | return *this; executed: return *this; Execution Count:3 | 3 |
3497 | } | - |
3498 | QDataStream &operator<<(QDataStream &out, const QString &str) | - |
3499 | { | - |
3500 | if (out.version() == 1) { partially evaluated: out.version() == 1 no Evaluation Count:0 | yes Evaluation Count:13960 |
| 0-13960 |
3501 | out << str.toLatin1(); | - |
3502 | } else { | 0 |
3503 | if (!str.isNull() || out.version() < 3) { evaluated: !str.isNull() yes Evaluation Count:13732 | yes Evaluation Count:228 |
evaluated: out.version() < 3 yes Evaluation Count:1 | yes Evaluation Count:227 |
| 1-13732 |
3504 | if ((out.byteOrder() == QDataStream::BigEndian) == (QSysInfo::ByteOrder == QSysInfo::BigEndian)) { partially evaluated: (out.byteOrder() == QDataStream::BigEndian) == (QSysInfo::ByteOrder == QSysInfo::BigEndian) no Evaluation Count:0 | yes Evaluation Count:13733 |
| 0-13733 |
3505 | out.writeBytes(reinterpret_cast<const char *>(str.unicode()), sizeof(QChar) * str.length()); | - |
3506 | } else { | 0 |
3507 | QVarLengthArray<ushort> buffer(str.length()); | - |
3508 | const ushort *data = reinterpret_cast<const ushort *>(str.constData()); | - |
3509 | for (int i = 0; i < str.length(); i++) { evaluated: i < str.length() yes Evaluation Count:48556 | yes Evaluation Count:13733 |
| 13733-48556 |
3510 | buffer[i] = qbswap(*data); | - |
3511 | ++data; | - |
3512 | } executed: } Execution Count:48556 | 48556 |
3513 | out.writeBytes(reinterpret_cast<const char *>(buffer.data()), sizeof(ushort) * buffer.size()); | - |
3514 | } executed: } Execution Count:13733 | 13733 |
3515 | } else { | - |
3516 | | - |
3517 | out << (quint32)0xffffffff; | - |
3518 | } executed: } Execution Count:227 | 227 |
3519 | } | - |
3520 | return out; executed: return out; Execution Count:13960 | 13960 |
3521 | } | - |
3522 | QDataStream &operator>>(QDataStream &in, QString &str) | - |
3523 | { | - |
3524 | | - |
3525 | | - |
3526 | | - |
3527 | | - |
3528 | | - |
3529 | | - |
3530 | if (in.version() == 1) { partially evaluated: in.version() == 1 no Evaluation Count:0 | yes Evaluation Count:13964 |
| 0-13964 |
3531 | QByteArray l; | - |
3532 | in >> l; | - |
3533 | str = QString::fromLatin1(l); | - |
3534 | } else { | 0 |
3535 | quint32 bytes = 0; | - |
3536 | in >> bytes; | - |
3537 | if (bytes == 0xffffffff) { evaluated: bytes == 0xffffffff yes Evaluation Count:222 | yes Evaluation Count:13742 |
| 222-13742 |
3538 | str.clear(); | - |
3539 | } else if (bytes > 0) { evaluated: bytes > 0 yes Evaluation Count:13491 | yes Evaluation Count:251 |
executed: } Execution Count:222 | 222-13491 |
3540 | if (bytes & 0x1) { evaluated: bytes & 0x1 yes Evaluation Count:6 | yes Evaluation Count:13485 |
| 6-13485 |
3541 | str.clear(); | - |
3542 | in.setStatus(QDataStream::ReadCorruptData); | - |
3543 | return in; executed: return in; Execution Count:6 | 6 |
3544 | } | - |
3545 | | - |
3546 | const quint32 Step = 1024 * 1024; | - |
3547 | quint32 len = bytes / 2; | - |
3548 | quint32 allocated = 0; | - |
3549 | | - |
3550 | while (allocated < len) { evaluated: allocated < len yes Evaluation Count:13497 | yes Evaluation Count:13471 |
| 13471-13497 |
3551 | int blockSize = qMin(Step, len - allocated); | - |
3552 | str.resize(allocated + blockSize); | - |
3553 | if (in.readRawData(reinterpret_cast<char *>(str.data()) + allocated * 2, | 14-13483 |
3554 | blockSize * 2) != blockSize * 2) { evaluated: in.readRawData(reinterpret_cast<char *>(str.data()) + allocated * 2, blockSize * 2) != blockSize * 2 yes Evaluation Count:14 | yes Evaluation Count:13483 |
| 14-13483 |
3555 | str.clear(); | - |
3556 | in.setStatus(QDataStream::ReadPastEnd); | - |
3557 | return in; executed: return in; Execution Count:14 | 14 |
3558 | } | - |
3559 | allocated += blockSize; | - |
3560 | } executed: } Execution Count:13483 | 13483 |
3561 | | - |
3562 | if ((in.byteOrder() == QDataStream::BigEndian) | 0-13471 |
3563 | != (QSysInfo::ByteOrder == QSysInfo::BigEndian)) { partially evaluated: (in.byteOrder() == QDataStream::BigEndian) != (QSysInfo::ByteOrder == QSysInfo::BigEndian) yes Evaluation Count:13471 | no Evaluation Count:0 |
| 0-13471 |
3564 | ushort *data = reinterpret_cast<ushort *>(str.data()); | - |
3565 | while (len--) { evaluated: len-- yes Evaluation Count:12625938 | yes Evaluation Count:13471 |
| 13471-12625938 |
3566 | *data = qbswap(*data); | - |
3567 | ++data; | - |
3568 | } executed: } Execution Count:12625938 | 12625938 |
3569 | } executed: } Execution Count:13471 | 13471 |
3570 | } else { executed: } Execution Count:13471 | 13471 |
3571 | str = QString(QLatin1String("")); | - |
3572 | } executed: } Execution Count:251 | 251 |
3573 | } | - |
3574 | return in; executed: return in; Execution Count:13944 | 13944 |
3575 | } | - |
3576 | QString QStringRef::toString() const { | - |
3577 | if (!m_string) evaluated: !m_string yes Evaluation Count:2147 | yes Evaluation Count:82486 |
| 2147-82486 |
3578 | return QString(); executed: return QString(); Execution Count:2147 | 2147 |
3579 | if (m_size && m_position == 0 && m_size == m_string->size()) evaluated: m_size yes Evaluation Count:82434 | yes Evaluation Count:52 |
evaluated: m_position == 0 yes Evaluation Count:1488 | yes Evaluation Count:80946 |
evaluated: m_size == m_string->size() yes Evaluation Count:1487 | yes Evaluation Count:1 |
| 1-82434 |
3580 | return *m_string; executed: return *m_string; Execution Count:1487 | 1487 |
3581 | return QString(m_string->unicode() + m_position, m_size); executed: return QString(m_string->unicode() + m_position, m_size); Execution Count:80999 | 80999 |
3582 | } | - |
3583 | | - |
3584 | | - |
3585 | | - |
3586 | | - |
3587 | | - |
3588 | | - |
3589 | | - |
3590 | bool operator==(const QStringRef &s1,const QStringRef &s2) | - |
3591 | { return (s1.size() == s2.size() && | 245123 |
3592 | qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size())); executed: return (s1.size() == s2.size() && qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size())); Execution Count:245123 | 245123 |
3593 | } | - |
3594 | | - |
3595 | | - |
3596 | | - |
3597 | | - |
3598 | | - |
3599 | | - |
3600 | bool operator==(const QString &s1,const QStringRef &s2) | - |
3601 | { return (s1.size() == s2.size() && | 52291 |
3602 | qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size())); executed: return (s1.size() == s2.size() && qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size())); Execution Count:52291 | 52291 |
3603 | } | - |
3604 | | - |
3605 | | - |
3606 | | - |
3607 | | - |
3608 | | - |
3609 | | - |
3610 | bool operator==(QLatin1String s1, const QStringRef &s2) | - |
3611 | { | - |
3612 | if (s1.size() != s2.size()) evaluated: s1.size() != s2.size() yes Evaluation Count:231457 | yes Evaluation Count:29544 |
| 29544-231457 |
3613 | return false; executed: return false; Execution Count:231457 | 231457 |
3614 | | - |
3615 | const ushort *uc = reinterpret_cast<const ushort *>(s2.unicode()); | - |
3616 | const ushort *e = uc + s2.size(); | - |
3617 | const uchar *c = reinterpret_cast<const uchar *>(s1.latin1()); | - |
3618 | if (!c) partially evaluated: !c no Evaluation Count:0 | yes Evaluation Count:29544 |
| 0-29544 |
3619 | return s2.isEmpty(); never executed: return s2.isEmpty(); | 0 |
3620 | | - |
3621 | while (*c) { evaluated: *c yes Evaluation Count:165334 | yes Evaluation Count:25312 |
| 25312-165334 |
3622 | if (uc == e || *uc != *c) partially evaluated: uc == e no Evaluation Count:0 | yes Evaluation Count:165334 |
evaluated: *uc != *c yes Evaluation Count:4232 | yes Evaluation Count:161102 |
| 0-165334 |
3623 | return false; executed: return false; Execution Count:4232 | 4232 |
3624 | ++uc; | - |
3625 | ++c; | - |
3626 | } executed: } Execution Count:161102 | 161102 |
3627 | return (uc == e); executed: return (uc == e); Execution Count:25312 | 25312 |
3628 | } | - |
3629 | bool operator<(const QStringRef &s1,const QStringRef &s2) | - |
3630 | { | - |
3631 | return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0; executed: return ucstrcmp(s1.constData(), s1.length(), s2.constData(), s2.length()) < 0; Execution Count:826 | 826 |
3632 | } | - |
3633 | QStringRef QStringRef::appendTo(QString *string) const | - |
3634 | { | - |
3635 | if (!string) partially evaluated: !string no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
3636 | return QStringRef(); never executed: return QStringRef(); | 0 |
3637 | int pos = string->size(); | - |
3638 | string->insert(pos, unicode(), size()); | - |
3639 | return QStringRef(string, pos, size()); executed: return QStringRef(string, pos, size()); Execution Count:8 | 8 |
3640 | } | - |
3641 | QString &QString::append(const QStringRef &str) | - |
3642 | { | - |
3643 | if (str.string() == this) { never evaluated: str.string() == this | 0 |
3644 | str.appendTo(this); | - |
3645 | } else if (str.string()) { never evaluated: str.string() | 0 |
3646 | int oldSize = size(); | - |
3647 | resize(oldSize + str.size()); | - |
3648 | memcpy(data() + oldSize, str.unicode(), str.size() * sizeof(QChar)); | - |
3649 | } | 0 |
3650 | return *this; never executed: return *this; | 0 |
3651 | } | - |
3652 | QStringRef QString::leftRef(int n) const | - |
3653 | { | - |
3654 | if (n >= d->size || n < 0) evaluated: n >= d->size yes Evaluation Count:2289 | yes Evaluation Count:58 |
evaluated: n < 0 yes Evaluation Count:1 | yes Evaluation Count:57 |
| 1-2289 |
3655 | n = d->size; executed: n = d->size; Execution Count:2290 | 2290 |
3656 | return QStringRef(this, 0, n); executed: return QStringRef(this, 0, n); Execution Count:2347 | 2347 |
3657 | } | - |
3658 | QStringRef QString::rightRef(int n) const | - |
3659 | { | - |
3660 | if (n >= d->size || n < 0) evaluated: n >= d->size yes Evaluation Count:3 | yes Evaluation Count:3 |
evaluated: n < 0 yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-3 |
3661 | n = d->size; executed: n = d->size; Execution Count:4 | 4 |
3662 | return QStringRef(this, d->size - n, n); executed: return QStringRef(this, d->size - n, n); Execution Count:6 | 6 |
3663 | } | - |
3664 | QStringRef QString::midRef(int position, int n) const | - |
3665 | { | - |
3666 | if (position > d->size) evaluated: position > d->size yes Evaluation Count:16 | yes Evaluation Count:562 |
| 16-562 |
3667 | return QStringRef(); executed: return QStringRef(); Execution Count:16 | 16 |
3668 | if (position < 0) { evaluated: position < 0 yes Evaluation Count:33 | yes Evaluation Count:529 |
| 33-529 |
3669 | if (n < 0 || n + position >= d->size) evaluated: n < 0 yes Evaluation Count:6 | yes Evaluation Count:27 |
evaluated: n + position >= d->size yes Evaluation Count:12 | yes Evaluation Count:15 |
| 6-27 |
3670 | return QStringRef(this, 0, d->size); executed: return QStringRef(this, 0, d->size); Execution Count:18 | 18 |
3671 | if (n + position <= 0) evaluated: n + position <= 0 yes Evaluation Count:11 | yes Evaluation Count:4 |
| 4-11 |
3672 | return QStringRef(); executed: return QStringRef(); Execution Count:11 | 11 |
3673 | | - |
3674 | n += position; | - |
3675 | position = 0; | - |
3676 | } else if (n < 0 || n > d->size - position) evaluated: n < 0 yes Evaluation Count:12 | yes Evaluation Count:517 |
evaluated: n > d->size - position yes Evaluation Count:9 | yes Evaluation Count:508 |
executed: } Execution Count:4 | 4-517 |
3677 | n = d->size - position; executed: n = d->size - position; Execution Count:21 | 21 |
3678 | return QStringRef(this, position, n); executed: return QStringRef(this, position, n); Execution Count:533 | 533 |
3679 | } | - |
3680 | int QStringRef::indexOf(const QString &str, int from, Qt::CaseSensitivity cs) const | - |
3681 | { | - |
3682 | return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs); executed: return qFindString(unicode(), length(), from, str.unicode(), str.length(), cs); Execution Count:197 | 197 |
3683 | } | - |
3684 | int QStringRef::indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const | - |
3685 | { | - |
3686 | return findChar(unicode(), length(), ch, from, cs); executed: return findChar(unicode(), length(), ch, from, cs); Execution Count:79 | 79 |
3687 | } | - |
3688 | int QStringRef::indexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const | - |
3689 | { | - |
3690 | return qt_find_latin1_string(unicode(), size(), str, from, cs); never executed: return qt_find_latin1_string(unicode(), size(), str, from, cs); | 0 |
3691 | } | - |
3692 | int QStringRef::indexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const | - |
3693 | { | - |
3694 | return qFindString(unicode(), size(), from, str.unicode(), str.size(), cs); executed: return qFindString(unicode(), size(), from, str.unicode(), str.size(), cs); Execution Count:196 | 196 |
3695 | } | - |
3696 | int QStringRef::lastIndexOf(const QString &str, int from, Qt::CaseSensitivity cs) const | - |
3697 | { | - |
3698 | const int sl = str.size(); | - |
3699 | if (sl == 1) evaluated: sl == 1 yes Evaluation Count:53 | yes Evaluation Count:50 |
| 50-53 |
3700 | return lastIndexOf(str.at(0), from, cs); executed: return lastIndexOf(str.at(0), from, cs); Execution Count:53 | 53 |
3701 | | - |
3702 | const int l = size();; | - |
3703 | if (from < 0) evaluated: from < 0 yes Evaluation Count:43 | yes Evaluation Count:7 |
| 7-43 |
3704 | from += l; executed: from += l; Execution Count:43 | 43 |
3705 | int delta = l - sl; | - |
3706 | if (from == l && sl == 0) evaluated: from == l yes Evaluation Count:2 | yes Evaluation Count:48 |
evaluated: sl == 0 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-48 |
3707 | return from; executed: return from; Execution Count:1 | 1 |
3708 | if (from < 0 || from >= l || delta < 0) evaluated: from < 0 yes Evaluation Count:6 | yes Evaluation Count:43 |
evaluated: from >= l yes Evaluation Count:2 | yes Evaluation Count:41 |
evaluated: delta < 0 yes Evaluation Count:7 | yes Evaluation Count:34 |
| 2-43 |
3709 | return -1; executed: return -1; Execution Count:15 | 15 |
3710 | if (from > delta) evaluated: from > delta yes Evaluation Count:29 | yes Evaluation Count:5 |
| 5-29 |
3711 | from = delta; executed: from = delta; Execution Count:29 | 29 |
3712 | | - |
3713 | return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, | 34 |
3714 | reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs); executed: return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs); Execution Count:34 | 34 |
3715 | } | - |
3716 | int QStringRef::lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const | - |
3717 | { | - |
3718 | return qt_last_index_of(unicode(), size(), ch, from, cs); executed: return qt_last_index_of(unicode(), size(), ch, from, cs); Execution Count:136 | 136 |
3719 | } | - |
3720 | int QStringRef::lastIndexOf(QLatin1String str, int from, Qt::CaseSensitivity cs) const | - |
3721 | { | - |
3722 | const int sl = str.size(); | - |
3723 | if (sl == 1) | 0 |
3724 | return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs); never executed: return lastIndexOf(QLatin1Char(str.latin1()[0]), from, cs); | 0 |
3725 | | - |
3726 | const int l = size(); | - |
3727 | if (from < 0) never evaluated: from < 0 | 0 |
3728 | from += l; never executed: from += l; | 0 |
3729 | int delta = l - sl; | - |
3730 | if (from == l && sl == 0) never evaluated: from == l | 0 |
3731 | return from; never executed: return from; | 0 |
3732 | if (from < 0 || from >= l || delta < 0) never evaluated: from < 0 never evaluated: from >= l never evaluated: delta < 0 | 0 |
3733 | return -1; never executed: return -1; | 0 |
3734 | if (from > delta) never evaluated: from > delta | 0 |
3735 | from = delta; never executed: from = delta; | 0 |
3736 | | - |
3737 | QVarLengthArray<ushort> s(sl); | - |
3738 | for (int i = 0; i < sl; ++i) | 0 |
3739 | s[i] = str.latin1()[i]; never executed: s[i] = str.latin1()[i]; | 0 |
3740 | | - |
3741 | return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, s.data(), sl, cs); never executed: return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, s.data(), sl, cs); | 0 |
3742 | } | - |
3743 | int QStringRef::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs) const | - |
3744 | { | - |
3745 | const int sl = str.size(); | - |
3746 | if (sl == 1) evaluated: sl == 1 yes Evaluation Count:53 | yes Evaluation Count:50 |
| 50-53 |
3747 | return lastIndexOf(str.at(0), from, cs); executed: return lastIndexOf(str.at(0), from, cs); Execution Count:53 | 53 |
3748 | | - |
3749 | const int l = size(); | - |
3750 | if (from < 0) evaluated: from < 0 yes Evaluation Count:43 | yes Evaluation Count:7 |
| 7-43 |
3751 | from += l; executed: from += l; Execution Count:43 | 43 |
3752 | int delta = l - sl; | - |
3753 | if (from == l && sl == 0) evaluated: from == l yes Evaluation Count:2 | yes Evaluation Count:48 |
evaluated: sl == 0 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-48 |
3754 | return from; executed: return from; Execution Count:1 | 1 |
3755 | if (from < 0 || from >= l || delta < 0) evaluated: from < 0 yes Evaluation Count:6 | yes Evaluation Count:43 |
evaluated: from >= l yes Evaluation Count:2 | yes Evaluation Count:41 |
evaluated: delta < 0 yes Evaluation Count:7 | yes Evaluation Count:34 |
| 2-43 |
3756 | return -1; executed: return -1; Execution Count:15 | 15 |
3757 | if (from > delta) evaluated: from > delta yes Evaluation Count:29 | yes Evaluation Count:5 |
| 5-29 |
3758 | from = delta; executed: from = delta; Execution Count:29 | 29 |
3759 | | - |
3760 | return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, | 34 |
3761 | reinterpret_cast<const ushort*>(str.unicode()), | 34 |
3762 | str.size(), cs); executed: return lastIndexOfHelper(reinterpret_cast<const ushort*>(unicode()), from, reinterpret_cast<const ushort*>(str.unicode()), str.size(), cs); Execution Count:34 | 34 |
3763 | } | - |
3764 | int QStringRef::count(const QString &str, Qt::CaseSensitivity cs) const | - |
3765 | { | - |
3766 | return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); Execution Count:4 | 4 |
3767 | } | - |
3768 | int QStringRef::count(QChar ch, Qt::CaseSensitivity cs) const | - |
3769 | { | - |
3770 | return qt_string_count(unicode(), size(), ch, cs); executed: return qt_string_count(unicode(), size(), ch, cs); Execution Count:5 | 5 |
3771 | } | - |
3772 | int QStringRef::count(const QStringRef &str, Qt::CaseSensitivity cs) const | - |
3773 | { | - |
3774 | return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); never executed: return qt_string_count(unicode(), size(), str.unicode(), str.size(), cs); | 0 |
3775 | } | - |
3776 | bool QStringRef::startsWith(const QString &str, Qt::CaseSensitivity cs) const | - |
3777 | { | - |
3778 | return qt_starts_with(isNull() ? 0 : unicode(), size(), | 25 |
3779 | str.isNull() ? 0 : str.unicode(), str.size(), cs); executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs); Execution Count:25 | 25 |
3780 | } | - |
3781 | | - |
3782 | | - |
3783 | | - |
3784 | | - |
3785 | | - |
3786 | | - |
3787 | bool QStringRef::startsWith(QLatin1String str, Qt::CaseSensitivity cs) const | - |
3788 | { | - |
3789 | return qt_starts_with(isNull() ? 0 : unicode(), size(), str, cs); executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), str, cs); Execution Count:25 | 25 |
3790 | } | - |
3791 | | - |
3792 | | - |
3793 | | - |
3794 | | - |
3795 | | - |
3796 | | - |
3797 | bool QStringRef::startsWith(const QStringRef &str, Qt::CaseSensitivity cs) const | - |
3798 | { | - |
3799 | return qt_starts_with(isNull() ? 0 : unicode(), size(), | 0 |
3800 | str.isNull() ? 0 : str.unicode(), str.size(), cs); never executed: return qt_starts_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs); | 0 |
3801 | } | - |
3802 | bool QStringRef::startsWith(QChar ch, Qt::CaseSensitivity cs) const | - |
3803 | { | - |
3804 | if (!isEmpty()) { evaluated: !isEmpty() yes Evaluation Count:19 | yes Evaluation Count:6 |
| 6-19 |
3805 | const ushort *data = reinterpret_cast<const ushort*>(unicode()); | - |
3806 | return (cs == Qt::CaseSensitive | 19 |
3807 | ? data[0] == ch | 19 |
3808 | : foldCase(data[0]) == foldCase(ch.unicode())); executed: return (cs == Qt::CaseSensitive ? data[0] == ch : foldCase(data[0]) == foldCase(ch.unicode())); Execution Count:19 | 19 |
3809 | } else { | - |
3810 | return false; executed: return false; Execution Count:6 | 6 |
3811 | } | - |
3812 | } | - |
3813 | bool QStringRef::endsWith(const QString &str, Qt::CaseSensitivity cs) const | - |
3814 | { | - |
3815 | return qt_ends_with(isNull() ? 0 : unicode(), size(), | 25 |
3816 | str.isNull() ? 0 : str.unicode(), str.size(), cs); executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs); Execution Count:25 | 25 |
3817 | } | - |
3818 | bool QStringRef::endsWith(QChar ch, Qt::CaseSensitivity cs) const | - |
3819 | { | - |
3820 | if (!isEmpty()) { evaluated: !isEmpty() yes Evaluation Count:19 | yes Evaluation Count:6 |
| 6-19 |
3821 | const ushort *data = reinterpret_cast<const ushort*>(unicode()); | - |
3822 | const int size = length(); | - |
3823 | return (cs == Qt::CaseSensitive | 19 |
3824 | ? data[size - 1] == ch | 19 |
3825 | : foldCase(data[size - 1]) == foldCase(ch.unicode())); executed: return (cs == Qt::CaseSensitive ? data[size - 1] == ch : foldCase(data[size - 1]) == foldCase(ch.unicode())); Execution Count:19 | 19 |
3826 | } else { | - |
3827 | return false; executed: return false; Execution Count:6 | 6 |
3828 | } | - |
3829 | } | - |
3830 | | - |
3831 | | - |
3832 | | - |
3833 | | - |
3834 | | - |
3835 | | - |
3836 | bool QStringRef::endsWith(QLatin1String str, Qt::CaseSensitivity cs) const | - |
3837 | { | - |
3838 | return qt_ends_with(isNull() ? 0 : unicode(), size(), str, cs); executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), str, cs); Execution Count:25 | 25 |
3839 | } | - |
3840 | | - |
3841 | | - |
3842 | | - |
3843 | | - |
3844 | | - |
3845 | | - |
3846 | bool QStringRef::endsWith(const QStringRef &str, Qt::CaseSensitivity cs) const | - |
3847 | { | - |
3848 | return qt_ends_with(isNull() ? 0 : unicode(), size(), | 0 |
3849 | str.isNull() ? 0 : str.unicode(), str.size(), cs); never executed: return qt_ends_with(isNull() ? 0 : unicode(), size(), str.isNull() ? 0 : str.unicode(), str.size(), cs); | 0 |
3850 | } | - |
3851 | static inline int qt_last_index_of(const QChar *haystack, int haystackLen, QChar needle, | - |
3852 | int from, Qt::CaseSensitivity cs) | - |
3853 | { | - |
3854 | ushort c = needle.unicode(); | - |
3855 | if (from < 0) evaluated: from < 0 yes Evaluation Count:21317 | yes Evaluation Count:4589 |
| 4589-21317 |
3856 | from += haystackLen; executed: from += haystackLen; Execution Count:21319 | 21319 |
3857 | if (from < 0 || from >= haystackLen) evaluated: from < 0 yes Evaluation Count:105 | yes Evaluation Count:25785 |
evaluated: from >= haystackLen yes Evaluation Count:19 | yes Evaluation Count:25789 |
| 19-25789 |
3858 | return -1; executed: return -1; Execution Count:124 | 124 |
3859 | if (from >= 0) { partially evaluated: from >= 0 yes Evaluation Count:25796 | no Evaluation Count:0 |
| 0-25796 |
3860 | const ushort *b = reinterpret_cast<const ushort*>(haystack); | - |
3861 | const ushort *n = b + from; | - |
3862 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:25763 | yes Evaluation Count:32 |
| 32-25763 |
3863 | for (; n >= b; --n) evaluated: n >= b yes Evaluation Count:191905 | yes Evaluation Count:10319 |
| 10319-191905 |
3864 | if (*n == c) evaluated: *n == c yes Evaluation Count:15460 | yes Evaluation Count:176554 |
| 15460-176554 |
3865 | return n - b; executed: return n - b; Execution Count:15463 | 15463 |
3866 | } else { executed: } Execution Count:10319 | 10319 |
3867 | c = foldCase(c); | - |
3868 | for (; n >= b; --n) evaluated: n >= b yes Evaluation Count:56 | yes Evaluation Count:8 |
| 8-56 |
3869 | if (foldCase(*n) == c) evaluated: foldCase(*n) == c yes Evaluation Count:24 | yes Evaluation Count:32 |
| 24-32 |
3870 | return n - b; executed: return n - b; Execution Count:24 | 24 |
3871 | } executed: } Execution Count:8 | 8 |
3872 | } | - |
3873 | return -1; executed: return -1; Execution Count:10327 | 10327 |
3874 | | - |
3875 | | - |
3876 | } | - |
3877 | | - |
3878 | static inline int qt_string_count(const QChar *haystack, int haystackLen, | - |
3879 | const QChar *needle, int needleLen, | - |
3880 | Qt::CaseSensitivity cs) | - |
3881 | { | - |
3882 | int num = 0; | - |
3883 | int i = -1; | - |
3884 | if (haystackLen > 500 && needleLen > 5) { evaluated: haystackLen > 500 yes Evaluation Count:2 | yes Evaluation Count:18 |
partially evaluated: needleLen > 5 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-18 |
3885 | QStringMatcher matcher(needle, needleLen, cs); | - |
3886 | while ((i = matcher.indexIn(haystack, haystackLen, i + 1)) != -1) never evaluated: (i = matcher.indexIn(haystack, haystackLen, i + 1)) != -1 | 0 |
3887 | ++num; | 0 |
3888 | } else { | 0 |
3889 | while ((i = qFindString(haystack, haystackLen, i + 1, needle, needleLen, cs)) != -1) evaluated: (i = qFindString(haystack, haystackLen, i + 1, needle, needleLen, cs)) != -1 yes Evaluation Count:20628 | yes Evaluation Count:20 |
| 20-20628 |
3890 | ++num; executed: ++num; Execution Count:20628 | 20628 |
3891 | } executed: } Execution Count:20 | 20 |
3892 | return num; executed: return num; Execution Count:20 | 20 |
3893 | } | - |
3894 | | - |
3895 | static inline int qt_string_count(const QChar *unicode, int size, QChar ch, | - |
3896 | Qt::CaseSensitivity cs) | - |
3897 | { | - |
3898 | ushort c = ch.unicode(); | - |
3899 | int num = 0; | - |
3900 | const ushort *b = reinterpret_cast<const ushort*>(unicode); | - |
3901 | const ushort *i = b + size; | - |
3902 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:3592 | yes Evaluation Count:2 |
| 2-3592 |
3903 | while (i != b) evaluated: i != b yes Evaluation Count:55773 | yes Evaluation Count:3592 |
| 3592-55773 |
3904 | if (*--i == c) evaluated: *--i == c yes Evaluation Count:2327 | yes Evaluation Count:53446 |
| 2327-53446 |
3905 | ++num; executed: ++num; Execution Count:2327 | 2327 |
3906 | } else { executed: } Execution Count:3592 | 3592 |
3907 | c = foldCase(c); | - |
3908 | while (i != b) evaluated: i != b yes Evaluation Count:30 | yes Evaluation Count:2 |
| 2-30 |
3909 | if (foldCase(*(--i)) == c) evaluated: foldCase(*(--i)) == c yes Evaluation Count:6 | yes Evaluation Count:24 |
| 6-24 |
3910 | ++num; executed: ++num; Execution Count:6 | 6 |
3911 | } executed: } Execution Count:2 | 2 |
3912 | return num; executed: return num; Execution Count:3594 | 3594 |
3913 | } | - |
3914 | | - |
3915 | static inline int qt_find_latin1_string(const QChar *haystack, int size, | - |
3916 | QLatin1String needle, | - |
3917 | int from, Qt::CaseSensitivity cs) | - |
3918 | { | - |
3919 | const char *latin1 = needle.latin1(); | - |
3920 | int len = needle.size(); | - |
3921 | QVarLengthArray<ushort> s(len); | - |
3922 | for (int i = 0; i < len; ++i) evaluated: i < len yes Evaluation Count:19655 | yes Evaluation Count:3182 |
| 3182-19655 |
3923 | s[i] = latin1[i]; executed: s[i] = latin1[i]; Execution Count:19655 | 19655 |
3924 | | - |
3925 | return qFindString(haystack, size, from, | 3182 |
3926 | reinterpret_cast<const QChar*>(s.constData()), len, cs); executed: return qFindString(haystack, size, from, reinterpret_cast<const QChar*>(s.constData()), len, cs); Execution Count:3182 | 3182 |
3927 | } | - |
3928 | | - |
3929 | static inline bool qt_starts_with(const QChar *haystack, int haystackLen, | - |
3930 | const QChar *needle, int needleLen, Qt::CaseSensitivity cs) | - |
3931 | { | - |
3932 | if (!haystack) evaluated: !haystack yes Evaluation Count:260 | yes Evaluation Count:67572 |
| 260-67572 |
3933 | return !needle; executed: return !needle; Execution Count:260 | 260 |
3934 | if (haystackLen == 0) evaluated: haystackLen == 0 yes Evaluation Count:9 | yes Evaluation Count:67563 |
| 9-67563 |
3935 | return needleLen == 0; executed: return needleLen == 0; Execution Count:9 | 9 |
3936 | if (needleLen > haystackLen) evaluated: needleLen > haystackLen yes Evaluation Count:14400 | yes Evaluation Count:53163 |
| 14400-53163 |
3937 | return false; executed: return false; Execution Count:14400 | 14400 |
3938 | | - |
3939 | const ushort *h = reinterpret_cast<const ushort*>(haystack); | - |
3940 | const ushort *n = reinterpret_cast<const ushort*>(needle); | - |
3941 | | - |
3942 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:52492 | yes Evaluation Count:671 |
| 671-52492 |
3943 | return qMemEquals(h, n, needleLen); executed: return qMemEquals(h, n, needleLen); Execution Count:52492 | 52492 |
3944 | } else { | - |
3945 | uint last = 0; | - |
3946 | uint olast = 0; | - |
3947 | for (int i = 0; i < needleLen; ++i) evaluated: i < needleLen yes Evaluation Count:1128 | yes Evaluation Count:203 |
| 203-1128 |
3948 | if (foldCase(h[i], last) != foldCase(n[i], olast)) evaluated: foldCase(h[i], last) != foldCase(n[i], olast) yes Evaluation Count:468 | yes Evaluation Count:660 |
| 468-660 |
3949 | return false; executed: return false; Execution Count:468 | 468 |
3950 | } executed: } Execution Count:203 | 203 |
3951 | return true; executed: return true; Execution Count:203 | 203 |
3952 | } | - |
3953 | | - |
3954 | static inline bool qt_starts_with(const QChar *haystack, int haystackLen, | - |
3955 | QLatin1String needle, Qt::CaseSensitivity cs) | - |
3956 | { | - |
3957 | if (!haystack) evaluated: !haystack yes Evaluation Count:1908 | yes Evaluation Count:659546 |
| 1908-659546 |
3958 | return !needle.latin1(); executed: return !needle.latin1(); Execution Count:1908 | 1908 |
3959 | if (haystackLen == 0) evaluated: haystackLen == 0 yes Evaluation Count:1693 | yes Evaluation Count:657853 |
| 1693-657853 |
3960 | return !needle.latin1() || *needle.latin1() == 0; executed: return !needle.latin1() || *needle.latin1() == 0; Execution Count:1693 | 1693 |
3961 | const int slen = needle.size(); | - |
3962 | if (slen > haystackLen) evaluated: slen > haystackLen yes Evaluation Count:263942 | yes Evaluation Count:393911 |
| 263942-393911 |
3963 | return false; executed: return false; Execution Count:263942 | 263942 |
3964 | const ushort *data = reinterpret_cast<const ushort*>(haystack); | - |
3965 | const uchar *latin = reinterpret_cast<const uchar*>(needle.latin1()); | - |
3966 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:393802 | yes Evaluation Count:109 |
| 109-393802 |
3967 | for (int i = 0; i < slen; ++i) evaluated: i < slen yes Evaluation Count:568511 | yes Evaluation Count:104710 |
| 104710-568511 |
3968 | if (data[i] != latin[i]) evaluated: data[i] != latin[i] yes Evaluation Count:289092 | yes Evaluation Count:279419 |
| 279419-289092 |
3969 | return false; executed: return false; Execution Count:289092 | 289092 |
3970 | } else { executed: } Execution Count:104710 | 104710 |
3971 | for (int i = 0; i < slen; ++i) evaluated: i < slen yes Evaluation Count:125 | yes Evaluation Count:19 |
| 19-125 |
3972 | if (foldCase(data[i]) != foldCase((ushort)latin[i])) evaluated: foldCase(data[i]) != foldCase((ushort)latin[i]) yes Evaluation Count:90 | yes Evaluation Count:35 |
| 35-90 |
3973 | return false; executed: return false; Execution Count:90 | 90 |
3974 | } executed: } Execution Count:19 | 19 |
3975 | return true; executed: return true; Execution Count:104729 | 104729 |
3976 | } | - |
3977 | | - |
3978 | static inline bool qt_ends_with(const QChar *haystack, int haystackLen, | - |
3979 | const QChar *needle, int needleLen, Qt::CaseSensitivity cs) | - |
3980 | { | - |
3981 | if (!haystack) evaluated: !haystack yes Evaluation Count:6 | yes Evaluation Count:3471 |
| 6-3471 |
3982 | return !needle; executed: return !needle; Execution Count:6 | 6 |
3983 | if (haystackLen == 0) evaluated: haystackLen == 0 yes Evaluation Count:6 | yes Evaluation Count:3465 |
| 6-3465 |
3984 | return needleLen == 0; executed: return needleLen == 0; Execution Count:6 | 6 |
3985 | const int pos = haystackLen - needleLen; | - |
3986 | if (pos < 0) evaluated: pos < 0 yes Evaluation Count:105 | yes Evaluation Count:3360 |
| 105-3360 |
3987 | return false; executed: return false; Execution Count:105 | 105 |
3988 | | - |
3989 | const ushort *h = reinterpret_cast<const ushort*>(haystack); | - |
3990 | const ushort *n = reinterpret_cast<const ushort*>(needle); | - |
3991 | | - |
3992 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:3341 | yes Evaluation Count:19 |
| 19-3341 |
3993 | return qMemEquals(h + pos, n, needleLen); executed: return qMemEquals(h + pos, n, needleLen); Execution Count:3341 | 3341 |
3994 | } else { | - |
3995 | uint last = 0; | - |
3996 | uint olast = 0; | - |
3997 | for (int i = 0; i < needleLen; i++) evaluated: i < needleLen yes Evaluation Count:17 | yes Evaluation Count:13 |
| 13-17 |
3998 | if (foldCase(h[pos+i], last) != foldCase(n[i], olast)) evaluated: foldCase(h[pos+i], last) != foldCase(n[i], olast) yes Evaluation Count:6 | yes Evaluation Count:11 |
| 6-11 |
3999 | return false; executed: return false; Execution Count:6 | 6 |
4000 | } executed: } Execution Count:13 | 13 |
4001 | return true; executed: return true; Execution Count:13 | 13 |
4002 | } | - |
4003 | | - |
4004 | | - |
4005 | static inline bool qt_ends_with(const QChar *haystack, int haystackLen, | - |
4006 | QLatin1String needle, Qt::CaseSensitivity cs) | - |
4007 | { | - |
4008 | if (!haystack) evaluated: !haystack yes Evaluation Count:189 | yes Evaluation Count:5324 |
| 189-5324 |
4009 | return !needle.latin1(); executed: return !needle.latin1(); Execution Count:189 | 189 |
4010 | if (haystackLen == 0) evaluated: haystackLen == 0 yes Evaluation Count:6 | yes Evaluation Count:5318 |
| 6-5318 |
4011 | return !needle.latin1() || *needle.latin1() == 0; executed: return !needle.latin1() || *needle.latin1() == 0; Execution Count:6 | 6 |
4012 | const int slen = needle.size(); | - |
4013 | int pos = haystackLen - slen; | - |
4014 | if (pos < 0) evaluated: pos < 0 yes Evaluation Count:1420 | yes Evaluation Count:3898 |
| 1420-3898 |
4015 | return false; executed: return false; Execution Count:1420 | 1420 |
4016 | const uchar *latin = reinterpret_cast<const uchar*>(needle.latin1()); | - |
4017 | const ushort *data = reinterpret_cast<const ushort*>(haystack); | - |
4018 | if (cs == Qt::CaseSensitive) { evaluated: cs == Qt::CaseSensitive yes Evaluation Count:3601 | yes Evaluation Count:297 |
| 297-3601 |
4019 | for (int i = 0; i < slen; i++) evaluated: i < slen yes Evaluation Count:5740 | yes Evaluation Count:835 |
| 835-5740 |
4020 | if (data[pos+i] != latin[i]) evaluated: data[pos+i] != latin[i] yes Evaluation Count:2766 | yes Evaluation Count:2974 |
| 2766-2974 |
4021 | return false; executed: return false; Execution Count:2766 | 2766 |
4022 | } else { executed: } Execution Count:835 | 835 |
4023 | for (int i = 0; i < slen; i++) evaluated: i < slen yes Evaluation Count:593 | yes Evaluation Count:270 |
| 270-593 |
4024 | if (foldCase(data[pos+i]) != foldCase((ushort)latin[i])) evaluated: foldCase(data[pos+i]) != foldCase((ushort)latin[i]) yes Evaluation Count:27 | yes Evaluation Count:566 |
| 27-566 |
4025 | return false; executed: return false; Execution Count:27 | 27 |
4026 | } executed: } Execution Count:270 | 270 |
4027 | return true; executed: return true; Execution Count:1105 | 1105 |
4028 | } | - |
4029 | QByteArray QStringRef::toLatin1() const | - |
4030 | { | - |
4031 | return toLatin1_helper(unicode(), length()); executed: return toLatin1_helper(unicode(), length()); Execution Count:16 | 16 |
4032 | } | - |
4033 | QByteArray QStringRef::toLocal8Bit() const | - |
4034 | { | - |
4035 | | - |
4036 | QTextCodec *localeCodec = QTextCodec::codecForLocale(); | - |
4037 | if (localeCodec) partially evaluated: localeCodec yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
4038 | return localeCodec->fromUnicode(unicode(), length()); executed: return localeCodec->fromUnicode(unicode(), length()); Execution Count:5 | 5 |
4039 | | - |
4040 | return toLatin1(); never executed: return toLatin1(); | 0 |
4041 | } | - |
4042 | QByteArray QStringRef::toUtf8() const | - |
4043 | { | - |
4044 | if (isNull()) partially evaluated: isNull() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
4045 | return QByteArray(); never executed: return QByteArray(); | 0 |
4046 | | - |
4047 | return QUtf8::convertFromUnicode(constData(), length(), 0); executed: return QUtf8::convertFromUnicode(constData(), length(), 0); Execution Count:5 | 5 |
4048 | } | - |
4049 | QVector<uint> QStringRef::toUcs4() const | - |
4050 | { | - |
4051 | QVector<uint> v(length()); | - |
4052 | uint *a = v.data(); | - |
4053 | int len = QString::toUcs4_helper(reinterpret_cast<const ushort *>(unicode()), length(), a); | - |
4054 | v.resize(len); | - |
4055 | return v; never executed: return v; | 0 |
4056 | } | - |
4057 | QString QString::toHtmlEscaped() const | - |
4058 | { | - |
4059 | QString rich; | - |
4060 | const int len = length(); | - |
4061 | rich.reserve(int(len * 1.1)); | - |
4062 | for (int i = 0; i < len; ++i) { evaluated: i < len yes Evaluation Count:1702 | yes Evaluation Count:257 |
| 257-1702 |
4063 | if (at(i) == QLatin1Char('<')) evaluated: at(i) == QLatin1Char('<') yes Evaluation Count:7 | yes Evaluation Count:1695 |
| 7-1695 |
4064 | rich += QLatin1String("<"); executed: rich += QLatin1String("<"); Execution Count:7 | 7 |
4065 | else if (at(i) == QLatin1Char('>')) evaluated: at(i) == QLatin1Char('>') yes Evaluation Count:7 | yes Evaluation Count:1688 |
| 7-1688 |
4066 | rich += QLatin1String(">"); executed: rich += QLatin1String(">"); Execution Count:7 | 7 |
4067 | else if (at(i) == QLatin1Char('&')) evaluated: at(i) == QLatin1Char('&') yes Evaluation Count:5 | yes Evaluation Count:1683 |
| 5-1683 |
4068 | rich += QLatin1String("&"); executed: rich += QLatin1String("&"); Execution Count:5 | 5 |
4069 | else if (at(i) == QLatin1Char('"')) evaluated: at(i) == QLatin1Char('"') yes Evaluation Count:6 | yes Evaluation Count:1677 |
| 6-1677 |
4070 | rich += QLatin1String("""); executed: rich += QLatin1String("""); Execution Count:6 | 6 |
4071 | else | - |
4072 | rich += at(i); executed: rich += at(i); Execution Count:1677 | 1677 |
4073 | } | - |
4074 | rich.squeeze(); | - |
4075 | return rich; executed: return rich; Execution Count:257 | 257 |
4076 | } | - |
4077 | | - |
4078 | | - |
| | |