15#include <qstringlist.h>
27QT_IMPL_METATYPE_EXTERN(QDBusArgument)
29QDBusArgumentPrivate::~QDBusArgumentPrivate()
32 q_dbus_message_unref(message);
41 QDBusMarshaller *marshaller =
new QDBusMarshaller;
42 marshaller->ba = &signature;
47 QDBusMetaType::marshall(arg, v.metaType(), v.constData());
51 bool ok = marshaller
->ok;
54 if (signature.isEmpty() || !ok || !QDBusUtil::isValidSingleSignature(QString::fromLatin1(signature))) {
55 qWarning(
"QDBusMarshaller: type '%s' produces invalid D-Bus signature '%s' "
56 "(Did you forget to call beginStructure() ?)",
57 type.name(), signature.isEmpty() ?
"<empty>" : signature.constData());
62 qWarning(
"QDBusMarshaller: type '%s' attempts to redefine basic D-Bus type '%s' (%s) "
63 "(Did you forget to call beginStructure() ?)",
64 type.name(), signature.constData(),
65 QDBusMetaType::signatureToMetaType(signature).name());
75 if (d->direction == Direction::Marshalling) {
79 if (d->message && d->ref.loadRelaxed() != 1) {
80 QDBusMarshaller *dd =
new QDBusMarshaller(d->capabilities);
81 dd->message = q_dbus_message_copy(d->message);
82 q_dbus_message_iter_init_append(dd->message, &dd->iterator);
92 qFatal(
"QDBusArgument: write from a read-only object");
94 qWarning(
"QDBusArgument: write from a read-only object");
103 if (d->direction == Direction::Demarshalling)
107 qFatal(
"QDBusArgument: read from a write-only object");
109 qWarning(
"QDBusArgument: read from a write-only object");
120 if (d->ref.loadRelaxed() == 1)
124 dd->message = q_dbus_message_ref(d->message);
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
237
238
239
240
241
242
243
244
245
246
247
248
249
252
253
254
255
256
257QDBusArgument::QDBusArgument()
259 if (!qdbus_loadLibDBus()) {
264 QDBusMarshaller *dd =
new QDBusMarshaller;
269 q_dbus_message_iter_init_append(dd->message, &dd->iterator);
273
274
275
276
277
278
279QDBusArgument::QDBusArgument(
const QDBusArgument &other)
287
288
289QDBusArgument::QDBusArgument(QDBusArgumentPrivate *dd)
295
296
297
298
299
300
301QDBusArgument &QDBusArgument::operator=(
const QDBusArgument &other)
303 qAtomicAssign(d, other.d);
308
309
310
311QDBusArgument::~QDBusArgument()
313 if (d && !d->ref.deref())
318
319
320QDBusArgument &QDBusArgument::operator<<(uchar arg)
322 if (QDBusArgumentPrivate::checkWrite(d))
323 d->marshaller()->append(arg);
328
329
330
331QDBusArgument &QDBusArgument::operator<<(
bool arg)
333 if (QDBusArgumentPrivate::checkWrite(d))
334 d->marshaller()->append(arg);
339
340
341
342QDBusArgument &QDBusArgument::operator<<(
short arg)
344 if (QDBusArgumentPrivate::checkWrite(d))
345 d->marshaller()->append(arg);
350
351
352
353QDBusArgument &QDBusArgument::operator<<(ushort arg)
355 if (QDBusArgumentPrivate::checkWrite(d))
356 d->marshaller()->append(arg);
361
362
363
364QDBusArgument &QDBusArgument::operator<<(
int arg)
366 if (QDBusArgumentPrivate::checkWrite(d))
367 d->marshaller()->append(arg);
372
373
374
375QDBusArgument &QDBusArgument::operator<<(uint arg)
377 if (QDBusArgumentPrivate::checkWrite(d))
378 d->marshaller()->append(arg);
383
384
385
386QDBusArgument &QDBusArgument::operator<<(qlonglong arg)
388 if (QDBusArgumentPrivate::checkWrite(d))
389 d->marshaller()->append(arg);
394
395
396
397QDBusArgument &QDBusArgument::operator<<(qulonglong arg)
399 if (QDBusArgumentPrivate::checkWrite(d))
400 d->marshaller()->append(arg);
405
406
407
408
409QDBusArgument &QDBusArgument::operator<<(
double arg)
411 if (QDBusArgumentPrivate::checkWrite(d))
412 d->marshaller()->append(arg);
417
418
419
420
421QDBusArgument &QDBusArgument::operator<<(
const QString &arg)
423 if (QDBusArgumentPrivate::checkWrite(d))
424 d->marshaller()->append(arg);
429
430
431
432
433
434QDBusArgument &QDBusArgument::operator<<(
const QDBusObjectPath &arg)
436 if (QDBusArgumentPrivate::checkWrite(d))
437 d->marshaller()->append(arg);
442
443
444
445
446
447QDBusArgument &QDBusArgument::operator<<(
const QDBusSignature &arg)
449 if (QDBusArgumentPrivate::checkWrite(d))
450 d->marshaller()->append(arg);
455
456
457
458
459
460
461QDBusArgument &QDBusArgument::operator<<(
const QDBusUnixFileDescriptor &arg)
463 if (QDBusArgumentPrivate::checkWrite(d))
464 d->marshaller()->append(arg);
469
470
471
472
473
474
475QDBusArgument &QDBusArgument::operator<<(
const QDBusVariant &arg)
477 if (QDBusArgumentPrivate::checkWrite(d))
478 d->marshaller()->append(arg);
483
484
485
486
487
488
489
490
491
492
493QDBusArgument &QDBusArgument::operator<<(
const QStringList &arg)
495 if (QDBusArgumentPrivate::checkWrite(d))
496 d->marshaller()->append(arg);
501
502
503
504
505
506
507
508
509
510
511QDBusArgument &QDBusArgument::operator<<(
const QByteArray &arg)
513 if (QDBusArgumentPrivate::checkWrite(d))
514 d->marshaller()->append(arg);
519
520
521
522
523
524
525
526void QDBusArgument::appendVariant(
const QVariant &v)
528 if (QDBusArgumentPrivate::checkWrite(d))
529 d->marshaller()->appendVariantInternal(v);
533
534
535
536
537QString QDBusArgument::currentSignature()
const
541 if (d->direction == QDBusArgumentPrivate::Direction::Demarshalling)
542 return d->demarshaller()->currentSignature();
544 return d->marshaller()->currentSignature();
548
549
550
551
552
553
554
555
556QDBusArgument::ElementType QDBusArgument::currentType()
const
560 if (d->direction == QDBusArgumentPrivate::Direction::Demarshalling)
561 return d->demarshaller()->currentType();
566
567
568
569const QDBusArgument &QDBusArgument::operator>>(uchar &arg)
const
571 if (QDBusArgumentPrivate::checkReadAndDetach(d))
572 arg = d->demarshaller()->toByte();
579
580
581
582
583const QDBusArgument &QDBusArgument::operator>>(
bool &arg)
const
585 if (QDBusArgumentPrivate::checkReadAndDetach(d))
586 arg = d->demarshaller()->toBool();
593
594
595
596
597const QDBusArgument &QDBusArgument::operator>>(ushort &arg)
const
599 if (QDBusArgumentPrivate::checkReadAndDetach(d))
600 arg = d->demarshaller()->toUShort();
607
608
609
610
611const QDBusArgument &QDBusArgument::operator>>(
short &arg)
const
613 if (QDBusArgumentPrivate::checkReadAndDetach(d))
614 arg = d->demarshaller()->toShort();
621
622
623
624
625const QDBusArgument &QDBusArgument::operator>>(
int &arg)
const
627 if (QDBusArgumentPrivate::checkReadAndDetach(d))
628 arg = d->demarshaller()->toInt();
635
636
637
638
639const QDBusArgument &QDBusArgument::operator>>(uint &arg)
const
641 if (QDBusArgumentPrivate::checkReadAndDetach(d))
642 arg = d->demarshaller()->toUInt();
649
650
651
652
653const QDBusArgument &QDBusArgument::operator>>(qlonglong &arg)
const
655 if (QDBusArgumentPrivate::checkReadAndDetach(d))
656 arg = d->demarshaller()->toLongLong();
663
664
665
666
667const QDBusArgument &QDBusArgument::operator>>(qulonglong &arg)
const
669 if (QDBusArgumentPrivate::checkReadAndDetach(d))
670 arg = d->demarshaller()->toULongLong();
677
678
679
680
681const QDBusArgument &QDBusArgument::operator>>(
double &arg)
const
683 if (QDBusArgumentPrivate::checkReadAndDetach(d))
684 arg = d->demarshaller()->toDouble();
691
692
693
694
695const QDBusArgument &QDBusArgument::operator>>(QString &arg)
const
697 if (QDBusArgumentPrivate::checkReadAndDetach(d))
698 arg = d->demarshaller()->toString();
703
704
705
706
707
708const QDBusArgument &QDBusArgument::operator>>(QDBusObjectPath &arg)
const
710 if (QDBusArgumentPrivate::checkReadAndDetach(d))
711 arg = d->demarshaller()->toObjectPath();
716
717
718
719
720
721const QDBusArgument &QDBusArgument::operator>>(QDBusSignature &arg)
const
723 if (QDBusArgumentPrivate::checkReadAndDetach(d))
724 arg = d->demarshaller()->toSignature();
729
730
731
732
733
734
735const QDBusArgument &QDBusArgument::operator>>(QDBusUnixFileDescriptor &arg)
const
737 if (QDBusArgumentPrivate::checkReadAndDetach(d))
738 arg = d->demarshaller()->toUnixFileDescriptor();
743
744
745
746
747
748
749
750
751
752
753
754
755const QDBusArgument &QDBusArgument::operator>>(QDBusVariant &arg)
const
757 if (QDBusArgumentPrivate::checkReadAndDetach(d))
758 arg = d->demarshaller()->toVariant();
763
764
765
766
767
768
769
770
771
772
773const QDBusArgument &QDBusArgument::operator>>(QStringList &arg)
const
775 if (QDBusArgumentPrivate::checkReadAndDetach(d))
776 arg = d->demarshaller()->toStringList();
781
782
783
784
785
786
787
788
789
790
791const QDBusArgument &QDBusArgument::operator>>(QByteArray &arg)
const
793 if (QDBusArgumentPrivate::checkReadAndDetach(d))
794 arg = d->demarshaller()->toByteArray();
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813void QDBusArgument::beginStructure()
815 if (QDBusArgumentPrivate::checkWrite(d))
816 d = d->marshaller()->beginStructure();
820
821
822
823
824
825void QDBusArgument::endStructure()
827 if (QDBusArgumentPrivate::checkWrite(d))
828 d = d->marshaller()->endStructure();
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848void QDBusArgument::beginArray(QMetaType id)
850 if (QDBusArgumentPrivate::checkWrite(d))
851 d = d->marshaller()->beginArray(id);
855
856
857
858
859
860void QDBusArgument::endArray()
862 if (QDBusArgumentPrivate::checkWrite(d))
863 d = d->marshaller()->endArray();
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885void QDBusArgument::beginMap(QMetaType keyMetaType, QMetaType valueMetaType)
887 if (QDBusArgumentPrivate::checkWrite(d))
888 d = d->marshaller()->beginMap(keyMetaType, valueMetaType);
892
893
894
895
896
897void QDBusArgument::endMap()
899 if (QDBusArgumentPrivate::checkWrite(d))
900 d = d->marshaller()->endMap();
904
905
906
907
908
909
910
911
912void QDBusArgument::beginMapEntry()
914 if (QDBusArgumentPrivate::checkWrite(d))
915 d = d->marshaller()->beginMapEntry();
919
920
921
922
923
924void QDBusArgument::endMapEntry()
926 if (QDBusArgumentPrivate::checkWrite(d))
927 d = d->marshaller()->endMapEntry();
931
932
933
934
935
936
937
938
939
940void QDBusArgument::beginStructure()
const
942 if (QDBusArgumentPrivate::checkReadAndDetach(d))
943 d = d->demarshaller()->beginStructure();
947
948
949
950
951
952void QDBusArgument::endStructure()
const
954 if (QDBusArgumentPrivate::checkReadAndDetach(d))
955 d = d->demarshaller()->endStructure();
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976void QDBusArgument::beginArray()
const
978 if (QDBusArgumentPrivate::checkReadAndDetach(d))
979 d = d->demarshaller()->beginArray();
983
984
985
986
987
988void QDBusArgument::endArray()
const
990 if (QDBusArgumentPrivate::checkReadAndDetach(d))
991 d = d->demarshaller()->endArray();
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009void QDBusArgument::beginMap()
const
1011 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1012 d = d->demarshaller()->beginMap();
1016
1017
1018
1019
1020
1021void QDBusArgument::endMap()
const
1023 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1024 d = d->demarshaller()->endMap();
1028
1029
1030
1031
1032
1033
1034
1035void QDBusArgument::beginMapEntry()
const
1037 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1038 d = d->demarshaller()->beginMapEntry();
1042
1043
1044
1045
1046
1047void QDBusArgument::endMapEntry()
const
1049 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1050 d = d->demarshaller()->endMapEntry();
1054
1055
1056
1057
1058bool QDBusArgument::atEnd()
const
1060 if (QDBusArgumentPrivate::checkRead(d))
1061 return d->demarshaller()->atEnd();
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086QVariant QDBusArgument::asVariant()
const
1088 if (QDBusArgumentPrivate::checkRead(d))
1089 return d->demarshaller()->toVariantInternal();
1113#ifndef QDBUS_NO_SPECIALTYPES
1121 if (y != 0 && m != 0 && d != 0)
1122 date.setDate(y, m, d);
1132 a << date.year() << date.month() << date.day();
1143 a >> h >> m >> s >> ms;
1149 time.setHMS(h, m, s, ms);
1157 a << time.hour() << time.minute() << time.second() << time.msec();
1159 a << -1 << -1 << -1 << -1;
1171 a >> date >> time >> timespec;
1174 switch (Qt::TimeSpec(timespec)) {
1176 qWarning(
"Restoring zoned date-time without zone info");
1179 dt = QDateTime(date, time);
1181 case Qt::OffsetFromUTC:
1182 qWarning(
"Restoring date-time without its offset");
1185 dt = QDateTime(date, time, QTimeZone::UTC);
1194 if (Q_UNLIKELY(dt.timeSpec() != Qt::UTC && dt.timeSpec() != Qt::LocalTime)) {
1195 qWarning() <<
"Serializing a date-time with unsupported time-spec" << dt.timeSpec();
1199 return a << (dt.timeSpec() == Qt::OffsetFromUTC ? dt.toUTC() : dt.toLocalTime());
1202 a << dt.date() << dt.time() <<
int(dt.timeSpec());
1209 int x, y, width, height;
1211 a >> x >> y >> width >> height;
1214 rect.setRect(x, y, width, height);
1221 a << rect.x() << rect.y() << rect.width() << rect.height();
1229 double x, y, width, height;
1231 a >> x >> y >> width >> height;
1234 rect.setRect(qreal(x), qreal(y), qreal(width), qreal(height));
1241 a <<
double(rect.x()) <<
double(rect.y()) <<
double(rect.width()) <<
double(rect.height());
1250 a >> size.rwidth() >> size.rheight();
1259 a << size.width() << size.height();
1267 double width, height;
1269 a >> width >> height;
1272 size.setWidth(qreal(width));
1273 size.setHeight(qreal(height));
1280 a <<
double(size.width()) <<
double(size.height());
1289 a >> pt.rx() >> pt.ry();
1298 a << pt.x() << pt.y();
1319 a <<
double(pt.x()) <<
double(pt.y());
1332 line = QLine(p1, p2);
1339 a << line.p1() << line.p2();
1352 line = QLineF(p1, p2);
1359 a << line.p1() << line.p2();
1367
1368
1369
static bool checkReadAndDetach(QDBusArgumentPrivate *&d)
QDBusMarshaller * marshaller()
static bool checkRead(QDBusArgumentPrivate *d)
static bool checkWrite(QDBusArgumentPrivate *&d)
QDBusArgument::ElementType currentType()
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
#define DBUS_MESSAGE_TYPE_METHOD_CALL
#define DBUS_STRUCT_BEGIN_CHAR
QT_END_NAMESPACE QT_BEGIN_NAMESPACE const QDBusArgument & operator>>(const QDBusArgument &a, QVariant &v)
QDBusArgument & operator<<(QDBusArgument &a, const QPointF &pt)
const QDBusArgument & operator>>(const QDBusArgument &a, QPointF &pt)
QDBusArgument & operator<<(QDBusArgument &a, const QSize &size)
QDBusArgument & operator<<(QDBusArgument &a, const QDateTime &dt)
const QDBusArgument & operator>>(const QDBusArgument &a, QSize &size)
QDBusArgument & operator<<(QDBusArgument &a, const QSizeF &size)
QDBusArgument & operator<<(QDBusArgument &a, const QDate &date)
QDBusArgument & operator<<(QDBusArgument &a, const QTime &time)
const QDBusArgument & operator>>(const QDBusArgument &a, QRect &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QLineF &line)
const QDBusArgument & operator>>(const QDBusArgument &a, QDateTime &dt)
QDBusArgument & operator<<(QDBusArgument &a, const QRect &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QSizeF &size)
QDBusArgument & operator<<(QDBusArgument &a, const QRectF &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QTime &time)
const QDBusArgument & operator>>(const QDBusArgument &a, QRectF &rect)
const QDBusArgument & operator>>(const QDBusArgument &a, QDate &date)
const QDBusArgument & operator>>(const QDBusArgument &a, QLine &line)
const QDBusArgument & operator>>(const QDBusArgument &a, QPoint &pt)
QDBusArgument & operator<<(QDBusArgument &a, const QLine &line)
QDBusArgument & operator<<(QDBusArgument &a, const QPoint &pt)
QDBusArgument & operator<<(QDBusArgument &a, const QLineF &line)