OpenCoverage

qquickpackage.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/types/qquickpackage.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4class QQuickPackagePrivate : public QObjectPrivate-
5{-
6public:-
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
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: return list->at(index);
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: return list->count();
list->count();
never executed: return list->count();
0
35 }-
36};-
37-
38QHash<QObject *, QQuickPackageAttached *> QQuickPackageAttached::attached;-
39-
40QQuickPackageAttached::QQuickPackageAttached(QObject *parent)-
41: QObject(parent)-
42{-
43 attached.insert(parent, this);-
44}
executed 5226 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
5226
45-
46QQuickPackageAttached::~QQuickPackageAttached()-
47{-
48 attached.remove(parent());-
49}
executed 5226 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
5226
50-
51QString QQuickPackageAttached::name() const-
52{-
53 return
executed 18694 times by 6 tests: return _name;
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
_name;
executed 18694 times by 6 tests: return _name;
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
18694
54}-
55-
56void QQuickPackageAttached::setName(const QString &n)-
57{-
58 _name = n;-
59}
executed 5226 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
5226
60-
61QQuickPackage::QQuickPackage(QObject *parent)-
62 : QObject(*(new QQuickPackagePrivate), parent)-
63{-
64}
executed 4962 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
4962
65-
66QQuickPackage::~QQuickPackage()-
67{-
68}-
69-
70QQmlListProperty<QObject> QQuickPackage::data()-
71{-
72 QQuickPackagePrivate * const d = d_func();-
73 return
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
QQmlListProperty<QObject>(this, &d->dataList, QQuickPackagePrivate::data_append,
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
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:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
4962
77}-
78-
79bool QQuickPackage::hasPart(const QString &name)-
80{-
81 QQuickPackagePrivate * const d = d_func();-
82 for (int ii = 0; ii < d->dataList.count()
ii < d->dataList.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++ii) {
0
83 QObject *obj = d->dataList.at(ii);-
84 QQuickPackageAttached *a = QQuickPackageAttached::attached.value(obj);-
85 if (a
aDescription
TRUEnever evaluated
FALSEnever evaluated
&& a->name() == name
a->name() == nameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
86 return
never executed: return true;
true;
never executed: return true;
0
87 }
never executed: end of block
0
88 return
never executed: return false;
false;
never executed: return false;
0
89}-
90-
91QObject *QQuickPackage::part(const QString &name)-
92{-
93 QQuickPackagePrivate * const d = d_func();-
94 if (name.isEmpty()
name.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 17892 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
&& !d->dataList.isEmpty()
!d->dataList.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0-17892
95 return
never executed: return d->dataList.at(0);
d->dataList.at(0);
never executed: return d->dataList.at(0);
0
96-
97 for (int ii = 0; ii < d->dataList.count()
ii < d->dataList.count()Description
TRUEevaluated 18694 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
FALSEnever evaluated
; ++ii) {
0-18694
98 QObject *obj = d->dataList.at(ii);-
99 QQuickPackageAttached *a = QQuickPackageAttached::attached.value(obj);-
100 if (a
aDescription
TRUEevaluated 18694 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
FALSEnever evaluated
&& a->name() == name
a->name() == nameDescription
TRUEevaluated 17892 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
FALSEevaluated 802 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
)
0-18694
101 return
executed 17892 times by 6 tests: return obj;
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
obj;
executed 17892 times by 6 tests: return obj;
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
17892
102 }
executed 802 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
802
103-
104 if (name == QLatin1String("default")
name == QLatin...ing("default")Description
TRUEnever evaluated
FALSEnever evaluated
&& !d->dataList.isEmpty()
!d->dataList.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
105 return
never executed: return d->dataList.at(0);
d->dataList.at(0);
never executed: return d->dataList.at(0);
0
106-
107 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
108}-
109-
110QQuickPackageAttached *QQuickPackage::qmlAttachedProperties(QObject *o)-
111{-
112 return
executed 5226 times by 6 tests: return new QQuickPackageAttached(o);
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
new QQuickPackageAttached(o);
executed 5226 times by 6 tests: return new QQuickPackageAttached(o);
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickvisualdatamodel
5226
113}-
114-
115-
116-
117-
118-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0