qdbusmetaobject.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9class QDBusMetaObjectGenerator -
10{ -
11public: -
12 QDBusMetaObjectGenerator(const QString &interface, -
13 const QDBusIntrospection::Interface *parsedData); -
14 void write(QDBusMetaObject *obj); -
15 void writeWithoutXml(QDBusMetaObject *obj); -
16 -
17private: -
18 struct Method { -
19 QList<QByteArray> parameterNames; -
20 QByteArray tag; -
21 QByteArray name; -
22 QVarLengthArray<int, 4> inputTypes; -
23 QVarLengthArray<int, 4> outputTypes; -
24 int flags; -
25 }; -
26 -
27 struct Property { -
28 QByteArray typeName; -
29 QByteArray signature; -
30 int type; -
31 int flags; -
32 }; -
33 struct Type { -
34 int id; -
35 QByteArray name; -
36 }; -
37 -
38 QMap<QByteArray, Method> signals_; -
39 QMap<QByteArray, Method> methods; -
40 QMap<QByteArray, Property> properties; -
41 -
42 const QDBusIntrospection::Interface *data; -
43 QString interface; -
44 -
45 Type findType(const QByteArray &signature, -
46 const QDBusIntrospection::Annotations &annotations, -
47 const char *direction = "Out", int id = -1); -
48 -
49 void parseMethods(); -
50 void parseSignals(); -
51 void parseProperties(); -
52 -
53 static int aggregateParameterCount(const QMap<QByteArray, Method> &map); -
54}; -
55 -
56static const int intsPerProperty = 2; -
57static const int intsPerMethod = 2; -
58 -
59struct QDBusMetaObjectPrivate : public QMetaObjectPrivate -
60{ -
61 int propertyDBusData; -
62 int methodDBusData; -
63}; -
64 -
65QDBusMetaObjectGenerator::QDBusMetaObjectGenerator(const QString &interfaceName, -
66 const QDBusIntrospection::Interface *parsedData) -
67 : data(parsedData), interface(interfaceName) -
68{ -
69 if (data) {
partially evaluated: data
TRUEFALSE
yes
Evaluation Count:142
no
Evaluation Count:0
0-142
70 parseProperties(); -
71 parseSignals(); -
72 parseMethods(); -
73 }
executed: }
Execution Count:142
142
74}
executed: }
Execution Count:142
142
75 -
76__attribute__((visibility("default"))) bool qt_dbus_metaobject_skip_annotations = false; -
77 -
78QDBusMetaObjectGenerator::Type -
79QDBusMetaObjectGenerator::findType(const QByteArray &signature, -
80 const QDBusIntrospection::Annotations &annotations, -
81 const char *direction, int id) -
82{ -
83 struct QDBusRawTypeHandler { -
84 static void destroy(void *) -
85 { -
86 QMessageLogger("qdbusmetaobject.cpp", 140, __PRETTY_FUNCTION__).fatal("Cannot destroy placeholder type QDBusRawType"); -
87 }
never executed: }
0
88 -
89 static void *create(const void *) -
90 { -
91 QMessageLogger("qdbusmetaobject.cpp", 145, __PRETTY_FUNCTION__).fatal("Cannot create placeholder type QDBusRawType"); -
92 return 0;
never executed: return 0;
0
93 } -
94 -
95 static void destruct(void *) -
96 { -
97 QMessageLogger("qdbusmetaobject.cpp", 151, __PRETTY_FUNCTION__).fatal("Cannot destruct placeholder type QDBusRawType"); -
98 }
never executed: }
0
99 -
100 static void *construct(void *, const void *) -
101 { -
102 QMessageLogger("qdbusmetaobject.cpp", 156, __PRETTY_FUNCTION__).fatal("Cannot construct placeholder type QDBusRawType"); -
103 return 0;
never executed: return 0;
0
104 } -
105 }; -
106 -
107 Type result; -
108 result.id = QVariant::Invalid; -
109 -
110 int type = QDBusMetaType::signatureToType(signature); -
111 if (type == QVariant::Invalid && !qt_dbus_metaobject_skip_annotations) {
evaluated: type == QVariant::Invalid
TRUEFALSE
yes
Evaluation Count:187
yes
Evaluation Count:975
partially evaluated: !qt_dbus_metaobject_skip_annotations
TRUEFALSE
yes
Evaluation Count:187
no
Evaluation Count:0
0-975
112 -
113 -
114 QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName"); -
115 if (id >= 0)
evaluated: id >= 0
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:6
6-181
116 annotationName += QString::fromLatin1(".%1%2") 181
117 .arg(QLatin1String(direction)) 181
118 .arg(id);
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:181
181
119 -
120 -
121 QByteArray typeName = annotations.value(annotationName).toLatin1(); -
122 -
123 -
124 if (typeName.isEmpty()) {
evaluated: typeName.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:182
5-182
125 -
126 annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName"); -
127 if (id >= 0)
evaluated: id >= 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
128 annotationName += QString::fromLatin1(".%1%2") 4
129 .arg(QLatin1String(direction)) 4
130 .arg(id);
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:4
4
131 typeName = annotations.value(annotationName).toLatin1(); -
132 }
executed: }
Execution Count:5
5
133 -
134 if (!typeName.isEmpty()) {
evaluated: !typeName.isEmpty()
TRUEFALSE
yes
Evaluation Count:183
yes
Evaluation Count:4
4-183
135 -
136 type = QMetaType::type(typeName); -
137 }
executed: }
Execution Count:183
183
138 -
139 if (type == QVariant::Invalid || signature != QDBusMetaType::typeToSignature(type)) {
evaluated: type == QVariant::Invalid
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:183
partially evaluated: signature != QDBusMetaType::typeToSignature(type)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:183
0-183
140 -
141 -
142 typeName = "QDBusRawType<0x" + signature.toHex() + ">*"; -
143 type = QMetaType::registerType(typeName, QDBusRawTypeHandler::destroy, -
144 QDBusRawTypeHandler::create, -
145 QDBusRawTypeHandler::destruct, -
146 QDBusRawTypeHandler::construct, -
147 sizeof(void *), -
148 QMetaType::MovableType, -
149 0); -
150 }
executed: }
Execution Count:4
4
151 -
152 result.name = typeName; -
153 } else if (type == QVariant::Invalid) {
executed: }
Execution Count:187
partially evaluated: type == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:975
0-975
154 -
155 -
156 -
157 if (signature == "av") {
never evaluated: signature == "av"
0
158 result.name = "QVariantList"; -
159 type = QVariant::List; -
160 } else if (signature == "a{sv}") {
never evaluated: signature == "a{sv}"
never executed: }
0
161 result.name = "QVariantMap"; -
162 type = QVariant::Map; -
163 } else {
never executed: }
0
164 result.name = "QDBusRawType::" + signature; -
165 type = -1; -
166 }
never executed: }
0
167 } else { -
168 result.name = QMetaType::typeName(type); -
169 }
executed: }
Execution Count:975
975
170 -
171 result.id = type; -
172 return result;
executed: return result;
Execution Count:1162
1162
173} -
174 -
175void QDBusMetaObjectGenerator::parseMethods() -
176{ -
177 -
178 -
179 -
180 -
181 -
182 QDBusIntrospection::Methods::ConstIterator method_it = data->methods.constBegin(); -
183 QDBusIntrospection::Methods::ConstIterator method_end = data->methods.constEnd(); -
184 for ( ; method_it != method_end; ++method_it) {
evaluated: method_it != method_end
TRUEFALSE
yes
Evaluation Count:950
yes
Evaluation Count:142
142-950
185 const QDBusIntrospection::Method &m = *method_it; -
186 Method mm; -
187 -
188 mm.name = m.name.toLatin1(); -
189 QByteArray prototype = mm.name; -
190 prototype += '('; -
191 -
192 bool ok = true; -
193 -
194 -
195 for (int i = 0; i < m.inputArgs.count(); ++i) {
evaluated: i < m.inputArgs.count()
TRUEFALSE
yes
Evaluation Count:510
yes
Evaluation Count:950
510-950
196 const QDBusIntrospection::Argument &arg = m.inputArgs.at(i); -
197 -
198 Type type = findType(arg.type.toLatin1(), m.annotations, "In", i); -
199 if (type.id == QVariant::Invalid) {
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:510
0-510
200 ok = false; -
201 break;
never executed: break;
0
202 } -
203 -
204 mm.inputTypes.append(type.id); -
205 -
206 mm.parameterNames.append(arg.name.toLatin1()); -
207 -
208 prototype.append(type.name); -
209 prototype.append(','); -
210 }
executed: }
Execution Count:510
510
211 if (!ok) continue;
never executed: continue;
partially evaluated: !ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:950
0-950
212 -
213 -
214 for (int i = 0; i < m.outputArgs.count(); ++i) {
evaluated: i < m.outputArgs.count()
TRUEFALSE
yes
Evaluation Count:509
yes
Evaluation Count:950
509-950
215 const QDBusIntrospection::Argument &arg = m.outputArgs.at(i); -
216 -
217 Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i); -
218 if (type.id == QVariant::Invalid) {
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:509
0-509
219 ok = false; -
220 break;
never executed: break;
0
221 } -
222 -
223 mm.outputTypes.append(type.id); -
224 -
225 if (i != 0) {
evaluated: i != 0
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:490
19-490
226 -
227 mm.parameterNames.append(arg.name.toLatin1()); -
228 -
229 prototype.append(type.name); -
230 prototype.append("&,"); -
231 }
executed: }
Execution Count:19
19
232 }
executed: }
Execution Count:509
509
233 if (!ok) continue;
never executed: continue;
partially evaluated: !ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:950
0-950
234 -
235 -
236 if (!mm.parameterNames.isEmpty())
evaluated: !mm.parameterNames.isEmpty()
TRUEFALSE
yes
Evaluation Count:464
yes
Evaluation Count:486
464-486
237 prototype[prototype.length() - 1] = ')';
executed: prototype[prototype.length() - 1] = ')';
Execution Count:464
464
238 else -
239 prototype.append(')');
executed: prototype.append(')');
Execution Count:486
486
240 -
241 -
242 if (m.annotations.value(QLatin1String("org.freedesktop.DBus.Method.NoReply")) == QLatin1String("true"))
evaluated: m.annotations.value(QLatin1String("org.freedesktop.DBus.Method.NoReply")) == QLatin1String("true")
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:949
1-949
243 mm.tag = "Q_NOREPLY";
executed: mm.tag = "Q_NOREPLY";
Execution Count:1
1
244 -
245 -
246 mm.flags = AccessPublic | MethodSlot | MethodScriptable; -
247 -
248 -
249 methods.insert(QMetaObject::normalizedSignature(prototype), mm); -
250 }
executed: }
Execution Count:950
950
251}
executed: }
Execution Count:142
142
252 -
253void QDBusMetaObjectGenerator::parseSignals() -
254{ -
255 QDBusIntrospection::Signals::ConstIterator signal_it = data->signals_.constBegin(); -
256 QDBusIntrospection::Signals::ConstIterator signal_end = data->signals_.constEnd(); -
257 for ( ; signal_it != signal_end; ++signal_it) {
evaluated: signal_it != signal_end
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:142
81-142
258 const QDBusIntrospection::Signal &s = *signal_it; -
259 Method mm; -
260 -
261 mm.name = s.name.toLatin1(); -
262 QByteArray prototype = mm.name; -
263 prototype += '('; -
264 -
265 bool ok = true; -
266 -
267 -
268 for (int i = 0; i < s.outputArgs.count(); ++i) {
evaluated: i < s.outputArgs.count()
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:81
55-81
269 const QDBusIntrospection::Argument &arg = s.outputArgs.at(i); -
270 -
271 Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i); -
272 if (type.id == QVariant::Invalid) {
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
273 ok = false; -
274 break;
never executed: break;
0
275 } -
276 -
277 mm.inputTypes.append(type.id); -
278 -
279 mm.parameterNames.append(arg.name.toLatin1()); -
280 -
281 prototype.append(type.name); -
282 prototype.append(','); -
283 }
executed: }
Execution Count:55
55
284 if (!ok) continue;
never executed: continue;
partially evaluated: !ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:81
0-81
285 -
286 -
287 if (!mm.parameterNames.isEmpty())
evaluated: !mm.parameterNames.isEmpty()
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:27
27-54
288 prototype[prototype.length() - 1] = ')';
executed: prototype[prototype.length() - 1] = ')';
Execution Count:54
54
289 else -
290 prototype.append(')');
executed: prototype.append(')');
Execution Count:27
27
291 -
292 -
293 mm.flags = AccessProtected | MethodSignal | MethodScriptable; -
294 -
295 -
296 signals_.insert(QMetaObject::normalizedSignature(prototype), mm); -
297 }
executed: }
Execution Count:81
81
298}
executed: }
Execution Count:142
142
299 -
300void QDBusMetaObjectGenerator::parseProperties() -
301{ -
302 QDBusIntrospection::Properties::ConstIterator prop_it = data->properties.constBegin(); -
303 QDBusIntrospection::Properties::ConstIterator prop_end = data->properties.constEnd(); -
304 for ( ; prop_it != prop_end; ++prop_it) {
evaluated: prop_it != prop_end
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:142
88-142
305 const QDBusIntrospection::Property &p = *prop_it; -
306 Property mp; -
307 Type type = findType(p.type.toLatin1(), p.annotations); -
308 if (type.id == QVariant::Invalid)
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:88
0-88
309 continue;
never executed: continue;
0
310 -
311 QByteArray name = p.name.toLatin1(); -
312 mp.signature = p.type.toLatin1(); -
313 mp.type = type.id; -
314 mp.typeName = type.name; -
315 -
316 -
317 mp.flags = StdCppSet | Scriptable | Stored | Designable; -
318 if (p.access != QDBusIntrospection::Property::Write)
evaluated: p.access != QDBusIntrospection::Property::Write
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:2
2-86
319 mp.flags |= Readable;
executed: mp.flags |= Readable;
Execution Count:86
86
320 if (p.access != QDBusIntrospection::Property::Read)
evaluated: p.access != QDBusIntrospection::Property::Read
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:35
35-53
321 mp.flags |= Writable;
executed: mp.flags |= Writable;
Execution Count:53
53
322 -
323 -
324 properties.insert(name, mp); -
325 }
executed: }
Execution Count:88
88
326}
executed: }
Execution Count:142
142
327 -
328 -
329 -
330 -
331int QDBusMetaObjectGenerator::aggregateParameterCount(const QMap<QByteArray, Method> &map) -
332{ -
333 int sum = 0; -
334 QMap<QByteArray, Method>::const_iterator it; -
335 for (it = map.constBegin(); it != map.constEnd(); ++it) {
evaluated: it != map.constEnd()
TRUEFALSE
yes
Evaluation Count:1031
yes
Evaluation Count:284
284-1031
336 const Method &m = it.value(); -
337 sum += m.inputTypes.size() + qMax(1, m.outputTypes.size()); -
338 }
executed: }
Execution Count:1031
1031
339 return sum;
executed: return sum;
Execution Count:284
284
340} -
341 -
342void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj) -
343{ -
344 -
345 -
346 -
347 QString className = interface; -
348 className.replace(QLatin1Char('.'), QLatin1String("::")); -
349 if (className.isEmpty())
partially evaluated: className.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:142
0-142
350 className = QLatin1String("QDBusInterface");
never executed: className = QLatin1String("QDBusInterface");
0
351 -
352 QVarLengthArray<int> idata; -
353 idata.resize(sizeof(QDBusMetaObjectPrivate) / sizeof(int)); -
354 -
355 int methodParametersDataSize = -
356 ((aggregateParameterCount(signals_) -
357 + aggregateParameterCount(methods)) * 2) -
358 - signals_.count() -
359 - methods.count(); -
360 -
361 QDBusMetaObjectPrivate *header = reinterpret_cast<QDBusMetaObjectPrivate *>(idata.data()); -
362 static_assert(bool(QMetaObjectPrivate::OutputRevision == 7), "QtDBus meta-object generator should generate the same version as moc"); -
363 header->revision = QMetaObjectPrivate::OutputRevision; -
364 header->className = 0; -
365 header->classInfoCount = 0; -
366 header->classInfoData = 0; -
367 header->methodCount = signals_.count() + methods.count(); -
368 header->methodData = idata.size(); -
369 header->propertyCount = properties.count(); -
370 header->propertyData = header->methodData + header->methodCount * 5 + methodParametersDataSize; -
371 header->enumeratorCount = 0; -
372 header->enumeratorData = 0; -
373 header->constructorCount = 0; -
374 header->constructorData = 0; -
375 header->flags = RequiresVariantMetaObject; -
376 header->signalCount = signals_.count(); -
377 -
378 header->propertyDBusData = header->propertyData + header->propertyCount * 3; -
379 header->methodDBusData = header->propertyDBusData + header->propertyCount * intsPerProperty; -
380 -
381 int data_size = idata.size() + -
382 (header->methodCount * (5+intsPerMethod)) + methodParametersDataSize + -
383 (header->propertyCount * (3+intsPerProperty)); -
384 for (QForeachContainer<__typeof__(signals_)> _container_(signals_); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const Method &mm = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
385 data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
executed: data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
Execution Count:81
81
386 for (QForeachContainer<__typeof__(methods)> _container_(methods); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const Method &mm = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
387 data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
executed: data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
Execution Count:950
950
388 idata.resize(data_size + 1); -
389 -
390 QMetaStringTable strings; -
391 strings.enter(className.toLatin1()); -
392 -
393 int offset = header->methodData; -
394 int parametersOffset = offset + header->methodCount * 5; -
395 int signatureOffset = header->methodDBusData; -
396 int typeidOffset = header->methodDBusData + header->methodCount * intsPerMethod; -
397 idata[typeidOffset++] = 0; -
398 -
399 -
400 for (int x = 0; x < 2; ++x) {
evaluated: x < 2
TRUEFALSE
yes
Evaluation Count:284
yes
Evaluation Count:142
142-284
401 -
402 QMap<QByteArray, Method> &map = (x == 0) ? signals_ : methods;
evaluated: (x == 0)
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:142
142
403 for (QMap<QByteArray, Method>::ConstIterator it = map.constBegin(); -
404 it != map.constEnd(); ++it) {
evaluated: it != map.constEnd()
TRUEFALSE
yes
Evaluation Count:1031
yes
Evaluation Count:284
284-1031
405 const Method &mm = it.value(); -
406 -
407 int argc = mm.inputTypes.size() + qMax(0, mm.outputTypes.size() - 1); -
408 -
409 idata[offset++] = strings.enter(mm.name); -
410 idata[offset++] = argc; -
411 idata[offset++] = parametersOffset; -
412 idata[offset++] = strings.enter(mm.tag); -
413 idata[offset++] = mm.flags; -
414 -
415 -
416 for (int i = -1; i < argc; ++i) {
evaluated: i < argc
TRUEFALSE
yes
Evaluation Count:1615
yes
Evaluation Count:1031
1031-1615
417 int type; -
418 QByteArray typeName; -
419 if (i < 0) {
evaluated: i < 0
TRUEFALSE
yes
Evaluation Count:1031
yes
Evaluation Count:584
584-1031
420 if (!mm.outputTypes.isEmpty())
evaluated: !mm.outputTypes.isEmpty()
TRUEFALSE
yes
Evaluation Count:490
yes
Evaluation Count:541
490-541
421 type = mm.outputTypes.first();
executed: type = mm.outputTypes.first();
Execution Count:490
490
422 else -
423 type = QMetaType::Void;
executed: type = QMetaType::Void;
Execution Count:541
541
424 } else if (i < mm.inputTypes.size()) {
evaluated: i < mm.inputTypes.size()
TRUEFALSE
yes
Evaluation Count:565
yes
Evaluation Count:19
19-565
425 type = mm.inputTypes.at(i); -
426 } else {
executed: }
Execution Count:565
565
427 qt_noop(); -
428 type = mm.outputTypes.at(i - mm.inputTypes.size() + 1); -
429 -
430 typeName = QMetaType::typeName(type); -
431 typeName.append('&'); -
432 }
executed: }
Execution Count:19
19
433 qt_noop(); -
434 int typeInfo; -
435 if (!typeName.isEmpty())
evaluated: !typeName.isEmpty()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:1596
19-1596
436 typeInfo = IsUnresolvedType | strings.enter(typeName);
executed: typeInfo = IsUnresolvedType | strings.enter(typeName);
Execution Count:19
19
437 else -
438 typeInfo = type;
executed: typeInfo = type;
Execution Count:1596
1596
439 idata[parametersOffset++] = typeInfo; -
440 }
executed: }
Execution Count:1615
1615
441 -
442 for (int i = 0; i < argc; ++i)
evaluated: i < argc
TRUEFALSE
yes
Evaluation Count:584
yes
Evaluation Count:1031
584-1031
443 idata[parametersOffset++] = strings.enter(mm.parameterNames.at(i));
executed: idata[parametersOffset++] = strings.enter(mm.parameterNames.at(i));
Execution Count:584
584
444 -
445 idata[signatureOffset++] = typeidOffset; -
446 idata[typeidOffset++] = mm.inputTypes.count(); -
447 memcpy(idata.data() + typeidOffset, mm.inputTypes.data(), mm.inputTypes.count() * sizeof(int)); -
448 typeidOffset += mm.inputTypes.count(); -
449 -
450 idata[signatureOffset++] = typeidOffset; -
451 idata[typeidOffset++] = mm.outputTypes.count(); -
452 memcpy(idata.data() + typeidOffset, mm.outputTypes.data(), mm.outputTypes.count() * sizeof(int)); -
453 typeidOffset += mm.outputTypes.count(); -
454 }
executed: }
Execution Count:1031
1031
455 }
executed: }
Execution Count:284
284
456 -
457 qt_noop(); -
458 qt_noop(); -
459 qt_noop(); -
460 qt_noop(); -
461 offset += methodParametersDataSize; -
462 qt_noop(); -
463 -
464 -
465 signatureOffset = header->propertyDBusData; -
466 for (QMap<QByteArray, Property>::ConstIterator it = properties.constBegin(); -
467 it != properties.constEnd(); ++it) {
evaluated: it != properties.constEnd()
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:142
88-142
468 const Property &mp = it.value(); -
469 -
470 -
471 idata[offset++] = strings.enter(it.key()); -
472 qt_noop(); -
473 idata[offset++] = mp.type; -
474 idata[offset++] = mp.flags; -
475 -
476 idata[signatureOffset++] = strings.enter(mp.signature); -
477 idata[signatureOffset++] = mp.type; -
478 }
executed: }
Execution Count:88
88
479 -
480 qt_noop(); -
481 qt_noop(); -
482 -
483 char *string_data = new char[strings.blobSize()]; -
484 strings.writeBlob(string_data); -
485 -
486 uint *uint_data = new uint[idata.size()]; -
487 memcpy(uint_data, idata.data(), idata.size() * sizeof(int)); -
488 -
489 -
490 obj->d.data = uint_data; -
491 obj->d.relatedMetaObjects = 0; -
492 obj->d.static_metacall = 0; -
493 obj->d.extradata = 0; -
494 obj->d.stringdata = reinterpret_cast<const QByteArrayData *>(string_data); -
495 obj->d.superdata = &QDBusAbstractInterface::staticMetaObject; -
496}
executed: }
Execution Count:142
142
497QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, const QString &xml, -
498 QHash<QString, QDBusMetaObject *> &cache, -
499 QDBusError &error) -
500{ -
501 error = QDBusError(); -
502 QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml); -
503 -
504 QDBusMetaObject *we = 0; -
505 QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin(); -
506 QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd(); -
507 for ( ; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:394
yes
Evaluation Count:137
137-394
508 -
509 bool us = it.key() == interface; -
510 -
511 QDBusMetaObject *obj = cache.value(it.key(), 0); -
512 if ( !obj && ( us || !interface.startsWith( QLatin1String("local.") ) ) ) {
evaluated: !obj
TRUEFALSE
yes
Evaluation Count:331
yes
Evaluation Count:63
evaluated: us
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:229
evaluated: !interface.startsWith( QLatin1String("local.") )
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:192
37-331
513 -
514 obj = new QDBusMetaObject; -
515 QDBusMetaObjectGenerator generator(it.key(), it.value().constData()); -
516 generator.write(obj); -
517 -
518 if ( (obj->cached = !it.key().startsWith( QLatin1String("local.") )) )
evaluated: (obj->cached = !it.key().startsWith( QLatin1String("local.") ))
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:101
38-101
519 -
520 cache.insert(it.key(), obj);
executed: cache.insert(it.key(), obj);
Execution Count:38
38
521 else if (!us)
evaluated: !us
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:94
7-94
522 delete obj;
executed: delete obj;
Execution Count:7
7
523 -
524 } -
525 -
526 if (us)
evaluated: us
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:292
102-292
527 -
528 we = obj;
executed: we = obj;
Execution Count:102
102
529 }
executed: }
Execution Count:394
394
530 -
531 if (we)
evaluated: we
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:35
35-102
532 return we;
executed: return we;
Execution Count:102
102
533 -
534 -
535 if (parsed.isEmpty()) {
partially evaluated: parsed.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
536 -
537 we = new QDBusMetaObject; -
538 QDBusMetaObjectGenerator generator(interface, 0); -
539 generator.write(we); -
540 we->cached = false; -
541 return we;
never executed: return we;
0
542 } else if (interface.isEmpty()) {
evaluated: interface.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:32
3-32
543 -
544 it = parsed.constBegin(); -
545 QDBusIntrospection::Interface merged = *it.value().constData(); -
546 -
547 for (++it; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
548 merged.annotations.unite(it.value()->annotations); -
549 merged.methods.unite(it.value()->methods); -
550 merged.signals_.unite(it.value()->signals_); -
551 merged.properties.unite(it.value()->properties); -
552 }
executed: }
Execution Count:9
9
553 -
554 merged.name = QLatin1String("local.Merged"); -
555 merged.introspection.clear(); -
556 -
557 we = new QDBusMetaObject; -
558 QDBusMetaObjectGenerator generator(merged.name, &merged); -
559 generator.write(we); -
560 we->cached = false; -
561 return we;
executed: return we;
Execution Count:3
3
562 } -
563 -
564 -
565 error = QDBusError(QDBusError::UnknownInterface, -
566 QString::fromLatin1("Interface '%1' was not found") -
567 .arg(interface)); -
568 return 0;
executed: return 0;
Execution Count:32
32
569} -
570 -
571QDBusMetaObject::QDBusMetaObject() -
572{ -
573} -
574 -
575static inline const QDBusMetaObjectPrivate *priv(const uint* data) -
576{ -
577 return reinterpret_cast<const QDBusMetaObjectPrivate *>(data);
executed: return reinterpret_cast<const QDBusMetaObjectPrivate *>(data);
Execution Count:64
64
578} -
579 -
580const int *QDBusMetaObject::inputTypesForMethod(int id) const -
581{ -
582 -
583 if (id >= 0 && id < priv(d.data)->methodCount) {
partially evaluated: id >= 0
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
partially evaluated: id < priv(d.data)->methodCount
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
584 int handle = priv(d.data)->methodDBusData + id*intsPerMethod; -
585 return reinterpret_cast<const int*>(d.data + d.data[handle]);
executed: return reinterpret_cast<const int*>(d.data + d.data[handle]);
Execution Count:16
16
586 } -
587 return 0;
never executed: return 0;
0
588} -
589 -
590const int *QDBusMetaObject::outputTypesForMethod(int id) const -
591{ -
592 -
593 if (id >= 0 && id < priv(d.data)->methodCount) {
partially evaluated: id >= 0
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
partially evaluated: id < priv(d.data)->methodCount
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
594 int handle = priv(d.data)->methodDBusData + id*intsPerMethod; -
595 return reinterpret_cast<const int*>(d.data + d.data[handle + 1]);
executed: return reinterpret_cast<const int*>(d.data + d.data[handle + 1]);
Execution Count:16
16
596 } -
597 return 0;
never executed: return 0;
0
598} -
599 -
600int QDBusMetaObject::propertyMetaType(int id) const -
601{ -
602 -
603 if (id >= 0 && id < priv(d.data)->propertyCount) {
never evaluated: id >= 0
never evaluated: id < priv(d.data)->propertyCount
0
604 int handle = priv(d.data)->propertyDBusData + id*intsPerProperty; -
605 return d.data[handle + 1];
never executed: return d.data[handle + 1];
0
606 } -
607 return 0;
never executed: return 0;
0
608} -
609 -
610 -
611 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial