qdbusinternalfilters.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusinternalfilters.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtDBus module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41#include "qdbusconnection_p.h"-
42-
43#include "qdbus_symbols_p.h"-
44#include <QtCore/qcoreapplication.h>-
45#include <QtCore/qmetaobject.h>-
46#include <QtCore/qstringlist.h>-
47#include <QtCore/qthread.h>-
48-
49#include "qdbusabstractadaptor.h"-
50#include "qdbusabstractadaptor_p.h"-
51#include "qdbusconnection.h"-
52#include "qdbusextratypes.h"-
53#include "qdbusmessage.h"-
54#include "qdbusmetatype.h"-
55#include "qdbusmetatype_p.h"-
56#include "qdbusmessage_p.h"-
57#include "qdbusutil_p.h"-
58#include "qdbusvirtualobject.h"-
59-
60#include <algorithm>-
61-
62#ifndef QT_NO_DBUS-
63-
64QT_BEGIN_NAMESPACE-
65-
66// defined in qdbusxmlgenerator.cpp-
67extern QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo,-
68 const QMetaObject *base, int flags);-
69-
70static const char introspectableInterfaceXml[] =-
71 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"-
72 " <method name=\"Introspect\">\n"-
73 " <arg name=\"xml_data\" type=\"s\" direction=\"out\"/>\n"-
74 " </method>\n"-
75 " </interface>\n";-
76-
77static const char propertiesInterfaceXml[] =-
78 " <interface name=\"org.freedesktop.DBus.Properties\">\n"-
79 " <method name=\"Get\">\n"-
80 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"-
81 " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n"-
82 " <arg name=\"value\" type=\"v\" direction=\"out\"/>\n"-
83 " </method>\n"-
84 " <method name=\"Set\">\n"-
85 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"-
86 " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n"-
87 " <arg name=\"value\" type=\"v\" direction=\"in\"/>\n"-
88 " </method>\n"-
89 " <method name=\"GetAll\">\n"-
90 " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"-
91 " <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n"-
92 " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n"-
93 " </method>\n"-
94 " <signal name=\"PropertiesChanged\">\n"-
95 " <arg name=\"interface_name\" type=\"s\" direction=\"out\"/>\n"-
96 " <arg name=\"changed_properties\" type=\"a{sv}\" direction=\"out\"/>\n"-
97 " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out1\" value=\"QVariantMap\"/>\n"-
98 " <arg name=\"invalidated_properties\" type=\"as\" direction=\"out\"/>\n"-
99 " </signal>\n"-
100 " </interface>\n";-
101-
102static const char peerInterfaceXml[] =-
103 " <interface name=\"org.freedesktop.DBus.Peer\">\n"-
104 " <method name=\"Ping\"/>\n"-
105 " <method name=\"GetMachineId\">\n"-
106 " <arg name=\"machine_uuid\" type=\"s\" direction=\"out\"/>\n"-
107 " </method>\n"-
108 " </interface>\n";-
109-
110static QString generateSubObjectXml(QObject *object)-
111{-
112 QString retval;-
113 const QObjectList &objs = object->children();-
114 QObjectList::ConstIterator it = objs.constBegin();-
115 QObjectList::ConstIterator end = objs.constEnd();-
116 for ( ; it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
117 QString name = (*it)->objectName();-
118 if (!name.isEmpty() && QDBusUtil::isValidPartOfObjectPath(name))
!name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
QDBusUtil::isV...jectPath(name)Description
TRUEnever evaluated
FALSEnever evaluated
0
119 retval += QString::fromLatin1(" <node name=\"%1\"/>\n")
never executed: retval += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(name);
0
120 .arg(name);
never executed: retval += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(name);
0
121 }
never executed: end of block
0
122 return retval;
never executed: return retval;
0
123}-
124-
125// declared as extern in qdbusconnection_p.h-
126-
127QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path)-
128{-
129 // object may be null-
130-
131 QString xml_data(QLatin1String(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE));-
132 xml_data += QLatin1String("<node>\n");-
133-
134 if (node.obj) {
node.objDescription
TRUEevaluated 85 times by 11 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
1-85
135 Q_ASSERT_X(QThread::currentThread() == node.obj->thread(),-
136 "QDBusConnection: internal threading error",-
137 "function called for an object that is in another thread!!");-
138-
139 if (node.flags & (QDBusConnection::ExportScriptableContents
node.flags & (...tableContents)Description
TRUEevaluated 12 times by 7 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
FALSEevaluated 73 times by 5 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
12-73
140 | QDBusConnection::ExportNonScriptableContents)) {
node.flags & (...tableContents)Description
TRUEevaluated 12 times by 7 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
FALSEevaluated 73 times by 5 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
12-73
141 // create XML for the object itself-
142 const QMetaObject *mo = node.obj->metaObject();-
143 for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass())
mo != &QObject...aticMetaObjectDescription
TRUEevaluated 12 times by 7 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
FALSEevaluated 12 times by 7 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
12
144 xml_data += qDBusGenerateMetaObjectXml(node.interfaceName, mo, mo->superClass(),
executed 12 times by 7 tests: xml_data += qDBusGenerateMetaObjectXml(node.interfaceName, mo, mo->superClass(), node.flags);
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
12
145 node.flags);
executed 12 times by 7 tests: xml_data += qDBusGenerateMetaObjectXml(node.interfaceName, mo, mo->superClass(), node.flags);
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
12
146 }
executed 12 times by 7 tests: end of block
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
12
147-
148 // does this object have adaptors?-
149 QDBusAdaptorConnector *connector;-
150 if (node.flags & QDBusConnection::ExportAdaptors &&
node.flags & Q...ExportAdaptorsDescription
TRUEevaluated 75 times by 6 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
FALSEevaluated 10 times by 7 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbusthreading - unknown status
10-75
151 (connector = qDBusFindAdaptorConnector(node.obj))) {
(connector = q...tor(node.obj))Description
TRUEevaluated 75 times by 6 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
FALSEnever evaluated
0-75
152-
153 // trasverse every adaptor in this object-
154 QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin();-
155 QDBusAdaptorConnector::AdaptorMap::ConstIterator end = connector->adaptors.constEnd();-
156 for ( ; it != end; ++it) {
it != endDescription
TRUEevaluated 129 times by 5 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
FALSEevaluated 75 times by 6 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
75-129
157 // add the interface:-
158 QString ifaceXml = QDBusAbstractAdaptorPrivate::retrieveIntrospectionXml(it->adaptor);-
159 if (ifaceXml.isEmpty()) {
ifaceXml.isEmpty()Description
TRUEevaluated 89 times by 5 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
FALSEevaluated 40 times by 2 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusthreading - unknown status
40-89
160 // add the interface's contents:-
161 ifaceXml += qDBusGenerateMetaObjectXml(QString::fromLatin1(it->interface),-
162 it->adaptor->metaObject(),-
163 &QDBusAbstractAdaptor::staticMetaObject,-
164 QDBusConnection::ExportScriptableContents-
165 | QDBusConnection::ExportNonScriptableContents);-
166-
167 QDBusAbstractAdaptorPrivate::saveIntrospectionXml(it->adaptor, ifaceXml);-
168 }
executed 89 times by 5 tests: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
89
169-
170 xml_data += ifaceXml;-
171 }
executed 129 times by 5 tests: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
129
172 }
executed 75 times by 6 tests: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
75
173-
174 // is it a virtual node that handles introspection itself?-
175 if (node.flags & QDBusConnectionPrivate::VirtualObject) {
node.flags & Q...:VirtualObjectDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qdbusinterface - unknown status
FALSEevaluated 83 times by 11 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
2-83
176 xml_data += node.treeNode->introspect(path);-
177 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qdbusinterface - unknown status
2
178-
179 xml_data += QLatin1String( propertiesInterfaceXml );-
180 }
executed 85 times by 11 tests: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
85
181-
182 xml_data += QLatin1String( introspectableInterfaceXml );-
183 xml_data += QLatin1String( peerInterfaceXml );-
184-
185 if (node.flags & QDBusConnection::ExportChildObjects) {
node.flags & Q...rtChildObjectsDescription
TRUEnever evaluated
FALSEevaluated 86 times by 11 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
0-86
186 xml_data += generateSubObjectXml(node.obj);-
187 } else {
never executed: end of block
0
188 // generate from the object tree-
189 QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it =-
190 node.children.constBegin();-
191 QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end =-
192 node.children.constEnd();-
193 for ( ; it != end; ++it)
it != endDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 86 times by 11 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
28-86
194 if (it->obj || !it->children.isEmpty())
it->objDescription
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
!it->children.isEmpty()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-28
195 xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n")
executed 28 times by 1 test: xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(it->name);
Executed by:
  • tst_qdbusabstractadaptor - unknown status
28
196 .arg(it->name);
executed 28 times by 1 test: xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(it->name);
Executed by:
  • tst_qdbusabstractadaptor - unknown status
28
197 }
executed 86 times by 11 tests: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
86
198-
199 xml_data += QLatin1String("</node>\n");-
200 return xml_data;
executed 86 times by 11 tests: return xml_data;
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusconnection - unknown status
  • tst_qdbusconnection_no_app - unknown status
  • tst_qdbusconnection_spyhook - unknown status
  • tst_qdbuscontext - unknown status
  • tst_qdbusinterface - unknown status
  • tst_qdbuspendingcall - unknown status
  • tst_qdbuspendingreply - unknown status
  • tst_qdbusreply - unknown status
  • tst_qdbusthreading - unknown status
86
201}-
202-
203// implement the D-Bus interface org.freedesktop.DBus.Properties-
204-
205static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name)-
206{-
207 return msg.createErrorReply(QDBusError::UnknownInterface,
executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
8
208 QString::fromLatin1("Interface %1 was not found in object %2")
executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
8
209 .arg(interface_name)
executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
8
210 .arg(msg.path()));
executed 8 times by 1 test: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
8
211}-
212-
213static inline QDBusMessage-
214propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name)-
215{-
216 return msg.createErrorReply(QDBusError::UnknownProperty,
never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path()));
0
217 QString::fromLatin1("Property %1%2%3 was not found in object %4")
never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path()));
0
218 .arg(interface_name,
never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path()));
0
219 QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path()));
0
220 QString::fromLatin1(property_name),
never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path()));
0
221 msg.path()));
never executed: return msg.createErrorReply(QDBusError::UnknownProperty, QString::fromLatin1("Property %1%2%3 was not found in object %4") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name), msg.path()));
0
222}-
223-
224QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node,-
225 const QDBusMessage &msg)-
226{-
227 Q_ASSERT(msg.arguments().count() == 2);-
228 Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(),-
229 "QDBusConnection: internal threading error",-
230 "function called for an object that is in another thread!!");-
231-
232 QString interface_name = msg.arguments().at(0).toString();-
233 QByteArray property_name = msg.arguments().at(1).toString().toUtf8();-
234-
235 QDBusAdaptorConnector *connector;-
236 QVariant value;-
237 bool interfaceFound = false;-
238 if (node.flags & QDBusConnection::ExportAdaptors &&
node.flags & Q...ExportAdaptorsDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16-26
239 (connector = qDBusFindAdaptorConnector(node.obj))) {
(connector = q...tor(node.obj))Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-26
240-
241 // find the class that implements interface_name or try until we've found the property-
242 // in case of an empty interface-
243 if (interface_name.isEmpty()) {
interface_name.isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
12-14
244 for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(),-
245 end = connector->adaptors.constEnd(); it != end; ++it) {
it != endDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
4-38
246 const QMetaObject *mo = it->adaptor->metaObject();-
247 int pidx = mo->indexOfProperty(property_name);-
248 if (pidx != -1) {
pidx != -1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
8-30
249 value = mo->property(pidx).read(it->adaptor);-
250 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qdbusabstractadaptor - unknown status
8
251 }-
252 }
executed 30 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
30
253 } else {
executed 12 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
12
254 QDBusAdaptorConnector::AdaptorMap::ConstIterator it;-
255 it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),-
256 interface_name);-
257 if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
it != connecto...ors.constEnd()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
interface_name...it->interface)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
0-14
258 interfaceFound = true;-
259 value = it->adaptor->property(property_name);-
260 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
12
261 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
14
262 }-
263-
264 if (!interfaceFound && !value.isValid()
!interfaceFoundDescription
TRUEevaluated 30 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
!value.isValid()Description
TRUEevaluated 22 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
8-30
265 && node.flags & (QDBusConnection::ExportAllProperties |
node.flags & (...bleProperties)Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
6-16
266 QDBusConnection::ExportNonScriptableProperties)) {
node.flags & (...bleProperties)Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
6-16
267 // try the object itself-
268 if (!interface_name.isEmpty())
!interface_name.isEmpty()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
269 interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
executed 16 times by 2 tests: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
270-
271 if (interfaceFound) {
interfaceFoundDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
272 int pidx = node.obj->metaObject()->indexOfProperty(property_name);-
273 if (pidx != -1) {
pidx != -1Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
274 QMetaProperty mp = node.obj->metaObject()->property(pidx);-
275 if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
mp.isScriptable()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
(node.flags & ...bleProperties)Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
276 (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
!mp.isScriptable()Description
TRUEnever evaluated
FALSEnever evaluated
(node.flags & ...bleProperties)Description
TRUEnever evaluated
FALSEnever evaluated
0
277 value = mp.read(node.obj);
executed 16 times by 2 tests: value = mp.read(node.obj);
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
278 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
279 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
280 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
281-
282 if (!value.isValid()) {
!value.isValid()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 36 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
6-36
283 // the property was not found-
284 if (!interfaceFound)
!interfaceFoundDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-6
285 return interfaceNotFoundError(msg, interface_name);
executed 6 times by 1 test: return interfaceNotFoundError(msg, interface_name);
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
286 return propertyNotFoundError(msg, interface_name, property_name);
never executed: return propertyNotFoundError(msg, interface_name, property_name);
0
287 }-
288-
289 return msg.createReply(QVariant::fromValue(QDBusVariant(value)));
executed 36 times by 3 tests: return msg.createReply(QVariant::fromValue(QDBusVariant(value)));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
36
290}-
291-
292enum PropertyWriteResult {-
293 PropertyWriteSuccess = 0,-
294 PropertyNotFound,-
295 PropertyTypeMismatch,-
296 PropertyReadOnly,-
297 PropertyWriteFailed-
298};-
299-
300static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name,-
301 const QByteArray &property_name, int status)-
302{-
303 switch (status) {-
304 case PropertyNotFound:
never executed: case PropertyNotFound:
0
305 return propertyNotFoundError(msg, interface_name, property_name);
never executed: return propertyNotFoundError(msg, interface_name, property_name);
0
306 case PropertyTypeMismatch:
never executed: case PropertyTypeMismatch:
0
307 return msg.createErrorReply(QDBusError::InvalidArgs,
never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
0
308 QString::fromLatin1("Invalid arguments for writing to property %1%2%3")
never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
0
309 .arg(interface_name,
never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
0
310 QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
0
311 QString::fromLatin1(property_name)));
never executed: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
0
312 case PropertyReadOnly:
executed 6 times by 1 test: case PropertyReadOnly:
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
313 return msg.createErrorReply(QDBusError::PropertyReadOnly,
executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
314 QString::fromLatin1("Property %1%2%3 is read-only")
executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
315 .arg(interface_name,
executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
316 QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
317 QString::fromLatin1(property_name)));
executed 6 times by 1 test: return msg.createErrorReply(QDBusError::PropertyReadOnly, QString::fromLatin1("Property %1%2%3 is read-only") .arg(interface_name, QString::fromLatin1(interface_name.isEmpty() ? "" : "."), QString::fromLatin1(property_name)));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
318 case PropertyWriteFailed:
never executed: case PropertyWriteFailed:
0
319 return msg.createErrorReply(QDBusError::InternalError,
never executed: return msg.createErrorReply(QDBusError::InternalError, QString::fromLatin1("Internal error"));
0
320 QString::fromLatin1("Internal error"));
never executed: return msg.createErrorReply(QDBusError::InternalError, QString::fromLatin1("Internal error"));
0
321-
322 case PropertyWriteSuccess:
executed 22 times by 3 tests: case PropertyWriteSuccess:
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
22
323 return msg.createReply();
executed 22 times by 3 tests: return msg.createReply();
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
22
324 }-
325 Q_ASSERT_X(false, "", "Should not be reached");-
326 return QDBusMessage();
never executed: return QDBusMessage();
0
327}-
328-
329static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value,-
330 int propFlags = QDBusConnection::ExportAllProperties)-
331{-
332 const QMetaObject *mo = obj->metaObject();-
333 int pidx = mo->indexOfProperty(property_name);-
334 if (pidx == -1) {
pidx == -1Description
TRUEnever evaluated
FALSEevaluated 28 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
0-28
335 // this object has no property by that name-
336 return PropertyNotFound;
never executed: return PropertyNotFound;
0
337 }-
338-
339 QMetaProperty mp = mo->property(pidx);-
340-
341 // check if this property is writable-
342 if (!mp.isWritable())
!mp.isWritable()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 22 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
6-22
343 return PropertyReadOnly;
executed 6 times by 1 test: return PropertyReadOnly;
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
344-
345 // check if this property is exported-
346 bool isScriptable = mp.isScriptable();-
347 if (!(propFlags & QDBusConnection::ExportScriptableProperties) && isScriptable)
!(propFlags & ...bleProperties)Description
TRUEnever evaluated
FALSEevaluated 22 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
isScriptableDescription
TRUEnever evaluated
FALSEnever evaluated
0-22
348 return PropertyNotFound;
never executed: return PropertyNotFound;
0
349 if (!(propFlags & QDBusConnection::ExportNonScriptableProperties) && !isScriptable)
!(propFlags & ...bleProperties)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusinterface - unknown status
!isScriptableDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
0-12
350 return PropertyNotFound;
never executed: return PropertyNotFound;
0
351-
352 // we found our property-
353 // do we have the right type?-
354 int id = mp.userType();-
355 if (!id){
!idDescription
TRUEnever evaluated
FALSEevaluated 22 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
0-22
356 // type not registered or invalid / void?-
357 qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",-
358 mp.typeName(), mo->className(), property_name.constData());-
359 return PropertyWriteFailed;
never executed: return PropertyWriteFailed;
0
360 }-
361-
362 if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) {
id != QMetaType::QVariantDescription
TRUEevaluated 22 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
value.userType...Id::argument()Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEevaluated 16 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
0-22
363 // we have to demarshall before writing-
364 void *null = 0;-
365 QVariant other(id, null);-
366 if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) {
!QDBusMetaType... other.data())Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
0-6
367 qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. "-
368 "Use qDBusRegisterMetaType to register it",-
369 mp.typeName(), id);-
370 return PropertyWriteFailed;
never executed: return PropertyWriteFailed;
0
371 }-
372-
373 value = other;-
374 }
executed 6 times by 2 tests: end of block
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
6
375-
376 if (mp.userType() == qMetaTypeId<QDBusVariant>())
mp.userType() ...DBusVariant>()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
4-18
377 value = QVariant::fromValue(QDBusVariant(value));
executed 4 times by 1 test: value = QVariant::fromValue(QDBusVariant(value));
Executed by:
  • tst_qdbusabstractinterface - unknown status
