| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlvmemetaobject_p.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||
| 4 | ** Copyright (C) 2016 BasysKom GmbH. | - | ||||||||||||||||||
| 5 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||
| 6 | ** | - | ||||||||||||||||||
| 7 | ** This file is part of the QtQml module of the Qt Toolkit. | - | ||||||||||||||||||
| 8 | ** | - | ||||||||||||||||||
| 9 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
| 10 | ** Commercial License Usage | - | ||||||||||||||||||
| 11 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
| 12 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
| 13 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
| 14 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
| 15 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 16 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||
| 17 | ** | - | ||||||||||||||||||
| 18 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
| 19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
| 20 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||
| 21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
| 22 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
| 23 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
| 24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||
| 26 | ** GNU General Public License Usage | - | ||||||||||||||||||
| 27 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
| 28 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
| 29 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
| 30 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
| 31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
| 32 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
| 33 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
| 34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
| 35 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
| 36 | ** | - | ||||||||||||||||||
| 37 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 38 | ** | - | ||||||||||||||||||
| 39 | ****************************************************************************/ | - | ||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | #ifndef QQMLVMEMETAOBJECT_P_H | - | ||||||||||||||||||
| 42 | #define QQMLVMEMETAOBJECT_P_H | - | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | // | - | ||||||||||||||||||
| 45 | // W A R N I N G | - | ||||||||||||||||||
| 46 | // ------------- | - | ||||||||||||||||||
| 47 | // | - | ||||||||||||||||||
| 48 | // This file is not part of the Qt API. It exists purely as an | - | ||||||||||||||||||
| 49 | // implementation detail. This header file may change from version to | - | ||||||||||||||||||
| 50 | // version without notice, or even be removed. | - | ||||||||||||||||||
| 51 | // | - | ||||||||||||||||||
| 52 | // We mean it. | - | ||||||||||||||||||
| 53 | // | - | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | #include "qqml.h" | - | ||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | #include <QtCore/QMetaObject> | - | ||||||||||||||||||
| 58 | #include <QtCore/QBitArray> | - | ||||||||||||||||||
| 59 | #include <QtCore/QPair> | - | ||||||||||||||||||
| 60 | #include <QtCore/QDate> | - | ||||||||||||||||||
| 61 | #include <QtCore/qlist.h> | - | ||||||||||||||||||
| 62 | #include <QtCore/qdebug.h> | - | ||||||||||||||||||
| 63 | - | |||||||||||||||||||
| 64 | #include <private/qobject_p.h> | - | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | #include "qqmlguard_p.h" | - | ||||||||||||||||||
| 67 | #include "qqmlcontext_p.h" | - | ||||||||||||||||||
| 68 | #include "qqmlpropertycache_p.h" | - | ||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | #include <private/qv8engine_p.h> | - | ||||||||||||||||||
| 71 | #include <private/qflagpointer_p.h> | - | ||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | #include <private/qv4object_p.h> | - | ||||||||||||||||||
| 74 | #include <private/qv4value_p.h> | - | ||||||||||||||||||
| 75 | #include <private/qqmlpropertyvalueinterceptor_p.h> | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | class QQmlVMEMetaObject; | - | ||||||||||||||||||
| 80 | class QQmlVMEVariantQObjectPtr : public QQmlGuard<QObject> | - | ||||||||||||||||||
| 81 | { | - | ||||||||||||||||||
| 82 | public: | - | ||||||||||||||||||
| 83 | inline QQmlVMEVariantQObjectPtr(); | - | ||||||||||||||||||
| 84 | inline ~QQmlVMEVariantQObjectPtr() override; | - | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | inline void objectDestroyed(QObject *) override; | - | ||||||||||||||||||
| 87 | inline void setGuardedValue(QObject *obj, QQmlVMEMetaObject *target, int index); | - | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | QQmlVMEMetaObject *m_target; | - | ||||||||||||||||||
| 90 | int m_index; | - | ||||||||||||||||||
| 91 | }; | - | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | class Q_QML_PRIVATE_EXPORT QQmlInterceptorMetaObject : public QAbstractDynamicMetaObject | - | ||||||||||||||||||
| 95 | { | - | ||||||||||||||||||
| 96 | public: | - | ||||||||||||||||||
| 97 | QQmlInterceptorMetaObject(QObject *obj, const QQmlRefPointer<QQmlPropertyCache> &cache); | - | ||||||||||||||||||
| 98 | ~QQmlInterceptorMetaObject() override; | - | ||||||||||||||||||
| 99 | - | |||||||||||||||||||
| 100 | void registerInterceptor(QQmlPropertyIndex index, QQmlPropertyValueInterceptor *interceptor); | - | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | static QQmlInterceptorMetaObject *get(QObject *obj); | - | ||||||||||||||||||
| 103 | - | |||||||||||||||||||
| 104 | QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *o) override; | - | ||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | // Used by auto-tests for inspection | - | ||||||||||||||||||
| 107 | QQmlPropertyCache *propertyCache() const { return cache.data(); } never executed: return cache.data(); | 0 | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | bool intercepts(QQmlPropertyIndex propertyIndex) const | - | ||||||||||||||||||
| 110 | { | - | ||||||||||||||||||
| 111 | for (auto it = interceptors; it; it = it->m_next) {
| 1064-150790 | ||||||||||||||||||
| 112 | if (it->m_propertyIndex == propertyIndex)
| 470-594 | ||||||||||||||||||
| 113 | return true; executed 470 times by 7 tests: return true;Executed by:
| 470 | ||||||||||||||||||
| 114 | } executed 594 times by 5 tests: end of blockExecuted by:
| 594 | ||||||||||||||||||
| 115 | if (auto parentInterceptor = ((parent.isT1() && parent.flag()) ? static_cast<QQmlInterceptorMetaObject *>(parent.asT1()) : nullptr))
| 4-150394 | ||||||||||||||||||
| 116 | return parentInterceptor->intercepts(propertyIndex); executed 396 times by 9 tests: return parentInterceptor->intercepts(propertyIndex);Executed by:
| 396 | ||||||||||||||||||
| 117 | return false; executed 150394 times by 76 tests: return false;Executed by:
| 150394 | ||||||||||||||||||
| 118 | } | - | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | protected: | - | ||||||||||||||||||
| 121 | int metaCall(QObject *o, QMetaObject::Call c, int id, void **a) override; | - | ||||||||||||||||||
| 122 | bool intercept(QMetaObject::Call c, int id, void **a); | - | ||||||||||||||||||
| 123 | - | |||||||||||||||||||
| 124 | public: | - | ||||||||||||||||||
| 125 | QObject *object; | - | ||||||||||||||||||
| 126 | QQmlRefPointer<QQmlPropertyCache> cache; | - | ||||||||||||||||||
| 127 | QBiPointer<QDynamicMetaObjectData, const QMetaObject> parent; | - | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | QQmlPropertyValueInterceptor *interceptors; | - | ||||||||||||||||||
| 130 | bool hasAssignedMetaObjectData; | - | ||||||||||||||||||
| 131 | }; | - | ||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | inline QQmlInterceptorMetaObject *QQmlInterceptorMetaObject::get(QObject *obj) | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | if (obj) {
| 0-561133 | ||||||||||||||||||
| 136 | if (QQmlData *data = QQmlData::get(obj)) {
| 0-561133 | ||||||||||||||||||
| 137 | if (data->hasInterceptorMetaObject)
| 151428-409705 | ||||||||||||||||||
| 138 | return static_cast<QQmlInterceptorMetaObject *>(QObjectPrivate::get(obj)->metaObject); executed 151428 times by 77 tests: return static_cast<QQmlInterceptorMetaObject *>(QObjectPrivate::get(obj)->metaObject);Executed by:
| 151428 | ||||||||||||||||||
| 139 | } executed 409705 times by 101 tests: end of blockExecuted by:
| 409705 | ||||||||||||||||||
| 140 | } executed 409705 times by 101 tests: end of blockExecuted by:
| 409705 | ||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | return nullptr; executed 409705 times by 101 tests: return nullptr;Executed by:
| 409705 | ||||||||||||||||||
| 143 | } | - | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | class QQmlVMEMetaObjectEndpoint; | - | ||||||||||||||||||
| 146 | class Q_QML_PRIVATE_EXPORT QQmlVMEMetaObject : public QQmlInterceptorMetaObject | - | ||||||||||||||||||
| 147 | { | - | ||||||||||||||||||
| 148 | public: | - | ||||||||||||||||||
| 149 | QQmlVMEMetaObject(QV4::ExecutionEngine *engine, QObject *obj, const QQmlRefPointer<QQmlPropertyCache> &cache, const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &qmlCompilationUnit, int qmlObjectId); | - | ||||||||||||||||||
| 150 | ~QQmlVMEMetaObject() override; | - | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | bool aliasTarget(int index, QObject **target, int *coreIndex, int *valueTypeIndex) const; | - | ||||||||||||||||||
| 153 | QV4::ReturnedValue vmeMethod(int index) const; | - | ||||||||||||||||||
| 154 | void setVmeMethod(int index, const QV4::Value &function); | - | ||||||||||||||||||
| 155 | QV4::ReturnedValue vmeProperty(int index) const; | - | ||||||||||||||||||
| 156 | void setVMEProperty(int index, const QV4::Value &v); | - | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | void connectAliasSignal(int index, bool indexInSignalRange); | - | ||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | static inline QQmlVMEMetaObject *get(QObject *o); | - | ||||||||||||||||||
| 161 | static QQmlVMEMetaObject *getForProperty(QObject *o, int coreIndex); | - | ||||||||||||||||||
| 162 | static QQmlVMEMetaObject *getForMethod(QObject *o, int coreIndex); | - | ||||||||||||||||||
| 163 | static QQmlVMEMetaObject *getForSignal(QObject *o, int coreIndex); | - | ||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | protected: | - | ||||||||||||||||||
| 166 | int metaCall(QObject *o, QMetaObject::Call _c, int _id, void **_a) override; | - | ||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | public: | - | ||||||||||||||||||
| 169 | QV4::ExecutionEngine *engine; | - | ||||||||||||||||||
| 170 | QQmlGuardedContextData ctxt; | - | ||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | inline int propOffset() const; | - | ||||||||||||||||||
| 173 | inline int methodOffset() const; | - | ||||||||||||||||||
| 174 | inline int signalOffset() const; | - | ||||||||||||||||||
| 175 | inline int signalCount() const; | - | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | QQmlVMEMetaObjectEndpoint *aliasEndpoints; | - | ||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | QV4::WeakValue propertyAndMethodStorage; | - | ||||||||||||||||||
| 180 | QV4::MemberData *propertyAndMethodStorageAsMemberData() const; | - | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | int readPropertyAsInt(int id) const; | - | ||||||||||||||||||
| 183 | bool readPropertyAsBool(int id) const; | - | ||||||||||||||||||
| 184 | double readPropertyAsDouble(int id) const; | - | ||||||||||||||||||
| 185 | QString readPropertyAsString(int id) const; | - | ||||||||||||||||||
| 186 | QSizeF readPropertyAsSizeF(int id) const; | - | ||||||||||||||||||
| 187 | QPointF readPropertyAsPointF(int id) const; | - | ||||||||||||||||||
| 188 | QUrl readPropertyAsUrl(int id) const; | - | ||||||||||||||||||
| 189 | QDate readPropertyAsDate(int id) const; | - | ||||||||||||||||||
| 190 | QDateTime readPropertyAsDateTime(int id); | - | ||||||||||||||||||
| 191 | QRectF readPropertyAsRectF(int id) const; | - | ||||||||||||||||||
| 192 | QObject *readPropertyAsQObject(int id) const; | - | ||||||||||||||||||
| 193 | QList<QObject *> *readPropertyAsList(int id) const; | - | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | void writeProperty(int id, int v); | - | ||||||||||||||||||
| 196 | void writeProperty(int id, bool v); | - | ||||||||||||||||||
| 197 | void writeProperty(int id, double v); | - | ||||||||||||||||||
| 198 | void writeProperty(int id, const QString& v); | - | ||||||||||||||||||
| 199 | void writeProperty(int id, const QPointF& v); | - | ||||||||||||||||||
| 200 | void writeProperty(int id, const QSizeF& v); | - | ||||||||||||||||||
| 201 | void writeProperty(int id, const QUrl& v); | - | ||||||||||||||||||
| 202 | void writeProperty(int id, const QDate& v); | - | ||||||||||||||||||
| 203 | void writeProperty(int id, const QDateTime& v); | - | ||||||||||||||||||
| 204 | void writeProperty(int id, const QRectF& v); | - | ||||||||||||||||||
| 205 | void writeProperty(int id, QObject *v); | - | ||||||||||||||||||
| 206 | - | |||||||||||||||||||
| 207 | void ensureQObjectWrapper(); | - | ||||||||||||||||||
| 208 | - | |||||||||||||||||||
| 209 | void mark(QV4::MarkStack *markStack); | - | ||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | void connectAlias(int aliasId); | - | ||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | QV4::ReturnedValue method(int) const; | - | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | QV4::ReturnedValue readVarProperty(int) const; | - | ||||||||||||||||||
| 216 | void writeVarProperty(int, const QV4::Value &); | - | ||||||||||||||||||
| 217 | QVariant readPropertyAsVariant(int) const; | - | ||||||||||||||||||
| 218 | void writeProperty(int, const QVariant &); | - | ||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | inline QQmlVMEMetaObject *parentVMEMetaObject() const; | - | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | void activate(QObject *, int, void **); | - | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | QList<QQmlVMEVariantQObjectPtr *> varObjectGuards; | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | QQmlVMEVariantQObjectPtr *getQObjectGuardForProperty(int) const; | - | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | - | |||||||||||||||||||
| 229 | // keep a reference to the compilation unit in order to still | - | ||||||||||||||||||
| 230 | // do property access when the context has been invalidated. | - | ||||||||||||||||||
| 231 | QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit; | - | ||||||||||||||||||
| 232 | const QV4::CompiledData::Object *compiledObject; | - | ||||||||||||||||||
| 233 | }; | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | QQmlVMEMetaObject *QQmlVMEMetaObject::get(QObject *obj) | - | ||||||||||||||||||
| 236 | { | - | ||||||||||||||||||
| 237 | if (obj) {
| 0-890629 | ||||||||||||||||||
| 238 | if (QQmlData *data = QQmlData::get(obj)) {
| 0-890629 | ||||||||||||||||||
| 239 | if (data->hasVMEMetaObject)
| 231711-658918 | ||||||||||||||||||
| 240 | return static_cast<QQmlVMEMetaObject *>(QObjectPrivate::get(obj)->metaObject); executed 231711 times by 73 tests: return static_cast<QQmlVMEMetaObject *>(QObjectPrivate::get(obj)->metaObject);Executed by:
| 231711 | ||||||||||||||||||
| 241 | } executed 658918 times by 135 tests: end of blockExecuted by:
| 658918 | ||||||||||||||||||
| 242 | } executed 658918 times by 135 tests: end of blockExecuted by:
| 658918 | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | return nullptr; executed 658918 times by 135 tests: return nullptr;Executed by:
| 658918 | ||||||||||||||||||
| 245 | } | - | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | int QQmlVMEMetaObject::propOffset() const | - | ||||||||||||||||||
| 248 | { | - | ||||||||||||||||||
| 249 | return cache->propertyOffset(); executed 848785 times by 99 tests: return cache->propertyOffset();Executed by:
| 848785 | ||||||||||||||||||
| 250 | } | - | ||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | int QQmlVMEMetaObject::methodOffset() const | - | ||||||||||||||||||
| 253 | { | - | ||||||||||||||||||
| 254 | return cache->methodOffset(); executed 867836 times by 98 tests: return cache->methodOffset();Executed by:
| 867836 | ||||||||||||||||||
| 255 | } | - | ||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | int QQmlVMEMetaObject::signalOffset() const | - | ||||||||||||||||||
| 258 | { | - | ||||||||||||||||||
| 259 | return cache->signalOffset(); executed 228553 times by 98 tests: return cache->signalOffset();Executed by:
| 228553 | ||||||||||||||||||
| 260 | } | - | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | int QQmlVMEMetaObject::signalCount() const | - | ||||||||||||||||||
| 263 | { | - | ||||||||||||||||||
| 264 | return cache->signalCount(); never executed: return cache->signalCount(); | 0 | ||||||||||||||||||
| 265 | } | - | ||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | QQmlVMEMetaObject *QQmlVMEMetaObject::parentVMEMetaObject() const | - | ||||||||||||||||||
| 268 | { | - | ||||||||||||||||||
| 269 | if (parent.isT1() && parent.flag())
| 0-51869 | ||||||||||||||||||
| 270 | return static_cast<QQmlVMEMetaObject *>(parent.asT1()); executed 51869 times by 10 tests: return static_cast<QQmlVMEMetaObject *>(parent.asT1());Executed by:
| 51869 | ||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | return nullptr; executed 13617 times by 23 tests: return nullptr;Executed by:
| 13617 | ||||||||||||||||||
| 273 | } | - | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | #endif // QQMLVMEMETAOBJECT_P_H | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |