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