qdbusmetaobject.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtDBus module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qdbusmetaobject_p.h" -
43 -
44#include <QtCore/qbytearray.h> -
45#include <QtCore/qhash.h> -
46#include <QtCore/qstring.h> -
47#include <QtCore/qvarlengtharray.h> -
48 -
49#include "qdbusutil_p.h" -
50#include "qdbuserror.h" -
51#include "qdbusmetatype.h" -
52#include "qdbusargument.h" -
53#include "qdbusintrospection_p.h" -
54#include "qdbusabstractinterface_p.h" -
55 -
56#include <private/qmetaobject_p.h> -
57#include <private/qmetaobjectbuilder_p.h> -
58 -
59#ifndef QT_NO_DBUS -
60 -
61QT_BEGIN_NAMESPACE -
62 -
63class QDBusMetaObjectGenerator -
64{ -
65public: -
66 QDBusMetaObjectGenerator(const QString &interface, -
67 const QDBusIntrospection::Interface *parsedData); -
68 void write(QDBusMetaObject *obj); -
69 void writeWithoutXml(QDBusMetaObject *obj); -
70 -
71private: -
72 struct Method { -
73 QList<QByteArray> parameterNames; -
74 QByteArray tag; -
75 QByteArray name; -
76 QVarLengthArray<int, 4> inputTypes; -
77 QVarLengthArray<int, 4> outputTypes; -
78 int flags; -
79 }; -
80 -
81 struct Property { -
82 QByteArray typeName; -
83 QByteArray signature; -
84 int type; -
85 int flags; -
86 }; -
87 struct Type { -
88 int id; -
89 QByteArray name; -
90 }; -
91 -
92 QMap<QByteArray, Method> signals_; -
93 QMap<QByteArray, Method> methods; -
94 QMap<QByteArray, Property> properties; -
95 -
96 const QDBusIntrospection::Interface *data; -
97 QString interface; -
98 -
99 Type findType(const QByteArray &signature, -
100 const QDBusIntrospection::Annotations &annotations, -
101 const char *direction = "Out", int id = -1); -
102 -
103 void parseMethods(); -
104 void parseSignals(); -
105 void parseProperties(); -
106 -
107 static int aggregateParameterCount(const QMap<QByteArray, Method> &map); -
108}; -
109 -
110static const int intsPerProperty = 2; -
111static const int intsPerMethod = 2; -
112 -
113struct QDBusMetaObjectPrivate : public QMetaObjectPrivate -
114{ -
115 int propertyDBusData; -
116 int methodDBusData; -
117}; -
118 -
119QDBusMetaObjectGenerator::QDBusMetaObjectGenerator(const QString &interfaceName, -
120 const QDBusIntrospection::Interface *parsedData) -
121 : data(parsedData), interface(interfaceName) -
122{ -
123 if (data) {
partially evaluated: data
TRUEFALSE
yes
Evaluation Count:142
no
Evaluation Count:0
0-142
124 parseProperties();
executed (the execution status of this line is deduced): parseProperties();
-
125 parseSignals(); // call parseSignals first so that slots override signals
executed (the execution status of this line is deduced): parseSignals();
-
126 parseMethods();
executed (the execution status of this line is deduced): parseMethods();
-
127 }
executed: }
Execution Count:142
142
128}
executed: }
Execution Count:142
142
129 -
130Q_DBUS_EXPORT bool qt_dbus_metaobject_skip_annotations = false; -
131 -
132QDBusMetaObjectGenerator::Type -
133QDBusMetaObjectGenerator::findType(const QByteArray &signature, -
134 const QDBusIntrospection::Annotations &annotations, -
135 const char *direction, int id) -
136{ -
137 struct QDBusRawTypeHandler {
executed (the execution status of this line is deduced): struct QDBusRawTypeHandler {
-
138 static void destroy(void *)
executed (the execution status of this line is deduced): static void destroy(void *)
-
139 {
executed (the execution status of this line is deduced): {
-
140 qFatal("Cannot destroy placeholder type QDBusRawType");
executed (the execution status of this line is deduced): QMessageLogger("qdbusmetaobject.cpp", 140, __PRETTY_FUNCTION__).fatal("Cannot destroy placeholder type QDBusRawType");
-
141 }
never executed: }
0
142
executed (the execution status of this line is deduced):
-
143 static void *create(const void *)
executed (the execution status of this line is deduced): static void *create(const void *)
-
144 {
executed (the execution status of this line is deduced): {
-
145 qFatal("Cannot create placeholder type QDBusRawType");
executed (the execution status of this line is deduced): QMessageLogger("qdbusmetaobject.cpp", 145, __PRETTY_FUNCTION__).fatal("Cannot create placeholder type QDBusRawType");
-
146 return 0;
never executed: return 0;
0
147 }
executed (the execution status of this line is deduced): }
-
148
executed (the execution status of this line is deduced):
-
149 static void destruct(void *)
executed (the execution status of this line is deduced): static void destruct(void *)
-
150 {
executed (the execution status of this line is deduced): {
-
151 qFatal("Cannot destruct placeholder type QDBusRawType");
executed (the execution status of this line is deduced): QMessageLogger("qdbusmetaobject.cpp", 151, __PRETTY_FUNCTION__).fatal("Cannot destruct placeholder type QDBusRawType");
-
152 }
never executed: }
0
153
executed (the execution status of this line is deduced):
-
154 static void *construct(void *, const void *)
executed (the execution status of this line is deduced): static void *construct(void *, const void *)
-
155 {
executed (the execution status of this line is deduced): {
-
156 qFatal("Cannot construct placeholder type QDBusRawType");
executed (the execution status of this line is deduced): QMessageLogger("qdbusmetaobject.cpp", 156, __PRETTY_FUNCTION__).fatal("Cannot construct placeholder type QDBusRawType");
-
157 return 0;
never executed: return 0;
0
158 }
executed (the execution status of this line is deduced): }
-
159 };
executed (the execution status of this line is deduced): };
-
160 -
161 Type result;
executed (the execution status of this line is deduced): Type result;
-
162 result.id = QVariant::Invalid;
executed (the execution status of this line is deduced): result.id = QVariant::Invalid;
-
163 -
164 int type = QDBusMetaType::signatureToType(signature);
executed (the execution status of this line is deduced): int type = QDBusMetaType::signatureToType(signature);
-
165 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
166 // it's not a type normally handled by our meta type system -
167 // it must contain an annotation -
168 QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName");
executed (the execution status of this line is deduced): QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName");
-
169 if (id >= 0)
evaluated: id >= 0
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:6
6-181
170 annotationName += QString::fromLatin1(".%1%2")
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:181
181
171 .arg(QLatin1String(direction))
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:181
181
172 .arg(id);
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:181
181
173 -
174 // extract from annotations: -
175 QByteArray typeName = annotations.value(annotationName).toLatin1();
executed (the execution status of this line is deduced): QByteArray typeName = annotations.value(annotationName).toLatin1();
-
176 -
177 // verify that it's a valid one -
178 if (typeName.isEmpty()) {
evaluated: typeName.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:182
5-182
179 // try the old annotation from Qt 4 -
180 annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName");
executed (the execution status of this line is deduced): annotationName = QString::fromLatin1("com.trolltech.QtDBus.QtTypeName");
-
181 if (id >= 0)
evaluated: id >= 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
182 annotationName += QString::fromLatin1(".%1%2")
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:4
4
183 .arg(QLatin1String(direction))
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:4
4
184 .arg(id);
executed: annotationName += QString::fromLatin1(".%1%2") .arg(QLatin1String(direction)) .arg(id);
Execution Count:4
4
185 typeName = annotations.value(annotationName).toLatin1();
executed (the execution status of this line is deduced): typeName = annotations.value(annotationName).toLatin1();
-
186 }
executed: }
Execution Count:5
5
187 -
188 if (!typeName.isEmpty()) {
evaluated: !typeName.isEmpty()
TRUEFALSE
yes
Evaluation Count:183
yes
Evaluation Count:4
4-183
189 // type name found -
190 type = QMetaType::type(typeName);
executed (the execution status of this line is deduced): type = QMetaType::type(typeName);
-
191 }
executed: }
Execution Count:183
183
192 -
193 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
194 // type is still unknown or doesn't match back to the signature that it -
195 // was expected to, so synthesize a fake type -
196 typeName = "QDBusRawType<0x" + signature.toHex() + ">*";
executed (the execution status of this line is deduced): typeName = "QDBusRawType<0x" + signature.toHex() + ">*";
-
197 type = QMetaType::registerType(typeName, QDBusRawTypeHandler::destroy,
executed (the execution status of this line is deduced): type = QMetaType::registerType(typeName, QDBusRawTypeHandler::destroy,
-
198 QDBusRawTypeHandler::create,
executed (the execution status of this line is deduced): QDBusRawTypeHandler::create,
-
199 QDBusRawTypeHandler::destruct,
executed (the execution status of this line is deduced): QDBusRawTypeHandler::destruct,
-
200 QDBusRawTypeHandler::construct,
executed (the execution status of this line is deduced): QDBusRawTypeHandler::construct,
-
201 sizeof(void *),
executed (the execution status of this line is deduced): sizeof(void *),
-
202 QMetaType::MovableType,
executed (the execution status of this line is deduced): QMetaType::MovableType,
-
203 0);
executed (the execution status of this line is deduced): 0);
-
204 }
executed: }
Execution Count:4
4
205 -
206 result.name = typeName;
executed (the execution status of this line is deduced): result.name = typeName;
-
207 } 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
208 // this case is used only by the qdbus command-line tool -
209 // invalid, let's create an impossible type that contains the signature -
210 -
211 if (signature == "av") {
never evaluated: signature == "av"
0
212 result.name = "QVariantList";
never executed (the execution status of this line is deduced): result.name = "QVariantList";
-
213 type = QVariant::List;
never executed (the execution status of this line is deduced): type = QVariant::List;
-
214 } else if (signature == "a{sv}") {
never executed: }
never evaluated: signature == "a{sv}"
0
215 result.name = "QVariantMap";
never executed (the execution status of this line is deduced): result.name = "QVariantMap";
-
216 type = QVariant::Map;
never executed (the execution status of this line is deduced): type = QVariant::Map;
-
217 } else {
never executed: }
0
218 result.name = "QDBusRawType::" + signature;
never executed (the execution status of this line is deduced): result.name = "QDBusRawType::" + signature;
-
219 type = -1;
never executed (the execution status of this line is deduced): type = -1;
-
220 }
never executed: }
0
221 } else { -
222 result.name = QMetaType::typeName(type);
executed (the execution status of this line is deduced): result.name = QMetaType::typeName(type);
-
223 }
executed: }
Execution Count:975
975
224 -
225 result.id = type;
executed (the execution status of this line is deduced): result.id = type;
-
226 return result; // success
executed: return result;
Execution Count:1162
1162
227} -
228 -
229void QDBusMetaObjectGenerator::parseMethods() -
230{ -
231 // -
232 // TODO: -
233 // Add cloned methods when the remote object has return types -
234 // -
235 -
236 QDBusIntrospection::Methods::ConstIterator method_it = data->methods.constBegin();
executed (the execution status of this line is deduced): QDBusIntrospection::Methods::ConstIterator method_it = data->methods.constBegin();
-
237 QDBusIntrospection::Methods::ConstIterator method_end = data->methods.constEnd();
executed (the execution status of this line is deduced): QDBusIntrospection::Methods::ConstIterator method_end = data->methods.constEnd();
-
238 for ( ; method_it != method_end; ++method_it) {
evaluated: method_it != method_end
TRUEFALSE
yes
Evaluation Count:950
yes
Evaluation Count:142
142-950
239 const QDBusIntrospection::Method &m = *method_it;
executed (the execution status of this line is deduced): const QDBusIntrospection::Method &m = *method_it;
-
240 Method mm;
executed (the execution status of this line is deduced): Method mm;
-
241 -
242 mm.name = m.name.toLatin1();
executed (the execution status of this line is deduced): mm.name = m.name.toLatin1();
-
243 QByteArray prototype = mm.name;
executed (the execution status of this line is deduced): QByteArray prototype = mm.name;
-
244 prototype += '(';
executed (the execution status of this line is deduced): prototype += '(';
-
245 -
246 bool ok = true;
executed (the execution status of this line is deduced): bool ok = true;
-
247 -
248 // build the input argument list -
249 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
250 const QDBusIntrospection::Argument &arg = m.inputArgs.at(i);
executed (the execution status of this line is deduced): const QDBusIntrospection::Argument &arg = m.inputArgs.at(i);
-
251 -
252 Type type = findType(arg.type.toLatin1(), m.annotations, "In", i);
executed (the execution status of this line is deduced): Type type = findType(arg.type.toLatin1(), m.annotations, "In", i);
-
253 if (type.id == QVariant::Invalid) {
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:510
0-510
254 ok = false;
never executed (the execution status of this line is deduced): ok = false;
-
255 break;
never executed: break;
0
256 } -
257 -
258 mm.inputTypes.append(type.id);
executed (the execution status of this line is deduced): mm.inputTypes.append(type.id);
-
259 -
260 mm.parameterNames.append(arg.name.toLatin1());
executed (the execution status of this line is deduced): mm.parameterNames.append(arg.name.toLatin1());
-
261 -
262 prototype.append(type.name);
executed (the execution status of this line is deduced): prototype.append(type.name);
-
263 prototype.append(',');
executed (the execution status of this line is deduced): prototype.append(',');
-
264 }
executed: }
Execution Count:510
510
265 if (!ok) continue;
never executed: continue;
partially evaluated: !ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:950
0-950
266 -
267 // build the output argument list: -
268 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
269 const QDBusIntrospection::Argument &arg = m.outputArgs.at(i);
executed (the execution status of this line is deduced): const QDBusIntrospection::Argument &arg = m.outputArgs.at(i);
-
270 -
271 Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i);
executed (the execution status of this line is deduced): Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i);
-
272 if (type.id == QVariant::Invalid) {
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:509
0-509
273 ok = false;
never executed (the execution status of this line is deduced): ok = false;
-
274 break;
never executed: break;
0
275 } -
276 -
277 mm.outputTypes.append(type.id);
executed (the execution status of this line is deduced): mm.outputTypes.append(type.id);
-
278 -
279 if (i != 0) {
evaluated: i != 0
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:490
19-490
280 // non-const ref parameter -
281 mm.parameterNames.append(arg.name.toLatin1());
executed (the execution status of this line is deduced): mm.parameterNames.append(arg.name.toLatin1());
-
282 -
283 prototype.append(type.name);
executed (the execution status of this line is deduced): prototype.append(type.name);
-
284 prototype.append("&,");
executed (the execution status of this line is deduced): prototype.append("&,");
-
285 }
executed: }
Execution Count:19
19
286 }
executed: }
Execution Count:509
509
287 if (!ok) continue;
never executed: continue;
partially evaluated: !ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:950
0-950
288 -
289 // convert the last commas: -
290 if (!mm.parameterNames.isEmpty())
evaluated: !mm.parameterNames.isEmpty()
TRUEFALSE
yes
Evaluation Count:464
yes
Evaluation Count:486
464-486
291 prototype[prototype.length() - 1] = ')';
executed: prototype[prototype.length() - 1] = ')';
Execution Count:464
464
292 else -
293 prototype.append(')');
executed: prototype.append(')');
Execution Count:486
486
294 -
295 // check the async tag -
296 if (m.annotations.value(QLatin1String(ANNOTATION_NO_WAIT)) == 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
297 mm.tag = "Q_NOREPLY";
executed: mm.tag = "Q_NOREPLY";
Execution Count:1
1
298 -
299 // meta method flags -
300 mm.flags = AccessPublic | MethodSlot | MethodScriptable;
executed (the execution status of this line is deduced): mm.flags = AccessPublic | MethodSlot | MethodScriptable;
-
301 -
302 // add -
303 methods.insert(QMetaObject::normalizedSignature(prototype), mm);
executed (the execution status of this line is deduced): methods.insert(QMetaObject::normalizedSignature(prototype), mm);
-
304 }
executed: }
Execution Count:950
950
305}
executed: }
Execution Count:142
142
306 -
307void QDBusMetaObjectGenerator::parseSignals() -
308{ -
309 QDBusIntrospection::Signals::ConstIterator signal_it = data->signals_.constBegin();
executed (the execution status of this line is deduced): QDBusIntrospection::Signals::ConstIterator signal_it = data->signals_.constBegin();
-
310 QDBusIntrospection::Signals::ConstIterator signal_end = data->signals_.constEnd();
executed (the execution status of this line is deduced): QDBusIntrospection::Signals::ConstIterator signal_end = data->signals_.constEnd();
-
311 for ( ; signal_it != signal_end; ++signal_it) {
evaluated: signal_it != signal_end
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:142
81-142
312 const QDBusIntrospection::Signal &s = *signal_it;
executed (the execution status of this line is deduced): const QDBusIntrospection::Signal &s = *signal_it;
-
313 Method mm;
executed (the execution status of this line is deduced): Method mm;
-
314 -
315 mm.name = s.name.toLatin1();
executed (the execution status of this line is deduced): mm.name = s.name.toLatin1();
-
316 QByteArray prototype = mm.name;
executed (the execution status of this line is deduced): QByteArray prototype = mm.name;
-
317 prototype += '(';
executed (the execution status of this line is deduced): prototype += '(';
-
318 -
319 bool ok = true;
executed (the execution status of this line is deduced): bool ok = true;
-
320 -
321 // build the output argument list -
322 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
323 const QDBusIntrospection::Argument &arg = s.outputArgs.at(i);
executed (the execution status of this line is deduced): const QDBusIntrospection::Argument &arg = s.outputArgs.at(i);
-
324 -
325 Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i);
executed (the execution status of this line is deduced): Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i);
-
326 if (type.id == QVariant::Invalid) {
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
327 ok = false;
never executed (the execution status of this line is deduced): ok = false;
-
328 break;
never executed: break;
0
329 } -
330 -
331 mm.inputTypes.append(type.id);
executed (the execution status of this line is deduced): mm.inputTypes.append(type.id);
-
332 -
333 mm.parameterNames.append(arg.name.toLatin1());
executed (the execution status of this line is deduced): mm.parameterNames.append(arg.name.toLatin1());
-
334 -
335 prototype.append(type.name);
executed (the execution status of this line is deduced): prototype.append(type.name);
-
336 prototype.append(',');
executed (the execution status of this line is deduced): prototype.append(',');
-
337 }
executed: }
Execution Count:55
55
338 if (!ok) continue;
never executed: continue;
partially evaluated: !ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:81
0-81
339 -
340 // convert the last commas: -
341 if (!mm.parameterNames.isEmpty())
evaluated: !mm.parameterNames.isEmpty()
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:27
27-54
342 prototype[prototype.length() - 1] = ')';
executed: prototype[prototype.length() - 1] = ')';
Execution Count:54
54
343 else -
344 prototype.append(')');
executed: prototype.append(')');
Execution Count:27
27
345 -
346 // meta method flags -
347 mm.flags = AccessProtected | MethodSignal | MethodScriptable;
executed (the execution status of this line is deduced): mm.flags = AccessProtected | MethodSignal | MethodScriptable;
-
348 -
349 // add -
350 signals_.insert(QMetaObject::normalizedSignature(prototype), mm);
executed (the execution status of this line is deduced): signals_.insert(QMetaObject::normalizedSignature(prototype), mm);
-
351 }
executed: }
Execution Count:81
81
352}
executed: }
Execution Count:142
142
353 -
354void QDBusMetaObjectGenerator::parseProperties() -
355{ -
356 QDBusIntrospection::Properties::ConstIterator prop_it = data->properties.constBegin();
executed (the execution status of this line is deduced): QDBusIntrospection::Properties::ConstIterator prop_it = data->properties.constBegin();
-
357 QDBusIntrospection::Properties::ConstIterator prop_end = data->properties.constEnd();
executed (the execution status of this line is deduced): QDBusIntrospection::Properties::ConstIterator prop_end = data->properties.constEnd();
-
358 for ( ; prop_it != prop_end; ++prop_it) {
evaluated: prop_it != prop_end
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:142
88-142
359 const QDBusIntrospection::Property &p = *prop_it;
executed (the execution status of this line is deduced): const QDBusIntrospection::Property &p = *prop_it;
-
360 Property mp;
executed (the execution status of this line is deduced): Property mp;
-
361 Type type = findType(p.type.toLatin1(), p.annotations);
executed (the execution status of this line is deduced): Type type = findType(p.type.toLatin1(), p.annotations);
-
362 if (type.id == QVariant::Invalid)
partially evaluated: type.id == QVariant::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:88
0-88
363 continue;
never executed: continue;
0
364 -
365 QByteArray name = p.name.toLatin1();
executed (the execution status of this line is deduced): QByteArray name = p.name.toLatin1();
-
366 mp.signature = p.type.toLatin1();
executed (the execution status of this line is deduced): mp.signature = p.type.toLatin1();
-
367 mp.type = type.id;
executed (the execution status of this line is deduced): mp.type = type.id;
-
368 mp.typeName = type.name;
executed (the execution status of this line is deduced): mp.typeName = type.name;
-
369 -
370 // build the flags: -
371 mp.flags = StdCppSet | Scriptable | Stored | Designable;
executed (the execution status of this line is deduced): mp.flags = StdCppSet | Scriptable | Stored | Designable;
-
372 if (p.access != QDBusIntrospection::Property::Write)
evaluated: p.access != QDBusIntrospection::Property::Write
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:2
2-86
373 mp.flags |= Readable;
executed: mp.flags |= Readable;
Execution Count:86
86
374 if (p.access != QDBusIntrospection::Property::Read)
evaluated: p.access != QDBusIntrospection::Property::Read
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:35
35-53
375 mp.flags |= Writable;
executed: mp.flags |= Writable;
Execution Count:53
53
376 -
377 // add the property: -
378 properties.insert(name, mp);
executed (the execution status of this line is deduced): properties.insert(name, mp);
-
379 }
executed: }
Execution Count:88
88
380}
executed: }
Execution Count:142
142
381 -
382// Returns the sum of all parameters (including return type) for the given -
383// \a map of methods. This is needed for calculating the size of the methods' -
384// parameter type/name meta-data. -
385int QDBusMetaObjectGenerator::aggregateParameterCount(const QMap<QByteArray, Method> &map) -
386{ -
387 int sum = 0;
executed (the execution status of this line is deduced): int sum = 0;
-
388 QMap<QByteArray, Method>::const_iterator it;
executed (the execution status of this line is deduced): QMap<QByteArray, Method>::const_iterator it;
-
389 for (it = map.constBegin(); it != map.constEnd(); ++it) {
evaluated: it != map.constEnd()
TRUEFALSE
yes
Evaluation Count:1031
yes
Evaluation Count:284
284-1031
390 const Method &m = it.value();
executed (the execution status of this line is deduced): const Method &m = it.value();
-
391 sum += m.inputTypes.size() + qMax(1, m.outputTypes.size());
executed (the execution status of this line is deduced): sum += m.inputTypes.size() + qMax(1, m.outputTypes.size());
-
392 }
executed: }
Execution Count:1031
1031
393 return sum;
executed: return sum;
Execution Count:284
284
394} -
395 -
396void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj) -
397{ -
398 // this code here is mostly copied from qaxbase.cpp -
399 // with a few modifications to make it cleaner -
400 -
401 QString className = interface;
executed (the execution status of this line is deduced): QString className = interface;
-
402 className.replace(QLatin1Char('.'), QLatin1String("::"));
executed (the execution status of this line is deduced): className.replace(QLatin1Char('.'), QLatin1String("::"));
-
403 if (className.isEmpty())
partially evaluated: className.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:142
0-142
404 className = QLatin1String("QDBusInterface");
never executed: className = QLatin1String("QDBusInterface");
0
405 -
406 QVarLengthArray<int> idata;
executed (the execution status of this line is deduced): QVarLengthArray<int> idata;
-
407 idata.resize(sizeof(QDBusMetaObjectPrivate) / sizeof(int));
executed (the execution status of this line is deduced): idata.resize(sizeof(QDBusMetaObjectPrivate) / sizeof(int));
-
408 -
409 int methodParametersDataSize =
executed (the execution status of this line is deduced): int methodParametersDataSize =
-
410 ((aggregateParameterCount(signals_)
executed (the execution status of this line is deduced): ((aggregateParameterCount(signals_)
-
411 + aggregateParameterCount(methods)) * 2) // types and parameter names
executed (the execution status of this line is deduced): + aggregateParameterCount(methods)) * 2)
-
412 - signals_.count() // return "parameters" don't have names
executed (the execution status of this line is deduced): - signals_.count()
-
413 - methods.count(); // ditto
executed (the execution status of this line is deduced): - methods.count();
-
414 -
415 QDBusMetaObjectPrivate *header = reinterpret_cast<QDBusMetaObjectPrivate *>(idata.data());
executed (the execution status of this line is deduced): QDBusMetaObjectPrivate *header = reinterpret_cast<QDBusMetaObjectPrivate *>(idata.data());
-
416 Q_STATIC_ASSERT_X(QMetaObjectPrivate::OutputRevision == 7, "QtDBus meta-object generator should generate the same version as moc");
executed (the execution status of this line is deduced): static_assert(bool(QMetaObjectPrivate::OutputRevision == 7), "QtDBus meta-object generator should generate the same version as moc");
-
417 header->revision = QMetaObjectPrivate::OutputRevision;
executed (the execution status of this line is deduced): header->revision = QMetaObjectPrivate::OutputRevision;
-
418 header->className = 0;
executed (the execution status of this line is deduced): header->className = 0;
-
419 header->classInfoCount = 0;
executed (the execution status of this line is deduced): header->classInfoCount = 0;
-
420 header->classInfoData = 0;
executed (the execution status of this line is deduced): header->classInfoData = 0;
-
421 header->methodCount = signals_.count() + methods.count();
executed (the execution status of this line is deduced): header->methodCount = signals_.count() + methods.count();
-
422 header->methodData = idata.size();
executed (the execution status of this line is deduced): header->methodData = idata.size();
-
423 header->propertyCount = properties.count();
executed (the execution status of this line is deduced): header->propertyCount = properties.count();
-
424 header->propertyData = header->methodData + header->methodCount * 5 + methodParametersDataSize;
executed (the execution status of this line is deduced): header->propertyData = header->methodData + header->methodCount * 5 + methodParametersDataSize;
-
425 header->enumeratorCount = 0;
executed (the execution status of this line is deduced): header->enumeratorCount = 0;
-
426 header->enumeratorData = 0;
executed (the execution status of this line is deduced): header->enumeratorData = 0;
-
427 header->constructorCount = 0;
executed (the execution status of this line is deduced): header->constructorCount = 0;
-
428 header->constructorData = 0;
executed (the execution status of this line is deduced): header->constructorData = 0;
-
429 header->flags = RequiresVariantMetaObject;
executed (the execution status of this line is deduced): header->flags = RequiresVariantMetaObject;
-
430 header->signalCount = signals_.count();
executed (the execution status of this line is deduced): header->signalCount = signals_.count();
-
431 // These are specific to QDBusMetaObject: -
432 header->propertyDBusData = header->propertyData + header->propertyCount * 3;
executed (the execution status of this line is deduced): header->propertyDBusData = header->propertyData + header->propertyCount * 3;
-
433 header->methodDBusData = header->propertyDBusData + header->propertyCount * intsPerProperty;
executed (the execution status of this line is deduced): header->methodDBusData = header->propertyDBusData + header->propertyCount * intsPerProperty;
-
434 -
435 int data_size = idata.size() +
executed (the execution status of this line is deduced): int data_size = idata.size() +
-
436 (header->methodCount * (5+intsPerMethod)) + methodParametersDataSize +
executed (the execution status of this line is deduced): (header->methodCount * (5+intsPerMethod)) + methodParametersDataSize +
-
437 (header->propertyCount * (3+intsPerProperty));
executed (the execution status of this line is deduced): (header->propertyCount * (3+intsPerProperty));
-
438 foreach (const Method &mm, signals_)
executed (the execution status of this line is deduced): 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;}))
-
439 data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
executed: data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
Execution Count:81
81
440 foreach (const Method &mm, methods)
executed (the execution status of this line is deduced): 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;}))
-
441 data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
executed: data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count();
Execution Count:950
950
442 idata.resize(data_size + 1);
executed (the execution status of this line is deduced): idata.resize(data_size + 1);
-
443 -
444 QMetaStringTable strings;
executed (the execution status of this line is deduced): QMetaStringTable strings;
-
445 strings.enter(className.toLatin1());
executed (the execution status of this line is deduced): strings.enter(className.toLatin1());
-
446 -
447 int offset = header->methodData;
executed (the execution status of this line is deduced): int offset = header->methodData;
-
448 int parametersOffset = offset + header->methodCount * 5;
executed (the execution status of this line is deduced): int parametersOffset = offset + header->methodCount * 5;
-
449 int signatureOffset = header->methodDBusData;
executed (the execution status of this line is deduced): int signatureOffset = header->methodDBusData;
-
450 int typeidOffset = header->methodDBusData + header->methodCount * intsPerMethod;
executed (the execution status of this line is deduced): int typeidOffset = header->methodDBusData + header->methodCount * intsPerMethod;
-
451 idata[typeidOffset++] = 0; // eod
executed (the execution status of this line is deduced): idata[typeidOffset++] = 0;
-
452 -
453 // add each method: -
454 for (int x = 0; x < 2; ++x) {
evaluated: x < 2
TRUEFALSE
yes
Evaluation Count:284
yes
Evaluation Count:142
142-284
455 // Signals must be added before other methods, to match moc. -
456 QMap<QByteArray, Method> &map = (x == 0) ? signals_ : methods;
evaluated: (x == 0)
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:142
142
457 for (QMap<QByteArray, Method>::ConstIterator it = map.constBegin();
executed (the execution status of this line is deduced): for (QMap<QByteArray, Method>::ConstIterator it = map.constBegin();
-
458 it != map.constEnd(); ++it) {
evaluated: it != map.constEnd()
TRUEFALSE
yes
Evaluation Count:1031
yes
Evaluation Count:284
284-1031
459 const Method &mm = it.value();
executed (the execution status of this line is deduced): const Method &mm = it.value();
-
460 -
461 int argc = mm.inputTypes.size() + qMax(0, mm.outputTypes.size() - 1);
executed (the execution status of this line is deduced): int argc = mm.inputTypes.size() + qMax(0, mm.outputTypes.size() - 1);
-
462 -
463 idata[offset++] = strings.enter(mm.name);
executed (the execution status of this line is deduced): idata[offset++] = strings.enter(mm.name);
-
464 idata[offset++] = argc;
executed (the execution status of this line is deduced): idata[offset++] = argc;
-
465 idata[offset++] = parametersOffset;
executed (the execution status of this line is deduced): idata[offset++] = parametersOffset;
-
466 idata[offset++] = strings.enter(mm.tag);
executed (the execution status of this line is deduced): idata[offset++] = strings.enter(mm.tag);
-
467 idata[offset++] = mm.flags;
executed (the execution status of this line is deduced): idata[offset++] = mm.flags;
-
468 -
469 // Parameter types -
470 for (int i = -1; i < argc; ++i) {
evaluated: i < argc
TRUEFALSE
yes
Evaluation Count:1615
yes
Evaluation Count:1031
1031-1615
471 int type;
executed (the execution status of this line is deduced): int type;
-
472 QByteArray typeName;
executed (the execution status of this line is deduced): QByteArray typeName;
-
473 if (i < 0) { // Return type
evaluated: i < 0
TRUEFALSE
yes
Evaluation Count:1031
yes
Evaluation Count:584
584-1031
474 if (!mm.outputTypes.isEmpty())
evaluated: !mm.outputTypes.isEmpty()
TRUEFALSE
yes
Evaluation Count:490
yes
Evaluation Count:541
490-541
475 type = mm.outputTypes.first();
executed: type = mm.outputTypes.first();
Execution Count:490
490
476 else -
477 type = QMetaType::Void;
executed: type = QMetaType::Void;
Execution Count:541
541
478 } else if (i < mm.inputTypes.size()) {
evaluated: i < mm.inputTypes.size()
TRUEFALSE
yes
Evaluation Count:565
yes
Evaluation Count:19
19-565
479 type = mm.inputTypes.at(i);
executed (the execution status of this line is deduced): type = mm.inputTypes.at(i);
-
480 } else {
executed: }
Execution Count:565
565
481 Q_ASSERT(mm.outputTypes.size() > 1);
executed (the execution status of this line is deduced): qt_noop();
-
482 type = mm.outputTypes.at(i - mm.inputTypes.size() + 1);
executed (the execution status of this line is deduced): type = mm.outputTypes.at(i - mm.inputTypes.size() + 1);
-
483 // Output parameters are references; type id not available -
484 typeName = QMetaType::typeName(type);
executed (the execution status of this line is deduced): typeName = QMetaType::typeName(type);
-
485 typeName.append('&');
executed (the execution status of this line is deduced): typeName.append('&');
-
486 }
executed: }
Execution Count:19
19
487 Q_ASSERT(type != QMetaType::UnknownType);
executed (the execution status of this line is deduced): qt_noop();
-
488 int typeInfo;
executed (the execution status of this line is deduced): int typeInfo;
-
489 if (!typeName.isEmpty())
evaluated: !typeName.isEmpty()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:1596
19-1596
490 typeInfo = IsUnresolvedType | strings.enter(typeName);
executed: typeInfo = IsUnresolvedType | strings.enter(typeName);
Execution Count:19
19
491 else -
492 typeInfo = type;
executed: typeInfo = type;
Execution Count:1596
1596
493 idata[parametersOffset++] = typeInfo;
executed (the execution status of this line is deduced): idata[parametersOffset++] = typeInfo;
-
494 }
executed: }
Execution Count:1615
1615
495 // Parameter names -
496 for (int i = 0; i < argc; ++i)
evaluated: i < argc
TRUEFALSE
yes
Evaluation Count:584
yes
Evaluation Count:1031
584-1031
497 idata[parametersOffset++] = strings.enter(mm.parameterNames.at(i));
executed: idata[parametersOffset++] = strings.enter(mm.parameterNames.at(i));
Execution Count:584
584
498 -
499 idata[signatureOffset++] = typeidOffset;
executed (the execution status of this line is deduced): idata[signatureOffset++] = typeidOffset;
-
500 idata[typeidOffset++] = mm.inputTypes.count();
executed (the execution status of this line is deduced): idata[typeidOffset++] = mm.inputTypes.count();
-
501 memcpy(idata.data() + typeidOffset, mm.inputTypes.data(), mm.inputTypes.count() * sizeof(int));
executed (the execution status of this line is deduced): memcpy(idata.data() + typeidOffset, mm.inputTypes.data(), mm.inputTypes.count() * sizeof(int));
-
502 typeidOffset += mm.inputTypes.count();
executed (the execution status of this line is deduced): typeidOffset += mm.inputTypes.count();
-
503 -
504 idata[signatureOffset++] = typeidOffset;
executed (the execution status of this line is deduced): idata[signatureOffset++] = typeidOffset;
-
505 idata[typeidOffset++] = mm.outputTypes.count();
executed (the execution status of this line is deduced): idata[typeidOffset++] = mm.outputTypes.count();
-
506 memcpy(idata.data() + typeidOffset, mm.outputTypes.data(), mm.outputTypes.count() * sizeof(int));
executed (the execution status of this line is deduced): memcpy(idata.data() + typeidOffset, mm.outputTypes.data(), mm.outputTypes.count() * sizeof(int));
-
507 typeidOffset += mm.outputTypes.count();
executed (the execution status of this line is deduced): typeidOffset += mm.outputTypes.count();
-
508 }
executed: }
Execution Count:1031
1031
509 }
executed: }
Execution Count:284
284
510 -
511 Q_ASSERT(offset == header->methodData + header->methodCount * 5);
executed (the execution status of this line is deduced): qt_noop();
-
512 Q_ASSERT(parametersOffset = header->propertyData);
executed (the execution status of this line is deduced): qt_noop();
-
513 Q_ASSERT(signatureOffset == header->methodDBusData + header->methodCount * intsPerMethod);
executed (the execution status of this line is deduced): qt_noop();
-
514 Q_ASSERT(typeidOffset == idata.size());
executed (the execution status of this line is deduced): qt_noop();
-
515 offset += methodParametersDataSize;
executed (the execution status of this line is deduced): offset += methodParametersDataSize;
-
516 Q_ASSERT(offset == header->propertyData);
executed (the execution status of this line is deduced): qt_noop();
-
517 -
518 // add each property -
519 signatureOffset = header->propertyDBusData;
executed (the execution status of this line is deduced): signatureOffset = header->propertyDBusData;
-
520 for (QMap<QByteArray, Property>::ConstIterator it = properties.constBegin();
executed (the execution status of this line is deduced): for (QMap<QByteArray, Property>::ConstIterator it = properties.constBegin();
-
521 it != properties.constEnd(); ++it) {
evaluated: it != properties.constEnd()
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:142
88-142
522 const Property &mp = it.value();
executed (the execution status of this line is deduced): const Property &mp = it.value();
-
523 -
524 // form is name, typeinfo, flags -
525 idata[offset++] = strings.enter(it.key()); // name
executed (the execution status of this line is deduced): idata[offset++] = strings.enter(it.key());
-
526 Q_ASSERT(mp.type != QMetaType::UnknownType);
executed (the execution status of this line is deduced): qt_noop();
-
527 idata[offset++] = mp.type;
executed (the execution status of this line is deduced): idata[offset++] = mp.type;
-
528 idata[offset++] = mp.flags;
executed (the execution status of this line is deduced): idata[offset++] = mp.flags;
-
529 -
530 idata[signatureOffset++] = strings.enter(mp.signature);
executed (the execution status of this line is deduced): idata[signatureOffset++] = strings.enter(mp.signature);
-
531 idata[signatureOffset++] = mp.type;
executed (the execution status of this line is deduced): idata[signatureOffset++] = mp.type;
-
532 }
executed: }
Execution Count:88
88
533 -
534 Q_ASSERT(offset == header->propertyDBusData);
executed (the execution status of this line is deduced): qt_noop();
-
535 Q_ASSERT(signatureOffset == header->methodDBusData);
executed (the execution status of this line is deduced): qt_noop();
-
536 -
537 char *string_data = new char[strings.blobSize()];
executed (the execution status of this line is deduced): char *string_data = new char[strings.blobSize()];
-
538 strings.writeBlob(string_data);
executed (the execution status of this line is deduced): strings.writeBlob(string_data);
-
539 -
540 uint *uint_data = new uint[idata.size()];
executed (the execution status of this line is deduced): uint *uint_data = new uint[idata.size()];
-
541 memcpy(uint_data, idata.data(), idata.size() * sizeof(int));
executed (the execution status of this line is deduced): memcpy(uint_data, idata.data(), idata.size() * sizeof(int));
-
542 -
543 // put the metaobject together -
544 obj->d.data = uint_data;
executed (the execution status of this line is deduced): obj->d.data = uint_data;
-
545 obj->d.relatedMetaObjects = 0;
executed (the execution status of this line is deduced): obj->d.relatedMetaObjects = 0;
-
546 obj->d.static_metacall = 0;
executed (the execution status of this line is deduced): obj->d.static_metacall = 0;
-
547 obj->d.extradata = 0;
executed (the execution status of this line is deduced): obj->d.extradata = 0;
-
548 obj->d.stringdata = reinterpret_cast<const QByteArrayData *>(string_data);
executed (the execution status of this line is deduced): obj->d.stringdata = reinterpret_cast<const QByteArrayData *>(string_data);
-
549 obj->d.superdata = &QDBusAbstractInterface::staticMetaObject;
executed (the execution status of this line is deduced): obj->d.superdata = &QDBusAbstractInterface::staticMetaObject;
-
550}
executed: }
Execution Count:142
142
551 -
552#if 0 -
553void QDBusMetaObjectGenerator::writeWithoutXml(const QString &interface) -
554{ -
555 // no XML definition -
556 QString tmp(interface); -
557 tmp.replace(QLatin1Char('.'), QLatin1String("::")); -
558 QByteArray name(tmp.toLatin1()); -
559 -
560 QDBusMetaObjectPrivate *header = new QDBusMetaObjectPrivate; -
561 memset(header, 0, sizeof *header); -
562 header->revision = 1; -
563 // leave the rest with 0 -
564 -
565 char *stringdata = new char[name.length() + 1]; -
566 stringdata[name.length()] = '\0'; -
567 -
568 d.data = reinterpret_cast<uint*>(header); -
569 d.relatedMetaObjects = 0; -
570 d.static_metacall = 0; -
571 d.extradata = 0; -
572 d.stringdata = stringdata; -
573 d.superdata = &QDBusAbstractInterface::staticMetaObject; -
574 cached = false; -
575} -
576#endif -
577 -
578///////// -
579// class QDBusMetaObject -
580 -
581QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, const QString &xml, -
582 QHash<QString, QDBusMetaObject *> &cache, -
583 QDBusError &error) -
584{ -
585 error = QDBusError();
executed (the execution status of this line is deduced): error = QDBusError();
-
586 QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml);
executed (the execution status of this line is deduced): QDBusIntrospection::Interfaces parsed = QDBusIntrospection::parseInterfaces(xml);
-
587 -
588 QDBusMetaObject *we = 0;
executed (the execution status of this line is deduced): QDBusMetaObject *we = 0;
-
589 QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin();
executed (the execution status of this line is deduced): QDBusIntrospection::Interfaces::ConstIterator it = parsed.constBegin();
-
590 QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd();
executed (the execution status of this line is deduced): QDBusIntrospection::Interfaces::ConstIterator end = parsed.constEnd();
-
591 for ( ; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:394
yes
Evaluation Count:137
137-394
592 // check if it's in the cache -
593 bool us = it.key() == interface;
executed (the execution status of this line is deduced): bool us = it.key() == interface;
-
594 -
595 QDBusMetaObject *obj = cache.value(it.key(), 0);
executed (the execution status of this line is deduced): QDBusMetaObject *obj = cache.value(it.key(), 0);
-
596 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
597 // not in cache; create -
598 obj = new QDBusMetaObject;
executed (the execution status of this line is deduced): obj = new QDBusMetaObject;
-
599 QDBusMetaObjectGenerator generator(it.key(), it.value().constData());
executed (the execution status of this line is deduced): QDBusMetaObjectGenerator generator(it.key(), it.value().constData());
-
600 generator.write(obj);
executed (the execution status of this line is deduced): generator.write(obj);
-
601 -
602 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
603 // cache it -
604 cache.insert(it.key(), obj);
executed: cache.insert(it.key(), obj);
Execution Count:38
38
605 else if (!us)
evaluated: !us
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:94
7-94
606 delete obj;
executed: delete obj;
Execution Count:7
7
607 -
608 } -
609 -
610 if (us)
evaluated: us
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:292
102-292
611 // it's us -
612 we = obj;
executed: we = obj;
Execution Count:102
102
613 }
executed: }
Execution Count:394
394
614 -
615 if (we)
evaluated: we
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:35
35-102
616 return we;
executed: return we;
Execution Count:102
102
617 // still nothing? -
618 -
619 if (parsed.isEmpty()) {
partially evaluated: parsed.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:35
0-35
620 // object didn't return introspection -
621 we = new QDBusMetaObject;
never executed (the execution status of this line is deduced): we = new QDBusMetaObject;
-
622 QDBusMetaObjectGenerator generator(interface, 0);
never executed (the execution status of this line is deduced): QDBusMetaObjectGenerator generator(interface, 0);
-
623 generator.write(we);
never executed (the execution status of this line is deduced): generator.write(we);
-
624 we->cached = false;
never executed (the execution status of this line is deduced): we->cached = false;
-
625 return we;
never executed: return we;
0
626 } else if (interface.isEmpty()) {
evaluated: interface.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:32
3-32
627 // merge all interfaces -
628 it = parsed.constBegin();
executed (the execution status of this line is deduced): it = parsed.constBegin();
-
629 QDBusIntrospection::Interface merged = *it.value().constData();
executed (the execution status of this line is deduced): QDBusIntrospection::Interface merged = *it.value().constData();
-
630 -
631 for (++it; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
632 merged.annotations.unite(it.value()->annotations);
executed (the execution status of this line is deduced): merged.annotations.unite(it.value()->annotations);
-
633 merged.methods.unite(it.value()->methods);
executed (the execution status of this line is deduced): merged.methods.unite(it.value()->methods);
-
634 merged.signals_.unite(it.value()->signals_);
executed (the execution status of this line is deduced): merged.signals_.unite(it.value()->signals_);
-
635 merged.properties.unite(it.value()->properties);
executed (the execution status of this line is deduced): merged.properties.unite(it.value()->properties);
-
636 }
executed: }
Execution Count:9
9
637 -
638 merged.name = QLatin1String("local.Merged");
executed (the execution status of this line is deduced): merged.name = QLatin1String("local.Merged");
-
639 merged.introspection.clear();
executed (the execution status of this line is deduced): merged.introspection.clear();
-
640 -
641 we = new QDBusMetaObject;
executed (the execution status of this line is deduced): we = new QDBusMetaObject;
-
642 QDBusMetaObjectGenerator generator(merged.name, &merged);
executed (the execution status of this line is deduced): QDBusMetaObjectGenerator generator(merged.name, &merged);
-
643 generator.write(we);
executed (the execution status of this line is deduced): generator.write(we);
-
644 we->cached = false;
executed (the execution status of this line is deduced): we->cached = false;
-
645 return we;
executed: return we;
Execution Count:3
3
646 } -
647 -
648 // mark as an error -
649 error = QDBusError(QDBusError::UnknownInterface,
executed (the execution status of this line is deduced): error = QDBusError(QDBusError::UnknownInterface,
-
650 QString::fromLatin1("Interface '%1' was not found")
executed (the execution status of this line is deduced): QString::fromLatin1("Interface '%1' was not found")
-
651 .arg(interface));
executed (the execution status of this line is deduced): .arg(interface));
-
652 return 0;
executed: return 0;
Execution Count:32
32
653} -
654 -
655QDBusMetaObject::QDBusMetaObject() -
656{ -
657} -
658 -
659static inline const QDBusMetaObjectPrivate *priv(const uint* data) -
660{ -
661 return reinterpret_cast<const QDBusMetaObjectPrivate *>(data);
executed: return reinterpret_cast<const QDBusMetaObjectPrivate *>(data);
Execution Count:64
64
662} -
663 -
664const int *QDBusMetaObject::inputTypesForMethod(int id) const -
665{ -
666 //id -= methodOffset(); -
667 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
668 int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
executed (the execution status of this line is deduced): int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
-
669 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
670 } -
671 return 0;
never executed: return 0;
0
672} -
673 -
674const int *QDBusMetaObject::outputTypesForMethod(int id) const -
675{ -
676 //id -= methodOffset(); -
677 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
678 int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
executed (the execution status of this line is deduced): int handle = priv(d.data)->methodDBusData + id*intsPerMethod;
-
679 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
680 } -
681 return 0;
never executed: return 0;
0
682} -
683 -
684int QDBusMetaObject::propertyMetaType(int id) const -
685{ -
686 //id -= propertyOffset(); -
687 if (id >= 0 && id < priv(d.data)->propertyCount) {
never evaluated: id >= 0
never evaluated: id < priv(d.data)->propertyCount
0
688 int handle = priv(d.data)->propertyDBusData + id*intsPerProperty;
never executed (the execution status of this line is deduced): int handle = priv(d.data)->propertyDBusData + id*intsPerProperty;
-
689 return d.data[handle + 1];
never executed: return d.data[handle + 1];
0
690 } -
691 return 0;
never executed: return 0;
0
692} -
693 -
694QT_END_NAMESPACE -
695 -
696#endif // QT_NO_DBUS -
697 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial