OpenCoverage

qqmllocale_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmllocale_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml 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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQMLLOCALE_H-
41#define QQMLLOCALE_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include <qqml.h>-
55-
56#include <QtCore/qlocale.h>-
57#include <QtCore/qobject.h>-
58#include <private/qqmlglobal_p.h>-
59#include <private/qv4object_p.h>-
60-
61QT_REQUIRE_CONFIG(qml_locale);-
62-
63QT_BEGIN_NAMESPACE-
64-
65-
66class QQmlDateExtension-
67{-
68public:-
69 static void registerExtension(QV4::ExecutionEngine *engine);-
70-
71private:-
72 static QV4::ReturnedValue method_toLocaleString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
73 static QV4::ReturnedValue method_toLocaleTimeString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
74 static QV4::ReturnedValue method_toLocaleDateString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
75 static QV4::ReturnedValue method_fromLocaleString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
76 static QV4::ReturnedValue method_fromLocaleTimeString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
77 static QV4::ReturnedValue method_fromLocaleDateString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
78 static QV4::ReturnedValue method_timeZoneUpdated(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
79};-
80-
81-
82class QQmlNumberExtension-
83{-
84public:-
85 static void registerExtension(QV4::ExecutionEngine *engine);-
86-
87private:-
88 static QV4::ReturnedValue method_toLocaleString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
89 static QV4::ReturnedValue method_fromLocaleString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
90 static QV4::ReturnedValue method_toLocaleCurrencyString(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
91};-
92-
93-
94class Q_QML_PRIVATE_EXPORT QQmlLocale-
95{-
96 Q_GADGET-
97-
98public:-
99 ~QQmlLocale();-
100-
101 enum MeasurementSystem {-
102 MetricSystem = QLocale::MetricSystem,-
103 ImperialSystem = QLocale::ImperialSystem,-
104 ImperialUSSystem = QLocale::ImperialUSSystem,-
105 ImperialUKSystem = QLocale::ImperialUKSystem-
106 };-
107 Q_ENUM(MeasurementSystem)-
108 enum FormatType {-
109 LongFormat = QLocale::LongFormat,-
110 ShortFormat = QLocale::ShortFormat,-
111 NarrowFormat = QLocale::NarrowFormat-
112 };-
113 Q_ENUM(FormatType)-
114 enum CurrencySymbolFormat {-
115 CurrencyIsoCode = QLocale::CurrencyIsoCode,-
116 CurrencySymbol = QLocale::CurrencySymbol,-
117 CurrencyDisplayName = QLocale::CurrencyDisplayName-
118 };-
119 Q_ENUM(CurrencySymbolFormat)-
120 // Qt defines Sunday as 7, but JS Date assigns Sunday 0-
121 enum DayOfWeek {-
122 Sunday = 0,-
123 Monday = Qt::Monday,-
124 Tuesday = Qt::Tuesday,-
125 Wednesday = Qt::Wednesday,-
126 Thursday = Qt::Thursday,-
127 Friday = Qt::Friday,-
128 Saturday = Qt::Saturday-
129 };-
130 Q_ENUM(DayOfWeek)-
131-
132 static QV4::ReturnedValue locale(QV4::ExecutionEngine *engine, const QString &localeName);-
133 static QV4::ReturnedValue wrap(QV4::ExecutionEngine *engine, const QLocale &locale);-
134-
135 static void registerStringLocaleCompare(QV4::ExecutionEngine *engine);-
136-
137private:-
138 QQmlLocale();-
139-
140 static QV4::ReturnedValue method_localeCompare(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
141};-
142-
143namespace QV4 {-
144-
145namespace Heap {-
146-
147struct QQmlLocaleData : Object {-
148 inline void init() { locale = new QLocale; }
executed 2086 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
2086
149 void destroy() {-
150 delete locale;-
151 Object::destroy();-
152 }
executed 2086 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
2086
153 QLocale *locale;-
154};-
155-
156}-
157-
158struct QQmlLocaleData : public QV4::Object-
159{-
160 V4_OBJECT2(QQmlLocaleData, Object)
executed 30916 times by 36 tests: end of block
Executed by:
  • tst_examples
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsettings
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • ...
never executed: end of block
executed 37278 times by 36 tests: return &static_vtbl;
Executed by:
  • tst_examples
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlmetaobject
  • tst_qqmlproperty
  • tst_qqmlqt
  • tst_qqmlsettings
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • ...
executed 15952 times by 3 tests: return static_cast<QV4::Heap::QQmlLocaleData *>(m());
Executed by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
executed 13866 times by 3 tests: return dptr;
Executed by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
0-37278
161 V4_NEEDS_DESTROY
executed 2086 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
2086
162-
163 static QLocale *getThisLocale(QV4::Scope &scope, const QV4::Value *thisObject) {-
164 const QV4::Object *o = thisObject->as<Object>();-
165 const QQmlLocaleData *data = o ? o->as<QQmlLocaleData>() : nullptr;
oDescription
TRUEevaluated 9094 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
FALSEnever evaluated
0-9094
166 if (!data) {
!dataDescription
TRUEnever evaluated
FALSEevaluated 9094 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
0-9094
167 scope.engine->throwTypeError();-
168 return nullptr;
never executed: return nullptr;
0
169 }-
170 return data->d()->locale;
executed 9094 times by 3 tests: return data->d()->locale;
Executed by:
  • tst_examples
  • tst_qqmllocale
  • tst_qqmlvaluetypes
9094
171 }-
172-
173 static QV4::ReturnedValue method_currencySymbol(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
174 static QV4::ReturnedValue method_dateTimeFormat(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
175 static QV4::ReturnedValue method_timeFormat(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
176 static QV4::ReturnedValue method_dateFormat(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
177 static QV4::ReturnedValue method_monthName(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
178 static QV4::ReturnedValue method_standaloneMonthName(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
179 static QV4::ReturnedValue method_dayName(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
180 static QV4::ReturnedValue method_standaloneDayName(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
181-
182 static QV4::ReturnedValue method_get_firstDayOfWeek(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
183 static QV4::ReturnedValue method_get_measurementSystem(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
184 static QV4::ReturnedValue method_get_textDirection(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
185 static QV4::ReturnedValue method_get_weekDays(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
186 static QV4::ReturnedValue method_get_uiLanguages(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
187-
188 static QV4::ReturnedValue method_get_name(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
189 static QV4::ReturnedValue method_get_nativeLanguageName(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
190 static QV4::ReturnedValue method_get_nativeCountryName(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
191 static QV4::ReturnedValue method_get_decimalPoint(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
192 static QV4::ReturnedValue method_get_groupSeparator(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
193 static QV4::ReturnedValue method_get_percent(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
194 static QV4::ReturnedValue method_get_zeroDigit(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
195 static QV4::ReturnedValue method_get_negativeSign(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
196 static QV4::ReturnedValue method_get_positiveSign(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
197 static QV4::ReturnedValue method_get_exponential(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
198 static QV4::ReturnedValue method_get_amText(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
199 static QV4::ReturnedValue method_get_pmText(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc);-
200};-
201-
202}-
203-
204QT_END_NAMESPACE-
205-
206#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0