qdbusmessage.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9static inline const char *data(const QByteArray &arr) -
10{ -
11 return arr.isEmpty() ? 0 : arr.constData();
executed: return arr.isEmpty() ? 0 : arr.constData();
Execution Count:2962
2962
12} -
13 -
14QDBusMessagePrivate::QDBusMessagePrivate() -
15 : msg(0), reply(0), type(0), -
16 timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false), -
17 parametersValidated(false), autoStartService(true) -
18{ -
19}
executed: }
Execution Count:5035
5035
20 -
21QDBusMessagePrivate::~QDBusMessagePrivate() -
22{ -
23 if (msg)
evaluated: msg
TRUEFALSE
yes
Evaluation Count:1716
yes
Evaluation Count:3319
1716-3319
24 q_dbus_message_unref(msg);
executed: q_dbus_message_unref(msg);
Execution Count:1716
1716
25 if (reply)
evaluated: reply
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:4925
110-4925
26 q_dbus_message_unref(reply);
executed: q_dbus_message_unref(reply);
Execution Count:110
110
27 delete localReply; -
28}
executed: }
Execution Count:5035
5035
29 -
30 -
31 -
32 -
33 -
34QString QDBusMessage::errorMessage() const -
35{ -
36 if (d_ptr->type == ErrorMessage) {
partially evaluated: d_ptr->type == ErrorMessage
TRUEFALSE
yes
Evaluation Count:322
no
Evaluation Count:0
0-322
37 if (!d_ptr->message.isEmpty())
evaluated: !d_ptr->message.isEmpty()
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:226
96-226
38 return d_ptr->message;
executed: return d_ptr->message;
Execution Count:96
96
39 if (!d_ptr->arguments.isEmpty())
evaluated: !d_ptr->arguments.isEmpty()
TRUEFALSE
yes
Evaluation Count:224
yes
Evaluation Count:2
2-224
40 return d_ptr->arguments.at(0).toString();
executed: return d_ptr->arguments.at(0).toString();
Execution Count:224
224
41 }
executed: }
Execution Count:2
2
42 return QString();
executed: return QString();
Execution Count:2
2
43} -
44DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDBusConnection::ConnectionCapabilities capabilities, -
45 QDBusError *error) -
46{ -
47 if (!qdbus_loadLibDBus()) {
partially evaluated: !qdbus_loadLibDBus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1722
0-1722
48 *error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library")); -
49 return 0;
never executed: return 0;
0
50 } -
51 -
52 DBusMessage *msg = 0; -
53 const QDBusMessagePrivate *d_ptr = message.d_ptr; -
54 -
55 switch (d_ptr->type) { -
56 case 0: -
57 -
58 break;
never executed: break;
0
59 case 1: -
60 -
61 if (!d_ptr->parametersValidated) {
evaluated: !d_ptr->parametersValidated
TRUEFALSE
yes
Evaluation Count:527
yes
Evaluation Count:954
527-954
62 if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error))
partially evaluated: !QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:527
0-527
63 return 0;
never executed: return 0;
0
64 if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
partially evaluated: !QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:527
0-527
65 return 0;
never executed: return 0;
0
66 if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
partially evaluated: !QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:527
0-527
67 return 0;
never executed: return 0;
0
68 if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
partially evaluated: !QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:527
0-527
69 return 0;
never executed: return 0;
0
70 }
executed: }
Execution Count:527
527
71 -
72 msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(), -
73 data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8()); -
74 q_dbus_message_set_auto_start( msg, d_ptr->autoStartService ); -
75 break;
executed: break;
Execution Count:1481
1481
76 case 2: -
77 msg = q_dbus_message_new(2); -
78 if (!d_ptr->localMessage) {
evaluated: !d_ptr->localMessage
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:67
42-67
79 q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->reply)); -
80 q_dbus_message_set_reply_serial(msg, q_dbus_message_get_serial(d_ptr->reply)); -
81 }
executed: }
Execution Count:42
42
82 break;
executed: break;
Execution Count:109
109
83 case 3: -
84 -
85 if (!d_ptr->parametersValidated
partially evaluated: !d_ptr->parametersValidated
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-32
86 && !QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error))
never evaluated: !QDBusUtil::checkErrorName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error)
0
87 return 0;
never executed: return 0;
0
88 -
89 msg = q_dbus_message_new(3); -
90 q_dbus_message_set_error_name(msg, d_ptr->name.toUtf8()); -
91 if (!d_ptr->localMessage) {
partially evaluated: !d_ptr->localMessage
TRUEFALSE
yes
Evaluation Count:32
no
Evaluation Count:0
0-32
92 q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->reply)); -
93 q_dbus_message_set_reply_serial(msg, q_dbus_message_get_serial(d_ptr->reply)); -
94 }
executed: }
Execution Count:32
32
95 break;
executed: break;
Execution Count:32
32
96 case 4: -
97 -
98 if (!d_ptr->parametersValidated) {
evaluated: !d_ptr->parametersValidated
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:93
7-93
99 if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
partially evaluated: !QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
100 return 0;
never executed: return 0;
0
101 if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
partially evaluated: !QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
102 return 0;
never executed: return 0;
0
103 if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
partially evaluated: !QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
104 return 0;
never executed: return 0;
0
105 }
executed: }
Execution Count:7
7
106 -
107 msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(), -
108 d_ptr->name.toUtf8()); -
109 break;
executed: break;
Execution Count:100
100
110 default: -
111 qt_noop(); -
112 break;
never executed: break;
0
113 } -
114 -
115 -
116 -
117 -
118 d_ptr->parametersValidated = true; -
119 -
120 QDBusMarshaller marshaller(capabilities); -
121 QVariantList::ConstIterator it = d_ptr->arguments.constBegin(); -
122 QVariantList::ConstIterator cend = d_ptr->arguments.constEnd(); -
123 q_dbus_message_iter_init_append(msg, &marshaller.iterator); -
124 if (!d_ptr->message.isEmpty())
evaluated: !d_ptr->message.isEmpty()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:1690
32-1690
125 -
126 marshaller.append(d_ptr->message);
executed: marshaller.append(d_ptr->message);
Execution Count:32
32
127 for ( ; it != cend; ++it)
evaluated: it != cend
TRUEFALSE
yes
Evaluation Count:1430
yes
Evaluation Count:1722
1430-1722
128 marshaller.appendVariantInternal(*it);
executed: marshaller.appendVariantInternal(*it);
Execution Count:1430
1430
129 -
130 -
131 if (marshaller.ok)
partially evaluated: marshaller.ok
TRUEFALSE
yes
Evaluation Count:1722
no
Evaluation Count:0
0-1722
132 return msg;
executed: return msg;
Execution Count:1722
1722
133 -
134 -
135 q_dbus_message_unref(msg); -
136 *error = QDBusError(QDBusError::Failed, QLatin1String("Marshalling failed: ") + marshaller.errorString); -
137 return 0;
never executed: return 0;
0
138} -
139QDBusMessage QDBusMessagePrivate::fromDBusMessage(DBusMessage *dmsg, QDBusConnection::ConnectionCapabilities capabilities) -
140{ -
141 QDBusMessage message; -
142 if (!dmsg)
partially evaluated: !dmsg
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1716
0-1716
143 return message;
never executed: return message;
0
144 -
145 message.d_ptr->type = q_dbus_message_get_type(dmsg); -
146 message.d_ptr->path = QString::fromUtf8(q_dbus_message_get_path(dmsg)); -
147 message.d_ptr->interface = QString::fromUtf8(q_dbus_message_get_interface(dmsg)); -
148 message.d_ptr->name = message.d_ptr->type == 3 ?
evaluated: message.d_ptr->type == 3
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:1651
65-1651
149 QString::fromUtf8(q_dbus_message_get_error_name(dmsg)) : -
150 QString::fromUtf8(q_dbus_message_get_member(dmsg)); -
151 message.d_ptr->service = QString::fromUtf8(q_dbus_message_get_sender(dmsg)); -
152 message.d_ptr->signature = QString::fromUtf8(q_dbus_message_get_signature(dmsg)); -
153 message.d_ptr->msg = q_dbus_message_ref(dmsg); -
154 -
155 QDBusDemarshaller demarshaller(capabilities); -
156 demarshaller.message = q_dbus_message_ref(dmsg); -
157 if (q_dbus_message_iter_init(demarshaller.message, &demarshaller.iterator))
evaluated: q_dbus_message_iter_init(demarshaller.message, &demarshaller.iterator)
TRUEFALSE
yes
Evaluation Count:1445
yes
Evaluation Count:271
271-1445
158 while (!demarshaller.atEnd())
evaluated: !demarshaller.atEnd()
TRUEFALSE
yes
Evaluation Count:1523
yes
Evaluation Count:1445
1445-1523
159 message << demarshaller.toVariantInternal();
executed: message << demarshaller.toVariantInternal();
Execution Count:1523
1523
160 return message;
executed: return message;
Execution Count:1716
1716
161} -
162 -
163bool QDBusMessagePrivate::isLocal(const QDBusMessage &message) -
164{ -
165 return message.d_ptr->localMessage;
executed: return message.d_ptr->localMessage;
Execution Count:911
911
166} -
167 -
168QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn, -
169 const QDBusMessage &asSent) -
170{ -
171 -
172 -
173 -
174 -
175 -
176 -
177 QString computedSignature; -
178 QVariantList::ConstIterator it = asSent.d_ptr->arguments.constBegin(); -
179 QVariantList::ConstIterator end = asSent.d_ptr->arguments.constEnd(); -
180 for ( ; it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:354
yes
Evaluation Count:623
354-623
181 int id = it->userType(); -
182 const char *signature = QDBusMetaType::typeToSignature(id); -
183 if ((id != QVariant::StringList && id != QVariant::ByteArray &&
evaluated: id != QVariant::StringList
TRUEFALSE
yes
Evaluation Count:346
yes
Evaluation Count:8
evaluated: id != QVariant::ByteArray
TRUEFALSE
yes
Evaluation Count:341
yes
Evaluation Count:5
5-346
184 qstrlen(signature) != 1) || id == qMetaTypeId<QDBusVariant>()) {
evaluated: qstrlen(signature) != 1
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:301
evaluated: id == qMetaTypeId<QDBusVariant>()
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:251
40-301
185 -
186 -
187 -
188 QDBusError error; -
189 DBusMessage *message = toDBusMessage(asSent, conn.capabilities, &error); -
190 if (!message) {
partially evaluated: !message
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:103
0-103
191 -
192 return QDBusMessage::createError(error);
never executed: return QDBusMessage::createError(error);
0
193 } -
194 -
195 q_dbus_message_set_sender(message, conn.baseService.toUtf8()); -
196 -
197 QDBusMessage retval = fromDBusMessage(message, conn.capabilities); -
198 retval.d_ptr->localMessage = true; -
199 q_dbus_message_unref(message); -
200 if (retval.d_ptr->service.isEmpty())
partially evaluated: retval.d_ptr->service.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:103
0-103
201 retval.d_ptr->service = conn.baseService;
never executed: retval.d_ptr->service = conn.baseService;
0
202 return retval;
executed: return retval;
Execution Count:103
103
203 } else { -
204 computedSignature += QLatin1String(signature); -
205 }
executed: }
Execution Count:251
251
206 } -
207 -
208 -
209 -
210 QDBusMessage retval; -
211 QDBusMessagePrivate *d = retval.d_ptr; -
212 d->arguments = asSent.d_ptr->arguments; -
213 d->path = asSent.d_ptr->path; -
214 d->interface = asSent.d_ptr->interface; -
215 d->name = asSent.d_ptr->name; -
216 d->message = asSent.d_ptr->message; -
217 d->type = asSent.d_ptr->type; -
218 -
219 d->service = conn.baseService; -
220 d->signature = computedSignature; -
221 d->localMessage = true; -
222 return retval;
executed: return retval;
Execution Count:623
623
223} -
224 -
225QDBusMessage QDBusMessagePrivate::makeLocalReply(const QDBusConnectionPrivate &conn, -
226 const QDBusMessage &callMsg) -
227{ -
228 -
229 -
230 if (callMsg.d_ptr->localReply)
evaluated: callMsg.d_ptr->localReply
TRUEFALSE
yes
Evaluation Count:362
yes
Evaluation Count:2
2-362
231 return makeLocal(conn, *callMsg.d_ptr->localReply);
executed: return makeLocal(conn, *callMsg.d_ptr->localReply);
Execution Count:362
362
232 return QDBusMessage();
executed: return QDBusMessage();
Execution Count:2
2
233} -
234QDBusMessage QDBusMessage::createSignal(const QString &path, const QString &interface, -
235 const QString &name) -
236{ -
237 QDBusMessage message; -
238 message.d_ptr->type = 4; -
239 message.d_ptr->path = path; -
240 message.d_ptr->interface = interface; -
241 message.d_ptr->name = name; -
242 -
243 return message;
executed: return message;
Execution Count:99
99
244} -
245QDBusMessage QDBusMessage::createMethodCall(const QString &service, const QString &path, -
246 const QString &interface, const QString &method) -
247{ -
248 QDBusMessage message; -
249 message.d_ptr->type = 1; -
250 message.d_ptr->service = service; -
251 message.d_ptr->path = path; -
252 message.d_ptr->interface = interface; -
253 message.d_ptr->name = method; -
254 -
255 return message;
executed: return message;
Execution Count:1818
1818
256} -
257 -
258 -
259 -
260 -
261 -
262QDBusMessage QDBusMessage::createError(const QString &name, const QString &msg) -
263{ -
264 QDBusMessage error; -
265 error.d_ptr->type = 3; -
266 error.d_ptr->name = name; -
267 error.d_ptr->message = msg; -
268 -
269 return error;
executed: return error;
Execution Count:157
157
270} -
271QDBusMessage QDBusMessage::createReply(const QVariantList &arguments) const -
272{ -
273 QDBusMessage reply; -
274 reply.setArguments(arguments); -
275 reply.d_ptr->type = 2; -
276 if (d_ptr->msg)
evaluated: d_ptr->msg
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:251
75-251
277 reply.d_ptr->reply = q_dbus_message_ref(d_ptr->msg);
executed: reply.d_ptr->reply = q_dbus_message_ref(d_ptr->msg);
Execution Count:75
75
278 if (d_ptr->localMessage) {
evaluated: d_ptr->localMessage
TRUEFALSE
yes
Evaluation Count:284
yes
Evaluation Count:42
42-284
279 reply.d_ptr->localMessage = true; -
280 d_ptr->localReply = new QDBusMessage(reply); -
281 }
executed: }
Execution Count:284
284
282 -
283 -
284 qt_noop(); -
285 return reply;
executed: return reply;
Execution Count:326
326
286} -
287 -
288 -
289 -
290 -
291 -
292QDBusMessage QDBusMessage::createErrorReply(const QString name, const QString &msg) const -
293{ -
294 QDBusMessage reply = QDBusMessage::createError(name, msg); -
295 if (d_ptr->msg)
evaluated: d_ptr->msg
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:77
35-77
296 reply.d_ptr->reply = q_dbus_message_ref(d_ptr->msg);
executed: reply.d_ptr->reply = q_dbus_message_ref(d_ptr->msg);
Execution Count:35
35
297 if (d_ptr->localMessage) {
evaluated: d_ptr->localMessage
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:32
32-80
298 reply.d_ptr->localMessage = true; -
299 d_ptr->localReply = new QDBusMessage(reply); -
300 }
executed: }
Execution Count:80
80
301 -
302 -
303 qt_noop(); -
304 return reply;
executed: return reply;
Execution Count:112
112
305} -
306QDBusMessage QDBusMessage::createErrorReply(QDBusError::ErrorType atype, const QString &amsg) const -
307{ -
308 QDBusMessage msg = createErrorReply(QDBusError::errorString(atype), amsg); -
309 msg.d_ptr->parametersValidated = true; -
310 return msg;
executed: return msg;
Execution Count:106
106
311} -
312 -
313 -
314 -
315 -
316 -
317 -
318 -
319QDBusMessage::QDBusMessage() -
320{ -
321 d_ptr = new QDBusMessagePrivate; -
322}
executed: }
Execution Count:5035
5035
323QDBusMessage::QDBusMessage(const QDBusMessage &other) -
324{ -
325 d_ptr = other.d_ptr; -
326 d_ptr->ref.ref(); -
327}
executed: }
Execution Count:4374
4374
328 -
329 -
330 -
331 -
332QDBusMessage::~QDBusMessage() -
333{ -
334 if (!d_ptr->ref.deref())
evaluated: !d_ptr->ref.deref()
TRUEFALSE
yes
Evaluation Count:4740
yes
Evaluation Count:4669
4669-4740
335 delete d_ptr;
executed: delete d_ptr;
Execution Count:4740
4740
336}
executed: }
Execution Count:9409
9409
337QDBusMessage &QDBusMessage::operator=(const QDBusMessage &other) -
338{ -
339 qAtomicAssign(d_ptr, other.d_ptr); -
340 return *this;
executed: return *this;
Execution Count:295
295
341} -
342 -
343 -
344 -
345 -
346QString QDBusMessage::service() const -
347{ -
348 return d_ptr->service;
executed: return d_ptr->service;
Execution Count:1989
1989
349} -
350 -
351 -
352 -
353 -
354 -
355QString QDBusMessage::path() const -
356{ -
357 return d_ptr->path;
executed: return d_ptr->path;
Execution Count:1231
1231
358} -
359 -
360 -
361 -
362 -
363 -
364QString QDBusMessage::interface() const -
365{ -
366 return d_ptr->interface;
executed: return d_ptr->interface;
Execution Count:1666
1666
367} -
368 -
369 -
370 -
371 -
372QString QDBusMessage::member() const -
373{ -
374 if (d_ptr->type != ErrorMessage)
partially evaluated: d_ptr->type != ErrorMessage
TRUEFALSE
yes
Evaluation Count:1373
no
Evaluation Count:0
0-1373
375 return d_ptr->name;
executed: return d_ptr->name;
Execution Count:1373
1373
376 return QString();
never executed: return QString();
0
377} -
378 -
379 -
380 -
381 -
382QString QDBusMessage::errorName() const -
383{ -
384 if (d_ptr->type == ErrorMessage)
partially evaluated: d_ptr->type == ErrorMessage
TRUEFALSE
yes
Evaluation Count:645
no
Evaluation Count:0
0-645
385 return d_ptr->name;
executed: return d_ptr->name;
Execution Count:645
645
386 return QString();
never executed: return QString();
0
387} -
388 -
389 -
390 -
391 -
392 -
393QString QDBusMessage::signature() const -
394{ -
395 return d_ptr->signature;
executed: return d_ptr->signature;
Execution Count:846
846
396} -
397 -
398 -
399 -
400 -
401 -
402 -
403 -
404bool QDBusMessage::isReplyRequired() const -
405{ -
406 if (!d_ptr->msg)
evaluated: !d_ptr->msg
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:215
180-215
407 return d_ptr->localMessage;
executed: return d_ptr->localMessage;
Execution Count:180
180
408 return !q_dbus_message_get_no_reply(d_ptr->msg);
executed: return !q_dbus_message_get_no_reply(d_ptr->msg);
Execution Count:215
215
409} -
410void QDBusMessage::setDelayedReply(bool enable) const -
411{ -
412 d_ptr->delayedReply = enable; -
413}
executed: }
Execution Count:18
18
414 -
415 -
416 -
417 -
418 -
419 -
420bool QDBusMessage::isDelayedReply() const -
421{ -
422 return d_ptr->delayedReply;
executed: return d_ptr->delayedReply;
Execution Count:241
241
423} -
424void QDBusMessage::setAutoStartService(bool enable) -
425{ -
426 d_ptr->autoStartService = enable; -
427}
never executed: }
0
428bool QDBusMessage::autoStartService() const -
429{ -
430 return d_ptr->autoStartService;
never executed: return d_ptr->autoStartService;
0
431} -
432 -
433 -
434 -
435 -
436 -
437 -
438 -
439void QDBusMessage::setArguments(const QList<QVariant> &arguments) -
440{ -
441 -
442 d_ptr->arguments = arguments; -
443}
executed: }
Execution Count:1522
1522
444 -
445 -
446 -
447 -
448 -
449QList<QVariant> QDBusMessage::arguments() const -
450{ -
451 return d_ptr->arguments;
executed: return d_ptr->arguments;
Execution Count:5199
5199
452} -
453 -
454 -
455 -
456 -
457 -
458 -
459QDBusMessage &QDBusMessage::operator<<(const QVariant &arg) -
460{ -
461 -
462 d_ptr->arguments.append(arg); -
463 return *this;
executed: return *this;
Execution Count:2034
2034
464} -
465 -
466 -
467 -
468 -
469QDBusMessage::MessageType QDBusMessage::type() const -
470{ -
471 switch (d_ptr->type) { -
472 case 1: -
473 return MethodCallMessage;
executed: return MethodCallMessage;
Execution Count:438
438
474 case 2: -
475 return ReplyMessage;
executed: return ReplyMessage;
Execution Count:3311
3311
476 case 3: -
477 return ErrorMessage;
executed: return ErrorMessage;
Execution Count:930
930
478 case 4: -
479 return SignalMessage;
executed: return SignalMessage;
Execution Count:197
197
480 default: -
481 break;
executed: break;
Execution Count:196
196
482 } -
483 return InvalidMessage;
executed: return InvalidMessage;
Execution Count:196
196
484} -
485static QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t) -
486{ -
487 switch (t) -
488 { -
489 case QDBusMessage::MethodCallMessage: -
490 return dbg << "MethodCall";
never executed: return dbg << "MethodCall";
0
491 case QDBusMessage::ReplyMessage: -
492 return dbg << "MethodReturn";
never executed: return dbg << "MethodReturn";
0
493 case QDBusMessage::SignalMessage: -
494 return dbg << "Signal";
never executed: return dbg << "Signal";
0
495 case QDBusMessage::ErrorMessage: -
496 return dbg << "Error";
never executed: return dbg << "Error";
0
497 default: -
498 return dbg << "Invalid";
never executed: return dbg << "Invalid";
0
499 } -
500}
never executed: }
0
501 -
502static void debugVariantList(QDebug dbg, const QVariantList &list) -
503{ -
504 bool first = true; -
505 QVariantList::ConstIterator it = list.constBegin(); -
506 QVariantList::ConstIterator end = list.constEnd(); -
507 for ( ; it != end; ++it) {
never evaluated: it != end
0
508 if (!first)
never evaluated: !first
0
509 dbg.nospace() << ", ";
never executed: dbg.nospace() << ", ";
0
510 dbg.nospace() << QString(QDBusUtil::argumentToString(*it)).toLocal8Bit().constData(); -
511 first = false; -
512 }
never executed: }
0
513}
never executed: }
0
514 -
515QDebug operator<<(QDebug dbg, const QDBusMessage &msg) -
516{ -
517 dbg.nospace() << "QDBusMessage(type=" << msg.type() -
518 << ", service=" << msg.service(); -
519 if (msg.type() == QDBusMessage::MethodCallMessage ||
never evaluated: msg.type() == QDBusMessage::MethodCallMessage
0
520 msg.type() == QDBusMessage::SignalMessage)
never evaluated: msg.type() == QDBusMessage::SignalMessage
0
521 dbg.nospace() << ", path=" << msg.path() 0
522 << ", interface=" << msg.interface() 0
523 << ", member=" << msg.member();
never executed: dbg.nospace() << ", path=" << msg.path() << ", interface=" << msg.interface() << ", member=" << msg.member();
0
524 if (msg.type() == QDBusMessage::ErrorMessage)
never evaluated: msg.type() == QDBusMessage::ErrorMessage
0
525 dbg.nospace() << ", error name=" << msg.errorName() 0
526 << ", error message=" << msg.errorMessage();
never executed: dbg.nospace() << ", error name=" << msg.errorName() << ", error message=" << msg.errorMessage();
0
527 dbg.nospace() << ", signature=" << msg.signature() -
528 << ", contents=("; -
529 debugVariantList(dbg, msg.arguments()); -
530 dbg.nospace() << ") )"; -
531 return dbg.space();
never executed: return dbg.space();
0
532} -
533 -
534 -
535 -
536 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial