qdbusabstractadaptor.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11static int cachedRelaySlotMethodIndex = -1; -
12 -
13int QDBusAdaptorConnector::relaySlotMethodIndex() -
14{ -
15 if (cachedRelaySlotMethodIndex == -1) {
evaluated: cachedRelaySlotMethodIndex == -1
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:147
8-147
16 cachedRelaySlotMethodIndex = staticMetaObject.indexOfMethod("relaySlot()"); -
17 qt_noop(); -
18 }
executed: }
Execution Count:8
8
19 return cachedRelaySlotMethodIndex;
executed: return cachedRelaySlotMethodIndex;
Execution Count:155
155
20} -
21 -
22QDBusAdaptorConnector *qDBusFindAdaptorConnector(QObject *obj) -
23{ -
24 if (!obj)
partially evaluated: !obj
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:478
0-478
25 return 0;
never executed: return 0;
0
26 const QObjectList &children = obj->children(); -
27 QObjectList::ConstIterator it = children.constBegin(); -
28 QObjectList::ConstIterator end = children.constEnd(); -
29 for ( ; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:854
yes
Evaluation Count:69
69-854
30 QDBusAdaptorConnector *connector = qobject_cast<QDBusAdaptorConnector *>(*it); -
31 if (connector) {
evaluated: connector
TRUEFALSE
yes
Evaluation Count:409
yes
Evaluation Count:445
409-445
32 connector->polish(); -
33 return connector;
executed: return connector;
Execution Count:409
409
34 } -
35 }
executed: }
Execution Count:445
445
36 return 0;
executed: return 0;
Execution Count:69
69
37} -
38 -
39QDBusAdaptorConnector *qDBusFindAdaptorConnector(QDBusAbstractAdaptor *adaptor) -
40{ -
41 return qDBusFindAdaptorConnector(adaptor->parent());
never executed: return qDBusFindAdaptorConnector(adaptor->parent());
0
42} -
43 -
44QDBusAdaptorConnector *qDBusCreateAdaptorConnector(QObject *obj) -
45{ -
46 QDBusAdaptorConnector *connector = qDBusFindAdaptorConnector(obj); -
47 if (connector)
evaluated: connector
TRUEFALSE
yes
Evaluation Count:114
yes
Evaluation Count:69
69-114
48 return connector;
executed: return connector;
Execution Count:114
114
49 return new QDBusAdaptorConnector(obj);
executed: return new QDBusAdaptorConnector(obj);
Execution Count:69
69
50} -
51 -
52QString QDBusAbstractAdaptorPrivate::retrieveIntrospectionXml(QDBusAbstractAdaptor *adaptor) -
53{ -
54 return adaptor->d_func()->xml;
executed: return adaptor->d_func()->xml;
Execution Count:73
73
55} -
56 -
57void QDBusAbstractAdaptorPrivate::saveIntrospectionXml(QDBusAbstractAdaptor *adaptor, -
58 const QString &xml) -
59{ -
60 adaptor->d_func()->xml = xml; -
61}
executed: }
Execution Count:54
54
62QDBusAbstractAdaptor::QDBusAbstractAdaptor(QObject* obj) -
63 : QObject(*new QDBusAbstractAdaptorPrivate, obj) -
64{ -
65 QDBusAdaptorConnector *connector = qDBusCreateAdaptorConnector(obj); -
66 -
67 connector->waitingForPolish = true; -
68 QMetaObject::invokeMethod(connector, "polish", Qt::QueuedConnection); -
69}
executed: }
Execution Count:111
111
70 -
71 -
72 -
73 -
74 -
75 -
76 -
77QDBusAbstractAdaptor::~QDBusAbstractAdaptor() -
78{ -
79} -
80void QDBusAbstractAdaptor::setAutoRelaySignals(bool enable) -
81{ -
82 const QMetaObject *us = metaObject(); -
83 const QMetaObject *them = parent()->metaObject(); -
84 bool connected = false; -
85 for (int idx = staticMetaObject.methodCount(); idx < us->methodCount(); ++idx) {
evaluated: idx < us->methodCount()
TRUEFALSE
yes
Evaluation Count:316
yes
Evaluation Count:62
62-316
86 QMetaMethod mm = us->method(idx); -
87 -
88 if (mm.methodType() != QMetaMethod::Signal)
evaluated: mm.methodType() != QMetaMethod::Signal
TRUEFALSE
yes
Evaluation Count:182
yes
Evaluation Count:134
134-182
89 continue;
executed: continue;
Execution Count:182
182
90 -
91 -
92 QByteArray sig = QMetaObject::normalizedSignature(mm.methodSignature().constData()); -
93 if (them->indexOfSignal(sig) == -1)
partially evaluated: them->indexOfSignal(sig) == -1
TRUEFALSE
yes
Evaluation Count:134
no
Evaluation Count:0
0-134
94 continue;
executed: continue;
Execution Count:134
134
95 sig.prepend(2 + '0'); -
96 parent()->disconnect(sig, this, sig); -
97 if (enable)
never evaluated: enable
0
98 connected = connect(parent(), sig, sig) || connected;
never executed: connected = connect(parent(), sig, sig) || connected;
never evaluated: connect(parent(), sig, sig)
never evaluated: connected
0
99 }
never executed: }
0
100 d_func()->autoRelaySignals = connected; -
101}
executed: }
Execution Count:62
62
102 -
103 -
104 -
105 -
106 -
107 -
108 -
109bool QDBusAbstractAdaptor::autoRelaySignals() const -
110{ -
111 return d_func()->autoRelaySignals;
never executed: return d_func()->autoRelaySignals;
0
112} -
113 -
114QDBusAdaptorConnector::QDBusAdaptorConnector(QObject *obj) -
115 : QObject(obj), waitingForPolish(false) -
116{ -
117}
executed: }
Execution Count:69
69
118 -
119QDBusAdaptorConnector::~QDBusAdaptorConnector() -
120{ -
121} -
122 -
123void QDBusAdaptorConnector::addAdaptor(QDBusAbstractAdaptor *adaptor) -
124{ -
125 -
126 const QMetaObject *mo = adaptor->metaObject(); -
127 int ciid = mo->indexOfClassInfo("D-Bus Interface"); -
128 if (ciid != -1) {
evaluated: ciid != -1
TRUEFALSE
yes
Evaluation Count:223
yes
Evaluation Count:62
62-223
129 QMetaClassInfo mci = mo->classInfo(ciid); -
130 if (*mci.value()) {
partially evaluated: *mci.value()
TRUEFALSE
yes
Evaluation Count:223
no
Evaluation Count:0
0-223
131 -
132 const char *interface = mci.value(); -
133 AdaptorMap::Iterator it = std::lower_bound(adaptors.begin(), adaptors.end(), -
134 QByteArray(interface)); -
135 if (it != adaptors.end() && qstrcmp(interface, it->interface) == 0) {
evaluated: it != adaptors.end()
TRUEFALSE
yes
Evaluation Count:174
yes
Evaluation Count:49
evaluated: qstrcmp(interface, it->interface) == 0
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:62
49-174
136 -
137 if (it->adaptor != adaptor) {
partially evaluated: it->adaptor != adaptor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:112
0-112
138 -
139 disconnectAllSignals(it->adaptor); -
140 connectAllSignals(adaptor); -
141 }
never executed: }
0
142 it->adaptor = adaptor; -
143 } else {
executed: }
Execution Count:112
112
144 -
145 AdaptorData entry; -
146 entry.interface = interface; -
147 entry.adaptor = adaptor; -
148 adaptors << entry; -
149 -
150 -
151 connectAllSignals(adaptor); -
152 }
executed: }
Execution Count:111
111
153 } -
154 }
executed: }
Execution Count:223
223
155}
executed: }
Execution Count:285
285
156 -
157void QDBusAdaptorConnector::disconnectAllSignals(QObject *obj) -
158{ -
159 QMetaObject::disconnect(obj, -1, this, relaySlotMethodIndex()); -
160}
executed: }
Execution Count:22
22
161 -
162void QDBusAdaptorConnector::connectAllSignals(QObject *obj) -
163{ -
164 QMetaObject::connect(obj, -1, this, relaySlotMethodIndex(), Qt::DirectConnection); -
165}
executed: }
Execution Count:133
133
166 -
167void QDBusAdaptorConnector::polish() -
168{ -
169 if (!waitingForPolish)
evaluated: !waitingForPolish
TRUEFALSE
yes
Evaluation Count:337
yes
Evaluation Count:111
111-337
170 return;
executed: return;
Execution Count:337
337
171 -
172 waitingForPolish = false; -
173 const QObjectList &objs = parent()->children(); -
174 QObjectList::ConstIterator it = objs.constBegin(); -
175 QObjectList::ConstIterator end = objs.constEnd(); -
176 for ( ; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:396
yes
Evaluation Count:111
111-396
177 QDBusAbstractAdaptor *adaptor = qobject_cast<QDBusAbstractAdaptor *>(*it); -
178 if (adaptor)
evaluated: adaptor
TRUEFALSE
yes
Evaluation Count:285
yes
Evaluation Count:111
111-285
179 addAdaptor(adaptor);
executed: addAdaptor(adaptor);
Execution Count:285
285
180 }
executed: }
Execution Count:396
396
181 -
182 -
183 qSort(adaptors); -
184}
executed: }
Execution Count:111
111
185 -
186void QDBusAdaptorConnector::relaySlot(void **argv) -
187{ -
188 relay(sender(), senderSignalIndex(), argv); -
189}
executed: }
Execution Count:161
161
190 -
191void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void **argv) -
192{ -
193 if (lastSignalIdx < QObject::staticMetaObject.methodCount())
evaluated: lastSignalIdx < QObject::staticMetaObject.methodCount()
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:92
69-92
194 -
195 return;
executed: return;
Execution Count:69
69
196 -
197 const QMetaObject *senderMetaObject = senderObj->metaObject(); -
198 QMetaMethod mm = senderMetaObject->method(lastSignalIdx); -
199 -
200 QObject *realObject = senderObj; -
201 if (qobject_cast<QDBusAbstractAdaptor *>(senderObj))
evaluated: qobject_cast<QDBusAbstractAdaptor *>(senderObj)
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:44
44-48
202 -
203 realObject = realObject->parent();
executed: realObject = realObject->parent();
Execution Count:48
48
204 -
205 -
206 QVector<int> types; -
207 int inputCount = qDBusParametersForMethod(mm, types); -
208 if (inputCount == -1)
partially evaluated: inputCount == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:92
0-92
209 -
210 -
211 return;
never executed: return;
0
212 if (inputCount + 1 != types.count() ||
partially evaluated: inputCount + 1 != types.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:92
0-92
213 types.at(inputCount) == QDBusMetaTypeId::message()) {
partially evaluated: types.at(inputCount) == QDBusMetaTypeId::message()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:92
0-92
214 -
215 -
216 QMessageLogger("qdbusabstractadaptor.cpp", 310, __PRETTY_FUNCTION__).warning("QDBusAbstractAdaptor: Cannot relay signal %s::%s", -
217 senderMetaObject->className(), mm.methodSignature().constData()); -
218 return;
never executed: return;
0
219 } -
220 -
221 QVariantList args; -
222 for (int i = 1; i < types.count(); ++i)
evaluated: i < types.count()
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:92
48-92
223 args << QVariant(types.at(i), argv[i]);
executed: args << QVariant(types.at(i), argv[i]);
Execution Count:48
48
224 -
225 -
226 relaySignal(realObject, senderMetaObject, lastSignalIdx, args); -
227}
executed: }
Execution Count:92
92
228 -
229 -
230 -
231 -
232 -
233struct qt_meta_stringdata_QDBusAdaptorConnector_t { -
234 QByteArrayData data[10]; -
235 char stringdata[96]; -
236}; -
237 -
238 -
239 -
240 -
241 -
242static const qt_meta_stringdata_QDBusAdaptorConnector_t qt_meta_stringdata_QDBusAdaptorConnector = { -
243 { -
244{ { { (-1) } }, 21, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 0 - 0 * sizeof(QByteArrayData) }, -
245{ { { (-1) } }, 11, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 22 - 1 * sizeof(QByteArrayData) }, -
246{ { { (-1) } }, 0, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 34 - 2 * sizeof(QByteArrayData) }, -
247{ { { (-1) } }, 3, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 35 - 3 * sizeof(QByteArrayData) }, -
248{ { { (-1) } }, 18, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 39 - 4 * sizeof(QByteArrayData) }, -
249{ { { (-1) } }, 10, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 58 - 5 * sizeof(QByteArrayData) }, -
250{ { { (-1) } }, 3, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 69 - 6 * sizeof(QByteArrayData) }, -
251{ { { (-1) } }, 4, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 73 - 7 * sizeof(QByteArrayData) }, -
252{ { { (-1) } }, 9, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 78 - 8 * sizeof(QByteArrayData) }, -
253{ { { (-1) } }, 6, 0, 0, __builtin_offsetof (qt_meta_stringdata_QDBusAdaptorConnector_t, stringdata) + 88 - 9 * sizeof(QByteArrayData) } -
254 }, -
255 "QDBusAdaptorConnector\0relaySignal\0\0" -
256 "obj\0const QMetaObject*\0metaObject\0sid\0" -
257 "args\0relaySlot\0polish\0" -
258}; -
259 -
260 -
261static const uint qt_meta_data_QDBusAdaptorConnector[] = { -
262 -
263 -
264 7, -
265 0, -
266 0, 0, -
267 3, 14, -
268 0, 0, -
269 0, 0, -
270 0, 0, -
271 0, -
272 1, -
273 -
274 -
275 1, 4, 29, 2, 0x05, -
276 -
277 -
278 8, 0, 38, 2, 0x0a, -
279 9, 0, 39, 2, 0x0a, -
280 -
281 -
282 QMetaType::Void, QMetaType::QObjectStar, 0x80000000 | 4, QMetaType::Int, QMetaType::QVariantList, 3, 5, 6, 7, -
283 -
284 -
285 QMetaType::Void, -
286 QMetaType::Void, -
287 -
288 0 -
289}; -
290 -
291void QDBusAdaptorConnector::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) -
292{ -
293 if (_c == QMetaObject::InvokeMetaMethod) { -
294 qt_noop(); -
295 QDBusAdaptorConnector *_t = static_cast<QDBusAdaptorConnector *>(_o); -
296 switch (_id) { -
297 case 0: _t->relaySignal((*reinterpret_cast< QObject*(*)>(_a[1])),(*reinterpret_cast< const QMetaObject*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QVariantList(*)>(_a[4]))); break; -
298 case 1: _t->relaySlot(_a); break; -
299 case 2: _t->polish(); break; -
300 default: ; -
301 } -
302 } -
303} -
304 -
305const QMetaObject QDBusAdaptorConnector::staticMetaObject = { -
306 { &QObject::staticMetaObject, qt_meta_stringdata_QDBusAdaptorConnector.data, -
307 qt_meta_data_QDBusAdaptorConnector, qt_static_metacall, 0, 0 } -
308}; -
309 -
310const QMetaObject *QDBusAdaptorConnector::metaObject() const -
311{ -
312 return &staticMetaObject; -
313} -
314 -
315void *QDBusAdaptorConnector::qt_metacast(const char *_clname) -
316{ -
317 if (!_clname) return 0; -
318 if (!strcmp(_clname, qt_meta_stringdata_QDBusAdaptorConnector.stringdata)) -
319 return static_cast<void*>(const_cast< QDBusAdaptorConnector*>(this)); -
320 return QObject::qt_metacast(_clname); -
321} -
322 -
323int QDBusAdaptorConnector::qt_metacall(QMetaObject::Call _c, int _id, void **_a) -
324{ -
325 _id = QObject::qt_metacall(_c, _id, _a); -
326 if (_id < 0) -
327 return _id; -
328 if (_c == QMetaObject::InvokeMetaMethod) { -
329 if (_id < 3) -
330 qt_static_metacall(this, _c, _id, _a); -
331 _id -= 3; -
332 } -
333 return _id; -
334} -
335 -
336 -
337void QDBusAdaptorConnector::relaySignal(QObject * _t1, const QMetaObject * _t2, int _t3, const QVariantList & _t4) -
338{ -
339 void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) }; -
340 QMetaObject::activate(this, &staticMetaObject, 0, _a); -
341}
executed: }
Execution Count:92
92
342 -
343 -
344 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial