Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | static QSystemLocale *_systemLocale = 0; | - |
12 | class QSystemLocaleSingleton: public QSystemLocale | - |
13 | { | - |
14 | public: | - |
15 | QSystemLocaleSingleton() : QSystemLocale(true) {} executed: } Execution Count:45 | 45 |
16 | }; | - |
17 | | - |
18 | static QSystemLocaleSingleton *QSystemLocale_globalSystemLocale() { static QGlobalStatic<QSystemLocaleSingleton > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QSystemLocaleSingleton *x = new QSystemLocaleSingleton; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QSystemLocaleSingleton > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:17754 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:45 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:45 | yes Evaluation Count:17709 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-17754 |
19 | static QLocaleData *system_data = 0; | - |
20 | static QLocaleData *globalLocaleData() { static QGlobalStatic<QLocaleData > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QLocaleData *x = new QLocaleData; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QLocaleData > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:45 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:45 |
partially evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:45 | no Evaluation Count:0 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | QLocale::Language QLocalePrivate::codeToLanguage(const QString &code) | - |
31 | { | - |
32 | int len = code.length(); | - |
33 | if (len != 2 && len != 3) evaluated: len != 2 yes Evaluation Count:440 | yes Evaluation Count:2884 |
partially evaluated: len != 3 no Evaluation Count:0 | yes Evaluation Count:440 |
| 0-2884 |
34 | return QLocale::C; never executed: return QLocale::C; | 0 |
35 | ushort uc1 = len-- > 0 ? code[0].toLower().unicode() : 0; partially evaluated: len-- > 0 yes Evaluation Count:3324 | no Evaluation Count:0 |
| 0-3324 |
36 | ushort uc2 = len-- > 0 ? code[1].toLower().unicode() : 0; partially evaluated: len-- > 0 yes Evaluation Count:3324 | no Evaluation Count:0 |
| 0-3324 |
37 | ushort uc3 = len-- > 0 ? code[2].toLower().unicode() : 0; evaluated: len-- > 0 yes Evaluation Count:440 | yes Evaluation Count:2884 |
| 440-2884 |
38 | | - |
39 | const unsigned char *c = language_code_list; | - |
40 | for (; *c != 0; c += 3) { evaluated: *c != 0 yes Evaluation Count:269564 | yes Evaluation Count:47 |
| 47-269564 |
41 | if (uc1 == c[0] && uc2 == c[1] && uc3 == c[2]) evaluated: uc1 == c[0] yes Evaluation Count:17715 | yes Evaluation Count:251849 |
evaluated: uc2 == c[1] yes Evaluation Count:3585 | yes Evaluation Count:14130 |
evaluated: uc3 == c[2] yes Evaluation Count:3277 | yes Evaluation Count:308 |
| 308-251849 |
42 | return QLocale::Language((c - language_code_list)/3); executed: return QLocale::Language((c - language_code_list)/3); Execution Count:3277 | 3277 |
43 | } executed: } Execution Count:266287 | 266287 |
44 | | - |
45 | | - |
46 | if (uc1 == 'n' && uc2 == 'o' && uc3 == 0) { evaluated: uc1 == 'n' yes Evaluation Count:40 | yes Evaluation Count:7 |
partially evaluated: uc2 == 'o' yes Evaluation Count:40 | no Evaluation Count:0 |
partially evaluated: uc3 == 0 yes Evaluation Count:40 | no Evaluation Count:0 |
| 0-40 |
47 | static_assert(bool(QLocale::Norwegian == QLocale::NorwegianBokmal), "QLocale::Norwegian == QLocale::NorwegianBokmal"); | - |
48 | return QLocale::Norwegian; executed: return QLocale::Norwegian; Execution Count:40 | 40 |
49 | } | - |
50 | if (uc1 == 't' && uc2 == 'l' && uc3 == 0) { evaluated: uc1 == 't' yes Evaluation Count:1 | yes Evaluation Count:6 |
partially evaluated: uc2 == 'l' yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: uc3 == 0 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-6 |
51 | static_assert(bool(QLocale::Tagalog == QLocale::Filipino), "QLocale::Tagalog == QLocale::Filipino"); | - |
52 | return QLocale::Tagalog; executed: return QLocale::Tagalog; Execution Count:1 | 1 |
53 | } | - |
54 | if (uc1 == 's' && uc2 == 'h' && uc3 == 0) { evaluated: uc1 == 's' yes Evaluation Count:1 | yes Evaluation Count:5 |
partially evaluated: uc2 == 'h' yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: uc3 == 0 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-5 |
55 | static_assert(bool(QLocale::SerboCroatian == QLocale::Serbian), "QLocale::SerboCroatian == QLocale::Serbian"); | - |
56 | return QLocale::SerboCroatian; executed: return QLocale::SerboCroatian; Execution Count:1 | 1 |
57 | } | - |
58 | if (uc1 == 'm' && uc2 == 'o' && uc3 == 0) { evaluated: uc1 == 'm' yes Evaluation Count:1 | yes Evaluation Count:4 |
partially evaluated: uc2 == 'o' yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: uc3 == 0 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-4 |
59 | static_assert(bool(QLocale::Moldavian == QLocale::Romanian), "QLocale::Moldavian == QLocale::Romanian"); | - |
60 | return QLocale::Moldavian; executed: return QLocale::Moldavian; Execution Count:1 | 1 |
61 | } | - |
62 | | - |
63 | return QLocale::C; executed: return QLocale::C; Execution Count:4 | 4 |
64 | } | - |
65 | | - |
66 | QLocale::Script QLocalePrivate::codeToScript(const QString &code) | - |
67 | { | - |
68 | int len = code.length(); | - |
69 | if (len != 4) evaluated: len != 4 yes Evaluation Count:3308 | yes Evaluation Count:12 |
| 12-3308 |
70 | return QLocale::AnyScript; executed: return QLocale::AnyScript; Execution Count:3308 | 3308 |
71 | | - |
72 | | - |
73 | unsigned char c0 = code.at(0).toUpper().toLatin1(); | - |
74 | unsigned char c1 = code.at(1).toLower().toLatin1(); | - |
75 | unsigned char c2 = code.at(2).toLower().toLatin1(); | - |
76 | unsigned char c3 = code.at(3).toLower().toLatin1(); | - |
77 | | - |
78 | const unsigned char *c = script_code_list; | - |
79 | for (int i = 0; i < QLocale::LastScript; ++i, c += 4) { partially evaluated: i < QLocale::LastScript yes Evaluation Count:72 | no Evaluation Count:0 |
| 0-72 |
80 | if (c0 == c[0] && c1 == c[1] && c2 == c[2] && c3 == c[3]) evaluated: c0 == c[0] yes Evaluation Count:15 | yes Evaluation Count:57 |
partially evaluated: c1 == c[1] yes Evaluation Count:15 | no Evaluation Count:0 |
partially evaluated: c2 == c[2] yes Evaluation Count:15 | no Evaluation Count:0 |
evaluated: c3 == c[3] yes Evaluation Count:12 | yes Evaluation Count:3 |
| 0-57 |
81 | return QLocale::Script(i); executed: return QLocale::Script(i); Execution Count:12 | 12 |
82 | } executed: } Execution Count:60 | 60 |
83 | return QLocale::AnyScript; never executed: return QLocale::AnyScript; | 0 |
84 | } | - |
85 | | - |
86 | QLocale::Country QLocalePrivate::codeToCountry(const QString &code) | - |
87 | { | - |
88 | int len = code.length(); | - |
89 | if (len != 2 && len != 3) evaluated: len != 2 yes Evaluation Count:1400 | yes Evaluation Count:1920 |
evaluated: len != 3 yes Evaluation Count:519 | yes Evaluation Count:881 |
| 519-1920 |
90 | return QLocale::AnyCountry; executed: return QLocale::AnyCountry; Execution Count:519 | 519 |
91 | ushort uc1 = len-- > 0 ? code[0].toUpper().unicode() : 0; partially evaluated: len-- > 0 yes Evaluation Count:2801 | no Evaluation Count:0 |
| 0-2801 |
92 | ushort uc2 = len-- > 0 ? code[1].toUpper().unicode() : 0; partially evaluated: len-- > 0 yes Evaluation Count:2801 | no Evaluation Count:0 |
| 0-2801 |
93 | ushort uc3 = len-- > 0 ? code[2].toUpper().unicode() : 0; evaluated: len-- > 0 yes Evaluation Count:881 | yes Evaluation Count:1920 |
| 881-1920 |
94 | | - |
95 | const unsigned char *c = country_code_list; | - |
96 | for (; *c != 0; c += 3) { evaluated: *c != 0 yes Evaluation Count:510975 | yes Evaluation Count:876 |
| 876-510975 |
97 | if (uc1 == c[0] && uc2 == c[1] && uc3 == c[2]) evaluated: uc1 == c[0] yes Evaluation Count:17282 | yes Evaluation Count:493693 |
evaluated: uc2 == c[1] yes Evaluation Count:2801 | yes Evaluation Count:14481 |
evaluated: uc3 == c[2] yes Evaluation Count:1925 | yes Evaluation Count:876 |
| 876-493693 |
98 | return QLocale::Country((c - country_code_list)/3); executed: return QLocale::Country((c - country_code_list)/3); Execution Count:1925 | 1925 |
99 | } executed: } Execution Count:509050 | 509050 |
100 | | - |
101 | return QLocale::AnyCountry; executed: return QLocale::AnyCountry; Execution Count:876 | 876 |
102 | } | - |
103 | | - |
104 | QString QLocalePrivate::languageCode() const | - |
105 | { | - |
106 | if (m_data->m_language_id == QLocale::AnyLanguage) partially evaluated: m_data->m_language_id == QLocale::AnyLanguage no Evaluation Count:0 | yes Evaluation Count:2615 |
| 0-2615 |
107 | return QString(); never executed: return QString(); | 0 |
108 | if (m_data->m_language_id == QLocale::C) evaluated: m_data->m_language_id == QLocale::C yes Evaluation Count:101 | yes Evaluation Count:2514 |
| 101-2514 |
109 | return QLatin1String("C"); executed: return QLatin1String("C"); Execution Count:101 | 101 |
110 | | - |
111 | const unsigned char *c = language_code_list + 3*(uint(m_data->m_language_id)); | - |
112 | | - |
113 | QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized); | - |
114 | | - |
115 | code[0] = ushort(c[0]); | - |
116 | code[1] = ushort(c[1]); | - |
117 | if (c[2] != 0) evaluated: c[2] != 0 yes Evaluation Count:292 | yes Evaluation Count:2222 |
| 292-2222 |
118 | code[2] = ushort(c[2]); executed: code[2] = ushort(c[2]); Execution Count:292 | 292 |
119 | | - |
120 | return code; executed: return code; Execution Count:2514 | 2514 |
121 | } | - |
122 | | - |
123 | QString QLocalePrivate::scriptCode() const | - |
124 | { | - |
125 | if (m_data->m_script_id == QLocale::AnyScript || m_data->m_script_id > QLocale::LastScript) never evaluated: m_data->m_script_id == QLocale::AnyScript never evaluated: m_data->m_script_id > QLocale::LastScript | 0 |
126 | return QString(); never executed: return QString(); | 0 |
127 | const unsigned char *c = script_code_list + 4*(uint(m_data->m_script_id)); | - |
128 | return QString::fromLatin1((const char *)c, 4); never executed: return QString::fromLatin1((const char *)c, 4); | 0 |
129 | } | - |
130 | | - |
131 | QString QLocalePrivate::countryCode() const | - |
132 | { | - |
133 | if (m_data->m_country_id == QLocale::AnyCountry) partially evaluated: m_data->m_country_id == QLocale::AnyCountry no Evaluation Count:0 | yes Evaluation Count:2514 |
| 0-2514 |
134 | return QString(); never executed: return QString(); | 0 |
135 | | - |
136 | const unsigned char *c = country_code_list + 3*(uint(m_data->m_country_id)); | - |
137 | | - |
138 | QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized); | - |
139 | | - |
140 | code[0] = ushort(c[0]); | - |
141 | code[1] = ushort(c[1]); | - |
142 | if (c[2] != 0) evaluated: c[2] != 0 yes Evaluation Count:4 | yes Evaluation Count:2510 |
| 4-2510 |
143 | code[2] = ushort(c[2]); executed: code[2] = ushort(c[2]); Execution Count:4 | 4 |
144 | | - |
145 | return code; executed: return code; Execution Count:2514 | 2514 |
146 | } | - |
147 | | - |
148 | | - |
149 | static bool addLikelySubtags(QLocaleId &localeId) | - |
150 | { | - |
151 | | - |
152 | const int likely_subtags_count = sizeof(likely_subtags) / sizeof(likely_subtags[0]); | - |
153 | const QLocaleId *p = likely_subtags; | - |
154 | const QLocaleId *const e = p + likely_subtags_count; | - |
155 | for ( ; p < e; p += 2) { evaluated: p < e yes Evaluation Count:2147483647 | yes Evaluation Count:23061435 |
| 23061435-2147483647 |
156 | if (localeId == p[0]) { evaluated: localeId == p[0] yes Evaluation Count:6161475 | yes Evaluation Count:2147483647 |
| 6161475-2147483647 |
157 | localeId = p[1]; | - |
158 | return true; executed: return true; Execution Count:6161475 | 6161475 |
159 | } | - |
160 | } executed: } Execution Count:2147483647 | 2147483647 |
161 | return false; executed: return false; Execution Count:23061435 | 23061435 |
162 | } | - |
163 | | - |
164 | QLocaleId QLocaleId::withLikelySubtagsAdded() const | - |
165 | { | - |
166 | | - |
167 | if (language_id || script_id || country_id) { evaluated: language_id yes Evaluation Count:19984794 | yes Evaluation Count:2 |
partially evaluated: script_id no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: country_id no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-19984794 |
168 | QLocaleId id = QLocaleId::fromIds(language_id, script_id, country_id); | - |
169 | if (addLikelySubtags(id)) evaluated: addLikelySubtags(id) yes Evaluation Count:3079820 | yes Evaluation Count:16904961 |
| 3079820-16904961 |
170 | return id; executed: return id; Execution Count:3079820 | 3079820 |
171 | } executed: } Execution Count:16904961 | 16904961 |
172 | | - |
173 | if (country_id) { evaluated: country_id yes Evaluation Count:3081648 | yes Evaluation Count:13823315 |
| 3081648-13823315 |
174 | QLocaleId id = QLocaleId::fromIds(language_id, script_id, 0); | - |
175 | if (addLikelySubtags(id)) { evaluated: addLikelySubtags(id) yes Evaluation Count:3395 | yes Evaluation Count:3078253 |
| 3395-3078253 |
176 | id.country_id = country_id; | - |
177 | return id; executed: return id; Execution Count:3395 | 3395 |
178 | } | - |
179 | } executed: } Execution Count:3078253 | 3078253 |
180 | | - |
181 | if (script_id) { evaluated: script_id yes Evaluation Count:3078260 | yes Evaluation Count:13823308 |
| 3078260-13823308 |
182 | QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id); | - |
183 | if (addLikelySubtags(id)) { evaluated: addLikelySubtags(id) yes Evaluation Count:39 | yes Evaluation Count:3078221 |
| 39-3078221 |
184 | id.script_id = script_id; | - |
185 | return id; executed: return id; Execution Count:39 | 39 |
186 | } | - |
187 | } executed: } Execution Count:3078221 | 3078221 |
188 | | - |
189 | if (script_id && country_id) { evaluated: script_id yes Evaluation Count:3078221 | yes Evaluation Count:13823308 |
partially evaluated: country_id yes Evaluation Count:3078221 | no Evaluation Count:0 |
| 0-13823308 |
190 | QLocaleId id = QLocaleId::fromIds(language_id, 0, 0); | - |
191 | if (addLikelySubtags(id)) { partially evaluated: addLikelySubtags(id) yes Evaluation Count:3078221 | no Evaluation Count:0 |
| 0-3078221 |
192 | id.script_id = script_id; | - |
193 | id.country_id = country_id; | - |
194 | return id; executed: return id; Execution Count:3078221 | 3078221 |
195 | } | - |
196 | } | 0 |
197 | return *this; executed: return *this; Execution Count:13823309 | 13823309 |
198 | } | - |
199 | | - |
200 | QLocaleId QLocaleId::withLikelySubtagsRemoved() const | - |
201 | { | - |
202 | QLocaleId max = withLikelySubtagsAdded(); | - |
203 | | - |
204 | { | - |
205 | QLocaleId id = QLocaleId::fromIds(language_id, 0, 0); | - |
206 | if (id.withLikelySubtagsAdded() == max) evaluated: id.withLikelySubtagsAdded() == max yes Evaluation Count:3077224 | yes Evaluation Count:1043 |
| 1043-3077224 |
207 | return id; executed: return id; Execution Count:3077224 | 3077224 |
208 | } | - |
209 | | - |
210 | if (country_id) { partially evaluated: country_id yes Evaluation Count:1043 | no Evaluation Count:0 |
| 0-1043 |
211 | QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id); | - |
212 | if (id.withLikelySubtagsAdded() == max) evaluated: id.withLikelySubtagsAdded() == max yes Evaluation Count:1034 | yes Evaluation Count:9 |
| 9-1034 |
213 | return id; executed: return id; Execution Count:1034 | 1034 |
214 | } executed: } Execution Count:9 | 9 |
215 | | - |
216 | if (script_id) { partially evaluated: script_id yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
217 | QLocaleId id = QLocaleId::fromIds(language_id, script_id, 0); | - |
218 | if (id.withLikelySubtagsAdded() == max) evaluated: id.withLikelySubtagsAdded() == max yes Evaluation Count:7 | yes Evaluation Count:2 |
| 2-7 |
219 | return id; executed: return id; Execution Count:7 | 7 |
220 | } executed: } Execution Count:2 | 2 |
221 | return max; executed: return max; Execution Count:2 | 2 |
222 | } | - |
223 | | - |
224 | QString QLocaleId::bcp47Name() const | - |
225 | { | - |
226 | if (language_id == QLocale::AnyLanguage) partially evaluated: language_id == QLocale::AnyLanguage no Evaluation Count:0 | yes Evaluation Count:3078300 |
| 0-3078300 |
227 | return QString(); never executed: return QString(); | 0 |
228 | if (language_id == QLocale::C) evaluated: language_id == QLocale::C yes Evaluation Count:2 | yes Evaluation Count:3078298 |
| 2-3078298 |
229 | return QString::fromUtf8("" "C" "", sizeof("C") - 1); executed: return QString::fromUtf8("" "C" "", sizeof("C") - 1); Execution Count:2 | 2 |
230 | | - |
231 | const unsigned char *lang = language_code_list + 3*uint(language_id); | - |
232 | const unsigned char *script = | - |
233 | (script_id != QLocale::AnyScript ? script_code_list + 4*uint(script_id) : 0); evaluated: script_id != QLocale::AnyScript yes Evaluation Count:30 | yes Evaluation Count:3078268 |
| 30-3078268 |
234 | const unsigned char *country = | - |
235 | (country_id != QLocale::AnyCountry ? country_code_list + 3*uint(country_id) : 0); evaluated: country_id != QLocale::AnyCountry yes Evaluation Count:1069 | yes Evaluation Count:3077229 |
| 1069-3077229 |
236 | char len = (lang[2] != 0 ? 3 : 2) + (script ? 4+1 : 0) + (country ? (country[2] != 0 ? 3 : 2)+1 : 0); evaluated: lang[2] != 0 yes Evaluation Count:516 | yes Evaluation Count:3077782 |
evaluated: script yes Evaluation Count:30 | yes Evaluation Count:3078268 |
evaluated: country yes Evaluation Count:1069 | yes Evaluation Count:3077229 |
| 30-3078268 |
237 | QString name(len, Qt::Uninitialized); | - |
238 | QChar *uc = name.data(); | - |
239 | *uc++ = ushort(lang[0]); | - |
240 | *uc++ = ushort(lang[1]); | - |
241 | if (lang[2] != 0) evaluated: lang[2] != 0 yes Evaluation Count:516 | yes Evaluation Count:3077782 |
| 516-3077782 |
242 | *uc++ = ushort(lang[2]); executed: *uc++ = ushort(lang[2]); Execution Count:516 | 516 |
243 | if (script) { evaluated: script yes Evaluation Count:30 | yes Evaluation Count:3078268 |
| 30-3078268 |
244 | *uc++ = QLatin1Char('-'); | - |
245 | *uc++ = ushort(script[0]); | - |
246 | *uc++ = ushort(script[1]); | - |
247 | *uc++ = ushort(script[2]); | - |
248 | *uc++ = ushort(script[3]); | - |
249 | } executed: } Execution Count:30 | 30 |
250 | if (country) { evaluated: country yes Evaluation Count:1069 | yes Evaluation Count:3077229 |
| 1069-3077229 |
251 | *uc++ = QLatin1Char('-'); | - |
252 | *uc++ = ushort(country[0]); | - |
253 | *uc++ = ushort(country[1]); | - |
254 | if (country[2] != 0) evaluated: country[2] != 0 yes Evaluation Count:7 | yes Evaluation Count:1062 |
| 7-1062 |
255 | *uc++ = ushort(country[2]); executed: *uc++ = ushort(country[2]); Execution Count:7 | 7 |
256 | } executed: } Execution Count:1069 | 1069 |
257 | return name; executed: return name; Execution Count:3078298 | 3078298 |
258 | } | - |
259 | | - |
260 | QString QLocalePrivate::bcp47Name() const | - |
261 | { | - |
262 | if (m_data->m_language_id == QLocale::AnyLanguage) partially evaluated: m_data->m_language_id == QLocale::AnyLanguage no Evaluation Count:0 | yes Evaluation Count:16912484 |
| 0-16912484 |
263 | return QString(); never executed: return QString(); | 0 |
264 | if (m_data->m_language_id == QLocale::C) evaluated: m_data->m_language_id == QLocale::C yes Evaluation Count:13834237 | yes Evaluation Count:3078244 |
| 3078244-13834237 |
265 | return QString::fromUtf8("" "C" "", sizeof("C") - 1); executed: return QString::fromUtf8("" "C" "", sizeof("C") - 1); Execution Count:13834236 | 13834236 |
266 | | - |
267 | QLocaleId localeId = QLocaleId::fromIds(m_data->m_language_id, m_data->m_script_id, m_data->m_country_id); | - |
268 | return localeId.withLikelySubtagsRemoved().bcp47Name(); executed: return localeId.withLikelySubtagsRemoved().bcp47Name(); Execution Count:3078244 | 3078244 |
269 | } | - |
270 | | - |
271 | const QLocaleData *QLocaleData::findLocaleData(QLocale::Language language, QLocale::Script script, QLocale::Country country) | - |
272 | { | - |
273 | QLocaleId localeId = QLocaleId::fromIds(language, script, country); | - |
274 | localeId = localeId.withLikelySubtagsAdded(); | - |
275 | | - |
276 | uint idx = locale_index[localeId.language_id]; | - |
277 | | - |
278 | const QLocaleData *data = locale_data + idx; | - |
279 | | - |
280 | if (idx == 0) evaluated: idx == 0 yes Evaluation Count:13823331 | yes Evaluation Count:3847 |
| 3847-13823331 |
281 | return data; executed: return data; Execution Count:13823330 | 13823330 |
282 | | - |
283 | qt_noop(); | - |
284 | | - |
285 | if (localeId.script_id != QLocale::AnyScript && localeId.country_id != QLocale::AnyCountry) { partially evaluated: localeId.script_id != QLocale::AnyScript yes Evaluation Count:3847 | no Evaluation Count:0 |
partially evaluated: localeId.country_id != QLocale::AnyCountry yes Evaluation Count:3847 | no Evaluation Count:0 |
| 0-3847 |
286 | | - |
287 | do { | - |
288 | if (data->m_script_id == localeId.script_id && data->m_country_id == localeId.country_id) evaluated: data->m_script_id == localeId.script_id yes Evaluation Count:21855 | yes Evaluation Count:438 |
evaluated: data->m_country_id == localeId.country_id yes Evaluation Count:3843 | yes Evaluation Count:18012 |
| 438-21855 |
289 | return data; executed: return data; Execution Count:3843 | 3843 |
290 | ++data; | - |
291 | } while (data->m_language_id == localeId.language_id); executed: } Execution Count:18450 evaluated: data->m_language_id == localeId.language_id yes Evaluation Count:18446 | yes Evaluation Count:4 |
| 4-18450 |
292 | | - |
293 | | - |
294 | localeId.script_id = QLocale::AnyScript; | - |
295 | data = locale_data + idx; | - |
296 | } executed: } Execution Count:4 | 4 |
297 | | - |
298 | if (localeId.script_id == QLocale::AnyScript && localeId.country_id == QLocale::AnyCountry) partially evaluated: localeId.script_id == QLocale::AnyScript yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: localeId.country_id == QLocale::AnyCountry no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
299 | return data; never executed: return data; | 0 |
300 | | - |
301 | if (localeId.script_id == QLocale::AnyScript) { partially evaluated: localeId.script_id == QLocale::AnyScript yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
302 | do { | - |
303 | if (data->m_country_id == localeId.country_id) partially evaluated: data->m_country_id == localeId.country_id no Evaluation Count:0 | yes Evaluation Count:284 |
| 0-284 |
304 | return data; never executed: return data; | 0 |
305 | ++data; | - |
306 | } while (data->m_language_id == localeId.language_id); executed: } Execution Count:284 evaluated: data->m_language_id == localeId.language_id yes Evaluation Count:280 | yes Evaluation Count:4 |
| 4-284 |
307 | } else if (localeId.country_id == QLocale::AnyCountry) { never evaluated: localeId.country_id == QLocale::AnyCountry executed: } Execution Count:4 | 0-4 |
308 | do { | - |
309 | if (data->m_script_id == localeId.script_id) never evaluated: data->m_script_id == localeId.script_id | 0 |
310 | return data; never executed: return data; | 0 |
311 | ++data; | - |
312 | } while (data->m_language_id == localeId.language_id); never evaluated: data->m_language_id == localeId.language_id | 0 |
313 | } | 0 |
314 | | - |
315 | return locale_data + idx; executed: return locale_data + idx; Execution Count:4 | 4 |
316 | } | - |
317 | | - |
318 | static bool parse_locale_tag(const QString &input, int &i, QString *result, const QString &separators) | - |
319 | { | - |
320 | *result = QString(8, Qt::Uninitialized); | - |
321 | QChar *pch = result->data(); | - |
322 | const QChar *uc = input.data() + i; | - |
323 | const int l = input.length(); | - |
324 | int size = 0; | - |
325 | for (; i < l && size < 8; ++i, ++size) { evaluated: i < l yes Evaluation Count:18863 | yes Evaluation Count:3242 |
partially evaluated: size < 8 yes Evaluation Count:18863 | no Evaluation Count:0 |
| 0-18863 |
326 | if (separators.contains(*uc)) evaluated: separators.contains(*uc) yes Evaluation Count:4062 | yes Evaluation Count:14801 |
| 4062-14801 |
327 | break; executed: break; Execution Count:4062 | 4062 |
328 | if (! ((uc->unicode() >= 'a' && uc->unicode() <= 'z') || evaluated: uc->unicode() >= 'a' yes Evaluation Count:9779 | yes Evaluation Count:5022 |
partially evaluated: uc->unicode() <= 'z' yes Evaluation Count:9779 | no Evaluation Count:0 |
| 0-9779 |
329 | (uc->unicode() >= 'A' && uc->unicode() <= 'Z') || evaluated: uc->unicode() >= 'A' yes Evaluation Count:5006 | yes Evaluation Count:16 |
partially evaluated: uc->unicode() <= 'Z' yes Evaluation Count:5006 | no Evaluation Count:0 |
| 0-5006 |
330 | (uc->unicode() >= '0' && uc->unicode() <= '9')) ) evaluated: uc->unicode() >= '0' yes Evaluation Count:15 | yes Evaluation Count:1 |
partially evaluated: uc->unicode() <= '9' yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
331 | return false; executed: return false; Execution Count:1 | 1 |
332 | *pch++ = *uc++; | - |
333 | } executed: } Execution Count:14800 | 14800 |
334 | result->truncate(size); | - |
335 | return true; executed: return true; Execution Count:7304 | 7304 |
336 | } | - |
337 | | - |
338 | bool qt_splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry) | - |
339 | { | - |
340 | const int length = name.length(); | - |
341 | | - |
342 | lang = script = cntry = QString(); | - |
343 | | - |
344 | const QString separators = QString::fromUtf8("" "_-.@" "", sizeof("_-.@") - 1); | - |
345 | enum ParserState { NoState, LangState, ScriptState, CountryState }; | - |
346 | ParserState state = LangState; | - |
347 | for (int i = 0; i < length && state != NoState; ) { evaluated: i < length yes Evaluation Count:8535 | yes Evaluation Count:3249 |
evaluated: state != NoState yes Evaluation Count:7305 | yes Evaluation Count:1230 |
| 1230-8535 |
348 | QString value; | - |
349 | if (!parse_locale_tag(name, i, &value, separators) ||value.isEmpty()) evaluated: !parse_locale_tag(name, i, &value, separators) yes Evaluation Count:1 | yes Evaluation Count:7304 |
evaluated: value.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:7300 |
| 1-7304 |
350 | break; executed: break; Execution Count:5 | 5 |
351 | QChar sep = i < length ? name.at(i) : QChar(); evaluated: i < length yes Evaluation Count:4058 | yes Evaluation Count:3242 |
| 3242-4058 |
352 | switch (state) { | - |
353 | case LangState: | - |
354 | if (!sep.isNull() && !separators.contains(sep)) { evaluated: !sep.isNull() yes Evaluation Count:2821 | yes Evaluation Count:1658 |
partially evaluated: !separators.contains(sep) no Evaluation Count:0 | yes Evaluation Count:2821 |
| 0-2821 |
355 | state = NoState; | - |
356 | break; | 0 |
357 | } | - |
358 | lang = value; | - |
359 | if (i == length) { evaluated: i == length yes Evaluation Count:1658 | yes Evaluation Count:2821 |
| 1658-2821 |
360 | | - |
361 | state = NoState; | - |
362 | break; executed: break; Execution Count:1658 | 1658 |
363 | } | - |
364 | state = ScriptState; | - |
365 | break; executed: break; Execution Count:2821 | 2821 |
366 | case ScriptState: { | - |
367 | QString scripts = QString::fromLatin1((const char *)script_code_list, sizeof(script_code_list)); | - |
368 | if (value.length() == 4 && scripts.indexOf(value) % 4 == 0) { evaluated: value.length() == 4 yes Evaluation Count:12 | yes Evaluation Count:2802 |
partially evaluated: scripts.indexOf(value) % 4 == 0 yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-2802 |
369 | | - |
370 | script = value; | - |
371 | state = CountryState; | - |
372 | } else { executed: } Execution Count:12 | 12 |
373 | | - |
374 | cntry = value; | - |
375 | state = NoState; | - |
376 | } executed: } Execution Count:2802 | 2802 |
377 | break; executed: break; Execution Count:2814 | 2814 |
378 | } | - |
379 | case CountryState: | - |
380 | cntry = value; | - |
381 | state = NoState; | - |
382 | break; executed: break; Execution Count:7 | 7 |
383 | case NoState: | - |
384 | | - |
385 | QMessageLogger("tools/qlocale.cpp", 448, __PRETTY_FUNCTION__).warning("QLocale: This should never happen"); | - |
386 | break; | 0 |
387 | } | - |
388 | ++i; | - |
389 | } executed: } Execution Count:7300 | 7300 |
390 | return lang.length() == 2 || lang.length() == 3; executed: return lang.length() == 2 || lang.length() == 3; Execution Count:4484 | 4484 |
391 | } | - |
392 | | - |
393 | void QLocalePrivate::getLangAndCountry(const QString &name, QLocale::Language &lang, | - |
394 | QLocale::Script &script, QLocale::Country &cntry) | - |
395 | { | - |
396 | lang = QLocale::C; | - |
397 | script = QLocale::AnyScript; | - |
398 | cntry = QLocale::AnyCountry; | - |
399 | | - |
400 | QString lang_code; | - |
401 | QString script_code; | - |
402 | QString cntry_code; | - |
403 | if (!qt_splitLocaleName(name, lang_code, script_code, cntry_code)) evaluated: !qt_splitLocaleName(name, lang_code, script_code, cntry_code) yes Evaluation Count:1158 | yes Evaluation Count:3324 |
| 1158-3324 |
404 | return; executed: return; Execution Count:1158 | 1158 |
405 | | - |
406 | lang = QLocalePrivate::codeToLanguage(lang_code); | - |
407 | if (lang == QLocale::C) evaluated: lang == QLocale::C yes Evaluation Count:4 | yes Evaluation Count:3320 |
| 4-3320 |
408 | return; executed: return; Execution Count:4 | 4 |
409 | script = QLocalePrivate::codeToScript(script_code); | - |
410 | cntry = QLocalePrivate::codeToCountry(cntry_code); | - |
411 | } executed: } Execution Count:3320 | 3320 |
412 | | - |
413 | static const QLocaleData *findLocaleData(const QString &name) | - |
414 | { | - |
415 | QLocale::Language lang; | - |
416 | QLocale::Script script; | - |
417 | QLocale::Country cntry; | - |
418 | QLocalePrivate::getLangAndCountry(name, lang, script, cntry); | - |
419 | | - |
420 | return QLocaleData::findLocaleData(lang, script, cntry); executed: return QLocaleData::findLocaleData(lang, script, cntry); Execution Count:4482 | 4482 |
421 | } | - |
422 | | - |
423 | QString qt_readEscapedFormatString(const QString &format, int *idx) | - |
424 | { | - |
425 | int &i = *idx; | - |
426 | | - |
427 | qt_noop(); | - |
428 | ++i; | - |
429 | if (i == format.size()) evaluated: i == format.size() yes Evaluation Count:14 | yes Evaluation Count:1527 |
| 14-1527 |
430 | return QString(); executed: return QString(); Execution Count:14 | 14 |
431 | if (format.at(i).unicode() == '\'') { evaluated: format.at(i).unicode() == '\'' yes Evaluation Count:14 | yes Evaluation Count:1513 |
| 14-1513 |
432 | ++i; | - |
433 | return QLatin1String("'"); executed: return QLatin1String("'"); Execution Count:14 | 14 |
434 | } | - |
435 | | - |
436 | QString result; | - |
437 | | - |
438 | while (i < format.size()) { evaluated: i < format.size() yes Evaluation Count:4918 | yes Evaluation Count:1250 |
| 1250-4918 |
439 | if (format.at(i).unicode() == '\'') { evaluated: format.at(i).unicode() == '\'' yes Evaluation Count:263 | yes Evaluation Count:4655 |
| 263-4655 |
440 | if (i + 1 < format.size() && format.at(i + 1).unicode() == '\'') { evaluated: i + 1 < format.size() yes Evaluation Count:56 | yes Evaluation Count:207 |
partially evaluated: format.at(i + 1).unicode() == '\'' no Evaluation Count:0 | yes Evaluation Count:56 |
| 0-207 |
441 | | - |
442 | result.append(QLatin1Char('\'')); | - |
443 | i += 2; | - |
444 | } else { | 0 |
445 | break; executed: break; Execution Count:263 | 263 |
446 | } | - |
447 | } else { | - |
448 | result.append(format.at(i++)); | - |
449 | } executed: } Execution Count:4655 | 4655 |
450 | } | - |
451 | if (i < format.size()) evaluated: i < format.size() yes Evaluation Count:263 | yes Evaluation Count:1250 |
| 263-1250 |
452 | ++i; executed: ++i; Execution Count:263 | 263 |
453 | | - |
454 | return result; executed: return result; Execution Count:1513 | 1513 |
455 | } | - |
456 | | - |
457 | int qt_repeatCount(const QString &s, int i) | - |
458 | { | - |
459 | QChar c = s.at(i); | - |
460 | int j = i + 1; | - |
461 | while (j < s.size() && s.at(j) == c) evaluated: j < s.size() yes Evaluation Count:69815 | yes Evaluation Count:4386 |
evaluated: s.at(j) == c yes Evaluation Count:25296 | yes Evaluation Count:44519 |
| 4386-69815 |
462 | ++j; executed: ++j; Execution Count:25296 | 25296 |
463 | return j - i; executed: return j - i; Execution Count:48905 | 48905 |
464 | } | - |
465 | | - |
466 | static const QLocaleData *default_data = 0; | - |
467 | static uint default_number_options = 0; | - |
468 | QSystemLocale::QSystemLocale() | - |
469 | { | - |
470 | delete _systemLocale; | - |
471 | _systemLocale = this; | - |
472 | | - |
473 | if (system_data) never evaluated: system_data | 0 |
474 | system_data->m_language_id = 0; never executed: system_data->m_language_id = 0; | 0 |
475 | } | 0 |
476 | | - |
477 | | - |
478 | | - |
479 | | - |
480 | QSystemLocale::QSystemLocale(bool) | - |
481 | { } | - |
482 | | - |
483 | | - |
484 | | - |
485 | | - |
486 | QSystemLocale::~QSystemLocale() | - |
487 | { | - |
488 | if (_systemLocale == this) { partially evaluated: _systemLocale == this no Evaluation Count:0 | yes Evaluation Count:233 |
| 0-233 |
489 | _systemLocale = 0; | - |
490 | | - |
491 | if (system_data) never evaluated: system_data | 0 |
492 | system_data->m_language_id = 0; never executed: system_data->m_language_id = 0; | 0 |
493 | } | 0 |
494 | } executed: } Execution Count:233 | 233 |
495 | | - |
496 | static const QSystemLocale *systemLocale() | - |
497 | { | - |
498 | if (_systemLocale) partially evaluated: _systemLocale no Evaluation Count:0 | yes Evaluation Count:17754 |
| 0-17754 |
499 | return _systemLocale; never executed: return _systemLocale; | 0 |
500 | return QSystemLocale_globalSystemLocale(); executed: return QSystemLocale_globalSystemLocale(); Execution Count:17754 | 17754 |
501 | } | - |
502 | | - |
503 | void QLocalePrivate::updateSystemPrivate() | - |
504 | { | - |
505 | const QSystemLocale *sys_locale = systemLocale(); | - |
506 | if (!system_data) partially evaluated: !system_data yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
507 | system_data = globalLocaleData(); executed: system_data = globalLocaleData(); Execution Count:45 | 45 |
508 | | - |
509 | | - |
510 | sys_locale->query(QSystemLocale::LocaleChanged, QVariant()); | - |
511 | | - |
512 | *system_data = *sys_locale->fallbackUiLocale().d->m_data; | - |
513 | | - |
514 | QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant()); | - |
515 | if (!res.isNull()) { partially evaluated: !res.isNull() no Evaluation Count:0 | yes Evaluation Count:45 |
| 0-45 |
516 | system_data->m_language_id = res.toInt(); | - |
517 | system_data->m_script_id = QLocale::AnyScript; | - |
518 | } | 0 |
519 | res = sys_locale->query(QSystemLocale::CountryId, QVariant()); | - |
520 | if (!res.isNull()) { partially evaluated: !res.isNull() no Evaluation Count:0 | yes Evaluation Count:45 |
| 0-45 |
521 | system_data->m_country_id = res.toInt(); | - |
522 | system_data->m_script_id = QLocale::AnyScript; | - |
523 | } | 0 |
524 | res = sys_locale->query(QSystemLocale::ScriptId, QVariant()); | - |
525 | if (!res.isNull()) partially evaluated: !res.isNull() no Evaluation Count:0 | yes Evaluation Count:45 |
| 0-45 |
526 | system_data->m_script_id = res.toInt(); never executed: system_data->m_script_id = res.toInt(); | 0 |
527 | | - |
528 | res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant()); | - |
529 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
530 | system_data->m_decimal = res.toString().at(0).unicode(); executed: system_data->m_decimal = res.toString().at(0).unicode(); Execution Count:45 | 45 |
531 | | - |
532 | res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant()); | - |
533 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
534 | system_data->m_group = res.toString().at(0).unicode(); executed: system_data->m_group = res.toString().at(0).unicode(); Execution Count:45 | 45 |
535 | | - |
536 | res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant()); | - |
537 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
538 | system_data->m_zero = res.toString().at(0).unicode(); executed: system_data->m_zero = res.toString().at(0).unicode(); Execution Count:45 | 45 |
539 | | - |
540 | res = sys_locale->query(QSystemLocale::NegativeSign, QVariant()); | - |
541 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
542 | system_data->m_minus = res.toString().at(0).unicode(); executed: system_data->m_minus = res.toString().at(0).unicode(); Execution Count:45 | 45 |
543 | | - |
544 | res = sys_locale->query(QSystemLocale::PositiveSign, QVariant()); | - |
545 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
546 | system_data->m_plus = res.toString().at(0).unicode(); executed: system_data->m_plus = res.toString().at(0).unicode(); Execution Count:45 | 45 |
547 | } executed: } Execution Count:45 | 45 |
548 | | - |
549 | | - |
550 | static const QLocaleData *systemData() | - |
551 | { | - |
552 | | - |
553 | | - |
554 | if (!system_data || system_data->m_language_id == 0) evaluated: !system_data yes Evaluation Count:45 | yes Evaluation Count:49422 |
partially evaluated: system_data->m_language_id == 0 no Evaluation Count:0 | yes Evaluation Count:49422 |
| 0-49422 |
555 | QLocalePrivate::updateSystemPrivate(); executed: QLocalePrivate::updateSystemPrivate(); Execution Count:45 | 45 |
556 | | - |
557 | return system_data; executed: return system_data; Execution Count:49467 | 49467 |
558 | | - |
559 | | - |
560 | | - |
561 | } | - |
562 | | - |
563 | static const QLocaleData *defaultData() | - |
564 | { | - |
565 | if (!default_data) evaluated: !default_data yes Evaluation Count:42 | yes Evaluation Count:2158488 |
| 42-2158488 |
566 | default_data = systemData(); executed: default_data = systemData(); Execution Count:42 | 42 |
567 | return default_data; executed: return default_data; Execution Count:2158530 | 2158530 |
568 | } | - |
569 | | - |
570 | static QString getLocaleListData(const ushort *data, int size, int index) | - |
571 | { | - |
572 | static const ushort separator = ';'; | - |
573 | while (index && size > 0) { evaluated: index yes Evaluation Count:74583 | yes Evaluation Count:17252 |
partially evaluated: size > 0 yes Evaluation Count:74583 | no Evaluation Count:0 |
| 0-74583 |
574 | while (*data != separator) evaluated: *data != separator yes Evaluation Count:293784 | yes Evaluation Count:74583 |
| 74583-293784 |
575 | ++data, --size; executed: ++data, --size; Execution Count:293784 | 293784 |
576 | --index; | - |
577 | ++data; | - |
578 | --size; | - |
579 | } executed: } Execution Count:74583 | 74583 |
580 | const ushort *end = data; | - |
581 | while (size > 0 && *end != separator) partially evaluated: size > 0 yes Evaluation Count:87176 | no Evaluation Count:0 |
evaluated: *end != separator yes Evaluation Count:69924 | yes Evaluation Count:17252 |
| 0-87176 |
582 | ++end, --size; executed: ++end, --size; Execution Count:69924 | 69924 |
583 | if (end-data == 0) partially evaluated: end-data == 0 no Evaluation Count:0 | yes Evaluation Count:17252 |
| 0-17252 |
584 | return QString(); never executed: return QString(); | 0 |
585 | return QString::fromRawData(reinterpret_cast<const QChar*>(data), end-data); executed: return QString::fromRawData(reinterpret_cast<const QChar*>(data), end-data); Execution Count:17252 | 17252 |
586 | } | - |
587 | | - |
588 | static inline QString getLocaleData(const ushort *data, int size) | - |
589 | { | - |
590 | return size ? QString::fromRawData(reinterpret_cast<const QChar*>(data), size) : QString(); executed: return size ? QString::fromRawData(reinterpret_cast<const QChar*>(data), size) : QString(); Execution Count:6269 | 6269 |
591 | } | - |
592 | | - |
593 | | - |
594 | | - |
595 | QDataStream &operator<<(QDataStream &ds, const QLocale &l) | - |
596 | { | - |
597 | ds << l.name(); | - |
598 | return ds; executed: return ds; Execution Count:3 | 3 |
599 | } | - |
600 | | - |
601 | QDataStream &operator>>(QDataStream &ds, QLocale &l) | - |
602 | { | - |
603 | QString s; | - |
604 | ds >> s; | - |
605 | l = QLocale(s); | - |
606 | return ds; executed: return ds; Execution Count:7 | 7 |
607 | } | - |
608 | | - |
609 | | - |
610 | | - |
611 | static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1; | - |
612 | | - |
613 | const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index) | - |
614 | { | - |
615 | | - |
616 | qt_noop(); | - |
617 | if (index == locale_data_size) evaluated: index == locale_data_size yes Evaluation Count:2151948 | yes Evaluation Count:13838436 |
| 2151948-13838436 |
618 | return system_data; executed: return system_data; Execution Count:2151948 | 2151948 |
619 | | - |
620 | | - |
621 | | - |
622 | | - |
623 | return &locale_data[index]; executed: return &locale_data[index]; Execution Count:13838438 | 13838438 |
624 | } | - |
625 | | - |
626 | static quint16 localeDataIndex(const QLocaleData *p) | - |
627 | { | - |
628 | | - |
629 | qt_noop(); | - |
630 | | - |
631 | quint16 index = p == system_data ? locale_data_size : p - locale_data; evaluated: p == system_data yes Evaluation Count:2151948 | yes Evaluation Count:13838438 |
| 2151948-13838438 |
632 | | - |
633 | | - |
634 | | - |
635 | | - |
636 | | - |
637 | return index; executed: return index; Execution Count:15990386 | 15990386 |
638 | } | - |
639 | | - |
640 | | - |
641 | | - |
642 | | - |
643 | QLocale::QLocale(QLocalePrivate &dd) | - |
644 | : d(&dd) | - |
645 | {} executed: } Execution Count:4691 | 4691 |
646 | QLocale::QLocale(const QString &name) | - |
647 | : d(new QLocalePrivate(localeDataIndex(findLocaleData(name)))) | - |
648 | { | - |
649 | } executed: } Execution Count:4482 | 4482 |
650 | QLocale::QLocale() | - |
651 | : d(new QLocalePrivate(localeDataIndex(defaultData()), default_number_options)) | - |
652 | { | - |
653 | } executed: } Execution Count:2158518 | 2158518 |
654 | QLocale::QLocale(Language language, Country country) | - |
655 | { | - |
656 | const QLocaleData *data = QLocaleData::findLocaleData(language, QLocale::AnyScript, country); | - |
657 | int index; | - |
658 | int numberOptions = 0; | - |
659 | | - |
660 | | - |
661 | if (data->m_language_id == QLocale::C && language != QLocale::C) { evaluated: data->m_language_id == QLocale::C yes Evaluation Count:13822168 | yes Evaluation Count:527 |
evaluated: language != QLocale::C yes Evaluation Count:12 | yes Evaluation Count:13822156 |
| 12-13822168 |
662 | numberOptions = default_number_options; | - |
663 | index = localeDataIndex(defaultData()); | - |
664 | } else { executed: } Execution Count:12 | 12 |
665 | index = localeDataIndex(data); | - |
666 | } executed: } Execution Count:13822683 | 13822683 |
667 | d = new QLocalePrivate(index, numberOptions); | - |
668 | } executed: } Execution Count:13822696 | 13822696 |
669 | QLocale::QLocale(Language language, Script script, Country country) | - |
670 | { | - |
671 | const QLocaleData *data = QLocaleData::findLocaleData(language, script, country); | - |
672 | int index; | - |
673 | int numberOptions = 0; | - |
674 | | - |
675 | | - |
676 | if (data->m_language_id == QLocale::C && language != QLocale::C) { never evaluated: data->m_language_id == QLocale::C never evaluated: language != QLocale::C | 0 |
677 | numberOptions = default_number_options; | - |
678 | index = localeDataIndex(defaultData()); | - |
679 | } else { | 0 |
680 | index = localeDataIndex(data); | - |
681 | } | 0 |
682 | d = new QLocalePrivate(index, numberOptions); | - |
683 | } | 0 |
684 | | - |
685 | | - |
686 | | - |
687 | | - |
688 | | - |
689 | QLocale::QLocale(const QLocale &other) | - |
690 | { | - |
691 | d = other.d; | - |
692 | } executed: } Execution Count:94582 | 94582 |
693 | | - |
694 | | - |
695 | | - |
696 | | - |
697 | | - |
698 | QLocale::~QLocale() | - |
699 | { | - |
700 | } | - |
701 | | - |
702 | | - |
703 | | - |
704 | | - |
705 | | - |
706 | | - |
707 | QLocale &QLocale::operator=(const QLocale &other) | - |
708 | { | - |
709 | d = other.d; | - |
710 | return *this; executed: return *this; Execution Count:1169786 | 1169786 |
711 | } | - |
712 | | - |
713 | bool QLocale::operator==(const QLocale &other) const | - |
714 | { | - |
715 | return d->m_data == other.d->m_data && d->m_numberOptions == other.d->m_numberOptions; executed: return d->m_data == other.d->m_data && d->m_numberOptions == other.d->m_numberOptions; Execution Count:43165 | 43165 |
716 | } | - |
717 | | - |
718 | bool QLocale::operator!=(const QLocale &other) const | - |
719 | { | - |
720 | return d->m_data != other.d->m_data || d->m_numberOptions != other.d->m_numberOptions; executed: return d->m_data != other.d->m_data || d->m_numberOptions != other.d->m_numberOptions; Execution Count:26138 | 26138 |
721 | } | - |
722 | | - |
723 | | - |
724 | | - |
725 | | - |
726 | | - |
727 | | - |
728 | | - |
729 | void QLocale::setNumberOptions(NumberOptions options) | - |
730 | { | - |
731 | d->m_numberOptions = options; | - |
732 | } executed: } Execution Count:42303 | 42303 |
733 | QLocale::NumberOptions QLocale::numberOptions() const | - |
734 | { | - |
735 | return static_cast<NumberOption>(d->m_numberOptions); executed: return static_cast<NumberOption>(d->m_numberOptions); Execution Count:1847 | 1847 |
736 | } | - |
737 | | - |
738 | | - |
739 | | - |
740 | | - |
741 | | - |
742 | | - |
743 | | - |
744 | QString QLocale::quoteString(const QString &str, QuotationStyle style) const | - |
745 | { | - |
746 | return quoteString(&str, style); executed: return quoteString(&str, style); Execution Count:4 | 4 |
747 | } | - |
748 | | - |
749 | | - |
750 | | - |
751 | | - |
752 | | - |
753 | | - |
754 | QString QLocale::quoteString(const QStringRef &str, QuotationStyle style) const | - |
755 | { | - |
756 | | - |
757 | if (d->m_data == systemData()) { partially evaluated: d->m_data == systemData() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
758 | QVariant res; | - |
759 | if (style == QLocale::AlternateQuotation) never evaluated: style == QLocale::AlternateQuotation | 0 |
760 | res = systemLocale()->query(QSystemLocale::StringToAlternateQuotation, QVariant::fromValue(str)); never executed: res = systemLocale()->query(QSystemLocale::StringToAlternateQuotation, QVariant::fromValue(str)); | 0 |
761 | if (res.isNull() || style == QLocale::StandardQuotation) never evaluated: res.isNull() never evaluated: style == QLocale::StandardQuotation | 0 |
762 | res = systemLocale()->query(QSystemLocale::StringToStandardQuotation, QVariant::fromValue(str)); never executed: res = systemLocale()->query(QSystemLocale::StringToStandardQuotation, QVariant::fromValue(str)); | 0 |
763 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
764 | return res.toString(); never executed: return res.toString(); | 0 |
765 | } | 0 |
766 | | - |
767 | | - |
768 | if (style == QLocale::StandardQuotation) evaluated: style == QLocale::StandardQuotation yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
769 | return QChar(d->m_data->m_quotation_start) % str % QChar(d->m_data->m_quotation_end); executed: return QChar(d->m_data->m_quotation_start) % str % QChar(d->m_data->m_quotation_end); Execution Count:2 | 2 |
770 | else | - |
771 | return QChar(d->m_data->m_alternate_quotation_start) % str % QChar(d->m_data->m_alternate_quotation_end); executed: return QChar(d->m_data->m_alternate_quotation_start) % str % QChar(d->m_data->m_alternate_quotation_end); Execution Count:2 | 2 |
772 | } | - |
773 | | - |
774 | | - |
775 | | - |
776 | | - |
777 | | - |
778 | | - |
779 | | - |
780 | QString QLocale::createSeparatedList(const QStringList &list) const | - |
781 | { | - |
782 | | - |
783 | if (d->m_data == systemData()) { partially evaluated: d->m_data == systemData() no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
784 | QVariant res; | - |
785 | res = systemLocale()->query(QSystemLocale::ListToSeparatedString, QVariant::fromValue(list)); | - |
786 | | - |
787 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
788 | return res.toString(); never executed: return res.toString(); | 0 |
789 | } | 0 |
790 | | - |
791 | | - |
792 | const int size = list.size(); | - |
793 | if (size == 1) { evaluated: size == 1 yes Evaluation Count:3 | yes Evaluation Count:12 |
| 3-12 |
794 | return list.at(0); executed: return list.at(0); Execution Count:3 | 3 |
795 | } else if (size == 2) { evaluated: size == 2 yes Evaluation Count:3 | yes Evaluation Count:9 |
| 3-9 |
796 | QString format = getLocaleData(list_pattern_part_data + d->m_data->m_list_pattern_part_two_idx, d->m_data->m_list_pattern_part_two_size); | - |
797 | return format.arg(list.at(0), list.at(1)); executed: return format.arg(list.at(0), list.at(1)); Execution Count:3 | 3 |
798 | } else if (size > 2) { evaluated: size > 2 yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
799 | QString formatStart = getLocaleData(list_pattern_part_data + d->m_data->m_list_pattern_part_start_idx, d->m_data->m_list_pattern_part_start_size); | - |
800 | QString formatMid = getLocaleData(list_pattern_part_data + d->m_data->m_list_pattern_part_mid_idx, d->m_data->m_list_pattern_part_mid_size); | - |
801 | QString formatEnd = getLocaleData(list_pattern_part_data + d->m_data->m_list_pattern_part_end_idx, d->m_data->m_list_pattern_part_end_size); | - |
802 | QString result = formatStart.arg(list.at(0), list.at(1)); | - |
803 | for (int i = 2; i < size - 1; ++i) evaluated: i < size - 1 yes Evaluation Count:3 | yes Evaluation Count:6 |
| 3-6 |
804 | result = formatMid.arg(result, list.at(i)); executed: result = formatMid.arg(result, list.at(i)); Execution Count:3 | 3 |
805 | result = formatEnd.arg(result, list.at(size - 1)); | - |
806 | return result; executed: return result; Execution Count:6 | 6 |
807 | } | - |
808 | | - |
809 | return QString(); executed: return QString(); Execution Count:3 | 3 |
810 | } | - |
811 | void QLocale::setDefault(const QLocale &locale) | - |
812 | { | - |
813 | default_data = locale.d->m_data; | - |
814 | default_number_options = locale.numberOptions(); | - |
815 | } executed: } Execution Count:1633 | 1633 |
816 | | - |
817 | | - |
818 | | - |
819 | | - |
820 | | - |
821 | | - |
822 | QLocale::Language QLocale::language() const | - |
823 | { | - |
824 | return Language(d->languageId()); executed: return Language(d->languageId()); Execution Count:11985 | 11985 |
825 | } | - |
826 | QLocale::Script QLocale::script() const | - |
827 | { | - |
828 | return Script(d->m_data->m_script_id); executed: return Script(d->m_data->m_script_id); Execution Count:21 | 21 |
829 | } | - |
830 | | - |
831 | | - |
832 | | - |
833 | | - |
834 | | - |
835 | | - |
836 | QLocale::Country QLocale::country() const | - |
837 | { | - |
838 | return Country(d->countryId()); executed: return Country(d->countryId()); Execution Count:10563 | 10563 |
839 | } | - |
840 | QString QLocale::name() const | - |
841 | { | - |
842 | Language l = language(); | - |
843 | | - |
844 | QString result = d->languageCode(); | - |
845 | | - |
846 | if (l == C) evaluated: l == C yes Evaluation Count:101 | yes Evaluation Count:2514 |
| 101-2514 |
847 | return result; executed: return result; Execution Count:101 | 101 |
848 | | - |
849 | Country c = country(); | - |
850 | if (c == AnyCountry) partially evaluated: c == AnyCountry no Evaluation Count:0 | yes Evaluation Count:2514 |
| 0-2514 |
851 | return result; never executed: return result; | 0 |
852 | | - |
853 | result.append(QLatin1Char('_')); | - |
854 | result.append(d->countryCode()); | - |
855 | | - |
856 | return result; executed: return result; Execution Count:2514 | 2514 |
857 | } | - |
858 | QString QLocale::bcp47Name() const | - |
859 | { | - |
860 | return d->bcp47Name(); executed: return d->bcp47Name(); Execution Count:922098 | 922098 |
861 | } | - |
862 | | - |
863 | | - |
864 | | - |
865 | | - |
866 | | - |
867 | | - |
868 | | - |
869 | QString QLocale::languageToString(Language language) | - |
870 | { | - |
871 | if (uint(language) > uint(QLocale::LastLanguage)) partially evaluated: uint(language) > uint(QLocale::LastLanguage) no Evaluation Count:0 | yes Evaluation Count:494 |
| 0-494 |
872 | return QLatin1String("Unknown"); never executed: return QLatin1String("Unknown"); | 0 |
873 | return QLatin1String(language_name_list + language_name_index[language]); executed: return QLatin1String(language_name_list + language_name_index[language]); Execution Count:494 | 494 |
874 | } | - |
875 | | - |
876 | | - |
877 | | - |
878 | | - |
879 | | - |
880 | | - |
881 | | - |
882 | QString QLocale::countryToString(Country country) | - |
883 | { | - |
884 | if (uint(country) > uint(QLocale::LastCountry)) partially evaluated: uint(country) > uint(QLocale::LastCountry) no Evaluation Count:0 | yes Evaluation Count:494 |
| 0-494 |
885 | return QLatin1String("Unknown"); never executed: return QLatin1String("Unknown"); | 0 |
886 | return QLatin1String(country_name_list + country_name_index[country]); executed: return QLatin1String(country_name_list + country_name_index[country]); Execution Count:494 | 494 |
887 | } | - |
888 | QString QLocale::scriptToString(QLocale::Script script) | - |
889 | { | - |
890 | if (uint(script) > uint(QLocale::LastScript)) partially evaluated: uint(script) > uint(QLocale::LastScript) no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
891 | return QLatin1String("Unknown"); never executed: return QLatin1String("Unknown"); | 0 |
892 | return QLatin1String(script_name_list + script_name_index[script]); executed: return QLatin1String(script_name_list + script_name_index[script]); Execution Count:11 | 11 |
893 | } | - |
894 | short QLocale::toShort(const QString &s, bool *ok) const | - |
895 | { | - |
896 | qlonglong i = toLongLong(s, ok); | - |
897 | if (i < (-32767 - 1) || i > 32767) { never evaluated: i < (-32767 - 1) never evaluated: i > 32767 | 0 |
898 | if (ok != 0) | 0 |
899 | *ok = false; never executed: *ok = false; | 0 |
900 | return 0; never executed: return 0; | 0 |
901 | } | - |
902 | return short(i); never executed: return short(i); | 0 |
903 | } | - |
904 | ushort QLocale::toUShort(const QString &s, bool *ok) const | - |
905 | { | - |
906 | qulonglong i = toULongLong(s, ok); | - |
907 | if (i > (32767 * 2 + 1)) { never evaluated: i > (32767 * 2 + 1) | 0 |
908 | if (ok != 0) | 0 |
909 | *ok = false; never executed: *ok = false; | 0 |
910 | return 0; never executed: return 0; | 0 |
911 | } | - |
912 | return ushort(i); never executed: return ushort(i); | 0 |
913 | } | - |
914 | int QLocale::toInt(const QString &s, bool *ok) const | - |
915 | { | - |
916 | qlonglong i = toLongLong(s, ok); | - |
917 | if (i < (-2147483647 - 1) || i > 2147483647) { partially evaluated: i < (-2147483647 - 1) no Evaluation Count:0 | yes Evaluation Count:1110 |
partially evaluated: i > 2147483647 no Evaluation Count:0 | yes Evaluation Count:1110 |
| 0-1110 |
918 | if (ok != 0) | 0 |
919 | *ok = false; never executed: *ok = false; | 0 |
920 | return 0; never executed: return 0; | 0 |
921 | } | - |
922 | return int(i); executed: return int(i); Execution Count:1110 | 1110 |
923 | } | - |
924 | uint QLocale::toUInt(const QString &s, bool *ok) const | - |
925 | { | - |
926 | qulonglong i = toULongLong(s, ok); | - |
927 | if (i > (2147483647 * 2U + 1U)) { partially evaluated: i > (2147483647 * 2U + 1U) no Evaluation Count:0 | yes Evaluation Count:11632 |
| 0-11632 |
928 | if (ok != 0) | 0 |
929 | *ok = false; never executed: *ok = false; | 0 |
930 | return 0; never executed: return 0; | 0 |
931 | } | - |
932 | return uint(i); executed: return uint(i); Execution Count:11632 | 11632 |
933 | } | - |
934 | qlonglong QLocale::toLongLong(const QString &s, bool *ok) const | - |
935 | { | - |
936 | QLocalePrivate::GroupSeparatorMode mode | - |
937 | = d->m_numberOptions & RejectGroupSeparator evaluated: d->m_numberOptions & RejectGroupSeparator yes Evaluation Count:2 | yes Evaluation Count:1149 |
| 2-1149 |
938 | ? QLocalePrivate::FailOnGroupSeparators | - |
939 | : QLocalePrivate::ParseGroupSeparators; | - |
940 | | - |
941 | return d->stringToLongLong(s, 10, ok, mode); executed: return d->stringToLongLong(s, 10, ok, mode); Execution Count:1151 | 1151 |
942 | } | - |
943 | qulonglong QLocale::toULongLong(const QString &s, bool *ok) const | - |
944 | { | - |
945 | QLocalePrivate::GroupSeparatorMode mode | - |
946 | = d->m_numberOptions & RejectGroupSeparator partially evaluated: d->m_numberOptions & RejectGroupSeparator no Evaluation Count:0 | yes Evaluation Count:11632 |
| 0-11632 |
947 | ? QLocalePrivate::FailOnGroupSeparators | - |
948 | : QLocalePrivate::ParseGroupSeparators; | - |
949 | | - |
950 | return d->stringToUnsLongLong(s, 10, ok, mode); executed: return d->stringToUnsLongLong(s, 10, ok, mode); Execution Count:11632 | 11632 |
951 | } | - |
952 | float QLocale::toFloat(const QString &s, bool *ok) const | - |
953 | { | - |
954 | bool myOk; | - |
955 | double d = toDouble(s, &myOk); | - |
956 | if (!myOk || d > 3.4028234663852886e+38 || d < -3.4028234663852886e+38) { never evaluated: d > 3.4028234663852886e+38 never evaluated: d < -3.4028234663852886e+38 | 0 |
957 | if (ok != 0) | 0 |
958 | *ok = false; never executed: *ok = false; | 0 |
959 | return 0.0; never executed: return 0.0; | 0 |
960 | } | - |
961 | if (ok != 0) | 0 |
962 | *ok = true; never executed: *ok = true; | 0 |
963 | return float(d); never executed: return float(d); | 0 |
964 | } | - |
965 | double QLocale::toDouble(const QString &s, bool *ok) const | - |
966 | { | - |
967 | QLocalePrivate::GroupSeparatorMode mode | - |
968 | = d->m_numberOptions & RejectGroupSeparator partially evaluated: d->m_numberOptions & RejectGroupSeparator no Evaluation Count:0 | yes Evaluation Count:1274 |
| 0-1274 |
969 | ? QLocalePrivate::FailOnGroupSeparators | - |
970 | : QLocalePrivate::ParseGroupSeparators; | - |
971 | | - |
972 | return d->stringToDouble(s, ok, mode); executed: return d->stringToDouble(s, ok, mode); Execution Count:1274 | 1274 |
973 | } | - |
974 | | - |
975 | | - |
976 | | - |
977 | | - |
978 | | - |
979 | | - |
980 | | - |
981 | QString QLocale::toString(qlonglong i) const | - |
982 | { | - |
983 | int flags = d->m_numberOptions & OmitGroupSeparator evaluated: d->m_numberOptions & OmitGroupSeparator yes Evaluation Count:6447 | yes Evaluation Count:1671 |
| 1671-6447 |
984 | ? 0 | - |
985 | : QLocalePrivate::ThousandsGroup; | - |
986 | | - |
987 | return d->longLongToString(i, -1, 10, -1, flags); executed: return d->longLongToString(i, -1, 10, -1, flags); Execution Count:8118 | 8118 |
988 | } | - |
989 | | - |
990 | | - |
991 | | - |
992 | | - |
993 | | - |
994 | | - |
995 | | - |
996 | QString QLocale::toString(qulonglong i) const | - |
997 | { | - |
998 | int flags = d->m_numberOptions & OmitGroupSeparator evaluated: d->m_numberOptions & OmitGroupSeparator yes Evaluation Count:12 | yes Evaluation Count:452 |
| 12-452 |
999 | ? 0 | - |
1000 | : QLocalePrivate::ThousandsGroup; | - |
1001 | | - |
1002 | return d->unsLongLongToString(i, -1, 10, -1, flags); executed: return d->unsLongLongToString(i, -1, 10, -1, flags); Execution Count:464 | 464 |
1003 | } | - |
1004 | | - |
1005 | | - |
1006 | | - |
1007 | | - |
1008 | | - |
1009 | | - |
1010 | | - |
1011 | QString QLocale::toString(const QDate &date, const QString &format) const | - |
1012 | { | - |
1013 | return d->dateTimeToString(format, &date, 0, this); executed: return d->dateTimeToString(format, &date, 0, this); Execution Count:1744 | 1744 |
1014 | } | - |
1015 | | - |
1016 | | - |
1017 | | - |
1018 | | - |
1019 | | - |
1020 | | - |
1021 | QString QLocale::toString(const QDate &date, FormatType format) const | - |
1022 | { | - |
1023 | if (!date.isValid()) partially evaluated: !date.isValid() no Evaluation Count:0 | yes Evaluation Count:3391 |
| 0-3391 |
1024 | return QString(); never executed: return QString(); | 0 |
1025 | | - |
1026 | | - |
1027 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:1683 | yes Evaluation Count:1708 |
| 1683-1708 |
1028 | QVariant res = systemLocale()->query(format == LongFormat | - |
1029 | ? QSystemLocale::DateToStringLong : QSystemLocale::DateToStringShort, | - |
1030 | date); | - |
1031 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:1683 | no Evaluation Count:0 |
| 0-1683 |
1032 | return res.toString(); executed: return res.toString(); Execution Count:1683 | 1683 |
1033 | } | 0 |
1034 | | - |
1035 | | - |
1036 | QString format_str = dateFormat(format); | - |
1037 | return toString(date, format_str); executed: return toString(date, format_str); Execution Count:1708 | 1708 |
1038 | } | - |
1039 | | - |
1040 | static bool timeFormatContainsAP(const QString &format) | - |
1041 | { | - |
1042 | int i = 0; | - |
1043 | while (i < format.size()) { evaluated: i < format.size() yes Evaluation Count:64412 | yes Evaluation Count:3331 |
| 3331-64412 |
1044 | if (format.at(i).unicode() == '\'') { evaluated: format.at(i).unicode() == '\'' yes Evaluation Count:765 | yes Evaluation Count:63647 |
| 765-63647 |
1045 | qt_readEscapedFormatString(format, &i); | - |
1046 | continue; executed: continue; Execution Count:765 | 765 |
1047 | } | - |
1048 | | - |
1049 | if (format.at(i).toLower().unicode() == 'a') evaluated: format.at(i).toLower().unicode() == 'a' yes Evaluation Count:2487 | yes Evaluation Count:61160 |
| 2487-61160 |
1050 | return true; executed: return true; Execution Count:2487 | 2487 |
1051 | | - |
1052 | ++i; | - |
1053 | } executed: } Execution Count:61160 | 61160 |
1054 | return false; executed: return false; Execution Count:3331 | 3331 |
1055 | } | - |
1056 | | - |
1057 | static QString timeZone() | - |
1058 | { | - |
1059 | tzset(); | - |
1060 | return QString::fromLocal8Bit(tzname[1]); executed: return QString::fromLocal8Bit(tzname[1]); Execution Count:2 | 2 |
1061 | | - |
1062 | } | - |
1063 | | - |
1064 | | - |
1065 | | - |
1066 | | - |
1067 | | - |
1068 | | - |
1069 | QString QLocale::toString(const QTime &time, const QString &format) const | - |
1070 | { | - |
1071 | return d->dateTimeToString(format, 0, &time, this); executed: return d->dateTimeToString(format, 0, &time, this); Execution Count:1700 | 1700 |
1072 | } | - |
1073 | QString QLocale::toString(const QDateTime &dateTime, const QString &format) const | - |
1074 | { | - |
1075 | const QDate dt = dateTime.date(); | - |
1076 | const QTime tm = dateTime.time(); | - |
1077 | return d->dateTimeToString(format, &dt, &tm, this); executed: return d->dateTimeToString(format, &dt, &tm, this); Execution Count:4121 | 4121 |
1078 | } | - |
1079 | QString QLocale::toString(const QDateTime &dateTime, FormatType format) const | - |
1080 | { | - |
1081 | if (!dateTime.isValid()) never evaluated: !dateTime.isValid() | 0 |
1082 | return QString(); never executed: return QString(); | 0 |
1083 | | - |
1084 | | - |
1085 | if (d->m_data == systemData()) { never evaluated: d->m_data == systemData() | 0 |
1086 | QVariant res = systemLocale()->query(format == LongFormat | - |
1087 | ? QSystemLocale::DateTimeToStringLong | - |
1088 | : QSystemLocale::DateTimeToStringShort, | - |
1089 | dateTime); | - |
1090 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
1091 | return res.toString(); never executed: return res.toString(); | 0 |
1092 | } | 0 |
1093 | | - |
1094 | | - |
1095 | const QString format_str = dateTimeFormat(format); | - |
1096 | return toString(dateTime, format_str); never executed: return toString(dateTime, format_str); | 0 |
1097 | } | - |
1098 | | - |
1099 | | - |
1100 | | - |
1101 | | - |
1102 | | - |
1103 | | - |
1104 | | - |
1105 | QString QLocale::toString(const QTime &time, FormatType format) const | - |
1106 | { | - |
1107 | if (!time.isValid()) partially evaluated: !time.isValid() no Evaluation Count:0 | yes Evaluation Count:3333 |
| 0-3333 |
1108 | return QString(); never executed: return QString(); | 0 |
1109 | | - |
1110 | | - |
1111 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:1664 | yes Evaluation Count:1669 |
| 1664-1669 |
1112 | QVariant res = systemLocale()->query(format == LongFormat | - |
1113 | ? QSystemLocale::TimeToStringLong : QSystemLocale::TimeToStringShort, | - |
1114 | time); | - |
1115 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:1664 | no Evaluation Count:0 |
| 0-1664 |
1116 | return res.toString(); executed: return res.toString(); Execution Count:1664 | 1664 |
1117 | } | 0 |
1118 | | - |
1119 | | - |
1120 | QString format_str = timeFormat(format); | - |
1121 | return toString(time, format_str); executed: return toString(time, format_str); Execution Count:1669 | 1669 |
1122 | } | - |
1123 | QString QLocale::dateFormat(FormatType format) const | - |
1124 | { | - |
1125 | | - |
1126 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:10 | yes Evaluation Count:1871 |
| 10-1871 |
1127 | QVariant res = systemLocale()->query(format == LongFormat | - |
1128 | ? QSystemLocale::DateFormatLong : QSystemLocale::DateFormatShort, | - |
1129 | QVariant()); | - |
1130 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1131 | return res.toString(); executed: return res.toString(); Execution Count:10 | 10 |
1132 | } | 0 |
1133 | | - |
1134 | | - |
1135 | quint32 idx, size; | - |
1136 | switch (format) { | - |
1137 | case LongFormat: | - |
1138 | idx = d->m_data->m_long_date_format_idx; | - |
1139 | size = d->m_data->m_long_date_format_size; | - |
1140 | break; executed: break; Execution Count:27 | 27 |
1141 | default: | - |
1142 | idx = d->m_data->m_short_date_format_idx; | - |
1143 | size = d->m_data->m_short_date_format_size; | - |
1144 | break; executed: break; Execution Count:1844 | 1844 |
1145 | } | - |
1146 | return getLocaleData(date_format_data + idx, size); executed: return getLocaleData(date_format_data + idx, size); Execution Count:1871 | 1871 |
1147 | } | - |
1148 | QString QLocale::timeFormat(FormatType format) const | - |
1149 | { | - |
1150 | | - |
1151 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:10 | yes Evaluation Count:1833 |
| 10-1833 |
1152 | QVariant res = systemLocale()->query(format == LongFormat | - |
1153 | ? QSystemLocale::TimeFormatLong : QSystemLocale::TimeFormatShort, | - |
1154 | QVariant()); | - |
1155 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1156 | return res.toString(); executed: return res.toString(); Execution Count:10 | 10 |
1157 | } | 0 |
1158 | | - |
1159 | | - |
1160 | quint32 idx, size; | - |
1161 | switch (format) { | - |
1162 | case LongFormat: | - |
1163 | idx = d->m_data->m_long_time_format_idx; | - |
1164 | size = d->m_data->m_long_time_format_size; | - |
1165 | break; executed: break; Execution Count:28 | 28 |
1166 | default: | - |
1167 | idx = d->m_data->m_short_time_format_idx; | - |
1168 | size = d->m_data->m_short_time_format_size; | - |
1169 | break; executed: break; Execution Count:1805 | 1805 |
1170 | } | - |
1171 | return getLocaleData(time_format_data + idx, size); executed: return getLocaleData(time_format_data + idx, size); Execution Count:1833 | 1833 |
1172 | } | - |
1173 | QString QLocale::dateTimeFormat(FormatType format) const | - |
1174 | { | - |
1175 | | - |
1176 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:13 | yes Evaluation Count:93 |
| 13-93 |
1177 | QVariant res = systemLocale()->query(format == LongFormat | - |
1178 | ? QSystemLocale::DateTimeFormatLong | - |
1179 | : QSystemLocale::DateTimeFormatShort, | - |
1180 | QVariant()); | - |
1181 | if (!res.isNull()) { partially evaluated: !res.isNull() yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
1182 | return res.toString(); executed: return res.toString(); Execution Count:13 | 13 |
1183 | } | - |
1184 | } | 0 |
1185 | | - |
1186 | return dateFormat(format) + QLatin1Char(' ') + timeFormat(format); executed: return dateFormat(format) + QLatin1Char(' ') + timeFormat(format); Execution Count:93 | 93 |
1187 | } | - |
1188 | QTime QLocale::toTime(const QString &string, FormatType format) const | - |
1189 | { | - |
1190 | return toTime(string, timeFormat(format)); never executed: return toTime(string, timeFormat(format)); | 0 |
1191 | } | - |
1192 | QDate QLocale::toDate(const QString &string, FormatType format) const | - |
1193 | { | - |
1194 | return toDate(string, dateFormat(format)); never executed: return toDate(string, dateFormat(format)); | 0 |
1195 | } | - |
1196 | QDateTime QLocale::toDateTime(const QString &string, FormatType format) const | - |
1197 | { | - |
1198 | return toDateTime(string, dateTimeFormat(format)); never executed: return toDateTime(string, dateTimeFormat(format)); | 0 |
1199 | } | - |
1200 | QTime QLocale::toTime(const QString &string, const QString &format) const | - |
1201 | { | - |
1202 | QTime time; | - |
1203 | | - |
1204 | QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString); | - |
1205 | dt.defaultLocale = *this; | - |
1206 | if (dt.parseFormat(format)) never evaluated: dt.parseFormat(format) | 0 |
1207 | dt.fromString(string, 0, &time); never executed: dt.fromString(string, 0, &time); | 0 |
1208 | | - |
1209 | | - |
1210 | | - |
1211 | | - |
1212 | return time; never executed: return time; | 0 |
1213 | } | - |
1214 | QDate QLocale::toDate(const QString &string, const QString &format) const | - |
1215 | { | - |
1216 | QDate date; | - |
1217 | | - |
1218 | QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString); | - |
1219 | dt.defaultLocale = *this; | - |
1220 | if (dt.parseFormat(format)) never evaluated: dt.parseFormat(format) | 0 |
1221 | dt.fromString(string, &date, 0); never executed: dt.fromString(string, &date, 0); | 0 |
1222 | | - |
1223 | | - |
1224 | | - |
1225 | | - |
1226 | return date; never executed: return date; | 0 |
1227 | } | - |
1228 | QDateTime QLocale::toDateTime(const QString &string, const QString &format) const | - |
1229 | { | - |
1230 | | - |
1231 | QTime time; | - |
1232 | QDate date; | - |
1233 | | - |
1234 | QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString); | - |
1235 | dt.defaultLocale = *this; | - |
1236 | if (dt.parseFormat(format) && dt.fromString(string, &date, &time)) partially evaluated: dt.parseFormat(format) yes Evaluation Count:21 | no Evaluation Count:0 |
partially evaluated: dt.fromString(string, &date, &time) yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-21 |
1237 | return QDateTime(date, time); executed: return QDateTime(date, time); Execution Count:21 | 21 |
1238 | | - |
1239 | | - |
1240 | | - |
1241 | | - |
1242 | return QDateTime(QDate(), QTime(-1, -1, -1)); never executed: return QDateTime(QDate(), QTime(-1, -1, -1)); | 0 |
1243 | } | - |
1244 | QChar QLocale::decimalPoint() const | - |
1245 | { | - |
1246 | return d->decimal(); executed: return d->decimal(); Execution Count:2043 | 2043 |
1247 | } | - |
1248 | | - |
1249 | | - |
1250 | | - |
1251 | | - |
1252 | | - |
1253 | | - |
1254 | QChar QLocale::groupSeparator() const | - |
1255 | { | - |
1256 | return d->group(); executed: return d->group(); Execution Count:5889 | 5889 |
1257 | } | - |
1258 | | - |
1259 | | - |
1260 | | - |
1261 | | - |
1262 | | - |
1263 | | - |
1264 | QChar QLocale::percent() const | - |
1265 | { | - |
1266 | return d->percent(); never executed: return d->percent(); | 0 |
1267 | } | - |
1268 | | - |
1269 | | - |
1270 | | - |
1271 | | - |
1272 | | - |
1273 | | - |
1274 | QChar QLocale::zeroDigit() const | - |
1275 | { | - |
1276 | return d->zero(); executed: return d->zero(); Execution Count:45 | 45 |
1277 | } | - |
1278 | | - |
1279 | | - |
1280 | | - |
1281 | | - |
1282 | | - |
1283 | | - |
1284 | QChar QLocale::negativeSign() const | - |
1285 | { | - |
1286 | return d->minus(); executed: return d->minus(); Execution Count:57112 | 57112 |
1287 | } | - |
1288 | | - |
1289 | | - |
1290 | | - |
1291 | | - |
1292 | | - |
1293 | | - |
1294 | QChar QLocale::positiveSign() const | - |
1295 | { | - |
1296 | return d->plus(); executed: return d->plus(); Execution Count:35726 | 35726 |
1297 | } | - |
1298 | | - |
1299 | | - |
1300 | | - |
1301 | | - |
1302 | | - |
1303 | | - |
1304 | QChar QLocale::exponential() const | - |
1305 | { | - |
1306 | return d->exponential(); executed: return d->exponential(); Execution Count:81 | 81 |
1307 | } | - |
1308 | | - |
1309 | static bool qIsUpper(char c) | - |
1310 | { | - |
1311 | return c >= 'A' && c <= 'Z'; executed: return c >= 'A' && c <= 'Z'; Execution Count:997 | 997 |
1312 | } | - |
1313 | | - |
1314 | static char qToLower(char c) | - |
1315 | { | - |
1316 | if (c >= 'A' && c <= 'Z') partially evaluated: c >= 'A' yes Evaluation Count:997 | no Evaluation Count:0 |
partially evaluated: c <= 'Z' no Evaluation Count:0 | yes Evaluation Count:997 |
| 0-997 |
1317 | return c - 'A' + 'a'; never executed: return c - 'A' + 'a'; | 0 |
1318 | else | - |
1319 | return c; executed: return c; Execution Count:997 | 997 |
1320 | } | - |
1321 | QString QLocale::toString(double i, char f, int prec) const | - |
1322 | { | - |
1323 | QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal; | - |
1324 | uint flags = 0; | - |
1325 | | - |
1326 | if (qIsUpper(f)) partially evaluated: qIsUpper(f) no Evaluation Count:0 | yes Evaluation Count:997 |
| 0-997 |
1327 | flags = QLocalePrivate::CapitalEorX; never executed: flags = QLocalePrivate::CapitalEorX; | 0 |
1328 | f = qToLower(f); | - |
1329 | | - |
1330 | switch (f) { | - |
1331 | case 'f': | - |
1332 | form = QLocalePrivate::DFDecimal; | - |
1333 | break; executed: break; Execution Count:929 | 929 |
1334 | case 'e': | - |
1335 | form = QLocalePrivate::DFExponent; | - |
1336 | break; | 0 |
1337 | case 'g': | - |
1338 | form = QLocalePrivate::DFSignificantDigits; | - |
1339 | break; executed: break; Execution Count:68 | 68 |
1340 | default: | - |
1341 | break; | 0 |
1342 | } | - |
1343 | | - |
1344 | if (!(d->m_numberOptions & OmitGroupSeparator)) evaluated: !(d->m_numberOptions & OmitGroupSeparator) yes Evaluation Count:986 | yes Evaluation Count:11 |
| 11-986 |
1345 | flags |= QLocalePrivate::ThousandsGroup; executed: flags |= QLocalePrivate::ThousandsGroup; Execution Count:986 | 986 |
1346 | return d->doubleToString(i, prec, form, -1, flags); executed: return d->doubleToString(i, prec, form, -1, flags); Execution Count:997 | 997 |
1347 | } | - |
1348 | QLocale QLocale::system() | - |
1349 | { | - |
1350 | return QLocale(*new QLocalePrivate(localeDataIndex(systemData()))); executed: return QLocale(*new QLocalePrivate(localeDataIndex(systemData()))); Execution Count:4659 | 4659 |
1351 | } | - |
1352 | QList<QLocale> QLocale::matchingLocales(QLocale::Language language, | - |
1353 | QLocale::Script script, | - |
1354 | QLocale::Country country) | - |
1355 | { | - |
1356 | if (uint(language) > QLocale::LastLanguage || uint(script) > QLocale::LastScript || partially evaluated: uint(language) > QLocale::LastLanguage no Evaluation Count:0 | yes Evaluation Count:5 |
partially evaluated: uint(script) > QLocale::LastScript no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1357 | uint(country) > QLocale::LastCountry) partially evaluated: uint(country) > QLocale::LastCountry no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1358 | return QList<QLocale>(); never executed: return QList<QLocale>(); | 0 |
1359 | | - |
1360 | if (language == QLocale::C) evaluated: language == QLocale::C yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
1361 | return QList<QLocale>() << QLocale(QLocale::C); executed: return QList<QLocale>() << QLocale(QLocale::C); Execution Count:1 | 1 |
1362 | | - |
1363 | QList<QLocale> result; | - |
1364 | if (language == QLocale::AnyLanguage && script == QLocale::AnyScript && country == QLocale::AnyCountry) evaluated: language == QLocale::AnyLanguage yes Evaluation Count:2 | yes Evaluation Count:2 |
evaluated: script == QLocale::AnyScript yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: country == QLocale::AnyCountry no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-2 |
1365 | result.reserve(locale_data_size); never executed: result.reserve(locale_data_size); | 0 |
1366 | const QLocaleData *data = locale_data + locale_index[language]; | - |
1367 | while ( (data != locale_data + locale_data_size) evaluated: (data != locale_data + locale_data_size) yes Evaluation Count:890 | yes Evaluation Count:2 |
| 2-890 |
1368 | && (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) { evaluated: language == QLocale::AnyLanguage yes Evaluation Count:876 | yes Evaluation Count:14 |
evaluated: data->m_language_id == uint(language) yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-876 |
1369 | if ((script == QLocale::AnyScript || data->m_script_id == uint(script)) evaluated: script == QLocale::AnyScript yes Evaluation Count:444 | yes Evaluation Count:444 |
evaluated: data->m_script_id == uint(script) yes Evaluation Count:28 | yes Evaluation Count:416 |
| 28-444 |
1370 | && (country == QLocale::AnyCountry || data->m_country_id == uint(country))) { evaluated: country == QLocale::AnyCountry yes Evaluation Count:28 | yes Evaluation Count:444 |
evaluated: data->m_country_id == uint(country) yes Evaluation Count:4 | yes Evaluation Count:440 |
| 4-444 |
1371 | QLocale locale(*new QLocalePrivate(localeDataIndex(data))); | - |
1372 | result.append(locale); | - |
1373 | } executed: } Execution Count:32 | 32 |
1374 | ++data; | - |
1375 | } executed: } Execution Count:888 | 888 |
1376 | return result; executed: return result; Execution Count:4 | 4 |
1377 | } | - |
1378 | QList<QLocale::Country> QLocale::countriesForLanguage(Language language) | - |
1379 | { | - |
1380 | QList<Country> result; | - |
1381 | if (language == C) { never evaluated: language == C | 0 |
1382 | result << AnyCountry; | - |
1383 | return result; never executed: return result; | 0 |
1384 | } | - |
1385 | | - |
1386 | unsigned language_id = language; | - |
1387 | const QLocaleData *data = locale_data + locale_index[language_id]; | - |
1388 | while (data->m_language_id == language_id) { never evaluated: data->m_language_id == language_id | 0 |
1389 | const QLocale::Country country = static_cast<Country>(data->m_country_id); | - |
1390 | if (!result.contains(country)) never evaluated: !result.contains(country) | 0 |
1391 | result.append(country); never executed: result.append(country); | 0 |
1392 | ++data; | - |
1393 | } | 0 |
1394 | | - |
1395 | return result; never executed: return result; | 0 |
1396 | } | - |
1397 | QString QLocale::monthName(int month, FormatType type) const | - |
1398 | { | - |
1399 | if (month < 1 || month > 12) evaluated: month < 1 yes Evaluation Count:6 | yes Evaluation Count:27036 |
evaluated: month > 12 yes Evaluation Count:6 | yes Evaluation Count:27030 |
| 6-27036 |
1400 | return QString(); executed: return QString(); Execution Count:12 | 12 |
1401 | | - |
1402 | | - |
1403 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:12114 | yes Evaluation Count:14916 |
| 12114-14916 |
1404 | QVariant res = systemLocale()->query(type == LongFormat | - |
1405 | ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, | - |
1406 | month); | - |
1407 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:12114 | no Evaluation Count:0 |
| 0-12114 |
1408 | return res.toString(); executed: return res.toString(); Execution Count:12114 | 12114 |
1409 | } | 0 |
1410 | | - |
1411 | | - |
1412 | quint32 idx, size; | - |
1413 | switch (type) { | - |
1414 | case QLocale::LongFormat: | - |
1415 | idx = d->m_data->m_long_month_names_idx; | - |
1416 | size = d->m_data->m_long_month_names_size; | - |
1417 | break; executed: break; Execution Count:4445 | 4445 |
1418 | case QLocale::ShortFormat: | - |
1419 | idx = d->m_data->m_short_month_names_idx; | - |
1420 | size = d->m_data->m_short_month_names_size; | - |
1421 | break; executed: break; Execution Count:10468 | 10468 |
1422 | case QLocale::NarrowFormat: | - |
1423 | idx = d->m_data->m_narrow_month_names_idx; | - |
1424 | size = d->m_data->m_narrow_month_names_size; | - |
1425 | break; executed: break; Execution Count:3 | 3 |
1426 | default: | - |
1427 | return QString(); never executed: return QString(); | 0 |
1428 | } | - |
1429 | return getLocaleListData(months_data + idx, size, month - 1); executed: return getLocaleListData(months_data + idx, size, month - 1); Execution Count:14916 | 14916 |
1430 | } | - |
1431 | QString QLocale::standaloneMonthName(int month, FormatType type) const | - |
1432 | { | - |
1433 | if (month < 1 || month > 12) partially evaluated: month < 1 no Evaluation Count:0 | yes Evaluation Count:1222 |
partially evaluated: month > 12 no Evaluation Count:0 | yes Evaluation Count:1222 |
| 0-1222 |
1434 | return QString(); never executed: return QString(); | 0 |
1435 | | - |
1436 | | - |
1437 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:537 | yes Evaluation Count:685 |
| 537-685 |
1438 | QVariant res = systemLocale()->query(type == LongFormat | - |
1439 | ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, | - |
1440 | month); | - |
1441 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:537 | no Evaluation Count:0 |
| 0-537 |
1442 | return res.toString(); executed: return res.toString(); Execution Count:537 | 537 |
1443 | } | 0 |
1444 | | - |
1445 | | - |
1446 | quint32 idx, size; | - |
1447 | switch (type) { | - |
1448 | case QLocale::LongFormat: | - |
1449 | idx = d->m_data->m_standalone_long_month_names_idx; | - |
1450 | size = d->m_data->m_standalone_long_month_names_size; | - |
1451 | break; executed: break; Execution Count:680 | 680 |
1452 | case QLocale::ShortFormat: | - |
1453 | idx = d->m_data->m_standalone_short_month_names_idx; | - |
1454 | size = d->m_data->m_standalone_short_month_names_size; | - |
1455 | break; executed: break; Execution Count:3 | 3 |
1456 | case QLocale::NarrowFormat: | - |
1457 | idx = d->m_data->m_standalone_narrow_month_names_idx; | - |
1458 | size = d->m_data->m_standalone_narrow_month_names_size; | - |
1459 | break; executed: break; Execution Count:2 | 2 |
1460 | default: | - |
1461 | return QString(); never executed: return QString(); | 0 |
1462 | } | - |
1463 | QString name = getLocaleListData(months_data + idx, size, month - 1); | - |
1464 | if (name.isEmpty()) partially evaluated: name.isEmpty() no Evaluation Count:0 | yes Evaluation Count:685 |
| 0-685 |
1465 | return monthName(month, type); never executed: return monthName(month, type); | 0 |
1466 | return name; executed: return name; Execution Count:685 | 685 |
1467 | } | - |
1468 | QString QLocale::dayName(int day, FormatType type) const | - |
1469 | { | - |
1470 | if (day < 1 || day > 7) partially evaluated: day < 1 no Evaluation Count:0 | yes Evaluation Count:2463 |
partially evaluated: day > 7 no Evaluation Count:0 | yes Evaluation Count:2463 |
| 0-2463 |
1471 | return QString(); never executed: return QString(); | 0 |
1472 | | - |
1473 | | - |
1474 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:821 | yes Evaluation Count:1642 |
| 821-1642 |
1475 | QVariant res = systemLocale()->query(type == LongFormat | - |
1476 | ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort, | - |
1477 | day); | - |
1478 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:821 | no Evaluation Count:0 |
| 0-821 |
1479 | return res.toString(); executed: return res.toString(); Execution Count:821 | 821 |
1480 | } | 0 |
1481 | | - |
1482 | if (day == 7) evaluated: day == 7 yes Evaluation Count:288 | yes Evaluation Count:1354 |
| 288-1354 |
1483 | day = 0; executed: day = 0; Execution Count:288 | 288 |
1484 | | - |
1485 | quint32 idx, size; | - |
1486 | switch (type) { | - |
1487 | case QLocale::LongFormat: | - |
1488 | idx = d->m_data->m_long_day_names_idx; | - |
1489 | size = d->m_data->m_long_day_names_size; | - |
1490 | break; executed: break; Execution Count:311 | 311 |
1491 | case QLocale::ShortFormat: | - |
1492 | idx = d->m_data->m_short_day_names_idx; | - |
1493 | size = d->m_data->m_short_day_names_size; | - |
1494 | break; executed: break; Execution Count:1329 | 1329 |
1495 | case QLocale::NarrowFormat: | - |
1496 | idx = d->m_data->m_narrow_day_names_idx; | - |
1497 | size = d->m_data->m_narrow_day_names_size; | - |
1498 | break; executed: break; Execution Count:2 | 2 |
1499 | default: | - |
1500 | return QString(); never executed: return QString(); | 0 |
1501 | } | - |
1502 | return getLocaleListData(days_data + idx, size, day); executed: return getLocaleListData(days_data + idx, size, day); Execution Count:1642 | 1642 |
1503 | } | - |
1504 | QString QLocale::standaloneDayName(int day, FormatType type) const | - |
1505 | { | - |
1506 | if (day < 1 || day > 7) evaluated: day < 1 yes Evaluation Count:3 | yes Evaluation Count:40 |
evaluated: day > 7 yes Evaluation Count:3 | yes Evaluation Count:37 |
| 3-40 |
1507 | return QString(); executed: return QString(); Execution Count:6 | 6 |
1508 | | - |
1509 | | - |
1510 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:28 | yes Evaluation Count:9 |
| 9-28 |
1511 | QVariant res = systemLocale()->query(type == LongFormat | - |
1512 | ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort, | - |
1513 | day); | - |
1514 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:28 | no Evaluation Count:0 |
| 0-28 |
1515 | return res.toString(); executed: return res.toString(); Execution Count:28 | 28 |
1516 | } | 0 |
1517 | | - |
1518 | if (day == 7) evaluated: day == 7 yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
1519 | day = 0; executed: day = 0; Execution Count:6 | 6 |
1520 | | - |
1521 | quint32 idx, size; | - |
1522 | switch (type) { | - |
1523 | case QLocale::LongFormat: | - |
1524 | idx = d->m_data->m_standalone_long_day_names_idx; | - |
1525 | size = d->m_data->m_standalone_long_day_names_size; | - |
1526 | break; executed: break; Execution Count:5 | 5 |
1527 | case QLocale::ShortFormat: | - |
1528 | idx = d->m_data->m_standalone_short_day_names_idx; | - |
1529 | size = d->m_data->m_standalone_short_day_names_size; | - |
1530 | break; executed: break; Execution Count:2 | 2 |
1531 | case QLocale::NarrowFormat: | - |
1532 | idx = d->m_data->m_standalone_narrow_day_names_idx; | - |
1533 | size = d->m_data->m_standalone_narrow_day_names_size; | - |
1534 | break; executed: break; Execution Count:2 | 2 |
1535 | default: | - |
1536 | return QString(); never executed: return QString(); | 0 |
1537 | } | - |
1538 | QString name = getLocaleListData(days_data + idx, size, day); | - |
1539 | if (name.isEmpty()) partially evaluated: name.isEmpty() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
1540 | return dayName(day == 0 ? 7 : day, type); never executed: return dayName(day == 0 ? 7 : day, type); | 0 |
1541 | return name; executed: return name; Execution Count:9 | 9 |
1542 | } | - |
1543 | | - |
1544 | | - |
1545 | | - |
1546 | | - |
1547 | | - |
1548 | | - |
1549 | Qt::DayOfWeek QLocale::firstDayOfWeek() const | - |
1550 | { | - |
1551 | | - |
1552 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:22 | yes Evaluation Count:37 |
| 22-37 |
1553 | QVariant res = systemLocale()->query(QSystemLocale::FirstDayOfWeek, QVariant()); | - |
1554 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
1555 | return static_cast<Qt::DayOfWeek>(res.toUInt()); executed: return static_cast<Qt::DayOfWeek>(res.toUInt()); Execution Count:22 | 22 |
1556 | } | 0 |
1557 | | - |
1558 | return static_cast<Qt::DayOfWeek>(d->m_data->m_first_day_of_week); executed: return static_cast<Qt::DayOfWeek>(d->m_data->m_first_day_of_week); Execution Count:37 | 37 |
1559 | } | - |
1560 | | - |
1561 | QLocale::MeasurementSystem QLocalePrivate::measurementSystem() const | - |
1562 | { | - |
1563 | for (int i = 0; i < ImperialMeasurementSystemsCount; ++i) { evaluated: i < ImperialMeasurementSystemsCount yes Evaluation Count:16 | yes Evaluation Count:2 |
| 2-16 |
1564 | if (ImperialMeasurementSystems[i].languageId == m_data->m_language_id evaluated: ImperialMeasurementSystems[i].languageId == m_data->m_language_id yes Evaluation Count:7 | yes Evaluation Count:9 |
| 7-9 |
1565 | && ImperialMeasurementSystems[i].countryId == m_data->m_country_id) { evaluated: ImperialMeasurementSystems[i].countryId == m_data->m_country_id yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
1566 | return ImperialMeasurementSystems[i].system; executed: return ImperialMeasurementSystems[i].system; Execution Count:2 | 2 |
1567 | } | - |
1568 | } executed: } Execution Count:14 | 14 |
1569 | return QLocale::MetricSystem; executed: return QLocale::MetricSystem; Execution Count:2 | 2 |
1570 | } | - |
1571 | | - |
1572 | | - |
1573 | | - |
1574 | | - |
1575 | | - |
1576 | | - |
1577 | QList<Qt::DayOfWeek> QLocale::weekdays() const | - |
1578 | { | - |
1579 | | - |
1580 | if (d->m_data == systemData()) { partially evaluated: d->m_data == systemData() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1581 | QVariant res = systemLocale()->query(QSystemLocale::Weekdays, QVariant()); | - |
1582 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
1583 | return static_cast<QList<Qt::DayOfWeek> >(res.value<QList<Qt::DayOfWeek> >()); never executed: return static_cast<QList<Qt::DayOfWeek> >(res.value<QList<Qt::DayOfWeek> >()); | 0 |
1584 | } | 0 |
1585 | | - |
1586 | QList<Qt::DayOfWeek> weekdays; | - |
1587 | quint16 weekendStart = d->m_data->m_weekend_start; | - |
1588 | quint16 weekendEnd = d->m_data->m_weekend_end; | - |
1589 | for (int day = Qt::Monday; day <= Qt::Sunday; day++) { evaluated: day <= Qt::Sunday yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-7 |
1590 | if ((weekendEnd >= weekendStart && (day < weekendStart || day > weekendEnd)) || partially evaluated: weekendEnd >= weekendStart yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: day < weekendStart yes Evaluation Count:5 | yes Evaluation Count:2 |
partially evaluated: day > weekendEnd no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-7 |
1591 | (weekendEnd < weekendStart && (day > weekendEnd && day < weekendStart))) partially evaluated: weekendEnd < weekendStart no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: day > weekendEnd never evaluated: day < weekendStart | 0-2 |
1592 | weekdays << static_cast<Qt::DayOfWeek>(day); executed: weekdays << static_cast<Qt::DayOfWeek>(day); Execution Count:5 | 5 |
1593 | } executed: } Execution Count:7 | 7 |
1594 | return weekdays; executed: return weekdays; Execution Count:1 | 1 |
1595 | } | - |
1596 | | - |
1597 | | - |
1598 | | - |
1599 | | - |
1600 | | - |
1601 | | - |
1602 | QLocale::MeasurementSystem QLocale::measurementSystem() const | - |
1603 | { | - |
1604 | | - |
1605 | if (d->m_data == systemData()) { partially evaluated: d->m_data == systemData() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1606 | QVariant res = systemLocale()->query(QSystemLocale::MeasurementSystem, QVariant()); | - |
1607 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
1608 | return MeasurementSystem(res.toInt()); never executed: return MeasurementSystem(res.toInt()); | 0 |
1609 | } | 0 |
1610 | | - |
1611 | | - |
1612 | return d->measurementSystem(); executed: return d->measurementSystem(); Execution Count:4 | 4 |
1613 | } | - |
1614 | | - |
1615 | | - |
1616 | | - |
1617 | | - |
1618 | | - |
1619 | | - |
1620 | Qt::LayoutDirection QLocale::textDirection() const | - |
1621 | { | - |
1622 | switch (language()) { | - |
1623 | case QLocale::Arabic: | - |
1624 | case QLocale::Hebrew: | - |
1625 | case QLocale::Persian: | - |
1626 | case QLocale::Pashto: | - |
1627 | case QLocale::Urdu: | - |
1628 | case QLocale::Syriac: | - |
1629 | case QLocale::Divehi: | - |
1630 | return Qt::RightToLeft; never executed: return Qt::RightToLeft; | 0 |
1631 | case QLocale::Punjabi: | - |
1632 | case QLocale::Uzbek: | - |
1633 | if (script() == QLocale::ArabicScript) never evaluated: script() == QLocale::ArabicScript | 0 |
1634 | return Qt::RightToLeft; never executed: return Qt::RightToLeft; | 0 |
1635 | | - |
1636 | default: | - |
1637 | break; | 0 |
1638 | } | - |
1639 | return Qt::LeftToRight; never executed: return Qt::LeftToRight; | 0 |
1640 | } | - |
1641 | | - |
1642 | | - |
1643 | | - |
1644 | | - |
1645 | | - |
1646 | | - |
1647 | QString QLocale::toUpper(const QString &str) const | - |
1648 | { | - |
1649 | | - |
1650 | bool ok = true; | - |
1651 | QString result = QIcu::toUpper(d->m_localeID, str, &ok); | - |
1652 | if (ok) partially evaluated: ok yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1653 | return result; executed: return result; Execution Count:3 | 3 |
1654 | | - |
1655 | | - |
1656 | return str.toUpper(); never executed: return str.toUpper(); | 0 |
1657 | } | - |
1658 | | - |
1659 | | - |
1660 | | - |
1661 | | - |
1662 | | - |
1663 | | - |
1664 | QString QLocale::toLower(const QString &str) const | - |
1665 | { | - |
1666 | | - |
1667 | bool ok = true; | - |
1668 | QString result = QIcu::toLower(d->m_localeID, str, &ok); | - |
1669 | if (ok) partially evaluated: ok yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1670 | return result; executed: return result; Execution Count:5 | 5 |
1671 | | - |
1672 | | - |
1673 | return str.toLower(); never executed: return str.toLower(); | 0 |
1674 | } | - |
1675 | QString QLocale::amText() const | - |
1676 | { | - |
1677 | | - |
1678 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:683 | yes Evaluation Count:1129 |
| 683-1129 |
1679 | QVariant res = systemLocale()->query(QSystemLocale::AMText, QVariant()); | - |
1680 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:683 | no Evaluation Count:0 |
| 0-683 |
1681 | return res.toString(); executed: return res.toString(); Execution Count:683 | 683 |
1682 | } | 0 |
1683 | | - |
1684 | return getLocaleData(am_data + d->m_data->m_am_idx, d->m_data->m_am_size); executed: return getLocaleData(am_data + d->m_data->m_am_idx, d->m_data->m_am_size); Execution Count:1129 | 1129 |
1685 | } | - |
1686 | QString QLocale::pmText() const | - |
1687 | { | - |
1688 | | - |
1689 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:117 | yes Evaluation Count:1379 |
| 117-1379 |
1690 | QVariant res = systemLocale()->query(QSystemLocale::PMText, QVariant()); | - |
1691 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:117 | no Evaluation Count:0 |
| 0-117 |
1692 | return res.toString(); executed: return res.toString(); Execution Count:117 | 117 |
1693 | } | 0 |
1694 | | - |
1695 | return getLocaleData(pm_data + d->m_data->m_pm_idx, d->m_data->m_pm_size); executed: return getLocaleData(pm_data + d->m_data->m_pm_idx, d->m_data->m_pm_size); Execution Count:1379 | 1379 |
1696 | } | - |
1697 | | - |
1698 | | - |
1699 | QString QLocalePrivate::dateTimeToString(const QString &format, const QDate *date, const QTime *time, | - |
1700 | const QLocale *q) const | - |
1701 | { | - |
1702 | qt_noop(); | - |
1703 | if ((date && !date->isValid()) || (time && !time->isValid())) evaluated: date yes Evaluation Count:5865 | yes Evaluation Count:1700 |
evaluated: !date->isValid() yes Evaluation Count:3 | yes Evaluation Count:5862 |
evaluated: time yes Evaluation Count:5819 | yes Evaluation Count:1743 |
evaluated: !time->isValid() yes Evaluation Count:1 | yes Evaluation Count:5818 |
| 1-5865 |
1704 | return QString(); executed: return QString(); Execution Count:4 | 4 |
1705 | const bool format_am_pm = time && timeFormatContainsAP(format); evaluated: time yes Evaluation Count:5818 | yes Evaluation Count:1743 |
evaluated: timeFormatContainsAP(format) yes Evaluation Count:2487 | yes Evaluation Count:3331 |
| 1743-5818 |
1706 | | - |
1707 | enum { AM, PM } am_pm = AM; | - |
1708 | int hour12 = time ? time->hour() : -1; evaluated: time yes Evaluation Count:5818 | yes Evaluation Count:1743 |
| 1743-5818 |
1709 | if (time) { evaluated: time yes Evaluation Count:5818 | yes Evaluation Count:1743 |
| 1743-5818 |
1710 | if (hour12 == 0) { evaluated: hour12 == 0 yes Evaluation Count:2103 | yes Evaluation Count:3715 |
| 2103-3715 |
1711 | am_pm = AM; | - |
1712 | hour12 = 12; | - |
1713 | } else if (hour12 < 12) { executed: } Execution Count:2103 evaluated: hour12 < 12 yes Evaluation Count:1920 | yes Evaluation Count:1795 |
| 1795-2103 |
1714 | am_pm = AM; | - |
1715 | } else if (hour12 == 12) { executed: } Execution Count:1920 evaluated: hour12 == 12 yes Evaluation Count:402 | yes Evaluation Count:1393 |
| 402-1920 |
1716 | am_pm = PM; | - |
1717 | } else { executed: } Execution Count:402 | 402 |
1718 | am_pm = PM; | - |
1719 | hour12 -= 12; | - |
1720 | } executed: } Execution Count:1393 | 1393 |
1721 | } | - |
1722 | | - |
1723 | QString result; | - |
1724 | | - |
1725 | int i = 0; | - |
1726 | while (i < format.size()) { evaluated: i < format.size() yes Evaluation Count:49681 | yes Evaluation Count:7561 |
| 7561-49681 |
1727 | if (format.at(i).unicode() == '\'') { evaluated: format.at(i).unicode() == '\'' yes Evaluation Count:776 | yes Evaluation Count:48905 |
| 776-48905 |
1728 | result.append(qt_readEscapedFormatString(format, &i)); | - |
1729 | continue; executed: continue; Execution Count:776 | 776 |
1730 | } | - |
1731 | | - |
1732 | const QChar c = format.at(i); | - |
1733 | int repeat = qt_repeatCount(format, i); | - |
1734 | bool used = false; | - |
1735 | if (date) { evaluated: date yes Evaluation Count:40404 | yes Evaluation Count:8501 |
| 8501-40404 |
1736 | switch (c.unicode()) { | - |
1737 | case 'y': | - |
1738 | used = true; | - |
1739 | if (repeat >= 4) evaluated: repeat >= 4 yes Evaluation Count:1949 | yes Evaluation Count:2388 |
| 1949-2388 |
1740 | repeat = 4; executed: repeat = 4; Execution Count:1949 | 1949 |
1741 | else if (repeat >= 2) evaluated: repeat >= 2 yes Evaluation Count:2376 | yes Evaluation Count:12 |
| 12-2376 |
1742 | repeat = 2; executed: repeat = 2; Execution Count:2376 | 2376 |
1743 | | - |
1744 | switch (repeat) { | - |
1745 | case 4: | - |
1746 | result.append(longLongToString(date->year(), -1, 10, 4, QLocalePrivate::ZeroPadded)); | - |
1747 | break; executed: break; Execution Count:1949 | 1949 |
1748 | case 2: | - |
1749 | result.append(longLongToString(date->year() % 100, -1, 10, 2, | - |
1750 | QLocalePrivate::ZeroPadded)); | - |
1751 | break; executed: break; Execution Count:2376 | 2376 |
1752 | default: | - |
1753 | repeat = 1; | - |
1754 | result.append(c); | - |
1755 | break; executed: break; Execution Count:12 | 12 |
1756 | } | - |
1757 | break; executed: break; Execution Count:4337 | 4337 |
1758 | | - |
1759 | case 'M': | - |
1760 | used = true; | - |
1761 | repeat = qMin(repeat, 4); | - |
1762 | switch (repeat) { | - |
1763 | case 1: | - |
1764 | result.append(longLongToString(date->month())); | - |
1765 | break; executed: break; Execution Count:1818 | 1818 |
1766 | case 2: | - |
1767 | result.append(longLongToString(date->month(), -1, 10, 2, QLocalePrivate::ZeroPadded)); | - |
1768 | break; executed: break; Execution Count:1169 | 1169 |
1769 | case 3: | - |
1770 | result.append(q->monthName(date->month(), QLocale::ShortFormat)); | - |
1771 | break; executed: break; Execution Count:1358 | 1358 |
1772 | case 4: | - |
1773 | result.append(q->monthName(date->month(), QLocale::LongFormat)); | - |
1774 | break; executed: break; Execution Count:56 | 56 |
1775 | } | - |
1776 | break; executed: break; Execution Count:4401 | 4401 |
1777 | | - |
1778 | case 'd': | - |
1779 | used = true; | - |
1780 | repeat = qMin(repeat, 4); | - |
1781 | switch (repeat) { | - |
1782 | case 1: | - |
1783 | result.append(longLongToString(date->day())); | - |
1784 | break; executed: break; Execution Count:1991 | 1991 |
1785 | case 2: | - |
1786 | result.append(longLongToString(date->day(), -1, 10, 2, QLocalePrivate::ZeroPadded)); | - |
1787 | break; executed: break; Execution Count:2383 | 2383 |
1788 | case 3: | - |
1789 | result.append(q->dayName(date->dayOfWeek(), QLocale::ShortFormat)); | - |
1790 | break; executed: break; Execution Count:711 | 711 |
1791 | case 4: | - |
1792 | result.append(q->dayName(date->dayOfWeek(), QLocale::LongFormat)); | - |
1793 | break; executed: break; Execution Count:21 | 21 |
1794 | } | - |
1795 | break; executed: break; Execution Count:5106 | 5106 |
1796 | | - |
1797 | default: | - |
1798 | break; executed: break; Execution Count:26560 | 26560 |
1799 | } | - |
1800 | } executed: } Execution Count:40404 | 40404 |
1801 | if (!used && time) { evaluated: !used yes Evaluation Count:35061 | yes Evaluation Count:13844 |
evaluated: time yes Evaluation Count:31598 | yes Evaluation Count:3463 |
| 3463-35061 |
1802 | switch (c.unicode()) { | - |
1803 | case 'h': { | - |
1804 | used = true; | - |
1805 | repeat = qMin(repeat, 2); | - |
1806 | const int hour = format_am_pm ? hour12 : time->hour(); evaluated: format_am_pm yes Evaluation Count:2436 | yes Evaluation Count:1667 |
| 1667-2436 |
1807 | | - |
1808 | switch (repeat) { | - |
1809 | case 1: | - |
1810 | result.append(longLongToString(hour)); | - |
1811 | break; executed: break; Execution Count:1792 | 1792 |
1812 | case 2: | - |
1813 | result.append(longLongToString(hour, -1, 10, 2, QLocalePrivate::ZeroPadded)); | - |
1814 | break; executed: break; Execution Count:2311 | 2311 |
1815 | } | - |
1816 | break; executed: break; Execution Count:4103 | 4103 |
1817 | } | - |
1818 | case 'H': | - |
1819 | used = true; | - |
1820 | repeat = qMin(repeat, 2); | - |
1821 | switch (repeat) { | - |
1822 | case 1: | - |
1823 | result.append(longLongToString(time->hour())); | - |
1824 | break; executed: break; Execution Count:11 | 11 |
1825 | case 2: | - |
1826 | result.append(longLongToString(time->hour(), -1, 10, 2, QLocalePrivate::ZeroPadded)); | - |
1827 | break; executed: break; Execution Count:180 | 180 |
1828 | } | - |
1829 | break; executed: break; Execution Count:191 | 191 |
1830 | | - |
1831 | case 'm': | - |
1832 | used = true; | - |
1833 | repeat = qMin(repeat, 2); | - |
1834 | switch (repeat) { | - |
1835 | case 1: | - |
1836 | result.append(longLongToString(time->minute())); | - |
1837 | break; executed: break; Execution Count:105 | 105 |
1838 | case 2: | - |
1839 | result.append(longLongToString(time->minute(), -1, 10, 2, QLocalePrivate::ZeroPadded)); | - |
1840 | break; executed: break; Execution Count:3990 | 3990 |
1841 | } | - |
1842 | break; executed: break; Execution Count:4095 | 4095 |
1843 | | - |
1844 | case 's': | - |
1845 | used = true; | - |
1846 | repeat = qMin(repeat, 2); | - |
1847 | switch (repeat) { | - |
1848 | case 1: | - |
1849 | result.append(longLongToString(time->second())); | - |
1850 | break; executed: break; Execution Count:102 | 102 |
1851 | case 2: | - |
1852 | result.append(longLongToString(time->second(), -1, 10, 2, QLocalePrivate::ZeroPadded)); | - |
1853 | break; executed: break; Execution Count:2259 | 2259 |
1854 | } | - |
1855 | break; executed: break; Execution Count:2361 | 2361 |
1856 | | - |
1857 | case 'a': | - |
1858 | used = true; | - |
1859 | if (i + 1 < format.length() && format.at(i + 1).unicode() == 'p') { evaluated: i + 1 < format.length() yes Evaluation Count:731 | yes Evaluation Count:41 |
evaluated: format.at(i + 1).unicode() == 'p' yes Evaluation Count:729 | yes Evaluation Count:2 |
| 2-731 |
1860 | repeat = 2; | - |
1861 | } else { executed: } Execution Count:729 | 729 |
1862 | repeat = 1; | - |
1863 | } executed: } Execution Count:43 | 43 |
1864 | result.append(am_pm == AM ? q->amText().toLower() : q->pmText().toLower()); | - |
1865 | break; executed: break; Execution Count:772 | 772 |
1866 | | - |
1867 | case 'A': | - |
1868 | used = true; | - |
1869 | if (i + 1 < format.length() && format.at(i + 1).unicode() == 'P') { partially evaluated: i + 1 < format.length() yes Evaluation Count:1720 | no Evaluation Count:0 |
partially evaluated: format.at(i + 1).unicode() == 'P' yes Evaluation Count:1720 | no Evaluation Count:0 |
| 0-1720 |
1870 | repeat = 2; | - |
1871 | } else { executed: } Execution Count:1720 | 1720 |
1872 | repeat = 1; | - |
1873 | } | 0 |
1874 | result.append(am_pm == AM ? q->amText().toUpper() : q->pmText().toUpper()); | - |
1875 | break; executed: break; Execution Count:1720 | 1720 |
1876 | | - |
1877 | case 'z': | - |
1878 | used = true; | - |
1879 | if (repeat >= 3) { evaluated: repeat >= 3 yes Evaluation Count:176 | yes Evaluation Count:82 |
| 82-176 |
1880 | repeat = 3; | - |
1881 | } else { executed: } Execution Count:176 | 176 |
1882 | repeat = 1; | - |
1883 | } executed: } Execution Count:82 | 82 |
1884 | switch (repeat) { | - |
1885 | case 1: | - |
1886 | result.append(longLongToString(time->msec())); | - |
1887 | break; executed: break; Execution Count:82 | 82 |
1888 | case 3: | - |
1889 | result.append(longLongToString(time->msec(), -1, 10, 3, QLocalePrivate::ZeroPadded)); | - |
1890 | break; executed: break; Execution Count:176 | 176 |
1891 | } | - |
1892 | break; executed: break; Execution Count:258 | 258 |
1893 | | - |
1894 | case 't': | - |
1895 | used = true; | - |
1896 | repeat = 1; | - |
1897 | result.append(timeZone()); | - |
1898 | break; executed: break; Execution Count:2 | 2 |
1899 | default: | - |
1900 | break; executed: break; Execution Count:18096 | 18096 |
1901 | } | - |
1902 | } executed: } Execution Count:31598 | 31598 |
1903 | if (!used) { evaluated: !used yes Evaluation Count:21559 | yes Evaluation Count:27346 |
| 21559-27346 |
1904 | result.append(QString(repeat, c)); | - |
1905 | } executed: } Execution Count:21559 | 21559 |
1906 | i += repeat; | - |
1907 | } executed: } Execution Count:48905 | 48905 |
1908 | | - |
1909 | return result; executed: return result; Execution Count:7561 | 7561 |
1910 | } | - |
1911 | | - |
1912 | QString QLocalePrivate::doubleToString(double d, | - |
1913 | int precision, | - |
1914 | DoubleForm form, | - |
1915 | int width, | - |
1916 | unsigned flags) const | - |
1917 | { | - |
1918 | return QLocalePrivate::doubleToString(zero(), plus(), minus(), exponential(), | 1506060 |
1919 | group(), decimal(), | 1506060 |
1920 | d, precision, form, width, flags); executed: return QLocalePrivate::doubleToString(zero(), plus(), minus(), exponential(), group(), decimal(), d, precision, form, width, flags); Execution Count:1506060 | 1506060 |
1921 | } | - |
1922 | | - |
1923 | QString QLocalePrivate::doubleToString(const QChar _zero, const QChar plus, const QChar minus, | - |
1924 | const QChar exponential, const QChar group, const QChar decimal, | - |
1925 | double d, | - |
1926 | int precision, | - |
1927 | DoubleForm form, | - |
1928 | int width, | - |
1929 | unsigned flags) | - |
1930 | { | - |
1931 | if (precision == -1) evaluated: precision == -1 yes Evaluation Count:1044733 | yes Evaluation Count:461327 |
| 461327-1044733 |
1932 | precision = 6; executed: precision = 6; Execution Count:1044733 | 1044733 |
1933 | if (width == -1) evaluated: width == -1 yes Evaluation Count:455725 | yes Evaluation Count:1050335 |
| 455725-1050335 |
1934 | width = 0; executed: width = 0; Execution Count:455725 | 455725 |
1935 | | - |
1936 | bool negative = false; | - |
1937 | bool special_number = false; | - |
1938 | QString num_str; | - |
1939 | | - |
1940 | | - |
1941 | if (qt_is_inf(d)) { evaluated: qt_is_inf(d) yes Evaluation Count:522 | yes Evaluation Count:1505538 |
| 522-1505538 |
1942 | num_str = QString::fromLatin1("inf"); | - |
1943 | special_number = true; | - |
1944 | negative = d < 0; | - |
1945 | } else if (qt_is_nan(d)) { executed: } Execution Count:522 evaluated: qt_is_nan(d) yes Evaluation Count:260 | yes Evaluation Count:1505278 |
| 260-1505278 |
1946 | num_str = QString::fromLatin1("nan"); | - |
1947 | special_number = true; | - |
1948 | } executed: } Execution Count:260 | 260 |
1949 | | - |
1950 | | - |
1951 | if (!special_number) { evaluated: !special_number yes Evaluation Count:1505278 | yes Evaluation Count:782 |
| 782-1505278 |
1952 | int decpt, sign; | - |
1953 | QString digits; | - |
1954 | int mode; | - |
1955 | if (form == DFDecimal) evaluated: form == DFDecimal yes Evaluation Count:1629 | yes Evaluation Count:1503649 |
| 1629-1503649 |
1956 | mode = 3; executed: mode = 3; Execution Count:1629 | 1629 |
1957 | else | - |
1958 | mode = 2; executed: mode = 2; Execution Count:1503649 | 1503649 |
1959 | | - |
1960 | | - |
1961 | | - |
1962 | | - |
1963 | | - |
1964 | | - |
1965 | | - |
1966 | int pr = precision; | - |
1967 | if (form == DFExponent) evaluated: form == DFExponent yes Evaluation Count:11 | yes Evaluation Count:1505267 |
| 11-1505267 |
1968 | ++pr; executed: ++pr; Execution Count:11 | 11 |
1969 | | - |
1970 | char *rve = 0; | - |
1971 | char *buff = 0; | - |
1972 | try { | - |
1973 | digits = QLatin1String(qdtoa(d, mode, pr, &decpt, &sign, &rve, &buff)); | - |
1974 | } catch (...) { executed: } Execution Count:1505278 | 1505278 |
1975 | if (buff != 0) never evaluated: buff != 0 | 0 |
1976 | free(buff); never executed: free(buff); | 0 |
1977 | throw; | 0 |
1978 | } | - |
1979 | if (buff != 0) evaluated: buff != 0 yes Evaluation Count:1463101 | yes Evaluation Count:42177 |
| 42177-1463101 |
1980 | free(buff); executed: free(buff); Execution Count:1463101 | 1463101 |
1981 | | - |
1982 | | - |
1983 | if (_zero.unicode() != '0') { partially evaluated: _zero.unicode() != '0' no Evaluation Count:0 | yes Evaluation Count:1505278 |
| 0-1505278 |
1984 | ushort z = _zero.unicode() - '0'; | - |
1985 | for (int i = 0; i < digits.length(); ++i) never evaluated: i < digits.length() | 0 |
1986 | reinterpret_cast<ushort *>(digits.data())[i] += z; never executed: reinterpret_cast<ushort *>(digits.data())[i] += z; | 0 |
1987 | } | 0 |
1988 | | - |
1989 | bool always_show_decpt = (flags & Alternate || flags & ForcePoint); evaluated: flags & Alternate yes Evaluation Count:4614 | yes Evaluation Count:1500664 |
partially evaluated: flags & ForcePoint no Evaluation Count:0 | yes Evaluation Count:1500664 |
| 0-1500664 |
1990 | switch (form) { | - |
1991 | case DFExponent: { | - |
1992 | num_str = exponentForm(_zero, decimal, exponential, group, plus, minus, | - |
1993 | digits, decpt, precision, PMDecimalDigits, | - |
1994 | always_show_decpt); | - |
1995 | break; executed: break; Execution Count:11 | 11 |
1996 | } | - |
1997 | case DFDecimal: { | - |
1998 | num_str = decimalForm(_zero, decimal, group, | - |
1999 | digits, decpt, precision, PMDecimalDigits, | - |
2000 | always_show_decpt, flags & ThousandsGroup); | - |
2001 | break; executed: break; Execution Count:1629 | 1629 |
2002 | } | - |
2003 | case DFSignificantDigits: { | - |
2004 | PrecisionMode mode = (flags & Alternate) ? evaluated: (flags & Alternate) yes Evaluation Count:4610 | yes Evaluation Count:1499028 |
| 4610-1499028 |
2005 | PMSignificantDigits : PMChopTrailingZeros; | - |
2006 | | - |
2007 | if (decpt != digits.length() && (decpt <= -4 || decpt > precision)) evaluated: decpt <= -4 yes Evaluation Count:5205 | yes Evaluation Count:492803 |
evaluated: decpt > precision yes Evaluation Count:63054 | yes Evaluation Count:429749 |
evaluated: decpt != digits.length() yes Evaluation Count:498008 | yes Evaluation Count:1005630 |
| 5205-1005630 |
2008 | num_str = exponentForm(_zero, decimal, exponential, group, plus, minus, | 68259 |
2009 | digits, decpt, precision, mode, | 68259 |
2010 | always_show_decpt); executed: num_str = exponentForm(_zero, decimal, exponential, group, plus, minus, digits, decpt, precision, mode, always_show_decpt); Execution Count:68259 | 68259 |
2011 | else | - |
2012 | num_str = decimalForm(_zero, decimal, group, | 1435379 |
2013 | digits, decpt, precision, mode, | 1435379 |
2014 | always_show_decpt, flags & ThousandsGroup); executed: num_str = decimalForm(_zero, decimal, group, digits, decpt, precision, mode, always_show_decpt, flags & ThousandsGroup); Execution Count:1435379 | 1435379 |
2015 | break; executed: break; Execution Count:1503638 | 1503638 |
2016 | } | - |
2017 | } | - |
2018 | | - |
2019 | negative = sign != 0 && !isZero(d); evaluated: sign != 0 yes Evaluation Count:474215 | yes Evaluation Count:1031063 |
evaluated: !isZero(d) yes Evaluation Count:474207 | yes Evaluation Count:8 |
| 8-1031063 |
2020 | } executed: } Execution Count:1505278 | 1505278 |
2021 | | - |
2022 | | - |
2023 | | - |
2024 | if (flags & QLocalePrivate::ZeroPadded evaluated: flags & QLocalePrivate::ZeroPadded yes Evaluation Count:4994 | yes Evaluation Count:1501066 |
| 4994-1501066 |
2025 | && !(flags & QLocalePrivate::LeftAdjusted) evaluated: !(flags & QLocalePrivate::LeftAdjusted) yes Evaluation Count:2498 | yes Evaluation Count:2496 |
| 2496-2498 |
2026 | && !special_number) { evaluated: !special_number yes Evaluation Count:2306 | yes Evaluation Count:192 |
| 192-2306 |
2027 | int num_pad_chars = width - num_str.length(); | - |
2028 | | - |
2029 | if (negative evaluated: negative yes Evaluation Count:66 | yes Evaluation Count:2240 |
| 66-2240 |
2030 | || flags & QLocalePrivate::AlwaysShowSign evaluated: flags & QLocalePrivate::AlwaysShowSign yes Evaluation Count:1120 | yes Evaluation Count:1120 |
| 1120 |
2031 | || flags & QLocalePrivate::BlankBeforePositive) evaluated: flags & QLocalePrivate::BlankBeforePositive yes Evaluation Count:560 | yes Evaluation Count:560 |
| 560 |
2032 | --num_pad_chars; executed: --num_pad_chars; Execution Count:1746 | 1746 |
2033 | | - |
2034 | for (int i = 0; i < num_pad_chars; ++i) evaluated: i < num_pad_chars yes Evaluation Count:23649 | yes Evaluation Count:2306 |
| 2306-23649 |
2035 | num_str.prepend(_zero); executed: num_str.prepend(_zero); Execution Count:23649 | 23649 |
2036 | } executed: } Execution Count:2306 | 2306 |
2037 | | - |
2038 | | - |
2039 | if (negative) evaluated: negative yes Evaluation Count:474468 | yes Evaluation Count:1031592 |
| 474468-1031592 |
2040 | num_str.prepend(minus); executed: num_str.prepend(minus); Execution Count:474468 | 474468 |
2041 | else if (flags & QLocalePrivate::AlwaysShowSign) evaluated: flags & QLocalePrivate::AlwaysShowSign yes Evaluation Count:4738 | yes Evaluation Count:1026854 |
| 4738-1026854 |
2042 | num_str.prepend(plus); executed: num_str.prepend(plus); Execution Count:4738 | 4738 |
2043 | else if (flags & QLocalePrivate::BlankBeforePositive) evaluated: flags & QLocalePrivate::BlankBeforePositive yes Evaluation Count:2368 | yes Evaluation Count:1024486 |
| 2368-1024486 |
2044 | num_str.prepend(QLatin1Char(' ')); executed: num_str.prepend(QLatin1Char(' ')); Execution Count:2368 | 2368 |
2045 | | - |
2046 | if (flags & QLocalePrivate::CapitalEorX) evaluated: flags & QLocalePrivate::CapitalEorX yes Evaluation Count:4999 | yes Evaluation Count:1501061 |
| 4999-1501061 |
2047 | num_str = num_str.toUpper(); executed: num_str = num_str.toUpper(); Execution Count:4999 | 4999 |
2048 | | - |
2049 | return num_str; executed: return num_str; Execution Count:1506060 | 1506060 |
2050 | } | - |
2051 | | - |
2052 | QString QLocalePrivate::longLongToString(qlonglong l, int precision, | - |
2053 | int base, int width, | - |
2054 | unsigned flags) const | - |
2055 | { | - |
2056 | return QLocalePrivate::longLongToString(zero(), group(), plus(), minus(), | 12184074 |
2057 | l, precision, base, width, flags); executed: return QLocalePrivate::longLongToString(zero(), group(), plus(), minus(), l, precision, base, width, flags); Execution Count:12184074 | 12184074 |
2058 | } | - |
2059 | | - |
2060 | QString QLocalePrivate::longLongToString(const QChar zero, const QChar group, | - |
2061 | const QChar plus, const QChar minus, | - |
2062 | qlonglong l, int precision, | - |
2063 | int base, int width, | - |
2064 | unsigned flags) | - |
2065 | { | - |
2066 | bool precision_not_specified = false; | - |
2067 | if (precision == -1) { evaluated: precision == -1 yes Evaluation Count:12182872 | yes Evaluation Count:69470 |
| 69470-12182872 |
2068 | precision_not_specified = true; | - |
2069 | precision = 1; | - |
2070 | } executed: } Execution Count:12182872 | 12182872 |
2071 | | - |
2072 | bool negative = l < 0; | - |
2073 | if (base != 10) { evaluated: base != 10 yes Evaluation Count:2519 | yes Evaluation Count:12249822 |
| 2519-12249822 |
2074 | | - |
2075 | flags &= ~AlwaysShowSign; | - |
2076 | flags &= ~BlankBeforePositive; | - |
2077 | negative = false; | - |
2078 | } executed: } Execution Count:2519 | 2519 |
2079 | | - |
2080 | QString num_str; | - |
2081 | if (base == 10) evaluated: base == 10 yes Evaluation Count:12249824 | yes Evaluation Count:2519 |
| 2519-12249824 |
2082 | num_str = qlltoa(l, base, zero); executed: num_str = qlltoa(l, base, zero); Execution Count:12249823 | 12249823 |
2083 | else | - |
2084 | num_str = qulltoa(l, base, zero); executed: num_str = qulltoa(l, base, zero); Execution Count:2519 | 2519 |
2085 | | - |
2086 | uint cnt_thousand_sep = 0; | - |
2087 | if (flags & ThousandsGroup && base == 10) { evaluated: flags & ThousandsGroup yes Evaluation Count:1877 | yes Evaluation Count:12250466 |
partially evaluated: base == 10 yes Evaluation Count:1877 | no Evaluation Count:0 |
| 0-12250466 |
2088 | for (int i = num_str.length() - 3; i > 0; i -= 3) { evaluated: i > 0 yes Evaluation Count:743 | yes Evaluation Count:1877 |
| 743-1877 |
2089 | num_str.insert(i, group); | - |
2090 | ++cnt_thousand_sep; | - |
2091 | } executed: } Execution Count:743 | 743 |
2092 | } executed: } Execution Count:1877 | 1877 |
2093 | | - |
2094 | for (int i = num_str.length() ; i < precision; ++i) evaluated: i < precision yes Evaluation Count:488427 | yes Evaluation Count:12252345 |
| 488427-12252345 |
2095 | num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); Execution Count:488427 | 488427 |
2096 | | - |
2097 | if ((flags & Alternate || flags & ShowBase) partially evaluated: flags & Alternate no Evaluation Count:0 | yes Evaluation Count:12252344 |
partially evaluated: flags & ShowBase no Evaluation Count:0 | yes Evaluation Count:12252345 |
| 0-12252345 |
2098 | && base == 8 never evaluated: base == 8 | 0 |
2099 | && (num_str.isEmpty() || num_str[0].unicode() != QLatin1Char('0'))) never evaluated: num_str.isEmpty() never evaluated: num_str[0].unicode() != QLatin1Char('0') | 0 |
2100 | num_str.prepend(QLatin1Char('0')); never executed: num_str.prepend(QLatin1Char('0')); | 0 |
2101 | | - |
2102 | | - |
2103 | | - |
2104 | bool zero_padded = flags & ZeroPadded evaluated: flags & ZeroPadded yes Evaluation Count:17107 | yes Evaluation Count:12235236 |
| 17107-12235236 |
2105 | && !(flags & LeftAdjusted) partially evaluated: !(flags & LeftAdjusted) yes Evaluation Count:17107 | no Evaluation Count:0 |
| 0-17107 |
2106 | && precision_not_specified; partially evaluated: precision_not_specified yes Evaluation Count:17107 | no Evaluation Count:0 |
| 0-17107 |
2107 | | - |
2108 | if (zero_padded) { evaluated: zero_padded yes Evaluation Count:17107 | yes Evaluation Count:12235238 |
| 17107-12235238 |
2109 | int num_pad_chars = width - num_str.length(); | - |
2110 | | - |
2111 | | - |
2112 | if (negative evaluated: negative yes Evaluation Count:18 | yes Evaluation Count:17089 |
| 18-17089 |
2113 | || flags & AlwaysShowSign partially evaluated: flags & AlwaysShowSign no Evaluation Count:0 | yes Evaluation Count:17089 |
| 0-17089 |
2114 | || flags & BlankBeforePositive) partially evaluated: flags & BlankBeforePositive no Evaluation Count:0 | yes Evaluation Count:17089 |
| 0-17089 |
2115 | --num_pad_chars; executed: --num_pad_chars; Execution Count:18 | 18 |
2116 | | - |
2117 | | - |
2118 | if (base == 16 && (flags & Alternate || flags & ShowBase)) partially evaluated: base == 16 no Evaluation Count:0 | yes Evaluation Count:17107 |
never evaluated: flags & Alternate never evaluated: flags & ShowBase | 0-17107 |
2119 | num_pad_chars -= 2; never executed: num_pad_chars -= 2; | 0 |
2120 | | - |
2121 | else if (base == 2 && (flags & Alternate || flags & ShowBase)) partially evaluated: base == 2 no Evaluation Count:0 | yes Evaluation Count:17107 |
never evaluated: flags & Alternate never evaluated: flags & ShowBase | 0-17107 |
2122 | num_pad_chars -= 2; never executed: num_pad_chars -= 2; | 0 |
2123 | | - |
2124 | for (int i = 0; i < num_pad_chars; ++i) evaluated: i < num_pad_chars yes Evaluation Count:8227 | yes Evaluation Count:17107 |
| 8227-17107 |
2125 | num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); Execution Count:8227 | 8227 |
2126 | } executed: } Execution Count:17107 | 17107 |
2127 | | - |
2128 | if (flags & CapitalEorX) partially evaluated: flags & CapitalEorX no Evaluation Count:0 | yes Evaluation Count:12252345 |
| 0-12252345 |
2129 | num_str = num_str.toUpper(); never executed: num_str = num_str.toUpper(); | 0 |
2130 | | - |
2131 | if (base == 16 && (flags & Alternate || flags & ShowBase)) evaluated: base == 16 yes Evaluation Count:2365 | yes Evaluation Count:12249979 |
partially evaluated: flags & Alternate no Evaluation Count:0 | yes Evaluation Count:2365 |
partially evaluated: flags & ShowBase no Evaluation Count:0 | yes Evaluation Count:2365 |
| 0-12249979 |
2132 | num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); never executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); | 0 |
2133 | if (base == 2 && (flags & Alternate || flags & ShowBase)) partially evaluated: base == 2 no Evaluation Count:0 | yes Evaluation Count:12252344 |
never evaluated: flags & Alternate never evaluated: flags & ShowBase | 0-12252344 |
2134 | num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b")); never executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b")); | 0 |
2135 | | - |
2136 | | - |
2137 | if (negative) evaluated: negative yes Evaluation Count:40418 | yes Evaluation Count:12211926 |
| 40418-12211926 |
2138 | num_str.prepend(minus); executed: num_str.prepend(minus); Execution Count:40418 | 40418 |
2139 | else if (flags & AlwaysShowSign) evaluated: flags & AlwaysShowSign yes Evaluation Count:63065 | yes Evaluation Count:12148861 |
| 63065-12148861 |
2140 | num_str.prepend(plus); executed: num_str.prepend(plus); Execution Count:63065 | 63065 |
2141 | else if (flags & BlankBeforePositive) partially evaluated: flags & BlankBeforePositive no Evaluation Count:0 | yes Evaluation Count:12148860 |
| 0-12148860 |
2142 | num_str.prepend(QLatin1Char(' ')); never executed: num_str.prepend(QLatin1Char(' ')); | 0 |
2143 | | - |
2144 | return num_str; executed: return num_str; Execution Count:12252343 | 12252343 |
2145 | } | - |
2146 | | - |
2147 | QString QLocalePrivate::unsLongLongToString(qulonglong l, int precision, | - |
2148 | int base, int width, | - |
2149 | unsigned flags) const | - |
2150 | { | - |
2151 | return QLocalePrivate::unsLongLongToString(zero(), group(), plus(), | 38019 |
2152 | l, precision, base, width, flags); executed: return QLocalePrivate::unsLongLongToString(zero(), group(), plus(), l, precision, base, width, flags); Execution Count:38019 | 38019 |
2153 | } | - |
2154 | | - |
2155 | QString QLocalePrivate::unsLongLongToString(const QChar zero, const QChar group, | - |
2156 | const QChar plus, | - |
2157 | qulonglong l, int precision, | - |
2158 | int base, int width, | - |
2159 | unsigned flags) | - |
2160 | { | - |
2161 | bool precision_not_specified = false; | - |
2162 | if (precision == -1) { partially evaluated: precision == -1 yes Evaluation Count:38018 | no Evaluation Count:0 |
| 0-38018 |
2163 | precision_not_specified = true; | - |
2164 | precision = 1; | - |
2165 | } executed: } Execution Count:38018 | 38018 |
2166 | | - |
2167 | QString num_str = qulltoa(l, base, zero); | - |
2168 | | - |
2169 | uint cnt_thousand_sep = 0; | - |
2170 | if (flags & ThousandsGroup && base == 10) { evaluated: flags & ThousandsGroup yes Evaluation Count:454 | yes Evaluation Count:37563 |
partially evaluated: base == 10 yes Evaluation Count:454 | no Evaluation Count:0 |
| 0-37563 |
2171 | for (int i = num_str.length() - 3; i > 0; i -=3) { evaluated: i > 0 yes Evaluation Count:8 | yes Evaluation Count:454 |
| 8-454 |
2172 | num_str.insert(i, group); | - |
2173 | ++cnt_thousand_sep; | - |
2174 | } executed: } Execution Count:8 | 8 |
2175 | } executed: } Execution Count:454 | 454 |
2176 | | - |
2177 | for (int i = num_str.length() ; i < precision; ++i) evaluated: i < precision yes Evaluation Count:13279 | yes Evaluation Count:38017 |
| 13279-38017 |
2178 | num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); Execution Count:13279 | 13279 |
2179 | | - |
2180 | if ((flags & Alternate || flags & ShowBase) evaluated: flags & Alternate yes Evaluation Count:35 | yes Evaluation Count:37982 |
evaluated: flags & ShowBase yes Evaluation Count:94 | yes Evaluation Count:37888 |
| 35-37982 |
2181 | && base == 8 evaluated: base == 8 yes Evaluation Count:2 | yes Evaluation Count:127 |
| 2-127 |
2182 | && (num_str.isEmpty() || num_str[0].unicode() != QLatin1Char('0'))) partially evaluated: num_str.isEmpty() no Evaluation Count:0 | yes Evaluation Count:2 |
evaluated: num_str[0].unicode() != QLatin1Char('0') yes Evaluation Count:1 | yes Evaluation Count:1 |
| 0-2 |
2183 | num_str.prepend(QLatin1Char('0')); executed: num_str.prepend(QLatin1Char('0')); Execution Count:1 | 1 |
2184 | | - |
2185 | | - |
2186 | | - |
2187 | bool zero_padded = flags & ZeroPadded evaluated: flags & ZeroPadded yes Evaluation Count:2040 | yes Evaluation Count:35977 |
| 2040-35977 |
2188 | && !(flags & LeftAdjusted) partially evaluated: !(flags & LeftAdjusted) yes Evaluation Count:2040 | no Evaluation Count:0 |
| 0-2040 |
2189 | && precision_not_specified; partially evaluated: precision_not_specified yes Evaluation Count:2040 | no Evaluation Count:0 |
| 0-2040 |
2190 | | - |
2191 | if (zero_padded) { evaluated: zero_padded yes Evaluation Count:2040 | yes Evaluation Count:35976 |
| 2040-35976 |
2192 | int num_pad_chars = width - num_str.length(); | - |
2193 | | - |
2194 | | - |
2195 | if (base == 16 && flags & Alternate) partially evaluated: base == 16 yes Evaluation Count:2040 | no Evaluation Count:0 |
partially evaluated: flags & Alternate no Evaluation Count:0 | yes Evaluation Count:2040 |
| 0-2040 |
2196 | num_pad_chars -= 2; never executed: num_pad_chars -= 2; | 0 |
2197 | | - |
2198 | else if (base == 2 && flags & Alternate) partially evaluated: base == 2 no Evaluation Count:0 | yes Evaluation Count:2040 |
never evaluated: flags & Alternate | 0-2040 |
2199 | num_pad_chars -= 2; never executed: num_pad_chars -= 2; | 0 |
2200 | | - |
2201 | for (int i = 0; i < num_pad_chars; ++i) evaluated: i < num_pad_chars yes Evaluation Count:604 | yes Evaluation Count:2040 |
| 604-2040 |
2202 | num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); Execution Count:604 | 604 |
2203 | } executed: } Execution Count:2040 | 2040 |
2204 | | - |
2205 | if (flags & CapitalEorX) evaluated: flags & CapitalEorX yes Evaluation Count:9 | yes Evaluation Count:38007 |
| 9-38007 |
2206 | num_str = num_str.toUpper(); executed: num_str = num_str.toUpper(); Execution Count:9 | 9 |
2207 | | - |
2208 | if (base == 16 && (flags & Alternate || flags & ShowBase)) evaluated: base == 16 yes Evaluation Count:15293 | yes Evaluation Count:22723 |
evaluated: flags & Alternate yes Evaluation Count:35 | yes Evaluation Count:15258 |
evaluated: flags & ShowBase yes Evaluation Count:77 | yes Evaluation Count:15181 |
| 35-22723 |
2209 | num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); Execution Count:112 | 112 |
2210 | else if (base == 2 && (flags & Alternate || flags & ShowBase)) evaluated: base == 2 yes Evaluation Count:15 | yes Evaluation Count:37889 |
partially evaluated: flags & Alternate no Evaluation Count:0 | yes Evaluation Count:15 |
evaluated: flags & ShowBase yes Evaluation Count:14 | yes Evaluation Count:1 |
| 0-37889 |
2211 | num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b")); executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b")); Execution Count:14 | 14 |
2212 | | - |
2213 | | - |
2214 | if (flags & AlwaysShowSign) evaluated: flags & AlwaysShowSign yes Evaluation Count:3 | yes Evaluation Count:38013 |
| 3-38013 |
2215 | num_str.prepend(plus); executed: num_str.prepend(plus); Execution Count:3 | 3 |
2216 | else if (flags & BlankBeforePositive) partially evaluated: flags & BlankBeforePositive no Evaluation Count:0 | yes Evaluation Count:38011 |
| 0-38011 |
2217 | num_str.prepend(QLatin1Char(' ')); never executed: num_str.prepend(QLatin1Char(' ')); | 0 |
2218 | | - |
2219 | return num_str; executed: return num_str; Execution Count:38014 | 38014 |
2220 | } | - |
2221 | bool QLocalePrivate::numberToCLocale(const QString &num, | - |
2222 | GroupSeparatorMode group_sep_mode, | - |
2223 | CharBuff *result) const | - |
2224 | { | - |
2225 | const QChar *uc = num.unicode(); | - |
2226 | int l = num.length(); | - |
2227 | int idx = 0; | - |
2228 | | - |
2229 | | - |
2230 | while (idx < l && uc[idx].isSpace()) evaluated: idx < l yes Evaluation Count:103045 | yes Evaluation Count:11432 |
evaluated: uc[idx].isSpace() yes Evaluation Count:151 | yes Evaluation Count:102894 |
| 151-103045 |
2231 | ++idx; executed: ++idx; Execution Count:151 | 151 |
2232 | if (idx == l) evaluated: idx == l yes Evaluation Count:11432 | yes Evaluation Count:102894 |
| 11432-102894 |
2233 | return false; executed: return false; Execution Count:11432 | 11432 |
2234 | | - |
2235 | while (idx < l) { evaluated: idx < l yes Evaluation Count:263388 | yes Evaluation Count:102201 |
| 102201-263388 |
2236 | const QChar in = uc[idx]; | - |
2237 | | - |
2238 | char out = digitToCLocale(in); | - |
2239 | if (out == 0) { evaluated: out == 0 yes Evaluation Count:111212 | yes Evaluation Count:152176 |
| 111212-152176 |
2240 | if (in == list()) partially evaluated: in == list() no Evaluation Count:0 | yes Evaluation Count:111212 |
| 0-111212 |
2241 | out = ';'; never executed: out = ';'; | 0 |
2242 | else if (in == percent()) evaluated: in == percent() yes Evaluation Count:4 | yes Evaluation Count:111208 |
| 4-111208 |
2243 | out = '%'; executed: out = '%'; Execution Count:4 | 4 |
2244 | | - |
2245 | else if (in.unicode() >= 'A' && in.unicode() <= 'Z') evaluated: in.unicode() >= 'A' yes Evaluation Count:110530 | yes Evaluation Count:678 |
evaluated: in.unicode() <= 'Z' yes Evaluation Count:97711 | yes Evaluation Count:12819 |
| 678-110530 |
2246 | out = in.toLower().toLatin1(); executed: out = in.toLower().toLatin1(); Execution Count:97711 | 97711 |
2247 | else if (in.unicode() >= 'a' && in.unicode() <= 'z') evaluated: in.unicode() >= 'a' yes Evaluation Count:12809 | yes Evaluation Count:688 |
evaluated: in.unicode() <= 'z' yes Evaluation Count:12804 | yes Evaluation Count:5 |
| 5-12809 |
2248 | out = in.toLatin1(); executed: out = in.toLatin1(); Execution Count:12804 | 12804 |
2249 | else | - |
2250 | break; executed: break; Execution Count:693 | 693 |
2251 | } | - |
2252 | | - |
2253 | result->append(out); | - |
2254 | | - |
2255 | ++idx; | - |
2256 | } executed: } Execution Count:262695 | 262695 |
2257 | | - |
2258 | | - |
2259 | for (; idx < l; ++idx) { evaluated: idx < l yes Evaluation Count:773 | yes Evaluation Count:102261 |
| 773-102261 |
2260 | if (!uc[idx].isSpace()) evaluated: !uc[idx].isSpace() yes Evaluation Count:633 | yes Evaluation Count:140 |
| 140-633 |
2261 | return false; executed: return false; Execution Count:633 | 633 |
2262 | } executed: } Execution Count:140 | 140 |
2263 | | - |
2264 | result->append('\0'); | - |
2265 | | - |
2266 | | - |
2267 | if (group_sep_mode == ParseGroupSeparators evaluated: group_sep_mode == ParseGroupSeparators yes Evaluation Count:13445 | yes Evaluation Count:88816 |
| 13445-88816 |
2268 | && !removeGroupSeparators(result)) evaluated: !removeGroupSeparators(result) yes Evaluation Count:72 | yes Evaluation Count:13373 |
| 72-13373 |
2269 | return false; executed: return false; Execution Count:72 | 72 |
2270 | | - |
2271 | | - |
2272 | return true; executed: return true; Execution Count:102189 | 102189 |
2273 | } | - |
2274 | | - |
2275 | bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByteArray *buff, | - |
2276 | int decDigits) const | - |
2277 | { | - |
2278 | buff->clear(); | - |
2279 | buff->reserve(str.length()); | - |
2280 | | - |
2281 | const bool scientific = numMode == DoubleScientificMode; | - |
2282 | bool lastWasE = false; | - |
2283 | bool lastWasDigit = false; | - |
2284 | int eCnt = 0; | - |
2285 | int decPointCnt = 0; | - |
2286 | bool dec = false; | - |
2287 | int decDigitCnt = 0; | - |
2288 | | - |
2289 | for (int i = 0; i < str.length(); ++i) { evaluated: i < str.length() yes Evaluation Count:1596 | yes Evaluation Count:382 |
| 382-1596 |
2290 | char c = digitToCLocale(str.at(i)); | - |
2291 | | - |
2292 | if (c >= '0' && c <= '9') { evaluated: c >= '0' yes Evaluation Count:1304 | yes Evaluation Count:292 |
evaluated: c <= '9' yes Evaluation Count:1200 | yes Evaluation Count:104 |
| 104-1304 |
2293 | if (numMode != IntegerMode) { evaluated: numMode != IntegerMode yes Evaluation Count:695 | yes Evaluation Count:505 |
| 505-695 |
2294 | | - |
2295 | if (dec && decDigits != -1 && decDigits < ++decDigitCnt) evaluated: dec yes Evaluation Count:100 | yes Evaluation Count:595 |
partially evaluated: decDigits != -1 yes Evaluation Count:100 | no Evaluation Count:0 |
evaluated: decDigits < ++decDigitCnt yes Evaluation Count:12 | yes Evaluation Count:88 |
| 0-595 |
2296 | return false; executed: return false; Execution Count:12 | 12 |
2297 | } executed: } Execution Count:683 | 683 |
2298 | lastWasDigit = true; | - |
2299 | } else { executed: } Execution Count:1188 | 1188 |
2300 | switch (c) { | - |
2301 | case '.': | - |
2302 | if (numMode == IntegerMode) { evaluated: numMode == IntegerMode yes Evaluation Count:6 | yes Evaluation Count:62 |
| 6-62 |
2303 | | - |
2304 | return false; executed: return false; Execution Count:6 | 6 |
2305 | } else { | - |
2306 | | - |
2307 | if (++decPointCnt > 1) partially evaluated: ++decPointCnt > 1 no Evaluation Count:0 | yes Evaluation Count:62 |
| 0-62 |
2308 | return false; never executed: return false; | 0 |
2309 | | - |
2310 | | - |
2311 | | - |
2312 | | - |
2313 | | - |
2314 | | - |
2315 | | - |
2316 | dec = true; | - |
2317 | } executed: } Execution Count:62 | 62 |
2318 | break; executed: break; Execution Count:62 | 62 |
2319 | | - |
2320 | case '+': | - |
2321 | case '-': | - |
2322 | if (scientific) { evaluated: scientific yes Evaluation Count:56 | yes Evaluation Count:108 |
| 56-108 |
2323 | | - |
2324 | | - |
2325 | if (i != 0 && !lastWasE) evaluated: i != 0 yes Evaluation Count:42 | yes Evaluation Count:14 |
partially evaluated: !lastWasE no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
2326 | return false; never executed: return false; | 0 |
2327 | } else { executed: } Execution Count:56 | 56 |
2328 | | - |
2329 | | - |
2330 | if (i != 0) evaluated: i != 0 yes Evaluation Count:4 | yes Evaluation Count:104 |
| 4-104 |
2331 | return false; executed: return false; Execution Count:4 | 4 |
2332 | } executed: } Execution Count:104 | 104 |
2333 | break; executed: break; Execution Count:160 | 160 |
2334 | | - |
2335 | case ',': | - |
2336 | | - |
2337 | if (!lastWasDigit || decPointCnt > 0) evaluated: !lastWasDigit yes Evaluation Count:2 | yes Evaluation Count:13 |
partially evaluated: decPointCnt > 0 no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
2338 | return false; executed: return false; Execution Count:2 | 2 |
2339 | break; executed: break; Execution Count:13 | 13 |
2340 | | - |
2341 | case 'e': | - |
2342 | if (scientific) { evaluated: scientific yes Evaluation Count:52 | yes Evaluation Count:52 |
| 52 |
2343 | | - |
2344 | if (++eCnt > 1) partially evaluated: ++eCnt > 1 no Evaluation Count:0 | yes Evaluation Count:52 |
| 0-52 |
2345 | return false; never executed: return false; | 0 |
2346 | dec = false; | - |
2347 | } else { executed: } Execution Count:52 | 52 |
2348 | | - |
2349 | return false; executed: return false; Execution Count:52 | 52 |
2350 | } | - |
2351 | break; executed: break; Execution Count:52 | 52 |
2352 | | - |
2353 | default: | - |
2354 | | - |
2355 | return false; executed: return false; Execution Count:45 | 45 |
2356 | } | - |
2357 | lastWasDigit = false; | - |
2358 | } executed: } Execution Count:287 | 287 |
2359 | | - |
2360 | lastWasE = c == 'e'; | - |
2361 | if (c != ',') evaluated: c != ',' yes Evaluation Count:1462 | yes Evaluation Count:13 |
| 13-1462 |
2362 | buff->append(c); executed: buff->append(c); Execution Count:1462 | 1462 |
2363 | } executed: } Execution Count:1475 | 1475 |
2364 | | - |
2365 | return true; executed: return true; Execution Count:382 | 382 |
2366 | } | - |
2367 | | - |
2368 | double QLocalePrivate::stringToDouble(const QString &number, bool *ok, | - |
2369 | GroupSeparatorMode group_sep_mode) const | - |
2370 | { | - |
2371 | CharBuff buff; | - |
2372 | if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, | 93-3615 |
2373 | group_sep_mode, &buff)) { evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff) yes Evaluation Count:93 | yes Evaluation Count:3615 |
| 93-3615 |
2374 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:93 | no Evaluation Count:0 |
| 0-93 |
2375 | *ok = false; executed: *ok = false; Execution Count:93 | 93 |
2376 | return 0.0; executed: return 0.0; Execution Count:93 | 93 |
2377 | } | - |
2378 | return bytearrayToDouble(buff.constData(), ok); executed: return bytearrayToDouble(buff.constData(), ok); Execution Count:3615 | 3615 |
2379 | } | - |
2380 | | - |
2381 | qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, | - |
2382 | bool *ok, GroupSeparatorMode group_sep_mode) const | - |
2383 | { | - |
2384 | CharBuff buff; | - |
2385 | if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, | 11428-74537 |
2386 | group_sep_mode, &buff)) { evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff) yes Evaluation Count:11428 | yes Evaluation Count:74537 |
| 11428-74537 |
2387 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:11407 | yes Evaluation Count:21 |
| 21-11407 |
2388 | *ok = false; executed: *ok = false; Execution Count:11407 | 11407 |
2389 | return 0; executed: return 0; Execution Count:11428 | 11428 |
2390 | } | - |
2391 | | - |
2392 | return bytearrayToLongLong(buff.constData(), base, ok); executed: return bytearrayToLongLong(buff.constData(), base, ok); Execution Count:74536 | 74536 |
2393 | } | - |
2394 | | - |
2395 | qulonglong QLocalePrivate::stringToUnsLongLong(const QString &number, int base, | - |
2396 | bool *ok, GroupSeparatorMode group_sep_mode) const | - |
2397 | { | - |
2398 | CharBuff buff; | - |
2399 | if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, | 616-24038 |
2400 | group_sep_mode, &buff)) { evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff) yes Evaluation Count:616 | yes Evaluation Count:24038 |
| 616-24038 |
2401 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:612 | yes Evaluation Count:4 |
| 4-612 |
2402 | *ok = false; executed: *ok = false; Execution Count:612 | 612 |
2403 | return 0; executed: return 0; Execution Count:616 | 616 |
2404 | } | - |
2405 | | - |
2406 | return bytearrayToUnsLongLong(buff.constData(), base, ok); executed: return bytearrayToUnsLongLong(buff.constData(), base, ok); Execution Count:24038 | 24038 |
2407 | } | - |
2408 | | - |
2409 | | - |
2410 | double QLocalePrivate::bytearrayToDouble(const char *num, bool *ok, bool *overflow) | - |
2411 | { | - |
2412 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:3177 | yes Evaluation Count:990 |
| 990-3177 |
2413 | *ok = true; executed: *ok = true; Execution Count:3177 | 3177 |
2414 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:157 | yes Evaluation Count:4010 |
| 157-4010 |
2415 | *overflow = false; executed: *overflow = false; Execution Count:157 | 157 |
2416 | | - |
2417 | if (*num == '\0') { partially evaluated: *num == '\0' no Evaluation Count:0 | yes Evaluation Count:4167 |
| 0-4167 |
2418 | if (ok != 0) | 0 |
2419 | *ok = false; never executed: *ok = false; | 0 |
2420 | return 0.0; never executed: return 0.0; | 0 |
2421 | } | - |
2422 | | - |
2423 | if (qstrcmp(num, "nan") == 0) evaluated: qstrcmp(num, "nan") == 0 yes Evaluation Count:7 | yes Evaluation Count:4160 |
| 7-4160 |
2424 | return qt_snan(); executed: return qt_snan(); Execution Count:7 | 7 |
2425 | | - |
2426 | if (qstrcmp(num, "+inf") == 0 || qstrcmp(num, "inf") == 0) evaluated: qstrcmp(num, "+inf") == 0 yes Evaluation Count:3 | yes Evaluation Count:4157 |
evaluated: qstrcmp(num, "inf") == 0 yes Evaluation Count:6 | yes Evaluation Count:4151 |
| 3-4157 |
2427 | return qt_inf(); executed: return qt_inf(); Execution Count:9 | 9 |
2428 | | - |
2429 | if (qstrcmp(num, "-inf") == 0) evaluated: qstrcmp(num, "-inf") == 0 yes Evaluation Count:2 | yes Evaluation Count:4149 |
| 2-4149 |
2430 | return -qt_inf(); executed: return -qt_inf(); Execution Count:2 | 2 |
2431 | | - |
2432 | bool _ok; | - |
2433 | const char *endptr; | - |
2434 | double d = qstrtod(num, &endptr, &_ok); | - |
2435 | | - |
2436 | if (!_ok) { evaluated: !_ok yes Evaluation Count:4 | yes Evaluation Count:4145 |
| 4-4145 |
2437 | | - |
2438 | | - |
2439 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
2440 | *ok = false; executed: *ok = false; Execution Count:4 | 4 |
2441 | if (overflow != 0) partially evaluated: overflow != 0 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2442 | *overflow = *endptr != '\0'; never executed: *overflow = *endptr != '\0'; | 0 |
2443 | return 0.0; executed: return 0.0; Execution Count:4 | 4 |
2444 | } | - |
2445 | | - |
2446 | if (*endptr != '\0') { evaluated: *endptr != '\0' yes Evaluation Count:305 | yes Evaluation Count:3840 |
| 305-3840 |
2447 | | - |
2448 | if (ok != 0) partially evaluated: ok != 0 yes Evaluation Count:305 | no Evaluation Count:0 |
| 0-305 |
2449 | *ok = false; executed: *ok = false; Execution Count:305 | 305 |
2450 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:48 | yes Evaluation Count:257 |
| 48-257 |
2451 | *overflow = false; executed: *overflow = false; Execution Count:48 | 48 |
2452 | return 0.0; executed: return 0.0; Execution Count:305 | 305 |
2453 | } | - |
2454 | | - |
2455 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:2850 | yes Evaluation Count:990 |
| 990-2850 |
2456 | *ok = true; executed: *ok = true; Execution Count:2850 | 2850 |
2457 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:109 | yes Evaluation Count:3731 |
| 109-3731 |
2458 | *overflow = false; executed: *overflow = false; Execution Count:109 | 109 |
2459 | return d; executed: return d; Execution Count:3840 | 3840 |
2460 | } | - |
2461 | | - |
2462 | qlonglong QLocalePrivate::bytearrayToLongLong(const char *num, int base, bool *ok, bool *overflow) | - |
2463 | { | - |
2464 | bool _ok; | - |
2465 | const char *endptr; | - |
2466 | | - |
2467 | if (*num == '\0') { evaluated: *num == '\0' yes Evaluation Count:497 | yes Evaluation Count:254823 |
| 497-254823 |
2468 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:5 | yes Evaluation Count:492 |
| 5-492 |
2469 | *ok = false; executed: *ok = false; Execution Count:5 | 5 |
2470 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:4 | yes Evaluation Count:493 |
| 4-493 |
2471 | *overflow = false; executed: *overflow = false; Execution Count:4 | 4 |
2472 | return 0; executed: return 0; Execution Count:497 | 497 |
2473 | } | - |
2474 | | - |
2475 | qlonglong l = qstrtoll(num, &endptr, base, &_ok); | - |
2476 | | - |
2477 | if (!_ok) { evaluated: !_ok yes Evaluation Count:148 | yes Evaluation Count:254673 |
| 148-254673 |
2478 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:127 | yes Evaluation Count:21 |
| 21-127 |
2479 | *ok = false; executed: *ok = false; Execution Count:127 | 127 |
2480 | if (overflow != 0) { evaluated: overflow != 0 yes Evaluation Count:1 | yes Evaluation Count:147 |
| 1-147 |
2481 | | - |
2482 | | - |
2483 | *overflow = *endptr != '\0'; | - |
2484 | } executed: } Execution Count:1 | 1 |
2485 | return 0; executed: return 0; Execution Count:148 | 148 |
2486 | } | - |
2487 | | - |
2488 | if (*endptr != '\0') { evaluated: *endptr != '\0' yes Evaluation Count:48 | yes Evaluation Count:254625 |
| 48-254625 |
2489 | | - |
2490 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:41 | yes Evaluation Count:7 |
| 7-41 |
2491 | *ok = false; executed: *ok = false; Execution Count:41 | 41 |
2492 | if (overflow != 0) partially evaluated: overflow != 0 no Evaluation Count:0 | yes Evaluation Count:48 |
| 0-48 |
2493 | *overflow = false; never executed: *overflow = false; | 0 |
2494 | return 0; executed: return 0; Execution Count:48 | 48 |
2495 | } | - |
2496 | | - |
2497 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:185671 | yes Evaluation Count:68954 |
| 68954-185671 |
2498 | *ok = true; executed: *ok = true; Execution Count:185671 | 185671 |
2499 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:159 | yes Evaluation Count:254467 |
| 159-254467 |
2500 | *overflow = false; executed: *overflow = false; Execution Count:159 | 159 |
2501 | return l; executed: return l; Execution Count:254624 | 254624 |
2502 | } | - |
2503 | | - |
2504 | qulonglong QLocalePrivate::bytearrayToUnsLongLong(const char *num, int base, bool *ok) | - |
2505 | { | - |
2506 | bool _ok; | - |
2507 | const char *endptr; | - |
2508 | qulonglong l = qstrtoull(num, &endptr, base, &_ok); | - |
2509 | | - |
2510 | if (!_ok || *endptr != '\0') { evaluated: !_ok yes Evaluation Count:660 | yes Evaluation Count:26884 |
evaluated: *endptr != '\0' yes Evaluation Count:118 | yes Evaluation Count:26766 |
| 118-26884 |
2511 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:765 | yes Evaluation Count:13 |
| 13-765 |
2512 | *ok = false; executed: *ok = false; Execution Count:765 | 765 |
2513 | return 0; executed: return 0; Execution Count:778 | 778 |
2514 | } | - |
2515 | | - |
2516 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:25655 | yes Evaluation Count:1111 |
| 1111-25655 |
2517 | *ok = true; executed: *ok = true; Execution Count:25655 | 25655 |
2518 | return l; executed: return l; Execution Count:26766 | 26766 |
2519 | } | - |
2520 | QString QLocale::currencySymbol(QLocale::CurrencySymbolFormat format) const | - |
2521 | { | - |
2522 | | - |
2523 | if (d->m_data == systemData()) { partially evaluated: d->m_data == systemData() no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
2524 | QVariant res = systemLocale()->query(QSystemLocale::CurrencySymbol, format); | - |
2525 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
2526 | return res.toString(); never executed: return res.toString(); | 0 |
2527 | } | 0 |
2528 | | - |
2529 | quint32 idx, size; | - |
2530 | switch (format) { | - |
2531 | case CurrencySymbol: | - |
2532 | idx = d->m_data->m_currency_symbol_idx; | - |
2533 | size = d->m_data->m_currency_symbol_size; | - |
2534 | return getLocaleData(currency_symbol_data + idx, size); executed: return getLocaleData(currency_symbol_data + idx, size); Execution Count:16 | 16 |
2535 | case CurrencyDisplayName: | - |
2536 | idx = d->m_data->m_currency_display_name_idx; | - |
2537 | size = d->m_data->m_currency_display_name_size; | - |
2538 | return getLocaleListData(currency_display_name_data + idx, size, 0); never executed: return getLocaleListData(currency_display_name_data + idx, size, 0); | 0 |
2539 | case CurrencyIsoCode: { | - |
2540 | int len = 0; | - |
2541 | const QLocaleData *data = this->d->m_data; | - |
2542 | for (; len < 3; ++len) partially evaluated: len < 3 yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
2543 | if (!data->m_currency_iso_code[len]) partially evaluated: !data->m_currency_iso_code[len] yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
2544 | break; executed: break; Execution Count:4 | 4 |
2545 | return len ? QString::fromLatin1(data->m_currency_iso_code, len) : QString(); executed: return len ? QString::fromLatin1(data->m_currency_iso_code, len) : QString(); Execution Count:4 | 4 |
2546 | } | - |
2547 | } | - |
2548 | return QString(); never executed: return QString(); | 0 |
2549 | } | - |
2550 | QString QLocale::toCurrencyString(qlonglong value, const QString &symbol) const | - |
2551 | { | - |
2552 | | - |
2553 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
2554 | QSystemLocale::CurrencyToStringArgument arg(value, symbol); | - |
2555 | QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg)); | - |
2556 | if (!res.isNull()) partially evaluated: !res.isNull() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2557 | return res.toString(); never executed: return res.toString(); | 0 |
2558 | } executed: } Execution Count:1 | 1 |
2559 | | - |
2560 | const QLocalePrivate *d = this->d; | - |
2561 | quint8 idx = d->m_data->m_currency_format_idx; | - |
2562 | quint8 size = d->m_data->m_currency_format_size; | - |
2563 | if (d->m_data->m_currency_negative_format_size && value < 0) { evaluated: d->m_data->m_currency_negative_format_size yes Evaluation Count:2 | yes Evaluation Count:4 |
evaluated: value < 0 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-4 |
2564 | idx = d->m_data->m_currency_negative_format_idx; | - |
2565 | size = d->m_data->m_currency_negative_format_size; | - |
2566 | value = -value; | - |
2567 | } executed: } Execution Count:1 | 1 |
2568 | QString str = toString(value); | - |
2569 | QString sym = symbol.isNull() ? currencySymbol() : symbol; evaluated: symbol.isNull() yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
2570 | if (sym.isEmpty()) evaluated: sym.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
2571 | sym = currencySymbol(QLocale::CurrencyIsoCode); executed: sym = currencySymbol(QLocale::CurrencyIsoCode); Execution Count:1 | 1 |
2572 | QString format = getLocaleData(currency_format_data + idx, size); | - |
2573 | return format.arg(str, sym); executed: return format.arg(str, sym); Execution Count:6 | 6 |
2574 | } | - |
2575 | | - |
2576 | | - |
2577 | | - |
2578 | | - |
2579 | | - |
2580 | QString QLocale::toCurrencyString(qulonglong value, const QString &symbol) const | - |
2581 | { | - |
2582 | | - |
2583 | if (d->m_data == systemData()) { partially evaluated: d->m_data == systemData() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
2584 | QSystemLocale::CurrencyToStringArgument arg(value, symbol); | - |
2585 | QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg)); | - |
2586 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
2587 | return res.toString(); never executed: return res.toString(); | 0 |
2588 | } | 0 |
2589 | | - |
2590 | const QLocaleData *data = this->d->m_data; | - |
2591 | quint8 idx = data->m_currency_format_idx; | - |
2592 | quint8 size = data->m_currency_format_size; | - |
2593 | QString str = toString(value); | - |
2594 | QString sym = symbol.isNull() ? currencySymbol() : symbol; evaluated: symbol.isNull() yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
2595 | if (sym.isEmpty()) evaluated: sym.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
2596 | sym = currencySymbol(QLocale::CurrencyIsoCode); executed: sym = currencySymbol(QLocale::CurrencyIsoCode); Execution Count:1 | 1 |
2597 | QString format = getLocaleData(currency_format_data + idx, size); | - |
2598 | return format.arg(str, sym); executed: return format.arg(str, sym); Execution Count:5 | 5 |
2599 | } | - |
2600 | | - |
2601 | | - |
2602 | | - |
2603 | | - |
2604 | | - |
2605 | QString QLocale::toCurrencyString(double value, const QString &symbol) const | - |
2606 | { | - |
2607 | | - |
2608 | if (d->m_data == systemData()) { partially evaluated: d->m_data == systemData() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
2609 | QSystemLocale::CurrencyToStringArgument arg(value, symbol); | - |
2610 | QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg)); | - |
2611 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
2612 | return res.toString(); never executed: return res.toString(); | 0 |
2613 | } | 0 |
2614 | | - |
2615 | const QLocaleData *data = this->d->m_data; | - |
2616 | quint8 idx = data->m_currency_format_idx; | - |
2617 | quint8 size = data->m_currency_format_size; | - |
2618 | if (data->m_currency_negative_format_size && value < 0) { evaluated: data->m_currency_negative_format_size yes Evaluation Count:2 | yes Evaluation Count:7 |
evaluated: value < 0 yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-7 |
2619 | idx = data->m_currency_negative_format_idx; | - |
2620 | size = data->m_currency_negative_format_size; | - |
2621 | value = -value; | - |
2622 | } executed: } Execution Count:1 | 1 |
2623 | QString str = toString(value, 'f', d->m_data->m_currency_digits); | - |
2624 | QString sym = symbol.isNull() ? currencySymbol() : symbol; evaluated: symbol.isNull() yes Evaluation Count:8 | yes Evaluation Count:1 |
| 1-8 |
2625 | if (sym.isEmpty()) evaluated: sym.isEmpty() yes Evaluation Count:2 | yes Evaluation Count:7 |
| 2-7 |
2626 | sym = currencySymbol(QLocale::CurrencyIsoCode); executed: sym = currencySymbol(QLocale::CurrencyIsoCode); Execution Count:2 | 2 |
2627 | QString format = getLocaleData(currency_format_data + idx, size); | - |
2628 | return format.arg(str, sym); executed: return format.arg(str, sym); Execution Count:9 | 9 |
2629 | } | - |
2630 | QStringList QLocale::uiLanguages() const | - |
2631 | { | - |
2632 | | - |
2633 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:6 | yes Evaluation Count:23 |
| 6-23 |
2634 | QVariant res = systemLocale()->query(QSystemLocale::UILanguages, QVariant()); | - |
2635 | if (!res.isNull()) { partially evaluated: !res.isNull() yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
2636 | QStringList result = res.toStringList(); | - |
2637 | if (!result.isEmpty()) partially evaluated: !result.isEmpty() yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
2638 | return result; executed: return result; Execution Count:6 | 6 |
2639 | } | 0 |
2640 | } | 0 |
2641 | | - |
2642 | QLocaleId id = QLocaleId::fromIds(d->m_data->m_language_id, d->m_data->m_script_id, d->m_data->m_country_id); | - |
2643 | const QLocaleId max = id.withLikelySubtagsAdded(); | - |
2644 | const QLocaleId min = max.withLikelySubtagsRemoved(); | - |
2645 | | - |
2646 | QStringList uiLanguages; | - |
2647 | uiLanguages.append(min.bcp47Name()); | - |
2648 | if (id.script_id) { evaluated: id.script_id yes Evaluation Count:21 | yes Evaluation Count:2 |
| 2-21 |
2649 | id.script_id = 0; | - |
2650 | if (id != min && id.withLikelySubtagsAdded() == max) evaluated: id != min yes Evaluation Count:15 | yes Evaluation Count:6 |
evaluated: id.withLikelySubtagsAdded() == max yes Evaluation Count:12 | yes Evaluation Count:3 |
| 3-15 |
2651 | uiLanguages.append(id.bcp47Name()); executed: uiLanguages.append(id.bcp47Name()); Execution Count:12 | 12 |
2652 | } executed: } Execution Count:21 | 21 |
2653 | if (max != min && max != id) evaluated: max != min yes Evaluation Count:21 | yes Evaluation Count:2 |
partially evaluated: max != id yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-21 |
2654 | uiLanguages.append(max.bcp47Name()); executed: uiLanguages.append(max.bcp47Name()); Execution Count:21 | 21 |
2655 | return uiLanguages; executed: return uiLanguages; Execution Count:23 | 23 |
2656 | } | - |
2657 | QString QLocale::nativeLanguageName() const | - |
2658 | { | - |
2659 | | - |
2660 | if (d->m_data == systemData()) { never evaluated: d->m_data == systemData() | 0 |
2661 | QVariant res = systemLocale()->query(QSystemLocale::NativeLanguageName, QVariant()); | - |
2662 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
2663 | return res.toString(); never executed: return res.toString(); | 0 |
2664 | } | 0 |
2665 | | - |
2666 | return getLocaleData(endonyms_data + d->m_data->m_language_endonym_idx, d->m_data->m_language_endonym_size); never executed: return getLocaleData(endonyms_data + d->m_data->m_language_endonym_idx, d->m_data->m_language_endonym_size); | 0 |
2667 | } | - |
2668 | QString QLocale::nativeCountryName() const | - |
2669 | { | - |
2670 | | - |
2671 | if (d->m_data == systemData()) { never evaluated: d->m_data == systemData() | 0 |
2672 | QVariant res = systemLocale()->query(QSystemLocale::NativeCountryName, QVariant()); | - |
2673 | if (!res.isNull()) never evaluated: !res.isNull() | 0 |
2674 | return res.toString(); never executed: return res.toString(); | 0 |
2675 | } | 0 |
2676 | | - |
2677 | return getLocaleData(endonyms_data + d->m_data->m_country_endonym_idx, d->m_data->m_country_endonym_size); never executed: return getLocaleData(endonyms_data + d->m_data->m_country_endonym_idx, d->m_data->m_country_endonym_size); | 0 |
2678 | } | - |
2679 | | - |
2680 | | - |
2681 | QDebug operator<<(QDebug dbg, const QLocale &l) | - |
2682 | { | - |
2683 | dbg.nospace() << "QLocale(" << QString(QLocale::languageToString(l.language())).toLocal8Bit().constData() | - |
2684 | << ", " << QString(QLocale::scriptToString(l.script())).toLocal8Bit().constData() | - |
2685 | << ", " << QString(QLocale::countryToString(l.country())).toLocal8Bit().constData() << ')'; | - |
2686 | return dbg.space(); executed: return dbg.space(); Execution Count:1 | 1 |
2687 | } | - |
2688 | | - |
2689 | | - |
2690 | | - |
| | |