Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlfileselector.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | typedef QHash<QQmlAbstractUrlInterceptor*, QQmlFileSelector*> interceptorSelectorMap; | - | ||||||||||||
5 | namespace { namespace Q_QGS_interceptorInstances { typedef interceptorSelectorMap Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 24 times by 8 tests: }guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 24 times by 8 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block Executed by:
executed 332 times by 8 tests: &holder.value;return &holder.value; Executed by:
executed 332 times by 8 tests: } } } static QGlobalStatic<interceptorSelectorMap, Q_QGS_interceptorInstances::innerFunction, Q_QGS_interceptorInstances::guard> interceptorInstances;;return &holder.value; Executed by:
| 0-332 | ||||||||||||
6 | QQmlFileSelector::QQmlFileSelector(QQmlEngine* engine, QObject* parent) | - | ||||||||||||
7 | : QObject(*(new QQmlFileSelectorPrivate), parent) | - | ||||||||||||
8 | { | - | ||||||||||||
9 | QQmlFileSelectorPrivate * const d = d_func(); | - | ||||||||||||
10 | d->engine = engine; | - | ||||||||||||
11 | interceptorInstances()->insert(d->myInstance.data(), this); | - | ||||||||||||
12 | d->engine->setUrlInterceptor(d->myInstance.data()); | - | ||||||||||||
13 | } executed 156 times by 8 tests: end of block Executed by:
| 156 | ||||||||||||
14 | - | |||||||||||||
15 | - | |||||||||||||
16 | - | |||||||||||||
17 | - | |||||||||||||
18 | QQmlFileSelector::~QQmlFileSelector() | - | ||||||||||||
19 | { | - | ||||||||||||
20 | QQmlFileSelectorPrivate * const d = d_func(); | - | ||||||||||||
21 | if (d->engine && QQmlFileSelector::get(d->engine) == this
| 0-8 | ||||||||||||
22 | d->engine->setUrlInterceptor(nullptr); | - | ||||||||||||
23 | d->engine = nullptr; | - | ||||||||||||
24 | } executed 8 times by 2 tests: end of block Executed by:
| 8 | ||||||||||||
25 | interceptorInstances()->remove(d->myInstance.data()); | - | ||||||||||||
26 | } executed 156 times by 8 tests: end of block Executed by:
| 156 | ||||||||||||
27 | - | |||||||||||||
28 | - | |||||||||||||
29 | - | |||||||||||||
30 | - | |||||||||||||
31 | - | |||||||||||||
32 | QFileSelector *QQmlFileSelector::selector() const noexcept | - | ||||||||||||
33 | { | - | ||||||||||||
34 | const QQmlFileSelectorPrivate * const d = d_func(); | - | ||||||||||||
35 | return never executed: d->selector;return d->selector; never executed: return d->selector; | 0 | ||||||||||||
36 | } | - | ||||||||||||
37 | - | |||||||||||||
38 | QQmlFileSelectorPrivate::QQmlFileSelectorPrivate() | - | ||||||||||||
39 | { | - | ||||||||||||
40 | QQmlFileSelector * const q = q_func(); | - | ||||||||||||
41 | ownSelector = true; | - | ||||||||||||
42 | selector = new QFileSelector(q); | - | ||||||||||||
43 | myInstance.reset(new QQmlFileSelectorInterceptor(this)); | - | ||||||||||||
44 | } executed 156 times by 8 tests: end of block Executed by:
| 156 | ||||||||||||
45 | - | |||||||||||||
46 | QQmlFileSelectorPrivate::~QQmlFileSelectorPrivate() | - | ||||||||||||
47 | { | - | ||||||||||||
48 | if (ownSelector
| 0-156 | ||||||||||||
49 | delete selector; executed 156 times by 8 tests: delete selector; Executed by:
| 156 | ||||||||||||
50 | } executed 156 times by 8 tests: end of block Executed by:
| 156 | ||||||||||||
51 | - | |||||||||||||
52 | - | |||||||||||||
53 | - | |||||||||||||
54 | - | |||||||||||||
55 | - | |||||||||||||
56 | - | |||||||||||||
57 | - | |||||||||||||
58 | void QQmlFileSelector::setSelector(QFileSelector *selector) | - | ||||||||||||
59 | { | - | ||||||||||||
60 | QQmlFileSelectorPrivate * const d = d_func(); | - | ||||||||||||
61 | if (selector
| 0 | ||||||||||||
62 | if (d->ownSelector
| 0 | ||||||||||||
63 | delete d->selector; | - | ||||||||||||
64 | d->ownSelector = false; | - | ||||||||||||
65 | } never executed: end of block | 0 | ||||||||||||
66 | d->selector = selector; | - | ||||||||||||
67 | } never executed: else {end of block | 0 | ||||||||||||
68 | if (!d->ownSelector
| 0 | ||||||||||||
69 | d->ownSelector = true; | - | ||||||||||||
70 | d->selector = new QFileSelector(this); | - | ||||||||||||
71 | } never executed: end of block | 0 | ||||||||||||
72 | } never executed: end of block | 0 | ||||||||||||
73 | } | - | ||||||||||||
74 | - | |||||||||||||
75 | - | |||||||||||||
76 | - | |||||||||||||
77 | - | |||||||||||||
78 | - | |||||||||||||
79 | - | |||||||||||||
80 | void QQmlFileSelector::setExtraSelectors(QStringList &strings) | - | ||||||||||||
81 | { | - | ||||||||||||
82 | QQmlFileSelectorPrivate * const d = d_func(); | - | ||||||||||||
83 | d->selector->setExtraSelectors(strings); | - | ||||||||||||
84 | } executed 10 times by 2 tests: end of block Executed by:
| 10 | ||||||||||||
85 | - | |||||||||||||
86 | - | |||||||||||||
87 | - | |||||||||||||
88 | - | |||||||||||||
89 | - | |||||||||||||
90 | - | |||||||||||||
91 | - | |||||||||||||
92 | void QQmlFileSelector::setExtraSelectors(const QStringList &strings) | - | ||||||||||||
93 | { | - | ||||||||||||
94 | QQmlFileSelectorPrivate * const d = d_func(); | - | ||||||||||||
95 | d->selector->setExtraSelectors(strings); | - | ||||||||||||
96 | } never executed: end of block | 0 | ||||||||||||
97 | - | |||||||||||||
98 | - | |||||||||||||
99 | - | |||||||||||||
100 | - | |||||||||||||
101 | QQmlFileSelector* QQmlFileSelector::get(QQmlEngine* engine) | - | ||||||||||||
102 | { | - | ||||||||||||
103 | - | |||||||||||||
104 | QQmlAbstractUrlInterceptor* current = engine->urlInterceptor(); | - | ||||||||||||
105 | if (current
| 0-10 | ||||||||||||
106 | return executed 10 times by 2 tests: interceptorInstances()->value(current);return interceptorInstances()->value(current); Executed by:
executed 10 times by 2 tests: return interceptorInstances()->value(current); Executed by:
| 10 | ||||||||||||
107 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||
108 | } | - | ||||||||||||
109 | - | |||||||||||||
110 | - | |||||||||||||
111 | - | |||||||||||||
112 | - | |||||||||||||
113 | QQmlFileSelectorInterceptor::QQmlFileSelectorInterceptor(QQmlFileSelectorPrivate* pd) | - | ||||||||||||
114 | : d(pd) | - | ||||||||||||
115 | { | - | ||||||||||||
116 | } executed 156 times by 8 tests: end of block Executed by:
| 156 | ||||||||||||
117 | - | |||||||||||||
118 | - | |||||||||||||
119 | - | |||||||||||||
120 | - | |||||||||||||
121 | QUrl QQmlFileSelectorInterceptor::intercept(const QUrl &path, DataType type) | - | ||||||||||||
122 | { | - | ||||||||||||
123 | if ( type == QQmlAbstractUrlInterceptor::QmldirFile
| 190-3276 | ||||||||||||
124 | return executed 3276 times by 8 tests: path;return path; Executed by:
executed 3276 times by 8 tests: return path; Executed by:
| 3276 | ||||||||||||
125 | return executed 190 times by 8 tests: d->selector->select(path);return d->selector->select(path); Executed by:
executed 190 times by 8 tests: return d->selector->select(path); Executed by:
| 190 | ||||||||||||
126 | } | - | ||||||||||||
127 | - | |||||||||||||
128 | - | |||||||||||||
129 | - | |||||||||||||
Switch to Source code | Preprocessed file |