Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlmetatype_p.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 QQMLMETATYPE_P_H | - |
41 | #define QQMLMETATYPE_P_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 | #include <private/qtqmlglobal_p.h> | - |
56 | - | |
57 | #include <QtCore/qglobal.h> | - |
58 | #include <QtCore/qvariant.h> | - |
59 | #include <QtCore/qbitarray.h> | - |
60 | #include <QtQml/qjsvalue.h> | - |
61 | - | |
62 | QT_BEGIN_NAMESPACE | - |
63 | - | |
64 | class QQmlType; | - |
65 | class QQmlEngine; | - |
66 | class QQmlEnginePrivate; | - |
67 | class QQmlCustomParser; | - |
68 | class QQmlTypePrivate; | - |
69 | class QQmlTypeModule; | - |
70 | class QHashedString; | - |
71 | class QHashedStringRef; | - |
72 | class QMutex; | - |
73 | class QQmlPropertyCache; | - |
74 | class QQmlCompiledData; | - |
75 | - | |
76 | namespace QV4 { struct String; } | - |
77 | - | |
78 | void Q_QML_PRIVATE_EXPORT qmlUnregisterType(int type); | - |
79 | - | |
80 | class Q_QML_PRIVATE_EXPORT QQmlMetaType | - |
81 | { | - |
82 | public: | - |
83 | static QQmlType registerCompositeSingletonType(const QQmlPrivate::RegisterCompositeSingletonType &type); | - |
84 | static QQmlType registerCompositeType(const QQmlPrivate::RegisterCompositeType &type); | - |
85 | - | |
86 | static void registerInternalCompositeType(QV4::CompiledData::CompilationUnit *compilationUnit); | - |
87 | static void unregisterInternalCompositeType(QV4::CompiledData::CompilationUnit *compilationUnit); | - |
88 | - | |
89 | static QList<QString> qmlTypeNames(); | - |
90 | static QList<QQmlType> qmlTypes(); | - |
91 | static QList<QQmlType> qmlSingletonTypes(); | - |
92 | static QList<QQmlType> qmlAllTypes(); | - |
93 | - | |
94 | enum class TypeIdCategory { | - |
95 | MetaType, | - |
96 | QmlType | - |
97 | }; | - |
98 | - | |
99 | static QQmlType qmlType(const QString &qualifiedName, int, int); | - |
100 | static QQmlType qmlType(const QHashedStringRef &name, const QHashedStringRef &module, int, int); | - |
101 | static QQmlType qmlType(const QMetaObject *); | - |
102 | static QQmlType qmlType(const QMetaObject *metaObject, const QHashedStringRef &module, int version_major, int version_minor); | - |
103 | static QQmlType qmlType(int typeId, TypeIdCategory category = TypeIdCategory::MetaType); | - |
104 | static QQmlType qmlType(const QUrl &unNormalizedUrl, bool includeNonFileImports = false); | - |
105 | - | |
106 | static QQmlPropertyCache *propertyCache(const QMetaObject *metaObject); | - |
107 | static QQmlPropertyCache *propertyCache(const QQmlType &type, int minorVersion); | - |
108 | - | |
109 | static void freeUnusedTypesAndCaches(); | - |
110 | - | |
111 | static QMetaProperty defaultProperty(const QMetaObject *); | - |
112 | static QMetaProperty defaultProperty(QObject *); | - |
113 | static QMetaMethod defaultMethod(const QMetaObject *); | - |
114 | static QMetaMethod defaultMethod(QObject *); | - |
115 | - | |
116 | static bool isQObject(int); | - |
117 | static QObject *toQObject(const QVariant &, bool *ok = nullptr); | - |
118 | - | |
119 | static int listType(int); | - |
120 | static int attachedPropertiesFuncId(QQmlEnginePrivate *engine, const QMetaObject *); | - |
121 | static QQmlAttachedPropertiesFunc attachedPropertiesFuncById(QQmlEnginePrivate *, int); | - |
122 | - | |
123 | enum TypeCategory { Unknown, Object, List }; | - |
124 | static TypeCategory typeCategory(int); | - |
125 | - | |
126 | static bool isInterface(int); | - |
127 | static const char *interfaceIId(int); | - |
128 | static bool isList(int); | - |
129 | - | |
130 | typedef QVariant (*StringConverter)(const QString &); | - |
131 | static void registerCustomStringConverter(int, StringConverter); | - |
132 | static StringConverter customStringConverter(int); | - |
133 | - | |
134 | static bool isAnyModule(const QString &uri); | - |
135 | static bool isLockedModule(const QString &uri, int majorVersion); | - |
136 | static bool isModule(const QString &module, int versionMajor, int versionMinor); | - |
137 | static QQmlTypeModule *typeModule(const QString &uri, int majorVersion); | - |
138 | - | |
139 | static QList<QQmlPrivate::AutoParentFunction> parentFunctions(); | - |
140 | - | |
141 | enum class CachedUnitLookupError { | - |
142 | NoError, | - |
143 | NoUnitFound, | - |
144 | VersionMismatch | - |
145 | }; | - |
146 | - | |
147 | static const QV4::CompiledData::Unit *findCachedCompilationUnit(const QUrl &uri, CachedUnitLookupError *status); | - |
148 | - | |
149 | // used by tst_qqmlcachegen.cpp | - |
150 | static void prependCachedUnitLookupFunction(QQmlPrivate::QmlUnitCacheLookupFunction handler); | - |
151 | static void removeCachedUnitLookupFunction(QQmlPrivate::QmlUnitCacheLookupFunction handler); | - |
152 | - | |
153 | static bool namespaceContainsRegistrations(const QString &, int majorVersion); | - |
154 | - | |
155 | static void protectNamespace(const QString &); | - |
156 | - | |
157 | static void setTypeRegistrationNamespace(const QString &); | - |
158 | - | |
159 | static QMutex *typeRegistrationLock(); | - |
160 | - | |
161 | static QString prettyTypeName(const QObject *object); | - |
162 | }; | - |
163 | - | |
164 | struct QQmlMetaTypeData; | - |
165 | class QHashedCStringRef; | - |
166 | class QQmlPropertyCache; | - |
167 | class Q_QML_PRIVATE_EXPORT QQmlType | - |
168 | { | - |
169 | public: | - |
170 | QQmlType(); | - |
171 | QQmlType(const QQmlType &other); | - |
172 | QQmlType &operator =(const QQmlType &other); | - |
173 | explicit QQmlType(QQmlTypePrivate *priv); | - |
174 | ~QQmlType(); | - |
175 | - | |
176 | bool operator ==(const QQmlType &other) const { | - |
177 | return d == other.d; executed 1017 times by 32 tests: return d == other.d; Executed by:
| 1017 |
178 | } | - |
179 | - | |
180 | bool isValid() const { return d != nullptr; } executed 4198639 times by 142 tests: return d != nullptr; Executed by:
| 4198639 |
181 | const QQmlTypePrivate *key() const { return d; } never executed: return d; | 0 |
182 | - | |
183 | QByteArray typeName() const; | - |
184 | QString qmlTypeName() const; | - |
185 | QString elementName() const; | - |
186 | - | |
187 | QHashedString module() const; | - |
188 | int majorVersion() const; | - |
189 | int minorVersion() const; | - |
190 | - | |
191 | bool availableInVersion(int vmajor, int vminor) const; | - |
192 | bool availableInVersion(const QHashedStringRef &module, int vmajor, int vminor) const; | - |
193 | - | |
194 | QObject *create() const; | - |
195 | void create(QObject **, void **, size_t) const; | - |
196 | - | |
197 | typedef void (*CreateFunc)(void *); | - |
198 | CreateFunc createFunction() const; | - |
199 | int createSize() const; | - |
200 | - | |
201 | QQmlCustomParser *customParser() const; | - |
202 | - | |
203 | bool isCreatable() const; | - |
204 | bool isExtendedType() const; | - |
205 | QString noCreationReason() const; | - |
206 | - | |
207 | bool isSingleton() const; | - |
208 | bool isInterface() const; | - |
209 | bool isComposite() const; | - |
210 | bool isCompositeSingleton() const; | - |
211 | - | |
212 | int typeId() const; | - |
213 | int qListTypeId() const; | - |
214 | - | |
215 | const QMetaObject *metaObject() const; | - |
216 | const QMetaObject *baseMetaObject() const; | - |
217 | int metaObjectRevision() const; | - |
218 | bool containsRevisionedAttributes() const; | - |
219 | - | |
220 | QQmlAttachedPropertiesFunc attachedPropertiesFunction(QQmlEnginePrivate *engine) const; | - |
221 | const QMetaObject *attachedPropertiesType(QQmlEnginePrivate *engine) const; | - |
222 | int attachedPropertiesId(QQmlEnginePrivate *engine) const; | - |
223 | - | |
224 | int parserStatusCast() const; | - |
225 | const char *interfaceIId() const; | - |
226 | int propertyValueSourceCast() const; | - |
227 | int propertyValueInterceptorCast() const; | - |
228 | - | |
229 | int index() const; | - |
230 | - | |
231 | class Q_QML_PRIVATE_EXPORT SingletonInstanceInfo | - |
232 | { | - |
233 | public: | - |
234 | SingletonInstanceInfo() | - |
235 | : scriptCallback(nullptr), qobjectCallback(nullptr), instanceMetaObject(nullptr) {} never executed: end of block | 0 |
236 | - | |
237 | QJSValue (*scriptCallback)(QQmlEngine *, QJSEngine *); | - |
238 | QObject *(*qobjectCallback)(QQmlEngine *, QJSEngine *); | - |
239 | const QMetaObject *instanceMetaObject; | - |
240 | QString typeName; | - |
241 | QUrl url; // used by composite singletons | - |
242 | - | |
243 | void setQObjectApi(QQmlEngine *, QObject *); | - |
244 | QObject *qobjectApi(QQmlEngine *) const; | - |
245 | void setScriptApi(QQmlEngine *, const QJSValue &); | - |
246 | QJSValue scriptApi(QQmlEngine *) const; | - |
247 | - | |
248 | void init(QQmlEngine *); | - |
249 | void destroy(QQmlEngine *); | - |
250 | - | |
251 | QHash<QQmlEngine *, QJSValue> scriptApis; | - |
252 | QHash<QQmlEngine *, QObject *> qobjectApis; | - |
253 | }; | - |
254 | SingletonInstanceInfo *singletonInstanceInfo() const; | - |
255 | - | |
256 | QUrl sourceUrl() const; | - |
257 | - | |
258 | int enumValue(QQmlEnginePrivate *engine, const QHashedStringRef &, bool *ok) const; | - |
259 | int enumValue(QQmlEnginePrivate *engine, const QHashedCStringRef &, bool *ok) const; | - |
260 | int enumValue(QQmlEnginePrivate *engine, const QV4::String *, bool *ok) const; | - |
261 | - | |
262 | int scopedEnumIndex(QQmlEnginePrivate *engine, const QV4::String *, bool *ok) const; | - |
263 | int scopedEnumIndex(QQmlEnginePrivate *engine, const QString &, bool *ok) const; | - |
264 | int scopedEnumValue(QQmlEnginePrivate *engine, int index, const QV4::String *, bool *ok) const; | - |
265 | int scopedEnumValue(QQmlEnginePrivate *engine, int index, const QString &, bool *ok) const; | - |
266 | int scopedEnumValue(QQmlEnginePrivate *engine, const QByteArray &, const QByteArray &, bool *ok) const; | - |
267 | int scopedEnumValue(QQmlEnginePrivate *engine, const QStringRef &, const QStringRef &, bool *ok) const; | - |
268 | - | |
269 | QQmlTypePrivate *priv() const { return d; } executed 149516 times by 44 tests: return d; Executed by:
| 149516 |
270 | static void refHandle(QQmlTypePrivate *priv); | - |
271 | static void derefHandle(QQmlTypePrivate *priv); | - |
272 | static int refCount(QQmlTypePrivate *priv); | - |
273 | - | |
274 | enum RegistrationType { | - |
275 | CppType = 0, | - |
276 | SingletonType = 1, | - |
277 | InterfaceType = 2, | - |
278 | CompositeType = 3, | - |
279 | CompositeSingletonType = 4, | - |
280 | AnyRegistrationType = 255 | - |
281 | }; | - |
282 | - | |
283 | private: | - |
284 | QQmlType superType() const; | - |
285 | QQmlType resolveCompositeBaseType(QQmlEnginePrivate *engine) const; | - |
286 | int resolveCompositeEnumValue(QQmlEnginePrivate *engine, const QString &name, bool *ok) const; | - |
287 | QQmlPropertyCache *compositePropertyCache(QQmlEnginePrivate *engine) const; | - |
288 | friend class QQmlTypePrivate; | - |
289 | - | |
290 | friend QString registrationTypeString(RegistrationType); | - |
291 | friend bool checkRegistration(RegistrationType, QQmlMetaTypeData *, const char *, const QString &, int); | - |
292 | friend QQmlType registerType(const QQmlPrivate::RegisterType &); | - |
293 | friend QQmlType registerSingletonType(const QQmlPrivate::RegisterSingletonType &); | - |
294 | friend QQmlType registerInterface(const QQmlPrivate::RegisterInterface &); | - |
295 | friend int registerQmlUnitCacheHook(const QQmlPrivate::RegisterQmlUnitCacheHook &); | - |
296 | friend uint qHash(const QQmlType &t, uint seed); | - |
297 | friend Q_QML_EXPORT void qmlClearTypeRegistrations(); | - |
298 | friend class QQmlMetaType; | - |
299 | - | |
300 | QQmlType(QQmlMetaTypeData *data, const QQmlPrivate::RegisterInterface &); | - |
301 | QQmlType(QQmlMetaTypeData *data, const QString &, const QQmlPrivate::RegisterSingletonType &); | - |
302 | QQmlType(QQmlMetaTypeData *data, const QString &, const QQmlPrivate::RegisterType &); | - |
303 | QQmlType(QQmlMetaTypeData *data, const QString &, const QQmlPrivate::RegisterCompositeType &); | - |
304 | QQmlType(QQmlMetaTypeData *data, const QString &, const QQmlPrivate::RegisterCompositeSingletonType &); | - |
305 | - | |
306 | QQmlTypePrivate *d; | - |
307 | }; | - |
308 | - | |
309 | Q_DECLARE_TYPEINFO(QQmlMetaType, Q_MOVABLE_TYPE); | - |
310 | - | |
311 | - | |
312 | inline uint qHash(const QQmlType &t, uint seed = 0) { return qHash(reinterpret_cast<quintptr>(t.d), seed); } never executed: return qHash(reinterpret_cast<quintptr>(t.d), seed); | 0 |
313 | - | |
314 | - | |
315 | class QQmlTypeModulePrivate; | - |
316 | class QQmlTypeModule | - |
317 | { | - |
318 | public: | - |
319 | QString module() const; | - |
320 | int majorVersion() const; | - |
321 | - | |
322 | int minimumMinorVersion() const; | - |
323 | int maximumMinorVersion() const; | - |
324 | - | |
325 | QQmlType type(const QHashedStringRef &, int) const; | - |
326 | QQmlType type(const QV4::String *, int) const; | - |
327 | - | |
328 | void walkCompositeSingletons(const std::function<void(const QQmlType &)> &callback) const; | - |
329 | - | |
330 | QQmlTypeModulePrivate *priv() { return d; } never executed: return d; | 0 |
331 | private: | - |
332 | //Used by register functions and creates the QQmlTypeModule for them | - |
333 | friend QQmlTypeModule *getTypeModule(const QHashedString &uri, int majorVersion, QQmlMetaTypeData *data); | - |
334 | friend void addTypeToData(QQmlTypePrivate *type, QQmlMetaTypeData *data); | - |
335 | friend struct QQmlMetaTypeData; | - |
336 | friend Q_QML_EXPORT void qmlClearTypeRegistrations(); | - |
337 | friend class QQmlTypeModulePrivate; | - |
338 | - | |
339 | QQmlTypeModule(); | - |
340 | ~QQmlTypeModule(); | - |
341 | QQmlTypeModulePrivate *d; | - |
342 | }; | - |
343 | - | |
344 | class QQmlTypeModuleVersion | - |
345 | { | - |
346 | public: | - |
347 | QQmlTypeModuleVersion(); | - |
348 | QQmlTypeModuleVersion(QQmlTypeModule *, int); | - |
349 | QQmlTypeModuleVersion(const QQmlTypeModuleVersion &); | - |
350 | QQmlTypeModuleVersion &operator=(const QQmlTypeModuleVersion &); | - |
351 | - | |
352 | QQmlTypeModule *module() const; | - |
353 | int minorVersion() const; | - |
354 | - | |
355 | QQmlType type(const QHashedStringRef &) const; | - |
356 | QQmlType type(const QV4::String *) const; | - |
357 | - | |
358 | private: | - |
359 | QQmlTypeModule *m_module; | - |
360 | int m_minor; | - |
361 | }; | - |
362 | - | |
363 | class Q_AUTOTEST_EXPORT QQmlMetaTypeRegistrationFailureRecorder | - |
364 | { | - |
365 | QStringList _failures; | - |
366 | - | |
367 | public: | - |
368 | QQmlMetaTypeRegistrationFailureRecorder(); | - |
369 | ~QQmlMetaTypeRegistrationFailureRecorder(); | - |
370 | - | |
371 | QStringList failures() const | - |
372 | { return _failures; } executed 592 times by 136 tests: return _failures; Executed by:
| 592 |
373 | }; | - |
374 | - | |
375 | QT_END_NAMESPACE | - |
376 | - | |
377 | #endif // QQMLMETATYPE_P_H | - |
378 | - | |
Source code | Switch to Preprocessed file |