| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | template <typename T> | - |
| 4 | static inline T qIterGet(DBusMessageIter *it) | - |
| 5 | { | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | union { | - |
| 10 | | - |
| 11 | T t; | - |
| 12 | | - |
| 13 | | - |
| 14 | dbus_uint64_t maxValue; | - |
| 15 | | - |
| 16 | | - |
| 17 | void* ptr; | - |
| 18 | } value; | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | value.t = T(); | - |
| 24 | | - |
| 25 | q_dbus_message_iter_get_basic(it, &value); | - |
| 26 | q_dbus_message_iter_next(it); | - |
| 27 | return value.t; executed: return value.t;Execution Count:1712 | 1712 |
| 28 | } | - |
| 29 | | - |
| 30 | QDBusDemarshaller::~QDBusDemarshaller() | - |
| 31 | { | - |
| 32 | } | - |
| 33 | | - |
| 34 | inline QString QDBusDemarshaller::currentSignature() | - |
| 35 | { | - |
| 36 | char *sig = q_dbus_message_iter_get_signature(&iterator); | - |
| 37 | QString retval = QString::fromUtf8(sig); | - |
| 38 | q_dbus_free(sig); | - |
| 39 | | - |
| 40 | return retval; executed: return retval;Execution Count:35 | 35 |
| 41 | } | - |
| 42 | | - |
| 43 | inline uchar QDBusDemarshaller::toByte() | - |
| 44 | { | - |
| 45 | return qIterGet<uchar>(&iterator); never executed: return qIterGet<uchar>(&iterator); | 0 |
| 46 | } | - |
| 47 | | - |
| 48 | inline bool QDBusDemarshaller::toBool() | - |
| 49 | { | - |
| 50 | return bool(qIterGet<dbus_bool_t>(&iterator)); executed: return bool(qIterGet<dbus_bool_t>(&iterator));Execution Count:852 | 852 |
| 51 | } | - |
| 52 | | - |
| 53 | inline ushort QDBusDemarshaller::toUShort() | - |
| 54 | { | - |
| 55 | return qIterGet<dbus_uint16_t>(&iterator); never executed: return qIterGet<dbus_uint16_t>(&iterator); | 0 |
| 56 | } | - |
| 57 | | - |
| 58 | inline short QDBusDemarshaller::toShort() | - |
| 59 | { | - |
| 60 | return qIterGet<dbus_int16_t>(&iterator); executed: return qIterGet<dbus_int16_t>(&iterator);Execution Count:2 | 2 |
| 61 | } | - |
| 62 | | - |
| 63 | inline int QDBusDemarshaller::toInt() | - |
| 64 | { | - |
| 65 | return qIterGet<dbus_int32_t>(&iterator); executed: return qIterGet<dbus_int32_t>(&iterator);Execution Count:159 | 159 |
| 66 | } | - |
| 67 | | - |
| 68 | inline uint QDBusDemarshaller::toUInt() | - |
| 69 | { | - |
| 70 | return qIterGet<dbus_uint32_t>(&iterator); executed: return qIterGet<dbus_uint32_t>(&iterator);Execution Count:34 | 34 |
| 71 | } | - |
| 72 | | - |
| 73 | inline qlonglong QDBusDemarshaller::toLongLong() | - |
| 74 | { | - |
| 75 | return qIterGet<qlonglong>(&iterator); executed: return qIterGet<qlonglong>(&iterator);Execution Count:6 | 6 |
| 76 | } | - |
| 77 | | - |
| 78 | inline qulonglong QDBusDemarshaller::toULongLong() | - |
| 79 | { | - |
| 80 | return qIterGet<qulonglong>(&iterator); never executed: return qIterGet<qulonglong>(&iterator); | 0 |
| 81 | } | - |
| 82 | | - |
| 83 | inline double QDBusDemarshaller::toDouble() | - |
| 84 | { | - |
| 85 | return qIterGet<double>(&iterator); never executed: return qIterGet<double>(&iterator); | 0 |
| 86 | } | - |
| 87 | | - |
| 88 | inline QString QDBusDemarshaller::toStringUnchecked() | - |
| 89 | { | - |
| 90 | return QString::fromUtf8(qIterGet<char *>(&iterator)); executed: return QString::fromUtf8(qIterGet<char *>(&iterator));Execution Count:657 | 657 |
| 91 | } | - |
| 92 | | - |
| 93 | inline QString QDBusDemarshaller::toString() | - |
| 94 | { | - |
| 95 | if (isCurrentTypeStringLike()) partially evaluated: isCurrentTypeStringLike()| yes Evaluation Count:84 | no Evaluation Count:0 |
| 0-84 |
| 96 | return toStringUnchecked(); executed: return toStringUnchecked();Execution Count:84 | 84 |
| 97 | else | - |
| 98 | return QString(); never executed: return QString(); | 0 |
| 99 | } | - |
| 100 | | - |
| 101 | inline QDBusObjectPath QDBusDemarshaller::toObjectPathUnchecked() | - |
| 102 | { | - |
| 103 | return QDBusObjectPath(QString::fromUtf8(qIterGet<char *>(&iterator))); executed: return QDBusObjectPath(QString::fromUtf8(qIterGet<char *>(&iterator)));Execution Count:2 | 2 |
| 104 | } | - |
| 105 | | - |
| 106 | inline QDBusObjectPath QDBusDemarshaller::toObjectPath() | - |
| 107 | { | - |
| 108 | if (isCurrentTypeStringLike()) partially evaluated: isCurrentTypeStringLike()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 109 | return toObjectPathUnchecked(); executed: return toObjectPathUnchecked();Execution Count:2 | 2 |
| 110 | else | - |
| 111 | return QDBusObjectPath(); never executed: return QDBusObjectPath(); | 0 |
| 112 | } | - |
| 113 | | - |
| 114 | inline QDBusSignature QDBusDemarshaller::toSignatureUnchecked() | - |
| 115 | { | - |
| 116 | return QDBusSignature(QString::fromUtf8(qIterGet<char *>(&iterator))); never executed: return QDBusSignature(QString::fromUtf8(qIterGet<char *>(&iterator))); | 0 |
| 117 | } | - |
| 118 | | - |
| 119 | inline QDBusSignature QDBusDemarshaller::toSignature() | - |
| 120 | { | - |
| 121 | if (isCurrentTypeStringLike()) never evaluated: isCurrentTypeStringLike() | 0 |
| 122 | return toSignatureUnchecked(); never executed: return toSignatureUnchecked(); | 0 |
| 123 | else | - |
| 124 | return QDBusSignature(); never executed: return QDBusSignature(); | 0 |
| 125 | } | - |
| 126 | | - |
| 127 | inline QDBusUnixFileDescriptor QDBusDemarshaller::toUnixFileDescriptor() | - |
| 128 | { | - |
| 129 | QDBusUnixFileDescriptor fd; | - |
| 130 | fd.giveFileDescriptor(qIterGet<dbus_int32_t>(&iterator)); | - |
| 131 | return fd; never executed: return fd; | 0 |
| 132 | } | - |
| 133 | | - |
| 134 | inline QDBusVariant QDBusDemarshaller::toVariant() | - |
| 135 | { | - |
| 136 | QDBusDemarshaller sub(capabilities); | - |
| 137 | sub.message = q_dbus_message_ref(message); | - |
| 138 | q_dbus_message_iter_recurse(&iterator, &sub.iterator); | - |
| 139 | q_dbus_message_iter_next(&iterator); | - |
| 140 | | - |
| 141 | return QDBusVariant( sub.toVariantInternal() ); executed: return QDBusVariant( sub.toVariantInternal() );Execution Count:189 | 189 |
| 142 | } | - |
| 143 | | - |
| 144 | QDBusArgument::ElementType QDBusDemarshaller::currentType() | - |
| 145 | { | - |
| 146 | switch (q_dbus_message_iter_get_arg_type(&iterator)) { | - |
| 147 | case ((int) 'y'): | - |
| 148 | case ((int) 'n'): | - |
| 149 | case ((int) 'q'): | - |
| 150 | case ((int) 'i'): | - |
| 151 | case ((int) 'u'): | - |
| 152 | case ((int) 'x'): | - |
| 153 | case ((int) 't'): | - |
| 154 | case ((int) 'b'): | - |
| 155 | case ((int) 'd'): | - |
| 156 | case ((int) 's'): | - |
| 157 | case ((int) 'o'): | - |
| 158 | case ((int) 'g'): | - |
| 159 | return QDBusArgument::BasicType; never executed: return QDBusArgument::BasicType; | 0 |
| 160 | | - |
| 161 | case ((int) 'v'): | - |
| 162 | return QDBusArgument::VariantType; never executed: return QDBusArgument::VariantType; | 0 |
| 163 | | - |
| 164 | case ((int) 'a'): | - |
| 165 | switch (q_dbus_message_iter_get_element_type(&iterator)) { | - |
| 166 | case ((int) 'y'): | - |
| 167 | case ((int) 's'): | - |
| 168 | | - |
| 169 | return QDBusArgument::BasicType; never executed: return QDBusArgument::BasicType; | 0 |
| 170 | case ((int) 'e'): | - |
| 171 | return QDBusArgument::MapType; never executed: return QDBusArgument::MapType; | 0 |
| 172 | default: | - |
| 173 | return QDBusArgument::ArrayType; never executed: return QDBusArgument::ArrayType; | 0 |
| 174 | } | - |
| 175 | | - |
| 176 | case ((int) 'r'): | - |
| 177 | return QDBusArgument::StructureType; never executed: return QDBusArgument::StructureType; | 0 |
| 178 | case ((int) 'e'): | - |
| 179 | return QDBusArgument::MapEntryType; never executed: return QDBusArgument::MapEntryType; | 0 |
| 180 | | - |
| 181 | case int('h'): | - |
| 182 | return capabilities & QDBusConnection::UnixFileDescriptorPassing ? | 0 |
| 183 | QDBusArgument::BasicType : QDBusArgument::UnknownType; never executed: return capabilities & QDBusConnection::UnixFileDescriptorPassing ? QDBusArgument::BasicType : QDBusArgument::UnknownType; | 0 |
| 184 | | - |
| 185 | case ((int) '\0'): | - |
| 186 | return QDBusArgument::UnknownType; never executed: return QDBusArgument::UnknownType; | 0 |
| 187 | | - |
| 188 | | - |
| 189 | | - |
| 190 | | - |
| 191 | | - |
| 192 | } | - |
| 193 | return QDBusArgument::UnknownType; never executed: return QDBusArgument::UnknownType; | 0 |
| 194 | } | - |
| 195 | | - |
| 196 | QVariant QDBusDemarshaller::toVariantInternal() | - |
| 197 | { | - |
| 198 | switch (q_dbus_message_iter_get_arg_type(&iterator)) { | - |
| 199 | case ((int) 'y'): | - |
| 200 | return QVariant::fromValue(toByte()); never executed: return QVariant::fromValue(toByte()); | 0 |
| 201 | case ((int) 'n'): | - |
| 202 | return QVariant::fromValue(toShort()); executed: return QVariant::fromValue(toShort());Execution Count:2 | 2 |
| 203 | case ((int) 'q'): | - |
| 204 | return QVariant::fromValue(toUShort()); never executed: return QVariant::fromValue(toUShort()); | 0 |
| 205 | case ((int) 'i'): | - |
| 206 | return toInt(); executed: return toInt();Execution Count:81 | 81 |
| 207 | case ((int) 'u'): | - |
| 208 | return toUInt(); executed: return toUInt();Execution Count:34 | 34 |
| 209 | case ((int) 'd'): | - |
| 210 | return toDouble(); never executed: return toDouble(); | 0 |
| 211 | case ((int) 'b'): | - |
| 212 | return toBool(); executed: return toBool();Execution Count:852 | 852 |
| 213 | case ((int) 'x'): | - |
| 214 | return toLongLong(); executed: return toLongLong();Execution Count:2 | 2 |
| 215 | case ((int) 't'): | - |
| 216 | return toULongLong(); never executed: return toULongLong(); | 0 |
| 217 | case ((int) 's'): | - |
| 218 | return toStringUnchecked(); executed: return toStringUnchecked();Execution Count:525 | 525 |
| 219 | case ((int) 'o'): | - |
| 220 | return QVariant::fromValue(toObjectPathUnchecked()); never executed: return QVariant::fromValue(toObjectPathUnchecked()); | 0 |
| 221 | case ((int) 'g'): | - |
| 222 | return QVariant::fromValue(toSignatureUnchecked()); never executed: return QVariant::fromValue(toSignatureUnchecked()); | 0 |
| 223 | case ((int) 'v'): | - |
| 224 | return QVariant::fromValue(toVariant()); executed: return QVariant::fromValue(toVariant());Execution Count:113 | 113 |
| 225 | | - |
| 226 | case ((int) 'a'): | - |
| 227 | switch (q_dbus_message_iter_get_element_type(&iterator)) { | - |
| 228 | case ((int) 'y'): | - |
| 229 | | - |
| 230 | return toByteArrayUnchecked(); executed: return toByteArrayUnchecked();Execution Count:6 | 6 |
| 231 | case ((int) 's'): | - |
| 232 | return toStringListUnchecked(); executed: return toStringListUnchecked();Execution Count:20 | 20 |
| 233 | case ((int) 'e'): | - |
| 234 | return QVariant::fromValue(duplicate()); executed: return QVariant::fromValue(duplicate());Execution Count:22 | 22 |
| 235 | | - |
| 236 | default: | - |
| 237 | return QVariant::fromValue(duplicate()); executed: return QVariant::fromValue(duplicate());Execution Count:31 | 31 |
| 238 | } | - |
| 239 | | - |
| 240 | case ((int) 'r'): | - |
| 241 | return QVariant::fromValue(duplicate()); executed: return QVariant::fromValue(duplicate());Execution Count:24 | 24 |
| 242 | | - |
| 243 | case int('h'): | - |
| 244 | if (capabilities & QDBusConnection::UnixFileDescriptorPassing) never evaluated: capabilities & QDBusConnection::UnixFileDescriptorPassing | 0 |
| 245 | return QVariant::fromValue(toUnixFileDescriptor()); never executed: return QVariant::fromValue(toUnixFileDescriptor()); | 0 |
| 246 | | - |
| 247 | | - |
| 248 | default: code before this statement never executed: default: | 0 |
| 249 | | - |
| 250 | | - |
| 251 | | - |
| 252 | char *ptr = 0; | - |
| 253 | ptr += q_dbus_message_iter_get_arg_type(&iterator); | - |
| 254 | q_dbus_message_iter_next(&iterator); | - |
| 255 | | - |
| 256 | | - |
| 257 | return QVariant::fromValue<void *>(ptr); never executed: return QVariant::fromValue<void *>(ptr); | 0 |
| 258 | }; | - |
| 259 | } | 0 |
| 260 | | - |
| 261 | bool QDBusDemarshaller::isCurrentTypeStringLike() | - |
| 262 | { | - |
| 263 | const int type = q_dbus_message_iter_get_arg_type(&iterator); | - |
| 264 | switch (type) { | - |
| 265 | case ((int) 's'): | - |
| 266 | case ((int) 'o'): | - |
| 267 | case ((int) 'g'): | - |
| 268 | return true; executed: return true;Execution Count:86 | 86 |
| 269 | default: | - |
| 270 | return false; never executed: return false; | 0 |
| 271 | } | - |
| 272 | } | 0 |
| 273 | | - |
| 274 | QStringList QDBusDemarshaller::toStringListUnchecked() | - |
| 275 | { | - |
| 276 | QStringList list; | - |
| 277 | | - |
| 278 | QDBusDemarshaller sub(capabilities); | - |
| 279 | q_dbus_message_iter_recurse(&iterator, &sub.iterator); | - |
| 280 | q_dbus_message_iter_next(&iterator); | - |
| 281 | while (!sub.atEnd()) evaluated: !sub.atEnd()| yes Evaluation Count:48 | yes Evaluation Count:20 |
| 20-48 |
| 282 | list.append(sub.toStringUnchecked()); executed: list.append(sub.toStringUnchecked());Execution Count:48 | 48 |
| 283 | | - |
| 284 | return list; executed: return list;Execution Count:20 | 20 |
| 285 | } | - |
| 286 | | - |
| 287 | QStringList QDBusDemarshaller::toStringList() | - |
| 288 | { | - |
| 289 | if (q_dbus_message_iter_get_arg_type(&iterator) == ((int) 'a') never evaluated: q_dbus_message_iter_get_arg_type(&iterator) == ((int) 'a') | 0 |
| 290 | && q_dbus_message_iter_get_element_type(&iterator) == ((int) 's')) never evaluated: q_dbus_message_iter_get_element_type(&iterator) == ((int) 's') | 0 |
| 291 | return toStringListUnchecked(); never executed: return toStringListUnchecked(); | 0 |
| 292 | else | - |
| 293 | return QStringList(); never executed: return QStringList(); | 0 |
| 294 | } | - |
| 295 | | - |
| 296 | QByteArray QDBusDemarshaller::toByteArrayUnchecked() | - |
| 297 | { | - |
| 298 | DBusMessageIter sub; | - |
| 299 | q_dbus_message_iter_recurse(&iterator, &sub); | - |
| 300 | q_dbus_message_iter_next(&iterator); | - |
| 301 | int len; | - |
| 302 | char* data; | - |
| 303 | q_dbus_message_iter_get_fixed_array(&sub,&data,&len); | - |
| 304 | return QByteArray(data,len); executed: return QByteArray(data,len);Execution Count:6 | 6 |
| 305 | } | - |
| 306 | | - |
| 307 | QByteArray QDBusDemarshaller::toByteArray() | - |
| 308 | { | - |
| 309 | if (q_dbus_message_iter_get_arg_type(&iterator) == ((int) 'a') never evaluated: q_dbus_message_iter_get_arg_type(&iterator) == ((int) 'a') | 0 |
| 310 | && q_dbus_message_iter_get_element_type(&iterator) == ((int) 'y')) { never evaluated: q_dbus_message_iter_get_element_type(&iterator) == ((int) 'y') | 0 |
| 311 | return toByteArrayUnchecked(); never executed: return toByteArrayUnchecked(); | 0 |
| 312 | } | - |
| 313 | return QByteArray(); never executed: return QByteArray(); | 0 |
| 314 | } | - |
| 315 | | - |
| 316 | bool QDBusDemarshaller::atEnd() | - |
| 317 | { | - |
| 318 | | - |
| 319 | return q_dbus_message_iter_get_arg_type(&iterator) == ((int) '\0'); executed: return q_dbus_message_iter_get_arg_type(&iterator) == ((int) '\0');Execution Count:3215 | 3215 |
| 320 | } | - |
| 321 | | - |
| 322 | inline QDBusDemarshaller *QDBusDemarshaller::beginStructure() | - |
| 323 | { | - |
| 324 | return beginCommon(); executed: return beginCommon();Execution Count:32 | 32 |
| 325 | } | - |
| 326 | | - |
| 327 | inline QDBusDemarshaller *QDBusDemarshaller::beginArray() | - |
| 328 | { | - |
| 329 | return beginCommon(); executed: return beginCommon();Execution Count:31 | 31 |
| 330 | } | - |
| 331 | | - |
| 332 | inline QDBusDemarshaller *QDBusDemarshaller::beginMap() | - |
| 333 | { | - |
| 334 | return beginCommon(); executed: return beginCommon();Execution Count:20 | 20 |
| 335 | } | - |
| 336 | | - |
| 337 | inline QDBusDemarshaller *QDBusDemarshaller::beginMapEntry() | - |
| 338 | { | - |
| 339 | return beginCommon(); executed: return beginCommon();Execution Count:64 | 64 |
| 340 | } | - |
| 341 | | - |
| 342 | QDBusDemarshaller *QDBusDemarshaller::beginCommon() | - |
| 343 | { | - |
| 344 | QDBusDemarshaller *d = new QDBusDemarshaller(capabilities); | - |
| 345 | d->parent = this; | - |
| 346 | d->message = q_dbus_message_ref(message); | - |
| 347 | | - |
| 348 | | - |
| 349 | q_dbus_message_iter_recurse(&iterator, &d->iterator); | - |
| 350 | q_dbus_message_iter_next(&iterator); | - |
| 351 | return d; executed: return d;Execution Count:147 | 147 |
| 352 | } | - |
| 353 | | - |
| 354 | inline QDBusDemarshaller *QDBusDemarshaller::endStructure() | - |
| 355 | { | - |
| 356 | return endCommon(); executed: return endCommon();Execution Count:32 | 32 |
| 357 | } | - |
| 358 | | - |
| 359 | inline QDBusDemarshaller *QDBusDemarshaller::endArray() | - |
| 360 | { | - |
| 361 | return endCommon(); executed: return endCommon();Execution Count:31 | 31 |
| 362 | } | - |
| 363 | | - |
| 364 | inline QDBusDemarshaller *QDBusDemarshaller::endMap() | - |
| 365 | { | - |
| 366 | return endCommon(); executed: return endCommon();Execution Count:20 | 20 |
| 367 | } | - |
| 368 | | - |
| 369 | inline QDBusDemarshaller *QDBusDemarshaller::endMapEntry() | - |
| 370 | { | - |
| 371 | return endCommon(); executed: return endCommon();Execution Count:64 | 64 |
| 372 | } | - |
| 373 | | - |
| 374 | QDBusDemarshaller *QDBusDemarshaller::endCommon() | - |
| 375 | { | - |
| 376 | QDBusDemarshaller *retval = parent; | - |
| 377 | delete this; | - |
| 378 | return retval; executed: return retval;Execution Count:147 | 147 |
| 379 | } | - |
| 380 | | - |
| 381 | QDBusArgument QDBusDemarshaller::duplicate() | - |
| 382 | { | - |
| 383 | QDBusDemarshaller *d = new QDBusDemarshaller(capabilities); | - |
| 384 | d->iterator = iterator; | - |
| 385 | d->message = q_dbus_message_ref(message); | - |
| 386 | | - |
| 387 | q_dbus_message_iter_next(&iterator); | - |
| 388 | return QDBusArgumentPrivate::create(d); executed: return QDBusArgumentPrivate::create(d);Execution Count:77 | 77 |
| 389 | } | - |
| 390 | | - |
| 391 | | - |
| 392 | | - |
| | |