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:44 | 44 |
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:17382 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:44 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:44 | yes Evaluation Count:17338 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-17382 |
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:44 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:44 |
partially evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:44 | no Evaluation Count:0 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
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:2868 |
partially evaluated: len != 3 no Evaluation Count:0 | yes Evaluation Count:440 |
| 0-2868 |
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:3308 | no Evaluation Count:0 |
| 0-3308 |
36 | ushort uc2 = len-- > 0 ? code[1].toLower().unicode() : 0; partially evaluated: len-- > 0 yes Evaluation Count:3308 | no Evaluation Count:0 |
| 0-3308 |
37 | ushort uc3 = len-- > 0 ? code[2].toLower().unicode() : 0; evaluated: len-- > 0 yes Evaluation Count:440 | yes Evaluation Count:2868 |
| 440-2868 |
38 | | - |
39 | const unsigned char *c = language_code_list; | - |
40 | for (; *c != 0; c += 3) { evaluated: *c != 0 yes Evaluation Count:268906 | yes Evaluation Count:47 |
| 47-268906 |
41 | if (uc1 == c[0] && uc2 == c[1] && uc3 == c[2]) evaluated: uc1 == c[0] yes Evaluation Count:17683 | yes Evaluation Count:251223 |
evaluated: uc2 == c[1] yes Evaluation Count:3569 | yes Evaluation Count:14114 |
evaluated: uc3 == c[2] yes Evaluation Count:3261 | yes Evaluation Count:308 |
| 308-251223 |
42 | return QLocale::Language((c - language_code_list)/3); executed: return QLocale::Language((c - language_code_list)/3); Execution Count:3261 | 3261 |
43 | } executed: } Execution Count:265645 | 265645 |
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:3292 | yes Evaluation Count:12 |
| 12-3292 |
70 | return QLocale::AnyScript; executed: return QLocale::AnyScript; Execution Count:3292 | 3292 |
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:1904 |
evaluated: len != 3 yes Evaluation Count:519 | yes Evaluation Count:881 |
| 519-1904 |
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:2785 | no Evaluation Count:0 |
| 0-2785 |
92 | ushort uc2 = len-- > 0 ? code[1].toUpper().unicode() : 0; partially evaluated: len-- > 0 yes Evaluation Count:2785 | no Evaluation Count:0 |
| 0-2785 |
93 | ushort uc3 = len-- > 0 ? code[2].toUpper().unicode() : 0; evaluated: len-- > 0 yes Evaluation Count:881 | yes Evaluation Count:1904 |
| 881-1904 |
94 | | - |
95 | const unsigned char *c = country_code_list; | - |
96 | for (; *c != 0; c += 3) { evaluated: *c != 0 yes Evaluation Count:508134 | yes Evaluation Count:876 |
| 876-508134 |
97 | if (uc1 == c[0] && uc2 == c[1] && uc3 == c[2]) evaluated: uc1 == c[0] yes Evaluation Count:17209 | yes Evaluation Count:490925 |
evaluated: uc2 == c[1] yes Evaluation Count:2785 | yes Evaluation Count:14424 |
evaluated: uc3 == c[2] yes Evaluation Count:1909 | yes Evaluation Count:876 |
| 876-490925 |
98 | return QLocale::Country((c - country_code_list)/3); executed: return QLocale::Country((c - country_code_list)/3); Execution Count:1909 | 1909 |
99 | } executed: } Execution Count:506225 | 506225 |
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:2576 |
| 0-2576 |
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:2475 |
| 101-2475 |
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:2183 |
| 292-2183 |
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:2475 | 2475 |
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:2475 |
| 0-2475 |
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:2471 |
| 4-2471 |
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:2475 | 2475 |
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:4423082 |
| 4423082-2147483647 |
156 | if (localeId == p[0]) { evaluated: localeId == p[0] yes Evaluation Count:605784 | yes Evaluation Count:2147483647 |
| 605784-2147483647 |
157 | localeId = p[1]; | - |
158 | return true; executed: return true; Execution Count:605784 | 605784 |
159 | } | - |
160 | } executed: } Execution Count:2147483647 | 2147483647 |
161 | return false; executed: return false; Execution Count:4423082 | 4423082 |
162 | } | - |
163 | | - |
164 | QLocaleId QLocaleId::withLikelySubtagsAdded() const | - |
165 | { | - |
166 | | - |
167 | if (language_id || script_id || country_id) { evaluated: language_id yes Evaluation Count:4124255 | 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-4124255 |
168 | QLocaleId id = QLocaleId::fromIds(language_id, script_id, country_id); | - |
169 | if (addLikelySubtags(id)) evaluated: addLikelySubtags(id) yes Evaluation Count:301977 | yes Evaluation Count:3822269 |
| 301977-3822269 |
170 | return id; executed: return id; Execution Count:301977 | 301977 |
171 | } executed: } Execution Count:3822270 | 3822270 |
172 | | - |
173 | if (country_id) { evaluated: country_id yes Evaluation Count:303800 | yes Evaluation Count:3518474 |
| 303800-3518474 |
174 | QLocaleId id = QLocaleId::fromIds(language_id, script_id, 0); | - |
175 | if (addLikelySubtags(id)) { evaluated: addLikelySubtags(id) yes Evaluation Count:3377 | yes Evaluation Count:300423 |
| 3377-300423 |
176 | id.country_id = country_id; | - |
177 | return id; executed: return id; Execution Count:3377 | 3377 |
178 | } | - |
179 | } executed: } Execution Count:300423 | 300423 |
180 | | - |
181 | if (script_id) { evaluated: script_id yes Evaluation Count:300430 | yes Evaluation Count:3518468 |
| 300430-3518468 |
182 | QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id); | - |
183 | if (addLikelySubtags(id)) { evaluated: addLikelySubtags(id) yes Evaluation Count:39 | yes Evaluation Count:300391 |
| 39-300391 |
184 | id.script_id = script_id; | - |
185 | return id; executed: return id; Execution Count:39 | 39 |
186 | } | - |
187 | } executed: } Execution Count:300391 | 300391 |
188 | | - |
189 | if (script_id && country_id) { evaluated: script_id yes Evaluation Count:300391 | yes Evaluation Count:3518468 |
partially evaluated: country_id yes Evaluation Count:300391 | no Evaluation Count:0 |
| 0-3518468 |
190 | QLocaleId id = QLocaleId::fromIds(language_id, 0, 0); | - |
191 | if (addLikelySubtags(id)) { partially evaluated: addLikelySubtags(id) yes Evaluation Count:300391 | no Evaluation Count:0 |
| 0-300391 |
192 | id.script_id = script_id; | - |
193 | id.country_id = country_id; | - |
194 | return id; executed: return id; Execution Count:300391 | 300391 |
195 | } | - |
196 | } | 0 |
197 | return *this; executed: return *this; Execution Count:3518468 | 3518468 |
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:299396 | yes Evaluation Count:1041 |
| 1041-299396 |
207 | return id; executed: return id; Execution Count:299396 | 299396 |
208 | } | - |
209 | | - |
210 | if (country_id) { partially evaluated: country_id yes Evaluation Count:1041 | no Evaluation Count:0 |
| 0-1041 |
211 | QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id); | - |
212 | if (id.withLikelySubtagsAdded() == max) evaluated: id.withLikelySubtagsAdded() == max yes Evaluation Count:1032 | yes Evaluation Count:9 |
| 9-1032 |
213 | return id; executed: return id; Execution Count:1032 | 1032 |
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:300470 |
| 0-300470 |
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:300468 |
| 2-300468 |
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:300438 |
| 30-300438 |
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:1067 | yes Evaluation Count:299401 |
| 1067-299401 |
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:299952 |
evaluated: script yes Evaluation Count:30 | yes Evaluation Count:300438 |
evaluated: country yes Evaluation Count:1067 | yes Evaluation Count:299401 |
| 30-300438 |
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:299952 |
| 516-299952 |
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:300438 |
| 30-300438 |
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:1067 | yes Evaluation Count:299401 |
| 1067-299401 |
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:1060 |
| 7-1060 |
255 | *uc++ = ushort(country[2]); executed: *uc++ = ushort(country[2]); Execution Count:7 | 7 |
256 | } executed: } Execution Count:1067 | 1067 |
257 | return name; executed: return name; Execution Count:300468 | 300468 |
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:3829721 |
| 0-3829721 |
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:3529302 | yes Evaluation Count:300414 |
| 300414-3529302 |
265 | return QString::fromUtf8("" "C" "", sizeof("C") - 1); executed: return QString::fromUtf8("" "C" "", sizeof("C") - 1); Execution Count:3529308 | 3529308 |
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:300414 | 300414 |
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:3518486 | yes Evaluation Count:3818 |
| 3818-3518486 |
281 | return data; executed: return data; Execution Count:3518486 | 3518486 |
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:3818 | no Evaluation Count:0 |
partially evaluated: localeId.country_id != QLocale::AnyCountry yes Evaluation Count:3818 | no Evaluation Count:0 |
| 0-3818 |
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:21812 | yes Evaluation Count:437 |
evaluated: data->m_country_id == localeId.country_id yes Evaluation Count:3814 | yes Evaluation Count:17998 |
| 437-21812 |
289 | return data; executed: return data; Execution Count:3814 | 3814 |
290 | ++data; | - |
291 | } while (data->m_language_id == localeId.language_id); executed: } Execution Count:18435 evaluated: data->m_language_id == localeId.language_id yes Evaluation Count:18431 | yes Evaluation Count:4 |
| 4-18435 |
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:18772 | yes Evaluation Count:3231 |
partially evaluated: size < 8 yes Evaluation Count:18772 | no Evaluation Count:0 |
| 0-18772 |
326 | if (separators.contains(*uc)) evaluated: separators.contains(*uc) yes Evaluation Count:4038 | yes Evaluation Count:14734 |
| 4038-14734 |
327 | break; executed: break; Execution Count:4038 | 4038 |
328 | if (! ((uc->unicode() >= 'a' && uc->unicode() <= 'z') || evaluated: uc->unicode() >= 'a' yes Evaluation Count:9747 | yes Evaluation Count:4987 |
partially evaluated: uc->unicode() <= 'z' yes Evaluation Count:9747 | no Evaluation Count:0 |
| 0-9747 |
329 | (uc->unicode() >= 'A' && uc->unicode() <= 'Z') || evaluated: uc->unicode() >= 'A' yes Evaluation Count:4971 | yes Evaluation Count:16 |
partially evaluated: uc->unicode() <= 'Z' yes Evaluation Count:4971 | no Evaluation Count:0 |
| 0-4971 |
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:14733 | 14733 |
334 | result->truncate(size); | - |
335 | return true; executed: return true; Execution Count:7269 | 7269 |
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:8492 | yes Evaluation Count:3238 |
evaluated: state != NoState yes Evaluation Count:7270 | yes Evaluation Count:1222 |
| 1222-8492 |
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:7269 |
evaluated: value.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:7265 |
| 1-7269 |
350 | break; executed: break; Execution Count:5 | 5 |
351 | QChar sep = i < length ? name.at(i) : QChar(); evaluated: i < length yes Evaluation Count:4034 | yes Evaluation Count:3231 |
| 3231-4034 |
352 | switch (state) { | - |
353 | case LangState: | - |
354 | if (!sep.isNull() && !separators.contains(sep)) { evaluated: !sep.isNull() yes Evaluation Count:2805 | yes Evaluation Count:1655 |
partially evaluated: !separators.contains(sep) no Evaluation Count:0 | yes Evaluation Count:2805 |
| 0-2805 |
355 | state = NoState; | - |
356 | break; | 0 |
357 | } | - |
358 | lang = value; | - |
359 | if (i == length) { evaluated: i == length yes Evaluation Count:1655 | yes Evaluation Count:2805 |
| 1655-2805 |
360 | | - |
361 | state = NoState; | - |
362 | break; executed: break; Execution Count:1655 | 1655 |
363 | } | - |
364 | state = ScriptState; | - |
365 | break; executed: break; Execution Count:2805 | 2805 |
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:2786 |
partially evaluated: scripts.indexOf(value) % 4 == 0 yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-2786 |
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:2786 | 2786 |
377 | break; executed: break; Execution Count:2798 | 2798 |
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:7265 | 7265 |
390 | return lang.length() == 2 || lang.length() == 3; executed: return lang.length() == 2 || lang.length() == 3; Execution Count:4465 | 4465 |
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:1155 | yes Evaluation Count:3308 |
| 1155-3308 |
404 | return; executed: return; Execution Count:1155 | 1155 |
405 | | - |
406 | lang = QLocalePrivate::codeToLanguage(lang_code); | - |
407 | if (lang == QLocale::C) evaluated: lang == QLocale::C yes Evaluation Count:4 | yes Evaluation Count:3304 |
| 4-3304 |
408 | return; executed: return; Execution Count:4 | 4 |
409 | script = QLocalePrivate::codeToScript(script_code); | - |
410 | cntry = QLocalePrivate::codeToCountry(cntry_code); | - |
411 | } executed: } Execution Count:3304 | 3304 |
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:4463 | 4463 |
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:68119 | yes Evaluation Count:4248 |
evaluated: s.at(j) == c yes Evaluation Count:24993 | yes Evaluation Count:43126 |
| 4248-68119 |
462 | ++j; executed: ++j; Execution Count:24993 | 24993 |
463 | return j - i; executed: return j - i; Execution Count:47374 | 47374 |
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:231 |
| 0-231 |
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:231 | 231 |
495 | | - |
496 | static const QSystemLocale *systemLocale() | - |
497 | { | - |
498 | if (_systemLocale) partially evaluated: _systemLocale no Evaluation Count:0 | yes Evaluation Count:17382 |
| 0-17382 |
499 | return _systemLocale; never executed: return _systemLocale; | 0 |
500 | return QSystemLocale_globalSystemLocale(); executed: return QSystemLocale_globalSystemLocale(); Execution Count:17382 | 17382 |
501 | } | - |
502 | | - |
503 | void QLocalePrivate::updateSystemPrivate() | - |
504 | { | - |
505 | const QSystemLocale *sys_locale = systemLocale(); | - |
506 | if (!system_data) partially evaluated: !system_data yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
507 | system_data = globalLocaleData(); executed: system_data = globalLocaleData(); Execution Count:44 | 44 |
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:44 |
| 0-44 |
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:44 |
| 0-44 |
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:44 |
| 0-44 |
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:44 | no Evaluation Count:0 |
| 0-44 |
530 | system_data->m_decimal = res.toString().at(0).unicode(); executed: system_data->m_decimal = res.toString().at(0).unicode(); Execution Count:44 | 44 |
531 | | - |
532 | res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant()); | - |
533 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
534 | system_data->m_group = res.toString().at(0).unicode(); executed: system_data->m_group = res.toString().at(0).unicode(); Execution Count:44 | 44 |
535 | | - |
536 | res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant()); | - |
537 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
538 | system_data->m_zero = res.toString().at(0).unicode(); executed: system_data->m_zero = res.toString().at(0).unicode(); Execution Count:44 | 44 |
539 | | - |
540 | res = sys_locale->query(QSystemLocale::NegativeSign, QVariant()); | - |
541 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
542 | system_data->m_minus = res.toString().at(0).unicode(); executed: system_data->m_minus = res.toString().at(0).unicode(); Execution Count:44 | 44 |
543 | | - |
544 | res = sys_locale->query(QSystemLocale::PositiveSign, QVariant()); | - |
545 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
546 | system_data->m_plus = res.toString().at(0).unicode(); executed: system_data->m_plus = res.toString().at(0).unicode(); Execution Count:44 | 44 |
547 | } executed: } Execution Count:44 | 44 |
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:44 | yes Evaluation Count:48004 |
partially evaluated: system_data->m_language_id == 0 no Evaluation Count:0 | yes Evaluation Count:48004 |
| 0-48004 |
555 | QLocalePrivate::updateSystemPrivate(); executed: QLocalePrivate::updateSystemPrivate(); Execution Count:44 | 44 |
556 | | - |
557 | return system_data; executed: return system_data; Execution Count:48048 | 48048 |
558 | | - |
559 | | - |
560 | | - |
561 | } | - |
562 | | - |
563 | static const QLocaleData *defaultData() | - |
564 | { | - |
565 | if (!default_data) evaluated: !default_data yes Evaluation Count:41 | yes Evaluation Count:275152 |
| 41-275152 |
566 | default_data = systemData(); executed: default_data = systemData(); Execution Count:41 | 41 |
567 | return default_data; executed: return default_data; Execution Count:275193 | 275193 |
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:74044 | yes Evaluation Count:17178 |
partially evaluated: size > 0 yes Evaluation Count:74044 | no Evaluation Count:0 |
| 0-74044 |
574 | while (*data != separator) evaluated: *data != separator yes Evaluation Count:291280 | yes Evaluation Count:74044 |
| 74044-291280 |
575 | ++data, --size; executed: ++data, --size; Execution Count:291280 | 291280 |
576 | --index; | - |
577 | ++data; | - |
578 | --size; | - |
579 | } executed: } Execution Count:74044 | 74044 |
580 | const ushort *end = data; | - |
581 | while (size > 0 && *end != separator) partially evaluated: size > 0 yes Evaluation Count:86926 | no Evaluation Count:0 |
evaluated: *end != separator yes Evaluation Count:69748 | yes Evaluation Count:17178 |
| 0-86926 |
582 | ++end, --size; executed: ++end, --size; Execution Count:69748 | 69748 |
583 | if (end-data == 0) partially evaluated: end-data == 0 no Evaluation Count:0 | yes Evaluation Count:17178 |
| 0-17178 |
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:17178 | 17178 |
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:5829 | 5829 |
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:268431 | yes Evaluation Count:3533469 |
| 268431-3533469 |
618 | return system_data; executed: return system_data; Execution Count:268431 | 268431 |
619 | | - |
620 | | - |
621 | | - |
622 | | - |
623 | return &locale_data[index]; executed: return &locale_data[index]; Execution Count:3533470 | 3533470 |
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:268431 | yes Evaluation Count:3533471 |
| 268431-3533471 |
632 | | - |
633 | | - |
634 | | - |
635 | | - |
636 | | - |
637 | return index; executed: return index; Execution Count:3801901 | 3801901 |
638 | } | - |
639 | | - |
640 | | - |
641 | | - |
642 | | - |
643 | QLocale::QLocale(QLocalePrivate &dd) | - |
644 | : d(&dd) | - |
645 | {} executed: } Execution Count:4416 | 4416 |
646 | QLocale::QLocale(const QString &name) | - |
647 | : d(new QLocalePrivate(localeDataIndex(findLocaleData(name)))) | - |
648 | { | - |
649 | } executed: } Execution Count:4463 | 4463 |
650 | QLocale::QLocale() | - |
651 | : d(new QLocalePrivate(localeDataIndex(defaultData()), default_number_options)) | - |
652 | { | - |
653 | } executed: } Execution Count:275181 | 275181 |
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:3517326 | yes Evaluation Count:514 |
evaluated: language != QLocale::C yes Evaluation Count:12 | yes Evaluation Count:3517315 |
| 12-3517326 |
662 | numberOptions = default_number_options; | - |
663 | index = localeDataIndex(defaultData()); | - |
664 | } else { executed: } Execution Count:12 | 12 |
665 | index = localeDataIndex(data); | - |
666 | } executed: } Execution Count:3517829 | 3517829 |
667 | d = new QLocalePrivate(index, numberOptions); | - |
668 | } executed: } Execution Count:3517845 | 3517845 |
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:78724 | 78724 |
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:192348 | 192348 |
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:34085 | 34085 |
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:25883 | 25883 |
721 | } | - |
722 | | - |
723 | | - |
724 | | - |
725 | | - |
726 | | - |
727 | | - |
728 | | - |
729 | void QLocale::setNumberOptions(NumberOptions options) | - |
730 | { | - |
731 | d->m_numberOptions = options; | - |
732 | } executed: } Execution Count:35541 | 35541 |
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:1814 | 1814 |
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:1600 | 1600 |
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:11491 | 11491 |
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:10069 | 10069 |
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:2475 |
| 101-2475 |
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:2475 |
| 0-2475 |
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:2475 | 2475 |
857 | } | - |
858 | QString QLocale::bcp47Name() const | - |
859 | { | - |
860 | return d->bcp47Name(); executed: return d->bcp47Name(); Execution Count:27814 | 27814 |
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:952 |
partially evaluated: i > 2147483647 no Evaluation Count:0 | yes Evaluation Count:952 |
| 0-952 |
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:952 | 952 |
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:11533 |
| 0-11533 |
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:11533 | 11533 |
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:991 |
| 2-991 |
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:993 | 993 |
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:11533 |
| 0-11533 |
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:11533 | 11533 |
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:1273 |
| 0-1273 |
969 | ? QLocalePrivate::FailOnGroupSeparators | - |
970 | : QLocalePrivate::ParseGroupSeparators; | - |
971 | | - |
972 | return d->stringToDouble(s, ok, mode); executed: return d->stringToDouble(s, ok, mode); Execution Count:1273 | 1273 |
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:6255 | yes Evaluation Count:1398 |
| 1398-6255 |
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:7653 | 7653 |
988 | } | - |
989 | | - |
990 | | - |
991 | | - |
992 | | - |
993 | | - |
994 | | - |
995 | | - |
996 | QString QLocale::toString(qulonglong i) const | - |
997 | { | - |
998 | int flags = d->m_numberOptions & OmitGroupSeparator partially evaluated: d->m_numberOptions & OmitGroupSeparator no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-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:452 | 452 |
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:1620 | 1620 |
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:3143 |
| 0-3143 |
1024 | return QString(); never executed: return QString(); | 0 |
1025 | | - |
1026 | | - |
1027 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:1559 | yes Evaluation Count:1584 |
| 1559-1584 |
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:1559 | no Evaluation Count:0 |
| 0-1559 |
1032 | return res.toString(); executed: return res.toString(); Execution Count:1559 | 1559 |
1033 | } | 0 |
1034 | | - |
1035 | | - |
1036 | QString format_str = dateFormat(format); | - |
1037 | return toString(date, format_str); executed: return toString(date, format_str); Execution Count:1584 | 1584 |
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:63322 | yes Evaluation Count:3317 |
| 3317-63322 |
1044 | if (format.at(i).unicode() == '\'') { evaluated: format.at(i).unicode() == '\'' yes Evaluation Count:765 | yes Evaluation Count:62557 |
| 765-62557 |
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:2338 | yes Evaluation Count:60219 |
| 2338-60219 |
1050 | return true; executed: return true; Execution Count:2338 | 2338 |
1051 | | - |
1052 | ++i; | - |
1053 | } executed: } Execution Count:60219 | 60219 |
1054 | return false; executed: return false; Execution Count:3317 | 3317 |
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:1576 | 1576 |
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:4082 | 4082 |
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:3085 |
| 0-3085 |
1108 | return QString(); never executed: return QString(); | 0 |
1109 | | - |
1110 | | - |
1111 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:1540 | yes Evaluation Count:1545 |
| 1540-1545 |
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:1540 | no Evaluation Count:0 |
| 0-1540 |
1116 | return res.toString(); executed: return res.toString(); Execution Count:1540 | 1540 |
1117 | } | 0 |
1118 | | - |
1119 | | - |
1120 | QString format_str = timeFormat(format); | - |
1121 | return toString(time, format_str); executed: return toString(time, format_str); Execution Count:1545 | 1545 |
1122 | } | - |
1123 | QString QLocale::dateFormat(FormatType format) const | - |
1124 | { | - |
1125 | | - |
1126 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:2 | yes Evaluation Count:1728 |
| 2-1728 |
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:2 | no Evaluation Count:0 |
| 0-2 |
1131 | return res.toString(); executed: return res.toString(); Execution Count:2 | 2 |
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:26 | 26 |
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:1702 | 1702 |
1145 | } | - |
1146 | return getLocaleData(date_format_data + idx, size); executed: return getLocaleData(date_format_data + idx, size); Execution Count:1728 | 1728 |
1147 | } | - |
1148 | QString QLocale::timeFormat(FormatType format) const | - |
1149 | { | - |
1150 | | - |
1151 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:2 | yes Evaluation Count:1689 |
| 2-1689 |
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:2 | no Evaluation Count:0 |
| 0-2 |
1156 | return res.toString(); executed: return res.toString(); Execution Count:2 | 2 |
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:26 | 26 |
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:1663 | 1663 |
1170 | } | - |
1171 | return getLocaleData(time_format_data + idx, size); executed: return getLocaleData(time_format_data + idx, size); Execution Count:1689 | 1689 |
1172 | } | - |
1173 | QString QLocale::dateTimeFormat(FormatType format) const | - |
1174 | { | - |
1175 | | - |
1176 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:5 | yes Evaluation Count:85 |
| 5-85 |
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:5 | no Evaluation Count:0 |
| 0-5 |
1182 | return res.toString(); executed: return res.toString(); Execution Count:5 | 5 |
1183 | } | - |
1184 | } | 0 |
1185 | | - |
1186 | return dateFormat(format) + QLatin1Char(' ') + timeFormat(format); executed: return dateFormat(format) + QLatin1Char(' ') + timeFormat(format); Execution Count:85 | 85 |
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:2040 | 2040 |
1247 | } | - |
1248 | | - |
1249 | | - |
1250 | | - |
1251 | | - |
1252 | | - |
1253 | | - |
1254 | QChar QLocale::groupSeparator() const | - |
1255 | { | - |
1256 | return d->group(); executed: return d->group(); Execution Count:5860 | 5860 |
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:44 | 44 |
1277 | } | - |
1278 | | - |
1279 | | - |
1280 | | - |
1281 | | - |
1282 | | - |
1283 | | - |
1284 | QChar QLocale::negativeSign() const | - |
1285 | { | - |
1286 | return d->minus(); executed: return d->minus(); Execution Count:57111 | 57111 |
1287 | } | - |
1288 | | - |
1289 | | - |
1290 | | - |
1291 | | - |
1292 | | - |
1293 | | - |
1294 | QChar QLocale::positiveSign() const | - |
1295 | { | - |
1296 | return d->plus(); executed: return d->plus(); Execution Count:35725 | 35725 |
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:969 | 969 |
1312 | } | - |
1313 | | - |
1314 | static char qToLower(char c) | - |
1315 | { | - |
1316 | if (c >= 'A' && c <= 'Z') partially evaluated: c >= 'A' yes Evaluation Count:969 | no Evaluation Count:0 |
partially evaluated: c <= 'Z' no Evaluation Count:0 | yes Evaluation Count:969 |
| 0-969 |
1317 | return c - 'A' + 'a'; never executed: return c - 'A' + 'a'; | 0 |
1318 | else | - |
1319 | return c; executed: return c; Execution Count:969 | 969 |
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:969 |
| 0-969 |
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:901 | 901 |
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:958 | yes Evaluation Count:11 |
| 11-958 |
1345 | flags |= QLocalePrivate::ThousandsGroup; executed: flags |= QLocalePrivate::ThousandsGroup; Execution Count:958 | 958 |
1346 | return d->doubleToString(i, prec, form, -1, flags); executed: return d->doubleToString(i, prec, form, -1, flags); Execution Count:969 | 969 |
1347 | } | - |
1348 | QLocale QLocale::system() | - |
1349 | { | - |
1350 | return QLocale(*new QLocalePrivate(localeDataIndex(systemData()))); executed: return QLocale(*new QLocalePrivate(localeDataIndex(systemData()))); Execution Count:4384 | 4384 |
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:26997 |
evaluated: month > 12 yes Evaluation Count:6 | yes Evaluation Count:26991 |
| 6-26997 |
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:14877 |
| 12114-14877 |
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:4408 | 4408 |
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:10466 | 10466 |
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:14877 | 14877 |
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:1185 |
partially evaluated: month > 12 no Evaluation Count:0 | yes Evaluation Count:1185 |
| 0-1185 |
1434 | return QString(); never executed: return QString(); | 0 |
1435 | | - |
1436 | | - |
1437 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:500 | yes Evaluation Count:685 |
| 500-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:500 | no Evaluation Count:0 |
| 0-500 |
1442 | return res.toString(); executed: return res.toString(); Execution Count:500 | 500 |
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:2393 |
partially evaluated: day > 7 no Evaluation Count:0 | yes Evaluation Count:2393 |
| 0-2393 |
1471 | return QString(); never executed: return QString(); | 0 |
1472 | | - |
1473 | | - |
1474 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:786 | yes Evaluation Count:1607 |
| 786-1607 |
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:786 | no Evaluation Count:0 |
| 0-786 |
1479 | return res.toString(); executed: return res.toString(); Execution Count:786 | 786 |
1480 | } | 0 |
1481 | | - |
1482 | if (day == 7) evaluated: day == 7 yes Evaluation Count:283 | yes Evaluation Count:1324 |
| 283-1324 |
1483 | day = 0; executed: day = 0; Execution Count:283 | 283 |
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:1294 | 1294 |
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:1607 | 1607 |
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:20 | yes Evaluation Count:35 |
| 20-35 |
1553 | QVariant res = systemLocale()->query(QSystemLocale::FirstDayOfWeek, QVariant()); | - |
1554 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
1555 | return static_cast<Qt::DayOfWeek>(res.toUInt()); executed: return static_cast<Qt::DayOfWeek>(res.toUInt()); Execution Count:20 | 20 |
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:35 | 35 |
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:659 | yes Evaluation Count:1066 |
| 659-1066 |
1679 | QVariant res = systemLocale()->query(QSystemLocale::AMText, QVariant()); | - |
1680 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:659 | no Evaluation Count:0 |
| 0-659 |
1681 | return res.toString(); executed: return res.toString(); Execution Count:659 | 659 |
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:1066 | 1066 |
1685 | } | - |
1686 | QString QLocale::pmText() const | - |
1687 | { | - |
1688 | | - |
1689 | if (d->m_data == systemData()) { evaluated: d->m_data == systemData() yes Evaluation Count:116 | yes Evaluation Count:1289 |
| 116-1289 |
1690 | QVariant res = systemLocale()->query(QSystemLocale::PMText, QVariant()); | - |
1691 | if (!res.isNull()) partially evaluated: !res.isNull() yes Evaluation Count:116 | no Evaluation Count:0 |
| 0-116 |
1692 | return res.toString(); executed: return res.toString(); Execution Count:116 | 116 |
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:1289 | 1289 |
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:5702 | yes Evaluation Count:1576 |
evaluated: !date->isValid() yes Evaluation Count:3 | yes Evaluation Count:5699 |
evaluated: time yes Evaluation Count:5656 | yes Evaluation Count:1619 |
evaluated: !time->isValid() yes Evaluation Count:1 | yes Evaluation Count:5655 |
| 1-5702 |
1704 | return QString(); executed: return QString(); Execution Count:4 | 4 |
1705 | const bool format_am_pm = time && timeFormatContainsAP(format); evaluated: time yes Evaluation Count:5655 | yes Evaluation Count:1619 |
evaluated: timeFormatContainsAP(format) yes Evaluation Count:2338 | yes Evaluation Count:3317 |
| 1619-5655 |
1706 | | - |
1707 | enum { AM, PM } am_pm = AM; | - |
1708 | int hour12 = time ? time->hour() : -1; evaluated: time yes Evaluation Count:5655 | yes Evaluation Count:1619 |
| 1619-5655 |
1709 | if (time) { evaluated: time yes Evaluation Count:5655 | yes Evaluation Count:1619 |
| 1619-5655 |
1710 | if (hour12 == 0) { evaluated: hour12 == 0 yes Evaluation Count:2065 | yes Evaluation Count:3590 |
| 2065-3590 |
1711 | am_pm = AM; | - |
1712 | hour12 = 12; | - |
1713 | } else if (hour12 < 12) { executed: } Execution Count:2065 evaluated: hour12 < 12 yes Evaluation Count:1883 | yes Evaluation Count:1707 |
| 1707-2065 |
1714 | am_pm = AM; | - |
1715 | } else if (hour12 == 12) { executed: } Execution Count:1883 evaluated: hour12 == 12 yes Evaluation Count:446 | yes Evaluation Count:1261 |
| 446-1883 |
1716 | am_pm = PM; | - |
1717 | } else { executed: } Execution Count:446 | 446 |
1718 | am_pm = PM; | - |
1719 | hour12 -= 12; | - |
1720 | } executed: } Execution Count:1261 | 1261 |
1721 | } | - |
1722 | | - |
1723 | QString result; | - |
1724 | | - |
1725 | int i = 0; | - |
1726 | while (i < format.size()) { evaluated: i < format.size() yes Evaluation Count:48150 | yes Evaluation Count:7274 |
| 7274-48150 |
1727 | if (format.at(i).unicode() == '\'') { evaluated: format.at(i).unicode() == '\'' yes Evaluation Count:776 | yes Evaluation Count:47374 |
| 776-47374 |
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:39493 | yes Evaluation Count:7881 |
| 7881-39493 |
1736 | switch (c.unicode()) { | - |
1737 | case 'y': | - |
1738 | used = true; | - |
1739 | if (repeat >= 4) evaluated: repeat >= 4 yes Evaluation Count:1949 | yes Evaluation Count:2234 |
| 1949-2234 |
1740 | repeat = 4; executed: repeat = 4; Execution Count:1949 | 1949 |
1741 | else if (repeat >= 2) evaluated: repeat >= 2 yes Evaluation Count:2222 | yes Evaluation Count:12 |
| 12-2222 |
1742 | repeat = 2; executed: repeat = 2; Execution Count:2222 | 2222 |
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:2222 | 2222 |
1752 | default: | - |
1753 | repeat = 1; | - |
1754 | result.append(c); | - |
1755 | break; executed: break; Execution Count:12 | 12 |
1756 | } | - |
1757 | break; executed: break; Execution Count:4183 | 4183 |
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:1664 | 1664 |
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:4247 | 4247 |
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:1837 | 1837 |
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:4952 | 4952 |
1796 | | - |
1797 | default: | - |
1798 | break; executed: break; Execution Count:26111 | 26111 |
1799 | } | - |
1800 | } executed: } Execution Count:39493 | 39493 |
1801 | if (!used && time) { evaluated: !used yes Evaluation Count:33992 | yes Evaluation Count:13382 |
evaluated: time yes Evaluation Count:30777 | yes Evaluation Count:3215 |
| 3215-33992 |
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:2287 | yes Evaluation Count:1667 |
| 1667-2287 |
1807 | | - |
1808 | switch (repeat) { | - |
1809 | case 1: | - |
1810 | result.append(longLongToString(hour)); | - |
1811 | break; executed: break; Execution Count:1643 | 1643 |
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:3954 | 3954 |
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:3841 | 3841 |
1841 | } | - |
1842 | break; executed: break; Execution Count:3946 | 3946 |
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:1571 | no Evaluation Count:0 |
partially evaluated: format.at(i + 1).unicode() == 'P' yes Evaluation Count:1571 | no Evaluation Count:0 |
| 0-1571 |
1870 | repeat = 2; | - |
1871 | } else { executed: } Execution Count:1571 | 1571 |
1872 | repeat = 1; | - |
1873 | } | 0 |
1874 | result.append(am_pm == AM ? q->amText().toUpper() : q->pmText().toUpper()); | - |
1875 | break; executed: break; Execution Count:1571 | 1571 |
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:17722 | 17722 |
1901 | } | - |
1902 | } executed: } Execution Count:30777 | 30777 |
1903 | if (!used) { evaluated: !used yes Evaluation Count:20937 | yes Evaluation Count:26437 |
| 20937-26437 |
1904 | result.append(QString(repeat, c)); | - |
1905 | } executed: } Execution Count:20937 | 20937 |
1906 | i += repeat; | - |
1907 | } executed: } Execution Count:47374 | 47374 |
1908 | | - |
1909 | return result; executed: return result; Execution Count:7274 | 7274 |
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(), | 569752 |
1919 | group(), decimal(), | 569752 |
1920 | d, precision, form, width, flags); executed: return QLocalePrivate::doubleToString(zero(), plus(), minus(), exponential(), group(), decimal(), d, precision, form, width, flags); Execution Count:569752 | 569752 |
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:108474 | yes Evaluation Count:461278 |
| 108474-461278 |
1932 | precision = 6; executed: precision = 6; Execution Count:108474 | 108474 |
1933 | if (width == -1) evaluated: width == -1 yes Evaluation Count:455676 | yes Evaluation Count:114076 |
| 114076-455676 |
1934 | width = 0; executed: width = 0; Execution Count:455676 | 455676 |
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:569230 |
| 522-569230 |
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:568970 |
| 260-568970 |
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:568970 | yes Evaluation Count:782 |
| 782-568970 |
1952 | int decpt, sign; | - |
1953 | QString digits; | - |
1954 | int mode; | - |
1955 | if (form == DFDecimal) evaluated: form == DFDecimal yes Evaluation Count:1601 | yes Evaluation Count:567369 |
| 1601-567369 |
1956 | mode = 3; executed: mode = 3; Execution Count:1601 | 1601 |
1957 | else | - |
1958 | mode = 2; executed: mode = 2; Execution Count:567369 | 567369 |
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:568959 |
| 11-568959 |
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:568970 | 568970 |
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:528985 | yes Evaluation Count:39985 |
| 39985-528985 |
1980 | free(buff); executed: free(buff); Execution Count:528985 | 528985 |
1981 | | - |
1982 | | - |
1983 | if (_zero.unicode() != '0') { partially evaluated: _zero.unicode() != '0' no Evaluation Count:0 | yes Evaluation Count:568970 |
| 0-568970 |
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:564356 |
partially evaluated: flags & ForcePoint no Evaluation Count:0 | yes Evaluation Count:564356 |
| 0-564356 |
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:1601 | 1601 |
2002 | } | - |
2003 | case DFSignificantDigits: { | - |
2004 | PrecisionMode mode = (flags & Alternate) ? evaluated: (flags & Alternate) yes Evaluation Count:4610 | yes Evaluation Count:562748 |
| 4610-562748 |
2005 | PMSignificantDigits : PMChopTrailingZeros; | - |
2006 | | - |
2007 | if (decpt != digits.length() && (decpt <= -4 || decpt > precision)) evaluated: decpt <= -4 yes Evaluation Count:5205 | yes Evaluation Count:372335 |
evaluated: decpt > precision yes Evaluation Count:63054 | yes Evaluation Count:309281 |
evaluated: decpt != digits.length() yes Evaluation Count:377540 | yes Evaluation Count:189818 |
| 5205-377540 |
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, | 499099 |
2013 | digits, decpt, precision, mode, | 499099 |
2014 | always_show_decpt, flags & ThousandsGroup); executed: num_str = decimalForm(_zero, decimal, group, digits, decpt, precision, mode, always_show_decpt, flags & ThousandsGroup); Execution Count:499099 | 499099 |
2015 | break; executed: break; Execution Count:567358 | 567358 |
2016 | } | - |
2017 | } | - |
2018 | | - |
2019 | negative = sign != 0 && !isZero(d); evaluated: sign != 0 yes Evaluation Count:23925 | yes Evaluation Count:545045 |
evaluated: !isZero(d) yes Evaluation Count:23917 | yes Evaluation Count:8 |
| 8-545045 |
2020 | } executed: } Execution Count:568970 | 568970 |
2021 | | - |
2022 | | - |
2023 | | - |
2024 | if (flags & QLocalePrivate::ZeroPadded evaluated: flags & QLocalePrivate::ZeroPadded yes Evaluation Count:4994 | yes Evaluation Count:564758 |
| 4994-564758 |
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:24178 | yes Evaluation Count:545574 |
| 24178-545574 |
2040 | num_str.prepend(minus); executed: num_str.prepend(minus); Execution Count:24178 | 24178 |
2041 | else if (flags & QLocalePrivate::AlwaysShowSign) evaluated: flags & QLocalePrivate::AlwaysShowSign yes Evaluation Count:4738 | yes Evaluation Count:540836 |
| 4738-540836 |
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:538468 |
| 2368-538468 |
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:564753 |
| 4999-564753 |
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:569752 | 569752 |
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(), | 2814374 |
2057 | l, precision, base, width, flags); executed: return QLocalePrivate::longLongToString(zero(), group(), plus(), minus(), l, precision, base, width, flags); Execution Count:2814374 | 2814374 |
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:2813174 | yes Evaluation Count:69470 |
| 69470-2813174 |
2068 | precision_not_specified = true; | - |
2069 | precision = 1; | - |
2070 | } executed: } Execution Count:2813174 | 2813174 |
2071 | | - |
2072 | bool negative = l < 0; | - |
2073 | if (base != 10) { evaluated: base != 10 yes Evaluation Count:2495 | yes Evaluation Count:2880148 |
| 2495-2880148 |
2074 | | - |
2075 | flags &= ~AlwaysShowSign; | - |
2076 | flags &= ~BlankBeforePositive; | - |
2077 | negative = false; | - |
2078 | } executed: } Execution Count:2495 | 2495 |
2079 | | - |
2080 | QString num_str; | - |
2081 | if (base == 10) evaluated: base == 10 yes Evaluation Count:2880147 | yes Evaluation Count:2495 |
| 2495-2880147 |
2082 | num_str = qlltoa(l, base, zero); executed: num_str = qlltoa(l, base, zero); Execution Count:2880149 | 2880149 |
2083 | else | - |
2084 | num_str = qulltoa(l, base, zero); executed: num_str = qulltoa(l, base, zero); Execution Count:2495 | 2495 |
2085 | | - |
2086 | uint cnt_thousand_sep = 0; | - |
2087 | if (flags & ThousandsGroup && base == 10) { evaluated: flags & ThousandsGroup yes Evaluation Count:1604 | yes Evaluation Count:2881035 |
partially evaluated: base == 10 yes Evaluation Count:1604 | no Evaluation Count:0 |
| 0-2881035 |
2088 | for (int i = num_str.length() - 3; i > 0; i -= 3) { evaluated: i > 0 yes Evaluation Count:685 | yes Evaluation Count:1604 |
| 685-1604 |
2089 | num_str.insert(i, group); | - |
2090 | ++cnt_thousand_sep; | - |
2091 | } executed: } Execution Count:685 | 685 |
2092 | } executed: } Execution Count:1604 | 1604 |
2093 | | - |
2094 | for (int i = num_str.length() ; i < precision; ++i) evaluated: i < precision yes Evaluation Count:143896 | yes Evaluation Count:2882639 |
| 143896-2882639 |
2095 | num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); Execution Count:143896 | 143896 |
2096 | | - |
2097 | if ((flags & Alternate || flags & ShowBase) partially evaluated: flags & Alternate no Evaluation Count:0 | yes Evaluation Count:2882639 |
partially evaluated: flags & ShowBase no Evaluation Count:0 | yes Evaluation Count:2882642 |
| 0-2882642 |
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:16801 | yes Evaluation Count:2865840 |
| 16801-2865840 |
2105 | && !(flags & LeftAdjusted) partially evaluated: !(flags & LeftAdjusted) yes Evaluation Count:16801 | no Evaluation Count:0 |
| 0-16801 |
2106 | && precision_not_specified; partially evaluated: precision_not_specified yes Evaluation Count:16801 | no Evaluation Count:0 |
| 0-16801 |
2107 | | - |
2108 | if (zero_padded) { evaluated: zero_padded yes Evaluation Count:16801 | yes Evaluation Count:2865839 |
| 16801-2865839 |
2109 | int num_pad_chars = width - num_str.length(); | - |
2110 | | - |
2111 | | - |
2112 | if (negative evaluated: negative yes Evaluation Count:18 | yes Evaluation Count:16783 |
| 18-16783 |
2113 | || flags & AlwaysShowSign partially evaluated: flags & AlwaysShowSign no Evaluation Count:0 | yes Evaluation Count:16783 |
| 0-16783 |
2114 | || flags & BlankBeforePositive) partially evaluated: flags & BlankBeforePositive no Evaluation Count:0 | yes Evaluation Count:16783 |
| 0-16783 |
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:16801 |
never evaluated: flags & Alternate never evaluated: flags & ShowBase | 0-16801 |
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:16801 |
never evaluated: flags & Alternate never evaluated: flags & ShowBase | 0-16801 |
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:8230 | yes Evaluation Count:16801 |
| 8230-16801 |
2125 | num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); Execution Count:8230 | 8230 |
2126 | } executed: } Execution Count:16801 | 16801 |
2127 | | - |
2128 | if (flags & CapitalEorX) partially evaluated: flags & CapitalEorX no Evaluation Count:0 | yes Evaluation Count:2882644 |
| 0-2882644 |
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:2345 | yes Evaluation Count:2880295 |
partially evaluated: flags & Alternate no Evaluation Count:0 | yes Evaluation Count:2345 |
partially evaluated: flags & ShowBase no Evaluation Count:0 | yes Evaluation Count:2345 |
| 0-2880295 |
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:2882639 |
never evaluated: flags & Alternate never evaluated: flags & ShowBase | 0-2882639 |
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:13327 | yes Evaluation Count:2869311 |
| 13327-2869311 |
2138 | num_str.prepend(minus); executed: num_str.prepend(minus); Execution Count:13327 | 13327 |
2139 | else if (flags & AlwaysShowSign) evaluated: flags & AlwaysShowSign yes Evaluation Count:63065 | yes Evaluation Count:2806246 |
| 63065-2806246 |
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:2806248 |
| 0-2806248 |
2142 | num_str.prepend(QLatin1Char(' ')); never executed: num_str.prepend(QLatin1Char(' ')); | 0 |
2143 | | - |
2144 | return num_str; executed: return num_str; Execution Count:2882640 | 2882640 |
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(), | 37773 |
2152 | l, precision, base, width, flags); executed: return QLocalePrivate::unsLongLongToString(zero(), group(), plus(), l, precision, base, width, flags); Execution Count:37773 | 37773 |
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:37768 | no Evaluation Count:0 |
| 0-37768 |
2163 | precision_not_specified = true; | - |
2164 | precision = 1; | - |
2165 | } executed: } Execution Count:37768 | 37768 |
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:37313 |
partially evaluated: base == 10 yes Evaluation Count:454 | no Evaluation Count:0 |
| 0-37313 |
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:13251 | yes Evaluation Count:37766 |
| 13251-37766 |
2178 | num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0')); Execution Count:13251 | 13251 |
2179 | | - |
2180 | if ((flags & Alternate || flags & ShowBase) evaluated: flags & Alternate yes Evaluation Count:35 | yes Evaluation Count:37731 |
evaluated: flags & ShowBase yes Evaluation Count:60 | yes Evaluation Count:37671 |
| 35-37731 |
2181 | && base == 8 evaluated: base == 8 yes Evaluation Count:2 | yes Evaluation Count:93 |
| 2-93 |
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:35724 |
| 2040-35724 |
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:35724 |
| 2040-35724 |
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:37757 |
| 9-37757 |
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:15253 | yes Evaluation Count:22511 |
evaluated: flags & Alternate yes Evaluation Count:35 | yes Evaluation Count:15218 |
evaluated: flags & ShowBase yes Evaluation Count:43 | yes Evaluation Count:15175 |
| 35-22511 |
2209 | num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x")); Execution Count:78 | 78 |
2210 | else if (base == 2 && (flags & Alternate || flags & ShowBase)) evaluated: base == 2 yes Evaluation Count:15 | yes Evaluation Count:37671 |
partially evaluated: flags & Alternate no Evaluation Count:0 | yes Evaluation Count:15 |
evaluated: flags & ShowBase yes Evaluation Count:14 | yes Evaluation Count:1 |
| 0-37671 |
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:37762 |
| 3-37762 |
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:37762 |
| 0-37762 |
2217 | num_str.prepend(QLatin1Char(' ')); never executed: num_str.prepend(QLatin1Char(' ')); | 0 |
2218 | | - |
2219 | return num_str; executed: return num_str; Execution Count:37765 | 37765 |
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:102877 | yes Evaluation Count:11431 |
evaluated: uc[idx].isSpace() yes Evaluation Count:151 | yes Evaluation Count:102725 |
| 151-102877 |
2231 | ++idx; executed: ++idx; Execution Count:151 | 151 |
2232 | if (idx == l) evaluated: idx == l yes Evaluation Count:11431 | yes Evaluation Count:102725 |
| 11431-102725 |
2233 | return false; executed: return false; Execution Count:11431 | 11431 |
2234 | | - |
2235 | while (idx < l) { evaluated: idx < l yes Evaluation Count:263345 | yes Evaluation Count:102062 |
| 102062-263345 |
2236 | const QChar in = uc[idx]; | - |
2237 | | - |
2238 | char out = digitToCLocale(in); | - |
2239 | if (out == 0) { evaluated: out == 0 yes Evaluation Count:111078 | yes Evaluation Count:152269 |
| 111078-152269 |
2240 | if (in == list()) partially evaluated: in == list() no Evaluation Count:0 | yes Evaluation Count:111078 |
| 0-111078 |
2241 | out = ';'; never executed: out = ';'; | 0 |
2242 | else if (in == percent()) evaluated: in == percent() yes Evaluation Count:4 | yes Evaluation Count:111074 |
| 4-111074 |
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:110425 | yes Evaluation Count:649 |
evaluated: in.unicode() <= 'Z' yes Evaluation Count:97708 | yes Evaluation Count:12717 |
| 649-110425 |
2246 | out = in.toLower().toLatin1(); executed: out = in.toLower().toLatin1(); Execution Count:97708 | 97708 |
2247 | else if (in.unicode() >= 'a' && in.unicode() <= 'z') evaluated: in.unicode() >= 'a' yes Evaluation Count:12707 | yes Evaluation Count:659 |
evaluated: in.unicode() <= 'z' yes Evaluation Count:12702 | yes Evaluation Count:5 |
| 5-12707 |
2248 | out = in.toLatin1(); executed: out = in.toLatin1(); Execution Count:12702 | 12702 |
2249 | else | - |
2250 | break; executed: break; Execution Count:664 | 664 |
2251 | } | - |
2252 | | - |
2253 | result->append(out); | - |
2254 | | - |
2255 | ++idx; | - |
2256 | } executed: } Execution Count:262682 | 262682 |
2257 | | - |
2258 | | - |
2259 | for (; idx < l; ++idx) { evaluated: idx < l yes Evaluation Count:743 | yes Evaluation Count:102122 |
| 743-102122 |
2260 | if (!uc[idx].isSpace()) evaluated: !uc[idx].isSpace() yes Evaluation Count:604 | yes Evaluation Count:139 |
| 139-604 |
2261 | return false; executed: return false; Execution Count:604 | 604 |
2262 | } executed: } Execution Count:139 | 139 |
2263 | | - |
2264 | result->append('\0'); | - |
2265 | | - |
2266 | | - |
2267 | if (group_sep_mode == ParseGroupSeparators evaluated: group_sep_mode == ParseGroupSeparators yes Evaluation Count:13217 | yes Evaluation Count:88906 |
| 13217-88906 |
2268 | && !removeGroupSeparators(result)) evaluated: !removeGroupSeparators(result) yes Evaluation Count:71 | yes Evaluation Count:13146 |
| 71-13146 |
2269 | return false; executed: return false; Execution Count:71 | 71 |
2270 | | - |
2271 | | - |
2272 | return true; executed: return true; Execution Count:102052 | 102052 |
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:1396 | yes Evaluation Count:281 |
| 281-1396 |
2290 | char c = digitToCLocale(str.at(i)); | - |
2291 | | - |
2292 | if (c >= '0' && c <= '9') { evaluated: c >= '0' yes Evaluation Count:1138 | yes Evaluation Count:258 |
evaluated: c <= '9' yes Evaluation Count:1034 | yes Evaluation Count:104 |
| 104-1138 |
2293 | if (numMode != IntegerMode) { evaluated: numMode != IntegerMode yes Evaluation Count:695 | yes Evaluation Count:339 |
| 339-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:1022 | 1022 |
2300 | switch (c) { | - |
2301 | case '.': | - |
2302 | if (numMode == IntegerMode) { evaluated: numMode == IntegerMode yes Evaluation Count:5 | yes Evaluation Count:62 |
| 5-62 |
2303 | | - |
2304 | return false; executed: return false; Execution Count:5 | 5 |
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:93 |
| 56-93 |
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:89 |
| 4-89 |
2331 | return false; executed: return false; Execution Count:4 | 4 |
2332 | } executed: } Execution Count:89 | 89 |
2333 | break; executed: break; Execution Count:145 | 145 |
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:27 | 27 |
2356 | } | - |
2357 | lastWasDigit = false; | - |
2358 | } executed: } Execution Count:272 | 272 |
2359 | | - |
2360 | lastWasE = c == 'e'; | - |
2361 | if (c != ',') evaluated: c != ',' yes Evaluation Count:1281 | yes Evaluation Count:13 |
| 13-1281 |
2362 | buff->append(c); executed: buff->append(c); Execution Count:1281 | 1281 |
2363 | } executed: } Execution Count:1294 | 1294 |
2364 | | - |
2365 | return true; executed: return true; Execution Count:281 | 281 |
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-3613 |
2373 | group_sep_mode, &buff)) { evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff) yes Evaluation Count:93 | yes Evaluation Count:3613 |
| 93-3613 |
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:3613 | 3613 |
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, | 11425-74387 |
2386 | group_sep_mode, &buff)) { evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff) yes Evaluation Count:11425 | yes Evaluation Count:74387 |
| 11425-74387 |
2387 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:11404 | yes Evaluation Count:21 |
| 21-11404 |
2388 | *ok = false; executed: *ok = false; Execution Count:11404 | 11404 |
2389 | return 0; executed: return 0; Execution Count:11425 | 11425 |
2390 | } | - |
2391 | | - |
2392 | return bytearrayToLongLong(buff.constData(), base, ok); executed: return bytearrayToLongLong(buff.constData(), base, ok); Execution Count:74387 | 74387 |
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, | 588-24051 |
2400 | group_sep_mode, &buff)) { evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff) yes Evaluation Count:588 | yes Evaluation Count:24051 |
| 588-24051 |
2401 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:584 | yes Evaluation Count:4 |
| 4-584 |
2402 | *ok = false; executed: *ok = false; Execution Count:584 | 584 |
2403 | return 0; executed: return 0; Execution Count:588 | 588 |
2404 | } | - |
2405 | | - |
2406 | return bytearrayToUnsLongLong(buff.constData(), base, ok); executed: return bytearrayToUnsLongLong(buff.constData(), base, ok); Execution Count:24051 | 24051 |
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:3176 | yes Evaluation Count:989 |
| 989-3176 |
2413 | *ok = true; executed: *ok = true; Execution Count:3176 | 3176 |
2414 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:157 | yes Evaluation Count:4008 |
| 157-4008 |
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:4165 |
| 0-4165 |
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:4158 |
| 7-4158 |
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:4155 |
evaluated: qstrcmp(num, "inf") == 0 yes Evaluation Count:6 | yes Evaluation Count:4149 |
| 3-4155 |
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:4147 |
| 2-4147 |
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:4143 |
| 4-4143 |
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:3838 |
| 305-3838 |
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:2849 | yes Evaluation Count:989 |
| 989-2849 |
2456 | *ok = true; executed: *ok = true; Execution Count:2849 | 2849 |
2457 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:109 | yes Evaluation Count:3729 |
| 109-3729 |
2458 | *overflow = false; executed: *overflow = false; Execution Count:109 | 109 |
2459 | return d; executed: return d; Execution Count:3838 | 3838 |
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:463 | yes Evaluation Count:254507 |
| 463-254507 |
2468 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:1 | yes Evaluation Count:462 |
| 1-462 |
2469 | *ok = false; executed: *ok = false; Execution Count:1 | 1 |
2470 | if (overflow != 0) partially evaluated: overflow != 0 no Evaluation Count:0 | yes Evaluation Count:463 |
| 0-463 |
2471 | *overflow = false; never executed: *overflow = false; | 0 |
2472 | return 0; executed: return 0; Execution Count:463 | 463 |
2473 | } | - |
2474 | | - |
2475 | qlonglong l = qstrtoll(num, &endptr, base, &_ok); | - |
2476 | | - |
2477 | if (!_ok) { evaluated: !_ok yes Evaluation Count:124 | yes Evaluation Count:254385 |
| 124-254385 |
2478 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:103 | yes Evaluation Count:21 |
| 21-103 |
2479 | *ok = false; executed: *ok = false; Execution Count:103 | 103 |
2480 | if (overflow != 0) { evaluated: overflow != 0 yes Evaluation Count:1 | yes Evaluation Count:123 |
| 1-123 |
2481 | | - |
2482 | | - |
2483 | *overflow = *endptr != '\0'; | - |
2484 | } executed: } Execution Count:1 | 1 |
2485 | return 0; executed: return 0; Execution Count:124 | 124 |
2486 | } | - |
2487 | | - |
2488 | if (*endptr != '\0') { evaluated: *endptr != '\0' yes Evaluation Count:48 | yes Evaluation Count:254337 |
| 48-254337 |
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:185352 | yes Evaluation Count:68985 |
| 68985-185352 |
2498 | *ok = true; executed: *ok = true; Execution Count:185352 | 185352 |
2499 | if (overflow != 0) evaluated: overflow != 0 yes Evaluation Count:79 | yes Evaluation Count:254258 |
| 79-254258 |
2500 | *overflow = false; executed: *overflow = false; Execution Count:79 | 79 |
2501 | return l; executed: return l; Execution Count:254338 | 254338 |
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:623 | yes Evaluation Count:26688 |
evaluated: *endptr != '\0' yes Evaluation Count:118 | yes Evaluation Count:26570 |
| 118-26688 |
2511 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:728 | yes Evaluation Count:13 |
| 13-728 |
2512 | *ok = false; executed: *ok = false; Execution Count:728 | 728 |
2513 | return 0; executed: return 0; Execution Count:741 | 741 |
2514 | } | - |
2515 | | - |
2516 | if (ok != 0) evaluated: ok != 0 yes Evaluation Count:25375 | yes Evaluation Count:1195 |
| 1195-25375 |
2517 | *ok = true; executed: *ok = true; Execution Count:25375 | 25375 |
2518 | return l; executed: return l; Execution Count:26570 | 26570 |
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 | | - |
| | |