tools/qlocale.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtCore module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#if !defined(QWS) && defined(Q_OS_MAC) -
43# include "private/qcore_mac_p.h" -
44# include <CoreFoundation/CoreFoundation.h> -
45#endif -
46 -
47#include "qglobal.h" -
48 -
49#include "qplatformdefs.h" -
50 -
51#include "qdatastream.h" -
52#include "qdebug.h" -
53#include "qstring.h" -
54#include "qlocale.h" -
55#include "qlocale_p.h" -
56#include "qlocale_tools_p.h" -
57#include "qdatetime_p.h" -
58#include "qnamespace.h" -
59#include "qdatetime.h" -
60#include "qstringlist.h" -
61#include "qvariant.h" -
62#include "qstringbuilder.h" -
63#include "private/qnumeric_p.h" -
64#include "private/qsystemlibrary_p.h" -
65#ifdef Q_OS_WIN -
66# include <qt_windows.h> -
67# include <time.h> -
68#endif -
69 -
70QT_BEGIN_NAMESPACE -
71 -
72#ifndef QT_NO_SYSTEMLOCALE -
73static QSystemLocale *_systemLocale = 0; -
74class QSystemLocaleSingleton: public QSystemLocale -
75{ -
76public: -
77 QSystemLocaleSingleton() : QSystemLocale(true) {}
executed: }
Execution Count:45
45
78}; -
79 -
80Q_GLOBAL_STATIC(QSystemLocaleSingleton, QSystemLocale_globalSystemLocale)
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:17754
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:17709
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-17754
81static QLocaleData *system_data = 0; -
82Q_GLOBAL_STATIC(QLocaleData, globalLocaleData)
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:45
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45
partially evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
83#endif -
84 -
85/****************************************************************************** -
86** Helpers for accessing Qt locale database -
87*/ -
88 -
89QT_BEGIN_INCLUDE_NAMESPACE -
90#include "qlocale_data_p.h" -
91QT_END_INCLUDE_NAMESPACE -
92 -
93QLocale::Language QLocalePrivate::codeToLanguage(const QString &code) -
94{ -
95 int len = code.length();
executed (the execution status of this line is deduced): int len = code.length();
-
96 if (len != 2 && len != 3)
evaluated: len != 2
TRUEFALSE
yes
Evaluation Count:440
yes
Evaluation Count:2884
partially evaluated: len != 3
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:440
0-2884
97 return QLocale::C;
never executed: return QLocale::C;
0
98 ushort uc1 = len-- > 0 ? code[0].toLower().unicode() : 0;
partially evaluated: len-- > 0
TRUEFALSE
yes
Evaluation Count:3324
no
Evaluation Count:0
0-3324
99 ushort uc2 = len-- > 0 ? code[1].toLower().unicode() : 0;
partially evaluated: len-- > 0
TRUEFALSE
yes
Evaluation Count:3324
no
Evaluation Count:0
0-3324
100 ushort uc3 = len-- > 0 ? code[2].toLower().unicode() : 0;
evaluated: len-- > 0
TRUEFALSE
yes
Evaluation Count:440
yes
Evaluation Count:2884
440-2884
101 -
102 const unsigned char *c = language_code_list;
executed (the execution status of this line is deduced): const unsigned char *c = language_code_list;
-
103 for (; *c != 0; c += 3) {
evaluated: *c != 0
TRUEFALSE
yes
Evaluation Count:269564
yes
Evaluation Count:47
47-269564
104 if (uc1 == c[0] && uc2 == c[1] && uc3 == c[2])
evaluated: uc1 == c[0]
TRUEFALSE
yes
Evaluation Count:17715
yes
Evaluation Count:251849
evaluated: uc2 == c[1]
TRUEFALSE
yes
Evaluation Count:3585
yes
Evaluation Count:14130
evaluated: uc3 == c[2]
TRUEFALSE
yes
Evaluation Count:3277
yes
Evaluation Count:308
308-251849
105 return QLocale::Language((c - language_code_list)/3);
executed: return QLocale::Language((c - language_code_list)/3);
Execution Count:3277
3277
106 }
executed: }
Execution Count:266287
266287
107 -
108 // legacy codes -
109 if (uc1 == 'n' && uc2 == 'o' && uc3 == 0) { // no -> nb
evaluated: uc1 == 'n'
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:7
partially evaluated: uc2 == 'o'
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
partially evaluated: uc3 == 0
TRUEFALSE
yes
Evaluation Count:40
no
Evaluation Count:0
0-40
110 Q_STATIC_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal);
executed (the execution status of this line is deduced): static_assert(bool(QLocale::Norwegian == QLocale::NorwegianBokmal), "QLocale::Norwegian == QLocale::NorwegianBokmal");
-
111 return QLocale::Norwegian;
executed: return QLocale::Norwegian;
Execution Count:40
40
112 } -
113 if (uc1 == 't' && uc2 == 'l' && uc3 == 0) { // tl -> fil
evaluated: uc1 == 't'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
partially evaluated: uc2 == 'l'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: uc3 == 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-6
114 Q_STATIC_ASSERT(QLocale::Tagalog == QLocale::Filipino);
executed (the execution status of this line is deduced): static_assert(bool(QLocale::Tagalog == QLocale::Filipino), "QLocale::Tagalog == QLocale::Filipino");
-
115 return QLocale::Tagalog;
executed: return QLocale::Tagalog;
Execution Count:1
1
116 } -
117 if (uc1 == 's' && uc2 == 'h' && uc3 == 0) { // sh -> sr[_Latn]
evaluated: uc1 == 's'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
partially evaluated: uc2 == 'h'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: uc3 == 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-5
118 Q_STATIC_ASSERT(QLocale::SerboCroatian == QLocale::Serbian);
executed (the execution status of this line is deduced): static_assert(bool(QLocale::SerboCroatian == QLocale::Serbian), "QLocale::SerboCroatian == QLocale::Serbian");
-
119 return QLocale::SerboCroatian;
executed: return QLocale::SerboCroatian;
Execution Count:1
1
120 } -
121 if (uc1 == 'm' && uc2 == 'o' && uc3 == 0) { // mo -> ro
evaluated: uc1 == 'm'
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
partially evaluated: uc2 == 'o'
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: uc3 == 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-4
122 Q_STATIC_ASSERT(QLocale::Moldavian == QLocale::Romanian);
executed (the execution status of this line is deduced): static_assert(bool(QLocale::Moldavian == QLocale::Romanian), "QLocale::Moldavian == QLocale::Romanian");
-
123 return QLocale::Moldavian;
executed: return QLocale::Moldavian;
Execution Count:1
1
124 } -
125 -
126 return QLocale::C;
executed: return QLocale::C;
Execution Count:4
4
127} -
128 -
129QLocale::Script QLocalePrivate::codeToScript(const QString &code) -
130{ -
131 int len = code.length();
executed (the execution status of this line is deduced): int len = code.length();
-
132 if (len != 4)
evaluated: len != 4
TRUEFALSE
yes
Evaluation Count:3308
yes
Evaluation Count:12
12-3308
133 return QLocale::AnyScript;
executed: return QLocale::AnyScript;
Execution Count:3308
3308
134 -
135 // script is titlecased in our data -
136 unsigned char c0 = code.at(0).toUpper().toLatin1();
executed (the execution status of this line is deduced): unsigned char c0 = code.at(0).toUpper().toLatin1();
-
137 unsigned char c1 = code.at(1).toLower().toLatin1();
executed (the execution status of this line is deduced): unsigned char c1 = code.at(1).toLower().toLatin1();
-
138 unsigned char c2 = code.at(2).toLower().toLatin1();
executed (the execution status of this line is deduced): unsigned char c2 = code.at(2).toLower().toLatin1();
-
139 unsigned char c3 = code.at(3).toLower().toLatin1();
executed (the execution status of this line is deduced): unsigned char c3 = code.at(3).toLower().toLatin1();
-
140 -
141 const unsigned char *c = script_code_list;
executed (the execution status of this line is deduced): const unsigned char *c = script_code_list;
-
142 for (int i = 0; i < QLocale::LastScript; ++i, c += 4) {
partially evaluated: i < QLocale::LastScript
TRUEFALSE
yes
Evaluation Count:72
no
Evaluation Count:0
0-72
143 if (c0 == c[0] && c1 == c[1] && c2 == c[2] && c3 == c[3])
evaluated: c0 == c[0]
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:57
partially evaluated: c1 == c[1]
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
partially evaluated: c2 == c[2]
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
evaluated: c3 == c[3]
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3
0-57
144 return QLocale::Script(i);
executed: return QLocale::Script(i);
Execution Count:12
12
145 }
executed: }
Execution Count:60
60
146 return QLocale::AnyScript;
never executed: return QLocale::AnyScript;
0
147} -
148 -
149QLocale::Country QLocalePrivate::codeToCountry(const QString &code) -
150{ -
151 int len = code.length();
executed (the execution status of this line is deduced): int len = code.length();
-
152 if (len != 2 && len != 3)
evaluated: len != 2
TRUEFALSE
yes
Evaluation Count:1400
yes
Evaluation Count:1920
evaluated: len != 3
TRUEFALSE
yes
Evaluation Count:519
yes
Evaluation Count:881
519-1920
153 return QLocale::AnyCountry;
executed: return QLocale::AnyCountry;
Execution Count:519
519
154 ushort uc1 = len-- > 0 ? code[0].toUpper().unicode() : 0;
partially evaluated: len-- > 0
TRUEFALSE
yes
Evaluation Count:2801
no
Evaluation Count:0
0-2801
155 ushort uc2 = len-- > 0 ? code[1].toUpper().unicode() : 0;
partially evaluated: len-- > 0
TRUEFALSE
yes
Evaluation Count:2801
no
Evaluation Count:0
0-2801
156 ushort uc3 = len-- > 0 ? code[2].toUpper().unicode() : 0;
evaluated: len-- > 0
TRUEFALSE
yes
Evaluation Count:881
yes
Evaluation Count:1920
881-1920
157 -
158 const unsigned char *c = country_code_list;
executed (the execution status of this line is deduced): const unsigned char *c = country_code_list;
-
159 for (; *c != 0; c += 3) {
evaluated: *c != 0
TRUEFALSE
yes
Evaluation Count:510975
yes
Evaluation Count:876
876-510975
160 if (uc1 == c[0] && uc2 == c[1] && uc3 == c[2])
evaluated: uc1 == c[0]
TRUEFALSE
yes
Evaluation Count:17282
yes
Evaluation Count:493693
evaluated: uc2 == c[1]
TRUEFALSE
yes
Evaluation Count:2801
yes
Evaluation Count:14481
evaluated: uc3 == c[2]
TRUEFALSE
yes
Evaluation Count:1925
yes
Evaluation Count:876
876-493693
161 return QLocale::Country((c - country_code_list)/3);
executed: return QLocale::Country((c - country_code_list)/3);
Execution Count:1925
1925
162 }
executed: }
Execution Count:509050
509050
163 -
164 return QLocale::AnyCountry;
executed: return QLocale::AnyCountry;
Execution Count:876
876
165} -
166 -
167QString QLocalePrivate::languageCode() const -
168{ -
169 if (m_data->m_language_id == QLocale::AnyLanguage)
partially evaluated: m_data->m_language_id == QLocale::AnyLanguage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2615
0-2615
170 return QString();
never executed: return QString();
0
171 if (m_data->m_language_id == QLocale::C)
evaluated: m_data->m_language_id == QLocale::C
TRUEFALSE
yes
Evaluation Count:101
yes
Evaluation Count:2514
101-2514
172 return QLatin1String("C");
executed: return QLatin1String("C");
Execution Count:101
101
173 -
174 const unsigned char *c = language_code_list + 3*(uint(m_data->m_language_id));
executed (the execution status of this line is deduced): const unsigned char *c = language_code_list + 3*(uint(m_data->m_language_id));
-
175 -
176 QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized);
executed (the execution status of this line is deduced): QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized);
-
177 -
178 code[0] = ushort(c[0]);
executed (the execution status of this line is deduced): code[0] = ushort(c[0]);
-
179 code[1] = ushort(c[1]);
executed (the execution status of this line is deduced): code[1] = ushort(c[1]);
-
180 if (c[2] != 0)
evaluated: c[2] != 0
TRUEFALSE
yes
Evaluation Count:292
yes
Evaluation Count:2222
292-2222
181 code[2] = ushort(c[2]);
executed: code[2] = ushort(c[2]);
Execution Count:292
292
182 -
183 return code;
executed: return code;
Execution Count:2514
2514
184} -
185 -
186QString QLocalePrivate::scriptCode() const -
187{ -
188 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
189 return QString();
never executed: return QString();
0
190 const unsigned char *c = script_code_list + 4*(uint(m_data->m_script_id));
never executed (the execution status of this line is deduced): const unsigned char *c = script_code_list + 4*(uint(m_data->m_script_id));
-
191 return QString::fromLatin1((const char *)c, 4);
never executed: return QString::fromLatin1((const char *)c, 4);
0
192} -
193 -
194QString QLocalePrivate::countryCode() const -
195{ -
196 if (m_data->m_country_id == QLocale::AnyCountry)
partially evaluated: m_data->m_country_id == QLocale::AnyCountry
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2514
0-2514
197 return QString();
never executed: return QString();
0
198 -
199 const unsigned char *c = country_code_list + 3*(uint(m_data->m_country_id));
executed (the execution status of this line is deduced): const unsigned char *c = country_code_list + 3*(uint(m_data->m_country_id));
-
200 -
201 QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized);
executed (the execution status of this line is deduced): QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized);
-
202 -
203 code[0] = ushort(c[0]);
executed (the execution status of this line is deduced): code[0] = ushort(c[0]);
-
204 code[1] = ushort(c[1]);
executed (the execution status of this line is deduced): code[1] = ushort(c[1]);
-
205 if (c[2] != 0)
evaluated: c[2] != 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2510
4-2510
206 code[2] = ushort(c[2]);
executed: code[2] = ushort(c[2]);
Execution Count:4
4
207 -
208 return code;
executed: return code;
Execution Count:2514
2514
209} -
210 -
211// http://www.unicode.org/reports/tr35/#Likely_Subtags -
212static bool addLikelySubtags(QLocaleId &localeId) -
213{ -
214 // ### optimize with bsearch -
215 const int likely_subtags_count = sizeof(likely_subtags) / sizeof(likely_subtags[0]);
executed (the execution status of this line is deduced): const int likely_subtags_count = sizeof(likely_subtags) / sizeof(likely_subtags[0]);
-
216 const QLocaleId *p = likely_subtags;
executed (the execution status of this line is deduced): const QLocaleId *p = likely_subtags;
-
217 const QLocaleId *const e = p + likely_subtags_count;
executed (the execution status of this line is deduced): const QLocaleId *const e = p + likely_subtags_count;
-
218 for ( ; p < e; p += 2) {
evaluated: p < e
TRUEFALSE
yes
Evaluation Count:2147483647
yes
Evaluation Count:23061435
23061435-2147483647
219 if (localeId == p[0]) {
evaluated: localeId == p[0]
TRUEFALSE
yes
Evaluation Count:6161475
yes
Evaluation Count:2147483647
6161475-2147483647
220 localeId = p[1];
executed (the execution status of this line is deduced): localeId = p[1];
-
221 return true;
executed: return true;
Execution Count:6161475
6161475
222 } -
223 }
executed: }
Execution Count:2147483647
2147483647
224 return false;
executed: return false;
Execution Count:23061435
23061435
225} -
226 -
227QLocaleId QLocaleId::withLikelySubtagsAdded() const -
228{ -
229 // language_script_region -
230 if (language_id || script_id || country_id) {
evaluated: language_id
TRUEFALSE
yes
Evaluation Count:19984794
yes
Evaluation Count:2
partially evaluated: script_id
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: country_id
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-19984794
231 QLocaleId id = QLocaleId::fromIds(language_id, script_id, country_id);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(language_id, script_id, country_id);
-
232 if (addLikelySubtags(id))
evaluated: addLikelySubtags(id)
TRUEFALSE
yes
Evaluation Count:3079820
yes
Evaluation Count:16904961
3079820-16904961
233 return id;
executed: return id;
Execution Count:3079820
3079820
234 }
executed: }
Execution Count:16904961
16904961
235 // language_script -
236 if (country_id) {
evaluated: country_id
TRUEFALSE
yes
Evaluation Count:3081648
yes
Evaluation Count:13823315
3081648-13823315
237 QLocaleId id = QLocaleId::fromIds(language_id, script_id, 0);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(language_id, script_id, 0);
-
238 if (addLikelySubtags(id)) {
evaluated: addLikelySubtags(id)
TRUEFALSE
yes
Evaluation Count:3395
yes
Evaluation Count:3078253
3395-3078253
239 id.country_id = country_id;
executed (the execution status of this line is deduced): id.country_id = country_id;
-
240 return id;
executed: return id;
Execution Count:3395
3395
241 } -
242 }
executed: }
Execution Count:3078253
3078253
243 // language_region -
244 if (script_id) {
evaluated: script_id
TRUEFALSE
yes
Evaluation Count:3078260
yes
Evaluation Count:13823308
3078260-13823308
245 QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id);
-
246 if (addLikelySubtags(id)) {
evaluated: addLikelySubtags(id)
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:3078221
39-3078221
247 id.script_id = script_id;
executed (the execution status of this line is deduced): id.script_id = script_id;
-
248 return id;
executed: return id;
Execution Count:39
39
249 } -
250 }
executed: }
Execution Count:3078221
3078221
251 // language -
252 if (script_id && country_id) {
evaluated: script_id
TRUEFALSE
yes
Evaluation Count:3078221
yes
Evaluation Count:13823308
partially evaluated: country_id
TRUEFALSE
yes
Evaluation Count:3078221
no
Evaluation Count:0
0-13823308
253 QLocaleId id = QLocaleId::fromIds(language_id, 0, 0);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(language_id, 0, 0);
-
254 if (addLikelySubtags(id)) {
partially evaluated: addLikelySubtags(id)
TRUEFALSE
yes
Evaluation Count:3078221
no
Evaluation Count:0
0-3078221
255 id.script_id = script_id;
executed (the execution status of this line is deduced): id.script_id = script_id;
-
256 id.country_id = country_id;
executed (the execution status of this line is deduced): id.country_id = country_id;
-
257 return id;
executed: return id;
Execution Count:3078221
3078221
258 } -
259 }
never executed: }
0
260 return *this;
executed: return *this;
Execution Count:13823309
13823309
261} -
262 -
263QLocaleId QLocaleId::withLikelySubtagsRemoved() const -
264{ -
265 QLocaleId max = withLikelySubtagsAdded();
executed (the execution status of this line is deduced): QLocaleId max = withLikelySubtagsAdded();
-
266 // language -
267 { -
268 QLocaleId id = QLocaleId::fromIds(language_id, 0, 0);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(language_id, 0, 0);
-
269 if (id.withLikelySubtagsAdded() == max)
evaluated: id.withLikelySubtagsAdded() == max
TRUEFALSE
yes
Evaluation Count:3077224
yes
Evaluation Count:1043
1043-3077224
270 return id;
executed: return id;
Execution Count:3077224
3077224
271 } -
272 // language_region -
273 if (country_id) {
partially evaluated: country_id
TRUEFALSE
yes
Evaluation Count:1043
no
Evaluation Count:0
0-1043
274 QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(language_id, 0, country_id);
-
275 if (id.withLikelySubtagsAdded() == max)
evaluated: id.withLikelySubtagsAdded() == max
TRUEFALSE
yes
Evaluation Count:1034
yes
Evaluation Count:9
9-1034
276 return id;
executed: return id;
Execution Count:1034
1034
277 }
executed: }
Execution Count:9
9
278 // language_script -
279 if (script_id) {
partially evaluated: script_id
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
280 QLocaleId id = QLocaleId::fromIds(language_id, script_id, 0);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(language_id, script_id, 0);
-
281 if (id.withLikelySubtagsAdded() == max)
evaluated: id.withLikelySubtagsAdded() == max
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2
2-7
282 return id;
executed: return id;
Execution Count:7
7
283 }
executed: }
Execution Count:2
2
284 return max;
executed: return max;
Execution Count:2
2
285} -
286 -
287QString QLocaleId::bcp47Name() const -
288{ -
289 if (language_id == QLocale::AnyLanguage)
partially evaluated: language_id == QLocale::AnyLanguage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3078300
0-3078300
290 return QString();
never executed: return QString();
0
291 if (language_id == QLocale::C)
evaluated: language_id == QLocale::C
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3078298
2-3078298
292 return QStringLiteral("C");
executed: return QString::fromUtf8("" "C" "", sizeof("C") - 1);
Execution Count:2
2
293 -
294 const unsigned char *lang = language_code_list + 3*uint(language_id);
executed (the execution status of this line is deduced): const unsigned char *lang = language_code_list + 3*uint(language_id);
-
295 const unsigned char *script =
executed (the execution status of this line is deduced): const unsigned char *script =
-
296 (script_id != QLocale::AnyScript ? script_code_list + 4*uint(script_id) : 0);
evaluated: script_id != QLocale::AnyScript
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:3078268
30-3078268
297 const unsigned char *country =
executed (the execution status of this line is deduced): const unsigned char *country =
-
298 (country_id != QLocale::AnyCountry ? country_code_list + 3*uint(country_id) : 0);
evaluated: country_id != QLocale::AnyCountry
TRUEFALSE
yes
Evaluation Count:1069
yes
Evaluation Count:3077229
1069-3077229
299 char len = (lang[2] != 0 ? 3 : 2) + (script ? 4+1 : 0) + (country ? (country[2] != 0 ? 3 : 2)+1 : 0);
evaluated: lang[2] != 0
TRUEFALSE
yes
Evaluation Count:516
yes
Evaluation Count:3077782
evaluated: script
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:3078268
evaluated: country
TRUEFALSE
yes
Evaluation Count:1069
yes
Evaluation Count:3077229
30-3078268
300 QString name(len, Qt::Uninitialized);
executed (the execution status of this line is deduced): QString name(len, Qt::Uninitialized);
-
301 QChar *uc = name.data();
executed (the execution status of this line is deduced): QChar *uc = name.data();
-
302 *uc++ = ushort(lang[0]);
executed (the execution status of this line is deduced): *uc++ = ushort(lang[0]);
-
303 *uc++ = ushort(lang[1]);
executed (the execution status of this line is deduced): *uc++ = ushort(lang[1]);
-
304 if (lang[2] != 0)
evaluated: lang[2] != 0
TRUEFALSE
yes
Evaluation Count:516
yes
Evaluation Count:3077782
516-3077782
305 *uc++ = ushort(lang[2]);
executed: *uc++ = ushort(lang[2]);
Execution Count:516
516
306 if (script) {
evaluated: script
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:3078268
30-3078268
307 *uc++ = QLatin1Char('-');
executed (the execution status of this line is deduced): *uc++ = QLatin1Char('-');
-
308 *uc++ = ushort(script[0]);
executed (the execution status of this line is deduced): *uc++ = ushort(script[0]);
-
309 *uc++ = ushort(script[1]);
executed (the execution status of this line is deduced): *uc++ = ushort(script[1]);
-
310 *uc++ = ushort(script[2]);
executed (the execution status of this line is deduced): *uc++ = ushort(script[2]);
-
311 *uc++ = ushort(script[3]);
executed (the execution status of this line is deduced): *uc++ = ushort(script[3]);
-
312 }
executed: }
Execution Count:30
30
313 if (country) {
evaluated: country
TRUEFALSE
yes
Evaluation Count:1069
yes
Evaluation Count:3077229
1069-3077229
314 *uc++ = QLatin1Char('-');
executed (the execution status of this line is deduced): *uc++ = QLatin1Char('-');
-
315 *uc++ = ushort(country[0]);
executed (the execution status of this line is deduced): *uc++ = ushort(country[0]);
-
316 *uc++ = ushort(country[1]);
executed (the execution status of this line is deduced): *uc++ = ushort(country[1]);
-
317 if (country[2] != 0)
evaluated: country[2] != 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1062
7-1062
318 *uc++ = ushort(country[2]);
executed: *uc++ = ushort(country[2]);
Execution Count:7
7
319 }
executed: }
Execution Count:1069
1069
320 return name;
executed: return name;
Execution Count:3078298
3078298
321} -
322 -
323QString QLocalePrivate::bcp47Name() const -
324{ -
325 if (m_data->m_language_id == QLocale::AnyLanguage)
partially evaluated: m_data->m_language_id == QLocale::AnyLanguage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16912484
0-16912484
326 return QString();
never executed: return QString();
0
327 if (m_data->m_language_id == QLocale::C)
evaluated: m_data->m_language_id == QLocale::C
TRUEFALSE
yes
Evaluation Count:13834237
yes
Evaluation Count:3078244
3078244-13834237
328 return QStringLiteral("C");
executed: return QString::fromUtf8("" "C" "", sizeof("C") - 1);
Execution Count:13834236
13834236
329 -
330 QLocaleId localeId = QLocaleId::fromIds(m_data->m_language_id, m_data->m_script_id, m_data->m_country_id);
executed (the execution status of this line is deduced): QLocaleId localeId = QLocaleId::fromIds(m_data->m_language_id, m_data->m_script_id, m_data->m_country_id);
-
331 return localeId.withLikelySubtagsRemoved().bcp47Name();
executed: return localeId.withLikelySubtagsRemoved().bcp47Name();
Execution Count:3078244
3078244
332} -
333 -
334const QLocaleData *QLocaleData::findLocaleData(QLocale::Language language, QLocale::Script script, QLocale::Country country) -
335{ -
336 QLocaleId localeId = QLocaleId::fromIds(language, script, country);
executed (the execution status of this line is deduced): QLocaleId localeId = QLocaleId::fromIds(language, script, country);
-
337 localeId = localeId.withLikelySubtagsAdded();
executed (the execution status of this line is deduced): localeId = localeId.withLikelySubtagsAdded();
-
338 -
339 uint idx = locale_index[localeId.language_id];
executed (the execution status of this line is deduced): uint idx = locale_index[localeId.language_id];
-
340 -
341 const QLocaleData *data = locale_data + idx;
executed (the execution status of this line is deduced): const QLocaleData *data = locale_data + idx;
-
342 -
343 if (idx == 0) // default language has no associated country
evaluated: idx == 0
TRUEFALSE
yes
Evaluation Count:13823331
yes
Evaluation Count:3847
3847-13823331
344 return data;
executed: return data;
Execution Count:13823330
13823330
345 -
346 Q_ASSERT(data->m_language_id == localeId.language_id);
executed (the execution status of this line is deduced): qt_noop();
-
347 -
348 if (localeId.script_id != QLocale::AnyScript && localeId.country_id != QLocale::AnyCountry) {
partially evaluated: localeId.script_id != QLocale::AnyScript
TRUEFALSE
yes
Evaluation Count:3847
no
Evaluation Count:0
partially evaluated: localeId.country_id != QLocale::AnyCountry
TRUEFALSE
yes
Evaluation Count:3847
no
Evaluation Count:0
0-3847
349 // both script and country are explicitly specified -
350 do { -
351 if (data->m_script_id == localeId.script_id && data->m_country_id == localeId.country_id)
evaluated: data->m_script_id == localeId.script_id
TRUEFALSE
yes
Evaluation Count:21855
yes
Evaluation Count:438
evaluated: data->m_country_id == localeId.country_id
TRUEFALSE
yes
Evaluation Count:3843
yes
Evaluation Count:18012
438-21855
352 return data;
executed: return data;
Execution Count:3843
3843
353 ++data;
executed (the execution status of this line is deduced): ++data;
-
354 } while (data->m_language_id == localeId.language_id);
executed: }
Execution Count:18450
evaluated: data->m_language_id == localeId.language_id
TRUEFALSE
yes
Evaluation Count:18446
yes
Evaluation Count:4
4-18450
355 -
356 // no match; try again with default script -
357 localeId.script_id = QLocale::AnyScript;
executed (the execution status of this line is deduced): localeId.script_id = QLocale::AnyScript;
-
358 data = locale_data + idx;
executed (the execution status of this line is deduced): data = locale_data + idx;
-
359 }
executed: }
Execution Count:4
4
360 -
361 if (localeId.script_id == QLocale::AnyScript && localeId.country_id == QLocale::AnyCountry)
partially evaluated: localeId.script_id == QLocale::AnyScript
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: localeId.country_id == QLocale::AnyCountry
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
362 return data;
never executed: return data;
0
363 -
364 if (localeId.script_id == QLocale::AnyScript) {
partially evaluated: localeId.script_id == QLocale::AnyScript
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
365 do { -
366 if (data->m_country_id == localeId.country_id)
partially evaluated: data->m_country_id == localeId.country_id
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:284
0-284
367 return data;
never executed: return data;
0
368 ++data;
executed (the execution status of this line is deduced): ++data;
-
369 } while (data->m_language_id == localeId.language_id);
executed: }
Execution Count:284
evaluated: data->m_language_id == localeId.language_id
TRUEFALSE
yes
Evaluation Count:280
yes
Evaluation Count:4
4-284
370 } else if (localeId.country_id == QLocale::AnyCountry) {
executed: }
Execution Count:4
never evaluated: localeId.country_id == QLocale::AnyCountry
0-4
371 do { -
372 if (data->m_script_id == localeId.script_id)
never evaluated: data->m_script_id == localeId.script_id
0
373 return data;
never executed: return data;
0
374 ++data;
never executed (the execution status of this line is deduced): ++data;
-
375 } while (data->m_language_id == localeId.language_id);
never executed: }
never evaluated: data->m_language_id == localeId.language_id
0
376 }
never executed: }
0
377 -
378 return locale_data + idx;
executed: return locale_data + idx;
Execution Count:4
4
379} -
380 -
381static bool parse_locale_tag(const QString &input, int &i, QString *result, const QString &separators) -
382{ -
383 *result = QString(8, Qt::Uninitialized); // worst case according to BCP47
executed (the execution status of this line is deduced): *result = QString(8, Qt::Uninitialized);
-
384 QChar *pch = result->data();
executed (the execution status of this line is deduced): QChar *pch = result->data();
-
385 const QChar *uc = input.data() + i;
executed (the execution status of this line is deduced): const QChar *uc = input.data() + i;
-
386 const int l = input.length();
executed (the execution status of this line is deduced): const int l = input.length();
-
387 int size = 0;
executed (the execution status of this line is deduced): int size = 0;
-
388 for (; i < l && size < 8; ++i, ++size) {
evaluated: i < l
TRUEFALSE
yes
Evaluation Count:18863
yes
Evaluation Count:3242
partially evaluated: size < 8
TRUEFALSE
yes
Evaluation Count:18863
no
Evaluation Count:0
0-18863
389 if (separators.contains(*uc))
evaluated: separators.contains(*uc)
TRUEFALSE
yes
Evaluation Count:4062
yes
Evaluation Count:14801
4062-14801
390 break;
executed: break;
Execution Count:4062
4062
391 if (! ((uc->unicode() >= 'a' && uc->unicode() <= 'z') ||
evaluated: uc->unicode() >= 'a'
TRUEFALSE
yes
Evaluation Count:9779
yes
Evaluation Count:5022
partially evaluated: uc->unicode() <= 'z'
TRUEFALSE
yes
Evaluation Count:9779
no
Evaluation Count:0
0-9779
392 (uc->unicode() >= 'A' && uc->unicode() <= 'Z') ||
evaluated: uc->unicode() >= 'A'
TRUEFALSE
yes
Evaluation Count:5006
yes
Evaluation Count:16
partially evaluated: uc->unicode() <= 'Z'
TRUEFALSE
yes
Evaluation Count:5006
no
Evaluation Count:0
0-5006
393 (uc->unicode() >= '0' && uc->unicode() <= '9')) ) // latin only
evaluated: uc->unicode() >= '0'
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
partially evaluated: uc->unicode() <= '9'
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
394 return false;
executed: return false;
Execution Count:1
1
395 *pch++ = *uc++;
executed (the execution status of this line is deduced): *pch++ = *uc++;
-
396 }
executed: }
Execution Count:14800
14800
397 result->truncate(size);
executed (the execution status of this line is deduced): result->truncate(size);
-
398 return true;
executed: return true;
Execution Count:7304
7304
399} -
400 -
401bool qt_splitLocaleName(const QString &name, QString &lang, QString &script, QString &cntry) -
402{ -
403 const int length = name.length();
executed (the execution status of this line is deduced): const int length = name.length();
-
404 -
405 lang = script = cntry = QString();
executed (the execution status of this line is deduced): lang = script = cntry = QString();
-
406 -
407 const QString separators = QStringLiteral("_-.@");
executed (the execution status of this line is deduced): const QString separators = QString::fromUtf8("" "_-.@" "", sizeof("_-.@") - 1);
-
408 enum ParserState { NoState, LangState, ScriptState, CountryState };
executed (the execution status of this line is deduced): enum ParserState { NoState, LangState, ScriptState, CountryState };
-
409 ParserState state = LangState;
executed (the execution status of this line is deduced): ParserState state = LangState;
-
410 for (int i = 0; i < length && state != NoState; ) {
evaluated: i < length
TRUEFALSE
yes
Evaluation Count:8535
yes
Evaluation Count:3249
evaluated: state != NoState
TRUEFALSE
yes
Evaluation Count:7305
yes
Evaluation Count:1230
1230-8535
411 QString value;
executed (the execution status of this line is deduced): QString value;
-
412 if (!parse_locale_tag(name, i, &value, separators) ||value.isEmpty())
evaluated: !parse_locale_tag(name, i, &value, separators)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7304
evaluated: value.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:7300
1-7304
413 break;
executed: break;
Execution Count:5
5
414 QChar sep = i < length ? name.at(i) : QChar();
evaluated: i < length
TRUEFALSE
yes
Evaluation Count:4058
yes
Evaluation Count:3242
3242-4058
415 switch (state) { -
416 case LangState: -
417 if (!sep.isNull() && !separators.contains(sep)) {
evaluated: !sep.isNull()
TRUEFALSE
yes
Evaluation Count:2821
yes
Evaluation Count:1658
partially evaluated: !separators.contains(sep)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2821
0-2821
418 state = NoState;
never executed (the execution status of this line is deduced): state = NoState;
-
419 break;
never executed: break;
0
420 } -
421 lang = value;
executed (the execution status of this line is deduced): lang = value;
-
422 if (i == length) {
evaluated: i == length
TRUEFALSE
yes
Evaluation Count:1658
yes
Evaluation Count:2821
1658-2821
423 // just language was specified -
424 state = NoState;
executed (the execution status of this line is deduced): state = NoState;
-
425 break;
executed: break;
Execution Count:1658
1658
426 } -
427 state = ScriptState;
executed (the execution status of this line is deduced): state = ScriptState;
-
428 break;
executed: break;
Execution Count:2821
2821
429 case ScriptState: { -
430 QString scripts = QString::fromLatin1((const char *)script_code_list, sizeof(script_code_list));
executed (the execution status of this line is deduced): QString scripts = QString::fromLatin1((const char *)script_code_list, sizeof(script_code_list));
-
431 if (value.length() == 4 && scripts.indexOf(value) % 4 == 0) {
evaluated: value.length() == 4
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2802
partially evaluated: scripts.indexOf(value) % 4 == 0
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-2802
432 // script name is always 4 characters -
433 script = value;
executed (the execution status of this line is deduced): script = value;
-
434 state = CountryState;
executed (the execution status of this line is deduced): state = CountryState;
-
435 } else {
executed: }
Execution Count:12
12
436 // it wasn't a script, maybe it is a country then? -
437 cntry = value;
executed (the execution status of this line is deduced): cntry = value;
-
438 state = NoState;
executed (the execution status of this line is deduced): state = NoState;
-
439 }
executed: }
Execution Count:2802
2802
440 break;
executed: break;
Execution Count:2814
2814
441 } -
442 case CountryState: -
443 cntry = value;
executed (the execution status of this line is deduced): cntry = value;
-
444 state = NoState;
executed (the execution status of this line is deduced): state = NoState;
-
445 break;
executed: break;
Execution Count:7
7
446 case NoState: -
447 // shouldn't happen -
448 qWarning("QLocale: This should never happen");
never executed (the execution status of this line is deduced): QMessageLogger("tools/qlocale.cpp", 448, __PRETTY_FUNCTION__).warning("QLocale: This should never happen");
-
449 break;
never executed: break;
0
450 } -
451 ++i;
executed (the execution status of this line is deduced): ++i;
-
452 }
executed: }
Execution Count:7300
7300
453 return lang.length() == 2 || lang.length() == 3;
executed: return lang.length() == 2 || lang.length() == 3;
Execution Count:4484
4484
454} -
455 -
456void QLocalePrivate::getLangAndCountry(const QString &name, QLocale::Language &lang, -
457 QLocale::Script &script, QLocale::Country &cntry) -
458{ -
459 lang = QLocale::C;
executed (the execution status of this line is deduced): lang = QLocale::C;
-
460 script = QLocale::AnyScript;
executed (the execution status of this line is deduced): script = QLocale::AnyScript;
-
461 cntry = QLocale::AnyCountry;
executed (the execution status of this line is deduced): cntry = QLocale::AnyCountry;
-
462 -
463 QString lang_code;
executed (the execution status of this line is deduced): QString lang_code;
-
464 QString script_code;
executed (the execution status of this line is deduced): QString script_code;
-
465 QString cntry_code;
executed (the execution status of this line is deduced): QString cntry_code;
-
466 if (!qt_splitLocaleName(name, lang_code, script_code, cntry_code))
evaluated: !qt_splitLocaleName(name, lang_code, script_code, cntry_code)
TRUEFALSE
yes
Evaluation Count:1158
yes
Evaluation Count:3324
1158-3324
467 return;
executed: return;
Execution Count:1158
1158
468 -
469 lang = QLocalePrivate::codeToLanguage(lang_code);
executed (the execution status of this line is deduced): lang = QLocalePrivate::codeToLanguage(lang_code);
-
470 if (lang == QLocale::C)
evaluated: lang == QLocale::C
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3320
4-3320
471 return;
executed: return;
Execution Count:4
4
472 script = QLocalePrivate::codeToScript(script_code);
executed (the execution status of this line is deduced): script = QLocalePrivate::codeToScript(script_code);
-
473 cntry = QLocalePrivate::codeToCountry(cntry_code);
executed (the execution status of this line is deduced): cntry = QLocalePrivate::codeToCountry(cntry_code);
-
474}
executed: }
Execution Count:3320
3320
475 -
476static const QLocaleData *findLocaleData(const QString &name) -
477{ -
478 QLocale::Language lang;
executed (the execution status of this line is deduced): QLocale::Language lang;
-
479 QLocale::Script script;
executed (the execution status of this line is deduced): QLocale::Script script;
-
480 QLocale::Country cntry;
executed (the execution status of this line is deduced): QLocale::Country cntry;
-
481 QLocalePrivate::getLangAndCountry(name, lang, script, cntry);
executed (the execution status of this line is deduced): QLocalePrivate::getLangAndCountry(name, lang, script, cntry);
-
482 -
483 return QLocaleData::findLocaleData(lang, script, cntry);
executed: return QLocaleData::findLocaleData(lang, script, cntry);
Execution Count:4482
4482
484} -
485 -
486QString qt_readEscapedFormatString(const QString &format, int *idx) -
487{ -
488 int &i = *idx;
executed (the execution status of this line is deduced): int &i = *idx;
-
489 -
490 Q_ASSERT(format.at(i) == QLatin1Char('\''));
executed (the execution status of this line is deduced): qt_noop();
-
491 ++i;
executed (the execution status of this line is deduced): ++i;
-
492 if (i == format.size())
evaluated: i == format.size()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1527
14-1527
493 return QString();
executed: return QString();
Execution Count:14
14
494 if (format.at(i).unicode() == '\'') { // "''" outside of a quoted stirng
evaluated: format.at(i).unicode() == '\''
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1513
14-1513
495 ++i;
executed (the execution status of this line is deduced): ++i;
-
496 return QLatin1String("'");
executed: return QLatin1String("'");
Execution Count:14
14
497 } -
498 -
499 QString result;
executed (the execution status of this line is deduced): QString result;
-
500 -
501 while (i < format.size()) {
evaluated: i < format.size()
TRUEFALSE
yes
Evaluation Count:4918
yes
Evaluation Count:1250
1250-4918
502 if (format.at(i).unicode() == '\'') {
evaluated: format.at(i).unicode() == '\''
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:4655
263-4655
503 if (i + 1 < format.size() && format.at(i + 1).unicode() == '\'') {
evaluated: i + 1 < format.size()
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:207
partially evaluated: format.at(i + 1).unicode() == '\''
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:56
0-207
504 // "''" inside of a quoted string -
505 result.append(QLatin1Char('\''));
never executed (the execution status of this line is deduced): result.append(QLatin1Char('\''));
-
506 i += 2;
never executed (the execution status of this line is deduced): i += 2;
-
507 } else {
never executed: }
0
508 break;
executed: break;
Execution Count:263
263
509 } -
510 } else { -
511 result.append(format.at(i++));
executed (the execution status of this line is deduced): result.append(format.at(i++));
-
512 }
executed: }
Execution Count:4655
4655
513 } -
514 if (i < format.size())
evaluated: i < format.size()
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:1250
263-1250
515 ++i;
executed: ++i;
Execution Count:263
263
516 -
517 return result;
executed: return result;
Execution Count:1513
1513
518} -
519 -
520int qt_repeatCount(const QString &s, int i) -
521{ -
522 QChar c = s.at(i);
executed (the execution status of this line is deduced): QChar c = s.at(i);
-
523 int j = i + 1;
executed (the execution status of this line is deduced): int j = i + 1;
-
524 while (j < s.size() && s.at(j) == c)
evaluated: j < s.size()
TRUEFALSE
yes
Evaluation Count:69815
yes
Evaluation Count:4386
evaluated: s.at(j) == c
TRUEFALSE
yes
Evaluation Count:25296
yes
Evaluation Count:44519
4386-69815
525 ++j;
executed: ++j;
Execution Count:25296
25296
526 return j - i;
executed: return j - i;
Execution Count:48905
48905
527} -
528 -
529static const QLocaleData *default_data = 0; -
530static uint default_number_options = 0; -
531 -
532#ifndef QT_NO_SYSTEMLOCALE -
533 -
534 -
535/****************************************************************************** -
536** Default system locale behavior -
537*/ -
538 -
539/*! -
540 Constructs a QSystemLocale object. The constructor will automatically -
541 install this object as the system locale and remove any earlier installed -
542 system locales. -
543*/ -
544QSystemLocale::QSystemLocale() -
545{ -
546 delete _systemLocale;
never executed (the execution status of this line is deduced): delete _systemLocale;
-
547 _systemLocale = this;
never executed (the execution status of this line is deduced): _systemLocale = this;
-
548 -
549 if (system_data)
never evaluated: system_data
0
550 system_data->m_language_id = 0;
never executed: system_data->m_language_id = 0;
0
551}
never executed: }
0
552 -
553/*! -
554 \internal -
555*/ -
556QSystemLocale::QSystemLocale(bool) -
557{ } -
558 -
559/*! -
560 Deletes the object. -
561*/ -
562QSystemLocale::~QSystemLocale() -
563{ -
564 if (_systemLocale == this) {
partially evaluated: _systemLocale == this
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:233
0-233
565 _systemLocale = 0;
never executed (the execution status of this line is deduced): _systemLocale = 0;
-
566 -
567 if (system_data)
never evaluated: system_data
0
568 system_data->m_language_id = 0;
never executed: system_data->m_language_id = 0;
0
569 }
never executed: }
0
570}
executed: }
Execution Count:233
233
571 -
572static const QSystemLocale *systemLocale() -
573{ -
574 if (_systemLocale)
partially evaluated: _systemLocale
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17754
0-17754
575 return _systemLocale;
never executed: return _systemLocale;
0
576 return QSystemLocale_globalSystemLocale();
executed: return QSystemLocale_globalSystemLocale();
Execution Count:17754
17754
577} -
578 -
579void QLocalePrivate::updateSystemPrivate() -
580{ -
581 const QSystemLocale *sys_locale = systemLocale();
executed (the execution status of this line is deduced): const QSystemLocale *sys_locale = systemLocale();
-
582 if (!system_data)
partially evaluated: !system_data
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
583 system_data = globalLocaleData();
executed: system_data = globalLocaleData();
Execution Count:45
45
584 -
585 // tell the object that the system locale has changed. -
586 sys_locale->query(QSystemLocale::LocaleChanged, QVariant());
executed (the execution status of this line is deduced): sys_locale->query(QSystemLocale::LocaleChanged, QVariant());
-
587 -
588 *system_data = *sys_locale->fallbackUiLocale().d->m_data;
executed (the execution status of this line is deduced): *system_data = *sys_locale->fallbackUiLocale().d->m_data;
-
589 -
590 QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
executed (the execution status of this line is deduced): QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
-
591 if (!res.isNull()) {
partially evaluated: !res.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45
0-45
592 system_data->m_language_id = res.toInt();
never executed (the execution status of this line is deduced): system_data->m_language_id = res.toInt();
-
593 system_data->m_script_id = QLocale::AnyScript; // default for compatibility
never executed (the execution status of this line is deduced): system_data->m_script_id = QLocale::AnyScript;
-
594 }
never executed: }
0
595 res = sys_locale->query(QSystemLocale::CountryId, QVariant());
executed (the execution status of this line is deduced): res = sys_locale->query(QSystemLocale::CountryId, QVariant());
-
596 if (!res.isNull()) {
partially evaluated: !res.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45
0-45
597 system_data->m_country_id = res.toInt();
never executed (the execution status of this line is deduced): system_data->m_country_id = res.toInt();
-
598 system_data->m_script_id = QLocale::AnyScript; // default for compatibility
never executed (the execution status of this line is deduced): system_data->m_script_id = QLocale::AnyScript;
-
599 }
never executed: }
0
600 res = sys_locale->query(QSystemLocale::ScriptId, QVariant());
executed (the execution status of this line is deduced): res = sys_locale->query(QSystemLocale::ScriptId, QVariant());
-
601 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:45
0-45
602 system_data->m_script_id = res.toInt();
never executed: system_data->m_script_id = res.toInt();
0
603 -
604 res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant());
executed (the execution status of this line is deduced): res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant());
-
605 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
606 system_data->m_decimal = res.toString().at(0).unicode();
executed: system_data->m_decimal = res.toString().at(0).unicode();
Execution Count:45
45
607 -
608 res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
executed (the execution status of this line is deduced): res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
-
609 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
610 system_data->m_group = res.toString().at(0).unicode();
executed: system_data->m_group = res.toString().at(0).unicode();
Execution Count:45
45
611 -
612 res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
executed (the execution status of this line is deduced): res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
-
613 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
614 system_data->m_zero = res.toString().at(0).unicode();
executed: system_data->m_zero = res.toString().at(0).unicode();
Execution Count:45
45
615 -
616 res = sys_locale->query(QSystemLocale::NegativeSign, QVariant());
executed (the execution status of this line is deduced): res = sys_locale->query(QSystemLocale::NegativeSign, QVariant());
-
617 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
618 system_data->m_minus = res.toString().at(0).unicode();
executed: system_data->m_minus = res.toString().at(0).unicode();
Execution Count:45
45
619 -
620 res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
executed (the execution status of this line is deduced): res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
-
621 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
622 system_data->m_plus = res.toString().at(0).unicode();
executed: system_data->m_plus = res.toString().at(0).unicode();
Execution Count:45
45
623}
executed: }
Execution Count:45
45
624#endif -
625 -
626static const QLocaleData *systemData() -
627{ -
628#ifndef QT_NO_SYSTEMLOCALE -
629 // copy over the information from the fallback locale and modify -
630 if (!system_data || system_data->m_language_id == 0)
evaluated: !system_data
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:49422
partially evaluated: system_data->m_language_id == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:49422
0-49422
631 QLocalePrivate::updateSystemPrivate();
executed: QLocalePrivate::updateSystemPrivate();
Execution Count:45
45
632 -
633 return system_data;
executed: return system_data;
Execution Count:49467
49467
634#else -
635 return locale_data; -
636#endif -
637} -
638 -
639static const QLocaleData *defaultData() -
640{ -
641 if (!default_data)
evaluated: !default_data
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:2158488
42-2158488
642 default_data = systemData();
executed: default_data = systemData();
Execution Count:42
42
643 return default_data;
executed: return default_data;
Execution Count:2158530
2158530
644} -
645 -
646static QString getLocaleListData(const ushort *data, int size, int index) -
647{ -
648 static const ushort separator = ';'; -
649 while (index && size > 0) {
evaluated: index
TRUEFALSE
yes
Evaluation Count:74583
yes
Evaluation Count:17252
partially evaluated: size > 0
TRUEFALSE
yes
Evaluation Count:74583
no
Evaluation Count:0
0-74583
650 while (*data != separator)
evaluated: *data != separator
TRUEFALSE
yes
Evaluation Count:293784
yes
Evaluation Count:74583
74583-293784
651 ++data, --size;
executed: ++data, --size;
Execution Count:293784
293784
652 --index;
executed (the execution status of this line is deduced): --index;
-
653 ++data;
executed (the execution status of this line is deduced): ++data;
-
654 --size;
executed (the execution status of this line is deduced): --size;
-
655 }
executed: }
Execution Count:74583
74583
656 const ushort *end = data;
executed (the execution status of this line is deduced): const ushort *end = data;
-
657 while (size > 0 && *end != separator)
partially evaluated: size > 0
TRUEFALSE
yes
Evaluation Count:87176
no
Evaluation Count:0
evaluated: *end != separator
TRUEFALSE
yes
Evaluation Count:69924
yes
Evaluation Count:17252
0-87176
658 ++end, --size;
executed: ++end, --size;
Execution Count:69924
69924
659 if (end-data == 0)
partially evaluated: end-data == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17252
0-17252
660 return QString();
never executed: return QString();
0
661 return QString::fromRawData(reinterpret_cast<const QChar*>(data), end-data);
executed: return QString::fromRawData(reinterpret_cast<const QChar*>(data), end-data);
Execution Count:17252
17252
662} -
663 -
664static inline QString getLocaleData(const ushort *data, int size) -
665{ -
666 return size ? QString::fromRawData(reinterpret_cast<const QChar*>(data), size) : QString();
executed: return size ? QString::fromRawData(reinterpret_cast<const QChar*>(data), size) : QString();
Execution Count:6269
6269
667} -
668 -
669 -
670#ifndef QT_NO_DATASTREAM -
671QDataStream &operator<<(QDataStream &ds, const QLocale &l) -
672{ -
673 ds << l.name();
executed (the execution status of this line is deduced): ds << l.name();
-
674 return ds;
executed: return ds;
Execution Count:3
3
675} -
676 -
677QDataStream &operator>>(QDataStream &ds, QLocale &l) -
678{ -
679 QString s;
executed (the execution status of this line is deduced): QString s;
-
680 ds >> s;
executed (the execution status of this line is deduced): ds >> s;
-
681 l = QLocale(s);
executed (the execution status of this line is deduced): l = QLocale(s);
-
682 return ds;
executed: return ds;
Execution Count:7
7
683} -
684#endif // QT_NO_DATASTREAM -
685 -
686 -
687static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1; -
688 -
689const QLocaleData *QLocalePrivate::dataPointerForIndex(quint16 index) -
690{ -
691#ifndef QT_NO_SYSTEMLOCALE -
692 Q_ASSERT(index <= locale_data_size);
executed (the execution status of this line is deduced): qt_noop();
-
693 if (index == locale_data_size)
evaluated: index == locale_data_size
TRUEFALSE
yes
Evaluation Count:2151948
yes
Evaluation Count:13838436
2151948-13838436
694 return system_data;
executed: return system_data;
Execution Count:2151948
2151948
695#else -
696 Q_ASSERT(index < locale_data_size); -
697#endif -
698 -
699 return &locale_data[index];
executed: return &locale_data[index];
Execution Count:13838438
13838438
700} -
701 -
702static quint16 localeDataIndex(const QLocaleData *p) -
703{ -
704#ifndef QT_NO_SYSTEMLOCALE -
705 Q_ASSERT((p >= locale_data && p - locale_data < locale_data_size)
executed (the execution status of this line is deduced): qt_noop();
-
706 || (p != 0 && p == system_data)); -
707 quint16 index = p == system_data ? locale_data_size : p - locale_data;
evaluated: p == system_data
TRUEFALSE
yes
Evaluation Count:2151948
yes
Evaluation Count:13838438
2151948-13838438
708#else -
709 Q_ASSERT(p >= locale_data && p - locale_data < locale_data_size); -
710 quint16 index = p - locale_data; -
711#endif -
712 -
713 return index;
executed: return index;
Execution Count:15990386
15990386
714} -
715 -
716/*! -
717 \internal -
718*/ -
719QLocale::QLocale(QLocalePrivate &dd) -
720 : d(&dd) -
721{}
executed: }
Execution Count:4691
4691
722 -
723 -
724/*! -
725 Constructs a QLocale object with the specified \a name, -
726 which has the format -
727 "language[_script][_country][.codeset][@modifier]" or "C", where: -
728 -
729 \list -
730 \li language is a lowercase, two-letter, ISO 639 language code (also some three-letter codes), -
731 \li script is a titlecase, four-letter, ISO 15924 script code, -
732 \li country is an uppercase, two-letter, ISO 3166 country code (also "419" as defined by United Nations), -
733 \li and codeset and modifier are ignored. -
734 \endlist -
735 -
736 The separator can be either underscore or a minus sign. -
737 -
738 If the string violates the locale format, or language is not -
739 a valid ISO 639 code, the "C" locale is used instead. If country -
740 is not present, or is not a valid ISO 3166 code, the most -
741 appropriate country is chosen for the specified language. -
742 -
743 The language, script and country codes are converted to their respective -
744 \c Language, \c Script and \c Country enums. After this conversion is -
745 performed, the constructor behaves exactly like QLocale(Country, Script, -
746 Language). -
747 -
748 This constructor is much slower than QLocale(Country, Script, Language). -
749 -
750 \sa bcp47Name() -
751*/ -
752 -
753QLocale::QLocale(const QString &name) -
754 : d(new QLocalePrivate(localeDataIndex(findLocaleData(name)))) -
755{ -
756}
executed: }
Execution Count:4482
4482
757 -
758/*! -
759 Constructs a QLocale object initialized with the default locale. If -
760 no default locale was set using setDefault(), this locale will -
761 be the same as the one returned by system(). -
762 -
763 \sa setDefault() -
764*/ -
765 -
766QLocale::QLocale() -
767 : d(new QLocalePrivate(localeDataIndex(defaultData()), default_number_options)) -
768{ -
769}
executed: }
Execution Count:2158518
2158518
770 -
771/*! -
772 Constructs a QLocale object with the specified \a language and \a -
773 country. -
774 -
775 \list -
776 \li If the language/country pair is found in the database, it is used. -
777 \li If the language is found but the country is not, or if the country -
778 is \c AnyCountry, the language is used with the most -
779 appropriate available country (for example, Germany for German), -
780 \li If neither the language nor the country are found, QLocale -
781 defaults to the default locale (see setDefault()). -
782 \endlist -
783 -
784 The language and country that are actually used can be queried -
785 using language() and country(). -
786 -
787 \sa setDefault(), language(), country() -
788*/ -
789 -
790QLocale::QLocale(Language language, Country country) -
791{ -
792 const QLocaleData *data = QLocaleData::findLocaleData(language, QLocale::AnyScript, country);
executed (the execution status of this line is deduced): const QLocaleData *data = QLocaleData::findLocaleData(language, QLocale::AnyScript, country);
-
793 int index;
executed (the execution status of this line is deduced): int index;
-
794 int numberOptions = 0;
executed (the execution status of this line is deduced): int numberOptions = 0;
-
795 -
796 // If not found, should default to system -
797 if (data->m_language_id == QLocale::C && language != QLocale::C) {
evaluated: data->m_language_id == QLocale::C
TRUEFALSE
yes
Evaluation Count:13822168
yes
Evaluation Count:527
evaluated: language != QLocale::C
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:13822156
12-13822168
798 numberOptions = default_number_options;
executed (the execution status of this line is deduced): numberOptions = default_number_options;
-
799 index = localeDataIndex(defaultData());
executed (the execution status of this line is deduced): index = localeDataIndex(defaultData());
-
800 } else {
executed: }
Execution Count:12
12
801 index = localeDataIndex(data);
executed (the execution status of this line is deduced): index = localeDataIndex(data);
-
802 }
executed: }
Execution Count:13822683
13822683
803 d = new QLocalePrivate(index, numberOptions);
executed (the execution status of this line is deduced): d = new QLocalePrivate(index, numberOptions);
-
804}
executed: }
Execution Count:13822696
13822696
805\ -
806/*! -
807 \since 4.8 -
808 -
809 Constructs a QLocale object with the specified \a language, \a script and -
810 \a country. -
811 -
812 \list -
813 \li If the language/script/country is found in the database, it is used. -
814 \li If both \a script is AnyScript and \a country is AnyCountry, the -
815 language is used with the most appropriate available script and country -
816 (for example, Germany for German), -
817 \li If either \a script is AnyScript or \a country is AnyCountry, the -
818 language is used with the first locale that matches the given \a script -
819 and \a country. -
820 \li If neither the language nor the country are found, QLocale -
821 defaults to the default locale (see setDefault()). -
822 \endlist -
823 -
824 The language, script and country that are actually used can be queried -
825 using language(), script() and country(). -
826 -
827 \sa setDefault(), language(), script(), country() -
828*/ -
829 -
830QLocale::QLocale(Language language, Script script, Country country) -
831{ -
832 const QLocaleData *data = QLocaleData::findLocaleData(language, script, country);
never executed (the execution status of this line is deduced): const QLocaleData *data = QLocaleData::findLocaleData(language, script, country);
-
833 int index;
never executed (the execution status of this line is deduced): int index;
-
834 int numberOptions = 0;
never executed (the execution status of this line is deduced): int numberOptions = 0;
-
835 -
836 // If not found, should default to system -
837 if (data->m_language_id == QLocale::C && language != QLocale::C) {
never evaluated: data->m_language_id == QLocale::C
never evaluated: language != QLocale::C
0
838 numberOptions = default_number_options;
never executed (the execution status of this line is deduced): numberOptions = default_number_options;
-
839 index = localeDataIndex(defaultData());
never executed (the execution status of this line is deduced): index = localeDataIndex(defaultData());
-
840 } else {
never executed: }
0
841 index = localeDataIndex(data);
never executed (the execution status of this line is deduced): index = localeDataIndex(data);
-
842 }
never executed: }
0
843 d = new QLocalePrivate(index, numberOptions);
never executed (the execution status of this line is deduced): d = new QLocalePrivate(index, numberOptions);
-
844}
never executed: }
0
845 -
846/*! -
847 Constructs a QLocale object as a copy of \a other. -
848*/ -
849 -
850QLocale::QLocale(const QLocale &other) -
851{ -
852 d = other.d;
executed (the execution status of this line is deduced): d = other.d;
-
853}
executed: }
Execution Count:94582
94582
854 -
855/*! -
856 Destructor -
857*/ -
858 -
859QLocale::~QLocale() -
860{ -
861} -
862 -
863/*! -
864 Assigns \a other to this QLocale object and returns a reference -
865 to this QLocale object. -
866*/ -
867 -
868QLocale &QLocale::operator=(const QLocale &other) -
869{ -
870 d = other.d;
executed (the execution status of this line is deduced): d = other.d;
-
871 return *this;
executed: return *this;
Execution Count:1169786
1169786
872} -
873 -
874bool QLocale::operator==(const QLocale &other) const -
875{ -
876 return d->m_data == other.d->m_data && d->m_numberOptions == other.d->m_numberOptions;
executed: return d->m_data == other.d->m_data && d->m_numberOptions == other.d->m_numberOptions;
Execution Count:43165
43165
877} -
878 -
879bool QLocale::operator!=(const QLocale &other) const -
880{ -
881 return d->m_data != other.d->m_data || d->m_numberOptions != other.d->m_numberOptions;
executed: return d->m_data != other.d->m_data || d->m_numberOptions != other.d->m_numberOptions;
Execution Count:26138
26138
882} -
883 -
884/*! -
885 \since 4.2 -
886 -
887 Sets the \a options related to number conversions for this -
888 QLocale instance. -
889*/ -
890void QLocale::setNumberOptions(NumberOptions options) -
891{ -
892 d->m_numberOptions = options;
executed (the execution status of this line is deduced): d->m_numberOptions = options;
-
893}
executed: }
Execution Count:42303
42303
894 -
895/*! -
896 \since 4.2 -
897 -
898 Returns the options related to number conversions for this -
899 QLocale instance. -
900 -
901 By default, no options are set for the standard locales. -
902*/ -
903QLocale::NumberOptions QLocale::numberOptions() const -
904{ -
905 return static_cast<NumberOption>(d->m_numberOptions);
executed: return static_cast<NumberOption>(d->m_numberOptions);
Execution Count:1847
1847
906} -
907 -
908/*! -
909 \since 4.8 -
910 -
911 Returns \a str quoted according to the current locale using the given -
912 quotation \a style. -
913*/ -
914QString QLocale::quoteString(const QString &str, QuotationStyle style) const -
915{ -
916 return quoteString(&str, style);
executed: return quoteString(&str, style);
Execution Count:4
4
917} -
918 -
919/*! -
920 \since 4.8 -
921 -
922 \overload -
923*/ -
924QString QLocale::quoteString(const QStringRef &str, QuotationStyle style) const -
925{ -
926#ifndef QT_NO_SYSTEMLOCALE -
927 if (d->m_data == systemData()) {
partially evaluated: d->m_data == systemData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
928 QVariant res;
never executed (the execution status of this line is deduced): QVariant res;
-
929 if (style == QLocale::AlternateQuotation)
never evaluated: style == QLocale::AlternateQuotation
0
930 res = systemLocale()->query(QSystemLocale::StringToAlternateQuotation, QVariant::fromValue(str));
never executed: res = systemLocale()->query(QSystemLocale::StringToAlternateQuotation, QVariant::fromValue(str));
0
931 if (res.isNull() || style == QLocale::StandardQuotation)
never evaluated: res.isNull()
never evaluated: style == QLocale::StandardQuotation
0
932 res = systemLocale()->query(QSystemLocale::StringToStandardQuotation, QVariant::fromValue(str));
never executed: res = systemLocale()->query(QSystemLocale::StringToStandardQuotation, QVariant::fromValue(str));
0
933 if (!res.isNull())
never evaluated: !res.isNull()
0
934 return res.toString();
never executed: return res.toString();
0
935 }
never executed: }
0
936#endif -
937 -
938 if (style == QLocale::StandardQuotation)
evaluated: style == QLocale::StandardQuotation
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
939 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
940 else -
941 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
942} -
943 -
944/*! -
945 \since 4.8 -
946 -
947 Returns a string that represents a join of a given \a list of strings with -
948 a separator defined by the locale. -
949*/ -
950QString QLocale::createSeparatedList(const QStringList &list) const -
951{ -
952#ifndef QT_NO_SYSTEMLOCALE -
953 if (d->m_data == systemData()) {
partially evaluated: d->m_data == systemData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
954 QVariant res;
never executed (the execution status of this line is deduced): QVariant res;
-
955 res = systemLocale()->query(QSystemLocale::ListToSeparatedString, QVariant::fromValue(list));
never executed (the execution status of this line is deduced): res = systemLocale()->query(QSystemLocale::ListToSeparatedString, QVariant::fromValue(list));
-
956 -
957 if (!res.isNull())
never evaluated: !res.isNull()
0
958 return res.toString();
never executed: return res.toString();
0
959 }
never executed: }
0
960#endif -
961 -
962 const int size = list.size();
executed (the execution status of this line is deduced): const int size = list.size();
-
963 if (size == 1) {
evaluated: size == 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:12
3-12
964 return list.at(0);
executed: return list.at(0);
Execution Count:3
3
965 } else if (size == 2) {
evaluated: size == 2
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:9
3-9
966 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);
executed (the execution status of this line is deduced): 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);
-
967 return format.arg(list.at(0), list.at(1));
executed: return format.arg(list.at(0), list.at(1));
Execution Count:3
3
968 } else if (size > 2) {
evaluated: size > 2
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
969 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);
executed (the execution status of this line is deduced): 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);
-
970 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);
executed (the execution status of this line is deduced): 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);
-
971 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);
executed (the execution status of this line is deduced): 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);
-
972 QString result = formatStart.arg(list.at(0), list.at(1));
executed (the execution status of this line is deduced): QString result = formatStart.arg(list.at(0), list.at(1));
-
973 for (int i = 2; i < size - 1; ++i)
evaluated: i < size - 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6
3-6
974 result = formatMid.arg(result, list.at(i));
executed: result = formatMid.arg(result, list.at(i));
Execution Count:3
3
975 result = formatEnd.arg(result, list.at(size - 1));
executed (the execution status of this line is deduced): result = formatEnd.arg(result, list.at(size - 1));
-
976 return result;
executed: return result;
Execution Count:6
6
977 } -
978 -
979 return QString();
executed: return QString();
Execution Count:3
3
980} -
981 -
982/*! -
983 \nonreentrant -
984 -
985 Sets the global default locale to \a locale. These -
986 values are used when a QLocale object is constructed with -
987 no arguments. If this function is not called, the system's -
988 locale is used. -
989 -
990 \warning In a multithreaded application, the default locale -
991 should be set at application startup, before any non-GUI threads -
992 are created. -
993 -
994 \sa system(), c() -
995*/ -
996 -
997void QLocale::setDefault(const QLocale &locale) -
998{ -
999 default_data = locale.d->m_data;
executed (the execution status of this line is deduced): default_data = locale.d->m_data;
-
1000 default_number_options = locale.numberOptions();
executed (the execution status of this line is deduced): default_number_options = locale.numberOptions();
-
1001}
executed: }
Execution Count:1633
1633
1002 -
1003/*! -
1004 Returns the language of this locale. -
1005 -
1006 \sa script(), country(), languageToString(), bcp47Name() -
1007*/ -
1008QLocale::Language QLocale::language() const -
1009{ -
1010 return Language(d->languageId());
executed: return Language(d->languageId());
Execution Count:11985
11985
1011} -
1012 -
1013/*! -
1014 \since 4.8 -
1015 -
1016 Returns the script of this locale. -
1017 -
1018 \sa language(), country(), languageToString(), scriptToString(), bcp47Name() -
1019*/ -
1020QLocale::Script QLocale::script() const -
1021{ -
1022 return Script(d->m_data->m_script_id);
executed: return Script(d->m_data->m_script_id);
Execution Count:21
21
1023} -
1024 -
1025/*! -
1026 Returns the country of this locale. -
1027 -
1028 \sa language(), script(), countryToString(), bcp47Name() -
1029*/ -
1030QLocale::Country QLocale::country() const -
1031{ -
1032 return Country(d->countryId());
executed: return Country(d->countryId());
Execution Count:10563
10563
1033} -
1034 -
1035/*! -
1036 Returns the language and country of this locale as a -
1037 string of the form "language_country", where -
1038 language is a lowercase, two-letter ISO 639 language code, -
1039 and country is an uppercase, two- or three-letter ISO 3166 country code. -
1040 -
1041 Note that even if QLocale object was constructed with an explicit script, -
1042 name() will not contain it for compatibility reasons. Use bcp47Name() instead -
1043 if you need a full locale name. -
1044 -
1045 \sa QLocale(), language(), script(), country(), bcp47Name() -
1046*/ -
1047 -
1048QString QLocale::name() const -
1049{ -
1050 Language l = language();
executed (the execution status of this line is deduced): Language l = language();
-
1051 -
1052 QString result = d->languageCode();
executed (the execution status of this line is deduced): QString result = d->languageCode();
-
1053 -
1054 if (l == C)
evaluated: l == C
TRUEFALSE
yes
Evaluation Count:101
yes
Evaluation Count:2514
101-2514
1055 return result;
executed: return result;
Execution Count:101
101
1056 -
1057 Country c = country();
executed (the execution status of this line is deduced): Country c = country();
-
1058 if (c == AnyCountry)
partially evaluated: c == AnyCountry
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2514
0-2514
1059 return result;
never executed: return result;
0
1060 -
1061 result.append(QLatin1Char('_'));
executed (the execution status of this line is deduced): result.append(QLatin1Char('_'));
-
1062 result.append(d->countryCode());
executed (the execution status of this line is deduced): result.append(d->countryCode());
-
1063 -
1064 return result;
executed: return result;
Execution Count:2514
2514
1065} -
1066 -
1067/*! -
1068 \since 4.8 -
1069 -
1070 Returns the dash-separated language, script and country (and possibly other BCP47 fields) -
1071 of this locale as a string. -
1072 -
1073 Unlike the uiLanguages() the returned value of the bcp47Name() represents -
1074 the locale name of the QLocale data but not the language the user-interface -
1075 should be in. -
1076 -
1077 This function tries to conform the locale name to BCP47. -
1078 -
1079 \sa language(), country(), script(), uiLanguages() -
1080*/ -
1081QString QLocale::bcp47Name() const -
1082{ -
1083 return d->bcp47Name();
executed: return d->bcp47Name();
Execution Count:922098
922098
1084} -
1085 -
1086/*! -
1087 Returns a QString containing the name of \a language. -
1088 -
1089 \sa countryToString(), scriptToString(), bcp47Name() -
1090*/ -
1091 -
1092QString QLocale::languageToString(Language language) -
1093{ -
1094 if (uint(language) > uint(QLocale::LastLanguage))
partially evaluated: uint(language) > uint(QLocale::LastLanguage)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:494
0-494
1095 return QLatin1String("Unknown");
never executed: return QLatin1String("Unknown");
0
1096 return QLatin1String(language_name_list + language_name_index[language]);
executed: return QLatin1String(language_name_list + language_name_index[language]);
Execution Count:494
494
1097} -
1098 -
1099/*! -
1100 Returns a QString containing the name of \a country. -
1101 -
1102 \sa languageToString(), scriptToString(), country(), bcp47Name() -
1103*/ -
1104 -
1105QString QLocale::countryToString(Country country) -
1106{ -
1107 if (uint(country) > uint(QLocale::LastCountry))
partially evaluated: uint(country) > uint(QLocale::LastCountry)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:494
0-494
1108 return QLatin1String("Unknown");
never executed: return QLatin1String("Unknown");
0
1109 return QLatin1String(country_name_list + country_name_index[country]);
executed: return QLatin1String(country_name_list + country_name_index[country]);
Execution Count:494
494
1110} -
1111 -
1112/*! -
1113 \since 4.8 -
1114 -
1115 Returns a QString containing the name of \a script. -
1116 -
1117 \sa languageToString(), countryToString(), script(), bcp47Name() -
1118*/ -
1119QString QLocale::scriptToString(QLocale::Script script) -
1120{ -
1121 if (uint(script) > uint(QLocale::LastScript))
partially evaluated: uint(script) > uint(QLocale::LastScript)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
1122 return QLatin1String("Unknown");
never executed: return QLatin1String("Unknown");
0
1123 return QLatin1String(script_name_list + script_name_index[script]);
executed: return QLatin1String(script_name_list + script_name_index[script]);
Execution Count:11
11
1124} -
1125 -
1126/*! -
1127 Returns the short int represented by the localized string \a s. -
1128 -
1129 If the conversion fails the function returns 0. -
1130 -
1131 If \a ok is not 0, failure is reported by setting *ok to false, and -
1132 success by setting *ok to true. -
1133 -
1134 This function ignores leading and trailing whitespace. -
1135 -
1136 \sa toUShort(), toString() -
1137*/ -
1138 -
1139short QLocale::toShort(const QString &s, bool *ok) const -
1140{ -
1141 qlonglong i = toLongLong(s, ok);
never executed (the execution status of this line is deduced): qlonglong i = toLongLong(s, ok);
-
1142 if (i < SHRT_MIN || i > SHRT_MAX) {
never evaluated: i < (-32767 - 1)
never evaluated: i > 32767
0
1143 if (ok != 0)
never evaluated: ok != 0
0
1144 *ok = false;
never executed: *ok = false;
0
1145 return 0;
never executed: return 0;
0
1146 } -
1147 return short(i);
never executed: return short(i);
0
1148} -
1149 -
1150/*! -
1151 Returns the unsigned short int represented by the localized string \a s. -
1152 -
1153 If the conversion fails the function returns 0. -
1154 -
1155 If \a ok is not 0, failure is reported by setting *ok to false, and -
1156 success by setting *ok to true. -
1157 -
1158 This function ignores leading and trailing whitespace. -
1159 -
1160 \sa toShort(), toString() -
1161*/ -
1162 -
1163ushort QLocale::toUShort(const QString &s, bool *ok) const -
1164{ -
1165 qulonglong i = toULongLong(s, ok);
never executed (the execution status of this line is deduced): qulonglong i = toULongLong(s, ok);
-
1166 if (i > USHRT_MAX) {
never evaluated: i > (32767 * 2 + 1)
0
1167 if (ok != 0)
never evaluated: ok != 0
0
1168 *ok = false;
never executed: *ok = false;
0
1169 return 0;
never executed: return 0;
0
1170 } -
1171 return ushort(i);
never executed: return ushort(i);
0
1172} -
1173 -
1174/*! -
1175 Returns the int represented by the localized string \a s. -
1176 -
1177 If the conversion fails the function returns 0. -
1178 -
1179 If \a ok is not 0, failure is reported by setting *ok to false, and -
1180 success by setting *ok to true. -
1181 -
1182 This function ignores leading and trailing whitespace. -
1183 -
1184 \sa toUInt(), toString() -
1185*/ -
1186 -
1187int QLocale::toInt(const QString &s, bool *ok) const -
1188{ -
1189 qlonglong i = toLongLong(s, ok);
executed (the execution status of this line is deduced): qlonglong i = toLongLong(s, ok);
-
1190 if (i < INT_MIN || i > INT_MAX) {
partially evaluated: i < (-2147483647 - 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1110
partially evaluated: i > 2147483647
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1110
0-1110
1191 if (ok != 0)
never evaluated: ok != 0
0
1192 *ok = false;
never executed: *ok = false;
0
1193 return 0;
never executed: return 0;
0
1194 } -
1195 return int(i);
executed: return int(i);
Execution Count:1110
1110
1196} -
1197 -
1198/*! -
1199 Returns the unsigned int represented by the localized string \a s. -
1200 -
1201 If the conversion fails the function returns 0. -
1202 -
1203 If \a ok is not 0, failure is reported by setting *ok to false, and -
1204 success by setting *ok to true. -
1205 -
1206 This function ignores leading and trailing whitespace. -
1207 -
1208 \sa toInt(), toString() -
1209*/ -
1210 -
1211uint QLocale::toUInt(const QString &s, bool *ok) const -
1212{ -
1213 qulonglong i = toULongLong(s, ok);
executed (the execution status of this line is deduced): qulonglong i = toULongLong(s, ok);
-
1214 if (i > UINT_MAX) {
partially evaluated: i > (2147483647 * 2U + 1U)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11632
0-11632
1215 if (ok != 0)
never evaluated: ok != 0
0
1216 *ok = false;
never executed: *ok = false;
0
1217 return 0;
never executed: return 0;
0
1218 } -
1219 return uint(i);
executed: return uint(i);
Execution Count:11632
11632
1220} -
1221 -
1222/*! -
1223 Returns the long long int represented by the localized string \a s. -
1224 -
1225 If the conversion fails the function returns 0. -
1226 -
1227 If \a ok is not 0, failure is reported by setting *ok to false, and -
1228 success by setting *ok to true. -
1229 -
1230 This function ignores leading and trailing whitespace. -
1231 -
1232 \sa toInt(), toULongLong(), toDouble(), toString() -
1233*/ -
1234 -
1235 -
1236qlonglong QLocale::toLongLong(const QString &s, bool *ok) const -
1237{ -
1238 QLocalePrivate::GroupSeparatorMode mode
executed (the execution status of this line is deduced): QLocalePrivate::GroupSeparatorMode mode
-
1239 = d->m_numberOptions & RejectGroupSeparator
evaluated: d->m_numberOptions & RejectGroupSeparator
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1149
2-1149
1240 ? QLocalePrivate::FailOnGroupSeparators
executed (the execution status of this line is deduced): ? QLocalePrivate::FailOnGroupSeparators
-
1241 : QLocalePrivate::ParseGroupSeparators;
executed (the execution status of this line is deduced): : QLocalePrivate::ParseGroupSeparators;
-
1242 -
1243 return d->stringToLongLong(s, 10, ok, mode);
executed: return d->stringToLongLong(s, 10, ok, mode);
Execution Count:1151
1151
1244} -
1245 -
1246/*! -
1247 Returns the unsigned long long int represented by the localized -
1248 string \a s. -
1249 -
1250 If the conversion fails the function returns 0. -
1251 -
1252 If \a ok is not 0, failure is reported by setting *ok to false, and -
1253 success by setting *ok to true. -
1254 -
1255 This function ignores leading and trailing whitespace. -
1256 -
1257 \sa toLongLong(), toInt(), toDouble(), toString() -
1258*/ -
1259 -
1260qulonglong QLocale::toULongLong(const QString &s, bool *ok) const -
1261{ -
1262 QLocalePrivate::GroupSeparatorMode mode
executed (the execution status of this line is deduced): QLocalePrivate::GroupSeparatorMode mode
-
1263 = d->m_numberOptions & RejectGroupSeparator
partially evaluated: d->m_numberOptions & RejectGroupSeparator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11632
0-11632
1264 ? QLocalePrivate::FailOnGroupSeparators
executed (the execution status of this line is deduced): ? QLocalePrivate::FailOnGroupSeparators
-
1265 : QLocalePrivate::ParseGroupSeparators;
executed (the execution status of this line is deduced): : QLocalePrivate::ParseGroupSeparators;
-
1266 -
1267 return d->stringToUnsLongLong(s, 10, ok, mode);
executed: return d->stringToUnsLongLong(s, 10, ok, mode);
Execution Count:11632
11632
1268} -
1269 -
1270/*! -
1271 Returns the float represented by the localized string \a s, or 0.0 -
1272 if the conversion failed. -
1273 -
1274 If \a ok is not 0, reports failure by setting -
1275 *ok to false and success by setting *ok to true. -
1276 -
1277 This function ignores leading and trailing whitespace. -
1278 -
1279 \sa toDouble(), toInt(), toString() -
1280*/ -
1281 -
1282#define QT_MAX_FLOAT 3.4028234663852886e+38 -
1283 -
1284float QLocale::toFloat(const QString &s, bool *ok) const -
1285{ -
1286 bool myOk;
never executed (the execution status of this line is deduced): bool myOk;
-
1287 double d = toDouble(s, &myOk);
never executed (the execution status of this line is deduced): double d = toDouble(s, &myOk);
-
1288 if (!myOk || d > QT_MAX_FLOAT || d < -QT_MAX_FLOAT) {
never evaluated: !myOk
never evaluated: d > 3.4028234663852886e+38
never evaluated: d < -3.4028234663852886e+38
0
1289 if (ok != 0)
never evaluated: ok != 0
0
1290 *ok = false;
never executed: *ok = false;
0
1291 return 0.0;
never executed: return 0.0;
0
1292 } -
1293 if (ok != 0)
never evaluated: ok != 0
0
1294 *ok = true;
never executed: *ok = true;
0
1295 return float(d);
never executed: return float(d);
0
1296} -
1297 -
1298/*! -
1299 Returns the double represented by the localized string \a s, or -
1300 0.0 if the conversion failed. -
1301 -
1302 If \a ok is not 0, reports failure by setting -
1303 *ok to false and success by setting *ok to true. -
1304 -
1305 Unlike QString::toDouble(), this function does not fall back to -
1306 the "C" locale if the string cannot be interpreted in this -
1307 locale. -
1308 -
1309 \snippet code/src_corelib_tools_qlocale.cpp 3 -
1310 -
1311 Notice that the last conversion returns 1234.0, because '.' is the -
1312 thousands group separator in the German locale. -
1313 -
1314 This function ignores leading and trailing whitespace. -
1315 -
1316 \sa toFloat(), toInt(), toString() -
1317*/ -
1318 -
1319double QLocale::toDouble(const QString &s, bool *ok) const -
1320{ -
1321 QLocalePrivate::GroupSeparatorMode mode
executed (the execution status of this line is deduced): QLocalePrivate::GroupSeparatorMode mode
-
1322 = d->m_numberOptions & RejectGroupSeparator
partially evaluated: d->m_numberOptions & RejectGroupSeparator
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1274
0-1274
1323 ? QLocalePrivate::FailOnGroupSeparators
executed (the execution status of this line is deduced): ? QLocalePrivate::FailOnGroupSeparators
-
1324 : QLocalePrivate::ParseGroupSeparators;
executed (the execution status of this line is deduced): : QLocalePrivate::ParseGroupSeparators;
-
1325 -
1326 return d->stringToDouble(s, ok, mode);
executed: return d->stringToDouble(s, ok, mode);
Execution Count:1274
1274
1327} -
1328 -
1329/*! -
1330 Returns a localized string representation of \a i. -
1331 -
1332 \sa toLongLong() -
1333*/ -
1334 -
1335QString QLocale::toString(qlonglong i) const -
1336{ -
1337 int flags = d->m_numberOptions & OmitGroupSeparator
evaluated: d->m_numberOptions & OmitGroupSeparator
TRUEFALSE
yes
Evaluation Count:6447
yes
Evaluation Count:1671
1671-6447
1338 ? 0
executed (the execution status of this line is deduced): ? 0
-
1339 : QLocalePrivate::ThousandsGroup;
executed (the execution status of this line is deduced): : QLocalePrivate::ThousandsGroup;
-
1340 -
1341 return d->longLongToString(i, -1, 10, -1, flags);
executed: return d->longLongToString(i, -1, 10, -1, flags);
Execution Count:8118
8118
1342} -
1343 -
1344/*! -
1345 \overload -
1346 -
1347 \sa toULongLong() -
1348*/ -
1349 -
1350QString QLocale::toString(qulonglong i) const -
1351{ -
1352 int flags = d->m_numberOptions & OmitGroupSeparator
evaluated: d->m_numberOptions & OmitGroupSeparator
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:452
12-452
1353 ? 0
executed (the execution status of this line is deduced): ? 0
-
1354 : QLocalePrivate::ThousandsGroup;
executed (the execution status of this line is deduced): : QLocalePrivate::ThousandsGroup;
-
1355 -
1356 return d->unsLongLongToString(i, -1, 10, -1, flags);
executed: return d->unsLongLongToString(i, -1, 10, -1, flags);
Execution Count:464
464
1357} -
1358 -
1359/*! -
1360 Returns a localized string representation of the given \a date in the -
1361 specified \a format. -
1362 If \a format is an empty string, an empty string is returned. -
1363*/ -
1364 -
1365QString QLocale::toString(const QDate &date, const QString &format) const -
1366{ -
1367 return d->dateTimeToString(format, &date, 0, this);
executed: return d->dateTimeToString(format, &date, 0, this);
Execution Count:1744
1744
1368} -
1369 -
1370/*! -
1371 Returns a localized string representation of the given \a date according -
1372 to the specified \a format. -
1373*/ -
1374 -
1375QString QLocale::toString(const QDate &date, FormatType format) const -
1376{ -
1377 if (!date.isValid())
partially evaluated: !date.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3391
0-3391
1378 return QString();
never executed: return QString();
0
1379 -
1380#ifndef QT_NO_SYSTEMLOCALE -
1381 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:1683
yes
Evaluation Count:1708
1683-1708
1382 QVariant res = systemLocale()->query(format == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(format == LongFormat
-
1383 ? QSystemLocale::DateToStringLong : QSystemLocale::DateToStringShort,
executed (the execution status of this line is deduced): ? QSystemLocale::DateToStringLong : QSystemLocale::DateToStringShort,
-
1384 date);
executed (the execution status of this line is deduced): date);
-
1385 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:1683
no
Evaluation Count:0
0-1683
1386 return res.toString();
executed: return res.toString();
Execution Count:1683
1683
1387 }
never executed: }
0
1388#endif -
1389 -
1390 QString format_str = dateFormat(format);
executed (the execution status of this line is deduced): QString format_str = dateFormat(format);
-
1391 return toString(date, format_str);
executed: return toString(date, format_str);
Execution Count:1708
1708
1392} -
1393 -
1394static bool timeFormatContainsAP(const QString &format) -
1395{ -
1396 int i = 0;
executed (the execution status of this line is deduced): int i = 0;
-
1397 while (i < format.size()) {
evaluated: i < format.size()
TRUEFALSE
yes
Evaluation Count:64412
yes
Evaluation Count:3331
3331-64412
1398 if (format.at(i).unicode() == '\'') {
evaluated: format.at(i).unicode() == '\''
TRUEFALSE
yes
Evaluation Count:765
yes
Evaluation Count:63647
765-63647
1399 qt_readEscapedFormatString(format, &i);
executed (the execution status of this line is deduced): qt_readEscapedFormatString(format, &i);
-
1400 continue;
executed: continue;
Execution Count:765
765
1401 } -
1402 -
1403 if (format.at(i).toLower().unicode() == 'a')
evaluated: format.at(i).toLower().unicode() == 'a'
TRUEFALSE
yes
Evaluation Count:2487
yes
Evaluation Count:61160
2487-61160
1404 return true;
executed: return true;
Execution Count:2487
2487
1405 -
1406 ++i;
executed (the execution status of this line is deduced): ++i;
-
1407 }
executed: }
Execution Count:61160
61160
1408 return false;
executed: return false;
Execution Count:3331
3331
1409} -
1410 -
1411static QString timeZone() -
1412{ -
1413#if defined(Q_OS_WINCE) -
1414 TIME_ZONE_INFORMATION info; -
1415 DWORD res = GetTimeZoneInformation(&info); -
1416 if (res == TIME_ZONE_ID_UNKNOWN) -
1417 return QString(); -
1418 return QString::fromWCharArray(info.StandardName); -
1419#elif defined(Q_OS_WIN) -
1420 _tzset(); -
1421# if defined(_MSC_VER) && _MSC_VER >= 1400 -
1422 size_t returnSize = 0; -
1423 char timeZoneName[512]; -
1424 if (_get_tzname(&returnSize, timeZoneName, 512, 1)) -
1425 return QString(); -
1426 return QString::fromLocal8Bit(timeZoneName); -
1427# else -
1428 return QString::fromLocal8Bit(_tzname[1]); -
1429# endif -
1430#elif defined(Q_OS_VXWORKS) -
1431 return QString(); -
1432#else -
1433 tzset();
executed (the execution status of this line is deduced): tzset();
-
1434 return QString::fromLocal8Bit(tzname[1]);
executed: return QString::fromLocal8Bit(tzname[1]);
Execution Count:2
2
1435#endif -
1436} -
1437 -
1438/*! -
1439 Returns a localized string representation of the given \a time according -
1440 to the specified \a format. -
1441 If \a format is an empty string, an empty string is returned. -
1442*/ -
1443QString QLocale::toString(const QTime &time, const QString &format) const -
1444{ -
1445 return d->dateTimeToString(format, 0, &time, this);
executed: return d->dateTimeToString(format, 0, &time, this);
Execution Count:1700
1700
1446} -
1447 -
1448/*! -
1449 \since 4.4 -
1450 -
1451 Returns a localized string representation of the given \a dateTime according -
1452 to the specified \a format. -
1453 If \a format is an empty string, an empty string is returned. -
1454*/ -
1455 -
1456QString QLocale::toString(const QDateTime &dateTime, const QString &format) const -
1457{ -
1458 const QDate dt = dateTime.date();
executed (the execution status of this line is deduced): const QDate dt = dateTime.date();
-
1459 const QTime tm = dateTime.time();
executed (the execution status of this line is deduced): const QTime tm = dateTime.time();
-
1460 return d->dateTimeToString(format, &dt, &tm, this);
executed: return d->dateTimeToString(format, &dt, &tm, this);
Execution Count:4121
4121
1461} -
1462 -
1463/*! -
1464 \since 4.4 -
1465 -
1466 Returns a localized string representation of the given \a dateTime according -
1467 to the specified \a format. -
1468*/ -
1469 -
1470QString QLocale::toString(const QDateTime &dateTime, FormatType format) const -
1471{ -
1472 if (!dateTime.isValid())
never evaluated: !dateTime.isValid()
0
1473 return QString();
never executed: return QString();
0
1474 -
1475#ifndef QT_NO_SYSTEMLOCALE -
1476 if (d->m_data == systemData()) {
never evaluated: d->m_data == systemData()
0
1477 QVariant res = systemLocale()->query(format == LongFormat
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(format == LongFormat
-
1478 ? QSystemLocale::DateTimeToStringLong
never executed (the execution status of this line is deduced): ? QSystemLocale::DateTimeToStringLong
-
1479 : QSystemLocale::DateTimeToStringShort,
never executed (the execution status of this line is deduced): : QSystemLocale::DateTimeToStringShort,
-
1480 dateTime);
never executed (the execution status of this line is deduced): dateTime);
-
1481 if (!res.isNull())
never evaluated: !res.isNull()
0
1482 return res.toString();
never executed: return res.toString();
0
1483 }
never executed: }
0
1484#endif -
1485 -
1486 const QString format_str = dateTimeFormat(format);
never executed (the execution status of this line is deduced): const QString format_str = dateTimeFormat(format);
-
1487 return toString(dateTime, format_str);
never executed: return toString(dateTime, format_str);
0
1488} -
1489 -
1490 -
1491/*! -
1492 Returns a localized string representation of the given \a time in the -
1493 specified \a format. -
1494*/ -
1495 -
1496QString QLocale::toString(const QTime &time, FormatType format) const -
1497{ -
1498 if (!time.isValid())
partially evaluated: !time.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3333
0-3333
1499 return QString();
never executed: return QString();
0
1500 -
1501#ifndef QT_NO_SYSTEMLOCALE -
1502 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:1664
yes
Evaluation Count:1669
1664-1669
1503 QVariant res = systemLocale()->query(format == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(format == LongFormat
-
1504 ? QSystemLocale::TimeToStringLong : QSystemLocale::TimeToStringShort,
executed (the execution status of this line is deduced): ? QSystemLocale::TimeToStringLong : QSystemLocale::TimeToStringShort,
-
1505 time);
executed (the execution status of this line is deduced): time);
-
1506 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:1664
no
Evaluation Count:0
0-1664
1507 return res.toString();
executed: return res.toString();
Execution Count:1664
1664
1508 }
never executed: }
0
1509#endif -
1510 -
1511 QString format_str = timeFormat(format);
executed (the execution status of this line is deduced): QString format_str = timeFormat(format);
-
1512 return toString(time, format_str);
executed: return toString(time, format_str);
Execution Count:1669
1669
1513} -
1514 -
1515/*! -
1516 \since 4.1 -
1517 -
1518 Returns the date format used for the current locale. -
1519 -
1520 If \a format is LongFormat the format will be a long version. -
1521 Otherwise it uses a shorter version. -
1522 -
1523 \sa QDate::toString(), QDate::fromString() -
1524*/ -
1525 -
1526QString QLocale::dateFormat(FormatType format) const -
1527{ -
1528#ifndef QT_NO_SYSTEMLOCALE -
1529 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1871
10-1871
1530 QVariant res = systemLocale()->query(format == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(format == LongFormat
-
1531 ? QSystemLocale::DateFormatLong : QSystemLocale::DateFormatShort,
executed (the execution status of this line is deduced): ? QSystemLocale::DateFormatLong : QSystemLocale::DateFormatShort,
-
1532 QVariant());
executed (the execution status of this line is deduced): QVariant());
-
1533 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
1534 return res.toString();
executed: return res.toString();
Execution Count:10
10
1535 }
never executed: }
0
1536#endif -
1537 -
1538 quint32 idx, size;
executed (the execution status of this line is deduced): quint32 idx, size;
-
1539 switch (format) { -
1540 case LongFormat: -
1541 idx = d->m_data->m_long_date_format_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_long_date_format_idx;
-
1542 size = d->m_data->m_long_date_format_size;
executed (the execution status of this line is deduced): size = d->m_data->m_long_date_format_size;
-
1543 break;
executed: break;
Execution Count:27
27
1544 default: -
1545 idx = d->m_data->m_short_date_format_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_short_date_format_idx;
-
1546 size = d->m_data->m_short_date_format_size;
executed (the execution status of this line is deduced): size = d->m_data->m_short_date_format_size;
-
1547 break;
executed: break;
Execution Count:1844
1844
1548 } -
1549 return getLocaleData(date_format_data + idx, size);
executed: return getLocaleData(date_format_data + idx, size);
Execution Count:1871
1871
1550} -
1551 -
1552/*! -
1553 \since 4.1 -
1554 -
1555 Returns the time format used for the current locale. -
1556 -
1557 If \a format is LongFormat the format will be a long version. -
1558 Otherwise it uses a shorter version. -
1559 -
1560 \sa QTime::toString(), QTime::fromString() -
1561*/ -
1562 -
1563QString QLocale::timeFormat(FormatType format) const -
1564{ -
1565#ifndef QT_NO_SYSTEMLOCALE -
1566 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1833
10-1833
1567 QVariant res = systemLocale()->query(format == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(format == LongFormat
-
1568 ? QSystemLocale::TimeFormatLong : QSystemLocale::TimeFormatShort,
executed (the execution status of this line is deduced): ? QSystemLocale::TimeFormatLong : QSystemLocale::TimeFormatShort,
-
1569 QVariant());
executed (the execution status of this line is deduced): QVariant());
-
1570 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
1571 return res.toString();
executed: return res.toString();
Execution Count:10
10
1572 }
never executed: }
0
1573#endif -
1574 -
1575 quint32 idx, size;
executed (the execution status of this line is deduced): quint32 idx, size;
-
1576 switch (format) { -
1577 case LongFormat: -
1578 idx = d->m_data->m_long_time_format_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_long_time_format_idx;
-
1579 size = d->m_data->m_long_time_format_size;
executed (the execution status of this line is deduced): size = d->m_data->m_long_time_format_size;
-
1580 break;
executed: break;
Execution Count:28
28
1581 default: -
1582 idx = d->m_data->m_short_time_format_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_short_time_format_idx;
-
1583 size = d->m_data->m_short_time_format_size;
executed (the execution status of this line is deduced): size = d->m_data->m_short_time_format_size;
-
1584 break;
executed: break;
Execution Count:1805
1805
1585 } -
1586 return getLocaleData(time_format_data + idx, size);
executed: return getLocaleData(time_format_data + idx, size);
Execution Count:1833
1833
1587} -
1588 -
1589/*! -
1590 \since 4.4 -
1591 -
1592 Returns the date time format used for the current locale. -
1593 -
1594 If \a format is ShortFormat the format will be a short version. -
1595 Otherwise it uses a longer version. -
1596 -
1597 \sa QDateTime::toString(), QDateTime::fromString() -
1598*/ -
1599 -
1600QString QLocale::dateTimeFormat(FormatType format) const -
1601{ -
1602#ifndef QT_NO_SYSTEMLOCALE -
1603 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:93
13-93
1604 QVariant res = systemLocale()->query(format == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(format == LongFormat
-
1605 ? QSystemLocale::DateTimeFormatLong
executed (the execution status of this line is deduced): ? QSystemLocale::DateTimeFormatLong
-
1606 : QSystemLocale::DateTimeFormatShort,
executed (the execution status of this line is deduced): : QSystemLocale::DateTimeFormatShort,
-
1607 QVariant());
executed (the execution status of this line is deduced): QVariant());
-
1608 if (!res.isNull()) {
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
1609 return res.toString();
executed: return res.toString();
Execution Count:13
13
1610 } -
1611 }
never executed: }
0
1612#endif -
1613 return dateFormat(format) + QLatin1Char(' ') + timeFormat(format);
executed: return dateFormat(format) + QLatin1Char(' ') + timeFormat(format);
Execution Count:93
93
1614} -
1615 -
1616/*! -
1617 \since 4.4 -
1618 -
1619 Parses the time string given in \a string and returns the -
1620 time. The format of the time string is chosen according to the -
1621 \a format parameter (see timeFormat()). -
1622 -
1623 If the time could not be parsed, returns an invalid time. -
1624 -
1625 \sa timeFormat(), toDate(), toDateTime(), QTime::fromString() -
1626*/ -
1627#ifndef QT_NO_DATESTRING -
1628QTime QLocale::toTime(const QString &string, FormatType format) const -
1629{ -
1630 return toTime(string, timeFormat(format));
never executed: return toTime(string, timeFormat(format));
0
1631} -
1632#endif -
1633 -
1634/*! -
1635 \since 4.4 -
1636 -
1637 Parses the date string given in \a string and returns the -
1638 date. The format of the date string is chosen according to the -
1639 \a format parameter (see dateFormat()). -
1640 -
1641 If the date could not be parsed, returns an invalid date. -
1642 -
1643 \sa dateFormat(), toTime(), toDateTime(), QDate::fromString() -
1644*/ -
1645#ifndef QT_NO_DATESTRING -
1646QDate QLocale::toDate(const QString &string, FormatType format) const -
1647{ -
1648 return toDate(string, dateFormat(format));
never executed: return toDate(string, dateFormat(format));
0
1649} -
1650#endif -
1651 -
1652/*! -
1653 \since 4.4 -
1654 -
1655 Parses the date/time string given in \a string and returns the -
1656 time. The format of the date/time string is chosen according to the -
1657 \a format parameter (see dateTimeFormat()). -
1658 -
1659 If the string could not be parsed, returns an invalid QDateTime. -
1660 -
1661 \sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString() -
1662*/ -
1663 -
1664#ifndef QT_NO_DATESTRING -
1665QDateTime QLocale::toDateTime(const QString &string, FormatType format) const -
1666{ -
1667 return toDateTime(string, dateTimeFormat(format));
never executed: return toDateTime(string, dateTimeFormat(format));
0
1668} -
1669#endif -
1670 -
1671/*! -
1672 \since 4.4 -
1673 -
1674 Parses the time string given in \a string and returns the -
1675 time. See QTime::fromString() for information on what is a valid -
1676 format string. -
1677 -
1678 If the time could not be parsed, returns an invalid time. -
1679 -
1680 \sa timeFormat(), toDate(), toDateTime(), QTime::fromString() -
1681*/ -
1682#ifndef QT_NO_DATESTRING -
1683QTime QLocale::toTime(const QString &string, const QString &format) const -
1684{ -
1685 QTime time;
never executed (the execution status of this line is deduced): QTime time;
-
1686#ifndef QT_BOOTSTRAPPED -
1687 QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString);
never executed (the execution status of this line is deduced): QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString);
-
1688 dt.defaultLocale = *this;
never executed (the execution status of this line is deduced): dt.defaultLocale = *this;
-
1689 if (dt.parseFormat(format))
never evaluated: dt.parseFormat(format)
0
1690 dt.fromString(string, 0, &time);
never executed: dt.fromString(string, 0, &time);
0
1691#else -
1692 Q_UNUSED(string); -
1693 Q_UNUSED(format); -
1694#endif -
1695 return time;
never executed: return time;
0
1696} -
1697#endif -
1698 -
1699/*! -
1700 \since 4.4 -
1701 -
1702 Parses the date string given in \a string and returns the -
1703 date. See QDate::fromString() for information on the expressions -
1704 that can be used with this function. -
1705 -
1706 This function searches month names and the names of the days of -
1707 the week in the current locale. -
1708 -
1709 If the date could not be parsed, returns an invalid date. -
1710 -
1711 \sa dateFormat(), toTime(), toDateTime(), QDate::fromString() -
1712*/ -
1713#ifndef QT_NO_DATESTRING -
1714QDate QLocale::toDate(const QString &string, const QString &format) const -
1715{ -
1716 QDate date;
never executed (the execution status of this line is deduced): QDate date;
-
1717#ifndef QT_BOOTSTRAPPED -
1718 QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString);
never executed (the execution status of this line is deduced): QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString);
-
1719 dt.defaultLocale = *this;
never executed (the execution status of this line is deduced): dt.defaultLocale = *this;
-
1720 if (dt.parseFormat(format))
never evaluated: dt.parseFormat(format)
0
1721 dt.fromString(string, &date, 0);
never executed: dt.fromString(string, &date, 0);
0
1722#else -
1723 Q_UNUSED(string); -
1724 Q_UNUSED(format); -
1725#endif -
1726 return date;
never executed: return date;
0
1727} -
1728#endif -
1729 -
1730/*! -
1731 \since 4.4 -
1732 -
1733 Parses the date/time string given in \a string and returns the -
1734 time. See QDateTime::fromString() for information on the expressions -
1735 that can be used with this function. -
1736 -
1737 \note The month and day names used must be given in the user's local -
1738 language. -
1739 -
1740 If the string could not be parsed, returns an invalid QDateTime. -
1741 -
1742 \sa dateTimeFormat(), toTime(), toDate(), QDateTime::fromString() -
1743*/ -
1744#ifndef QT_NO_DATESTRING -
1745QDateTime QLocale::toDateTime(const QString &string, const QString &format) const -
1746{ -
1747#ifndef QT_BOOTSTRAPPED -
1748 QTime time;
executed (the execution status of this line is deduced): QTime time;
-
1749 QDate date;
executed (the execution status of this line is deduced): QDate date;
-
1750 -
1751 QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString);
executed (the execution status of this line is deduced): QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString);
-
1752 dt.defaultLocale = *this;
executed (the execution status of this line is deduced): dt.defaultLocale = *this;
-
1753 if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
partially evaluated: dt.parseFormat(format)
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
partially evaluated: dt.fromString(string, &date, &time)
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1754 return QDateTime(date, time);
executed: return QDateTime(date, time);
Execution Count:21
21
1755#else -
1756 Q_UNUSED(string); -
1757 Q_UNUSED(format); -
1758#endif -
1759 return QDateTime(QDate(), QTime(-1, -1, -1));
never executed: return QDateTime(QDate(), QTime(-1, -1, -1));
0
1760} -
1761#endif -
1762 -
1763 -
1764/*! -
1765 \since 4.1 -
1766 -
1767 Returns the decimal point character of this locale. -
1768*/ -
1769QChar QLocale::decimalPoint() const -
1770{ -
1771 return d->decimal();
executed: return d->decimal();
Execution Count:2043
2043
1772} -
1773 -
1774/*! -
1775 \since 4.1 -
1776 -
1777 Returns the group separator character of this locale. -
1778*/ -
1779QChar QLocale::groupSeparator() const -
1780{ -
1781 return d->group();
executed: return d->group();
Execution Count:5889
5889
1782} -
1783 -
1784/*! -
1785 \since 4.1 -
1786 -
1787 Returns the percent character of this locale. -
1788*/ -
1789QChar QLocale::percent() const -
1790{ -
1791 return d->percent();
never executed: return d->percent();
0
1792} -
1793 -
1794/*! -
1795 \since 4.1 -
1796 -
1797 Returns the zero digit character of this locale. -
1798*/ -
1799QChar QLocale::zeroDigit() const -
1800{ -
1801 return d->zero();
executed: return d->zero();
Execution Count:45
45
1802} -
1803 -
1804/*! -
1805 \since 4.1 -
1806 -
1807 Returns the negative sign character of this locale. -
1808*/ -
1809QChar QLocale::negativeSign() const -
1810{ -
1811 return d->minus();
executed: return d->minus();
Execution Count:57112
57112
1812} -
1813 -
1814/*! -
1815 \since 4.5 -
1816 -
1817 Returns the positive sign character of this locale. -
1818*/ -
1819QChar QLocale::positiveSign() const -
1820{ -
1821 return d->plus();
executed: return d->plus();
Execution Count:35726
35726
1822} -
1823 -
1824/*! -
1825 \since 4.1 -
1826 -
1827 Returns the exponential character of this locale. -
1828*/ -
1829QChar QLocale::exponential() const -
1830{ -
1831 return d->exponential();
executed: return d->exponential();
Execution Count:81
81
1832} -
1833 -
1834static bool qIsUpper(char c) -
1835{ -
1836 return c >= 'A' && c <= 'Z';
executed: return c >= 'A' && c <= 'Z';
Execution Count:997
997
1837} -
1838 -
1839static char qToLower(char c) -
1840{ -
1841 if (c >= 'A' && c <= 'Z')
partially evaluated: c >= 'A'
TRUEFALSE
yes
Evaluation Count:997
no
Evaluation Count:0
partially evaluated: c <= 'Z'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:997
0-997
1842 return c - 'A' + 'a';
never executed: return c - 'A' + 'a';
0
1843 else -
1844 return c;
executed: return c;
Execution Count:997
997
1845} -
1846 -
1847/*! -
1848 \overload -
1849 -
1850 \a f and \a prec have the same meaning as in QString::number(double, char, int). -
1851 -
1852 \sa toDouble() -
1853*/ -
1854 -
1855QString QLocale::toString(double i, char f, int prec) const -
1856{ -
1857 QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal;
executed (the execution status of this line is deduced): QLocalePrivate::DoubleForm form = QLocalePrivate::DFDecimal;
-
1858 uint flags = 0;
executed (the execution status of this line is deduced): uint flags = 0;
-
1859 -
1860 if (qIsUpper(f))
partially evaluated: qIsUpper(f)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:997
0-997
1861 flags = QLocalePrivate::CapitalEorX;
never executed: flags = QLocalePrivate::CapitalEorX;
0
1862 f = qToLower(f);
executed (the execution status of this line is deduced): f = qToLower(f);
-
1863 -
1864 switch (f) { -
1865 case 'f': -
1866 form = QLocalePrivate::DFDecimal;
executed (the execution status of this line is deduced): form = QLocalePrivate::DFDecimal;
-
1867 break;
executed: break;
Execution Count:929
929
1868 case 'e': -
1869 form = QLocalePrivate::DFExponent;
never executed (the execution status of this line is deduced): form = QLocalePrivate::DFExponent;
-
1870 break;
never executed: break;
0
1871 case 'g': -
1872 form = QLocalePrivate::DFSignificantDigits;
executed (the execution status of this line is deduced): form = QLocalePrivate::DFSignificantDigits;
-
1873 break;
executed: break;
Execution Count:68
68
1874 default: -
1875 break;
never executed: break;
0
1876 } -
1877 -
1878 if (!(d->m_numberOptions & OmitGroupSeparator))
evaluated: !(d->m_numberOptions & OmitGroupSeparator)
TRUEFALSE
yes
Evaluation Count:986
yes
Evaluation Count:11
11-986
1879 flags |= QLocalePrivate::ThousandsGroup;
executed: flags |= QLocalePrivate::ThousandsGroup;
Execution Count:986
986
1880 return d->doubleToString(i, prec, form, -1, flags);
executed: return d->doubleToString(i, prec, form, -1, flags);
Execution Count:997
997
1881} -
1882 -
1883/*! -
1884 \fn QLocale QLocale::c() -
1885 -
1886 Returns a QLocale object initialized to the "C" locale. -
1887 -
1888 \sa system() -
1889*/ -
1890 -
1891/*! -
1892 Returns a QLocale object initialized to the system locale. -
1893 -
1894 On Windows and Mac, this locale will use the decimal/grouping characters and date/time -
1895 formats specified in the system configuration panel. -
1896 -
1897 \sa c() -
1898*/ -
1899 -
1900QLocale QLocale::system() -
1901{ -
1902 return QLocale(*new QLocalePrivate(localeDataIndex(systemData())));
executed: return QLocale(*new QLocalePrivate(localeDataIndex(systemData())));
Execution Count:4659
4659
1903} -
1904 -
1905 -
1906/*! -
1907 \since 4.8 -
1908 -
1909 Returns a list of valid locale objects that match the given \a language, \a -
1910 script and \a country. -
1911 -
1912 Getting a list of all locales: -
1913 QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); -
1914 -
1915 Getting a list of locales suitable for Russia: -
1916 QList<QLocale> locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::Russia); -
1917*/ -
1918QList<QLocale> QLocale::matchingLocales(QLocale::Language language, -
1919 QLocale::Script script, -
1920 QLocale::Country country) -
1921{ -
1922 if (uint(language) > QLocale::LastLanguage || uint(script) > QLocale::LastScript ||
partially evaluated: uint(language) > QLocale::LastLanguage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: uint(script) > QLocale::LastScript
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1923 uint(country) > QLocale::LastCountry)
partially evaluated: uint(country) > QLocale::LastCountry
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1924 return QList<QLocale>();
never executed: return QList<QLocale>();
0
1925 -
1926 if (language == QLocale::C)
evaluated: language == QLocale::C
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
1927 return QList<QLocale>() << QLocale(QLocale::C);
executed: return QList<QLocale>() << QLocale(QLocale::C);
Execution Count:1
1
1928 -
1929 QList<QLocale> result;
executed (the execution status of this line is deduced): QList<QLocale> result;
-
1930 if (language == QLocale::AnyLanguage && script == QLocale::AnyScript && country == QLocale::AnyCountry)
evaluated: language == QLocale::AnyLanguage
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
evaluated: script == QLocale::AnyScript
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: country == QLocale::AnyCountry
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-2
1931 result.reserve(locale_data_size);
never executed: result.reserve(locale_data_size);
0
1932 const QLocaleData *data = locale_data + locale_index[language];
executed (the execution status of this line is deduced): const QLocaleData *data = locale_data + locale_index[language];
-
1933 while ( (data != locale_data + locale_data_size)
evaluated: (data != locale_data + locale_data_size)
TRUEFALSE
yes
Evaluation Count:890
yes
Evaluation Count:2
2-890
1934 && (language == QLocale::AnyLanguage || data->m_language_id == uint(language))) {
evaluated: language == QLocale::AnyLanguage
TRUEFALSE
yes
Evaluation Count:876
yes
Evaluation Count:14
evaluated: data->m_language_id == uint(language)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
2-876
1935 if ((script == QLocale::AnyScript || data->m_script_id == uint(script))
evaluated: script == QLocale::AnyScript
TRUEFALSE
yes
Evaluation Count:444
yes
Evaluation Count:444
evaluated: data->m_script_id == uint(script)
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:416
28-444
1936 && (country == QLocale::AnyCountry || data->m_country_id == uint(country))) {
evaluated: country == QLocale::AnyCountry
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:444
evaluated: data->m_country_id == uint(country)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:440
4-444
1937 QLocale locale(*new QLocalePrivate(localeDataIndex(data)));
executed (the execution status of this line is deduced): QLocale locale(*new QLocalePrivate(localeDataIndex(data)));
-
1938 result.append(locale);
executed (the execution status of this line is deduced): result.append(locale);
-
1939 }
executed: }
Execution Count:32
32
1940 ++data;
executed (the execution status of this line is deduced): ++data;
-
1941 }
executed: }
Execution Count:888
888
1942 return result;
executed: return result;
Execution Count:4
4
1943} -
1944 -
1945/*! -
1946 \obsolete -
1947 \since 4.3 -
1948 -
1949 Returns the list of countries that have entries for \a language in Qt's locale -
1950 database. If the result is an empty list, then \a language is not represented in -
1951 Qt's locale database. -
1952 -
1953 \sa matchingLocales() -
1954*/ -
1955QList<QLocale::Country> QLocale::countriesForLanguage(Language language) -
1956{ -
1957 QList<Country> result;
never executed (the execution status of this line is deduced): QList<Country> result;
-
1958 if (language == C) {
never evaluated: language == C
0
1959 result << AnyCountry;
never executed (the execution status of this line is deduced): result << AnyCountry;
-
1960 return result;
never executed: return result;
0
1961 } -
1962 -
1963 unsigned language_id = language;
never executed (the execution status of this line is deduced): unsigned language_id = language;
-
1964 const QLocaleData *data = locale_data + locale_index[language_id];
never executed (the execution status of this line is deduced): const QLocaleData *data = locale_data + locale_index[language_id];
-
1965 while (data->m_language_id == language_id) {
never evaluated: data->m_language_id == language_id
0
1966 const QLocale::Country country = static_cast<Country>(data->m_country_id);
never executed (the execution status of this line is deduced): const QLocale::Country country = static_cast<Country>(data->m_country_id);
-
1967 if (!result.contains(country))
never evaluated: !result.contains(country)
0
1968 result.append(country);
never executed: result.append(country);
0
1969 ++data;
never executed (the execution status of this line is deduced): ++data;
-
1970 }
never executed: }
0
1971 -
1972 return result;
never executed: return result;
0
1973} -
1974 -
1975/*! -
1976 \since 4.2 -
1977 -
1978 Returns the localized name of \a month, in the format specified -
1979 by \a type. -
1980 -
1981 \sa dayName(), standaloneMonthName() -
1982*/ -
1983QString QLocale::monthName(int month, FormatType type) const -
1984{ -
1985 if (month < 1 || month > 12)
evaluated: month < 1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:27036
evaluated: month > 12
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:27030
6-27036
1986 return QString();
executed: return QString();
Execution Count:12
12
1987 -
1988#ifndef QT_NO_SYSTEMLOCALE -
1989 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:12114
yes
Evaluation Count:14916
12114-14916
1990 QVariant res = systemLocale()->query(type == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(type == LongFormat
-
1991 ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
executed (the execution status of this line is deduced): ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
-
1992 month);
executed (the execution status of this line is deduced): month);
-
1993 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:12114
no
Evaluation Count:0
0-12114
1994 return res.toString();
executed: return res.toString();
Execution Count:12114
12114
1995 }
never executed: }
0
1996#endif -
1997 -
1998 quint32 idx, size;
executed (the execution status of this line is deduced): quint32 idx, size;
-
1999 switch (type) { -
2000 case QLocale::LongFormat: -
2001 idx = d->m_data->m_long_month_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_long_month_names_idx;
-
2002 size = d->m_data->m_long_month_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_long_month_names_size;
-
2003 break;
executed: break;
Execution Count:4445
4445
2004 case QLocale::ShortFormat: -
2005 idx = d->m_data->m_short_month_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_short_month_names_idx;
-
2006 size = d->m_data->m_short_month_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_short_month_names_size;
-
2007 break;
executed: break;
Execution Count:10468
10468
2008 case QLocale::NarrowFormat: -
2009 idx = d->m_data->m_narrow_month_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_narrow_month_names_idx;
-
2010 size = d->m_data->m_narrow_month_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_narrow_month_names_size;
-
2011 break;
executed: break;
Execution Count:3
3
2012 default: -
2013 return QString();
never executed: return QString();
0
2014 } -
2015 return getLocaleListData(months_data + idx, size, month - 1);
executed: return getLocaleListData(months_data + idx, size, month - 1);
Execution Count:14916
14916
2016} -
2017 -
2018/*! -
2019 \since 4.5 -
2020 -
2021 Returns the localized name of \a month that is used as a -
2022 standalone text, in the format specified by \a type. -
2023 -
2024 If the locale information doesn't specify the standalone month -
2025 name then return value is the same as in monthName(). -
2026 -
2027 \sa monthName(), standaloneDayName() -
2028*/ -
2029QString QLocale::standaloneMonthName(int month, FormatType type) const -
2030{ -
2031 if (month < 1 || month > 12)
partially evaluated: month < 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1222
partially evaluated: month > 12
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1222
0-1222
2032 return QString();
never executed: return QString();
0
2033 -
2034#ifndef QT_NO_SYSTEMLOCALE -
2035 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:537
yes
Evaluation Count:685
537-685
2036 QVariant res = systemLocale()->query(type == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(type == LongFormat
-
2037 ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
executed (the execution status of this line is deduced): ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
-
2038 month);
executed (the execution status of this line is deduced): month);
-
2039 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:537
no
Evaluation Count:0
0-537
2040 return res.toString();
executed: return res.toString();
Execution Count:537
537
2041 }
never executed: }
0
2042#endif -
2043 -
2044 quint32 idx, size;
executed (the execution status of this line is deduced): quint32 idx, size;
-
2045 switch (type) { -
2046 case QLocale::LongFormat: -
2047 idx = d->m_data->m_standalone_long_month_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_standalone_long_month_names_idx;
-
2048 size = d->m_data->m_standalone_long_month_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_standalone_long_month_names_size;
-
2049 break;
executed: break;
Execution Count:680
680
2050 case QLocale::ShortFormat: -
2051 idx = d->m_data->m_standalone_short_month_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_standalone_short_month_names_idx;
-
2052 size = d->m_data->m_standalone_short_month_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_standalone_short_month_names_size;
-
2053 break;
executed: break;
Execution Count:3
3
2054 case QLocale::NarrowFormat: -
2055 idx = d->m_data->m_standalone_narrow_month_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_standalone_narrow_month_names_idx;
-
2056 size = d->m_data->m_standalone_narrow_month_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_standalone_narrow_month_names_size;
-
2057 break;
executed: break;
Execution Count:2
2
2058 default: -
2059 return QString();
never executed: return QString();
0
2060 } -
2061 QString name = getLocaleListData(months_data + idx, size, month - 1);
executed (the execution status of this line is deduced): QString name = getLocaleListData(months_data + idx, size, month - 1);
-
2062 if (name.isEmpty())
partially evaluated: name.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:685
0-685
2063 return monthName(month, type);
never executed: return monthName(month, type);
0
2064 return name;
executed: return name;
Execution Count:685
685
2065} -
2066 -
2067/*! -
2068 \since 4.2 -
2069 -
2070 Returns the localized name of the \a day (where 1 represents -
2071 Monday, 2 represents Tuesday and so on), in the format specified -
2072 by \a type. -
2073 -
2074 \sa monthName(), standaloneDayName() -
2075*/ -
2076QString QLocale::dayName(int day, FormatType type) const -
2077{ -
2078 if (day < 1 || day > 7)
partially evaluated: day < 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2463
partially evaluated: day > 7
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2463
0-2463
2079 return QString();
never executed: return QString();
0
2080 -
2081#ifndef QT_NO_SYSTEMLOCALE -
2082 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:821
yes
Evaluation Count:1642
821-1642
2083 QVariant res = systemLocale()->query(type == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(type == LongFormat
-
2084 ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort,
executed (the execution status of this line is deduced): ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort,
-
2085 day);
executed (the execution status of this line is deduced): day);
-
2086 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:821
no
Evaluation Count:0
0-821
2087 return res.toString();
executed: return res.toString();
Execution Count:821
821
2088 }
never executed: }
0
2089#endif -
2090 if (day == 7)
evaluated: day == 7
TRUEFALSE
yes
Evaluation Count:288
yes
Evaluation Count:1354
288-1354
2091 day = 0;
executed: day = 0;
Execution Count:288
288
2092 -
2093 quint32 idx, size;
executed (the execution status of this line is deduced): quint32 idx, size;
-
2094 switch (type) { -
2095 case QLocale::LongFormat: -
2096 idx = d->m_data->m_long_day_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_long_day_names_idx;
-
2097 size = d->m_data->m_long_day_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_long_day_names_size;
-
2098 break;
executed: break;
Execution Count:311
311
2099 case QLocale::ShortFormat: -
2100 idx = d->m_data->m_short_day_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_short_day_names_idx;
-
2101 size = d->m_data->m_short_day_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_short_day_names_size;
-
2102 break;
executed: break;
Execution Count:1329
1329
2103 case QLocale::NarrowFormat: -
2104 idx = d->m_data->m_narrow_day_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_narrow_day_names_idx;
-
2105 size = d->m_data->m_narrow_day_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_narrow_day_names_size;
-
2106 break;
executed: break;
Execution Count:2
2
2107 default: -
2108 return QString();
never executed: return QString();
0
2109 } -
2110 return getLocaleListData(days_data + idx, size, day);
executed: return getLocaleListData(days_data + idx, size, day);
Execution Count:1642
1642
2111} -
2112 -
2113/*! -
2114 \since 4.5 -
2115 -
2116 Returns the localized name of the \a day (where 1 represents -
2117 Monday, 2 represents Tuesday and so on) that is used as a -
2118 standalone text, in the format specified by \a type. -
2119 -
2120 If the locale information does not specify the standalone day -
2121 name then return value is the same as in dayName(). -
2122 -
2123 \sa dayName(), standaloneMonthName() -
2124*/ -
2125QString QLocale::standaloneDayName(int day, FormatType type) const -
2126{ -
2127 if (day < 1 || day > 7)
evaluated: day < 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:40
evaluated: day > 7
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:37
3-40
2128 return QString();
executed: return QString();
Execution Count:6
6
2129 -
2130#ifndef QT_NO_SYSTEMLOCALE -
2131 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:9
9-28
2132 QVariant res = systemLocale()->query(type == LongFormat
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(type == LongFormat
-
2133 ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort,
executed (the execution status of this line is deduced): ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort,
-
2134 day);
executed (the execution status of this line is deduced): day);
-
2135 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:28
no
Evaluation Count:0
0-28
2136 return res.toString();
executed: return res.toString();
Execution Count:28
28
2137 }
never executed: }
0
2138#endif -
2139 if (day == 7)
evaluated: day == 7
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
2140 day = 0;
executed: day = 0;
Execution Count:6
6
2141 -
2142 quint32 idx, size;
executed (the execution status of this line is deduced): quint32 idx, size;
-
2143 switch (type) { -
2144 case QLocale::LongFormat: -
2145 idx = d->m_data->m_standalone_long_day_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_standalone_long_day_names_idx;
-
2146 size = d->m_data->m_standalone_long_day_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_standalone_long_day_names_size;
-
2147 break;
executed: break;
Execution Count:5
5
2148 case QLocale::ShortFormat: -
2149 idx = d->m_data->m_standalone_short_day_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_standalone_short_day_names_idx;
-
2150 size = d->m_data->m_standalone_short_day_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_standalone_short_day_names_size;
-
2151 break;
executed: break;
Execution Count:2
2
2152 case QLocale::NarrowFormat: -
2153 idx = d->m_data->m_standalone_narrow_day_names_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_standalone_narrow_day_names_idx;
-
2154 size = d->m_data->m_standalone_narrow_day_names_size;
executed (the execution status of this line is deduced): size = d->m_data->m_standalone_narrow_day_names_size;
-
2155 break;
executed: break;
Execution Count:2
2
2156 default: -
2157 return QString();
never executed: return QString();
0
2158 } -
2159 QString name = getLocaleListData(days_data + idx, size, day);
executed (the execution status of this line is deduced): QString name = getLocaleListData(days_data + idx, size, day);
-
2160 if (name.isEmpty())
partially evaluated: name.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
2161 return dayName(day == 0 ? 7 : day, type);
never executed: return dayName(day == 0 ? 7 : day, type);
0
2162 return name;
executed: return name;
Execution Count:9
9
2163} -
2164 -
2165/*! -
2166 \since 4.8 -
2167 -
2168 Returns the first day of the week according to the current locale. -
2169*/ -
2170Qt::DayOfWeek QLocale::firstDayOfWeek() const -
2171{ -
2172#ifndef QT_NO_SYSTEMLOCALE -
2173 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:37
22-37
2174 QVariant res = systemLocale()->query(QSystemLocale::FirstDayOfWeek, QVariant());
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::FirstDayOfWeek, QVariant());
-
2175 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:22
no
Evaluation Count:0
0-22
2176 return static_cast<Qt::DayOfWeek>(res.toUInt());
executed: return static_cast<Qt::DayOfWeek>(res.toUInt());
Execution Count:22
22
2177 }
never executed: }
0
2178#endif -
2179 return static_cast<Qt::DayOfWeek>(d->m_data->m_first_day_of_week);
executed: return static_cast<Qt::DayOfWeek>(d->m_data->m_first_day_of_week);
Execution Count:37
37
2180} -
2181 -
2182QLocale::MeasurementSystem QLocalePrivate::measurementSystem() const -
2183{ -
2184 for (int i = 0; i < ImperialMeasurementSystemsCount; ++i) {
evaluated: i < ImperialMeasurementSystemsCount
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:2
2-16
2185 if (ImperialMeasurementSystems[i].languageId == m_data->m_language_id
evaluated: ImperialMeasurementSystems[i].languageId == m_data->m_language_id
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:9
7-9
2186 && ImperialMeasurementSystems[i].countryId == m_data->m_country_id) {
evaluated: ImperialMeasurementSystems[i].countryId == m_data->m_country_id
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
2187 return ImperialMeasurementSystems[i].system;
executed: return ImperialMeasurementSystems[i].system;
Execution Count:2
2
2188 } -
2189 }
executed: }
Execution Count:14
14
2190 return QLocale::MetricSystem;
executed: return QLocale::MetricSystem;
Execution Count:2
2
2191} -
2192 -
2193/*! -
2194 \since 4.8 -
2195 -
2196 Returns a list of days that are considered weekdays according to the current locale. -
2197*/ -
2198QList<Qt::DayOfWeek> QLocale::weekdays() const -
2199{ -
2200#ifndef QT_NO_SYSTEMLOCALE -
2201 if (d->m_data == systemData()) {
partially evaluated: d->m_data == systemData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2202 QVariant res = systemLocale()->query(QSystemLocale::Weekdays, QVariant());
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::Weekdays, QVariant());
-
2203 if (!res.isNull())
never evaluated: !res.isNull()
0
2204 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
2205 }
never executed: }
0
2206#endif -
2207 QList<Qt::DayOfWeek> weekdays;
executed (the execution status of this line is deduced): QList<Qt::DayOfWeek> weekdays;
-
2208 quint16 weekendStart = d->m_data->m_weekend_start;
executed (the execution status of this line is deduced): quint16 weekendStart = d->m_data->m_weekend_start;
-
2209 quint16 weekendEnd = d->m_data->m_weekend_end;
executed (the execution status of this line is deduced): quint16 weekendEnd = d->m_data->m_weekend_end;
-
2210 for (int day = Qt::Monday; day <= Qt::Sunday; day++) {
evaluated: day <= Qt::Sunday
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1
1-7
2211 if ((weekendEnd >= weekendStart && (day < weekendStart || day > weekendEnd)) ||
partially evaluated: weekendEnd >= weekendStart
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
evaluated: day < weekendStart
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
partially evaluated: day > weekendEnd
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-7
2212 (weekendEnd < weekendStart && (day > weekendEnd && day < weekendStart)))
partially evaluated: weekendEnd < weekendStart
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: day > weekendEnd
never evaluated: day < weekendStart
0-2
2213 weekdays << static_cast<Qt::DayOfWeek>(day);
executed: weekdays << static_cast<Qt::DayOfWeek>(day);
Execution Count:5
5
2214 }
executed: }
Execution Count:7
7
2215 return weekdays;
executed: return weekdays;
Execution Count:1
1
2216} -
2217 -
2218/*! -
2219 \since 4.4 -
2220 -
2221 Returns the measurement system for the locale. -
2222*/ -
2223QLocale::MeasurementSystem QLocale::measurementSystem() const -
2224{ -
2225#ifndef QT_NO_SYSTEMLOCALE -
2226 if (d->m_data == systemData()) {
partially evaluated: d->m_data == systemData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2227 QVariant res = systemLocale()->query(QSystemLocale::MeasurementSystem, QVariant());
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::MeasurementSystem, QVariant());
-
2228 if (!res.isNull())
never evaluated: !res.isNull()
0
2229 return MeasurementSystem(res.toInt());
never executed: return MeasurementSystem(res.toInt());
0
2230 }
never executed: }
0
2231#endif -
2232 -
2233 return d->measurementSystem();
executed: return d->measurementSystem();
Execution Count:4
4
2234} -
2235 -
2236/*! -
2237 \since 4.7 -
2238 -
2239 Returns the text direction of the language. -
2240*/ -
2241Qt::LayoutDirection QLocale::textDirection() const -
2242{ -
2243 switch (language()) { -
2244 case QLocale::Arabic: -
2245 case QLocale::Hebrew: -
2246 case QLocale::Persian: -
2247 case QLocale::Pashto: -
2248 case QLocale::Urdu: -
2249 case QLocale::Syriac: -
2250 case QLocale::Divehi: -
2251 return Qt::RightToLeft;
never executed: return Qt::RightToLeft;
0
2252 case QLocale::Punjabi: -
2253 case QLocale::Uzbek: -
2254 if (script() == QLocale::ArabicScript)
never evaluated: script() == QLocale::ArabicScript
0
2255 return Qt::RightToLeft;
never executed: return Qt::RightToLeft;
0
2256 // fall through -
2257 default: -
2258 break;
never executed: break;
0
2259 } -
2260 return Qt::LeftToRight;
never executed: return Qt::LeftToRight;
0
2261} -
2262 -
2263/*! -
2264 \since 4.8 -
2265 -
2266 Returns an uppercase copy of \a str. -
2267*/ -
2268QString QLocale::toUpper(const QString &str) const -
2269{ -
2270#ifdef QT_USE_ICU -
2271 bool ok = true;
executed (the execution status of this line is deduced): bool ok = true;
-
2272 QString result = QIcu::toUpper(d->m_localeID, str, &ok);
executed (the execution status of this line is deduced): QString result = QIcu::toUpper(d->m_localeID, str, &ok);
-
2273 if (ok)
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2274 return result;
executed: return result;
Execution Count:3
3
2275 // else fall through and use Qt's toUpper -
2276#endif -
2277 return str.toUpper();
never executed: return str.toUpper();
0
2278} -
2279 -
2280/*! -
2281 \since 4.8 -
2282 -
2283 Returns a lowercase copy of \a str. -
2284*/ -
2285QString QLocale::toLower(const QString &str) const -
2286{ -
2287#ifdef QT_USE_ICU -
2288 bool ok = true;
executed (the execution status of this line is deduced): bool ok = true;
-
2289 QString result = QIcu::toLower(d->m_localeID, str, &ok);
executed (the execution status of this line is deduced): QString result = QIcu::toLower(d->m_localeID, str, &ok);
-
2290 if (ok)
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
2291 return result;
executed: return result;
Execution Count:5
5
2292 // else fall through and use Qt's toUpper -
2293#endif -
2294 return str.toLower();
never executed: return str.toLower();
0
2295} -
2296 -
2297 -
2298/*! -
2299 \since 4.5 -
2300 -
2301 Returns the localized name of the "AM" suffix for times specified using -
2302 the conventions of the 12-hour clock. -
2303 -
2304 \sa pmText() -
2305*/ -
2306QString QLocale::amText() const -
2307{ -
2308#ifndef QT_NO_SYSTEMLOCALE -
2309 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:683
yes
Evaluation Count:1129
683-1129
2310 QVariant res = systemLocale()->query(QSystemLocale::AMText, QVariant());
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::AMText, QVariant());
-
2311 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:683
no
Evaluation Count:0
0-683
2312 return res.toString();
executed: return res.toString();
Execution Count:683
683
2313 }
never executed: }
0
2314#endif -
2315 return getLocaleData(am_data + d->m_data->m_am_idx, d->m_data->m_am_size);
executed: return getLocaleData(am_data + d->m_data->m_am_idx, d->m_data->m_am_size);
Execution Count:1129
1129
2316} -
2317 -
2318/*! -
2319 \since 4.5 -
2320 -
2321 Returns the localized name of the "PM" suffix for times specified using -
2322 the conventions of the 12-hour clock. -
2323 -
2324 \sa amText() -
2325*/ -
2326QString QLocale::pmText() const -
2327{ -
2328#ifndef QT_NO_SYSTEMLOCALE -
2329 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:1379
117-1379
2330 QVariant res = systemLocale()->query(QSystemLocale::PMText, QVariant());
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::PMText, QVariant());
-
2331 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:117
no
Evaluation Count:0
0-117
2332 return res.toString();
executed: return res.toString();
Execution Count:117
117
2333 }
never executed: }
0
2334#endif -
2335 return getLocaleData(pm_data + d->m_data->m_pm_idx, d->m_data->m_pm_size);
executed: return getLocaleData(pm_data + d->m_data->m_pm_idx, d->m_data->m_pm_size);
Execution Count:1379
1379
2336} -
2337 -
2338 -
2339QString QLocalePrivate::dateTimeToString(const QString &format, const QDate *date, const QTime *time, -
2340 const QLocale *q) const -
2341{ -
2342 Q_ASSERT(date || time);
executed (the execution status of this line is deduced): qt_noop();
-
2343 if ((date && !date->isValid()) || (time && !time->isValid()))
evaluated: date
TRUEFALSE
yes
Evaluation Count:5865
yes
Evaluation Count:1700
evaluated: !date->isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5862
evaluated: time
TRUEFALSE
yes
Evaluation Count:5819
yes
Evaluation Count:1743
evaluated: !time->isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5818
1-5865
2344 return QString();
executed: return QString();
Execution Count:4
4
2345 const bool format_am_pm = time && timeFormatContainsAP(format);
evaluated: time
TRUEFALSE
yes
Evaluation Count:5818
yes
Evaluation Count:1743
evaluated: timeFormatContainsAP(format)
TRUEFALSE
yes
Evaluation Count:2487
yes
Evaluation Count:3331
1743-5818
2346 -
2347 enum { AM, PM } am_pm = AM;
executed (the execution status of this line is deduced): enum { AM, PM } am_pm = AM;
-
2348 int hour12 = time ? time->hour() : -1;
evaluated: time
TRUEFALSE
yes
Evaluation Count:5818
yes
Evaluation Count:1743
1743-5818
2349 if (time) {
evaluated: time
TRUEFALSE
yes
Evaluation Count:5818
yes
Evaluation Count:1743
1743-5818
2350 if (hour12 == 0) {
evaluated: hour12 == 0
TRUEFALSE
yes
Evaluation Count:2103
yes
Evaluation Count:3715
2103-3715
2351 am_pm = AM;
executed (the execution status of this line is deduced): am_pm = AM;
-
2352 hour12 = 12;
executed (the execution status of this line is deduced): hour12 = 12;
-
2353 } else if (hour12 < 12) {
executed: }
Execution Count:2103
evaluated: hour12 < 12
TRUEFALSE
yes
Evaluation Count:1920
yes
Evaluation Count:1795
1795-2103
2354 am_pm = AM;
executed (the execution status of this line is deduced): am_pm = AM;
-
2355 } else if (hour12 == 12) {
executed: }
Execution Count:1920
evaluated: hour12 == 12
TRUEFALSE
yes
Evaluation Count:402
yes
Evaluation Count:1393
402-1920
2356 am_pm = PM;
executed (the execution status of this line is deduced): am_pm = PM;
-
2357 } else {
executed: }
Execution Count:402
402
2358 am_pm = PM;
executed (the execution status of this line is deduced): am_pm = PM;
-
2359 hour12 -= 12;
executed (the execution status of this line is deduced): hour12 -= 12;
-
2360 }
executed: }
Execution Count:1393
1393
2361 } -
2362 -
2363 QString result;
executed (the execution status of this line is deduced): QString result;
-
2364 -
2365 int i = 0;
executed (the execution status of this line is deduced): int i = 0;
-
2366 while (i < format.size()) {
evaluated: i < format.size()
TRUEFALSE
yes
Evaluation Count:49681
yes
Evaluation Count:7561
7561-49681
2367 if (format.at(i).unicode() == '\'') {
evaluated: format.at(i).unicode() == '\''
TRUEFALSE
yes
Evaluation Count:776
yes
Evaluation Count:48905
776-48905
2368 result.append(qt_readEscapedFormatString(format, &i));
executed (the execution status of this line is deduced): result.append(qt_readEscapedFormatString(format, &i));
-
2369 continue;
executed: continue;
Execution Count:776
776
2370 } -
2371 -
2372 const QChar c = format.at(i);
executed (the execution status of this line is deduced): const QChar c = format.at(i);
-
2373 int repeat = qt_repeatCount(format, i);
executed (the execution status of this line is deduced): int repeat = qt_repeatCount(format, i);
-
2374 bool used = false;
executed (the execution status of this line is deduced): bool used = false;
-
2375 if (date) {
evaluated: date
TRUEFALSE
yes
Evaluation Count:40404
yes
Evaluation Count:8501
8501-40404
2376 switch (c.unicode()) { -
2377 case 'y': -
2378 used = true;
executed (the execution status of this line is deduced): used = true;
-
2379 if (repeat >= 4)
evaluated: repeat >= 4
TRUEFALSE
yes
Evaluation Count:1949
yes
Evaluation Count:2388
1949-2388
2380 repeat = 4;
executed: repeat = 4;
Execution Count:1949
1949
2381 else if (repeat >= 2)
evaluated: repeat >= 2
TRUEFALSE
yes
Evaluation Count:2376
yes
Evaluation Count:12
12-2376
2382 repeat = 2;
executed: repeat = 2;
Execution Count:2376
2376
2383 -
2384 switch (repeat) { -
2385 case 4: -
2386 result.append(longLongToString(date->year(), -1, 10, 4, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(date->year(), -1, 10, 4, QLocalePrivate::ZeroPadded));
-
2387 break;
executed: break;
Execution Count:1949
1949
2388 case 2: -
2389 result.append(longLongToString(date->year() % 100, -1, 10, 2,
executed (the execution status of this line is deduced): result.append(longLongToString(date->year() % 100, -1, 10, 2,
-
2390 QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): QLocalePrivate::ZeroPadded));
-
2391 break;
executed: break;
Execution Count:2376
2376
2392 default: -
2393 repeat = 1;
executed (the execution status of this line is deduced): repeat = 1;
-
2394 result.append(c);
executed (the execution status of this line is deduced): result.append(c);
-
2395 break;
executed: break;
Execution Count:12
12
2396 } -
2397 break;
executed: break;
Execution Count:4337
4337
2398 -
2399 case 'M': -
2400 used = true;
executed (the execution status of this line is deduced): used = true;
-
2401 repeat = qMin(repeat, 4);
executed (the execution status of this line is deduced): repeat = qMin(repeat, 4);
-
2402 switch (repeat) { -
2403 case 1: -
2404 result.append(longLongToString(date->month()));
executed (the execution status of this line is deduced): result.append(longLongToString(date->month()));
-
2405 break;
executed: break;
Execution Count:1818
1818
2406 case 2: -
2407 result.append(longLongToString(date->month(), -1, 10, 2, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(date->month(), -1, 10, 2, QLocalePrivate::ZeroPadded));
-
2408 break;
executed: break;
Execution Count:1169
1169
2409 case 3: -
2410 result.append(q->monthName(date->month(), QLocale::ShortFormat));
executed (the execution status of this line is deduced): result.append(q->monthName(date->month(), QLocale::ShortFormat));
-
2411 break;
executed: break;
Execution Count:1358
1358
2412 case 4: -
2413 result.append(q->monthName(date->month(), QLocale::LongFormat));
executed (the execution status of this line is deduced): result.append(q->monthName(date->month(), QLocale::LongFormat));
-
2414 break;
executed: break;
Execution Count:56
56
2415 } -
2416 break;
executed: break;
Execution Count:4401
4401
2417 -
2418 case 'd': -
2419 used = true;
executed (the execution status of this line is deduced): used = true;
-
2420 repeat = qMin(repeat, 4);
executed (the execution status of this line is deduced): repeat = qMin(repeat, 4);
-
2421 switch (repeat) { -
2422 case 1: -
2423 result.append(longLongToString(date->day()));
executed (the execution status of this line is deduced): result.append(longLongToString(date->day()));
-
2424 break;
executed: break;
Execution Count:1991
1991
2425 case 2: -
2426 result.append(longLongToString(date->day(), -1, 10, 2, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(date->day(), -1, 10, 2, QLocalePrivate::ZeroPadded));
-
2427 break;
executed: break;
Execution Count:2383
2383
2428 case 3: -
2429 result.append(q->dayName(date->dayOfWeek(), QLocale::ShortFormat));
executed (the execution status of this line is deduced): result.append(q->dayName(date->dayOfWeek(), QLocale::ShortFormat));
-
2430 break;
executed: break;
Execution Count:711
711
2431 case 4: -
2432 result.append(q->dayName(date->dayOfWeek(), QLocale::LongFormat));
executed (the execution status of this line is deduced): result.append(q->dayName(date->dayOfWeek(), QLocale::LongFormat));
-
2433 break;
executed: break;
Execution Count:21
21
2434 } -
2435 break;
executed: break;
Execution Count:5106
5106
2436 -
2437 default: -
2438 break;
executed: break;
Execution Count:26560
26560
2439 } -
2440 }
executed: }
Execution Count:40404
40404
2441 if (!used && time) {
evaluated: !used
TRUEFALSE
yes
Evaluation Count:35061
yes
Evaluation Count:13844
evaluated: time
TRUEFALSE
yes
Evaluation Count:31598
yes
Evaluation Count:3463
3463-35061
2442 switch (c.unicode()) { -
2443 case 'h': { -
2444 used = true;
executed (the execution status of this line is deduced): used = true;
-
2445 repeat = qMin(repeat, 2);
executed (the execution status of this line is deduced): repeat = qMin(repeat, 2);
-
2446 const int hour = format_am_pm ? hour12 : time->hour();
evaluated: format_am_pm
TRUEFALSE
yes
Evaluation Count:2436
yes
Evaluation Count:1667
1667-2436
2447 -
2448 switch (repeat) { -
2449 case 1: -
2450 result.append(longLongToString(hour));
executed (the execution status of this line is deduced): result.append(longLongToString(hour));
-
2451 break;
executed: break;
Execution Count:1792
1792
2452 case 2: -
2453 result.append(longLongToString(hour, -1, 10, 2, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(hour, -1, 10, 2, QLocalePrivate::ZeroPadded));
-
2454 break;
executed: break;
Execution Count:2311
2311
2455 } -
2456 break;
executed: break;
Execution Count:4103
4103
2457 } -
2458 case 'H': -
2459 used = true;
executed (the execution status of this line is deduced): used = true;
-
2460 repeat = qMin(repeat, 2);
executed (the execution status of this line is deduced): repeat = qMin(repeat, 2);
-
2461 switch (repeat) { -
2462 case 1: -
2463 result.append(longLongToString(time->hour()));
executed (the execution status of this line is deduced): result.append(longLongToString(time->hour()));
-
2464 break;
executed: break;
Execution Count:11
11
2465 case 2: -
2466 result.append(longLongToString(time->hour(), -1, 10, 2, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(time->hour(), -1, 10, 2, QLocalePrivate::ZeroPadded));
-
2467 break;
executed: break;
Execution Count:180
180
2468 } -
2469 break;
executed: break;
Execution Count:191
191
2470 -
2471 case 'm': -
2472 used = true;
executed (the execution status of this line is deduced): used = true;
-
2473 repeat = qMin(repeat, 2);
executed (the execution status of this line is deduced): repeat = qMin(repeat, 2);
-
2474 switch (repeat) { -
2475 case 1: -
2476 result.append(longLongToString(time->minute()));
executed (the execution status of this line is deduced): result.append(longLongToString(time->minute()));
-
2477 break;
executed: break;
Execution Count:105
105
2478 case 2: -
2479 result.append(longLongToString(time->minute(), -1, 10, 2, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(time->minute(), -1, 10, 2, QLocalePrivate::ZeroPadded));
-
2480 break;
executed: break;
Execution Count:3990
3990
2481 } -
2482 break;
executed: break;
Execution Count:4095
4095
2483 -
2484 case 's': -
2485 used = true;
executed (the execution status of this line is deduced): used = true;
-
2486 repeat = qMin(repeat, 2);
executed (the execution status of this line is deduced): repeat = qMin(repeat, 2);
-
2487 switch (repeat) { -
2488 case 1: -
2489 result.append(longLongToString(time->second()));
executed (the execution status of this line is deduced): result.append(longLongToString(time->second()));
-
2490 break;
executed: break;
Execution Count:102
102
2491 case 2: -
2492 result.append(longLongToString(time->second(), -1, 10, 2, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(time->second(), -1, 10, 2, QLocalePrivate::ZeroPadded));
-
2493 break;
executed: break;
Execution Count:2259
2259
2494 } -
2495 break;
executed: break;
Execution Count:2361
2361
2496 -
2497 case 'a': -
2498 used = true;
executed (the execution status of this line is deduced): used = true;
-
2499 if (i + 1 < format.length() && format.at(i + 1).unicode() == 'p') {
evaluated: i + 1 < format.length()
TRUEFALSE
yes
Evaluation Count:731
yes
Evaluation Count:41
evaluated: format.at(i + 1).unicode() == 'p'
TRUEFALSE
yes
Evaluation Count:729
yes
Evaluation Count:2
2-731
2500 repeat = 2;
executed (the execution status of this line is deduced): repeat = 2;
-
2501 } else {
executed: }
Execution Count:729
729
2502 repeat = 1;
executed (the execution status of this line is deduced): repeat = 1;
-
2503 }
executed: }
Execution Count:43
43
2504 result.append(am_pm == AM ? q->amText().toLower() : q->pmText().toLower());
executed (the execution status of this line is deduced): result.append(am_pm == AM ? q->amText().toLower() : q->pmText().toLower());
-
2505 break;
executed: break;
Execution Count:772
772
2506 -
2507 case 'A': -
2508 used = true;
executed (the execution status of this line is deduced): used = true;
-
2509 if (i + 1 < format.length() && format.at(i + 1).unicode() == 'P') {
partially evaluated: i + 1 < format.length()
TRUEFALSE
yes
Evaluation Count:1720
no
Evaluation Count:0
partially evaluated: format.at(i + 1).unicode() == 'P'
TRUEFALSE
yes
Evaluation Count:1720
no
Evaluation Count:0
0-1720
2510 repeat = 2;
executed (the execution status of this line is deduced): repeat = 2;
-
2511 } else {
executed: }
Execution Count:1720
1720
2512 repeat = 1;
never executed (the execution status of this line is deduced): repeat = 1;
-
2513 }
never executed: }
0
2514 result.append(am_pm == AM ? q->amText().toUpper() : q->pmText().toUpper());
executed (the execution status of this line is deduced): result.append(am_pm == AM ? q->amText().toUpper() : q->pmText().toUpper());
-
2515 break;
executed: break;
Execution Count:1720
1720
2516 -
2517 case 'z': -
2518 used = true;
executed (the execution status of this line is deduced): used = true;
-
2519 if (repeat >= 3) {
evaluated: repeat >= 3
TRUEFALSE
yes
Evaluation Count:176
yes
Evaluation Count:82
82-176
2520 repeat = 3;
executed (the execution status of this line is deduced): repeat = 3;
-
2521 } else {
executed: }
Execution Count:176
176
2522 repeat = 1;
executed (the execution status of this line is deduced): repeat = 1;
-
2523 }
executed: }
Execution Count:82
82
2524 switch (repeat) { -
2525 case 1: -
2526 result.append(longLongToString(time->msec()));
executed (the execution status of this line is deduced): result.append(longLongToString(time->msec()));
-
2527 break;
executed: break;
Execution Count:82
82
2528 case 3: -
2529 result.append(longLongToString(time->msec(), -1, 10, 3, QLocalePrivate::ZeroPadded));
executed (the execution status of this line is deduced): result.append(longLongToString(time->msec(), -1, 10, 3, QLocalePrivate::ZeroPadded));
-
2530 break;
executed: break;
Execution Count:176
176
2531 } -
2532 break;
executed: break;
Execution Count:258
258
2533 -
2534 case 't': -
2535 used = true;
executed (the execution status of this line is deduced): used = true;
-
2536 repeat = 1;
executed (the execution status of this line is deduced): repeat = 1;
-
2537 result.append(timeZone());
executed (the execution status of this line is deduced): result.append(timeZone());
-
2538 break;
executed: break;
Execution Count:2
2
2539 default: -
2540 break;
executed: break;
Execution Count:18096
18096
2541 } -
2542 }
executed: }
Execution Count:31598
31598
2543 if (!used) {
evaluated: !used
TRUEFALSE
yes
Evaluation Count:21559
yes
Evaluation Count:27346
21559-27346
2544 result.append(QString(repeat, c));
executed (the execution status of this line is deduced): result.append(QString(repeat, c));
-
2545 }
executed: }
Execution Count:21559
21559
2546 i += repeat;
executed (the execution status of this line is deduced): i += repeat;
-
2547 }
executed: }
Execution Count:48905
48905
2548 -
2549 return result;
executed: return result;
Execution Count:7561
7561
2550} -
2551 -
2552QString QLocalePrivate::doubleToString(double d, -
2553 int precision, -
2554 DoubleForm form, -
2555 int width, -
2556 unsigned flags) const -
2557{ -
2558 return QLocalePrivate::doubleToString(zero(), plus(), minus(), exponential(),
executed: return QLocalePrivate::doubleToString(zero(), plus(), minus(), exponential(), group(), decimal(), d, precision, form, width, flags);
Execution Count:1506060
1506060
2559 group(), decimal(),
executed: return QLocalePrivate::doubleToString(zero(), plus(), minus(), exponential(), group(), decimal(), d, precision, form, width, flags);
Execution Count:1506060
1506060
2560 d, precision, form, width, flags);
executed: return QLocalePrivate::doubleToString(zero(), plus(), minus(), exponential(), group(), decimal(), d, precision, form, width, flags);
Execution Count:1506060
1506060
2561} -
2562 -
2563QString QLocalePrivate::doubleToString(const QChar _zero, const QChar plus, const QChar minus, -
2564 const QChar exponential, const QChar group, const QChar decimal, -
2565 double d, -
2566 int precision, -
2567 DoubleForm form, -
2568 int width, -
2569 unsigned flags) -
2570{ -
2571 if (precision == -1)
evaluated: precision == -1
TRUEFALSE
yes
Evaluation Count:1044733
yes
Evaluation Count:461327
461327-1044733
2572 precision = 6;
executed: precision = 6;
Execution Count:1044733
1044733
2573 if (width == -1)
evaluated: width == -1
TRUEFALSE
yes
Evaluation Count:455725
yes
Evaluation Count:1050335
455725-1050335
2574 width = 0;
executed: width = 0;
Execution Count:455725
455725
2575 -
2576 bool negative = false;
executed (the execution status of this line is deduced): bool negative = false;
-
2577 bool special_number = false; // nan, +/-inf
executed (the execution status of this line is deduced): bool special_number = false;
-
2578 QString num_str;
executed (the execution status of this line is deduced): QString num_str;
-
2579 -
2580 // Detect special numbers (nan, +/-inf) -
2581 if (qt_is_inf(d)) {
evaluated: qt_is_inf(d)
TRUEFALSE
yes
Evaluation Count:522
yes
Evaluation Count:1505538
522-1505538
2582 num_str = QString::fromLatin1("inf");
executed (the execution status of this line is deduced): num_str = QString::fromLatin1("inf");
-
2583 special_number = true;
executed (the execution status of this line is deduced): special_number = true;
-
2584 negative = d < 0;
executed (the execution status of this line is deduced): negative = d < 0;
-
2585 } else if (qt_is_nan(d)) {
executed: }
Execution Count:522
evaluated: qt_is_nan(d)
TRUEFALSE
yes
Evaluation Count:260
yes
Evaluation Count:1505278
260-1505278
2586 num_str = QString::fromLatin1("nan");
executed (the execution status of this line is deduced): num_str = QString::fromLatin1("nan");
-
2587 special_number = true;
executed (the execution status of this line is deduced): special_number = true;
-
2588 }
executed: }
Execution Count:260
260
2589 -
2590 // Handle normal numbers -
2591 if (!special_number) {
evaluated: !special_number
TRUEFALSE
yes
Evaluation Count:1505278
yes
Evaluation Count:782
782-1505278
2592 int decpt, sign;
executed (the execution status of this line is deduced): int decpt, sign;
-
2593 QString digits;
executed (the execution status of this line is deduced): QString digits;
-
2594 -
2595#ifdef QT_QLOCALE_USES_FCVT -
2596 // NOT thread safe! -
2597 if (form == DFDecimal) { -
2598 digits = QLatin1String(fcvt(d, precision, &decpt, &sign)); -
2599 } else { -
2600 int pr = precision; -
2601 if (form == DFExponent) -
2602 ++pr; -
2603 else if (form == DFSignificantDigits && pr == 0) -
2604 pr = 1; -
2605 digits = QLatin1String(ecvt(d, pr, &decpt, &sign)); -
2606 -
2607 // Chop trailing zeros -
2608 if (digits.length() > 0) { -
2609 int last_nonzero_idx = digits.length() - 1; -
2610 while (last_nonzero_idx > 0 -
2611 && digits.unicode()[last_nonzero_idx] == QLatin1Char('0')) -
2612 --last_nonzero_idx; -
2613 digits.truncate(last_nonzero_idx + 1); -
2614 } -
2615 -
2616 } -
2617 -
2618#else -
2619 int mode;
executed (the execution status of this line is deduced): int mode;
-
2620 if (form == DFDecimal)
evaluated: form == DFDecimal
TRUEFALSE
yes
Evaluation Count:1629
yes
Evaluation Count:1503649
1629-1503649
2621 mode = 3;
executed: mode = 3;
Execution Count:1629
1629
2622 else -
2623 mode = 2;
executed: mode = 2;
Execution Count:1503649
1503649
2624 -
2625 /* This next bit is a bit quirky. In DFExponent form, the precision -
2626 is the number of digits after decpt. So that would suggest using -
2627 mode=3 for qdtoa. But qdtoa behaves strangely when mode=3 and -
2628 precision=0. So we get around this by using mode=2 and reasoning -
2629 that we want precision+1 significant digits, since the decimal -
2630 point in this mode is always after the first digit. */ -
2631 int pr = precision;
executed (the execution status of this line is deduced): int pr = precision;
-
2632 if (form == DFExponent)
evaluated: form == DFExponent
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1505267
11-1505267
2633 ++pr;
executed: ++pr;
Execution Count:11
11
2634 -
2635 char *rve = 0;
executed (the execution status of this line is deduced): char *rve = 0;
-
2636 char *buff = 0;
executed (the execution status of this line is deduced): char *buff = 0;
-
2637 QT_TRY { -
2638 digits = QLatin1String(qdtoa(d, mode, pr, &decpt, &sign, &rve, &buff));
executed (the execution status of this line is deduced): digits = QLatin1String(qdtoa(d, mode, pr, &decpt, &sign, &rve, &buff));
-
2639 } QT_CATCH(...) {
executed: }
Execution Count:1505278
1505278
2640 if (buff != 0)
never evaluated: buff != 0
0
2641 free(buff);
never executed: free(buff);
0
2642 QT_RETHROW;
never executed: throw;
0
2643 } -
2644 if (buff != 0)
evaluated: buff != 0
TRUEFALSE
yes
Evaluation Count:1463101
yes
Evaluation Count:42177
42177-1463101
2645 free(buff);
executed: free(buff);
Execution Count:1463101
1463101
2646#endif // QT_QLOCALE_USES_FCVT -
2647 -
2648 if (_zero.unicode() != '0') {
partially evaluated: _zero.unicode() != '0'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1505278
0-1505278
2649 ushort z = _zero.unicode() - '0';
never executed (the execution status of this line is deduced): ushort z = _zero.unicode() - '0';
-
2650 for (int i = 0; i < digits.length(); ++i)
never evaluated: i < digits.length()
0
2651 reinterpret_cast<ushort *>(digits.data())[i] += z;
never executed: reinterpret_cast<ushort *>(digits.data())[i] += z;
0
2652 }
never executed: }
0
2653 -
2654 bool always_show_decpt = (flags & Alternate || flags & ForcePoint);
evaluated: flags & Alternate
TRUEFALSE
yes
Evaluation Count:4614
yes
Evaluation Count:1500664
partially evaluated: flags & ForcePoint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1500664
0-1500664
2655 switch (form) { -
2656 case DFExponent: { -
2657 num_str = exponentForm(_zero, decimal, exponential, group, plus, minus,
executed (the execution status of this line is deduced): num_str = exponentForm(_zero, decimal, exponential, group, plus, minus,
-
2658 digits, decpt, precision, PMDecimalDigits,
executed (the execution status of this line is deduced): digits, decpt, precision, PMDecimalDigits,
-
2659 always_show_decpt);
executed (the execution status of this line is deduced): always_show_decpt);
-
2660 break;
executed: break;
Execution Count:11
11
2661 } -
2662 case DFDecimal: { -
2663 num_str = decimalForm(_zero, decimal, group,
executed (the execution status of this line is deduced): num_str = decimalForm(_zero, decimal, group,
-
2664 digits, decpt, precision, PMDecimalDigits,
executed (the execution status of this line is deduced): digits, decpt, precision, PMDecimalDigits,
-
2665 always_show_decpt, flags & ThousandsGroup);
executed (the execution status of this line is deduced): always_show_decpt, flags & ThousandsGroup);
-
2666 break;
executed: break;
Execution Count:1629
1629
2667 } -
2668 case DFSignificantDigits: { -
2669 PrecisionMode mode = (flags & Alternate) ?
evaluated: (flags & Alternate)
TRUEFALSE
yes
Evaluation Count:4610
yes
Evaluation Count:1499028
4610-1499028
2670 PMSignificantDigits : PMChopTrailingZeros;
executed (the execution status of this line is deduced): PMSignificantDigits : PMChopTrailingZeros;
-
2671 -
2672 if (decpt != digits.length() && (decpt <= -4 || decpt > precision))
evaluated: decpt != digits.length()
TRUEFALSE
yes
Evaluation Count:498008
yes
Evaluation Count:1005630
evaluated: decpt <= -4
TRUEFALSE
yes
Evaluation Count:5205
yes
Evaluation Count:492803
evaluated: decpt > precision
TRUEFALSE
yes
Evaluation Count:63054
yes
Evaluation Count:429749
5205-1005630
2673 num_str = exponentForm(_zero, decimal, exponential, group, plus, minus,
executed: num_str = exponentForm(_zero, decimal, exponential, group, plus, minus, digits, decpt, precision, mode, always_show_decpt);
Execution Count:68259
68259
2674 digits, decpt, precision, mode,
executed: num_str = exponentForm(_zero, decimal, exponential, group, plus, minus, digits, decpt, precision, mode, always_show_decpt);
Execution Count:68259
68259
2675 always_show_decpt);
executed: num_str = exponentForm(_zero, decimal, exponential, group, plus, minus, digits, decpt, precision, mode, always_show_decpt);
Execution Count:68259
68259
2676 else -
2677 num_str = decimalForm(_zero, decimal, group,
executed: num_str = decimalForm(_zero, decimal, group, digits, decpt, precision, mode, always_show_decpt, flags & ThousandsGroup);
Execution Count:1435379
1435379
2678 digits, decpt, precision, mode,
executed: num_str = decimalForm(_zero, decimal, group, digits, decpt, precision, mode, always_show_decpt, flags & ThousandsGroup);
Execution Count:1435379
1435379
2679 always_show_decpt, flags & ThousandsGroup);
executed: num_str = decimalForm(_zero, decimal, group, digits, decpt, precision, mode, always_show_decpt, flags & ThousandsGroup);
Execution Count:1435379
1435379
2680 break;
executed: break;
Execution Count:1503638
1503638
2681 } -
2682 } -
2683 -
2684 negative = sign != 0 && !isZero(d);
evaluated: sign != 0
TRUEFALSE
yes
Evaluation Count:474215
yes
Evaluation Count:1031063
evaluated: !isZero(d)
TRUEFALSE
yes
Evaluation Count:474207
yes
Evaluation Count:8
8-1031063
2685 }
executed: }
Execution Count:1505278
1505278
2686 -
2687 // pad with zeros. LeftAdjusted overrides this flag). Also, we don't -
2688 // pad special numbers -
2689 if (flags & QLocalePrivate::ZeroPadded
evaluated: flags & QLocalePrivate::ZeroPadded
TRUEFALSE
yes
Evaluation Count:4994
yes
Evaluation Count:1501066
4994-1501066
2690 && !(flags & QLocalePrivate::LeftAdjusted)
evaluated: !(flags & QLocalePrivate::LeftAdjusted)
TRUEFALSE
yes
Evaluation Count:2498
yes
Evaluation Count:2496
2496-2498
2691 && !special_number) {
evaluated: !special_number
TRUEFALSE
yes
Evaluation Count:2306
yes
Evaluation Count:192
192-2306
2692 int num_pad_chars = width - num_str.length();
executed (the execution status of this line is deduced): int num_pad_chars = width - num_str.length();
-
2693 // leave space for the sign -
2694 if (negative
evaluated: negative
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:2240
66-2240
2695 || flags & QLocalePrivate::AlwaysShowSign
evaluated: flags & QLocalePrivate::AlwaysShowSign
TRUEFALSE
yes
Evaluation Count:1120
yes
Evaluation Count:1120
1120
2696 || flags & QLocalePrivate::BlankBeforePositive)
evaluated: flags & QLocalePrivate::BlankBeforePositive
TRUEFALSE
yes
Evaluation Count:560
yes
Evaluation Count:560
560
2697 --num_pad_chars;
executed: --num_pad_chars;
Execution Count:1746
1746
2698 -
2699 for (int i = 0; i < num_pad_chars; ++i)
evaluated: i < num_pad_chars
TRUEFALSE
yes
Evaluation Count:23649
yes
Evaluation Count:2306
2306-23649
2700 num_str.prepend(_zero);
executed: num_str.prepend(_zero);
Execution Count:23649
23649
2701 }
executed: }
Execution Count:2306
2306
2702 -
2703 // add sign -
2704 if (negative)
evaluated: negative
TRUEFALSE
yes
Evaluation Count:474468
yes
Evaluation Count:1031592
474468-1031592
2705 num_str.prepend(minus);
executed: num_str.prepend(minus);
Execution Count:474468
474468
2706 else if (flags & QLocalePrivate::AlwaysShowSign)
evaluated: flags & QLocalePrivate::AlwaysShowSign
TRUEFALSE
yes
Evaluation Count:4738
yes
Evaluation Count:1026854
4738-1026854
2707 num_str.prepend(plus);
executed: num_str.prepend(plus);
Execution Count:4738
4738
2708 else if (flags & QLocalePrivate::BlankBeforePositive)
evaluated: flags & QLocalePrivate::BlankBeforePositive
TRUEFALSE
yes
Evaluation Count:2368
yes
Evaluation Count:1024486
2368-1024486
2709 num_str.prepend(QLatin1Char(' '));
executed: num_str.prepend(QLatin1Char(' '));
Execution Count:2368
2368
2710 -
2711 if (flags & QLocalePrivate::CapitalEorX)
evaluated: flags & QLocalePrivate::CapitalEorX
TRUEFALSE
yes
Evaluation Count:4999
yes
Evaluation Count:1501061
4999-1501061
2712 num_str = num_str.toUpper();
executed: num_str = num_str.toUpper();
Execution Count:4999
4999
2713 -
2714 return num_str;
executed: return num_str;
Execution Count:1506060
1506060
2715} -
2716 -
2717QString QLocalePrivate::longLongToString(qlonglong l, int precision, -
2718 int base, int width, -
2719 unsigned flags) const -
2720{ -
2721 return QLocalePrivate::longLongToString(zero(), group(), plus(), minus(),
executed: return QLocalePrivate::longLongToString(zero(), group(), plus(), minus(), l, precision, base, width, flags);
Execution Count:12184074
12184074
2722 l, precision, base, width, flags);
executed: return QLocalePrivate::longLongToString(zero(), group(), plus(), minus(), l, precision, base, width, flags);
Execution Count:12184074
12184074
2723} -
2724 -
2725QString QLocalePrivate::longLongToString(const QChar zero, const QChar group, -
2726 const QChar plus, const QChar minus, -
2727 qlonglong l, int precision, -
2728 int base, int width, -
2729 unsigned flags) -
2730{ -
2731 bool precision_not_specified = false;
executed (the execution status of this line is deduced): bool precision_not_specified = false;
-
2732 if (precision == -1) {
evaluated: precision == -1
TRUEFALSE
yes
Evaluation Count:12182872
yes
Evaluation Count:69470
69470-12182872
2733 precision_not_specified = true;
executed (the execution status of this line is deduced): precision_not_specified = true;
-
2734 precision = 1;
executed (the execution status of this line is deduced): precision = 1;
-
2735 }
executed: }
Execution Count:12182872
12182872
2736 -
2737 bool negative = l < 0;
executed (the execution status of this line is deduced): bool negative = l < 0;
-
2738 if (base != 10) {
evaluated: base != 10
TRUEFALSE
yes
Evaluation Count:2519
yes
Evaluation Count:12249822
2519-12249822
2739 // these are not supported by sprintf for octal and hex -
2740 flags &= ~AlwaysShowSign;
executed (the execution status of this line is deduced): flags &= ~AlwaysShowSign;
-
2741 flags &= ~BlankBeforePositive;
executed (the execution status of this line is deduced): flags &= ~BlankBeforePositive;
-
2742 negative = false; // neither are negative numbers
executed (the execution status of this line is deduced): negative = false;
-
2743 }
executed: }
Execution Count:2519
2519
2744 -
2745 QString num_str;
executed (the execution status of this line is deduced): QString num_str;
-
2746 if (base == 10)
evaluated: base == 10
TRUEFALSE
yes
Evaluation Count:12249824
yes
Evaluation Count:2519
2519-12249824
2747 num_str = qlltoa(l, base, zero);
executed: num_str = qlltoa(l, base, zero);
Execution Count:12249823
12249823
2748 else -
2749 num_str = qulltoa(l, base, zero);
executed: num_str = qulltoa(l, base, zero);
Execution Count:2519
2519
2750 -
2751 uint cnt_thousand_sep = 0;
executed (the execution status of this line is deduced): uint cnt_thousand_sep = 0;
-
2752 if (flags & ThousandsGroup && base == 10) {
evaluated: flags & ThousandsGroup
TRUEFALSE
yes
Evaluation Count:1877
yes
Evaluation Count:12250466
partially evaluated: base == 10
TRUEFALSE
yes
Evaluation Count:1877
no
Evaluation Count:0
0-12250466
2753 for (int i = num_str.length() - 3; i > 0; i -= 3) {
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:743
yes
Evaluation Count:1877
743-1877
2754 num_str.insert(i, group);
executed (the execution status of this line is deduced): num_str.insert(i, group);
-
2755 ++cnt_thousand_sep;
executed (the execution status of this line is deduced): ++cnt_thousand_sep;
-
2756 }
executed: }
Execution Count:743
743
2757 }
executed: }
Execution Count:1877
1877
2758 -
2759 for (int i = num_str.length()/* - cnt_thousand_sep*/; i < precision; ++i)
evaluated: i < precision
TRUEFALSE
yes
Evaluation Count:488427
yes
Evaluation Count:12252345
488427-12252345
2760 num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
Execution Count:488427
488427
2761 -
2762 if ((flags & Alternate || flags & ShowBase)
partially evaluated: flags & Alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12252344
partially evaluated: flags & ShowBase
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12252345
0-12252345
2763 && base == 8
never evaluated: base == 8
0
2764 && (num_str.isEmpty() || num_str[0].unicode() != QLatin1Char('0')))
never evaluated: num_str.isEmpty()
never evaluated: num_str[0].unicode() != QLatin1Char('0')
0
2765 num_str.prepend(QLatin1Char('0'));
never executed: num_str.prepend(QLatin1Char('0'));
0
2766 -
2767 // LeftAdjusted overrides this flag ZeroPadded. sprintf only padds -
2768 // when precision is not specified in the format string -
2769 bool zero_padded = flags & ZeroPadded
evaluated: flags & ZeroPadded
TRUEFALSE
yes
Evaluation Count:17107
yes
Evaluation Count:12235236
17107-12235236
2770 && !(flags & LeftAdjusted)
partially evaluated: !(flags & LeftAdjusted)
TRUEFALSE
yes
Evaluation Count:17107
no
Evaluation Count:0
0-17107
2771 && precision_not_specified;
partially evaluated: precision_not_specified
TRUEFALSE
yes
Evaluation Count:17107
no
Evaluation Count:0
0-17107
2772 -
2773 if (zero_padded) {
evaluated: zero_padded
TRUEFALSE
yes
Evaluation Count:17107
yes
Evaluation Count:12235238
17107-12235238
2774 int num_pad_chars = width - num_str.length();
executed (the execution status of this line is deduced): int num_pad_chars = width - num_str.length();
-
2775 -
2776 // leave space for the sign -
2777 if (negative
evaluated: negative
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:17089
18-17089
2778 || flags & AlwaysShowSign
partially evaluated: flags & AlwaysShowSign
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17089
0-17089
2779 || flags & BlankBeforePositive)
partially evaluated: flags & BlankBeforePositive
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17089
0-17089
2780 --num_pad_chars;
executed: --num_pad_chars;
Execution Count:18
18
2781 -
2782 // leave space for optional '0x' in hex form -
2783 if (base == 16 && (flags & Alternate || flags & ShowBase))
partially evaluated: base == 16
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17107
never evaluated: flags & Alternate
never evaluated: flags & ShowBase
0-17107
2784 num_pad_chars -= 2;
never executed: num_pad_chars -= 2;
0
2785 // leave space for optional '0b' in binary form -
2786 else if (base == 2 && (flags & Alternate || flags & ShowBase))
partially evaluated: base == 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17107
never evaluated: flags & Alternate
never evaluated: flags & ShowBase
0-17107
2787 num_pad_chars -= 2;
never executed: num_pad_chars -= 2;
0
2788 -
2789 for (int i = 0; i < num_pad_chars; ++i)
evaluated: i < num_pad_chars
TRUEFALSE
yes
Evaluation Count:8227
yes
Evaluation Count:17107
8227-17107
2790 num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
Execution Count:8227
8227
2791 }
executed: }
Execution Count:17107
17107
2792 -
2793 if (flags & CapitalEorX)
partially evaluated: flags & CapitalEorX
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12252345
0-12252345
2794 num_str = num_str.toUpper();
never executed: num_str = num_str.toUpper();
0
2795 -
2796 if (base == 16 && (flags & Alternate || flags & ShowBase))
evaluated: base == 16
TRUEFALSE
yes
Evaluation Count:2365
yes
Evaluation Count:12249979
partially evaluated: flags & Alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2365
partially evaluated: flags & ShowBase
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2365
0-12249979
2797 num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));
never executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));
0
2798 if (base == 2 && (flags & Alternate || flags & ShowBase))
partially evaluated: base == 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12252344
never evaluated: flags & Alternate
never evaluated: flags & ShowBase
0-12252344
2799 num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b"));
never executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b"));
0
2800 -
2801 // add sign -
2802 if (negative)
evaluated: negative
TRUEFALSE
yes
Evaluation Count:40418
yes
Evaluation Count:12211926
40418-12211926
2803 num_str.prepend(minus);
executed: num_str.prepend(minus);
Execution Count:40418
40418
2804 else if (flags & AlwaysShowSign)
evaluated: flags & AlwaysShowSign
TRUEFALSE
yes
Evaluation Count:63065
yes
Evaluation Count:12148861
63065-12148861
2805 num_str.prepend(plus);
executed: num_str.prepend(plus);
Execution Count:63065
63065
2806 else if (flags & BlankBeforePositive)
partially evaluated: flags & BlankBeforePositive
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12148860
0-12148860
2807 num_str.prepend(QLatin1Char(' '));
never executed: num_str.prepend(QLatin1Char(' '));
0
2808 -
2809 return num_str;
executed: return num_str;
Execution Count:12252343
12252343
2810} -
2811 -
2812QString QLocalePrivate::unsLongLongToString(qulonglong l, int precision, -
2813 int base, int width, -
2814 unsigned flags) const -
2815{ -
2816 return QLocalePrivate::unsLongLongToString(zero(), group(), plus(),
executed: return QLocalePrivate::unsLongLongToString(zero(), group(), plus(), l, precision, base, width, flags);
Execution Count:38019
38019
2817 l, precision, base, width, flags);
executed: return QLocalePrivate::unsLongLongToString(zero(), group(), plus(), l, precision, base, width, flags);
Execution Count:38019
38019
2818} -
2819 -
2820QString QLocalePrivate::unsLongLongToString(const QChar zero, const QChar group, -
2821 const QChar plus, -
2822 qulonglong l, int precision, -
2823 int base, int width, -
2824 unsigned flags) -
2825{ -
2826 bool precision_not_specified = false;
executed (the execution status of this line is deduced): bool precision_not_specified = false;
-
2827 if (precision == -1) {
partially evaluated: precision == -1
TRUEFALSE
yes
Evaluation Count:38018
no
Evaluation Count:0
0-38018
2828 precision_not_specified = true;
executed (the execution status of this line is deduced): precision_not_specified = true;
-
2829 precision = 1;
executed (the execution status of this line is deduced): precision = 1;
-
2830 }
executed: }
Execution Count:38018
38018
2831 -
2832 QString num_str = qulltoa(l, base, zero);
executed (the execution status of this line is deduced): QString num_str = qulltoa(l, base, zero);
-
2833 -
2834 uint cnt_thousand_sep = 0;
executed (the execution status of this line is deduced): uint cnt_thousand_sep = 0;
-
2835 if (flags & ThousandsGroup && base == 10) {
evaluated: flags & ThousandsGroup
TRUEFALSE
yes
Evaluation Count:454
yes
Evaluation Count:37563
partially evaluated: base == 10
TRUEFALSE
yes
Evaluation Count:454
no
Evaluation Count:0
0-37563
2836 for (int i = num_str.length() - 3; i > 0; i -=3) {
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:454
8-454
2837 num_str.insert(i, group);
executed (the execution status of this line is deduced): num_str.insert(i, group);
-
2838 ++cnt_thousand_sep;
executed (the execution status of this line is deduced): ++cnt_thousand_sep;
-
2839 }
executed: }
Execution Count:8
8
2840 }
executed: }
Execution Count:454
454
2841 -
2842 for (int i = num_str.length()/* - cnt_thousand_sep*/; i < precision; ++i)
evaluated: i < precision
TRUEFALSE
yes
Evaluation Count:13279
yes
Evaluation Count:38017
13279-38017
2843 num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
Execution Count:13279
13279
2844 -
2845 if ((flags & Alternate || flags & ShowBase)
evaluated: flags & Alternate
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:37982
evaluated: flags & ShowBase
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:37888
35-37982
2846 && base == 8
evaluated: base == 8
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:127
2-127
2847 && (num_str.isEmpty() || num_str[0].unicode() != QLatin1Char('0')))
partially evaluated: num_str.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
evaluated: num_str[0].unicode() != QLatin1Char('0')
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
0-2
2848 num_str.prepend(QLatin1Char('0'));
executed: num_str.prepend(QLatin1Char('0'));
Execution Count:1
1
2849 -
2850 // LeftAdjusted overrides this flag ZeroPadded. sprintf only padds -
2851 // when precision is not specified in the format string -
2852 bool zero_padded = flags & ZeroPadded
evaluated: flags & ZeroPadded
TRUEFALSE
yes
Evaluation Count:2040
yes
Evaluation Count:35977
2040-35977
2853 && !(flags & LeftAdjusted)
partially evaluated: !(flags & LeftAdjusted)
TRUEFALSE
yes
Evaluation Count:2040
no
Evaluation Count:0
0-2040
2854 && precision_not_specified;
partially evaluated: precision_not_specified
TRUEFALSE
yes
Evaluation Count:2040
no
Evaluation Count:0
0-2040
2855 -
2856 if (zero_padded) {
evaluated: zero_padded
TRUEFALSE
yes
Evaluation Count:2040
yes
Evaluation Count:35976
2040-35976
2857 int num_pad_chars = width - num_str.length();
executed (the execution status of this line is deduced): int num_pad_chars = width - num_str.length();
-
2858 -
2859 // leave space for optional '0x' in hex form -
2860 if (base == 16 && flags & Alternate)
partially evaluated: base == 16
TRUEFALSE
yes
Evaluation Count:2040
no
Evaluation Count:0
partially evaluated: flags & Alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2040
0-2040
2861 num_pad_chars -= 2;
never executed: num_pad_chars -= 2;
0
2862 // leave space for optional '0b' in binary form -
2863 else if (base == 2 && flags & Alternate)
partially evaluated: base == 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2040
never evaluated: flags & Alternate
0-2040
2864 num_pad_chars -= 2;
never executed: num_pad_chars -= 2;
0
2865 -
2866 for (int i = 0; i < num_pad_chars; ++i)
evaluated: i < num_pad_chars
TRUEFALSE
yes
Evaluation Count:604
yes
Evaluation Count:2040
604-2040
2867 num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
executed: num_str.prepend(base == 10 ? zero : QChar::fromLatin1('0'));
Execution Count:604
604
2868 }
executed: }
Execution Count:2040
2040
2869 -
2870 if (flags & CapitalEorX)
evaluated: flags & CapitalEorX
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:38007
9-38007
2871 num_str = num_str.toUpper();
executed: num_str = num_str.toUpper();
Execution Count:9
9
2872 -
2873 if (base == 16 && (flags & Alternate || flags & ShowBase))
evaluated: base == 16
TRUEFALSE
yes
Evaluation Count:15293
yes
Evaluation Count:22723
evaluated: flags & Alternate
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:15258
evaluated: flags & ShowBase
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:15181
35-22723
2874 num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));
executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));
Execution Count:112
112
2875 else if (base == 2 && (flags & Alternate || flags & ShowBase))
evaluated: base == 2
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:37889
partially evaluated: flags & Alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
evaluated: flags & ShowBase
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1
0-37889
2876 num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b"));
executed: num_str.prepend(QLatin1String(flags & UppercaseBase ? "0B" : "0b"));
Execution Count:14
14
2877 -
2878 // add sign -
2879 if (flags & AlwaysShowSign)
evaluated: flags & AlwaysShowSign
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:38013
3-38013
2880 num_str.prepend(plus);
executed: num_str.prepend(plus);
Execution Count:3
3
2881 else if (flags & BlankBeforePositive)
partially evaluated: flags & BlankBeforePositive
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38011
0-38011
2882 num_str.prepend(QLatin1Char(' '));
never executed: num_str.prepend(QLatin1Char(' '));
0
2883 -
2884 return num_str;
executed: return num_str;
Execution Count:38014
38014
2885} -
2886 -
2887/* -
2888 Converts a number in locale to its representation in the C locale. -
2889 Only has to guarantee that a string that is a correct representation of -
2890 a number will be converted. If junk is passed in, junk will be passed -
2891 out and the error will be detected during the actual conversion to a -
2892 number. We can't detect junk here, since we don't even know the base -
2893 of the number. -
2894*/ -
2895bool QLocalePrivate::numberToCLocale(const QString &num, -
2896 GroupSeparatorMode group_sep_mode, -
2897 CharBuff *result) const -
2898{ -
2899 const QChar *uc = num.unicode();
executed (the execution status of this line is deduced): const QChar *uc = num.unicode();
-
2900 int l = num.length();
executed (the execution status of this line is deduced): int l = num.length();
-
2901 int idx = 0;
executed (the execution status of this line is deduced): int idx = 0;
-
2902 -
2903 // Skip whitespace -
2904 while (idx < l && uc[idx].isSpace())
evaluated: idx < l
TRUEFALSE
yes
Evaluation Count:103045
yes
Evaluation Count:11432
evaluated: uc[idx].isSpace()
TRUEFALSE
yes
Evaluation Count:151
yes
Evaluation Count:102894
151-103045
2905 ++idx;
executed: ++idx;
Execution Count:151
151
2906 if (idx == l)
evaluated: idx == l
TRUEFALSE
yes
Evaluation Count:11432
yes
Evaluation Count:102894
11432-102894
2907 return false;
executed: return false;
Execution Count:11432
11432
2908 -
2909 while (idx < l) {
evaluated: idx < l
TRUEFALSE
yes
Evaluation Count:263388
yes
Evaluation Count:102201
102201-263388
2910 const QChar in = uc[idx];
executed (the execution status of this line is deduced): const QChar in = uc[idx];
-
2911 -
2912 char out = digitToCLocale(in);
executed (the execution status of this line is deduced): char out = digitToCLocale(in);
-
2913 if (out == 0) {
evaluated: out == 0
TRUEFALSE
yes
Evaluation Count:111212
yes
Evaluation Count:152176
111212-152176
2914 if (in == list())
partially evaluated: in == list()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:111212
0-111212
2915 out = ';';
never executed: out = ';';
0
2916 else if (in == percent())
evaluated: in == percent()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:111208
4-111208
2917 out = '%';
executed: out = '%';
Execution Count:4
4
2918 // for handling base-x numbers -
2919 else if (in.unicode() >= 'A' && in.unicode() <= 'Z')
evaluated: in.unicode() >= 'A'
TRUEFALSE
yes
Evaluation Count:110530
yes
Evaluation Count:678
evaluated: in.unicode() <= 'Z'
TRUEFALSE
yes
Evaluation Count:97711
yes
Evaluation Count:12819
678-110530
2920 out = in.toLower().toLatin1();
executed: out = in.toLower().toLatin1();
Execution Count:97711
97711
2921 else if (in.unicode() >= 'a' && in.unicode() <= 'z')
evaluated: in.unicode() >= 'a'
TRUEFALSE
yes
Evaluation Count:12809
yes
Evaluation Count:688
evaluated: in.unicode() <= 'z'
TRUEFALSE
yes
Evaluation Count:12804
yes
Evaluation Count:5
5-12809
2922 out = in.toLatin1();
executed: out = in.toLatin1();
Execution Count:12804
12804
2923 else -
2924 break;
executed: break;
Execution Count:693
693
2925 } -
2926 -
2927 result->append(out);
executed (the execution status of this line is deduced): result->append(out);
-
2928 -
2929 ++idx;
executed (the execution status of this line is deduced): ++idx;
-
2930 }
executed: }
Execution Count:262695
262695
2931 -
2932 // Check trailing whitespace -
2933 for (; idx < l; ++idx) {
evaluated: idx < l
TRUEFALSE
yes
Evaluation Count:773
yes
Evaluation Count:102261
773-102261
2934 if (!uc[idx].isSpace())
evaluated: !uc[idx].isSpace()
TRUEFALSE
yes
Evaluation Count:633
yes
Evaluation Count:140
140-633
2935 return false;
executed: return false;
Execution Count:633
633
2936 }
executed: }
Execution Count:140
140
2937 -
2938 result->append('\0');
executed (the execution status of this line is deduced): result->append('\0');
-
2939 -
2940 // Check separators -
2941 if (group_sep_mode == ParseGroupSeparators
evaluated: group_sep_mode == ParseGroupSeparators
TRUEFALSE
yes
Evaluation Count:13445
yes
Evaluation Count:88816
13445-88816
2942 && !removeGroupSeparators(result))
evaluated: !removeGroupSeparators(result)
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:13373
72-13373
2943 return false;
executed: return false;
Execution Count:72
72
2944 -
2945 -
2946 return true;
executed: return true;
Execution Count:102189
102189
2947} -
2948 -
2949bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByteArray *buff, -
2950 int decDigits) const -
2951{ -
2952 buff->clear();
executed (the execution status of this line is deduced): buff->clear();
-
2953 buff->reserve(str.length());
executed (the execution status of this line is deduced): buff->reserve(str.length());
-
2954 -
2955 const bool scientific = numMode == DoubleScientificMode;
executed (the execution status of this line is deduced): const bool scientific = numMode == DoubleScientificMode;
-
2956 bool lastWasE = false;
executed (the execution status of this line is deduced): bool lastWasE = false;
-
2957 bool lastWasDigit = false;
executed (the execution status of this line is deduced): bool lastWasDigit = false;
-
2958 int eCnt = 0;
executed (the execution status of this line is deduced): int eCnt = 0;
-
2959 int decPointCnt = 0;
executed (the execution status of this line is deduced): int decPointCnt = 0;
-
2960 bool dec = false;
executed (the execution status of this line is deduced): bool dec = false;
-
2961 int decDigitCnt = 0;
executed (the execution status of this line is deduced): int decDigitCnt = 0;
-
2962 -
2963 for (int i = 0; i < str.length(); ++i) {
evaluated: i < str.length()
TRUEFALSE
yes
Evaluation Count:1596
yes
Evaluation Count:382
382-1596
2964 char c = digitToCLocale(str.at(i));
executed (the execution status of this line is deduced): char c = digitToCLocale(str.at(i));
-
2965 -
2966 if (c >= '0' && c <= '9') {
evaluated: c >= '0'
TRUEFALSE
yes
Evaluation Count:1304
yes
Evaluation Count:292
evaluated: c <= '9'
TRUEFALSE
yes
Evaluation Count:1200
yes
Evaluation Count:104
104-1304
2967 if (numMode != IntegerMode) {
evaluated: numMode != IntegerMode
TRUEFALSE
yes
Evaluation Count:695
yes
Evaluation Count:505
505-695
2968 // If a double has too many digits after decpt, it shall be Invalid. -
2969 if (dec && decDigits != -1 && decDigits < ++decDigitCnt)
evaluated: dec
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:595
partially evaluated: decDigits != -1
TRUEFALSE
yes
Evaluation Count:100
no
Evaluation Count:0
evaluated: decDigits < ++decDigitCnt
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:88
0-595
2970 return false;
executed: return false;
Execution Count:12
12
2971 }
executed: }
Execution Count:683
683
2972 lastWasDigit = true;
executed (the execution status of this line is deduced): lastWasDigit = true;
-
2973 } else {
executed: }
Execution Count:1188
1188
2974 switch (c) { -
2975 case '.': -
2976 if (numMode == IntegerMode) {
evaluated: numMode == IntegerMode
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:62
6-62
2977 // If an integer has a decimal point, it shall be Invalid. -
2978 return false;
executed: return false;
Execution Count:6
6
2979 } else { -
2980 // If a double has more than one decimal point, it shall be Invalid. -
2981 if (++decPointCnt > 1)
partially evaluated: ++decPointCnt > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:62
0-62
2982 return false;
never executed: return false;
0
2983#if 0 -
2984 // If a double with no decimal digits has a decimal point, it shall be -
2985 // Invalid. -
2986 if (decDigits == 0) -
2987 return false; -
2988#endif // On second thoughts, it shall be Valid. -
2989 -
2990 dec = true;
executed (the execution status of this line is deduced): dec = true;
-
2991 }
executed: }
Execution Count:62
62
2992 break;
executed: break;
Execution Count:62
62
2993 -
2994 case '+': -
2995 case '-': -
2996 if (scientific) {
evaluated: scientific
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:108
56-108
2997 // If a scientific has a sign that's not at the beginning or after -
2998 // an 'e', it shall be Invalid. -
2999 if (i != 0 && !lastWasE)
evaluated: i != 0
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:14
partially evaluated: !lastWasE
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:42
0-42
3000 return false;
never executed: return false;
0
3001 } else {
executed: }
Execution Count:56
56
3002 // If a non-scientific has a sign that's not at the beginning, -
3003 // it shall be Invalid. -
3004 if (i != 0)
evaluated: i != 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:104
4-104
3005 return false;
executed: return false;
Execution Count:4
4
3006 }
executed: }
Execution Count:104
104
3007 break;
executed: break;
Execution Count:160
160
3008 -
3009 case ',': -
3010 //it can only be placed after a digit which is before the decimal point -
3011 if (!lastWasDigit || decPointCnt > 0)
evaluated: !lastWasDigit
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:13
partially evaluated: decPointCnt > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
3012 return false;
executed: return false;
Execution Count:2
2
3013 break;
executed: break;
Execution Count:13
13
3014 -
3015 case 'e': -
3016 if (scientific) {
evaluated: scientific
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:52
52
3017 // If a scientific has more than one 'e', it shall be Invalid. -
3018 if (++eCnt > 1)
partially evaluated: ++eCnt > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:52
0-52
3019 return false;
never executed: return false;
0
3020 dec = false;
executed (the execution status of this line is deduced): dec = false;
-
3021 } else {
executed: }
Execution Count:52
52
3022 // If a non-scientific has an 'e', it shall be Invalid. -
3023 return false;
executed: return false;
Execution Count:52
52
3024 } -
3025 break;
executed: break;
Execution Count:52
52
3026 -
3027 default: -
3028 // If it's not a valid digit, it shall be Invalid. -
3029 return false;
executed: return false;
Execution Count:45
45
3030 } -
3031 lastWasDigit = false;
executed (the execution status of this line is deduced): lastWasDigit = false;
-
3032 }
executed: }
Execution Count:287
287
3033 -
3034 lastWasE = c == 'e';
executed (the execution status of this line is deduced): lastWasE = c == 'e';
-
3035 if (c != ',')
evaluated: c != ','
TRUEFALSE
yes
Evaluation Count:1462
yes
Evaluation Count:13
13-1462
3036 buff->append(c);
executed: buff->append(c);
Execution Count:1462
1462
3037 }
executed: }
Execution Count:1475
1475
3038 -
3039 return true;
executed: return true;
Execution Count:382
382
3040} -
3041 -
3042double QLocalePrivate::stringToDouble(const QString &number, bool *ok, -
3043 GroupSeparatorMode group_sep_mode) const -
3044{ -
3045 CharBuff buff;
executed (the execution status of this line is deduced): CharBuff buff;
-
3046 if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number,
evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)
TRUEFALSE
yes
Evaluation Count:93
yes
Evaluation Count:3615
93-3615
3047 group_sep_mode, &buff)) {
evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)
TRUEFALSE
yes
Evaluation Count:93
yes
Evaluation Count:3615
93-3615
3048 if (ok != 0)
partially evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:93
no
Evaluation Count:0
0-93
3049 *ok = false;
executed: *ok = false;
Execution Count:93
93
3050 return 0.0;
executed: return 0.0;
Execution Count:93
93
3051 } -
3052 return bytearrayToDouble(buff.constData(), ok);
executed: return bytearrayToDouble(buff.constData(), ok);
Execution Count:3615
3615
3053} -
3054 -
3055qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, -
3056 bool *ok, GroupSeparatorMode group_sep_mode) const -
3057{ -
3058 CharBuff buff;
executed (the execution status of this line is deduced): CharBuff buff;
-
3059 if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number,
evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)
TRUEFALSE
yes
Evaluation Count:11428
yes
Evaluation Count:74537
11428-74537
3060 group_sep_mode, &buff)) {
evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)
TRUEFALSE
yes
Evaluation Count:11428
yes
Evaluation Count:74537
11428-74537
3061 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:11407
yes
Evaluation Count:21
21-11407
3062 *ok = false;
executed: *ok = false;
Execution Count:11407
11407
3063 return 0;
executed: return 0;
Execution Count:11428
11428
3064 } -
3065 -
3066 return bytearrayToLongLong(buff.constData(), base, ok);
executed: return bytearrayToLongLong(buff.constData(), base, ok);
Execution Count:74536
74536
3067} -
3068 -
3069qulonglong QLocalePrivate::stringToUnsLongLong(const QString &number, int base, -
3070 bool *ok, GroupSeparatorMode group_sep_mode) const -
3071{ -
3072 CharBuff buff;
executed (the execution status of this line is deduced): CharBuff buff;
-
3073 if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number,
evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)
TRUEFALSE
yes
Evaluation Count:616
yes
Evaluation Count:24038
616-24038
3074 group_sep_mode, &buff)) {
evaluated: !numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)
TRUEFALSE
yes
Evaluation Count:616
yes
Evaluation Count:24038
616-24038
3075 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:612
yes
Evaluation Count:4
4-612
3076 *ok = false;
executed: *ok = false;
Execution Count:612
612
3077 return 0;
executed: return 0;
Execution Count:616
616
3078 } -
3079 -
3080 return bytearrayToUnsLongLong(buff.constData(), base, ok);
executed: return bytearrayToUnsLongLong(buff.constData(), base, ok);
Execution Count:24038
24038
3081} -
3082 -
3083 -
3084double QLocalePrivate::bytearrayToDouble(const char *num, bool *ok, bool *overflow) -
3085{ -
3086 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:3177
yes
Evaluation Count:990
990-3177
3087 *ok = true;
executed: *ok = true;
Execution Count:3177
3177
3088 if (overflow != 0)
evaluated: overflow != 0
TRUEFALSE
yes
Evaluation Count:157
yes
Evaluation Count:4010
157-4010
3089 *overflow = false;
executed: *overflow = false;
Execution Count:157
157
3090 -
3091 if (*num == '\0') {
partially evaluated: *num == '\0'
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4167
0-4167
3092 if (ok != 0)
never evaluated: ok != 0
0
3093 *ok = false;
never executed: *ok = false;
0
3094 return 0.0;
never executed: return 0.0;
0
3095 } -
3096 -
3097 if (qstrcmp(num, "nan") == 0)
evaluated: qstrcmp(num, "nan") == 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4160
7-4160
3098 return qt_snan();
executed: return qt_snan();
Execution Count:7
7
3099 -
3100 if (qstrcmp(num, "+inf") == 0 || qstrcmp(num, "inf") == 0)
evaluated: qstrcmp(num, "+inf") == 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4157
evaluated: qstrcmp(num, "inf") == 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:4151
3-4157
3101 return qt_inf();
executed: return qt_inf();
Execution Count:9
9
3102 -
3103 if (qstrcmp(num, "-inf") == 0)
evaluated: qstrcmp(num, "-inf") == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4149
2-4149
3104 return -qt_inf();
executed: return -qt_inf();
Execution Count:2
2
3105 -
3106 bool _ok;
executed (the execution status of this line is deduced): bool _ok;
-
3107 const char *endptr;
executed (the execution status of this line is deduced): const char *endptr;
-
3108 double d = qstrtod(num, &endptr, &_ok);
executed (the execution status of this line is deduced): double d = qstrtod(num, &endptr, &_ok);
-
3109 -
3110 if (!_ok) {
evaluated: !_ok
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4145
4-4145
3111 // the only way strtod can fail with *endptr != '\0' on a non-empty -
3112 // input string is overflow -
3113 if (ok != 0)
partially evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
3114 *ok = false;
executed: *ok = false;
Execution Count:4
4
3115 if (overflow != 0)
partially evaluated: overflow != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
3116 *overflow = *endptr != '\0';
never executed: *overflow = *endptr != '\0';
0
3117 return 0.0;
executed: return 0.0;
Execution Count:4
4
3118 } -
3119 -
3120 if (*endptr != '\0') {
evaluated: *endptr != '\0'
TRUEFALSE
yes
Evaluation Count:305
yes
Evaluation Count:3840
305-3840
3121 // we stopped at a non-digit character after converting some digits -
3122 if (ok != 0)
partially evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:305
no
Evaluation Count:0
0-305
3123 *ok = false;
executed: *ok = false;
Execution Count:305
305
3124 if (overflow != 0)
evaluated: overflow != 0
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:257
48-257
3125 *overflow = false;
executed: *overflow = false;
Execution Count:48
48
3126 return 0.0;
executed: return 0.0;
Execution Count:305
305
3127 } -
3128 -
3129 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:2850
yes
Evaluation Count:990
990-2850
3130 *ok = true;
executed: *ok = true;
Execution Count:2850
2850
3131 if (overflow != 0)
evaluated: overflow != 0
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:3731
109-3731
3132 *overflow = false;
executed: *overflow = false;
Execution Count:109
109
3133 return d;
executed: return d;
Execution Count:3840
3840
3134} -
3135 -
3136qlonglong QLocalePrivate::bytearrayToLongLong(const char *num, int base, bool *ok, bool *overflow) -
3137{ -
3138 bool _ok;
executed (the execution status of this line is deduced): bool _ok;
-
3139 const char *endptr;
executed (the execution status of this line is deduced): const char *endptr;
-
3140 -
3141 if (*num == '\0') {
evaluated: *num == '\0'
TRUEFALSE
yes
Evaluation Count:497
yes
Evaluation Count:254823
497-254823
3142 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:492
5-492
3143 *ok = false;
executed: *ok = false;
Execution Count:5
5
3144 if (overflow != 0)
evaluated: overflow != 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:493
4-493
3145 *overflow = false;
executed: *overflow = false;
Execution Count:4
4
3146 return 0;
executed: return 0;
Execution Count:497
497
3147 } -
3148 -
3149 qlonglong l = qstrtoll(num, &endptr, base, &_ok);
executed (the execution status of this line is deduced): qlonglong l = qstrtoll(num, &endptr, base, &_ok);
-
3150 -
3151 if (!_ok) {
evaluated: !_ok
TRUEFALSE
yes
Evaluation Count:148
yes
Evaluation Count:254673
148-254673
3152 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:127
yes
Evaluation Count:21
21-127
3153 *ok = false;
executed: *ok = false;
Execution Count:127
127
3154 if (overflow != 0) {
evaluated: overflow != 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:147
1-147
3155 // the only way qstrtoll can fail with *endptr != '\0' on a non-empty -
3156 // input string is overflow -
3157 *overflow = *endptr != '\0';
executed (the execution status of this line is deduced): *overflow = *endptr != '\0';
-
3158 }
executed: }
Execution Count:1
1
3159 return 0;
executed: return 0;
Execution Count:148
148
3160 } -
3161 -
3162 if (*endptr != '\0') {
evaluated: *endptr != '\0'
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:254625
48-254625
3163 // we stopped at a non-digit character after converting some digits -
3164 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:7
7-41
3165 *ok = false;
executed: *ok = false;
Execution Count:41
41
3166 if (overflow != 0)
partially evaluated: overflow != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:48
0-48
3167 *overflow = false;
never executed: *overflow = false;
0
3168 return 0;
executed: return 0;
Execution Count:48
48
3169 } -
3170 -
3171 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:185671
yes
Evaluation Count:68954
68954-185671
3172 *ok = true;
executed: *ok = true;
Execution Count:185671
185671
3173 if (overflow != 0)
evaluated: overflow != 0
TRUEFALSE
yes
Evaluation Count:159
yes
Evaluation Count:254467
159-254467
3174 *overflow = false;
executed: *overflow = false;
Execution Count:159
159
3175 return l;
executed: return l;
Execution Count:254624
254624
3176} -
3177 -
3178qulonglong QLocalePrivate::bytearrayToUnsLongLong(const char *num, int base, bool *ok) -
3179{ -
3180 bool _ok;
executed (the execution status of this line is deduced): bool _ok;
-
3181 const char *endptr;
executed (the execution status of this line is deduced): const char *endptr;
-
3182 qulonglong l = qstrtoull(num, &endptr, base, &_ok);
executed (the execution status of this line is deduced): qulonglong l = qstrtoull(num, &endptr, base, &_ok);
-
3183 -
3184 if (!_ok || *endptr != '\0') {
evaluated: !_ok
TRUEFALSE
yes
Evaluation Count:660
yes
Evaluation Count:26884
evaluated: *endptr != '\0'
TRUEFALSE
yes
Evaluation Count:118
yes
Evaluation Count:26766
118-26884
3185 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:765
yes
Evaluation Count:13
13-765
3186 *ok = false;
executed: *ok = false;
Execution Count:765
765
3187 return 0;
executed: return 0;
Execution Count:778
778
3188 } -
3189 -
3190 if (ok != 0)
evaluated: ok != 0
TRUEFALSE
yes
Evaluation Count:25655
yes
Evaluation Count:1111
1111-25655
3191 *ok = true;
executed: *ok = true;
Execution Count:25655
25655
3192 return l;
executed: return l;
Execution Count:26766
26766
3193} -
3194 -
3195/*! -
3196 \since 4.8 -
3197 -
3198 \enum QLocale::CurrencySymbolFormat -
3199 -
3200 Specifies the format of the currency symbol. -
3201 -
3202 \value CurrencyIsoCode a ISO-4217 code of the currency. -
3203 \value CurrencySymbol a currency symbol. -
3204 \value CurrencyDisplayName a user readable name of the currency. -
3205*/ -
3206 -
3207/*! -
3208 \since 4.8 -
3209 Returns a currency symbol according to the \a format. -
3210*/ -
3211QString QLocale::currencySymbol(QLocale::CurrencySymbolFormat format) const -
3212{ -
3213#ifndef QT_NO_SYSTEMLOCALE -
3214 if (d->m_data == systemData()) {
partially evaluated: d->m_data == systemData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20
0-20
3215 QVariant res = systemLocale()->query(QSystemLocale::CurrencySymbol, format);
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::CurrencySymbol, format);
-
3216 if (!res.isNull())
never evaluated: !res.isNull()
0
3217 return res.toString();
never executed: return res.toString();
0
3218 }
never executed: }
0
3219#endif -
3220 quint32 idx, size;
executed (the execution status of this line is deduced): quint32 idx, size;
-
3221 switch (format) { -
3222 case CurrencySymbol: -
3223 idx = d->m_data->m_currency_symbol_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_currency_symbol_idx;
-
3224 size = d->m_data->m_currency_symbol_size;
executed (the execution status of this line is deduced): size = d->m_data->m_currency_symbol_size;
-
3225 return getLocaleData(currency_symbol_data + idx, size);
executed: return getLocaleData(currency_symbol_data + idx, size);
Execution Count:16
16
3226 case CurrencyDisplayName: -
3227 idx = d->m_data->m_currency_display_name_idx;
never executed (the execution status of this line is deduced): idx = d->m_data->m_currency_display_name_idx;
-
3228 size = d->m_data->m_currency_display_name_size;
never executed (the execution status of this line is deduced): size = d->m_data->m_currency_display_name_size;
-
3229 return getLocaleListData(currency_display_name_data + idx, size, 0);
never executed: return getLocaleListData(currency_display_name_data + idx, size, 0);
0
3230 case CurrencyIsoCode: { -
3231 int len = 0;
executed (the execution status of this line is deduced): int len = 0;
-
3232 const QLocaleData *data = this->d->m_data;
executed (the execution status of this line is deduced): const QLocaleData *data = this->d->m_data;
-
3233 for (; len < 3; ++len)
partially evaluated: len < 3
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
3234 if (!data->m_currency_iso_code[len])
partially evaluated: !data->m_currency_iso_code[len]
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
3235 break;
executed: break;
Execution Count:4
4
3236 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
3237 } -
3238 } -
3239 return QString();
never executed: return QString();
0
3240} -
3241 -
3242/*! -
3243 \since 4.8 -
3244 -
3245 Returns a localized string representation of \a value as a currency. -
3246 If the \a symbol is provided it is used instead of the default currency symbol. -
3247 -
3248 \sa currencySymbol() -
3249*/ -
3250QString QLocale::toCurrencyString(qlonglong value, const QString &symbol) const -
3251{ -
3252#ifndef QT_NO_SYSTEMLOCALE -
3253 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
3254 QSystemLocale::CurrencyToStringArgument arg(value, symbol);
executed (the execution status of this line is deduced): QSystemLocale::CurrencyToStringArgument arg(value, symbol);
-
3255 QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg));
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg));
-
3256 if (!res.isNull())
partially evaluated: !res.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
3257 return res.toString();
never executed: return res.toString();
0
3258 }
executed: }
Execution Count:1
1
3259#endif -
3260 const QLocalePrivate *d = this->d;
executed (the execution status of this line is deduced): const QLocalePrivate *d = this->d;
-
3261 quint8 idx = d->m_data->m_currency_format_idx;
executed (the execution status of this line is deduced): quint8 idx = d->m_data->m_currency_format_idx;
-
3262 quint8 size = d->m_data->m_currency_format_size;
executed (the execution status of this line is deduced): quint8 size = d->m_data->m_currency_format_size;
-
3263 if (d->m_data->m_currency_negative_format_size && value < 0) {
evaluated: d->m_data->m_currency_negative_format_size
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
evaluated: value < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-4
3264 idx = d->m_data->m_currency_negative_format_idx;
executed (the execution status of this line is deduced): idx = d->m_data->m_currency_negative_format_idx;
-
3265 size = d->m_data->m_currency_negative_format_size;
executed (the execution status of this line is deduced): size = d->m_data->m_currency_negative_format_size;
-
3266 value = -value;
executed (the execution status of this line is deduced): value = -value;
-
3267 }
executed: }
Execution Count:1
1
3268 QString str = toString(value);
executed (the execution status of this line is deduced): QString str = toString(value);
-
3269 QString sym = symbol.isNull() ? currencySymbol() : symbol;
evaluated: symbol.isNull()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
3270 if (sym.isEmpty())
evaluated: sym.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
3271 sym = currencySymbol(QLocale::CurrencyIsoCode);
executed: sym = currencySymbol(QLocale::CurrencyIsoCode);
Execution Count:1
1
3272 QString format = getLocaleData(currency_format_data + idx, size);
executed (the execution status of this line is deduced): QString format = getLocaleData(currency_format_data + idx, size);
-
3273 return format.arg(str, sym);
executed: return format.arg(str, sym);
Execution Count:6
6
3274} -
3275 -
3276/*! -
3277 \since 4.8 -
3278 \overload -
3279*/ -
3280QString QLocale::toCurrencyString(qulonglong value, const QString &symbol) const -
3281{ -
3282#ifndef QT_NO_SYSTEMLOCALE -
3283 if (d->m_data == systemData()) {
partially evaluated: d->m_data == systemData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
3284 QSystemLocale::CurrencyToStringArgument arg(value, symbol);
never executed (the execution status of this line is deduced): QSystemLocale::CurrencyToStringArgument arg(value, symbol);
-
3285 QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg));
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg));
-
3286 if (!res.isNull())
never evaluated: !res.isNull()
0
3287 return res.toString();
never executed: return res.toString();
0
3288 }
never executed: }
0
3289#endif -
3290 const QLocaleData *data = this->d->m_data;
executed (the execution status of this line is deduced): const QLocaleData *data = this->d->m_data;
-
3291 quint8 idx = data->m_currency_format_idx;
executed (the execution status of this line is deduced): quint8 idx = data->m_currency_format_idx;
-
3292 quint8 size = data->m_currency_format_size;
executed (the execution status of this line is deduced): quint8 size = data->m_currency_format_size;
-
3293 QString str = toString(value);
executed (the execution status of this line is deduced): QString str = toString(value);
-
3294 QString sym = symbol.isNull() ? currencySymbol() : symbol;
evaluated: symbol.isNull()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
3295 if (sym.isEmpty())
evaluated: sym.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
3296 sym = currencySymbol(QLocale::CurrencyIsoCode);
executed: sym = currencySymbol(QLocale::CurrencyIsoCode);
Execution Count:1
1
3297 QString format = getLocaleData(currency_format_data + idx, size);
executed (the execution status of this line is deduced): QString format = getLocaleData(currency_format_data + idx, size);
-
3298 return format.arg(str, sym);
executed: return format.arg(str, sym);
Execution Count:5
5
3299} -
3300 -
3301/*! -
3302 \since 4.8 -
3303 \overload -
3304*/ -
3305QString QLocale::toCurrencyString(double value, const QString &symbol) const -
3306{ -
3307#ifndef QT_NO_SYSTEMLOCALE -
3308 if (d->m_data == systemData()) {
partially evaluated: d->m_data == systemData()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
3309 QSystemLocale::CurrencyToStringArgument arg(value, symbol);
never executed (the execution status of this line is deduced): QSystemLocale::CurrencyToStringArgument arg(value, symbol);
-
3310 QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg));
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::CurrencyToString, QVariant::fromValue(arg));
-
3311 if (!res.isNull())
never evaluated: !res.isNull()
0
3312 return res.toString();
never executed: return res.toString();
0
3313 }
never executed: }
0
3314#endif -
3315 const QLocaleData *data = this->d->m_data;
executed (the execution status of this line is deduced): const QLocaleData *data = this->d->m_data;
-
3316 quint8 idx = data->m_currency_format_idx;
executed (the execution status of this line is deduced): quint8 idx = data->m_currency_format_idx;
-
3317 quint8 size = data->m_currency_format_size;
executed (the execution status of this line is deduced): quint8 size = data->m_currency_format_size;
-
3318 if (data->m_currency_negative_format_size && value < 0) {
evaluated: data->m_currency_negative_format_size
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
evaluated: value < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-7
3319 idx = data->m_currency_negative_format_idx;
executed (the execution status of this line is deduced): idx = data->m_currency_negative_format_idx;
-
3320 size = data->m_currency_negative_format_size;
executed (the execution status of this line is deduced): size = data->m_currency_negative_format_size;
-
3321 value = -value;
executed (the execution status of this line is deduced): value = -value;
-
3322 }
executed: }
Execution Count:1
1
3323 QString str = toString(value, 'f', d->m_data->m_currency_digits);
executed (the execution status of this line is deduced): QString str = toString(value, 'f', d->m_data->m_currency_digits);
-
3324 QString sym = symbol.isNull() ? currencySymbol() : symbol;
evaluated: symbol.isNull()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
1-8
3325 if (sym.isEmpty())
evaluated: sym.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
3326 sym = currencySymbol(QLocale::CurrencyIsoCode);
executed: sym = currencySymbol(QLocale::CurrencyIsoCode);
Execution Count:2
2
3327 QString format = getLocaleData(currency_format_data + idx, size);
executed (the execution status of this line is deduced): QString format = getLocaleData(currency_format_data + idx, size);
-
3328 return format.arg(str, sym);
executed: return format.arg(str, sym);
Execution Count:9
9
3329} -
3330 -
3331/*! -
3332 \since 4.8 -
3333 -
3334 Returns an ordered list of locale names for translation purposes in -
3335 preference order (like "en", "en-US", "en-Latn-US"). -
3336 -
3337 The return value represents locale names that the user expects to see the -
3338 UI translation in. -
3339 -
3340 Most like you do not need to use this function directly, but just pass the -
3341 QLocale object to the QTranslator::load() function. -
3342 -
3343 The first item in the list is the most preferred one. -
3344 -
3345 \sa QTranslator, bcp47Name() -
3346*/ -
3347QStringList QLocale::uiLanguages() const -
3348{ -
3349#ifndef QT_NO_SYSTEMLOCALE -
3350 if (d->m_data == systemData()) {
evaluated: d->m_data == systemData()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:23
6-23
3351 QVariant res = systemLocale()->query(QSystemLocale::UILanguages, QVariant());
executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::UILanguages, QVariant());
-
3352 if (!res.isNull()) {
partially evaluated: !res.isNull()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
3353 QStringList result = res.toStringList();
executed (the execution status of this line is deduced): QStringList result = res.toStringList();
-
3354 if (!result.isEmpty())
partially evaluated: !result.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
3355 return result;
executed: return result;
Execution Count:6
6
3356 }
never executed: }
0
3357 }
never executed: }
0
3358#endif -
3359 QLocaleId id = QLocaleId::fromIds(d->m_data->m_language_id, d->m_data->m_script_id, d->m_data->m_country_id);
executed (the execution status of this line is deduced): QLocaleId id = QLocaleId::fromIds(d->m_data->m_language_id, d->m_data->m_script_id, d->m_data->m_country_id);
-
3360 const QLocaleId max = id.withLikelySubtagsAdded();
executed (the execution status of this line is deduced): const QLocaleId max = id.withLikelySubtagsAdded();
-
3361 const QLocaleId min = max.withLikelySubtagsRemoved();
executed (the execution status of this line is deduced): const QLocaleId min = max.withLikelySubtagsRemoved();
-
3362 -
3363 QStringList uiLanguages;
executed (the execution status of this line is deduced): QStringList uiLanguages;
-
3364 uiLanguages.append(min.bcp47Name());
executed (the execution status of this line is deduced): uiLanguages.append(min.bcp47Name());
-
3365 if (id.script_id) {
evaluated: id.script_id
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:2
2-21
3366 id.script_id = 0;
executed (the execution status of this line is deduced): id.script_id = 0;
-
3367 if (id != min && id.withLikelySubtagsAdded() == max)
evaluated: id != min
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:6
evaluated: id.withLikelySubtagsAdded() == max
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3
3-15
3368 uiLanguages.append(id.bcp47Name());
executed: uiLanguages.append(id.bcp47Name());
Execution Count:12
12
3369 }
executed: }
Execution Count:21
21
3370 if (max != min && max != id)
evaluated: max != min
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:2
partially evaluated: max != id
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
3371 uiLanguages.append(max.bcp47Name());
executed: uiLanguages.append(max.bcp47Name());
Execution Count:21
21
3372 return uiLanguages;
executed: return uiLanguages;
Execution Count:23
23
3373} -
3374 -
3375/*! -
3376 \since 4.8 -
3377 -
3378 Returns a native name of the language for the locale. For example -
3379 "Schwiizertüütsch" for Swiss-German locale. -
3380 -
3381 \sa nativeCountryName(), languageToString() -
3382*/ -
3383QString QLocale::nativeLanguageName() const -
3384{ -
3385#ifndef QT_NO_SYSTEMLOCALE -
3386 if (d->m_data == systemData()) {
never evaluated: d->m_data == systemData()
0
3387 QVariant res = systemLocale()->query(QSystemLocale::NativeLanguageName, QVariant());
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::NativeLanguageName, QVariant());
-
3388 if (!res.isNull())
never evaluated: !res.isNull()
0
3389 return res.toString();
never executed: return res.toString();
0
3390 }
never executed: }
0
3391#endif -
3392 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
3393} -
3394 -
3395/*! -
3396 \since 4.8 -
3397 -
3398 Returns a native name of the country for the locale. For example -
3399 "España" for Spanish/Spain locale. -
3400 -
3401 \sa nativeLanguageName(), countryToString() -
3402*/ -
3403QString QLocale::nativeCountryName() const -
3404{ -
3405#ifndef QT_NO_SYSTEMLOCALE -
3406 if (d->m_data == systemData()) {
never evaluated: d->m_data == systemData()
0
3407 QVariant res = systemLocale()->query(QSystemLocale::NativeCountryName, QVariant());
never executed (the execution status of this line is deduced): QVariant res = systemLocale()->query(QSystemLocale::NativeCountryName, QVariant());
-
3408 if (!res.isNull())
never evaluated: !res.isNull()
0
3409 return res.toString();
never executed: return res.toString();
0
3410 }
never executed: }
0
3411#endif -
3412 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
3413} -
3414 -
3415#ifndef QT_NO_DEBUG_STREAM -
3416QDebug operator<<(QDebug dbg, const QLocale &l) -
3417{ -
3418 dbg.nospace() << "QLocale(" << qPrintable(QLocale::languageToString(l.language()))
executed (the execution status of this line is deduced): dbg.nospace() << "QLocale(" << QString(QLocale::languageToString(l.language())).toLocal8Bit().constData()
-
3419 << ", " << qPrintable(QLocale::scriptToString(l.script()))
executed (the execution status of this line is deduced): << ", " << QString(QLocale::scriptToString(l.script())).toLocal8Bit().constData()
-
3420 << ", " << qPrintable(QLocale::countryToString(l.country())) << ')';
executed (the execution status of this line is deduced): << ", " << QString(QLocale::countryToString(l.country())).toLocal8Bit().constData() << ')';
-
3421 return dbg.space();
executed: return dbg.space();
Execution Count:1
1
3422} -
3423#endif -
3424QT_END_NAMESPACE -
3425 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial