| Line | Source Code | Coverage |
|---|
| 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 "qdbusconnection_p.h" | - |
| 43 | | - |
| 44 | #include "qdbus_symbols_p.h" | - |
| 45 | #include <QtCore/qcoreapplication.h> | - |
| 46 | #include <QtCore/qmetaobject.h> | - |
| 47 | #include <QtCore/qstringlist.h> | - |
| 48 | #include <QtCore/qthread.h> | - |
| 49 | | - |
| 50 | #include "qdbusabstractadaptor.h" | - |
| 51 | #include "qdbusabstractadaptor_p.h" | - |
| 52 | #include "qdbusconnection.h" | - |
| 53 | #include "qdbusextratypes.h" | - |
| 54 | #include "qdbusmessage.h" | - |
| 55 | #include "qdbusmetatype.h" | - |
| 56 | #include "qdbusmetatype_p.h" | - |
| 57 | #include "qdbusmessage_p.h" | - |
| 58 | #include "qdbusutil_p.h" | - |
| 59 | #include "qdbusvirtualobject.h" | - |
| 60 | | - |
| 61 | #include <algorithm> | - |
| 62 | | - |
| 63 | #ifndef QT_NO_DBUS | - |
| 64 | | - |
| 65 | QT_BEGIN_NAMESPACE | - |
| 66 | | - |
| 67 | // defined in qdbusxmlgenerator.cpp | - |
| 68 | extern QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo, | - |
| 69 | const QMetaObject *base, int flags); | - |
| 70 | | - |
| 71 | static const char introspectableInterfaceXml[] = | - |
| 72 | " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" | - |
| 73 | " <method name=\"Introspect\">\n" | - |
| 74 | " <arg name=\"xml_data\" type=\"s\" direction=\"out\"/>\n" | - |
| 75 | " </method>\n" | - |
| 76 | " </interface>\n"; | - |
| 77 | | - |
| 78 | static const char propertiesInterfaceXml[] = | - |
| 79 | " <interface name=\"org.freedesktop.DBus.Properties\">\n" | - |
| 80 | " <method name=\"Get\">\n" | - |
| 81 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 82 | " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 83 | " <arg name=\"value\" type=\"v\" direction=\"out\"/>\n" | - |
| 84 | " </method>\n" | - |
| 85 | " <method name=\"Set\">\n" | - |
| 86 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 87 | " <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 88 | " <arg name=\"value\" type=\"v\" direction=\"in\"/>\n" | - |
| 89 | " </method>\n" | - |
| 90 | " <method name=\"GetAll\">\n" | - |
| 91 | " <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n" | - |
| 92 | " <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n" | - |
| 93 | " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n" | - |
| 94 | " </method>\n" | - |
| 95 | " </interface>\n"; | - |
| 96 | | - |
| 97 | static const char peerInterfaceXml[] = | - |
| 98 | " <interface name=\"org.freedesktop.DBus.Peer\">\n" | - |
| 99 | " <method name=\"Ping\"/>\n" | - |
| 100 | " <method name=\"GetMachineId\">\n" | - |
| 101 | " <arg name=\"machine_uuid\" type=\"s\" direction=\"out\"/>\n" | - |
| 102 | " </method>\n" | - |
| 103 | " </interface>\n"; | - |
| 104 | | - |
| 105 | static QString generateSubObjectXml(QObject *object) | - |
| 106 | { | - |
| 107 | QString retval; never executed (the execution status of this line is deduced): QString retval; | - |
| 108 | const QObjectList &objs = object->children(); never executed (the execution status of this line is deduced): const QObjectList &objs = object->children(); | - |
| 109 | QObjectList::ConstIterator it = objs.constBegin(); never executed (the execution status of this line is deduced): QObjectList::ConstIterator it = objs.constBegin(); | - |
| 110 | QObjectList::ConstIterator end = objs.constEnd(); never executed (the execution status of this line is deduced): QObjectList::ConstIterator end = objs.constEnd(); | - |
| 111 | for ( ; it != end; ++it) { never evaluated: it != end | 0 |
| 112 | QString name = (*it)->objectName(); never executed (the execution status of this line is deduced): QString name = (*it)->objectName(); | - |
| 113 | if (!name.isEmpty() && QDBusUtil::isValidPartOfObjectPath(name)) never evaluated: !name.isEmpty() never evaluated: QDBusUtil::isValidPartOfObjectPath(name) | 0 |
| 114 | retval += QString::fromLatin1(" <node name=\"%1\"/>\n") never executed: retval += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(name); | 0 |
| 115 | .arg(name); never executed: retval += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(name); | 0 |
| 116 | } | 0 |
| 117 | return retval; never executed: return retval; | 0 |
| 118 | } | - |
| 119 | | - |
| 120 | // declared as extern in qdbusconnection_p.h | - |
| 121 | | - |
| 122 | QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path) | - |
| 123 | { | - |
| 124 | // object may be null | - |
| 125 | | - |
| 126 | QString xml_data(QLatin1String(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE)); executed (the execution status of this line is deduced): QString xml_data(QLatin1String("<!DOCTYPE node PUBLIC \"""-//freedesktop//DTD D-BUS Object Introspection 1.0//EN""\"\n\"""http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd""\">\n")); | - |
| 127 | xml_data += QLatin1String("<node>\n"); executed (the execution status of this line is deduced): xml_data += QLatin1String("<node>\n"); | - |
| 128 | | - |
| 129 | if (node.obj) { partially evaluated: node.obj| yes Evaluation Count:55 | no Evaluation Count:0 |
| 0-55 |
| 130 | Q_ASSERT_X(QThread::currentThread() == node.obj->thread(), executed (the execution status of this line is deduced): qt_noop(); | - |
| 131 | "QDBusConnection: internal threading error", | - |
| 132 | "function called for an object that is in another thread!!"); | - |
| 133 | | - |
| 134 | if (node.flags & (QDBusConnection::ExportScriptableContents evaluated: node.flags & (QDBusConnection::ExportScriptableContents | QDBusConnection::ExportNonScriptableContents)| yes Evaluation Count:9 | yes Evaluation Count:46 |
| 9-46 |
| 135 | | QDBusConnection::ExportNonScriptableContents)) { evaluated: node.flags & (QDBusConnection::ExportScriptableContents | QDBusConnection::ExportNonScriptableContents)| yes Evaluation Count:9 | yes Evaluation Count:46 |
| 9-46 |
| 136 | // create XML for the object itself | - |
| 137 | const QMetaObject *mo = node.obj->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *mo = node.obj->metaObject(); | - |
| 138 | for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass()) evaluated: mo != &QObject::staticMetaObject| yes Evaluation Count:9 | yes Evaluation Count:9 |
| 9 |
| 139 | xml_data += qDBusGenerateMetaObjectXml(QString(), mo, mo->superClass(), executed: xml_data += qDBusGenerateMetaObjectXml(QString(), mo, mo->superClass(), node.flags);Execution Count:9 | 9 |
| 140 | node.flags); executed: xml_data += qDBusGenerateMetaObjectXml(QString(), mo, mo->superClass(), node.flags);Execution Count:9 | 9 |
| 141 | } executed: }Execution Count:9 | 9 |
| 142 | | - |
| 143 | // does this object have adaptors? | - |
| 144 | QDBusAdaptorConnector *connector; executed (the execution status of this line is deduced): QDBusAdaptorConnector *connector; | - |
| 145 | if (node.flags & QDBusConnection::ExportAdaptors && evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:48 | yes Evaluation Count:7 |
| 7-48 |
| 146 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:48 | no Evaluation Count:0 |
| 0-48 |
| 147 | | - |
| 148 | // trasverse every adaptor in this object | - |
| 149 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(); executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(); | - |
| 150 | QDBusAdaptorConnector::AdaptorMap::ConstIterator end = connector->adaptors.constEnd(); executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator end = connector->adaptors.constEnd(); | - |
| 151 | for ( ; it != end; ++it) { evaluated: it != end| yes Evaluation Count:73 | yes Evaluation Count:48 |
| 48-73 |
| 152 | // add the interface: | - |
| 153 | QString ifaceXml = QDBusAbstractAdaptorPrivate::retrieveIntrospectionXml(it->adaptor); executed (the execution status of this line is deduced): QString ifaceXml = QDBusAbstractAdaptorPrivate::retrieveIntrospectionXml(it->adaptor); | - |
| 154 | if (ifaceXml.isEmpty()) { evaluated: ifaceXml.isEmpty()| yes Evaluation Count:54 | yes Evaluation Count:19 |
| 19-54 |
| 155 | // add the interface's contents: | - |
| 156 | ifaceXml += qDBusGenerateMetaObjectXml(QString::fromLatin1(it->interface), executed (the execution status of this line is deduced): ifaceXml += qDBusGenerateMetaObjectXml(QString::fromLatin1(it->interface), | - |
| 157 | it->adaptor->metaObject(), executed (the execution status of this line is deduced): it->adaptor->metaObject(), | - |
| 158 | &QDBusAbstractAdaptor::staticMetaObject, executed (the execution status of this line is deduced): &QDBusAbstractAdaptor::staticMetaObject, | - |
| 159 | QDBusConnection::ExportScriptableContents executed (the execution status of this line is deduced): QDBusConnection::ExportScriptableContents | - |
| 160 | | QDBusConnection::ExportNonScriptableContents); executed (the execution status of this line is deduced): | QDBusConnection::ExportNonScriptableContents); | - |
| 161 | | - |
| 162 | QDBusAbstractAdaptorPrivate::saveIntrospectionXml(it->adaptor, ifaceXml); executed (the execution status of this line is deduced): QDBusAbstractAdaptorPrivate::saveIntrospectionXml(it->adaptor, ifaceXml); | - |
| 163 | } executed: }Execution Count:54 | 54 |
| 164 | | - |
| 165 | xml_data += ifaceXml; executed (the execution status of this line is deduced): xml_data += ifaceXml; | - |
| 166 | } executed: }Execution Count:73 | 73 |
| 167 | } executed: }Execution Count:48 | 48 |
| 168 | | - |
| 169 | // is it a virtual node that handles introspection itself? | - |
| 170 | if (node.flags & QDBusConnectionPrivate::VirtualObject) { evaluated: node.flags & QDBusConnectionPrivate::VirtualObject| yes Evaluation Count:2 | yes Evaluation Count:53 |
| 2-53 |
| 171 | xml_data += node.treeNode->introspect(path); executed (the execution status of this line is deduced): xml_data += node.treeNode->introspect(path); | - |
| 172 | } executed: }Execution Count:2 | 2 |
| 173 | | - |
| 174 | xml_data += QLatin1String( propertiesInterfaceXml ); executed (the execution status of this line is deduced): xml_data += QLatin1String( propertiesInterfaceXml ); | - |
| 175 | } executed: }Execution Count:55 | 55 |
| 176 | | - |
| 177 | xml_data += QLatin1String( introspectableInterfaceXml ); executed (the execution status of this line is deduced): xml_data += QLatin1String( introspectableInterfaceXml ); | - |
| 178 | xml_data += QLatin1String( peerInterfaceXml ); executed (the execution status of this line is deduced): xml_data += QLatin1String( peerInterfaceXml ); | - |
| 179 | | - |
| 180 | if (node.flags & QDBusConnection::ExportChildObjects) { partially evaluated: node.flags & QDBusConnection::ExportChildObjects| no Evaluation Count:0 | yes Evaluation Count:55 |
| 0-55 |
| 181 | xml_data += generateSubObjectXml(node.obj); never executed (the execution status of this line is deduced): xml_data += generateSubObjectXml(node.obj); | - |
| 182 | } else { | 0 |
| 183 | // generate from the object tree | - |
| 184 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator it = | - |
| 185 | node.children.constBegin(); executed (the execution status of this line is deduced): node.children.constBegin(); | - |
| 186 | QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = executed (the execution status of this line is deduced): QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = | - |
| 187 | node.children.constEnd(); executed (the execution status of this line is deduced): node.children.constEnd(); | - |
| 188 | for ( ; it != end; ++it) evaluated: it != end| yes Evaluation Count:5 | yes Evaluation Count:55 |
| 5-55 |
| 189 | if (it->obj || !it->children.isEmpty()) partially evaluated: it->obj| no Evaluation Count:0 | yes Evaluation Count:5 |
partially evaluated: !it->children.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 190 | xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") never executed: xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(it->name); | 0 |
| 191 | .arg(it->name); never executed: xml_data += QString::fromLatin1(" <node name=\"%1\"/>\n") .arg(it->name); | 0 |
| 192 | } executed: }Execution Count:55 | 55 |
| 193 | | - |
| 194 | xml_data += QLatin1String("</node>\n"); executed (the execution status of this line is deduced): xml_data += QLatin1String("</node>\n"); | - |
| 195 | return xml_data; executed: return xml_data;Execution Count:55 | 55 |
| 196 | } | - |
| 197 | | - |
| 198 | // implement the D-Bus interface org.freedesktop.DBus.Properties | - |
| 199 | | - |
| 200 | static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const QString &interface_name) | - |
| 201 | { | - |
| 202 | return msg.createErrorReply(QDBusError::UnknownInterface, executed: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Execution Count:4 | 4 |
| 203 | QString::fromLatin1("Interface %1 was not found in object %2") executed: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Execution Count:4 | 4 |
| 204 | .arg(interface_name) executed: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Execution Count:4 | 4 |
| 205 | .arg(msg.path())); executed: return msg.createErrorReply(QDBusError::UnknownInterface, QString::fromLatin1("Interface %1 was not found in object %2") .arg(interface_name) .arg(msg.path()));Execution Count:4 | 4 |
| 206 | } | - |
| 207 | | - |
| 208 | static inline QDBusMessage | - |
| 209 | propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name) | - |
| 210 | { | - |
| 211 | 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 |
| 212 | 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 |
| 213 | .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 |
| 214 | 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 |
| 215 | 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 |
| 216 | 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 |
| 217 | } | - |
| 218 | | - |
| 219 | QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node, | - |
| 220 | const QDBusMessage &msg) | - |
| 221 | { | - |
| 222 | Q_ASSERT(msg.arguments().count() == 2); executed (the execution status of this line is deduced): qt_noop(); | - |
| 223 | Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(), executed (the execution status of this line is deduced): qt_noop(); | - |
| 224 | "QDBusConnection: internal threading error", | - |
| 225 | "function called for an object that is in another thread!!"); | - |
| 226 | | - |
| 227 | QString interface_name = msg.arguments().at(0).toString(); executed (the execution status of this line is deduced): QString interface_name = msg.arguments().at(0).toString(); | - |
| 228 | QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); executed (the execution status of this line is deduced): QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); | - |
| 229 | | - |
| 230 | QDBusAdaptorConnector *connector; executed (the execution status of this line is deduced): QDBusAdaptorConnector *connector; | - |
| 231 | QVariant value; executed (the execution status of this line is deduced): QVariant value; | - |
| 232 | bool interfaceFound = false; executed (the execution status of this line is deduced): bool interfaceFound = false; | - |
| 233 | if (node.flags & QDBusConnection::ExportAdaptors && evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:13 | yes Evaluation Count:8 |
| 8-13 |
| 234 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 235 | | - |
| 236 | // find the class that implements interface_name or try until we've found the property | - |
| 237 | // in case of an empty interface | - |
| 238 | if (interface_name.isEmpty()) { evaluated: interface_name.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:7 |
| 6-7 |
| 239 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), executed (the execution status of this line is deduced): for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - |
| 240 | end = connector->adaptors.constEnd(); it != end; ++it) { evaluated: it != end| yes Evaluation Count:19 | yes Evaluation Count:2 |
| 2-19 |
| 241 | const QMetaObject *mo = it->adaptor->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *mo = it->adaptor->metaObject(); | - |
| 242 | int pidx = mo->indexOfProperty(property_name); executed (the execution status of this line is deduced): int pidx = mo->indexOfProperty(property_name); | - |
| 243 | if (pidx != -1) { evaluated: pidx != -1| yes Evaluation Count:4 | yes Evaluation Count:15 |
| 4-15 |
| 244 | value = mo->property(pidx).read(it->adaptor); executed (the execution status of this line is deduced): value = mo->property(pidx).read(it->adaptor); | - |
| 245 | break; executed: break;Execution Count:4 | 4 |
| 246 | } | - |
| 247 | } executed: }Execution Count:15 | 15 |
| 248 | } else { executed: }Execution Count:6 | 6 |
| 249 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - |
| 250 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), executed (the execution status of this line is deduced): it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - |
| 251 | interface_name); executed (the execution status of this line is deduced): interface_name); | - |
| 252 | if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { partially evaluated: it != connector->adaptors.constEnd()| yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: interface_name == QLatin1String(it->interface)| yes Evaluation Count:6 | yes Evaluation Count:1 |
| 0-7 |
| 253 | interfaceFound = true; executed (the execution status of this line is deduced): interfaceFound = true; | - |
| 254 | value = it->adaptor->property(property_name); executed (the execution status of this line is deduced): value = it->adaptor->property(property_name); | - |
| 255 | } executed: }Execution Count:6 | 6 |
| 256 | } executed: }Execution Count:7 | 7 |
| 257 | } | - |
| 258 | | - |
| 259 | if (!interfaceFound && !value.isValid() evaluated: !interfaceFound| yes Evaluation Count:15 | yes Evaluation Count:6 |
evaluated: !value.isValid()| yes Evaluation Count:11 | yes Evaluation Count:4 |
| 4-15 |
| 260 | && node.flags & (QDBusConnection::ExportAllProperties | evaluated: node.flags & (QDBusConnection::ExportAllProperties | QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:8 | yes Evaluation Count:3 |
| 3-8 |
| 261 | QDBusConnection::ExportNonScriptableProperties)) { evaluated: node.flags & (QDBusConnection::ExportAllProperties | QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:8 | yes Evaluation Count:3 |
| 3-8 |
| 262 | // try the object itself | - |
| 263 | if (!interface_name.isEmpty()) partially evaluated: !interface_name.isEmpty()| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 264 | interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); executed: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);Execution Count:8 | 8 |
| 265 | | - |
| 266 | if (interfaceFound) { partially evaluated: interfaceFound| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 267 | int pidx = node.obj->metaObject()->indexOfProperty(property_name); executed (the execution status of this line is deduced): int pidx = node.obj->metaObject()->indexOfProperty(property_name); | - |
| 268 | if (pidx != -1) { partially evaluated: pidx != -1| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 269 | QMetaProperty mp = node.obj->metaObject()->property(pidx); executed (the execution status of this line is deduced): QMetaProperty mp = node.obj->metaObject()->property(pidx); | - |
| 270 | if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) || partially evaluated: mp.isScriptable()| yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: (node.flags & QDBusConnection::ExportScriptableProperties)| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 271 | (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties))) never evaluated: !mp.isScriptable() never evaluated: (node.flags & QDBusConnection::ExportNonScriptableProperties) | 0 |
| 272 | value = mp.read(node.obj); executed: value = mp.read(node.obj);Execution Count:8 | 8 |
| 273 | } executed: }Execution Count:8 | 8 |
| 274 | } executed: }Execution Count:8 | 8 |
| 275 | } executed: }Execution Count:8 | 8 |
| 276 | | - |
| 277 | if (!value.isValid()) { evaluated: !value.isValid()| yes Evaluation Count:3 | yes Evaluation Count:18 |
| 3-18 |
| 278 | // the property was not found | - |
| 279 | if (!interfaceFound) partially evaluated: !interfaceFound| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 280 | return interfaceNotFoundError(msg, interface_name); executed: return interfaceNotFoundError(msg, interface_name);Execution Count:3 | 3 |
| 281 | return propertyNotFoundError(msg, interface_name, property_name); never executed: return propertyNotFoundError(msg, interface_name, property_name); | 0 |
| 282 | } | - |
| 283 | | - |
| 284 | return msg.createReply(QVariant::fromValue(QDBusVariant(value))); executed: return msg.createReply(QVariant::fromValue(QDBusVariant(value)));Execution Count:18 | 18 |
| 285 | } | - |
| 286 | | - |
| 287 | enum PropertyWriteResult { | - |
| 288 | PropertyWriteSuccess = 0, | - |
| 289 | PropertyNotFound, | - |
| 290 | PropertyTypeMismatch, | - |
| 291 | PropertyReadOnly, | - |
| 292 | PropertyWriteFailed | - |
| 293 | }; | - |
| 294 | | - |
| 295 | static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name, | - |
| 296 | const QByteArray &property_name, int status) | - |
| 297 | { | - |
| 298 | switch (status) { | - |
| 299 | case PropertyNotFound: | - |
| 300 | return propertyNotFoundError(msg, interface_name, property_name); never executed: return propertyNotFoundError(msg, interface_name, property_name); | 0 |
| 301 | case PropertyTypeMismatch: | - |
| 302 | 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 |
| 303 | 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 |
| 304 | .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 |
| 305 | 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 |
| 306 | 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 |
| 307 | case PropertyReadOnly: | - |
| 308 | return msg.createErrorReply(QDBusError::PropertyReadOnly, executed: 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)));Execution Count:3 | 3 |
| 309 | QString::fromLatin1("Property %1%2%3 is read-only") executed: 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)));Execution Count:3 | 3 |
| 310 | .arg(interface_name, executed: 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)));Execution Count:3 | 3 |
| 311 | QString::fromLatin1(interface_name.isEmpty() ? "" : "."), executed: 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)));Execution Count:3 | 3 |
| 312 | QString::fromLatin1(property_name))); executed: 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)));Execution Count:3 | 3 |
| 313 | case PropertyWriteFailed: | - |
| 314 | return msg.createErrorReply(QDBusError::InternalError, never executed: return msg.createErrorReply(QDBusError::InternalError, QString::fromLatin1("Internal error")); | 0 |
| 315 | QString::fromLatin1("Internal error")); never executed: return msg.createErrorReply(QDBusError::InternalError, QString::fromLatin1("Internal error")); | 0 |
| 316 | | - |
| 317 | case PropertyWriteSuccess: | - |
| 318 | return msg.createReply(); executed: return msg.createReply();Execution Count:11 | 11 |
| 319 | } | - |
| 320 | Q_ASSERT_X(false, "", "Should not be reached"); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 321 | return QDBusMessage(); never executed: return QDBusMessage(); | 0 |
| 322 | } | - |
| 323 | | - |
| 324 | static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant value, | - |
| 325 | int propFlags = QDBusConnection::ExportAllProperties) | - |
| 326 | { | - |
| 327 | const QMetaObject *mo = obj->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *mo = obj->metaObject(); | - |
| 328 | int pidx = mo->indexOfProperty(property_name); executed (the execution status of this line is deduced): int pidx = mo->indexOfProperty(property_name); | - |
| 329 | if (pidx == -1) { partially evaluated: pidx == -1| no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
| 330 | // this object has no property by that name | - |
| 331 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 |
| 332 | } | - |
| 333 | | - |
| 334 | QMetaProperty mp = mo->property(pidx); executed (the execution status of this line is deduced): QMetaProperty mp = mo->property(pidx); | - |
| 335 | | - |
| 336 | // check if this property is writable | - |
| 337 | if (!mp.isWritable()) evaluated: !mp.isWritable()| yes Evaluation Count:3 | yes Evaluation Count:11 |
| 3-11 |
| 338 | return PropertyReadOnly; executed: return PropertyReadOnly;Execution Count:3 | 3 |
| 339 | | - |
| 340 | // check if this property is exported | - |
| 341 | bool isScriptable = mp.isScriptable(); executed (the execution status of this line is deduced): bool isScriptable = mp.isScriptable(); | - |
| 342 | if (!(propFlags & QDBusConnection::ExportScriptableProperties) && isScriptable) partially evaluated: !(propFlags & QDBusConnection::ExportScriptableProperties)| no Evaluation Count:0 | yes Evaluation Count:11 |
never evaluated: isScriptable | 0-11 |
| 343 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 |
| 344 | if (!(propFlags & QDBusConnection::ExportNonScriptableProperties) && !isScriptable) evaluated: !(propFlags & QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:6 | yes Evaluation Count:5 |
partially evaluated: !isScriptable| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 345 | return PropertyNotFound; never executed: return PropertyNotFound; | 0 |
| 346 | | - |
| 347 | // we found our property | - |
| 348 | // do we have the right type? | - |
| 349 | int id = mp.userType(); executed (the execution status of this line is deduced): int id = mp.userType(); | - |
| 350 | if (!id){ partially evaluated: !id| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 351 | // type not registered or invalid / void? | - |
| 352 | qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'", never executed (the execution status of this line is deduced): QMessageLogger("qdbusinternalfilters.cpp", 352, __PRETTY_FUNCTION__).warning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'", | - |
| 353 | mp.typeName(), mo->className(), property_name.constData()); never executed (the execution status of this line is deduced): mp.typeName(), mo->className(), property_name.constData()); | - |
| 354 | return PropertyWriteFailed; never executed: return PropertyWriteFailed; | 0 |
| 355 | } | - |
| 356 | | - |
| 357 | if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) { partially evaluated: id != QMetaType::QVariant| yes Evaluation Count:11 | no Evaluation Count:0 |
evaluated: value.userType() == QDBusMetaTypeId::argument()| yes Evaluation Count:3 | yes Evaluation Count:8 |
| 0-11 |
| 358 | // we have to demarshall before writing | - |
| 359 | void *null = 0; executed (the execution status of this line is deduced): void *null = 0; | - |
| 360 | QVariant other(id, null); executed (the execution status of this line is deduced): QVariant other(id, null); | - |
| 361 | if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())) { partially evaluated: !QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), id, other.data())| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 362 | qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " never executed (the execution status of this line is deduced): QMessageLogger("qdbusinternalfilters.cpp", 362, __PRETTY_FUNCTION__).warning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. " | - |
| 363 | "Use qDBusRegisterMetaType to register it", never executed (the execution status of this line is deduced): "Use qDBusRegisterMetaType to register it", | - |
| 364 | mp.typeName(), id); never executed (the execution status of this line is deduced): mp.typeName(), id); | - |
| 365 | return PropertyWriteFailed; never executed: return PropertyWriteFailed; | 0 |
| 366 | } | - |
| 367 | | - |
| 368 | value = other; executed (the execution status of this line is deduced): value = other; | - |
| 369 | } executed: }Execution Count:3 | 3 |
| 370 | | - |
| 371 | // the property type here should match | - |
| 372 | return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed; executed: return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;Execution Count:11 | 11 |
| 373 | } | - |
| 374 | | - |
| 375 | QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node, | - |
| 376 | const QDBusMessage &msg) | - |
| 377 | { | - |
| 378 | Q_ASSERT(msg.arguments().count() == 3); executed (the execution status of this line is deduced): qt_noop(); | - |
| 379 | Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(), executed (the execution status of this line is deduced): qt_noop(); | - |
| 380 | "QDBusConnection: internal threading error", | - |
| 381 | "function called for an object that is in another thread!!"); | - |
| 382 | | - |
| 383 | QString interface_name = msg.arguments().at(0).toString(); executed (the execution status of this line is deduced): QString interface_name = msg.arguments().at(0).toString(); | - |
| 384 | QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); executed (the execution status of this line is deduced): QByteArray property_name = msg.arguments().at(1).toString().toUtf8(); | - |
| 385 | QVariant value = qvariant_cast<QDBusVariant>(msg.arguments().at(2)).variant(); executed (the execution status of this line is deduced): QVariant value = qvariant_cast<QDBusVariant>(msg.arguments().at(2)).variant(); | - |
| 386 | | - |
| 387 | QDBusAdaptorConnector *connector; executed (the execution status of this line is deduced): QDBusAdaptorConnector *connector; | - |
| 388 | if (node.flags & QDBusConnection::ExportAdaptors && evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:6 | yes Evaluation Count:8 |
| 6-8 |
| 389 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 390 | | - |
| 391 | // find the class that implements interface_name or try until we've found the property | - |
| 392 | // in case of an empty interface | - |
| 393 | if (interface_name.isEmpty()) { partially evaluated: interface_name.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 394 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), never executed (the execution status of this line is deduced): for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - |
| 395 | end = connector->adaptors.constEnd(); it != end; ++it) { never evaluated: it != end | 0 |
| 396 | int status = writeProperty(it->adaptor, property_name, value); never executed (the execution status of this line is deduced): int status = writeProperty(it->adaptor, property_name, value); | - |
| 397 | if (status == PropertyNotFound) never evaluated: status == PropertyNotFound | 0 |
| 398 | continue; never executed: continue; | 0 |
| 399 | return propertyWriteReply(msg, interface_name, property_name, status); never executed: return propertyWriteReply(msg, interface_name, property_name, status); | 0 |
| 400 | } | - |
| 401 | } else { | 0 |
| 402 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - |
| 403 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), executed (the execution status of this line is deduced): it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - |
| 404 | interface_name); executed (the execution status of this line is deduced): interface_name); | - |
| 405 | if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) { partially evaluated: it != connector->adaptors.end()| yes Evaluation Count:6 | no Evaluation Count:0 |
partially evaluated: interface_name == QLatin1String(it->interface)| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 406 | return propertyWriteReply(msg, interface_name, property_name, executed: return propertyWriteReply(msg, interface_name, property_name, writeProperty(it->adaptor, property_name, value));Execution Count:6 | 6 |
| 407 | writeProperty(it->adaptor, property_name, value)); executed: return propertyWriteReply(msg, interface_name, property_name, writeProperty(it->adaptor, property_name, value));Execution Count:6 | 6 |
| 408 | } | - |
| 409 | } | 0 |
| 410 | } | - |
| 411 | | - |
| 412 | if (node.flags & (QDBusConnection::ExportScriptableProperties | partially evaluated: node.flags & (QDBusConnection::ExportScriptableProperties | QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 413 | QDBusConnection::ExportNonScriptableProperties)) { partially evaluated: node.flags & (QDBusConnection::ExportScriptableProperties | QDBusConnection::ExportNonScriptableProperties)| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 414 | // try the object itself | - |
| 415 | bool interfaceFound = true; executed (the execution status of this line is deduced): bool interfaceFound = true; | - |
| 416 | if (!interface_name.isEmpty()) partially evaluated: !interface_name.isEmpty()| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 417 | interfaceFound = qDBusInterfaceInObject(node.obj, interface_name); executed: interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);Execution Count:8 | 8 |
| 418 | | - |
| 419 | if (interfaceFound) { partially evaluated: interfaceFound| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 420 | return propertyWriteReply(msg, interface_name, property_name, executed: return propertyWriteReply(msg, interface_name, property_name, writeProperty(node.obj, property_name, value, node.flags));Execution Count:8 | 8 |
| 421 | writeProperty(node.obj, property_name, value, node.flags)); executed: return propertyWriteReply(msg, interface_name, property_name, writeProperty(node.obj, property_name, value, node.flags));Execution Count:8 | 8 |
| 422 | } | - |
| 423 | } | 0 |
| 424 | | - |
| 425 | // the property was not found | - |
| 426 | if (!interface_name.isEmpty()) never evaluated: !interface_name.isEmpty() | 0 |
| 427 | return interfaceNotFoundError(msg, interface_name); never executed: return interfaceNotFoundError(msg, interface_name); | 0 |
| 428 | return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); never executed: return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound); | 0 |
| 429 | } | - |
| 430 | | - |
| 431 | // unite two QVariantMaps, but don't generate duplicate keys | - |
| 432 | static QVariantMap &operator+=(QVariantMap &lhs, const QVariantMap &rhs) | - |
| 433 | { | - |
| 434 | QVariantMap::ConstIterator it = rhs.constBegin(), executed (the execution status of this line is deduced): QVariantMap::ConstIterator it = rhs.constBegin(), | - |
| 435 | end = rhs.constEnd(); executed (the execution status of this line is deduced): end = rhs.constEnd(); | - |
| 436 | for ( ; it != end; ++it) evaluated: it != end| yes Evaluation Count:16 | yes Evaluation Count:8 |
| 8-16 |
| 437 | lhs.insert(it.key(), it.value()); executed: lhs.insert(it.key(), it.value());Execution Count:16 | 16 |
| 438 | return lhs; executed: return lhs;Execution Count:8 | 8 |
| 439 | } | - |
| 440 | | - |
| 441 | static QVariantMap readAllProperties(QObject *object, int flags) | - |
| 442 | { | - |
| 443 | QVariantMap result; executed (the execution status of this line is deduced): QVariantMap result; | - |
| 444 | const QMetaObject *mo = object->metaObject(); executed (the execution status of this line is deduced): const QMetaObject *mo = object->metaObject(); | - |
| 445 | | - |
| 446 | // QObject has properties, so don't start from 0 | - |
| 447 | for (int i = QObject::staticMetaObject.propertyCount(); i < mo->propertyCount(); ++i) { evaluated: i < mo->propertyCount()| yes Evaluation Count:27 | yes Evaluation Count:11 |
| 11-27 |
| 448 | QMetaProperty mp = mo->property(i); executed (the execution status of this line is deduced): QMetaProperty mp = mo->property(i); | - |
| 449 | | - |
| 450 | // is it readable? | - |
| 451 | if (!mp.isReadable()) partially evaluated: !mp.isReadable()| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 452 | continue; never executed: continue; | 0 |
| 453 | | - |
| 454 | // is it a registered property? | - |
| 455 | int typeId = mp.userType(); executed (the execution status of this line is deduced): int typeId = mp.userType(); | - |
| 456 | if (!typeId) partially evaluated: !typeId| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 457 | continue; never executed: continue; | 0 |
| 458 | const char *signature = QDBusMetaType::typeToSignature(typeId); executed (the execution status of this line is deduced): const char *signature = QDBusMetaType::typeToSignature(typeId); | - |
| 459 | if (!signature) evaluated: !signature| yes Evaluation Count:3 | yes Evaluation Count:24 |
| 3-24 |
| 460 | continue; executed: continue;Execution Count:3 | 3 |
| 461 | | - |
| 462 | // is this property visible from the outside? | - |
| 463 | if ((mp.isScriptable() && flags & QDBusConnection::ExportScriptableProperties) || partially evaluated: mp.isScriptable()| yes Evaluation Count:24 | no Evaluation Count:0 |
partially evaluated: flags & QDBusConnection::ExportScriptableProperties| yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
| 464 | (!mp.isScriptable() && flags & QDBusConnection::ExportNonScriptableProperties)) { never evaluated: !mp.isScriptable() never evaluated: flags & QDBusConnection::ExportNonScriptableProperties | 0 |
| 465 | // yes, it's visible | - |
| 466 | QVariant value = mp.read(object); executed (the execution status of this line is deduced): QVariant value = mp.read(object); | - |
| 467 | if (value.isValid()) partially evaluated: value.isValid()| yes Evaluation Count:24 | no Evaluation Count:0 |
| 0-24 |
| 468 | result.insert(QString::fromLatin1(mp.name()), value); executed: result.insert(QString::fromLatin1(mp.name()), value);Execution Count:24 | 24 |
| 469 | } executed: }Execution Count:24 | 24 |
| 470 | } executed: }Execution Count:24 | 24 |
| 471 | | - |
| 472 | return result; executed: return result;Execution Count:11 | 11 |
| 473 | } | - |
| 474 | | - |
| 475 | QDBusMessage qDBusPropertyGetAll(const QDBusConnectionPrivate::ObjectTreeNode &node, | - |
| 476 | const QDBusMessage &msg) | - |
| 477 | { | - |
| 478 | Q_ASSERT(msg.arguments().count() == 1); executed (the execution status of this line is deduced): qt_noop(); | - |
| 479 | Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(), executed (the execution status of this line is deduced): qt_noop(); | - |
| 480 | "QDBusConnection: internal threading error", | - |
| 481 | "function called for an object that is in another thread!!"); | - |
| 482 | | - |
| 483 | QString interface_name = msg.arguments().at(0).toString(); executed (the execution status of this line is deduced): QString interface_name = msg.arguments().at(0).toString(); | - |
| 484 | | - |
| 485 | bool interfaceFound = false; executed (the execution status of this line is deduced): bool interfaceFound = false; | - |
| 486 | QVariantMap result; executed (the execution status of this line is deduced): QVariantMap result; | - |
| 487 | | - |
| 488 | QDBusAdaptorConnector *connector; executed (the execution status of this line is deduced): QDBusAdaptorConnector *connector; | - |
| 489 | if (node.flags & QDBusConnection::ExportAdaptors && partially evaluated: node.flags & QDBusConnection::ExportAdaptors| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 490 | (connector = qDBusFindAdaptorConnector(node.obj))) { partially evaluated: (connector = qDBusFindAdaptorConnector(node.obj))| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 491 | | - |
| 492 | if (interface_name.isEmpty()) { evaluated: interface_name.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 493 | // iterate over all interfaces | - |
| 494 | for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), executed (the execution status of this line is deduced): for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(), | - |
| 495 | end = connector->adaptors.constEnd(); it != end; ++it) { evaluated: it != end| yes Evaluation Count:8 | yes Evaluation Count:2 |
| 2-8 |
| 496 | result += readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); executed (the execution status of this line is deduced): result += readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); | - |
| 497 | } executed: }Execution Count:8 | 8 |
| 498 | } else { executed: }Execution Count:2 | 2 |
| 499 | // find the class that implements interface_name | - |
| 500 | QDBusAdaptorConnector::AdaptorMap::ConstIterator it; executed (the execution status of this line is deduced): QDBusAdaptorConnector::AdaptorMap::ConstIterator it; | - |
| 501 | it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), executed (the execution status of this line is deduced): it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(), | - |
| 502 | interface_name); executed (the execution status of this line is deduced): interface_name); | - |
| 503 | if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) { partially evaluated: it != connector->adaptors.constEnd()| yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: interface_name == QLatin1String(it->interface)| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 0-4 |
| 504 | interfaceFound = true; executed (the execution status of this line is deduced): interfaceFound = true; | - |
| 505 | result = readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); executed (the execution status of this line is deduced): result = readAllProperties(it->adaptor, QDBusConnection::ExportAllProperties); | - |
| 506 | } executed: }Execution Count:3 | 3 |
| 507 | } executed: }Execution Count:4 | 4 |
| 508 | } | - |
| 509 | | - |
| 510 | if (node.flags & QDBusConnection::ExportAllProperties && partially evaluated: node.flags & QDBusConnection::ExportAllProperties| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 511 | (!interfaceFound || interface_name.isEmpty())) { never evaluated: !interfaceFound never evaluated: interface_name.isEmpty() | 0 |
| 512 | // try the object itself | - |
| 513 | result += readAllProperties(node.obj, node.flags); never executed (the execution status of this line is deduced): result += readAllProperties(node.obj, node.flags); | - |
| 514 | interfaceFound = true; never executed (the execution status of this line is deduced): interfaceFound = true; | - |
| 515 | } | 0 |
| 516 | | - |
| 517 | if (!interfaceFound && !interface_name.isEmpty()) { evaluated: !interfaceFound| yes Evaluation Count:3 | yes Evaluation Count:3 |
evaluated: !interface_name.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-3 |
| 518 | // the interface was not found | - |
| 519 | return interfaceNotFoundError(msg, interface_name); executed: return interfaceNotFoundError(msg, interface_name);Execution Count:1 | 1 |
| 520 | } | - |
| 521 | | - |
| 522 | return msg.createReply(QVariant::fromValue(result)); executed: return msg.createReply(QVariant::fromValue(result));Execution Count:5 | 5 |
| 523 | } | - |
| 524 | | - |
| 525 | QT_END_NAMESPACE | - |
| 526 | | - |
| 527 | #endif // QT_NO_DBUS | - |
| 528 | | - |
| | |