Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlprivate.h |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
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 QQMLPRIVATE_H | - |
41 | #define QQMLPRIVATE_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 <QtQml/qtqmlglobal.h> | - |
55 | - | |
56 | #include <QtCore/qglobal.h> | - |
57 | #include <QtCore/qvariant.h> | - |
58 | #include <QtCore/qurl.h> | - |
59 | - | |
60 | QT_BEGIN_NAMESPACE | - |
61 | - | |
62 | namespace QQmlPrivate { | - |
63 | struct CachedQmlUnit; | - |
64 | } | - |
65 | - | |
66 | namespace QV4 { | - |
67 | struct ExecutionEngine; | - |
68 | namespace CompiledData { | - |
69 | struct Unit; | - |
70 | struct CompilationUnit; | - |
71 | } | - |
72 | } | - |
73 | namespace QmlIR { | - |
74 | struct Document; | - |
75 | typedef void (*IRLoaderFunction)(Document *, const QQmlPrivate::CachedQmlUnit *); | - |
76 | } | - |
77 | - | |
78 | typedef QObject *(*QQmlAttachedPropertiesFunc)(QObject *); | - |
79 | - | |
80 | template <typename TYPE> | - |
81 | class QQmlTypeInfo | - |
82 | { | - |
83 | public: | - |
84 | enum { | - |
85 | hasAttachedProperties = 0 | - |
86 | }; | - |
87 | }; | - |
88 | - | |
89 | - | |
90 | class QJSValue; | - |
91 | class QJSEngine; | - |
92 | class QQmlEngine; | - |
93 | class QQmlCustomParser; | - |
94 | namespace QQmlPrivate | - |
95 | { | - |
96 | void Q_QML_EXPORT qdeclarativeelement_destructor(QObject *); | - |
97 | template<typename T> | - |
98 | class QQmlElement : public T | - |
99 | { | - |
100 | public: | - |
101 | ~QQmlElement() override { | - |
102 | QQmlPrivate::qdeclarativeelement_destructor(this); | - |
103 | } executed 472648 times by 129 tests: end of block Executed by:
| 472648 |
104 | }; | - |
105 | - | |
106 | template<typename T> | - |
107 | void createInto(void *memory) { new (memory) QQmlElement<T>; } executed 516464 times by 135 tests: end of block Executed by:
| 516464 |
108 | - | |
109 | template<typename T> | - |
110 | QObject *createParent(QObject *p) { return new T(p); } executed 16 times by 1 test: return new T(p); Executed by:
| 16 |
111 | - | |
112 | template<class From, class To, int N> | - |
113 | struct StaticCastSelectorClass | - |
114 | { | - |
115 | static inline int cast() { return -1; } executed 179798 times by 138 tests: return -1; Executed by:
| 179798 |
116 | }; | - |
117 | - | |
118 | template<class From, class To> | - |
119 | struct StaticCastSelectorClass<From, To, sizeof(int)> | - |
120 | { | - |
121 | static inline int cast() { return int(reinterpret_cast<quintptr>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; } executed 52708 times by 137 tests: return int(reinterpret_cast<quintptr>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; Executed by:
| 52708 |
122 | }; | - |
123 | - | |
124 | template<class From, class To> | - |
125 | struct StaticCastSelector | - |
126 | { | - |
127 | typedef int yes_type; | - |
128 | typedef char no_type; | - |
129 | - | |
130 | static yes_type checkType(To *); | - |
131 | static no_type checkType(...); | - |
132 | - | |
133 | static inline int cast() | - |
134 | { | - |
135 | return StaticCastSelectorClass<From, To, sizeof(checkType(reinterpret_cast<From *>(0)))>::cast(); executed 232506 times by 138 tests: return StaticCastSelectorClass<From, To, sizeof(checkType(reinterpret_cast<From *>(0)))>::cast(); Executed by:
| 232506 |
136 | } | - |
137 | }; | - |
138 | - | |
139 | template <typename T> | - |
140 | struct has_attachedPropertiesMember | - |
141 | { | - |
142 | static bool const value = QQmlTypeInfo<T>::hasAttachedProperties; | - |
143 | }; | - |
144 | - | |
145 | template <typename T, bool hasMember> | - |
146 | class has_attachedPropertiesMethod | - |
147 | { | - |
148 | public: | - |
149 | typedef int yes_type; | - |
150 | typedef char no_type; | - |
151 | - | |
152 | template<typename ReturnType> | - |
153 | static yes_type checkType(ReturnType *(*)(QObject *)); | - |
154 | static no_type checkType(...); | - |
155 | - | |
156 | static bool const value = sizeof(checkType(&T::qmlAttachedProperties)) == sizeof(yes_type); | - |
157 | }; | - |
158 | - | |
159 | template <typename T> | - |
160 | class has_attachedPropertiesMethod<T, false> | - |
161 | { | - |
162 | public: | - |
163 | static bool const value = false; | - |
164 | }; | - |
165 | - | |
166 | template<typename T, int N> | - |
167 | class AttachedPropertySelector | - |
168 | { | - |
169 | public: | - |
170 | static inline QQmlAttachedPropertiesFunc func() { return nullptr; } executed 69184 times by 138 tests: return nullptr; Executed by:
| 69184 |
171 | static inline const QMetaObject *metaObject() { return nullptr; } | - |
172 | }; | - |
173 | template<typename T> | - |
174 | class AttachedPropertySelector<T, 1> | - |
175 | { | - |
176 | static inline QObject *attachedProperties(QObject *obj) { | - |
177 | return T::qmlAttachedProperties(obj); executed 89777 times by 31 tests: return T::qmlAttachedProperties(obj); Executed by:
| 89777 |
178 | } | - |
179 | template<typename ReturnType> | - |
180 | static inline const QMetaObject *attachedPropertiesMetaObject(ReturnType *(*)(QObject *)) { | - |
181 | return &ReturnType::staticMetaObject; executed 8328 times by 135 tests: return &ReturnType::staticMetaObject; Executed by:
| 8328 |
182 | } | - |
183 | public: | - |
184 | static inline QQmlAttachedPropertiesFunc func() { | - |
185 | return &attachedProperties; executed 8328 times by 135 tests: return &attachedProperties; Executed by:
| 8328 |
186 | } | - |
187 | static inline const QMetaObject *metaObject() { | - |
188 | return attachedPropertiesMetaObject(&T::qmlAttachedProperties); | - |
189 | } | - |
190 | }; | - |
191 | - | |
192 | template<typename T> | - |
193 | inline QQmlAttachedPropertiesFunc attachedPropertiesFunc() | - |
194 | { | - |
195 | return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::func(); executed 77512 times by 138 tests: return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::func(); Executed by:
| 77512 |
196 | } | - |
197 | - | |
198 | template<typename T> | - |
199 | inline const QMetaObject *attachedPropertiesMetaObject() | - |
200 | { | - |
201 | return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::metaObject(); executed 77512 times by 138 tests: return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::metaObject(); Executed by:
| 77512 |
202 | } | - |
203 | - | |
204 | enum AutoParentResult { Parented, IncompatibleObject, IncompatibleParent }; | - |
205 | typedef AutoParentResult (*AutoParentFunction)(QObject *object, QObject *parent); | - |
206 | - | |
207 | struct RegisterType { | - |
208 | int version; | - |
209 | - | |
210 | int typeId; | - |
211 | int listId; | - |
212 | int objectSize; | - |
213 | void (*create)(void *); | - |
214 | QString noCreationReason; | - |
215 | - | |
216 | const char *uri; | - |
217 | int versionMajor; | - |
218 | int versionMinor; | - |
219 | const char *elementName; | - |
220 | const QMetaObject *metaObject; | - |
221 | - | |
222 | QQmlAttachedPropertiesFunc attachedPropertiesFunction; | - |
223 | const QMetaObject *attachedPropertiesMetaObject; | - |
224 | - | |
225 | int parserStatusCast; | - |
226 | int valueSourceCast; | - |
227 | int valueInterceptorCast; | - |
228 | - | |
229 | QObject *(*extensionObjectCreate)(QObject *); | - |
230 | const QMetaObject *extensionMetaObject; | - |
231 | - | |
232 | QQmlCustomParser *customParser; | - |
233 | int revision; | - |
234 | // If this is extended ensure "version" is bumped!!! | - |
235 | }; | - |
236 | - | |
237 | struct RegisterInterface { | - |
238 | int version; | - |
239 | - | |
240 | int typeId; | - |
241 | int listId; | - |
242 | - | |
243 | const char *iid; | - |
244 | }; | - |
245 | - | |
246 | struct RegisterAutoParent { | - |
247 | int version; | - |
248 | - | |
249 | AutoParentFunction function; | - |
250 | }; | - |
251 | - | |
252 | struct RegisterSingletonType { | - |
253 | int version; | - |
254 | - | |
255 | const char *uri; | - |
256 | int versionMajor; | - |
257 | int versionMinor; | - |
258 | const char *typeName; | - |
259 | - | |
260 | QJSValue (*scriptApi)(QQmlEngine *, QJSEngine *); | - |
261 | QObject *(*qobjectApi)(QQmlEngine *, QJSEngine *); | - |
262 | const QMetaObject *instanceMetaObject; // new in version 1 | - |
263 | int typeId; // new in version 2 | - |
264 | int revision; // new in version 2 | - |
265 | // If this is extended ensure "version" is bumped!!! | - |
266 | }; | - |
267 | - | |
268 | struct RegisterCompositeType { | - |
269 | QUrl url; | - |
270 | const char *uri; | - |
271 | int versionMajor; | - |
272 | int versionMinor; | - |
273 | const char *typeName; | - |
274 | }; | - |
275 | - | |
276 | struct RegisterCompositeSingletonType { | - |
277 | QUrl url; | - |
278 | const char *uri; | - |
279 | int versionMajor; | - |
280 | int versionMinor; | - |
281 | const char *typeName; | - |
282 | }; | - |
283 | - | |
284 | struct CachedQmlUnit { | - |
285 | const QV4::CompiledData::Unit *qmlData; | - |
286 | void *unused1; | - |
287 | void *unused2; | - |
288 | }; | - |
289 | - | |
290 | typedef const CachedQmlUnit *(*QmlUnitCacheLookupFunction)(const QUrl &url); | - |
291 | struct RegisterQmlUnitCacheHook { | - |
292 | int version; | - |
293 | QmlUnitCacheLookupFunction lookupCachedQmlUnit; | - |
294 | }; | - |
295 | - | |
296 | enum RegistrationType { | - |
297 | TypeRegistration = 0, | - |
298 | InterfaceRegistration = 1, | - |
299 | AutoParentRegistration = 2, | - |
300 | SingletonRegistration = 3, | - |
301 | CompositeRegistration = 4, | - |
302 | CompositeSingletonRegistration = 5, | - |
303 | QmlUnitCacheHookRegistration = 6 | - |
304 | }; | - |
305 | - | |
306 | int Q_QML_EXPORT qmlregister(RegistrationType, void *); | - |
307 | } | - |
308 | - | |
309 | QT_END_NAMESPACE | - |
310 | - | |
311 | #endif // QQMLPRIVATE_H | - |
Source code | Switch to Preprocessed file |