Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2012 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 | #include "qlocale_p.h" | - |
43 | | - |
44 | #include "qstringbuilder.h" | - |
45 | #include "qdatetime.h" | - |
46 | #include "qstringlist.h" | - |
47 | #include "qvariant.h" | - |
48 | #include "qreadwritelock.h" | - |
49 | | - |
50 | #if defined(Q_OS_BLACKBERRY) | - |
51 | #include <QtCore/private/qcore_unix_p.h> | - |
52 | #include <QCoreApplication> | - |
53 | | - |
54 | #include <unistd.h> | - |
55 | #include <errno.h> | - |
56 | #include <sys/pps.h> | - |
57 | #endif | - |
58 | | - |
59 | QT_BEGIN_NAMESPACE | - |
60 | | - |
61 | #if defined(Q_OS_BLACKBERRY) | - |
62 | static const char ppsServicePath[] = "/pps/services/locale/uom"; | - |
63 | static const size_t ppsBufferSize = 256; | - |
64 | | - |
65 | QQNXLocaleData::QQNXLocaleData() | - |
66 | :ppsNotifier(0) | - |
67 | ,ppsFd(-1) | - |
68 | { | - |
69 | readPPSLocale(); | - |
70 | } | - |
71 | | - |
72 | QQNXLocaleData::~QQNXLocaleData() | - |
73 | { | - |
74 | if (ppsFd != -1) | - |
75 | qt_safe_close(ppsFd); | - |
76 | } | - |
77 | | - |
78 | void QQNXLocaleData::updateMeasurementSystem() | - |
79 | { | - |
80 | char buffer[ppsBufferSize]; | - |
81 | | - |
82 | errno = 0; | - |
83 | int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1); | - |
84 | if (bytes == -1) { | - |
85 | qWarning("Failed to read Locale pps, errno=%d", errno); | - |
86 | return; | - |
87 | } | - |
88 | // ensure data is null terminated | - |
89 | buffer[bytes] = '\0'; | - |
90 | | - |
91 | pps_decoder_t ppsDecoder; | - |
92 | pps_decoder_initialize(&ppsDecoder, 0); | - |
93 | if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) { | - |
94 | pps_decoder_push(&ppsDecoder, 0); | - |
95 | const char *measurementBuff; | - |
96 | if (pps_decoder_get_string(&ppsDecoder, "uom", &measurementBuff) == PPS_DECODER_OK) { | - |
97 | if (qstrcmp(measurementBuff, "imperial") == 0) { | - |
98 | pps_decoder_cleanup(&ppsDecoder); | - |
99 | ppsMeasurement = QLocale::ImperialSystem; | - |
100 | return; | - |
101 | } | - |
102 | } | - |
103 | } | - |
104 | | - |
105 | pps_decoder_cleanup(&ppsDecoder); | - |
106 | ppsMeasurement = QLocale::MetricSystem; | - |
107 | } | - |
108 | | - |
109 | void QQNXLocaleData::readPPSLocale() | - |
110 | { | - |
111 | errno = 0; | - |
112 | ppsFd = qt_safe_open(ppsServicePath, O_RDONLY); | - |
113 | if (ppsFd == -1) { | - |
114 | qWarning("Failed to open Locale pps, errno=%d", errno); | - |
115 | return; | - |
116 | } | - |
117 | | - |
118 | updateMeasurementSystem(); | - |
119 | if (QCoreApplication::instance()) { | - |
120 | ppsNotifier = new QSocketNotifier(ppsFd, QSocketNotifier::Read, this); | - |
121 | QObject::connect(ppsNotifier, SIGNAL(activated(int)), this, SLOT(updateMeasurementSystem())); | - |
122 | } | - |
123 | } | - |
124 | #endif | - |
125 | | - |
126 | #ifndef QT_NO_SYSTEMLOCALE | - |
127 | struct QSystemLocaleData | - |
128 | { | - |
129 | QSystemLocaleData() | - |
130 | : lc_numeric(QLocale::C) | - |
131 | ,lc_time(QLocale::C) | - |
132 | ,lc_monetary(QLocale::C) | - |
133 | ,lc_messages(QLocale::C) | - |
134 | { | - |
135 | readEnvironment(); executed (the execution status of this line is deduced): readEnvironment(); | - |
136 | } executed: } Execution Count:44 | 44 |
137 | | - |
138 | void readEnvironment(); | - |
139 | | - |
140 | QReadWriteLock lock; | - |
141 | | - |
142 | QLocale lc_numeric; | - |
143 | QLocale lc_time; | - |
144 | QLocale lc_monetary; | - |
145 | QLocale lc_messages; | - |
146 | QByteArray lc_messages_var; | - |
147 | QByteArray lc_measurement_var; | - |
148 | QStringList uiLanguages; | - |
149 | }; | - |
150 | | - |
151 | void QSystemLocaleData::readEnvironment() | - |
152 | { | - |
153 | QWriteLocker locker(&lock); executed (the execution status of this line is deduced): QWriteLocker locker(&lock); | - |
154 | | - |
155 | QByteArray all = qgetenv("LC_ALL"); executed (the execution status of this line is deduced): QByteArray all = qgetenv("LC_ALL"); | - |
156 | QByteArray numeric = all.isEmpty() ? qgetenv("LC_NUMERIC") : all; partially evaluated: all.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
157 | QByteArray time = all.isEmpty() ? qgetenv("LC_TIME") : all; partially evaluated: all.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
158 | QByteArray monetary = all.isEmpty() ? qgetenv("LC_MONETARY") : all; partially evaluated: all.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
159 | lc_messages_var = all.isEmpty() ? qgetenv("LC_MESSAGES") : all; partially evaluated: all.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
160 | lc_measurement_var = all.isEmpty() ? qgetenv("LC_MEASUREMENT") : all; partially evaluated: all.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
161 | QByteArray lang = qgetenv("LANG"); executed (the execution status of this line is deduced): QByteArray lang = qgetenv("LANG"); | - |
162 | if (lang.isEmpty()) partially evaluated: lang.isEmpty() no Evaluation Count:0 | yes Evaluation Count:88 |
| 0-88 |
163 | lang = QByteArray("C"); never executed: lang = QByteArray("C"); | 0 |
164 | if (numeric.isEmpty()) partially evaluated: numeric.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
165 | numeric = lang; executed: numeric = lang; Execution Count:88 | 88 |
166 | if (time.isEmpty()) partially evaluated: time.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
167 | time = lang; executed: time = lang; Execution Count:88 | 88 |
168 | if (monetary.isEmpty()) partially evaluated: monetary.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
169 | monetary = lang; executed: monetary = lang; Execution Count:88 | 88 |
170 | if (lc_messages_var.isEmpty()) partially evaluated: lc_messages_var.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
171 | lc_messages_var = lang; executed: lc_messages_var = lang; Execution Count:88 | 88 |
172 | if (lc_measurement_var.isEmpty()) partially evaluated: lc_measurement_var.isEmpty() yes Evaluation Count:88 | no Evaluation Count:0 |
| 0-88 |
173 | lc_measurement_var = lang; executed: lc_measurement_var = lang; Execution Count:88 | 88 |
174 | lc_numeric = QLocale(QString::fromLatin1(numeric)); executed (the execution status of this line is deduced): lc_numeric = QLocale(QString::fromLatin1(numeric)); | - |
175 | lc_time = QLocale(QString::fromLatin1(time)); executed (the execution status of this line is deduced): lc_time = QLocale(QString::fromLatin1(time)); | - |
176 | lc_monetary = QLocale(QString::fromLatin1(monetary)); executed (the execution status of this line is deduced): lc_monetary = QLocale(QString::fromLatin1(monetary)); | - |
177 | lc_messages = QLocale(QString::fromLatin1(lc_messages_var)); executed (the execution status of this line is deduced): lc_messages = QLocale(QString::fromLatin1(lc_messages_var)); | - |
178 | } executed: } Execution Count:88 | 88 |
179 | | - |
180 | | - |
181 | Q_GLOBAL_STATIC(QSystemLocaleData, qSystemLocaleData) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:17734 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:44 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:44 | yes Evaluation Count:17690 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-17734 |
182 | #if defined(Q_OS_BLACKBERRY) | - |
183 | Q_GLOBAL_STATIC(QQNXLocaleData, qqnxLocaleData) | - |
184 | #endif | - |
185 | | - |
186 | #endif | - |
187 | | - |
188 | #ifndef QT_NO_SYSTEMLOCALE | - |
189 | | - |
190 | QLocale QSystemLocale::fallbackUiLocale() const | - |
191 | { | - |
192 | QByteArray lang = qgetenv("LC_ALL"); executed (the execution status of this line is deduced): QByteArray lang = qgetenv("LC_ALL"); | - |
193 | if (lang.isEmpty()) partially evaluated: lang.isEmpty() yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
194 | lang = qgetenv("LC_MESSAGES"); executed: lang = qgetenv("LC_MESSAGES"); Execution Count:44 | 44 |
195 | if (lang.isEmpty()) partially evaluated: lang.isEmpty() yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
196 | lang = qgetenv("LANG"); executed: lang = qgetenv("LANG"); Execution Count:44 | 44 |
197 | // if the locale is the "C" locale, then we can return the language we found here: | - |
198 | if (lang.isEmpty() || lang == QByteArray("C") || lang == QByteArray("POSIX")) partially evaluated: lang.isEmpty() no Evaluation Count:0 | yes Evaluation Count:44 |
evaluated: lang == QByteArray("C") yes Evaluation Count:1 | yes Evaluation Count:43 |
partially evaluated: lang == QByteArray("POSIX") no Evaluation Count:0 | yes Evaluation Count:43 |
| 0-44 |
199 | return QLocale(QString::fromLatin1(lang)); executed: return QLocale(QString::fromLatin1(lang)); Execution Count:1 | 1 |
200 | | - |
201 | // if the locale is not the "C" locale and LANGUAGE is not empty, return | - |
202 | // the first part of LANGUAGE if LANGUAGE is set and has a first part: | - |
203 | QByteArray language = qgetenv("LANGUAGE"); executed (the execution status of this line is deduced): QByteArray language = qgetenv("LANGUAGE"); | - |
204 | if (!language.isEmpty()) { partially evaluated: !language.isEmpty() yes Evaluation Count:43 | no Evaluation Count:0 |
| 0-43 |
205 | language = language.split(':').first(); executed (the execution status of this line is deduced): language = language.split(':').first(); | - |
206 | if (!language.isEmpty()) partially evaluated: !language.isEmpty() yes Evaluation Count:43 | no Evaluation Count:0 |
| 0-43 |
207 | return QLocale(QString::fromLatin1(language)); executed: return QLocale(QString::fromLatin1(language)); Execution Count:43 | 43 |
208 | } | 0 |
209 | | - |
210 | return QLocale(QString::fromLatin1(lang)); never executed: return QLocale(QString::fromLatin1(lang)); | 0 |
211 | } | - |
212 | | - |
213 | QVariant QSystemLocale::query(QueryType type, QVariant in) const | - |
214 | { | - |
215 | QSystemLocaleData *d = qSystemLocaleData(); executed (the execution status of this line is deduced): QSystemLocaleData *d = qSystemLocaleData(); | - |
216 | #if defined(Q_OS_BLACKBERRY) | - |
217 | QQNXLocaleData *qnxd = qqnxLocaleData(); | - |
218 | #endif | - |
219 | | - |
220 | if (type == LocaleChanged) { evaluated: type == LocaleChanged yes Evaluation Count:44 | yes Evaluation Count:17690 |
| 44-17690 |
221 | d->readEnvironment(); executed (the execution status of this line is deduced): d->readEnvironment(); | - |
222 | return QVariant(); executed: return QVariant(); Execution Count:44 | 44 |
223 | } | - |
224 | | - |
225 | QReadLocker locker(&d->lock); executed (the execution status of this line is deduced): QReadLocker locker(&d->lock); | - |
226 | | - |
227 | const QLocale &lc_numeric = d->lc_numeric; executed (the execution status of this line is deduced): const QLocale &lc_numeric = d->lc_numeric; | - |
228 | const QLocale &lc_time = d->lc_time; executed (the execution status of this line is deduced): const QLocale &lc_time = d->lc_time; | - |
229 | const QLocale &lc_monetary = d->lc_monetary; executed (the execution status of this line is deduced): const QLocale &lc_monetary = d->lc_monetary; | - |
230 | const QLocale &lc_messages = d->lc_messages; executed (the execution status of this line is deduced): const QLocale &lc_messages = d->lc_messages; | - |
231 | | - |
232 | switch (type) { | - |
233 | case DecimalPoint: | - |
234 | return lc_numeric.decimalPoint(); executed: return lc_numeric.decimalPoint(); Execution Count:44 | 44 |
235 | case GroupSeparator: | - |
236 | return lc_numeric.groupSeparator(); executed: return lc_numeric.groupSeparator(); Execution Count:44 | 44 |
237 | case ZeroDigit: | - |
238 | return lc_numeric.zeroDigit(); executed: return lc_numeric.zeroDigit(); Execution Count:44 | 44 |
239 | case NegativeSign: | - |
240 | return lc_numeric.negativeSign(); executed: return lc_numeric.negativeSign(); Execution Count:44 | 44 |
241 | case DateFormatLong: | - |
242 | return lc_time.dateFormat(QLocale::LongFormat); never executed: return lc_time.dateFormat(QLocale::LongFormat); | 0 |
243 | case DateFormatShort: | - |
244 | return lc_time.dateFormat(QLocale::ShortFormat); executed: return lc_time.dateFormat(QLocale::ShortFormat); Execution Count:2 | 2 |
245 | case TimeFormatLong: | - |
246 | return lc_time.timeFormat(QLocale::LongFormat); never executed: return lc_time.timeFormat(QLocale::LongFormat); | 0 |
247 | case TimeFormatShort: | - |
248 | return lc_time.timeFormat(QLocale::ShortFormat); executed: return lc_time.timeFormat(QLocale::ShortFormat); Execution Count:2 | 2 |
249 | case DayNameLong: | - |
250 | return lc_time.dayName(in.toInt(), QLocale::LongFormat); executed: return lc_time.dayName(in.toInt(), QLocale::LongFormat); Execution Count:267 | 267 |
251 | case DayNameShort: | - |
252 | return lc_time.dayName(in.toInt(), QLocale::ShortFormat); executed: return lc_time.dayName(in.toInt(), QLocale::ShortFormat); Execution Count:547 | 547 |
253 | case MonthNameLong: | - |
254 | return lc_time.monthName(in.toInt(), QLocale::LongFormat); executed: return lc_time.monthName(in.toInt(), QLocale::LongFormat); Execution Count:4088 | 4088 |
255 | case MonthNameShort: | - |
256 | return lc_time.monthName(in.toInt(), QLocale::ShortFormat); executed: return lc_time.monthName(in.toInt(), QLocale::ShortFormat); Execution Count:8526 | 8526 |
257 | case DateToStringLong: | - |
258 | return lc_time.toString(in.toDate(), QLocale::LongFormat); executed: return lc_time.toString(in.toDate(), QLocale::LongFormat); Execution Count:1 | 1 |
259 | case DateToStringShort: | - |
260 | return lc_time.toString(in.toDate(), QLocale::ShortFormat); executed: return lc_time.toString(in.toDate(), QLocale::ShortFormat); Execution Count:1558 | 1558 |
261 | case TimeToStringLong: | - |
262 | return lc_time.toString(in.toTime(), QLocale::LongFormat); executed: return lc_time.toString(in.toTime(), QLocale::LongFormat); Execution Count:1 | 1 |
263 | case TimeToStringShort: | - |
264 | return lc_time.toString(in.toTime(), QLocale::ShortFormat); executed: return lc_time.toString(in.toTime(), QLocale::ShortFormat); Execution Count:1539 | 1539 |
265 | case DateTimeFormatLong: | - |
266 | return lc_time.dateTimeFormat(QLocale::LongFormat); executed: return lc_time.dateTimeFormat(QLocale::LongFormat); Execution Count:1 | 1 |
267 | case DateTimeFormatShort: | - |
268 | return lc_time.dateTimeFormat(QLocale::ShortFormat); executed: return lc_time.dateTimeFormat(QLocale::ShortFormat); Execution Count:4 | 4 |
269 | case DateTimeToStringLong: | - |
270 | return lc_time.toString(in.toDateTime(), QLocale::LongFormat); never executed: return lc_time.toString(in.toDateTime(), QLocale::LongFormat); | 0 |
271 | case DateTimeToStringShort: | - |
272 | return lc_time.toString(in.toDateTime(), QLocale::ShortFormat); never executed: return lc_time.toString(in.toDateTime(), QLocale::ShortFormat); | 0 |
273 | case PositiveSign: | - |
274 | return lc_numeric.positiveSign(); executed: return lc_numeric.positiveSign(); Execution Count:44 | 44 |
275 | case AMText: | - |
276 | return lc_time.amText(); executed: return lc_time.amText(); Execution Count:659 | 659 |
277 | case PMText: | - |
278 | return lc_time.pmText(); executed: return lc_time.pmText(); Execution Count:116 | 116 |
279 | case FirstDayOfWeek: | - |
280 | return lc_time.firstDayOfWeek(); executed: return lc_time.firstDayOfWeek(); Execution Count:20 | 20 |
281 | case CurrencySymbol: | - |
282 | return lc_monetary.currencySymbol(QLocale::CurrencySymbolFormat(in.toUInt())); never executed: return lc_monetary.currencySymbol(QLocale::CurrencySymbolFormat(in.toUInt())); | 0 |
283 | case CurrencyToString: { | - |
284 | switch (in.type()) { | - |
285 | case QVariant::Int: | - |
286 | return lc_monetary.toCurrencyString(in.toInt()); never executed: return lc_monetary.toCurrencyString(in.toInt()); | 0 |
287 | case QVariant::UInt: | - |
288 | return lc_monetary.toCurrencyString(in.toUInt()); never executed: return lc_monetary.toCurrencyString(in.toUInt()); | 0 |
289 | case QVariant::Double: | - |
290 | return lc_monetary.toCurrencyString(in.toDouble()); never executed: return lc_monetary.toCurrencyString(in.toDouble()); | 0 |
291 | case QVariant::LongLong: | - |
292 | return lc_monetary.toCurrencyString(in.toLongLong()); never executed: return lc_monetary.toCurrencyString(in.toLongLong()); | 0 |
293 | case QVariant::ULongLong: | - |
294 | return lc_monetary.toCurrencyString(in.toULongLong()); never executed: return lc_monetary.toCurrencyString(in.toULongLong()); | 0 |
295 | default: | - |
296 | break; executed: break; Execution Count:1 | 1 |
297 | } | - |
298 | return QString(); executed: return QString(); Execution Count:1 | 1 |
299 | } | - |
300 | case MeasurementSystem: { | - |
301 | const QString meas_locale = QString::fromLatin1(d->lc_measurement_var.constData(), d->lc_measurement_var.size()); never executed (the execution status of this line is deduced): const QString meas_locale = QString::fromLatin1(d->lc_measurement_var.constData(), d->lc_measurement_var.size()); | - |
302 | if (meas_locale.compare(QLatin1String("Metric"), Qt::CaseInsensitive) == 0) never evaluated: meas_locale.compare(QLatin1String("Metric"), Qt::CaseInsensitive) == 0 | 0 |
303 | return QLocale::MetricSystem; never executed: return QLocale::MetricSystem; | 0 |
304 | if (meas_locale.compare(QLatin1String("Other"), Qt::CaseInsensitive) == 0) never evaluated: meas_locale.compare(QLatin1String("Other"), Qt::CaseInsensitive) == 0 | 0 |
305 | return QLocale::MetricSystem; never executed: return QLocale::MetricSystem; | 0 |
306 | #if defined(Q_OS_BLACKBERRY) | - |
307 | return qnxd->ppsMeasurement; | - |
308 | #endif | - |
309 | return QVariant((int)QLocale(meas_locale).measurementSystem()); never executed: return QVariant((int)QLocale(meas_locale).measurementSystem()); | 0 |
310 | } | - |
311 | case UILanguages: { | - |
312 | if (!d->uiLanguages.isEmpty()) evaluated: !d->uiLanguages.isEmpty() yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
313 | return d->uiLanguages; executed: return d->uiLanguages; Execution Count:5 | 5 |
314 | QString languages = QString::fromLatin1(qgetenv("LANGUAGE")); executed (the execution status of this line is deduced): QString languages = QString::fromLatin1(qgetenv("LANGUAGE")); | - |
315 | QStringList lst; executed (the execution status of this line is deduced): QStringList lst; | - |
316 | if (languages.isEmpty()) partially evaluated: languages.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
317 | lst.append(QString::fromLatin1(d->lc_messages_var)); never executed: lst.append(QString::fromLatin1(d->lc_messages_var)); | 0 |
318 | else | - |
319 | lst = languages.split(QLatin1Char(':')); executed: lst = languages.split(QLatin1Char(':')); Execution Count:1 | 1 |
320 | | - |
321 | for (int i = 0; i < lst.size(); ++i) { evaluated: i < lst.size() yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
322 | const QString &name = lst.at(i); executed (the execution status of this line is deduced): const QString &name = lst.at(i); | - |
323 | QString lang, script, cntry; executed (the execution status of this line is deduced): QString lang, script, cntry; | - |
324 | if (qt_splitLocaleName(name, lang, script, cntry)) { partially evaluated: qt_splitLocaleName(name, lang, script, cntry) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
325 | if (!cntry.length()) evaluated: !cntry.length() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
326 | d->uiLanguages.append(lang); executed: d->uiLanguages.append(lang); Execution Count:1 | 1 |
327 | else | - |
328 | d->uiLanguages.append(lang % QLatin1Char('-') % cntry); executed: d->uiLanguages.append(lang % QLatin1Char('-') % cntry); Execution Count:1 | 1 |
329 | } | - |
330 | } executed: } Execution Count:2 | 2 |
331 | return d->uiLanguages.isEmpty() ? QVariant() : QVariant(d->uiLanguages); executed: return d->uiLanguages.isEmpty() ? QVariant() : QVariant(d->uiLanguages); Execution Count:1 | 1 |
332 | } | - |
333 | case StringToStandardQuotation: | - |
334 | return lc_messages.quoteString(in.value<QStringRef>()); never executed: return lc_messages.quoteString(in.value<QStringRef>()); | 0 |
335 | case StringToAlternateQuotation: | - |
336 | return lc_messages.quoteString(in.value<QStringRef>(), QLocale::AlternateQuotation); never executed: return lc_messages.quoteString(in.value<QStringRef>(), QLocale::AlternateQuotation); | 0 |
337 | case ListToSeparatedString: | - |
338 | return lc_messages.createSeparatedList(in.value<QStringList>()); never executed: return lc_messages.createSeparatedList(in.value<QStringList>()); | 0 |
339 | case LocaleChanged: | - |
340 | Q_ASSERT(false); executed (the execution status of this line is deduced): qt_noop(); | - |
341 | default: | - |
342 | break; executed: break; Execution Count:132 | 132 |
343 | } | - |
344 | return QVariant(); executed: return QVariant(); Execution Count:132 | 132 |
345 | } | - |
346 | #endif // QT_NO_SYSTEMLOCALE | - |
347 | | - |
348 | QT_END_NAMESPACE | - |
349 | | - |
| | |