| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusargument.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtDBus module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||
| 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 The Qt Company. For licensing terms | - | ||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free | - | ||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | #include "qdbusargument.h" | - | ||||||||||||||||||
| 35 | #include "qdbusargument_p.h" | - | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | #include <qatomic.h> | - | ||||||||||||||||||
| 38 | #include <qbytearray.h> | - | ||||||||||||||||||
| 39 | #include <qlist.h> | - | ||||||||||||||||||
| 40 | #include <qmap.h> | - | ||||||||||||||||||
| 41 | #include <qstring.h> | - | ||||||||||||||||||
| 42 | #include <qstringlist.h> | - | ||||||||||||||||||
| 43 | #include <qvariant.h> | - | ||||||||||||||||||
| 44 | #include <qdatetime.h> | - | ||||||||||||||||||
| 45 | #include <qrect.h> | - | ||||||||||||||||||
| 46 | #include <qline.h> | - | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | #include "qdbusmetatype_p.h" | - | ||||||||||||||||||
| 49 | #include "qdbusutil_p.h" | - | ||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | #ifndef QT_NO_DBUS | - | ||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | QDBusArgumentPrivate::~QDBusArgumentPrivate() | - | ||||||||||||||||||
| 56 | { | - | ||||||||||||||||||
| 57 | if (message)
| 9703-14274 | ||||||||||||||||||
| 58 | q_dbus_message_unref(message); executed 14274 times by 299 tests: q_dbus_message_unref(message);Executed by:
| 14274 | ||||||||||||||||||
| 59 | } executed 23977 times by 302 tests: end of blockExecuted by:
| 23977 | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | QByteArray QDBusArgumentPrivate::createSignature(int id) | - | ||||||||||||||||||
| 62 | { | - | ||||||||||||||||||
| 63 | if (!qdbus_loadLibDBus())
| 0-1551 | ||||||||||||||||||
| 64 | return ""; never executed: return ""; | 0 | ||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | QByteArray signature; | - | ||||||||||||||||||
| 67 | QDBusMarshaller *marshaller = new QDBusMarshaller(0); | - | ||||||||||||||||||
| 68 | marshaller->ba = &signature; | - | ||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | // run it | - | ||||||||||||||||||
| 71 | void *null = 0; | - | ||||||||||||||||||
| 72 | QVariant v(id, null); | - | ||||||||||||||||||
| 73 | QDBusArgument arg(marshaller); | - | ||||||||||||||||||
| 74 | QDBusMetaType::marshall(arg, v.userType(), v.constData()); | - | ||||||||||||||||||
| 75 | arg.d = 0; | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | // delete it | - | ||||||||||||||||||
| 78 | bool ok = marshaller->ok; | - | ||||||||||||||||||
| 79 | delete marshaller; | - | ||||||||||||||||||
| 80 | - | |||||||||||||||||||
| 81 | if (signature.isEmpty() || !ok || !QDBusUtil::isValidSingleSignature(QString::fromLatin1(signature))) {
| 0-1550 | ||||||||||||||||||
| 82 | qWarning("QDBusMarshaller: type `%s' produces invalid D-BUS signature `%s' " | - | ||||||||||||||||||
| 83 | "(Did you forget to call beginStructure() ?)", | - | ||||||||||||||||||
| 84 | QMetaType::typeName(id), | - | ||||||||||||||||||
| 85 | signature.isEmpty() ? "<empty>" : signature.constData()); | - | ||||||||||||||||||
| 86 | return ""; executed 4 times by 1 test: return "";Executed by:
| 4 | ||||||||||||||||||
| 87 | } else if ((signature.at(0) != DBUS_TYPE_ARRAY && signature.at(0) != DBUS_STRUCT_BEGIN_CHAR) ||
| 2-895 | ||||||||||||||||||
| 88 | (signature.at(0) == DBUS_TYPE_ARRAY && (signature.at(1) == DBUS_TYPE_BYTE ||
| 1-895 | ||||||||||||||||||
| 89 | signature.at(1) == DBUS_TYPE_STRING))) {
| 1-893 | ||||||||||||||||||
| 90 | qWarning("QDBusMarshaller: type `%s' attempts to redefine basic D-BUS type '%s' (%s) " | - | ||||||||||||||||||
| 91 | "(Did you forget to call beginStructure() ?)", | - | ||||||||||||||||||
| 92 | QMetaType::typeName(id), | - | ||||||||||||||||||
| 93 | signature.constData(), | - | ||||||||||||||||||
| 94 | QMetaType::typeName(QDBusMetaType::signatureToType(signature))); | - | ||||||||||||||||||
| 95 | return ""; executed 4 times by 1 test: return "";Executed by:
| 4 | ||||||||||||||||||
| 96 | } | - | ||||||||||||||||||
| 97 | return signature; executed 1543 times by 31 tests: return signature;Executed by:
| 1543 | ||||||||||||||||||
| 98 | } | - | ||||||||||||||||||
| 99 | - | |||||||||||||||||||
| 100 | bool QDBusArgumentPrivate::checkWrite(QDBusArgumentPrivate *&d) | - | ||||||||||||||||||
| 101 | { | - | ||||||||||||||||||
| 102 | if (!d)
| 0-8707 | ||||||||||||||||||
| 103 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 104 | if (d->direction == Marshalling) {
| 0-8707 | ||||||||||||||||||
| 105 | if (!d->marshaller()->ok)
| 0-8707 | ||||||||||||||||||
| 106 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | if (d->message && d->ref.load() != 1) {
| 0-8485 | ||||||||||||||||||
| 109 | QDBusMarshaller *dd = new QDBusMarshaller(d->capabilities); | - | ||||||||||||||||||
| 110 | dd->message = q_dbus_message_copy(d->message); | - | ||||||||||||||||||
| 111 | q_dbus_message_iter_init_append(dd->message, &dd->iterator); | - | ||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | if (!d->ref.deref())
| 0 | ||||||||||||||||||
| 114 | delete d; never executed: delete d; | 0 | ||||||||||||||||||
| 115 | d = dd; | - | ||||||||||||||||||
| 116 | } never executed: end of block | 0 | ||||||||||||||||||
| 117 | return true; executed 8707 times by 31 tests: return true;Executed by:
| 8707 | ||||||||||||||||||
| 118 | } | - | ||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | #ifdef QT_DEBUG | - | ||||||||||||||||||
| 121 | qFatal("QDBusArgument: write from a read-only object"); | - | ||||||||||||||||||
| 122 | #else | - | ||||||||||||||||||
| 123 | qWarning("QDBusArgument: write from a read-only object"); | - | ||||||||||||||||||
| 124 | #endif | - | ||||||||||||||||||
| 125 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 126 | } | - | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | bool QDBusArgumentPrivate::checkRead(QDBusArgumentPrivate *d) | - | ||||||||||||||||||
| 129 | { | - | ||||||||||||||||||
| 130 | if (!d)
| 0-18071 | ||||||||||||||||||
| 131 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 132 | if (d->direction == Demarshalling)
| 0-18071 | ||||||||||||||||||
| 133 | return true; executed 18071 times by 23 tests: return true;Executed by:
| 18071 | ||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | #ifdef QT_DEBUG | - | ||||||||||||||||||
| 136 | qFatal("QDBusArgument: read from a write-only object"); | - | ||||||||||||||||||
| 137 | #else | - | ||||||||||||||||||
| 138 | qWarning("QDBusArgument: read from a write-only object"); | - | ||||||||||||||||||
| 139 | #endif | - | ||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | return false; never executed: return false; | 0 | ||||||||||||||||||
| 142 | } | - | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d) | - | ||||||||||||||||||
| 145 | { | - | ||||||||||||||||||
| 146 | if (!checkRead(d))
| 0-13139 | ||||||||||||||||||
| 147 | return false; // don't bother never executed: return false; | 0 | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | if (d->ref.load() == 1)
| 706-12433 | ||||||||||||||||||
| 150 | return true; // no need to detach executed 12433 times by 23 tests: return true;Executed by:
| 12433 | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | QDBusDemarshaller *dd = new QDBusDemarshaller(d->capabilities); | - | ||||||||||||||||||
| 153 | dd->message = q_dbus_message_ref(d->message); | - | ||||||||||||||||||
| 154 | dd->iterator = static_cast<QDBusDemarshaller*>(d)->iterator; | - | ||||||||||||||||||
| 155 | - | |||||||||||||||||||
| 156 | if (!d->ref.deref())
| 0-706 | ||||||||||||||||||
| 157 | delete d; never executed: delete d; | 0 | ||||||||||||||||||
| 158 | d = dd; | - | ||||||||||||||||||
| 159 | return true; executed 706 times by 23 tests: return true;Executed by:
| 706 | ||||||||||||||||||
| 160 | } | - | ||||||||||||||||||
| 161 | - | |||||||||||||||||||
| 162 | /*! | - | ||||||||||||||||||
| 163 | \class QDBusArgument | - | ||||||||||||||||||
| 164 | \inmodule QtDBus | - | ||||||||||||||||||
| 165 | \since 4.2 | - | ||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | \brief The QDBusArgument class is used to marshall and demarshall D-Bus arguments. | - | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | The class is used to send arguments over D-Bus to remote | - | ||||||||||||||||||
| 170 | applications and to receive them back. D-Bus offers an extensible | - | ||||||||||||||||||
| 171 | type system, based on a few primitive types and associations of | - | ||||||||||||||||||
| 172 | them. See the \l {qdbustypesystem.html}{Qt D-Bus Type System} page | - | ||||||||||||||||||
| 173 | for more information on the type system. | - | ||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | QDBusArgument is the central class in the Qt D-Bus type system, | - | ||||||||||||||||||
| 176 | providing functions to marshall and demarshall the primitive | - | ||||||||||||||||||
| 177 | types. The compound types are then created by association of one | - | ||||||||||||||||||
| 178 | or more of the primitive types in arrays, dictionaries or | - | ||||||||||||||||||
| 179 | structures. | - | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | The following example illustrates how a structure containing an | - | ||||||||||||||||||
| 182 | integer and a string can be constructed using the \l | - | ||||||||||||||||||
| 183 | {qdbustypesystem.html}{Qt D-Bus type system}: | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | \snippet code/src_qdbus_qdbusargument.cpp 0 | - | ||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | The type has to be registered with qDBusRegisterMetaType() before | - | ||||||||||||||||||
| 188 | it can be used with QDBusArgument. Therefore, somewhere in your | - | ||||||||||||||||||
| 189 | program, you should add the following code: | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | \snippet code/src_qdbus_qdbusargument.cpp 1 | - | ||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | Once registered, a type can be used in outgoing method calls | - | ||||||||||||||||||
| 194 | (placed with QDBusAbstractInterface::call()), signal emissions | - | ||||||||||||||||||
| 195 | from registered objects or in incoming calls from remote | - | ||||||||||||||||||
| 196 | applications. | - | ||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | It is important to note that the \c{operator<<} and \c{operator>>} | - | ||||||||||||||||||
| 199 | streaming functions must always produce the same number of entries | - | ||||||||||||||||||
| 200 | in case of structures, both in reading and in writing (marshalling | - | ||||||||||||||||||
| 201 | and demarshalling), otherwise calls and signals may start to | - | ||||||||||||||||||
| 202 | silently fail. | - | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | The following example illustrates this wrong usage | - | ||||||||||||||||||
| 205 | in context of a class that may contain invalid data: | - | ||||||||||||||||||
| 206 | - | |||||||||||||||||||
| 207 | \code | - | ||||||||||||||||||
| 208 | //bad code | - | ||||||||||||||||||
| 209 | // Wrongly marshall the MyTime data into a D-Bus argument | - | ||||||||||||||||||
| 210 | QDBusArgument &operator<<(QDBusArgument &argument, const MyTime &mytime) | - | ||||||||||||||||||
| 211 | { | - | ||||||||||||||||||
| 212 | argument.beginStructure(); | - | ||||||||||||||||||
| 213 | if (mytime.isValid) | - | ||||||||||||||||||
| 214 | argument << true << mytime.hour | - | ||||||||||||||||||
| 215 | << mytime.minute << mytime.second; | - | ||||||||||||||||||
| 216 | else | - | ||||||||||||||||||
| 217 | argument << false; | - | ||||||||||||||||||
| 218 | argument.endStructure(); | - | ||||||||||||||||||
| 219 | return argument; | - | ||||||||||||||||||
| 220 | } | - | ||||||||||||||||||
| 221 | \endcode | - | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | In this example, both the \c{operator<<} and the \c{operator>>} | - | ||||||||||||||||||
| 224 | functions may produce a different number of reads/writes. This can | - | ||||||||||||||||||
| 225 | confuse the Qt D-Bus type system and should be avoided. | - | ||||||||||||||||||
| 226 | - | |||||||||||||||||||
| 227 | \sa QDBusAbstractInterface, {qdbustypesystem.html}{The Qt D-Bus type | - | ||||||||||||||||||
| 228 | system}, {usingadaptors.html}{Using Adaptors}, qdbus_cast() | - | ||||||||||||||||||
| 229 | */ | - | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | /*! | - | ||||||||||||||||||
| 232 | \enum QDBusArgument::ElementType | - | ||||||||||||||||||
| 233 | \since 4.5 | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | This enum describes the type of element held by the argument. | - | ||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | \value BasicType A basic element, which is understood by | - | ||||||||||||||||||
| 238 | QVariant. The following types are considered basic: bool, | - | ||||||||||||||||||
| 239 | byte, short, ushort, int, uint, qint64, quint64, double, | - | ||||||||||||||||||
| 240 | QString, QByteArray, QDBusObjectPath, QDBusSignature | - | ||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | \value VariantType The variant element (QDBusVariant) | - | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | \value ArrayType An array element, usually represented by QList<T> | - | ||||||||||||||||||
| 245 | or QVector<T>. Note: QByteArray and associative maps are not | - | ||||||||||||||||||
| 246 | considered arrays, even if the D-Bus protocol transports them as such. | - | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 | \value StructureType A custom type represented by a structure, | - | ||||||||||||||||||
| 249 | like QDateTime, QPoint, etc. | - | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | \value MapType An associative container, like QMap<Key, Value> or | - | ||||||||||||||||||
| 252 | QHash<Key, Value> | - | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | \value MapEntryType One entry in an associative container: both | - | ||||||||||||||||||
| 255 | the key and the value form one map-entry type. | - | ||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | \value UnknownType The type is unknown or we have reached the end | - | ||||||||||||||||||
| 258 | of the list. | - | ||||||||||||||||||
| 259 | - | |||||||||||||||||||
| 260 | \sa currentType() | - | ||||||||||||||||||
| 261 | */ | - | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | /*! | - | ||||||||||||||||||
| 264 | \fn qdbus_cast(const QDBusArgument &argument) | - | ||||||||||||||||||
| 265 | \relates QDBusArgument | - | ||||||||||||||||||
| 266 | \since 4.2 | - | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | Attempts to demarshall the contents of \a argument into the type | - | ||||||||||||||||||
| 269 | \c{T}. For example: | - | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | \snippet code/src_qdbus_qdbusargument.cpp 2 | - | ||||||||||||||||||
| 272 | - | |||||||||||||||||||
| 273 | Note that it is equivalent to the following: | - | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | \snippet code/src_qdbus_qdbusargument.cpp 3 | - | ||||||||||||||||||
| 276 | */ | - | ||||||||||||||||||
| 277 | - | |||||||||||||||||||
| 278 | /*! | - | ||||||||||||||||||
| 279 | Constructs an empty QDBusArgument argument. | - | ||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | An empty QDBusArgument object does not allow either reading or | - | ||||||||||||||||||
| 282 | writing to be performed. | - | ||||||||||||||||||
| 283 | */ | - | ||||||||||||||||||
| 284 | QDBusArgument::QDBusArgument() | - | ||||||||||||||||||
| 285 | { | - | ||||||||||||||||||
| 286 | if (!qdbus_loadLibDBus()) {
| 0-224 | ||||||||||||||||||
| 287 | d = 0; | - | ||||||||||||||||||
| 288 | return; never executed: return; | 0 | ||||||||||||||||||
| 289 | } | - | ||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | QDBusMarshaller *dd = new QDBusMarshaller(0); | - | ||||||||||||||||||
| 292 | d = dd; | - | ||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | // create a new message with any type, we won't sent it anyways | - | ||||||||||||||||||
| 295 | dd->message = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL); | - | ||||||||||||||||||
| 296 | q_dbus_message_iter_init_append(dd->message, &dd->iterator); | - | ||||||||||||||||||
| 297 | } executed 224 times by 1 test: end of blockExecuted by:
| 224 | ||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | /*! | - | ||||||||||||||||||
| 300 | Constructs a copy of the \a other QDBusArgument object. | - | ||||||||||||||||||
| 301 | - | |||||||||||||||||||
| 302 | Both objects will therefore contain the same state from this point | - | ||||||||||||||||||
| 303 | forward. QDBusArguments are explicitly shared and, therefore, any | - | ||||||||||||||||||
| 304 | modification to either copy will affect the other one too. | - | ||||||||||||||||||
| 305 | */ | - | ||||||||||||||||||
| 306 | QDBusArgument::QDBusArgument(const QDBusArgument &other) | - | ||||||||||||||||||
| 307 | : d(other.d) | - | ||||||||||||||||||
| 308 | { | - | ||||||||||||||||||
| 309 | if (d)
| 0-4789 | ||||||||||||||||||
| 310 | d->ref.ref(); executed 4789 times by 23 tests: d->ref.ref();Executed by:
| 4789 | ||||||||||||||||||
| 311 | } executed 4789 times by 23 tests: end of blockExecuted by:
| 4789 | ||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | /*! | - | ||||||||||||||||||
| 314 | \internal | - | ||||||||||||||||||
| 315 | */ | - | ||||||||||||||||||
| 316 | QDBusArgument::QDBusArgument(QDBusArgumentPrivate *dd) | - | ||||||||||||||||||
| 317 | : d(dd) | - | ||||||||||||||||||
| 318 | { | - | ||||||||||||||||||
| 319 | } executed 3056 times by 31 tests: end of blockExecuted by:
| 3056 | ||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | /*! | - | ||||||||||||||||||
| 322 | Copies the \a other QDBusArgument object into this one. | - | ||||||||||||||||||
| 323 | - | |||||||||||||||||||
| 324 | Both objects will therefore contain the same state from this point | - | ||||||||||||||||||
| 325 | forward. QDBusArguments are explicitly shared and, therefore, any | - | ||||||||||||||||||
| 326 | modification to either copy will affect the other one too. | - | ||||||||||||||||||
| 327 | */ | - | ||||||||||||||||||
| 328 | QDBusArgument &QDBusArgument::operator=(const QDBusArgument &other) | - | ||||||||||||||||||
| 329 | { | - | ||||||||||||||||||
| 330 | qAtomicAssign(d, other.d); | - | ||||||||||||||||||
| 331 | return *this; never executed: return *this; | 0 | ||||||||||||||||||
| 332 | } | - | ||||||||||||||||||
| 333 | - | |||||||||||||||||||
| 334 | /*! | - | ||||||||||||||||||
| 335 | Disposes of the resources associated with this QDBusArgument | - | ||||||||||||||||||
| 336 | object. | - | ||||||||||||||||||
| 337 | */ | - | ||||||||||||||||||
| 338 | QDBusArgument::~QDBusArgument() | - | ||||||||||||||||||
| 339 | { | - | ||||||||||||||||||
| 340 | if (d && !d->ref.deref())
| 1551-6536 | ||||||||||||||||||
| 341 | delete d; executed 2144 times by 41 tests: delete d;Executed by:
| 2144 | ||||||||||||||||||
| 342 | } executed 8087 times by 49 tests: end of blockExecuted by:
| 8087 | ||||||||||||||||||
| 343 | - | |||||||||||||||||||
| 344 | /*! | - | ||||||||||||||||||
| 345 | Appends the primitive value \a arg of type \c{BYTE} to the D-Bus stream. | - | ||||||||||||||||||
| 346 | */ | - | ||||||||||||||||||
| 347 | QDBusArgument &QDBusArgument::operator<<(uchar arg) | - | ||||||||||||||||||
| 348 | { | - | ||||||||||||||||||
| 349 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-1 | ||||||||||||||||||
| 350 | d->marshaller()->append(arg); executed 1 time by 1 test: d->marshaller()->append(arg);Executed by:
| 1 | ||||||||||||||||||
| 351 | return *this; executed 1 time by 1 test: return *this;Executed by:
| 1 | ||||||||||||||||||
| 352 | } | - | ||||||||||||||||||
| 353 | - | |||||||||||||||||||
| 354 | /*! | - | ||||||||||||||||||
| 355 | \overload | - | ||||||||||||||||||
| 356 | Appends the primitive value \a arg of type \c{BOOLEAN} to the D-Bus stream. | - | ||||||||||||||||||
| 357 | */ | - | ||||||||||||||||||
| 358 | QDBusArgument &QDBusArgument::operator<<(bool arg) | - | ||||||||||||||||||
| 359 | { | - | ||||||||||||||||||
| 360 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-15 | ||||||||||||||||||
| 361 | d->marshaller()->append(arg); executed 15 times by 1 test: d->marshaller()->append(arg);Executed by:
| 15 | ||||||||||||||||||
| 362 | return *this; executed 15 times by 1 test: return *this;Executed by:
| 15 | ||||||||||||||||||
| 363 | } | - | ||||||||||||||||||
| 364 | - | |||||||||||||||||||
| 365 | /*! | - | ||||||||||||||||||
| 366 | \overload | - | ||||||||||||||||||
| 367 | Appends the primitive value \a arg of type \c{INT16} to the D-Bus stream. | - | ||||||||||||||||||
| 368 | */ | - | ||||||||||||||||||
| 369 | QDBusArgument &QDBusArgument::operator<<(short arg) | - | ||||||||||||||||||
| 370 | { | - | ||||||||||||||||||
| 371 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-14 | ||||||||||||||||||
| 372 | d->marshaller()->append(arg); executed 14 times by 1 test: d->marshaller()->append(arg);Executed by:
| 14 | ||||||||||||||||||
| 373 | return *this; executed 14 times by 1 test: return *this;Executed by:
| 14 | ||||||||||||||||||
| 374 | } | - | ||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | /*! | - | ||||||||||||||||||
| 377 | \overload | - | ||||||||||||||||||
| 378 | Appends the primitive value \a arg of type \c{UINT16} to the D-Bus stream. | - | ||||||||||||||||||
| 379 | */ | - | ||||||||||||||||||
| 380 | QDBusArgument &QDBusArgument::operator<<(ushort arg) | - | ||||||||||||||||||
| 381 | { | - | ||||||||||||||||||
| 382 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-12 | ||||||||||||||||||
| 383 | d->marshaller()->append(arg); executed 12 times by 1 test: d->marshaller()->append(arg);Executed by:
| 12 | ||||||||||||||||||
| 384 | return *this; executed 12 times by 1 test: return *this;Executed by:
| 12 | ||||||||||||||||||
| 385 | } | - | ||||||||||||||||||
| 386 | - | |||||||||||||||||||
| 387 | /*! | - | ||||||||||||||||||
| 388 | \overload | - | ||||||||||||||||||
| 389 | Appends the primitive value \a arg of type \c{INT32} to the D-Bus stream. | - | ||||||||||||||||||
| 390 | */ | - | ||||||||||||||||||
| 391 | QDBusArgument &QDBusArgument::operator<<(int arg) | - | ||||||||||||||||||
| 392 | { | - | ||||||||||||||||||
| 393 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-1786 | ||||||||||||||||||
| 394 | d->marshaller()->append(arg); executed 1786 times by 8 tests: d->marshaller()->append(arg);Executed by:
| 1786 | ||||||||||||||||||
| 395 | return *this; executed 1786 times by 8 tests: return *this;Executed by:
| 1786 | ||||||||||||||||||
| 396 | } | - | ||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | /*! | - | ||||||||||||||||||
| 399 | \overload | - | ||||||||||||||||||
| 400 | Appends the primitive value \a arg of type \c{UINT32} to the D-Bus stream. | - | ||||||||||||||||||
| 401 | */ | - | ||||||||||||||||||
| 402 | QDBusArgument &QDBusArgument::operator<<(uint arg) | - | ||||||||||||||||||
| 403 | { | - | ||||||||||||||||||
| 404 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-12 | ||||||||||||||||||
| 405 | d->marshaller()->append(arg); executed 12 times by 1 test: d->marshaller()->append(arg);Executed by:
| 12 | ||||||||||||||||||
| 406 | return *this; executed 12 times by 1 test: return *this;Executed by:
| 12 | ||||||||||||||||||
| 407 | } | - | ||||||||||||||||||
| 408 | - | |||||||||||||||||||
| 409 | /*! | - | ||||||||||||||||||
| 410 | \overload | - | ||||||||||||||||||
| 411 | Appends the primitive value \a arg of type \c{INT64} to the D-Bus stream. | - | ||||||||||||||||||
| 412 | */ | - | ||||||||||||||||||
| 413 | QDBusArgument &QDBusArgument::operator<<(qlonglong arg) | - | ||||||||||||||||||
| 414 | { | - | ||||||||||||||||||
| 415 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-21 | ||||||||||||||||||
| 416 | d->marshaller()->append(arg); executed 21 times by 4 tests: d->marshaller()->append(arg);Executed by:
| 21 | ||||||||||||||||||
| 417 | return *this; executed 21 times by 4 tests: return *this;Executed by:
| 21 | ||||||||||||||||||
| 418 | } | - | ||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | /*! | - | ||||||||||||||||||
| 421 | \overload | - | ||||||||||||||||||
| 422 | Appends the primitive value \a arg of type \c{UINT64} to the D-Bus stream. | - | ||||||||||||||||||
| 423 | */ | - | ||||||||||||||||||
| 424 | QDBusArgument &QDBusArgument::operator<<(qulonglong arg) | - | ||||||||||||||||||
| 425 | { | - | ||||||||||||||||||
| 426 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-7 | ||||||||||||||||||
| 427 | d->marshaller()->append(arg); executed 7 times by 1 test: d->marshaller()->append(arg);Executed by:
| 7 | ||||||||||||||||||
| 428 | return *this; executed 7 times by 1 test: return *this;Executed by:
| 7 | ||||||||||||||||||
| 429 | } | - | ||||||||||||||||||
| 430 | - | |||||||||||||||||||
| 431 | /*! | - | ||||||||||||||||||
| 432 | \overload | - | ||||||||||||||||||
| 433 | Appends the primitive value \a arg of type \c{DOUBLE} (double-precision | - | ||||||||||||||||||
| 434 | floating-point) to the D-Bus stream. | - | ||||||||||||||||||
| 435 | */ | - | ||||||||||||||||||
| 436 | QDBusArgument &QDBusArgument::operator<<(double arg) | - | ||||||||||||||||||
| 437 | { | - | ||||||||||||||||||
| 438 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-700 | ||||||||||||||||||
| 439 | d->marshaller()->append(arg); executed 700 times by 3 tests: d->marshaller()->append(arg);Executed by:
| 700 | ||||||||||||||||||
| 440 | return *this; executed 700 times by 3 tests: return *this;Executed by:
| 700 | ||||||||||||||||||
| 441 | } | - | ||||||||||||||||||
| 442 | - | |||||||||||||||||||
| 443 | /*! | - | ||||||||||||||||||
| 444 | \overload | - | ||||||||||||||||||
| 445 | Appends the primitive value \a arg of type \c{STRING} (Unicode character | - | ||||||||||||||||||
| 446 | string) to the D-Bus stream. | - | ||||||||||||||||||
| 447 | */ | - | ||||||||||||||||||
| 448 | QDBusArgument &QDBusArgument::operator<<(const QString &arg) | - | ||||||||||||||||||
| 449 | { | - | ||||||||||||||||||
| 450 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-334 | ||||||||||||||||||
| 451 | d->marshaller()->append(arg); executed 334 times by 7 tests: d->marshaller()->append(arg);Executed by:
| 334 | ||||||||||||||||||
| 452 | return *this; executed 334 times by 7 tests: return *this;Executed by:
| 334 | ||||||||||||||||||
| 453 | } | - | ||||||||||||||||||
| 454 | - | |||||||||||||||||||
| 455 | /*! | - | ||||||||||||||||||
| 456 | \overload | - | ||||||||||||||||||
| 457 | \internal | - | ||||||||||||||||||
| 458 | Appends the primitive value \a arg of type \c{OBJECT_PATH} (path to a D-Bus | - | ||||||||||||||||||
| 459 | object) to the D-Bus stream. | - | ||||||||||||||||||
| 460 | */ | - | ||||||||||||||||||
| 461 | QDBusArgument &QDBusArgument::operator<<(const QDBusObjectPath &arg) | - | ||||||||||||||||||
| 462 | { | - | ||||||||||||||||||
| 463 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-30 | ||||||||||||||||||
| 464 | d->marshaller()->append(arg); executed 30 times by 19 tests: d->marshaller()->append(arg);Executed by:
| 30 | ||||||||||||||||||
| 465 | return *this; executed 30 times by 19 tests: return *this;Executed by:
| 30 | ||||||||||||||||||
| 466 | } | - | ||||||||||||||||||
| 467 | - | |||||||||||||||||||
| 468 | /*! | - | ||||||||||||||||||
| 469 | \overload | - | ||||||||||||||||||
| 470 | \internal | - | ||||||||||||||||||
| 471 | Appends the primitive value \a arg of type \c{SIGNATURE} (D-Bus type | - | ||||||||||||||||||
| 472 | signature) to the D-Bus stream. | - | ||||||||||||||||||
| 473 | */ | - | ||||||||||||||||||
| 474 | QDBusArgument &QDBusArgument::operator<<(const QDBusSignature &arg) | - | ||||||||||||||||||
| 475 | { | - | ||||||||||||||||||
| 476 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-10 | ||||||||||||||||||
| 477 | d->marshaller()->append(arg); executed 10 times by 1 test: d->marshaller()->append(arg);Executed by:
| 10 | ||||||||||||||||||
| 478 | return *this; executed 10 times by 1 test: return *this;Executed by:
| 10 | ||||||||||||||||||
| 479 | } | - | ||||||||||||||||||
| 480 | - | |||||||||||||||||||
| 481 | /*! | - | ||||||||||||||||||
| 482 | \overload | - | ||||||||||||||||||
| 483 | \since 4.8 | - | ||||||||||||||||||
| 484 | \internal | - | ||||||||||||||||||
| 485 | Appends the primitive value \a arg of type \c{UNIX_FILE_DESCRIPTOR} (Unix | - | ||||||||||||||||||
| 486 | File Descriptor) to the D-Bus stream. | - | ||||||||||||||||||
| 487 | */ | - | ||||||||||||||||||
| 488 | QDBusArgument &QDBusArgument::operator<<(const QDBusUnixFileDescriptor &arg) | - | ||||||||||||||||||
| 489 | { | - | ||||||||||||||||||
| 490 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-6 | ||||||||||||||||||
| 491 | d->marshaller()->append(arg); executed 6 times by 1 test: d->marshaller()->append(arg);Executed by:
| 6 | ||||||||||||||||||
| 492 | return *this; executed 6 times by 1 test: return *this;Executed by:
| 6 | ||||||||||||||||||
| 493 | } | - | ||||||||||||||||||
| 494 | - | |||||||||||||||||||
| 495 | /*! | - | ||||||||||||||||||
| 496 | \overload | - | ||||||||||||||||||
| 497 | Appends the primitive value \a arg of type \c{VARIANT} to the D-Bus stream. | - | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | A D-Bus variant type can contain any type, including other | - | ||||||||||||||||||
| 500 | variants. It is similar to the Qt QVariant type. | - | ||||||||||||||||||
| 501 | */ | - | ||||||||||||||||||
| 502 | QDBusArgument &QDBusArgument::operator<<(const QDBusVariant &arg) | - | ||||||||||||||||||
| 503 | { | - | ||||||||||||||||||
| 504 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-159 | ||||||||||||||||||
| 505 | d->marshaller()->append(arg); executed 159 times by 7 tests: d->marshaller()->append(arg);Executed by:
| 159 | ||||||||||||||||||
| 506 | return *this; executed 159 times by 7 tests: return *this;Executed by:
| 159 | ||||||||||||||||||
| 507 | } | - | ||||||||||||||||||
| 508 | - | |||||||||||||||||||
| 509 | /*! | - | ||||||||||||||||||
| 510 | \overload | - | ||||||||||||||||||
| 511 | Appends the QStringList given by \a arg as \c{ARRAY of STRING} | - | ||||||||||||||||||
| 512 | to the D-Bus stream. | - | ||||||||||||||||||
| 513 | - | |||||||||||||||||||
| 514 | QStringList and QByteArray are the only two non-primitive types | - | ||||||||||||||||||
| 515 | that are supported directly by QDBusArgument because of their | - | ||||||||||||||||||
| 516 | widespread usage in Qt applications. | - | ||||||||||||||||||
| 517 | - | |||||||||||||||||||
| 518 | Other arrays are supported through compound types in Qt D-Bus. | - | ||||||||||||||||||
| 519 | */ | - | ||||||||||||||||||
| 520 | QDBusArgument &QDBusArgument::operator<<(const QStringList &arg) | - | ||||||||||||||||||
| 521 | { | - | ||||||||||||||||||
| 522 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-9 | ||||||||||||||||||
| 523 | d->marshaller()->append(arg); executed 9 times by 3 tests: d->marshaller()->append(arg);Executed by:
| 9 | ||||||||||||||||||
| 524 | return *this; executed 9 times by 3 tests: return *this;Executed by:
| 9 | ||||||||||||||||||
| 525 | } | - | ||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | /*! | - | ||||||||||||||||||
| 528 | \overload | - | ||||||||||||||||||
| 529 | Appends the QByteArray given by \a arg as \c{ARRAY of BYTE} | - | ||||||||||||||||||
| 530 | to the D-Bus stream. | - | ||||||||||||||||||
| 531 | - | |||||||||||||||||||
| 532 | QStringList and QByteArray are the only two non-primitive types | - | ||||||||||||||||||
| 533 | that are supported directly by QDBusArgument because of their | - | ||||||||||||||||||
| 534 | widespread usage in Qt applications. | - | ||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | Other arrays are supported through compound types in Qt D-Bus. | - | ||||||||||||||||||
| 537 | */ | - | ||||||||||||||||||
| 538 | QDBusArgument &QDBusArgument::operator<<(const QByteArray &arg) | - | ||||||||||||||||||
| 539 | { | - | ||||||||||||||||||
| 540 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-10 | ||||||||||||||||||
| 541 | d->marshaller()->append(arg); executed 10 times by 3 tests: d->marshaller()->append(arg);Executed by:
| 10 | ||||||||||||||||||
| 542 | return *this; executed 10 times by 3 tests: return *this;Executed by:
| 10 | ||||||||||||||||||
| 543 | } | - | ||||||||||||||||||
| 544 | - | |||||||||||||||||||
| 545 | /*! | - | ||||||||||||||||||
| 546 | \internal | - | ||||||||||||||||||
| 547 | \since 4.5 | - | ||||||||||||||||||
| 548 | - | |||||||||||||||||||
| 549 | Appends the variant \a v. | - | ||||||||||||||||||
| 550 | - | |||||||||||||||||||
| 551 | \sa asVariant() | - | ||||||||||||||||||
| 552 | */ | - | ||||||||||||||||||
| 553 | void QDBusArgument::appendVariant(const QVariant &v) | - | ||||||||||||||||||
| 554 | { | - | ||||||||||||||||||
| 555 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-201 | ||||||||||||||||||
| 556 | d->marshaller()->appendVariantInternal(v); executed 201 times by 1 test: d->marshaller()->appendVariantInternal(v);Executed by:
| 201 | ||||||||||||||||||
| 557 | } executed 201 times by 1 test: end of blockExecuted by:
| 201 | ||||||||||||||||||
| 558 | - | |||||||||||||||||||
| 559 | /*! | - | ||||||||||||||||||
| 560 | \internal | - | ||||||||||||||||||
| 561 | Returns the type signature of the D-Bus type this QDBusArgument | - | ||||||||||||||||||
| 562 | object is currently pointing to. | - | ||||||||||||||||||
| 563 | */ | - | ||||||||||||||||||
| 564 | QString QDBusArgument::currentSignature() const | - | ||||||||||||||||||
| 565 | { | - | ||||||||||||||||||
| 566 | if (!d)
| 0-894 | ||||||||||||||||||
| 567 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||
| 568 | if (d->direction == QDBusArgumentPrivate::Demarshalling)
| 0-894 | ||||||||||||||||||
| 569 | return d->demarshaller()->currentSignature(); executed 894 times by 5 tests: return d->demarshaller()->currentSignature();Executed by:
| 894 | ||||||||||||||||||
| 570 | else | - | ||||||||||||||||||
| 571 | return d->marshaller()->currentSignature(); never executed: return d->marshaller()->currentSignature(); | 0 | ||||||||||||||||||
| 572 | } | - | ||||||||||||||||||
| 573 | - | |||||||||||||||||||
| 574 | /*! | - | ||||||||||||||||||
| 575 | \since 4.5 | - | ||||||||||||||||||
| 576 | Returns the classification of the current element type. If an | - | ||||||||||||||||||
| 577 | error decoding the type occurs or if we're at the end of the | - | ||||||||||||||||||
| 578 | argument, this function returns QDBusArgument::UnknownType. | - | ||||||||||||||||||
| 579 | - | |||||||||||||||||||
| 580 | This function only makes sense when demarshalling arguments. If it | - | ||||||||||||||||||
| 581 | is used while marshalling, it will always return UnknownType. | - | ||||||||||||||||||
| 582 | */ | - | ||||||||||||||||||
| 583 | QDBusArgument::ElementType QDBusArgument::currentType() const | - | ||||||||||||||||||
| 584 | { | - | ||||||||||||||||||
| 585 | if (!d)
| 0-694 | ||||||||||||||||||
| 586 | return UnknownType; never executed: return UnknownType; | 0 | ||||||||||||||||||
| 587 | if (d->direction == QDBusArgumentPrivate::Demarshalling)
| 0-694 | ||||||||||||||||||
| 588 | return d->demarshaller()->currentType(); executed 694 times by 1 test: return d->demarshaller()->currentType();Executed by:
| 694 | ||||||||||||||||||
| 589 | return UnknownType; never executed: return UnknownType; | 0 | ||||||||||||||||||
| 590 | } | - | ||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | /*! | - | ||||||||||||||||||
| 593 | Extracts one D-BUS primitive argument of type \c{BYTE} from the | - | ||||||||||||||||||
| 594 | D-BUS stream and puts it into \a arg. | - | ||||||||||||||||||
| 595 | */ | - | ||||||||||||||||||
| 596 | const QDBusArgument &QDBusArgument::operator>>(uchar &arg) const | - | ||||||||||||||||||
| 597 | { | - | ||||||||||||||||||
| 598 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-10 | ||||||||||||||||||
| 599 | arg = d->demarshaller()->toByte(); executed 10 times by 1 test: arg = d->demarshaller()->toByte();Executed by:
| 10 | ||||||||||||||||||
| 600 | else | - | ||||||||||||||||||
| 601 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 602 | return *this; executed 10 times by 1 test: return *this;Executed by:
| 10 | ||||||||||||||||||
| 603 | } | - | ||||||||||||||||||
| 604 | - | |||||||||||||||||||
| 605 | /*! | - | ||||||||||||||||||
| 606 | \overload | - | ||||||||||||||||||
| 607 | Extracts one D-Bus primitive argument of type \c{BOOLEAN} from the | - | ||||||||||||||||||
| 608 | D-Bus stream. | - | ||||||||||||||||||
| 609 | */ | - | ||||||||||||||||||
| 610 | const QDBusArgument &QDBusArgument::operator>>(bool &arg) const | - | ||||||||||||||||||
| 611 | { | - | ||||||||||||||||||
| 612 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-16 | ||||||||||||||||||
| 613 | arg = d->demarshaller()->toBool(); executed 16 times by 1 test: arg = d->demarshaller()->toBool();Executed by:
| 16 | ||||||||||||||||||
| 614 | else | - | ||||||||||||||||||
| 615 | arg = false; never executed: arg = false; | 0 | ||||||||||||||||||
| 616 | return *this; executed 16 times by 1 test: return *this;Executed by:
| 16 | ||||||||||||||||||
| 617 | } | - | ||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | /*! | - | ||||||||||||||||||
| 620 | \overload | - | ||||||||||||||||||
| 621 | Extracts one D-Bus primitive argument of type \c{UINT16} from the | - | ||||||||||||||||||
| 622 | D-Bus stream. | - | ||||||||||||||||||
| 623 | */ | - | ||||||||||||||||||
| 624 | const QDBusArgument &QDBusArgument::operator>>(ushort &arg) const | - | ||||||||||||||||||
| 625 | { | - | ||||||||||||||||||
| 626 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-20 | ||||||||||||||||||
| 627 | arg = d->demarshaller()->toUShort(); executed 20 times by 1 test: arg = d->demarshaller()->toUShort();Executed by:
| 20 | ||||||||||||||||||
| 628 | else | - | ||||||||||||||||||
| 629 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 630 | return *this; executed 20 times by 1 test: return *this;Executed by:
| 20 | ||||||||||||||||||
| 631 | } | - | ||||||||||||||||||
| 632 | - | |||||||||||||||||||
| 633 | /*! | - | ||||||||||||||||||
| 634 | \overload | - | ||||||||||||||||||
| 635 | Extracts one D-Bus primitive argument of type \c{INT16} from the | - | ||||||||||||||||||
| 636 | D-Bus stream. | - | ||||||||||||||||||
| 637 | */ | - | ||||||||||||||||||
| 638 | const QDBusArgument &QDBusArgument::operator>>(short &arg) const | - | ||||||||||||||||||
| 639 | { | - | ||||||||||||||||||
| 640 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-22 | ||||||||||||||||||
| 641 | arg = d->demarshaller()->toShort(); executed 22 times by 1 test: arg = d->demarshaller()->toShort();Executed by:
| 22 | ||||||||||||||||||
| 642 | else | - | ||||||||||||||||||
| 643 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 644 | return *this; executed 22 times by 1 test: return *this;Executed by:
| 22 | ||||||||||||||||||
| 645 | } | - | ||||||||||||||||||
| 646 | - | |||||||||||||||||||
| 647 | /*! | - | ||||||||||||||||||
| 648 | \overload | - | ||||||||||||||||||
| 649 | Extracts one D-Bus primitive argument of type \c{INT32} from the | - | ||||||||||||||||||
| 650 | D-Bus stream. | - | ||||||||||||||||||
| 651 | */ | - | ||||||||||||||||||
| 652 | const QDBusArgument &QDBusArgument::operator>>(int &arg) const | - | ||||||||||||||||||
| 653 | { | - | ||||||||||||||||||
| 654 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-260 | ||||||||||||||||||
| 655 | arg = d->demarshaller()->toInt(); executed 260 times by 6 tests: arg = d->demarshaller()->toInt();Executed by:
| 260 | ||||||||||||||||||
| 656 | else | - | ||||||||||||||||||
| 657 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 658 | return *this; executed 260 times by 6 tests: return *this;Executed by:
| 260 | ||||||||||||||||||
| 659 | } | - | ||||||||||||||||||
| 660 | - | |||||||||||||||||||
| 661 | /*! | - | ||||||||||||||||||
| 662 | \overload | - | ||||||||||||||||||
| 663 | Extracts one D-Bus primitive argument of type \c{UINT32} from the | - | ||||||||||||||||||
| 664 | D-Bus stream. | - | ||||||||||||||||||
| 665 | */ | - | ||||||||||||||||||
| 666 | const QDBusArgument &QDBusArgument::operator>>(uint &arg) const | - | ||||||||||||||||||
| 667 | { | - | ||||||||||||||||||
| 668 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-18 | ||||||||||||||||||
| 669 | arg = d->demarshaller()->toUInt(); executed 18 times by 1 test: arg = d->demarshaller()->toUInt();Executed by:
| 18 | ||||||||||||||||||
| 670 | else | - | ||||||||||||||||||
| 671 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 672 | return *this; executed 18 times by 1 test: return *this;Executed by:
| 18 | ||||||||||||||||||
| 673 | } | - | ||||||||||||||||||
| 674 | - | |||||||||||||||||||
| 675 | /*! | - | ||||||||||||||||||
| 676 | \overload | - | ||||||||||||||||||
| 677 | Extracts one D-Bus primitive argument of type \c{INT64} from the | - | ||||||||||||||||||
| 678 | D-Bus stream. | - | ||||||||||||||||||
| 679 | */ | - | ||||||||||||||||||
| 680 | const QDBusArgument &QDBusArgument::operator>>(qlonglong &arg) const | - | ||||||||||||||||||
| 681 | { | - | ||||||||||||||||||
| 682 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-28 | ||||||||||||||||||
| 683 | arg = d->demarshaller()->toLongLong(); executed 28 times by 2 tests: arg = d->demarshaller()->toLongLong();Executed by:
| 28 | ||||||||||||||||||
| 684 | else | - | ||||||||||||||||||
| 685 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 686 | return *this; executed 28 times by 2 tests: return *this;Executed by:
| 28 | ||||||||||||||||||
| 687 | } | - | ||||||||||||||||||
| 688 | - | |||||||||||||||||||
| 689 | /*! | - | ||||||||||||||||||
| 690 | \overload | - | ||||||||||||||||||
| 691 | Extracts one D-Bus primitive argument of type \c{UINT64} from the | - | ||||||||||||||||||
| 692 | D-Bus stream. | - | ||||||||||||||||||
| 693 | */ | - | ||||||||||||||||||
| 694 | const QDBusArgument &QDBusArgument::operator>>(qulonglong &arg) const | - | ||||||||||||||||||
| 695 | { | - | ||||||||||||||||||
| 696 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-16 | ||||||||||||||||||
| 697 | arg = d->demarshaller()->toULongLong(); executed 16 times by 1 test: arg = d->demarshaller()->toULongLong();Executed by:
| 16 | ||||||||||||||||||
| 698 | else | - | ||||||||||||||||||
| 699 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 700 | return *this; executed 16 times by 1 test: return *this;Executed by:
| 16 | ||||||||||||||||||
| 701 | } | - | ||||||||||||||||||
| 702 | - | |||||||||||||||||||
| 703 | /*! | - | ||||||||||||||||||
| 704 | \overload | - | ||||||||||||||||||
| 705 | Extracts one D-Bus primitive argument of type \c{DOUBLE} | - | ||||||||||||||||||
| 706 | (double-precision floating pount) from the D-Bus stream. | - | ||||||||||||||||||
| 707 | */ | - | ||||||||||||||||||
| 708 | const QDBusArgument &QDBusArgument::operator>>(double &arg) const | - | ||||||||||||||||||
| 709 | { | - | ||||||||||||||||||
| 710 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-36 | ||||||||||||||||||
| 711 | arg = d->demarshaller()->toDouble(); executed 36 times by 1 test: arg = d->demarshaller()->toDouble();Executed by:
| 36 | ||||||||||||||||||
| 712 | else | - | ||||||||||||||||||
| 713 | arg = 0; never executed: arg = 0; | 0 | ||||||||||||||||||
| 714 | return *this; executed 36 times by 1 test: return *this;Executed by:
| 36 | ||||||||||||||||||
| 715 | } | - | ||||||||||||||||||
| 716 | - | |||||||||||||||||||
| 717 | /*! | - | ||||||||||||||||||
| 718 | \overload | - | ||||||||||||||||||
| 719 | Extracts one D-Bus primitive argument of type \c{STRING} (Unicode | - | ||||||||||||||||||
| 720 | character string) from the D-Bus stream. | - | ||||||||||||||||||
| 721 | */ | - | ||||||||||||||||||
| 722 | const QDBusArgument &QDBusArgument::operator>>(QString &arg) const | - | ||||||||||||||||||
| 723 | { | - | ||||||||||||||||||
| 724 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-2640 | ||||||||||||||||||
| 725 | arg = d->demarshaller()->toString(); executed 2640 times by 21 tests: arg = d->demarshaller()->toString();Executed by:
| 2640 | ||||||||||||||||||
| 726 | return *this; executed 2640 times by 21 tests: return *this;Executed by:
| 2640 | ||||||||||||||||||
| 727 | } | - | ||||||||||||||||||
| 728 | - | |||||||||||||||||||
| 729 | /*! | - | ||||||||||||||||||
| 730 | \overload | - | ||||||||||||||||||
| 731 | \internal | - | ||||||||||||||||||
| 732 | Extracts one D-Bus primitive argument of type \c{OBJECT_PATH} | - | ||||||||||||||||||
| 733 | (D-Bus path to an object) from the D-Bus stream. | - | ||||||||||||||||||
| 734 | */ | - | ||||||||||||||||||
| 735 | const QDBusArgument &QDBusArgument::operator>>(QDBusObjectPath &arg) const | - | ||||||||||||||||||
| 736 | { | - | ||||||||||||||||||
| 737 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-151 | ||||||||||||||||||
| 738 | arg = d->demarshaller()->toObjectPath(); executed 151 times by 18 tests: arg = d->demarshaller()->toObjectPath();Executed by:
| 151 | ||||||||||||||||||
| 739 | return *this; executed 151 times by 18 tests: return *this;Executed by:
| 151 | ||||||||||||||||||
| 740 | } | - | ||||||||||||||||||
| 741 | - | |||||||||||||||||||
| 742 | /*! | - | ||||||||||||||||||
| 743 | \overload | - | ||||||||||||||||||
| 744 | \internal | - | ||||||||||||||||||
| 745 | Extracts one D-Bus primitive argument of type \c{SIGNATURE} (D-Bus | - | ||||||||||||||||||
| 746 | type signature) from the D-Bus stream. | - | ||||||||||||||||||
| 747 | */ | - | ||||||||||||||||||
| 748 | const QDBusArgument &QDBusArgument::operator>>(QDBusSignature &arg) const | - | ||||||||||||||||||
| 749 | { | - | ||||||||||||||||||
| 750 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-24 | ||||||||||||||||||
| 751 | arg = d->demarshaller()->toSignature(); executed 24 times by 1 test: arg = d->demarshaller()->toSignature();Executed by:
| 24 | ||||||||||||||||||
| 752 | return *this; executed 24 times by 1 test: return *this;Executed by:
| 24 | ||||||||||||||||||
| 753 | } | - | ||||||||||||||||||
| 754 | - | |||||||||||||||||||
| 755 | /*! | - | ||||||||||||||||||
| 756 | \overload | - | ||||||||||||||||||
| 757 | \since 4.8 | - | ||||||||||||||||||
| 758 | \internal | - | ||||||||||||||||||
| 759 | Extracts one D-Bus primitive argument of type \c{UNIX_FILE_DESCRIPTOR} | - | ||||||||||||||||||
| 760 | (Unix file descriptor) from the D-Bus stream. | - | ||||||||||||||||||
| 761 | */ | - | ||||||||||||||||||
| 762 | const QDBusArgument &QDBusArgument::operator>>(QDBusUnixFileDescriptor &arg) const | - | ||||||||||||||||||
| 763 | { | - | ||||||||||||||||||
| 764 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-4 | ||||||||||||||||||
| 765 | arg = d->demarshaller()->toUnixFileDescriptor(); executed 4 times by 1 test: arg = d->demarshaller()->toUnixFileDescriptor();Executed by:
| 4 | ||||||||||||||||||
| 766 | return *this; executed 4 times by 1 test: return *this;Executed by:
| 4 | ||||||||||||||||||
| 767 | } | - | ||||||||||||||||||
| 768 | - | |||||||||||||||||||
| 769 | /*! | - | ||||||||||||||||||
| 770 | \overload | - | ||||||||||||||||||
| 771 | Extracts one D-Bus primitive argument of type \c{VARIANT} from the | - | ||||||||||||||||||
| 772 | D-Bus stream. | - | ||||||||||||||||||
| 773 | - | |||||||||||||||||||
| 774 | A D-Bus variant type can contain any type, including other | - | ||||||||||||||||||
| 775 | variants. It is similar to the Qt QVariant type. | - | ||||||||||||||||||
| 776 | - | |||||||||||||||||||
| 777 | In case the variant contains a type not directly supported by | - | ||||||||||||||||||
| 778 | QDBusArgument, the value of the returned QDBusVariant will contain | - | ||||||||||||||||||
| 779 | another QDBusArgument. It is your responsibility to further | - | ||||||||||||||||||
| 780 | demarshall it into another type. | - | ||||||||||||||||||
| 781 | */ | - | ||||||||||||||||||
| 782 | const QDBusArgument &QDBusArgument::operator>>(QDBusVariant &arg) const | - | ||||||||||||||||||
| 783 | { | - | ||||||||||||||||||
| 784 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-2520 | ||||||||||||||||||
| 785 | arg = d->demarshaller()->toVariant(); executed 2520 times by 22 tests: arg = d->demarshaller()->toVariant();Executed by:
| 2520 | ||||||||||||||||||
| 786 | return *this; executed 2520 times by 22 tests: return *this;Executed by:
| 2520 | ||||||||||||||||||
| 787 | } | - | ||||||||||||||||||
| 788 | - | |||||||||||||||||||
| 789 | /*! | - | ||||||||||||||||||
| 790 | \overload | - | ||||||||||||||||||
| 791 | Extracts an array of strings from the D-Bus stream and return it | - | ||||||||||||||||||
| 792 | as a QStringList. | - | ||||||||||||||||||
| 793 | - | |||||||||||||||||||
| 794 | QStringList and QByteArray are the only two non-primitive types | - | ||||||||||||||||||
| 795 | that are supported directly by QDBusArgument because of their | - | ||||||||||||||||||
| 796 | widespread usage in Qt applications. | - | ||||||||||||||||||
| 797 | - | |||||||||||||||||||
| 798 | Other arrays are supported through compound types in Qt D-Bus. | - | ||||||||||||||||||
| 799 | */ | - | ||||||||||||||||||
| 800 | const QDBusArgument &QDBusArgument::operator>>(QStringList &arg) const | - | ||||||||||||||||||
| 801 | { | - | ||||||||||||||||||
| 802 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-24 | ||||||||||||||||||
| 803 | arg = d->demarshaller()->toStringList(); executed 24 times by 1 test: arg = d->demarshaller()->toStringList();Executed by:
| 24 | ||||||||||||||||||
| 804 | return *this; executed 24 times by 1 test: return *this;Executed by:
| 24 | ||||||||||||||||||
| 805 | } | - | ||||||||||||||||||
| 806 | - | |||||||||||||||||||
| 807 | /*! | - | ||||||||||||||||||
| 808 | \overload | - | ||||||||||||||||||
| 809 | Extracts an array of bytes from the D-Bus stream and return it | - | ||||||||||||||||||
| 810 | as a QByteArray. | - | ||||||||||||||||||
| 811 | - | |||||||||||||||||||
| 812 | QStringList and QByteArray are the only two non-primitive types | - | ||||||||||||||||||
| 813 | that are supported directly by QDBusArgument because of their | - | ||||||||||||||||||
| 814 | widespread usage in Qt applications. | - | ||||||||||||||||||
| 815 | - | |||||||||||||||||||
| 816 | Other arrays are supported through compound types in Qt D-Bus. | - | ||||||||||||||||||
| 817 | */ | - | ||||||||||||||||||
| 818 | const QDBusArgument &QDBusArgument::operator>>(QByteArray &arg) const | - | ||||||||||||||||||
| 819 | { | - | ||||||||||||||||||
| 820 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-26 | ||||||||||||||||||
| 821 | arg = d->demarshaller()->toByteArray(); executed 26 times by 1 test: arg = d->demarshaller()->toByteArray();Executed by:
| 26 | ||||||||||||||||||
| 822 | return *this; executed 26 times by 1 test: return *this;Executed by:
| 26 | ||||||||||||||||||
| 823 | } | - | ||||||||||||||||||
| 824 | - | |||||||||||||||||||
| 825 | /*! | - | ||||||||||||||||||
| 826 | Opens a new D-Bus structure suitable for appending new arguments. | - | ||||||||||||||||||
| 827 | - | |||||||||||||||||||
| 828 | This function is used usually in \c{operator<<} streaming | - | ||||||||||||||||||
| 829 | operators, as in the following example: | - | ||||||||||||||||||
| 830 | - | |||||||||||||||||||
| 831 | \snippet code/src_qdbus_qdbusargument.cpp 4 | - | ||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | Structures can contain other structures, so the following code is | - | ||||||||||||||||||
| 834 | also valid: | - | ||||||||||||||||||
| 835 | - | |||||||||||||||||||
| 836 | \snippet code/src_qdbus_qdbusargument.cpp 5 | - | ||||||||||||||||||
| 837 | - | |||||||||||||||||||
| 838 | \sa endStructure(), beginArray(), beginMap() | - | ||||||||||||||||||
| 839 | */ | - | ||||||||||||||||||
| 840 | void QDBusArgument::beginStructure() | - | ||||||||||||||||||
| 841 | { | - | ||||||||||||||||||
| 842 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-1412 | ||||||||||||||||||
| 843 | d = d->marshaller()->beginStructure(); executed 1412 times by 24 tests: d = d->marshaller()->beginStructure();Executed by:
| 1412 | ||||||||||||||||||
| 844 | } executed 1412 times by 24 tests: end of blockExecuted by:
| 1412 | ||||||||||||||||||
| 845 | - | |||||||||||||||||||
| 846 | /*! | - | ||||||||||||||||||
| 847 | Closes a D-Bus structure opened with beginStructure(). This function must be called | - | ||||||||||||||||||
| 848 | same number of times that beginStructure() is called. | - | ||||||||||||||||||
| 849 | - | |||||||||||||||||||
| 850 | \sa beginStructure(), endArray(), endMap() | - | ||||||||||||||||||
| 851 | */ | - | ||||||||||||||||||
| 852 | void QDBusArgument::endStructure() | - | ||||||||||||||||||
| 853 | { | - | ||||||||||||||||||
| 854 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-1412 | ||||||||||||||||||
| 855 | d = d->marshaller()->endStructure(); executed 1412 times by 24 tests: d = d->marshaller()->endStructure();Executed by:
| 1412 | ||||||||||||||||||
| 856 | } executed 1412 times by 24 tests: end of blockExecuted by:
| 1412 | ||||||||||||||||||
| 857 | - | |||||||||||||||||||
| 858 | /*! | - | ||||||||||||||||||
| 859 | Opens a new D-Bus array suitable for appending elements of meta-type \a id. | - | ||||||||||||||||||
| 860 | - | |||||||||||||||||||
| 861 | This function is used usually in \c{operator<<} streaming | - | ||||||||||||||||||
| 862 | operators, as in the following example: | - | ||||||||||||||||||
| 863 | - | |||||||||||||||||||
| 864 | \snippet code/src_qdbus_qdbusargument.cpp 6 | - | ||||||||||||||||||
| 865 | - | |||||||||||||||||||
| 866 | If the type you want to marshall is a QList, QVector or any of the | - | ||||||||||||||||||
| 867 | Qt's \l {Container Classes} that take one template parameter, | - | ||||||||||||||||||
| 868 | you need not declare an \c{operator<<} function for it, since | - | ||||||||||||||||||
| 869 | Qt D-Bus provides generic templates to do the job of marshalling | - | ||||||||||||||||||
| 870 | the data. The same applies for STL's sequence containers, such | - | ||||||||||||||||||
| 871 | as \c {std::list}, \c {std::vector}, etc. | - | ||||||||||||||||||
| 872 | - | |||||||||||||||||||
| 873 | \sa endArray(), beginStructure(), beginMap() | - | ||||||||||||||||||
| 874 | */ | - | ||||||||||||||||||
| 875 | void QDBusArgument::beginArray(int id) | - | ||||||||||||||||||
| 876 | { | - | ||||||||||||||||||
| 877 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-871 | ||||||||||||||||||
| 878 | d = d->marshaller()->beginArray(id); executed 871 times by 25 tests: d = d->marshaller()->beginArray(id);Executed by:
| 871 | ||||||||||||||||||
| 879 | } executed 871 times by 25 tests: end of blockExecuted by:
| 871 | ||||||||||||||||||
| 880 | - | |||||||||||||||||||
| 881 | /*! | - | ||||||||||||||||||
| 882 | Closes a D-Bus array opened with beginArray(). This function must be called | - | ||||||||||||||||||
| 883 | same number of times that beginArray() is called. | - | ||||||||||||||||||
| 884 | - | |||||||||||||||||||
| 885 | \sa beginArray(), endStructure(), endMap() | - | ||||||||||||||||||
| 886 | */ | - | ||||||||||||||||||
| 887 | void QDBusArgument::endArray() | - | ||||||||||||||||||
| 888 | { | - | ||||||||||||||||||
| 889 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-871 | ||||||||||||||||||
| 890 | d = d->marshaller()->endArray(); executed 871 times by 25 tests: d = d->marshaller()->endArray();Executed by:
| 871 | ||||||||||||||||||
| 891 | } executed 871 times by 25 tests: end of blockExecuted by:
| 871 | ||||||||||||||||||
| 892 | - | |||||||||||||||||||
| 893 | /*! | - | ||||||||||||||||||
| 894 | Opens a new D-Bus map suitable for | - | ||||||||||||||||||
| 895 | appending elements. Maps are containers that associate one entry | - | ||||||||||||||||||
| 896 | (the key) to another (the value), such as Qt's QMap or QHash. The | - | ||||||||||||||||||
| 897 | ids of the map's key and value meta types must be passed in \a kid | - | ||||||||||||||||||
| 898 | and \a vid respectively. | - | ||||||||||||||||||
| 899 | - | |||||||||||||||||||
| 900 | This function is used usually in \c{operator<<} streaming | - | ||||||||||||||||||
| 901 | operators, as in the following example: | - | ||||||||||||||||||
| 902 | - | |||||||||||||||||||
| 903 | \snippet code/src_qdbus_qdbusargument.cpp 7 | - | ||||||||||||||||||
| 904 | - | |||||||||||||||||||
| 905 | If the type you want to marshall is a QMap or QHash, you need not | - | ||||||||||||||||||
| 906 | declare an \c{operator<<} function for it, since Qt D-Bus provides | - | ||||||||||||||||||
| 907 | generic templates to do the job of marshalling the data. | - | ||||||||||||||||||
| 908 | - | |||||||||||||||||||
| 909 | \sa endMap(), beginStructure(), beginArray(), beginMapEntry() | - | ||||||||||||||||||
| 910 | */ | - | ||||||||||||||||||
| 911 | void QDBusArgument::beginMap(int kid, int vid) | - | ||||||||||||||||||
| 912 | { | - | ||||||||||||||||||
| 913 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-245 | ||||||||||||||||||
| 914 | d = d->marshaller()->beginMap(kid, vid); executed 245 times by 30 tests: d = d->marshaller()->beginMap(kid, vid);Executed by:
| 245 | ||||||||||||||||||
| 915 | } executed 245 times by 30 tests: end of blockExecuted by:
| 245 | ||||||||||||||||||
| 916 | - | |||||||||||||||||||
| 917 | /*! | - | ||||||||||||||||||
| 918 | Closes a D-Bus map opened with beginMap(). This function must be called | - | ||||||||||||||||||
| 919 | same number of times that beginMap() is called. | - | ||||||||||||||||||
| 920 | - | |||||||||||||||||||
| 921 | \sa beginMap(), endStructure(), endArray() | - | ||||||||||||||||||
| 922 | */ | - | ||||||||||||||||||
| 923 | void QDBusArgument::endMap() | - | ||||||||||||||||||
| 924 | { | - | ||||||||||||||||||
| 925 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-245 | ||||||||||||||||||
| 926 | d = d->marshaller()->endMap(); executed 245 times by 30 tests: d = d->marshaller()->endMap();Executed by:
| 245 | ||||||||||||||||||
| 927 | } executed 245 times by 30 tests: end of blockExecuted by:
| 245 | ||||||||||||||||||
| 928 | - | |||||||||||||||||||
| 929 | /*! | - | ||||||||||||||||||
| 930 | Opens a D-Bus map entry suitable for | - | ||||||||||||||||||
| 931 | appending the key and value entries. This function is only valid | - | ||||||||||||||||||
| 932 | when a map has been opened with beginMap(). | - | ||||||||||||||||||
| 933 | - | |||||||||||||||||||
| 934 | See beginMap() for an example of usage of this function. | - | ||||||||||||||||||
| 935 | - | |||||||||||||||||||
| 936 | \sa endMapEntry(), beginMap() | - | ||||||||||||||||||
| 937 | */ | - | ||||||||||||||||||
| 938 | void QDBusArgument::beginMapEntry() | - | ||||||||||||||||||
| 939 | { | - | ||||||||||||||||||
| 940 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-162 | ||||||||||||||||||
| 941 | d = d->marshaller()->beginMapEntry(); executed 162 times by 6 tests: d = d->marshaller()->beginMapEntry();Executed by:
| 162 | ||||||||||||||||||
| 942 | } executed 162 times by 6 tests: end of blockExecuted by:
| 162 | ||||||||||||||||||
| 943 | - | |||||||||||||||||||
| 944 | /*! | - | ||||||||||||||||||
| 945 | Closes a D-Bus map entry opened with beginMapEntry(). This function must be called | - | ||||||||||||||||||
| 946 | same number of times that beginMapEntry() is called. | - | ||||||||||||||||||
| 947 | - | |||||||||||||||||||
| 948 | \sa beginMapEntry() | - | ||||||||||||||||||
| 949 | */ | - | ||||||||||||||||||
| 950 | void QDBusArgument::endMapEntry() | - | ||||||||||||||||||
| 951 | { | - | ||||||||||||||||||
| 952 | if (QDBusArgumentPrivate::checkWrite(d))
| 0-162 | ||||||||||||||||||
| 953 | d = d->marshaller()->endMapEntry(); executed 162 times by 6 tests: d = d->marshaller()->endMapEntry();Executed by:
| 162 | ||||||||||||||||||
| 954 | } executed 162 times by 6 tests: end of blockExecuted by:
| 162 | ||||||||||||||||||
| 955 | - | |||||||||||||||||||
| 956 | /*! | - | ||||||||||||||||||
| 957 | Opens a D-Bus structure suitable for extracting elements. | - | ||||||||||||||||||
| 958 | - | |||||||||||||||||||
| 959 | This function is used usually in \c{operator>>} streaming | - | ||||||||||||||||||
| 960 | operators, as in the following example: | - | ||||||||||||||||||
| 961 | - | |||||||||||||||||||
| 962 | \snippet code/src_qdbus_qdbusargument.cpp 8 | - | ||||||||||||||||||
| 963 | - | |||||||||||||||||||
| 964 | \sa endStructure(), beginArray(), beginMap() | - | ||||||||||||||||||
| 965 | */ | - | ||||||||||||||||||
| 966 | void QDBusArgument::beginStructure() const | - | ||||||||||||||||||
| 967 | { | - | ||||||||||||||||||
| 968 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-371 | ||||||||||||||||||
| 969 | d = d->demarshaller()->beginStructure(); executed 371 times by 5 tests: d = d->demarshaller()->beginStructure();Executed by:
| 371 | ||||||||||||||||||
| 970 | } executed 371 times by 5 tests: end of blockExecuted by:
| 371 | ||||||||||||||||||
| 971 | - | |||||||||||||||||||
| 972 | /*! | - | ||||||||||||||||||
| 973 | Closes the D-Bus structure and allow extracting of the next element | - | ||||||||||||||||||
| 974 | after the structure. | - | ||||||||||||||||||
| 975 | - | |||||||||||||||||||
| 976 | \sa beginStructure() | - | ||||||||||||||||||
| 977 | */ | - | ||||||||||||||||||
| 978 | void QDBusArgument::endStructure() const | - | ||||||||||||||||||
| 979 | { | - | ||||||||||||||||||
| 980 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-371 | ||||||||||||||||||
| 981 | d = d->demarshaller()->endStructure(); executed 371 times by 5 tests: d = d->demarshaller()->endStructure();Executed by:
| 371 | ||||||||||||||||||
| 982 | } executed 371 times by 5 tests: end of blockExecuted by:
| 371 | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | /*! | - | ||||||||||||||||||
| 985 | Recurses into the D-Bus array to allow extraction of | - | ||||||||||||||||||
| 986 | the array elements. | - | ||||||||||||||||||
| 987 | - | |||||||||||||||||||
| 988 | This function is used usually in \c{operator>>} streaming | - | ||||||||||||||||||
| 989 | operators, as in the following example: | - | ||||||||||||||||||
| 990 | - | |||||||||||||||||||
| 991 | \snippet code/src_qdbus_qdbusargument.cpp 9 | - | ||||||||||||||||||
| 992 | - | |||||||||||||||||||
| 993 | If the type you want to demarshall is a QList, QVector or any of the | - | ||||||||||||||||||
| 994 | Qt's \l {Container Classes} that take one template parameter, you | - | ||||||||||||||||||
| 995 | need not declare an \c{operator>>} function for it, since Qt D-Bus | - | ||||||||||||||||||
| 996 | provides generic templates to do the job of demarshalling the data. | - | ||||||||||||||||||
| 997 | The same applies for STL's sequence containers, such as \c {std::list}, | - | ||||||||||||||||||
| 998 | \c {std::vector}, etc. | - | ||||||||||||||||||
| 999 | - | |||||||||||||||||||
| 1000 | \sa atEnd(), beginStructure(), beginMap() | - | ||||||||||||||||||
| 1001 | */ | - | ||||||||||||||||||
| 1002 | void QDBusArgument::beginArray() const | - | ||||||||||||||||||
| 1003 | { | - | ||||||||||||||||||
| 1004 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-339 | ||||||||||||||||||
| 1005 | d = d->demarshaller()->beginArray(); executed 339 times by 22 tests: d = d->demarshaller()->beginArray();Executed by:
| 339 | ||||||||||||||||||
| 1006 | } executed 339 times by 22 tests: end of blockExecuted by:
| 339 | ||||||||||||||||||
| 1007 | - | |||||||||||||||||||
| 1008 | /*! | - | ||||||||||||||||||
| 1009 | Closes the D-Bus array and allow extracting of the next element | - | ||||||||||||||||||
| 1010 | after the array. | - | ||||||||||||||||||
| 1011 | - | |||||||||||||||||||
| 1012 | \sa beginArray() | - | ||||||||||||||||||
| 1013 | */ | - | ||||||||||||||||||
| 1014 | void QDBusArgument::endArray() const | - | ||||||||||||||||||
| 1015 | { | - | ||||||||||||||||||
| 1016 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-339 | ||||||||||||||||||
| 1017 | d = d->demarshaller()->endArray(); executed 339 times by 22 tests: d = d->demarshaller()->endArray();Executed by:
| 339 | ||||||||||||||||||
| 1018 | } executed 339 times by 22 tests: end of blockExecuted by:
| 339 | ||||||||||||||||||
| 1019 | - | |||||||||||||||||||
| 1020 | /*! | - | ||||||||||||||||||
| 1021 | Recurses into the D-Bus map to allow extraction of | - | ||||||||||||||||||
| 1022 | the map's elements. | - | ||||||||||||||||||
| 1023 | - | |||||||||||||||||||
| 1024 | This function is used usually in \c{operator>>} streaming | - | ||||||||||||||||||
| 1025 | operators, as in the following example: | - | ||||||||||||||||||
| 1026 | - | |||||||||||||||||||
| 1027 | \snippet code/src_qdbus_qdbusargument.cpp 10 | - | ||||||||||||||||||
| 1028 | - | |||||||||||||||||||
| 1029 | If the type you want to demarshall is a QMap or QHash, you need not | - | ||||||||||||||||||
| 1030 | declare an \c{operator>>} function for it, since Qt D-Bus provides | - | ||||||||||||||||||
| 1031 | generic templates to do the job of demarshalling the data. | - | ||||||||||||||||||
| 1032 | - | |||||||||||||||||||
| 1033 | \sa endMap(), beginStructure(), beginArray(), beginMapEntry() | - | ||||||||||||||||||
| 1034 | */ | - | ||||||||||||||||||
| 1035 | void QDBusArgument::beginMap() const | - | ||||||||||||||||||
| 1036 | { | - | ||||||||||||||||||
| 1037 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-274 | ||||||||||||||||||
| 1038 | d = d->demarshaller()->beginMap(); executed 274 times by 21 tests: d = d->demarshaller()->beginMap();Executed by:
| 274 | ||||||||||||||||||
| 1039 | } executed 274 times by 21 tests: end of blockExecuted by:
| 274 | ||||||||||||||||||
| 1040 | - | |||||||||||||||||||
| 1041 | /*! | - | ||||||||||||||||||
| 1042 | Closes the D-Bus map and allow extracting of the next element | - | ||||||||||||||||||
| 1043 | after the map. | - | ||||||||||||||||||
| 1044 | - | |||||||||||||||||||
| 1045 | \sa beginMap() | - | ||||||||||||||||||
| 1046 | */ | - | ||||||||||||||||||
| 1047 | void QDBusArgument::endMap() const | - | ||||||||||||||||||
| 1048 | { | - | ||||||||||||||||||
| 1049 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-274 | ||||||||||||||||||
| 1050 | d = d->demarshaller()->endMap(); executed 274 times by 21 tests: d = d->demarshaller()->endMap();Executed by:
| 274 | ||||||||||||||||||
| 1051 | } executed 274 times by 21 tests: end of blockExecuted by:
| 274 | ||||||||||||||||||
| 1052 | - | |||||||||||||||||||
| 1053 | /*! | - | ||||||||||||||||||
| 1054 | Recurses into the D-Bus map entry to allow extraction | - | ||||||||||||||||||
| 1055 | of the key and value pair. | - | ||||||||||||||||||
| 1056 | - | |||||||||||||||||||
| 1057 | See beginMap() for an example of how this function is usually used. | - | ||||||||||||||||||
| 1058 | - | |||||||||||||||||||
| 1059 | \sa endMapEntry(), beginMap() | - | ||||||||||||||||||
| 1060 | */ | - | ||||||||||||||||||
| 1061 | void QDBusArgument::beginMapEntry() const | - | ||||||||||||||||||
| 1062 | { | - | ||||||||||||||||||
| 1063 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-2678 | ||||||||||||||||||
| 1064 | d = d->demarshaller()->beginMapEntry(); executed 2678 times by 21 tests: d = d->demarshaller()->beginMapEntry();Executed by:
| 2678 | ||||||||||||||||||
| 1065 | } executed 2678 times by 21 tests: end of blockExecuted by:
| 2678 | ||||||||||||||||||
| 1066 | - | |||||||||||||||||||
| 1067 | /*! | - | ||||||||||||||||||
| 1068 | Closes the D-Bus map entry and allow extracting of the next element | - | ||||||||||||||||||
| 1069 | on the map. | - | ||||||||||||||||||
| 1070 | - | |||||||||||||||||||
| 1071 | \sa beginMapEntry() | - | ||||||||||||||||||
| 1072 | */ | - | ||||||||||||||||||
| 1073 | void QDBusArgument::endMapEntry() const | - | ||||||||||||||||||
| 1074 | { | - | ||||||||||||||||||
| 1075 | if (QDBusArgumentPrivate::checkReadAndDetach(d))
| 0-2678 | ||||||||||||||||||
| 1076 | d = d->demarshaller()->endMapEntry(); executed 2678 times by 21 tests: d = d->demarshaller()->endMapEntry();Executed by:
| 2678 | ||||||||||||||||||
| 1077 | } executed 2678 times by 21 tests: end of blockExecuted by:
| 2678 | ||||||||||||||||||
| 1078 | - | |||||||||||||||||||
| 1079 | /*! | - | ||||||||||||||||||
| 1080 | Returns \c true if there are no more elements to be extracted from | - | ||||||||||||||||||
| 1081 | this QDBusArgument. This function is usually used in QDBusArgument | - | ||||||||||||||||||
| 1082 | objects returned from beginMap() and beginArray(). | - | ||||||||||||||||||
| 1083 | */ | - | ||||||||||||||||||
| 1084 | bool QDBusArgument::atEnd() const | - | ||||||||||||||||||
| 1085 | { | - | ||||||||||||||||||
| 1086 | if (QDBusArgumentPrivate::checkRead(d))
| 0-4482 | ||||||||||||||||||
| 1087 | return d->demarshaller()->atEnd(); executed 4482 times by 23 tests: return d->demarshaller()->atEnd();Executed by:
| 4482 | ||||||||||||||||||
| 1088 | - | |||||||||||||||||||
| 1089 | return true; // at least, stop reading never executed: return true; | 0 | ||||||||||||||||||
| 1090 | } | - | ||||||||||||||||||
| 1091 | - | |||||||||||||||||||
| 1092 | /*! | - | ||||||||||||||||||
| 1093 | \since 4.5 | - | ||||||||||||||||||
| 1094 | - | |||||||||||||||||||
| 1095 | Returns the current argument in the form of a QVariant. Basic | - | ||||||||||||||||||
| 1096 | types will be decoded and returned in the QVariant, but for | - | ||||||||||||||||||
| 1097 | complex types, this function will return a QDBusArgument object in | - | ||||||||||||||||||
| 1098 | the QVariant. It is the caller's responsibility to decode the | - | ||||||||||||||||||
| 1099 | argument (for example, by calling asVariant() in it). | - | ||||||||||||||||||
| 1100 | - | |||||||||||||||||||
| 1101 | For example, if the current argument is an INT32, this function | - | ||||||||||||||||||
| 1102 | will return a QVariant with an argument of type QVariant::Int. For | - | ||||||||||||||||||
| 1103 | an array of INT32, it will return a QVariant containing a | - | ||||||||||||||||||
| 1104 | QDBusArgument. | - | ||||||||||||||||||
| 1105 | - | |||||||||||||||||||
| 1106 | If an error occurs or if there are no more arguments to decode | - | ||||||||||||||||||
| 1107 | (i.e., we are at the end of the argument list), this function will | - | ||||||||||||||||||
| 1108 | return an invalid QVariant. | - | ||||||||||||||||||
| 1109 | - | |||||||||||||||||||
| 1110 | \sa atEnd() | - | ||||||||||||||||||
| 1111 | */ | - | ||||||||||||||||||
| 1112 | QVariant QDBusArgument::asVariant() const | - | ||||||||||||||||||
| 1113 | { | - | ||||||||||||||||||
| 1114 | if (QDBusArgumentPrivate::checkRead(d))
| 0-450 | ||||||||||||||||||
| 1115 | return d->demarshaller()->toVariantInternal(); executed 450 times by 1 test: return d->demarshaller()->toVariantInternal();Executed by:
| 450 | ||||||||||||||||||
| 1116 | - | |||||||||||||||||||
| 1117 | return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||
| 1118 | } | - | ||||||||||||||||||
| 1119 | - | |||||||||||||||||||
| 1120 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 1121 | - | |||||||||||||||||||
| 1122 | // for optimization purposes, we include the marshallers here | - | ||||||||||||||||||
| 1123 | #include "qdbusmarshaller.cpp" | - | ||||||||||||||||||
| 1124 | #include "qdbusdemarshaller.cpp" | - | ||||||||||||||||||
| 1125 | - | |||||||||||||||||||
| 1126 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 1127 | - | |||||||||||||||||||
| 1128 | // QDBusArgument operators | - | ||||||||||||||||||
| 1129 | - | |||||||||||||||||||
| 1130 | const QDBusArgument &operator>>(const QDBusArgument &a, QVariant &v) | - | ||||||||||||||||||
| 1131 | { | - | ||||||||||||||||||
| 1132 | QDBusVariant dbv; | - | ||||||||||||||||||
| 1133 | a >> dbv; | - | ||||||||||||||||||
| 1134 | v = dbv.variant(); | - | ||||||||||||||||||
| 1135 | return a; executed 2520 times by 22 tests: return a;Executed by:
| 2520 | ||||||||||||||||||
| 1136 | } | - | ||||||||||||||||||
| 1137 | - | |||||||||||||||||||
| 1138 | // QVariant types | - | ||||||||||||||||||
| 1139 | #ifndef QDBUS_NO_SPECIALTYPES | - | ||||||||||||||||||
| 1140 | const QDBusArgument &operator>>(const QDBusArgument &a, QDate &date) | - | ||||||||||||||||||
| 1141 | { | - | ||||||||||||||||||
| 1142 | int y, m, d; | - | ||||||||||||||||||
| 1143 | a.beginStructure(); | - | ||||||||||||||||||
| 1144 | a >> y >> m >> d; | - | ||||||||||||||||||
| 1145 | a.endStructure(); | - | ||||||||||||||||||
| 1146 | - | |||||||||||||||||||
| 1147 | if (y != 0 && m != 0 && d != 0)
| 0-13 | ||||||||||||||||||
| 1148 | date.setDate(y, m, d); executed 13 times by 2 tests: date.setDate(y, m, d);Executed by:
| 13 | ||||||||||||||||||
| 1149 | else | - | ||||||||||||||||||
| 1150 | date = QDate(); executed 8 times by 2 tests: date = QDate();Executed by:
| 8 | ||||||||||||||||||
| 1151 | return a; executed 21 times by 2 tests: return a;Executed by:
| 21 | ||||||||||||||||||
| 1152 | } | - | ||||||||||||||||||
| 1153 | - | |||||||||||||||||||
| 1154 | QDBusArgument &operator<<(QDBusArgument &a, const QDate &date) | - | ||||||||||||||||||
| 1155 | { | - | ||||||||||||||||||
| 1156 | a.beginStructure(); | - | ||||||||||||||||||
| 1157 | if (date.isValid())
| 13-121 | ||||||||||||||||||
| 1158 | a << date.year() << date.month() << date.day(); executed 13 times by 2 tests: a << date.year() << date.month() << date.day();Executed by:
| 13 | ||||||||||||||||||
| 1159 | else | - | ||||||||||||||||||
| 1160 | a << 0 << 0 << 0; executed 121 times by 4 tests: a << 0 << 0 << 0;Executed by:
| 121 | ||||||||||||||||||
| 1161 | a.endStructure(); | - | ||||||||||||||||||
| 1162 | return a; executed 134 times by 4 tests: return a;Executed by:
| 134 | ||||||||||||||||||
| 1163 | } | - | ||||||||||||||||||
| 1164 | - | |||||||||||||||||||
| 1165 | const QDBusArgument &operator>>(const QDBusArgument &a, QTime &time) | - | ||||||||||||||||||
| 1166 | { | - | ||||||||||||||||||
| 1167 | int h, m, s, ms; | - | ||||||||||||||||||
| 1168 | a.beginStructure(); | - | ||||||||||||||||||
| 1169 | a >> h >> m >> s >> ms; | - | ||||||||||||||||||
| 1170 | a.endStructure(); | - | ||||||||||||||||||
| 1171 | - | |||||||||||||||||||
| 1172 | if (h < 0)
| 7-14 | ||||||||||||||||||
| 1173 | time = QTime(); executed 7 times by 2 tests: time = QTime();Executed by:
| 7 | ||||||||||||||||||
| 1174 | else | - | ||||||||||||||||||
| 1175 | time.setHMS(h, m, s, ms); executed 14 times by 2 tests: time.setHMS(h, m, s, ms);Executed by:
| 14 | ||||||||||||||||||
| 1176 | return a; executed 21 times by 2 tests: return a;Executed by:
| 21 | ||||||||||||||||||
| 1177 | } | - | ||||||||||||||||||
| 1178 | - | |||||||||||||||||||
| 1179 | QDBusArgument &operator<<(QDBusArgument &a, const QTime &time) | - | ||||||||||||||||||
| 1180 | { | - | ||||||||||||||||||
| 1181 | a.beginStructure(); | - | ||||||||||||||||||
| 1182 | if (time.isValid())
| 14-120 | ||||||||||||||||||
| 1183 | a << time.hour() << time.minute() << time.second() << time.msec(); executed 14 times by 2 tests: a << time.hour() << time.minute() << time.second() << time.msec();Executed by:
| 14 | ||||||||||||||||||
| 1184 | else | - | ||||||||||||||||||
| 1185 | a << -1 << -1 << -1 << -1; executed 120 times by 4 tests: a << -1 << -1 << -1 << -1;Executed by:
| 120 | ||||||||||||||||||
| 1186 | a.endStructure(); | - | ||||||||||||||||||
| 1187 | return a; executed 134 times by 4 tests: return a;Executed by:
| 134 | ||||||||||||||||||
| 1188 | } | - | ||||||||||||||||||
| 1189 | - | |||||||||||||||||||
| 1190 | const QDBusArgument &operator>>(const QDBusArgument &a, QDateTime &dt) | - | ||||||||||||||||||
| 1191 | { | - | ||||||||||||||||||
| 1192 | QDate date; | - | ||||||||||||||||||
| 1193 | QTime time; | - | ||||||||||||||||||
| 1194 | int timespec; | - | ||||||||||||||||||
| 1195 | - | |||||||||||||||||||
| 1196 | a.beginStructure(); | - | ||||||||||||||||||
| 1197 | a >> date >> time >> timespec; | - | ||||||||||||||||||
| 1198 | a.endStructure(); | - | ||||||||||||||||||
| 1199 | - | |||||||||||||||||||
| 1200 | dt = QDateTime(date, time, Qt::TimeSpec(timespec)); | - | ||||||||||||||||||
| 1201 | return a; executed 19 times by 2 tests: return a;Executed by:
| 19 | ||||||||||||||||||
| 1202 | } | - | ||||||||||||||||||
| 1203 | - | |||||||||||||||||||
| 1204 | QDBusArgument &operator<<(QDBusArgument &a, const QDateTime &dt) | - | ||||||||||||||||||
| 1205 | { | - | ||||||||||||||||||
| 1206 | a.beginStructure(); | - | ||||||||||||||||||
| 1207 | a << dt.date() << dt.time() << int(dt.timeSpec()); | - | ||||||||||||||||||
| 1208 | a.endStructure(); | - | ||||||||||||||||||
| 1209 | return a; executed 76 times by 4 tests: return a;Executed by:
| 76 | ||||||||||||||||||
| 1210 | } | - | ||||||||||||||||||
| 1211 | - | |||||||||||||||||||
| 1212 | const QDBusArgument &operator>>(const QDBusArgument &a, QRect &rect) | - | ||||||||||||||||||
| 1213 | { | - | ||||||||||||||||||
| 1214 | int x, y, width, height; | - | ||||||||||||||||||
| 1215 | a.beginStructure(); | - | ||||||||||||||||||
| 1216 | a >> x >> y >> width >> height; | - | ||||||||||||||||||
| 1217 | a.endStructure(); | - | ||||||||||||||||||
| 1218 | - | |||||||||||||||||||
| 1219 | rect.setRect(x, y, width, height); | - | ||||||||||||||||||
| 1220 | return a; executed 1 time by 1 test: return a;Executed by:
| 1 | ||||||||||||||||||
| 1221 | } | - | ||||||||||||||||||
| 1222 | - | |||||||||||||||||||
| 1223 | QDBusArgument &operator<<(QDBusArgument &a, const QRect &rect) | - | ||||||||||||||||||
| 1224 | { | - | ||||||||||||||||||
| 1225 | a.beginStructure(); | - | ||||||||||||||||||
| 1226 | a << rect.x() << rect.y() << rect.width() << rect.height(); | - | ||||||||||||||||||
| 1227 | a.endStructure(); | - | ||||||||||||||||||
| 1228 | - | |||||||||||||||||||
| 1229 | return a; executed 57 times by 3 tests: return a;Executed by:
| 57 | ||||||||||||||||||
| 1230 | } | - | ||||||||||||||||||
| 1231 | - | |||||||||||||||||||
| 1232 | const QDBusArgument &operator>>(const QDBusArgument &a, QRectF &rect) | - | ||||||||||||||||||
| 1233 | { | - | ||||||||||||||||||
| 1234 | double x, y, width, height; | - | ||||||||||||||||||
| 1235 | a.beginStructure(); | - | ||||||||||||||||||
| 1236 | a >> x >> y >> width >> height; | - | ||||||||||||||||||
| 1237 | a.endStructure(); | - | ||||||||||||||||||
| 1238 | - | |||||||||||||||||||
| 1239 | rect.setRect(qreal(x), qreal(y), qreal(width), qreal(height)); | - | ||||||||||||||||||
| 1240 | return a; executed 1 time by 1 test: return a;Executed by:
| 1 | ||||||||||||||||||
| 1241 | } | - | ||||||||||||||||||
| 1242 | - | |||||||||||||||||||
| 1243 | QDBusArgument &operator<<(QDBusArgument &a, const QRectF &rect) | - | ||||||||||||||||||
| 1244 | { | - | ||||||||||||||||||
| 1245 | a.beginStructure(); | - | ||||||||||||||||||
| 1246 | a << double(rect.x()) << double(rect.y()) << double(rect.width()) << double(rect.height()); | - | ||||||||||||||||||
| 1247 | a.endStructure(); | - | ||||||||||||||||||
| 1248 | - | |||||||||||||||||||
| 1249 | return a; executed 57 times by 3 tests: return a;Executed by:
| 57 | ||||||||||||||||||
| 1250 | } | - | ||||||||||||||||||
| 1251 | - | |||||||||||||||||||
| 1252 | const QDBusArgument &operator>>(const QDBusArgument &a, QSize &size) | - | ||||||||||||||||||
| 1253 | { | - | ||||||||||||||||||
| 1254 | a.beginStructure(); | - | ||||||||||||||||||
| 1255 | a >> size.rwidth() >> size.rheight(); | - | ||||||||||||||||||
| 1256 | a.endStructure(); | - | ||||||||||||||||||
| 1257 | - | |||||||||||||||||||
| 1258 | return a; executed 1 time by 1 test: return a;Executed by:
| 1 | ||||||||||||||||||
| 1259 | } | - | ||||||||||||||||||
| 1260 | - | |||||||||||||||||||
| 1261 | QDBusArgument &operator<<(QDBusArgument &a, const QSize &size) | - | ||||||||||||||||||
| 1262 | { | - | ||||||||||||||||||
| 1263 | a.beginStructure(); | - | ||||||||||||||||||
| 1264 | a << size.width() << size.height(); | - | ||||||||||||||||||
| 1265 | a.endStructure(); | - | ||||||||||||||||||
| 1266 | - | |||||||||||||||||||
| 1267 | return a; executed 57 times by 3 tests: return a;Executed by:
| 57 | ||||||||||||||||||
| 1268 | } | - | ||||||||||||||||||
| 1269 | - | |||||||||||||||||||
| 1270 | const QDBusArgument &operator>>(const QDBusArgument &a, QSizeF &size) | - | ||||||||||||||||||
| 1271 | { | - | ||||||||||||||||||
| 1272 | double width, height; | - | ||||||||||||||||||
| 1273 | a.beginStructure(); | - | ||||||||||||||||||
| 1274 | a >> width >> height; | - | ||||||||||||||||||
| 1275 | a.endStructure(); | - | ||||||||||||||||||
| 1276 | - | |||||||||||||||||||
| 1277 | size.setWidth(qreal(width)); | - | ||||||||||||||||||
| 1278 | size.setHeight(qreal(height)); | - | ||||||||||||||||||
| 1279 | return a; executed 1 time by 1 test: return a;Executed by:
| 1 | ||||||||||||||||||
| 1280 | } | - | ||||||||||||||||||
| 1281 | - | |||||||||||||||||||
| 1282 | QDBusArgument &operator<<(QDBusArgument &a, const QSizeF &size) | - | ||||||||||||||||||
| 1283 | { | - | ||||||||||||||||||
| 1284 | a.beginStructure(); | - | ||||||||||||||||||
| 1285 | a << double(size.width()) << double(size.height()); | - | ||||||||||||||||||
| 1286 | a.endStructure(); | - | ||||||||||||||||||
| 1287 | - | |||||||||||||||||||
| 1288 | return a; executed 57 times by 3 tests: return a;Executed by:
| 57 | ||||||||||||||||||
| 1289 | } | - | ||||||||||||||||||
| 1290 | - | |||||||||||||||||||
| 1291 | const QDBusArgument &operator>>(const QDBusArgument &a, QPoint &pt) | - | ||||||||||||||||||
| 1292 | { | - | ||||||||||||||||||
| 1293 | a.beginStructure(); | - | ||||||||||||||||||
| 1294 | a >> pt.rx() >> pt.ry(); | - | ||||||||||||||||||
| 1295 | a.endStructure(); | - | ||||||||||||||||||
| 1296 | - | |||||||||||||||||||
| 1297 | return a; executed 3 times by 1 test: return a;Executed by:
| 3 | ||||||||||||||||||
| 1298 | } | - | ||||||||||||||||||
| 1299 | - | |||||||||||||||||||
| 1300 | QDBusArgument &operator<<(QDBusArgument &a, const QPoint &pt) | - | ||||||||||||||||||
| 1301 | { | - | ||||||||||||||||||
| 1302 | a.beginStructure(); | - | ||||||||||||||||||
| 1303 | a << pt.x() << pt.y(); | - | ||||||||||||||||||
| 1304 | a.endStructure(); | - | ||||||||||||||||||
| 1305 | - | |||||||||||||||||||
| 1306 | return a; executed 171 times by 3 tests: return a;Executed by:
| 171 | ||||||||||||||||||
| 1307 | } | - | ||||||||||||||||||
| 1308 | - | |||||||||||||||||||
| 1309 | const QDBusArgument &operator>>(const QDBusArgument &a, QPointF &pt) | - | ||||||||||||||||||
| 1310 | { | - | ||||||||||||||||||
| 1311 | double x, y; | - | ||||||||||||||||||
| 1312 | a.beginStructure(); | - | ||||||||||||||||||
| 1313 | a >> x >> y; | - | ||||||||||||||||||
| 1314 | a.endStructure(); | - | ||||||||||||||||||
| 1315 | - | |||||||||||||||||||
| 1316 | pt.setX(qreal(x)); | - | ||||||||||||||||||
| 1317 | pt.setY(qreal(y)); | - | ||||||||||||||||||
| 1318 | return a; executed 4 times by 1 test: return a;Executed by:
| 4 | ||||||||||||||||||
| 1319 | } | - | ||||||||||||||||||
| 1320 | - | |||||||||||||||||||
| 1321 | QDBusArgument &operator<<(QDBusArgument &a, const QPointF &pt) | - | ||||||||||||||||||
| 1322 | { | - | ||||||||||||||||||
| 1323 | a.beginStructure(); | - | ||||||||||||||||||
| 1324 | a << double(pt.x()) << double(pt.y()); | - | ||||||||||||||||||
| 1325 | a.endStructure(); | - | ||||||||||||||||||
| 1326 | - | |||||||||||||||||||
| 1327 | return a; executed 172 times by 3 tests: return a;Executed by:
| 172 | ||||||||||||||||||
| 1328 | } | - | ||||||||||||||||||
| 1329 | - | |||||||||||||||||||
| 1330 | const QDBusArgument &operator>>(const QDBusArgument &a, QLine &line) | - | ||||||||||||||||||
| 1331 | { | - | ||||||||||||||||||
| 1332 | QPoint p1, p2; | - | ||||||||||||||||||
| 1333 | a.beginStructure(); | - | ||||||||||||||||||
| 1334 | a >> p1 >> p2; | - | ||||||||||||||||||
| 1335 | a.endStructure(); | - | ||||||||||||||||||
| 1336 | - | |||||||||||||||||||
| 1337 | line = QLine(p1, p2); | - | ||||||||||||||||||
| 1338 | return a; executed 1 time by 1 test: return a;Executed by:
| 1 | ||||||||||||||||||
| 1339 | } | - | ||||||||||||||||||
| 1340 | - | |||||||||||||||||||
| 1341 | QDBusArgument &operator<<(QDBusArgument &a, const QLine &line) | - | ||||||||||||||||||
| 1342 | { | - | ||||||||||||||||||
| 1343 | a.beginStructure(); | - | ||||||||||||||||||
| 1344 | a << line.p1() << line.p2(); | - | ||||||||||||||||||
| 1345 | a.endStructure(); | - | ||||||||||||||||||
| 1346 | - | |||||||||||||||||||
| 1347 | return a; executed 57 times by 3 tests: return a;Executed by:
| 57 | ||||||||||||||||||
| 1348 | } | - | ||||||||||||||||||
| 1349 | - | |||||||||||||||||||
| 1350 | const QDBusArgument &operator>>(const QDBusArgument &a, QLineF &line) | - | ||||||||||||||||||
| 1351 | { | - | ||||||||||||||||||
| 1352 | QPointF p1, p2; | - | ||||||||||||||||||
| 1353 | a.beginStructure(); | - | ||||||||||||||||||
| 1354 | a >> p1 >> p2; | - | ||||||||||||||||||
| 1355 | a.endStructure(); | - | ||||||||||||||||||
| 1356 | - | |||||||||||||||||||
| 1357 | line = QLineF(p1, p2); | - | ||||||||||||||||||
| 1358 | return a; executed 1 time by 1 test: return a;Executed by:
| 1 | ||||||||||||||||||
| 1359 | } | - | ||||||||||||||||||
| 1360 | - | |||||||||||||||||||
| 1361 | QDBusArgument &operator<<(QDBusArgument &a, const QLineF &line) | - | ||||||||||||||||||
| 1362 | { | - | ||||||||||||||||||
| 1363 | a.beginStructure(); | - | ||||||||||||||||||
| 1364 | a << line.p1() << line.p2(); | - | ||||||||||||||||||
| 1365 | a.endStructure(); | - | ||||||||||||||||||
| 1366 | - | |||||||||||||||||||
| 1367 | return a; executed 57 times by 3 tests: return a;Executed by:
| 57 | ||||||||||||||||||
| 1368 | } | - | ||||||||||||||||||
| 1369 | #endif | - | ||||||||||||||||||
| 1370 | - | |||||||||||||||||||
| 1371 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 1372 | - | |||||||||||||||||||
| 1373 | #endif // QT_NO_DBUS | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |