Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/types/qquickpackage.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | class QQuickPackagePrivate : public QObjectPrivate | - | ||||||||||||
5 | { | - | ||||||||||||
6 | public: | - | ||||||||||||
7 | QQuickPackagePrivate() {} | - | ||||||||||||
8 | - | |||||||||||||
9 | struct DataGuard : public QQmlGuard<QObject> | - | ||||||||||||
10 | { | - | ||||||||||||
11 | DataGuard(QObject *obj, QList<DataGuard> *l) : list(l) { (QQmlGuard<QObject>&)*this = obj; } executed 5334 times by 6 tests: end of block Executed by:
| 5334 | ||||||||||||
12 | QList<DataGuard> *list; | - | ||||||||||||
13 | void objectDestroyed(QObject *) override { | - | ||||||||||||
14 | - | |||||||||||||
15 | list->removeOne(*this); | - | ||||||||||||
16 | } executed 5334 times by 6 tests: end of block Executed by:
| 5334 | ||||||||||||
17 | }; | - | ||||||||||||
18 | - | |||||||||||||
19 | QList<DataGuard> dataList; | - | ||||||||||||
20 | static void data_append(QQmlListProperty<QObject> *prop, QObject *o) { | - | ||||||||||||
21 | QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data); | - | ||||||||||||
22 | list->append(DataGuard(o, list)); | - | ||||||||||||
23 | } executed 5334 times by 6 tests: end of block Executed by:
| 5334 | ||||||||||||
24 | static void data_clear(QQmlListProperty<QObject> *prop) { | - | ||||||||||||
25 | QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data); | - | ||||||||||||
26 | list->clear(); | - | ||||||||||||
27 | } never executed: end of block | 0 | ||||||||||||
28 | static QObject *data_at(QQmlListProperty<QObject> *prop, int index) { | - | ||||||||||||
29 | QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data); | - | ||||||||||||
30 | return never executed: list->at(index);return list->at(index); never executed: return list->at(index); | 0 | ||||||||||||
31 | } | - | ||||||||||||
32 | static int data_count(QQmlListProperty<QObject> *prop) { | - | ||||||||||||
33 | QList<DataGuard> *list = static_cast<QList<DataGuard> *>(prop->data); | - | ||||||||||||
34 | return never executed: list->count();return list->count(); never executed: return list->count(); | 0 | ||||||||||||
35 | } | - | ||||||||||||
36 | }; | - | ||||||||||||
37 | - | |||||||||||||
38 | QHash<QObject *, QQuickPackageAttached *> QQuickPackageAttached::attached; | - | ||||||||||||
39 | - | |||||||||||||
40 | QQuickPackageAttached::QQuickPackageAttached(QObject *parent) | - | ||||||||||||
41 | : QObject(parent) | - | ||||||||||||
42 | { | - | ||||||||||||
43 | attached.insert(parent, this); | - | ||||||||||||
44 | } executed 5226 times by 6 tests: end of block Executed by:
| 5226 | ||||||||||||
45 | - | |||||||||||||
46 | QQuickPackageAttached::~QQuickPackageAttached() | - | ||||||||||||
47 | { | - | ||||||||||||
48 | attached.remove(parent()); | - | ||||||||||||
49 | } executed 5226 times by 6 tests: end of block Executed by:
| 5226 | ||||||||||||
50 | - | |||||||||||||
51 | QString QQuickPackageAttached::name() const | - | ||||||||||||
52 | { | - | ||||||||||||
53 | return executed 18694 times by 6 tests: _name;return _name; Executed by:
executed 18694 times by 6 tests: return _name; Executed by:
| 18694 | ||||||||||||
54 | } | - | ||||||||||||
55 | - | |||||||||||||
56 | void QQuickPackageAttached::setName(const QString &n) | - | ||||||||||||
57 | { | - | ||||||||||||
58 | _name = n; | - | ||||||||||||
59 | } executed 5226 times by 6 tests: end of block Executed by:
| 5226 | ||||||||||||
60 | - | |||||||||||||
61 | QQuickPackage::QQuickPackage(QObject *parent) | - | ||||||||||||
62 | : QObject(*(new QQuickPackagePrivate), parent) | - | ||||||||||||
63 | { | - | ||||||||||||
64 | } executed 4962 times by 6 tests: end of block Executed by:
| 4962 | ||||||||||||
65 | - | |||||||||||||
66 | QQuickPackage::~QQuickPackage() | - | ||||||||||||
67 | { | - | ||||||||||||
68 | } | - | ||||||||||||
69 | - | |||||||||||||
70 | QQmlListProperty<QObject> QQuickPackage::data() | - | ||||||||||||
71 | { | - | ||||||||||||
72 | QQuickPackagePrivate * const d = d_func(); | - | ||||||||||||
73 | return executed 4962 times by 6 tests: QQmlListProperty<QObject>(this, &d->dataList, QQuickPackagePrivate::data_append,return QQmlListProperty<QObject>(this, &d->dataList, QQuickPackagePrivate::data_append, QQuickPackagePrivate::data_count, QQuickPackagePrivate::data_at, QQuickPackagePrivate::data_clear); Executed by:
executed 4962 times by 6 tests: return QQmlListProperty<QObject>(this, &d->dataList, QQuickPackagePrivate::data_append, QQuickPackagePrivate::data_count, QQuickPackagePrivate::data_at, QQuickPackagePrivate::data_clear); Executed by:
| 4962 | ||||||||||||
74 | QQuickPackagePrivate::data_count, executed 4962 times by 6 tests: return QQmlListProperty<QObject>(this, &d->dataList, QQuickPackagePrivate::data_append, QQuickPackagePrivate::data_count, QQuickPackagePrivate::data_at, QQuickPackagePrivate::data_clear); Executed by:
| 4962 | ||||||||||||
75 | QQuickPackagePrivate::data_at, executed 4962 times by 6 tests: return QQmlListProperty<QObject>(this, &d->dataList, QQuickPackagePrivate::data_append, QQuickPackagePrivate::data_count, QQuickPackagePrivate::data_at, QQuickPackagePrivate::data_clear); Executed by:
| 4962 | ||||||||||||
76 | QQuickPackagePrivate::data_clear); executed 4962 times by 6 tests: return QQmlListProperty<QObject>(this, &d->dataList, QQuickPackagePrivate::data_append, QQuickPackagePrivate::data_count, QQuickPackagePrivate::data_at, QQuickPackagePrivate::data_clear); Executed by:
| 4962 | ||||||||||||
77 | } | - | ||||||||||||
78 | - | |||||||||||||
79 | bool QQuickPackage::hasPart(const QString &name) | - | ||||||||||||
80 | { | - | ||||||||||||
81 | QQuickPackagePrivate * const d = d_func(); | - | ||||||||||||
82 | for (int ii = 0; ii < d->dataList.count()
| 0 | ||||||||||||
83 | QObject *obj = d->dataList.at(ii); | - | ||||||||||||
84 | QQuickPackageAttached *a = QQuickPackageAttached::attached.value(obj); | - | ||||||||||||
85 | if (a
| 0 | ||||||||||||
86 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
87 | } never executed: end of block | 0 | ||||||||||||
88 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
89 | } | - | ||||||||||||
90 | - | |||||||||||||
91 | QObject *QQuickPackage::part(const QString &name) | - | ||||||||||||
92 | { | - | ||||||||||||
93 | QQuickPackagePrivate * const d = d_func(); | - | ||||||||||||
94 | if (name.isEmpty()
| 0-17892 | ||||||||||||
95 | return never executed: d->dataList.at(0);return d->dataList.at(0); never executed: return d->dataList.at(0); | 0 | ||||||||||||
96 | - | |||||||||||||
97 | for (int ii = 0; ii < d->dataList.count()
| 0-18694 | ||||||||||||
98 | QObject *obj = d->dataList.at(ii); | - | ||||||||||||
99 | QQuickPackageAttached *a = QQuickPackageAttached::attached.value(obj); | - | ||||||||||||
100 | if (a
| 0-18694 | ||||||||||||
101 | return executed 17892 times by 6 tests: obj;return obj; Executed by:
executed 17892 times by 6 tests: return obj; Executed by:
| 17892 | ||||||||||||
102 | } executed 802 times by 6 tests: end of block Executed by:
| 802 | ||||||||||||
103 | - | |||||||||||||
104 | if (name == QLatin1String("default")
| 0 | ||||||||||||
105 | return never executed: d->dataList.at(0);return d->dataList.at(0); never executed: return d->dataList.at(0); | 0 | ||||||||||||
106 | - | |||||||||||||
107 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||
108 | } | - | ||||||||||||
109 | - | |||||||||||||
110 | QQuickPackageAttached *QQuickPackage::qmlAttachedProperties(QObject *o) | - | ||||||||||||
111 | { | - | ||||||||||||
112 | return executed 5226 times by 6 tests: new QQuickPackageAttached(o);return new QQuickPackageAttached(o); Executed by:
executed 5226 times by 6 tests: return new QQuickPackageAttached(o); Executed by:
| 5226 | ||||||||||||
113 | } | - | ||||||||||||
114 | - | |||||||||||||
115 | - | |||||||||||||
116 | - | |||||||||||||
117 | - | |||||||||||||
118 | - | |||||||||||||
Switch to Source code | Preprocessed file |