| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlbinding_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 QQMLBINDING_P_H | - |
| 41 | #define QQMLBINDING_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 "qqmlpropertyvaluesource.h" | - |
| 56 | #include "qqmlexpression.h" | - |
| 57 | #include "qqmlproperty.h" | - |
| 58 | #include "qqmlscriptstring.h" | - |
| 59 | #include "qqmlproperty_p.h" | - |
| 60 | - | |
| 61 | #include <QtCore/QObject> | - |
| 62 | #include <QtCore/QMetaProperty> | - |
| 63 | - | |
| 64 | #include <private/qqmlabstractbinding_p.h> | - |
| 65 | #include <private/qqmljavascriptexpression_p.h> | - |
| 66 | - | |
| 67 | QT_BEGIN_NAMESPACE | - |
| 68 | - | |
| 69 | class QQmlContext; | - |
| 70 | class Q_QML_PRIVATE_EXPORT QQmlBinding : public QQmlJavaScriptExpression, | - |
| 71 | public QQmlAbstractBinding | - |
| 72 | { | - |
| 73 | friend class QQmlAbstractBinding; | - |
| 74 | public: | - |
| 75 | typedef QExplicitlySharedDataPointer<QQmlBinding> Ptr; | - |
| 76 | - | |
| 77 | static QQmlBinding *create(const QQmlPropertyData *, const QQmlScriptString &, QObject *, QQmlContext *); | - |
| 78 | static QQmlBinding *create(const QQmlPropertyData *, const QString &, QObject *, QQmlContextData *, | - |
| 79 | const QString &url = QString(), quint16 lineNumber = 0); | - |
| 80 | static QQmlBinding *create(const QQmlPropertyData *property, QV4::Function *function, | - |
| 81 | QObject *obj, QQmlContextData *ctxt, QV4::ExecutionContext *scope); | - |
| 82 | static QQmlBinding *createTranslationBinding(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &unit, const QV4::CompiledData::Binding *binding, | - |
| 83 | QObject *obj, QQmlContextData *ctxt); | - |
| 84 | ~QQmlBinding() override; | - |
| 85 | - | |
| 86 | void setTarget(const QQmlProperty &); | - |
| 87 | bool setTarget(QObject *, const QQmlPropertyData &, const QQmlPropertyData *valueType); | - |
| 88 | - | |
| 89 | void setNotifyOnValueChanged(bool); | - |
| 90 | - | |
| 91 | void refresh() override; | - |
| 92 | - | |
| 93 | void setEnabled(bool, QQmlPropertyData::WriteFlags flags = QQmlPropertyData::DontRemoveBinding) override; | - |
| 94 | QString expression() const override; | - |
| 95 | void update(QQmlPropertyData::WriteFlags flags = QQmlPropertyData::DontRemoveBinding); | - |
| 96 | - | |
| 97 | typedef int Identifier; | - |
| 98 | enum { | - |
| 99 | Invalid = -1 | - |
| 100 | }; | - |
| 101 | - | |
| 102 | QVariant evaluate(); | - |
| 103 | - | |
| 104 | QString expressionIdentifier() const override; | - |
| 105 | void expressionChanged() override; | - |
| 106 | - | |
| 107 | QQmlSourceLocation sourceLocation() const override; | - |
| 108 | void setSourceLocation(const QQmlSourceLocation &location); | - |
| 109 | void setBoundFunction(QV4::BoundFunction *boundFunction) { | - |
| 110 | m_boundFunction.set(boundFunction->engine(), *boundFunction); | - |
| 111 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 |
| 112 | - | |
| 113 | /** | - |
| 114 | * This method returns a snapshot of the currently tracked dependencies of | - |
| 115 | * this binding. The dependencies can change upon reevaluation. This method is | - |
| 116 | * used in GammaRay to visualize binding hierarchies. | - |
| 117 | * | - |
| 118 | * Call this method from the UI thread. | - |
| 119 | */ | - |
| 120 | QVector<QQmlProperty> dependencies() const; | - |
| 121 | virtual bool hasDependencies() const; | - |
| 122 | - | |
| 123 | protected: | - |
| 124 | virtual void doUpdate(const DeleteWatcher &watcher, | - |
| 125 | QQmlPropertyData::WriteFlags flags, QV4::Scope &scope) = 0; | - |
| 126 | - | |
| 127 | void getPropertyData(QQmlPropertyData **propertyData, QQmlPropertyData *valueTypeData) const; | - |
| 128 | int getPropertyType() const; | - |
| 129 | - | |
| 130 | bool slowWrite(const QQmlPropertyData &core, const QQmlPropertyData &valueTypeData, | - |
| 131 | const QV4::Value &result, bool isUndefined, QQmlPropertyData::WriteFlags flags); | - |
| 132 | - | |
| 133 | QV4::ReturnedValue evaluate(bool *isUndefined); | - |
| 134 | - | |
| 135 | private: | - |
| 136 | inline bool updatingFlag() const; | - |
| 137 | inline void setUpdatingFlag(bool); | - |
| 138 | inline bool enabledFlag() const; | - |
| 139 | inline void setEnabledFlag(bool); | - |
| 140 | - | |
| 141 | static QQmlBinding *newBinding(QQmlEnginePrivate *engine, const QQmlPropertyData *property); | - |
| 142 | - | |
| 143 | QQmlSourceLocation *m_sourceLocation = nullptr; // used for Qt.binding() created functions | - |
| 144 | QV4::PersistentValue m_boundFunction; // used for Qt.binding() that are created from a bound function object | - |
| 145 | }; | - |
| 146 | - | |
| 147 | bool QQmlBinding::updatingFlag() const | - |
| 148 | { | - |
| 149 | return m_target.flag(); executed 891388 times by 121 tests: return m_target.flag();Executed by:
| 891388 |
| 150 | } | - |
| 151 | - | |
| 152 | void QQmlBinding::setUpdatingFlag(bool v) | - |
| 153 | { | - |
| 154 | m_target.setFlagValue(v); | - |
| 155 | } executed 1782728 times by 121 tests: end of blockExecuted by:
| 1782728 |
| 156 | - | |
| 157 | bool QQmlBinding::enabledFlag() const | - |
| 158 | { | - |
| 159 | return m_target.flag2(); executed 1481331 times by 121 tests: return m_target.flag2();Executed by:
| 1481331 |
| 160 | } | - |
| 161 | - | |
| 162 | void QQmlBinding::setEnabledFlag(bool v) | - |
| 163 | { | - |
| 164 | m_target.setFlag2Value(v); | - |
| 165 | } executed 560567 times by 121 tests: end of blockExecuted by:
| 560567 |
| 166 | - | |
| 167 | QT_END_NAMESPACE | - |
| 168 | - | |
| 169 | Q_DECLARE_METATYPE(QQmlBinding*) | - |
| 170 | - | |
| 171 | #endif // QQMLBINDING_P_H | - |
| Source code | Switch to Preprocessed file |