4
378-
379 // the property type here should match-
380 return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;
executed 22 times by 3 tests: return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;
Executed by:
  • tst_qdbusabstractadaptor - unknown status
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
22
381}-
382-
383QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,-
384 const QDBusMessage &msg)-
385{-
386 Q_ASSERT(msg.arguments().count() == 3);-
387 Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(),-
388 "QDBusConnection: internal threading error",-
389 "function called for an object that is in another thread!!");-
390-
391 QString interface_name = msg.arguments().at(0).toString();-
392 QByteArray property_name = msg.arguments().at(1).toString().toUtf8();-
393 QVariant value = qvariant_cast<QDBusVariant>(msg.arguments().at(2)).variant();-
394-
395 QDBusAdaptorConnector *connector;-
396 if (node.flags & QDBusConnection::ExportAdaptors &&
node.flags & Q...ExportAdaptorsDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
12-16
397 (connector = qDBusFindAdaptorConnector(node.obj))) {
(connector = q...tor(node.obj))Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-12
398-
399 // find the class that implements interface_name or try until we've found the property-
400 // in case of an empty interface-
401 if (interface_name.isEmpty()) {
interface_name.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
0-12
402 for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(),-
403 end = connector->adaptors.constEnd(); it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
404 int status = writeProperty(it->adaptor, property_name, value);-
405 if (status == PropertyNotFound)
status == PropertyNotFoundDescription
TRUEnever evaluated
FALSEnever evaluated
0
406 continue;
never executed: continue;
0
407 return propertyWriteReply(msg, interface_name, property_name, status);
never executed: return propertyWriteReply(msg, interface_name, property_name, status);
0
408 }-
409 } else {
never executed: end of block
0
410 QDBusAdaptorConnector::AdaptorMap::ConstIterator it;-
411 it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),-
412 interface_name);-
413 if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) {
it != connecto...adaptors.end()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
interface_name...it->interface)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-12
414 return propertyWriteReply(msg, interface_name, property_name,
executed 12 times by 1 test: return propertyWriteReply(msg, interface_name, property_name, writeProperty(it->adaptor, property_name, value));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
12
415 writeProperty(it->adaptor, property_name, value));
executed 12 times by 1 test: return propertyWriteReply(msg, interface_name, property_name, writeProperty(it->adaptor, property_name, value));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
12
416 }-
417 }
never executed: end of block
0
418 }-
419-
420 if (node.flags & (QDBusConnection::ExportScriptableProperties |
node.flags & (...bleProperties)Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
421 QDBusConnection::ExportNonScriptableProperties)) {
node.flags & (...bleProperties)Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
422 // try the object itself-
423 bool interfaceFound = true;-
424 if (!interface_name.isEmpty())
!interface_name.isEmpty()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
425 interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
executed 16 times by 2 tests: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
426-
427 if (interfaceFound) {
interfaceFoundDescription
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
FALSEnever evaluated
0-16
428 return propertyWriteReply(msg, interface_name, property_name,
executed 16 times by 2 tests: return propertyWriteReply(msg, interface_name, property_name, writeProperty(node.obj, property_name, value, node.flags));
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
429 writeProperty(node.obj, property_name, value, node.flags));
executed 16 times by 2 tests: return propertyWriteReply(msg, interface_name, property_name, writeProperty(node.obj, property_name, value, node.flags));
Executed by:
  • tst_qdbusabstractinterface - unknown status
  • tst_qdbusinterface - unknown status
16
430 }-
431 }
never executed: end of block
0
432-
433 // the property was not found-
434 if (!interface_name.isEmpty())
!interface_name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
435 return interfaceNotFoundError(msg, interface_name);
never executed: return interfaceNotFoundError(msg, interface_name);
0
436 return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound);
never executed: return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound);
0
437}-
438-
439// unite two QVariantMaps, but don't generate duplicate keys-
440static QVariantMap &operator+=(QVariantMap &lhs, const QVariantMap &rhs)-
441{-
442 QVariantMap::ConstIterator it = rhs.constBegin(),-
443 end = rhs.constEnd();-
444 for ( ; it != end; ++it)
it != endDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
16-32
445 lhs.insert(it.key(), it.value());
executed 32 times by 1 test: lhs.insert(it.key(), it.value());
Executed by:
  • tst_qdbusabstractadaptor - unknown status
32
446 return lhs;
executed 16 times by 1 test: return lhs;
Executed by:
  • tst_qdbusabstractadaptor - unknown status
16
447}-
448-
449static QVariantMap readAllProperties(QObject *object, int flags)-
450{-
451 QVariantMap result;-
452 const QMetaObject *mo = object->metaObject();-
453-
454 // QObject has properties, so don't start from 0-
455 for (int i = QObject::staticMetaObject.propertyCount(); i < mo->propertyCount(); ++i) {
i < mo->propertyCount()Description
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
22-54
456 QMetaProperty mp = mo->property(i);-
457-
458 // is it readable?-
459 if (!mp.isReadable())
!mp.isReadable()Description
TRUEnever evaluated
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
0-54
460 continue;
never executed: continue;
0
461-
462 // is it a registered property?-
463 int typeId = mp.userType();-
464 if (!typeId)
!typeIdDescription
TRUEnever evaluated
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
0-54
465 continue;
never executed: continue;
0
466 const char *signature = QDBusMetaType::typeToSignature(typeId);-
467 if (!signature)
!signatureDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
6-48
468 continue;
executed 6 times by 1 test: continue;
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
469-
470 // is this property visible from the outside?-
471 if ((mp.isScriptable() && flags & QDBusConnection::ExportScriptableProperties) ||
mp.isScriptable()Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
flags & QDBusC...ablePropertiesDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-48
472 (!mp.isScriptable() && flags & QDBusConnection::ExportNonScriptableProperties)) {
!mp.isScriptable()Description
TRUEnever evaluated
FALSEnever evaluated
flags & QDBusC...ablePropertiesDescription
TRUEnever evaluated
FALSEnever evaluated
0
473 // yes, it's visible-
474 QVariant value = mp.read(object);-
475 if (value.isValid())
value.isValid()Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-48
476 result.insert(QString::fromLatin1(mp.name()), value);
executed 48 times by 1 test: result.insert(QString::fromLatin1(mp.name()), value);
Executed by:
  • tst_qdbusabstractadaptor - unknown status
48
477 }
executed 48 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
48
478 }
executed 48 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
48
479-
480 return result;
executed 22 times by 1 test: return result;
Executed by:
  • tst_qdbusabstractadaptor - unknown status
22
481}-
482-
483QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node,-
484 const QDBusMessage &msg)-
485{-
486 Q_ASSERT(msg.arguments().count() == 1);-
487 Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(),-
488 "QDBusConnection: internal threading error",-
489 "function called for an object that is in another thread!!");-
490-
491 QString interface_name = msg.arguments().at(0).toString();-
492-
493 bool interfaceFound = false;-
494 QVariantMap result;-
495-
496 QDBusAdaptorConnector *connector;-
497 if (node.flags & QDBusConnection::ExportAdaptors &&
node.flags & Q...ExportAdaptorsDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-12
498 (connector = qDBusFindAdaptorConnector(node.obj))) {
(connector = q...tor(node.obj))Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
0-12
499-
500 if (interface_name.isEmpty()) {
interface_name.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
4-8
501 // iterate over all interfaces-
502 for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(),-
503 end = connector->adaptors.constEnd(); it != end; ++it) {
it != endDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
4-16
504 result += readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties);-
505 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
16
506 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
4
507 // find the class that implements interface_name-
508 QDBusAdaptorConnector::AdaptorMap::ConstIterator it;-
509 it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),-
510 interface_name);-
511 if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
it != connecto...ors.constEnd()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEnever evaluated
interface_name...it->interface)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
0-8
512 interfaceFound = true;-
513 result = readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties);-
514 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
6
515 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qdbusabstractadaptor - unknown status
8
516 }-
517-
518 if (node.flags & QDBusConnection::ExportAllProperties &&
node.flags & Q...tAllPropertiesDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
0-12
519 (!interfaceFound || interface_name.isEmpty())) {
!interfaceFoundDescription
TRUEnever evaluated
FALSEnever evaluated
interface_name.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
520 // try the object itself-
521 result += readAllProperties(node.obj, node.flags);-
522 interfaceFound = true;-
523 }
never executed: end of block
0
524-
525 if (!interfaceFound && !interface_name.isEmpty()) {
!interfaceFoundDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
!interface_name.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qdbusabstractadaptor - unknown status
2-6
526 // the interface was not found-
527 return interfaceNotFoundError(msg, interface_name);
executed 2 times by 1 test: return interfaceNotFoundError(msg, interface_name);
Executed by:
  • tst_qdbusabstractadaptor - unknown status
2
528 }-
529-
530 return msg.createReply(QVariant::fromValue(result));
executed 10 times by 1 test: return msg.createReply(QVariant::fromValue(result));
Executed by:
  • tst_qdbusabstractadaptor - unknown status
10
531}-
532-
533QT_END_NAMESPACE-
534-
535#endif // QT_NO_DBUS-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9