| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusinterface.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | static void copyArgument(void *to, int id, const QVariant &arg) | - | ||||||||||||
| 11 | { | - | ||||||||||||
| 12 | if (id == arg.userType()
| 4-12 | ||||||||||||
| 13 | switch (id) { | - | ||||||||||||
| 14 | case never executed: QVariant::Bool:case QVariant::Bool:never executed: case QVariant::Bool: | 0 | ||||||||||||
| 15 | *reinterpret_cast<bool *>(to) = arg.toBool(); | - | ||||||||||||
| 16 | return; never executed: return; | 0 | ||||||||||||
| 17 | - | |||||||||||||
| 18 | case never executed: QMetaType::UChar:case QMetaType::UChar:never executed: case QMetaType::UChar: | 0 | ||||||||||||
| 19 | *reinterpret_cast<uchar *>(to) = arg.value<uchar>(); | - | ||||||||||||
| 20 | return; never executed: return; | 0 | ||||||||||||
| 21 | - | |||||||||||||
| 22 | case never executed: QMetaType::Short:case QMetaType::Short:never executed: case QMetaType::Short: | 0 | ||||||||||||
| 23 | *reinterpret_cast<short *>(to) = arg.value<short>(); | - | ||||||||||||
| 24 | return; never executed: return; | 0 | ||||||||||||
| 25 | - | |||||||||||||
| 26 | case never executed: QMetaType::UShort:case QMetaType::UShort:never executed: case QMetaType::UShort: | 0 | ||||||||||||
| 27 | *reinterpret_cast<ushort *>(to) = arg.value<ushort>(); | - | ||||||||||||
| 28 | return; never executed: return; | 0 | ||||||||||||
| 29 | - | |||||||||||||
| 30 | case never executed: QVariant::Int:case QVariant::Int:never executed: case QVariant::Int: | 0 | ||||||||||||
| 31 | *reinterpret_cast<int *>(to) = arg.toInt(); | - | ||||||||||||
| 32 | return; never executed: return; | 0 | ||||||||||||
| 33 | - | |||||||||||||
| 34 | case never executed: QVariant::UInt:case QVariant::UInt:never executed: case QVariant::UInt: | 0 | ||||||||||||
| 35 | *reinterpret_cast<uint *>(to) = arg.toUInt(); | - | ||||||||||||
| 36 | return; never executed: return; | 0 | ||||||||||||
| 37 | - | |||||||||||||
| 38 | case never executed: QVariant::LongLong:case QVariant::LongLong:never executed: case QVariant::LongLong: | 0 | ||||||||||||
| 39 | *reinterpret_cast<qlonglong *>(to) = arg.toLongLong(); | - | ||||||||||||
| 40 | return; never executed: return; | 0 | ||||||||||||
| 41 | - | |||||||||||||
| 42 | case never executed: QVariant::ULongLong:case QVariant::ULongLong:never executed: case QVariant::ULongLong: | 0 | ||||||||||||
| 43 | *reinterpret_cast<qulonglong *>(to) = arg.toULongLong(); | - | ||||||||||||
| 44 | return; never executed: return; | 0 | ||||||||||||
| 45 | - | |||||||||||||
| 46 | case never executed: QVariant::Double:case QVariant::Double:never executed: case QVariant::Double: | 0 | ||||||||||||
| 47 | *reinterpret_cast<double *>(to) = arg.toDouble(); | - | ||||||||||||
| 48 | return; never executed: return; | 0 | ||||||||||||
| 49 | - | |||||||||||||
| 50 | case never executed: QVariant::String:case QVariant::String:never executed: case QVariant::String: | 0 | ||||||||||||
| 51 | *reinterpret_cast<QString *>(to) = arg.toString(); | - | ||||||||||||
| 52 | return; never executed: return; | 0 | ||||||||||||
| 53 | - | |||||||||||||
| 54 | case never executed: QVariant::ByteArray:case QVariant::ByteArray:never executed: case QVariant::ByteArray: | 0 | ||||||||||||
| 55 | *reinterpret_cast<QByteArray *>(to) = arg.toByteArray(); | - | ||||||||||||
| 56 | return; never executed: return; | 0 | ||||||||||||
| 57 | - | |||||||||||||
| 58 | case never executed: QVariant::StringList:case QVariant::StringList:never executed: case QVariant::StringList: | 0 | ||||||||||||
| 59 | *reinterpret_cast<QStringList *>(to) = arg.toStringList(); | - | ||||||||||||
| 60 | return; never executed: return; | 0 | ||||||||||||
| 61 | } | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | if (id == QDBusMetaTypeId::variant()
| 0-12 | ||||||||||||
| 64 | *reinterpret_cast<QDBusVariant *>(to) = arg.value<QDBusVariant>(); | - | ||||||||||||
| 65 | return; executed 12 times by 1 test: return;Executed by:
| 12 | ||||||||||||
| 66 | } else if (id == QDBusMetaTypeId::objectpath()
| 0 | ||||||||||||
| 67 | *reinterpret_cast<QDBusObjectPath *>(to) = arg.value<QDBusObjectPath>(); | - | ||||||||||||
| 68 | return; never executed: return; | 0 | ||||||||||||
| 69 | } else if (id == QDBusMetaTypeId::signature()
| 0 | ||||||||||||
| 70 | *reinterpret_cast<QDBusSignature *>(to) = arg.value<QDBusSignature>(); | - | ||||||||||||
| 71 | return; never executed: return; | 0 | ||||||||||||
| 72 | } | - | ||||||||||||
| 73 | - | |||||||||||||
| 74 | - | |||||||||||||
| 75 | - | |||||||||||||
| 76 | QMessageLogger(__FILE__, 114, __PRETTY_FUNCTION__).fatal("Found a decoded basic type in a D-Bus reply that shouldn't be there"); | - | ||||||||||||
| 77 | } never executed: end of block | 0 | ||||||||||||
| 78 | - | |||||||||||||
| 79 | - | |||||||||||||
| 80 | if (arg.userType() != QDBusMetaTypeId::argument()
| 0-4 | ||||||||||||
| 81 | - | |||||||||||||
| 82 | - | |||||||||||||
| 83 | return; never executed: return; | 0 | ||||||||||||
| 84 | } | - | ||||||||||||
| 85 | - | |||||||||||||
| 86 | - | |||||||||||||
| 87 | const char *userSignature = QDBusMetaType::typeToSignature(id); | - | ||||||||||||
| 88 | if (!userSignature
| 0-4 | ||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | return; never executed: return; | 0 | ||||||||||||
| 92 | } | - | ||||||||||||
| 93 | - | |||||||||||||
| 94 | - | |||||||||||||
| 95 | QDBusArgument dbarg = arg.value<QDBusArgument>(); | - | ||||||||||||
| 96 | if (dbarg.currentSignature() != QLatin1String(userSignature)
| 0-4 | ||||||||||||
| 97 | - | |||||||||||||
| 98 | - | |||||||||||||
| 99 | return; never executed: return; | 0 | ||||||||||||
| 100 | } | - | ||||||||||||
| 101 | - | |||||||||||||
| 102 | - | |||||||||||||
| 103 | QDBusMetaType::demarshall(dbarg, id, to); | - | ||||||||||||
| 104 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 105 | - | |||||||||||||
| 106 | QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p, | - | ||||||||||||
| 107 | const QString &iface, const QDBusConnection &con) | - | ||||||||||||
| 108 | : QDBusAbstractInterfacePrivate(serv, p, iface, con, true), metaObject(0) | - | ||||||||||||
| 109 | { | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | if (connection.isConnected()
| 4-131 | ||||||||||||
| 112 | metaObject = connectionPrivate()->findMetaObject(service, path, interface, lastError); | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | if (!metaObject
| 41-90 | ||||||||||||
| 115 | - | |||||||||||||
| 116 | - | |||||||||||||
| 117 | - | |||||||||||||
| 118 | - | |||||||||||||
| 119 | if (!lastError.isValid()
| 0-41 | ||||||||||||
| 120 | lastError = QDBusError(QDBusError::InternalError, QLatin1String("Unknown error")); never executed: lastError = QDBusError(QDBusError::InternalError, QLatin1String("Unknown error")); | 0 | ||||||||||||
| 121 | } executed 41 times by 3 tests: end of blockExecuted by:
| 41 | ||||||||||||
| 122 | } executed 131 times by 12 tests: end of blockExecuted by:
| 131 | ||||||||||||
| 123 | } executed 135 times by 12 tests: end of blockExecuted by:
| 135 | ||||||||||||
| 124 | - | |||||||||||||
| 125 | QDBusInterfacePrivate::~QDBusInterfacePrivate() | - | ||||||||||||
| 126 | { | - | ||||||||||||
| 127 | if (metaObject
| 42-90 | ||||||||||||
| 128 | delete metaObject; executed 42 times by 7 tests: delete metaObject;Executed by:
| 42 | ||||||||||||
| 129 | } executed 135 times by 12 tests: end of blockExecuted by:
| 135 | ||||||||||||
| 130 | QDBusInterface::QDBusInterface(const QString &service, const QString &path, const QString &interface, | - | ||||||||||||
| 131 | const QDBusConnection &connection, QObject *parent) | - | ||||||||||||
| 132 | : QDBusAbstractInterface(*new QDBusInterfacePrivate(service, path, interface, connection), | - | ||||||||||||
| 133 | parent) | - | ||||||||||||
| 134 | { | - | ||||||||||||
| 135 | } executed 135 times by 12 tests: end of blockExecuted by:
| 135 | ||||||||||||
| 136 | - | |||||||||||||
| 137 | - | |||||||||||||
| 138 | - | |||||||||||||
| 139 | - | |||||||||||||
| 140 | QDBusInterface::~QDBusInterface() | - | ||||||||||||
| 141 | { | - | ||||||||||||
| 142 | - | |||||||||||||
| 143 | } | - | ||||||||||||
| 144 | - | |||||||||||||
| 145 | - | |||||||||||||
| 146 | - | |||||||||||||
| 147 | - | |||||||||||||
| 148 | - | |||||||||||||
| 149 | const QMetaObject *QDBusInterface::metaObject() const | - | ||||||||||||
| 150 | { | - | ||||||||||||
| 151 | return d_func()->metaObject ? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject; | - | ||||||||||||
| 152 | } | - | ||||||||||||
| 153 | - | |||||||||||||
| 154 | - | |||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | void *QDBusInterface::qt_metacast(const char *_clname) | - | ||||||||||||
| 159 | { | - | ||||||||||||
| 160 | if (!_clname) return 0; | - | ||||||||||||
| 161 | if (!strcmp(_clname, "QDBusInterface")) | - | ||||||||||||
| 162 | return static_cast<void*>(const_cast<QDBusInterface*>(this)); | - | ||||||||||||
| 163 | if (d_func()->interface.toLatin1() == _clname) | - | ||||||||||||
| 164 | return static_cast<void*>(const_cast<QDBusInterface*>(this)); | - | ||||||||||||
| 165 | return QDBusAbstractInterface::qt_metacast(_clname); | - | ||||||||||||
| 166 | } | - | ||||||||||||
| 167 | - | |||||||||||||
| 168 | - | |||||||||||||
| 169 | - | |||||||||||||
| 170 | - | |||||||||||||
| 171 | - | |||||||||||||
| 172 | int QDBusInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | - | ||||||||||||
| 173 | { | - | ||||||||||||
| 174 | _id = QDBusAbstractInterface::qt_metacall(_c, _id, _a); | - | ||||||||||||
| 175 | if (_id < 0 || !d_func()->isValid || !d_func()->metaObject) | - | ||||||||||||
| 176 | return _id; | - | ||||||||||||
| 177 | return d_func()->metacall(_c, _id, _a); | - | ||||||||||||
| 178 | } | - | ||||||||||||
| 179 | - | |||||||||||||
| 180 | int QDBusInterfacePrivate::metacall(QMetaObject::Call c, int id, void **argv) | - | ||||||||||||
| 181 | { | - | ||||||||||||
| 182 | QDBusInterface * const q = q_func(); | - | ||||||||||||
| 183 | - | |||||||||||||
| 184 | if (c == QMetaObject::InvokeMetaMethod
| 0-28 | ||||||||||||
| 185 | int offset = metaObject->methodOffset(); | - | ||||||||||||
| 186 | QMetaMethod mm = metaObject->method(id + offset); | - | ||||||||||||
| 187 | - | |||||||||||||
| 188 | if (mm.methodType() == QMetaMethod::Signal
| 12-16 | ||||||||||||
| 189 | - | |||||||||||||
| 190 | QMetaObject::activate(q, metaObject, id, argv); | - | ||||||||||||
| 191 | - | |||||||||||||
| 192 | } executed 12 times by 2 tests: else if (mm.methodType() == QMetaMethod::Slotend of blockExecuted by:
| 0-16 | ||||||||||||
| 193 | - | |||||||||||||
| 194 | - | |||||||||||||
| 195 | QString methodName = QString::fromLatin1(mm.name()); | - | ||||||||||||
| 196 | const int *inputTypes = metaObject->inputTypesForMethod(id); | - | ||||||||||||
| 197 | int inputTypesCount = *inputTypes; | - | ||||||||||||
| 198 | - | |||||||||||||
| 199 | - | |||||||||||||
| 200 | QVariantList args; | - | ||||||||||||
| 201 | args.reserve(inputTypesCount); | - | ||||||||||||
| 202 | int i = 1; | - | ||||||||||||
| 203 | for ( ; i <= inputTypesCount
| 16-20 | ||||||||||||
| 204 | args << QVariant(inputTypes[i], argv[i]); executed 20 times by 1 test: args << QVariant(inputTypes[i], argv[i]);Executed by:
| 20 | ||||||||||||
| 205 | - | |||||||||||||
| 206 | - | |||||||||||||
| 207 | QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args); | - | ||||||||||||
| 208 | - | |||||||||||||
| 209 | if (reply.type() == QDBusMessage::ReplyMessage
| 0-16 | ||||||||||||
| 210 | - | |||||||||||||
| 211 | args = reply.arguments(); | - | ||||||||||||
| 212 | QVariantList::ConstIterator it = args.constBegin(); | - | ||||||||||||
| 213 | const int *outputTypes = metaObject->outputTypesForMethod(id); | - | ||||||||||||
| 214 | int outputTypesCount = *outputTypes++; | - | ||||||||||||
| 215 | - | |||||||||||||
| 216 | if (mm.returnType() != QMetaType::UnknownType
| 0-16 | ||||||||||||
| 217 | - | |||||||||||||
| 218 | if (argv[0]
| 0-12 | ||||||||||||
| 219 | copyArgument(argv[0], *outputTypes++, *it); executed 12 times by 1 test: copyArgument(argv[0], *outputTypes++, *it);Executed by:
| 12 | ||||||||||||
| 220 | - | |||||||||||||
| 221 | - | |||||||||||||
| 222 | --outputTypesCount; | - | ||||||||||||
| 223 | ++it; | - | ||||||||||||
| 224 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||
| 225 | - | |||||||||||||
| 226 | for (int j = 0; j < outputTypesCount
| 0-16 | ||||||||||||
| 227 | copyArgument(argv[i], outputTypes[j], *it); | - | ||||||||||||
| 228 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 229 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||
| 230 | - | |||||||||||||
| 231 | - | |||||||||||||
| 232 | lastError = QDBusError(reply); | - | ||||||||||||
| 233 | return executed 16 times by 1 test: -1;return -1;Executed by:
executed 16 times by 1 test: return -1;Executed by:
| 16 | ||||||||||||
| 234 | } | - | ||||||||||||
| 235 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 236 | return executed 12 times by 2 tests: id;return id;Executed by:
executed 12 times by 2 tests: return id;Executed by:
| 12 | ||||||||||||
| 237 | } | - | ||||||||||||
| 238 | - | |||||||||||||
| 239 | - | |||||||||||||
| Switch to Source code | Preprocessed file |