14#include <qstringlist.h>
26QT_IMPL_METATYPE_EXTERN(QDBusArgument)
28QDBusArgumentPrivate::~QDBusArgumentPrivate()
31 q_dbus_message_unref(message);
40 QDBusMarshaller *marshaller =
new QDBusMarshaller;
41 marshaller->ba = &signature;
46 QDBusMetaType::marshall(arg, v.metaType(), v.constData());
50 bool ok = marshaller
->ok;
53 if (signature.isEmpty() || !ok || !QDBusUtil::isValidSingleSignature(QString::fromLatin1(signature))) {
54 qWarning(
"QDBusMarshaller: type '%s' produces invalid D-Bus signature '%s' "
55 "(Did you forget to call beginStructure() ?)",
56 type.name(), signature.isEmpty() ?
"<empty>" : signature.constData());
61 qWarning(
"QDBusMarshaller: type '%s' attempts to redefine basic D-Bus type '%s' (%s) "
62 "(Did you forget to call beginStructure() ?)",
63 type.name(), signature.constData(),
64 QDBusMetaType::signatureToMetaType(signature).name());
74 if (d->direction == Direction::Marshalling) {
78 if (d->message && d->ref.loadRelaxed() != 1) {
79 QDBusMarshaller *dd =
new QDBusMarshaller(d->capabilities);
80 dd->message = q_dbus_message_copy(d->message);
81 q_dbus_message_iter_init_append(dd->message, &dd->iterator);
91 qFatal(
"QDBusArgument: write from a read-only object");
93 qWarning(
"QDBusArgument: write from a read-only object");
102 if (d->direction == Direction::Demarshalling)
106 qFatal(
"QDBusArgument: read from a write-only object");
108 qWarning(
"QDBusArgument: read from a write-only object");
119 if (d->ref.loadRelaxed() == 1)
123 dd->message = q_dbus_message_ref(d->message);
133
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
204
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
236
237
238
239
240
241
242
243
244
245
246
247
248
251
252
253
254
255
256QDBusArgument::QDBusArgument()
258 if (!qdbus_loadLibDBus()) {
263 QDBusMarshaller *dd =
new QDBusMarshaller;
268 q_dbus_message_iter_init_append(dd->message, &dd->iterator);
272
273
274
275
276
277
278QDBusArgument::QDBusArgument(
const QDBusArgument &other)
286
287
288QDBusArgument::QDBusArgument(QDBusArgumentPrivate *dd)
294
295
296
297
298
299
300QDBusArgument &QDBusArgument::operator=(
const QDBusArgument &other)
302 qAtomicAssign(d, other.d);
307
308
309
310QDBusArgument::~QDBusArgument()
312 if (d && !d->ref.deref())
317
318
319QDBusArgument &QDBusArgument::operator<<(uchar arg)
321 if (QDBusArgumentPrivate::checkWrite(d))
322 d->marshaller()->append(arg);
327
328
329
330QDBusArgument &QDBusArgument::operator<<(
bool arg)
332 if (QDBusArgumentPrivate::checkWrite(d))
333 d->marshaller()->append(arg);
338
339
340
341QDBusArgument &QDBusArgument::operator<<(
short arg)
343 if (QDBusArgumentPrivate::checkWrite(d))
344 d->marshaller()->append(arg);
349
350
351
352QDBusArgument &QDBusArgument::operator<<(ushort arg)
354 if (QDBusArgumentPrivate::checkWrite(d))
355 d->marshaller()->append(arg);
360
361
362
363QDBusArgument &QDBusArgument::operator<<(
int arg)
365 if (QDBusArgumentPrivate::checkWrite(d))
366 d->marshaller()->append(arg);
371
372
373
374QDBusArgument &QDBusArgument::operator<<(uint arg)
376 if (QDBusArgumentPrivate::checkWrite(d))
377 d->marshaller()->append(arg);
382
383
384
385QDBusArgument &QDBusArgument::operator<<(qlonglong arg)
387 if (QDBusArgumentPrivate::checkWrite(d))
388 d->marshaller()->append(arg);
393
394
395
396QDBusArgument &QDBusArgument::operator<<(qulonglong arg)
398 if (QDBusArgumentPrivate::checkWrite(d))
399 d->marshaller()->append(arg);
404
405
406
407
408QDBusArgument &QDBusArgument::operator<<(
double arg)
410 if (QDBusArgumentPrivate::checkWrite(d))
411 d->marshaller()->append(arg);
416
417
418
419
420QDBusArgument &QDBusArgument::operator<<(
const QString &arg)
422 if (QDBusArgumentPrivate::checkWrite(d))
423 d->marshaller()->append(arg);
428
429
430
431
432
433QDBusArgument &QDBusArgument::operator<<(
const QDBusObjectPath &arg)
435 if (QDBusArgumentPrivate::checkWrite(d))
436 d->marshaller()->append(arg);
441
442
443
444
445
446QDBusArgument &QDBusArgument::operator<<(
const QDBusSignature &arg)
448 if (QDBusArgumentPrivate::checkWrite(d))
449 d->marshaller()->append(arg);
454
455
456
457
458
459
460QDBusArgument &QDBusArgument::operator<<(
const QDBusUnixFileDescriptor &arg)
462 if (QDBusArgumentPrivate::checkWrite(d))
463 d->marshaller()->append(arg);
468
469
470
471
472
473
474QDBusArgument &QDBusArgument::operator<<(
const QDBusVariant &arg)
476 if (QDBusArgumentPrivate::checkWrite(d))
477 d->marshaller()->append(arg);
482
483
484
485
486
487
488
489
490
491
492QDBusArgument &QDBusArgument::operator<<(
const QStringList &arg)
494 if (QDBusArgumentPrivate::checkWrite(d))
495 d->marshaller()->append(arg);
500
501
502
503
504
505
506
507
508
509
510QDBusArgument &QDBusArgument::operator<<(
const QByteArray &arg)
512 if (QDBusArgumentPrivate::checkWrite(d))
513 d->marshaller()->append(arg);
518
519
520
521
522
523
524
525void QDBusArgument::appendVariant(
const QVariant &v)
527 if (QDBusArgumentPrivate::checkWrite(d))
528 d->marshaller()->appendVariantInternal(v);
532
533
534
535
536QString QDBusArgument::currentSignature()
const
540 if (d->direction == QDBusArgumentPrivate::Direction::Demarshalling)
541 return d->demarshaller()->currentSignature();
543 return d->marshaller()->currentSignature();
547
548
549
550
551
552
553
554
555QDBusArgument::ElementType QDBusArgument::currentType()
const
559 if (d->direction == QDBusArgumentPrivate::Direction::Demarshalling)
560 return d->demarshaller()->currentType();
565
566
567
568const QDBusArgument &QDBusArgument::operator>>(uchar &arg)
const
570 if (QDBusArgumentPrivate::checkReadAndDetach(d))
571 arg = d->demarshaller()->toByte();
578
579
580
581
582const QDBusArgument &QDBusArgument::operator>>(
bool &arg)
const
584 if (QDBusArgumentPrivate::checkReadAndDetach(d))
585 arg = d->demarshaller()->toBool();
592
593
594
595
596const QDBusArgument &QDBusArgument::operator>>(ushort &arg)
const
598 if (QDBusArgumentPrivate::checkReadAndDetach(d))
599 arg = d->demarshaller()->toUShort();
606
607
608
609
610const QDBusArgument &QDBusArgument::operator>>(
short &arg)
const
612 if (QDBusArgumentPrivate::checkReadAndDetach(d))
613 arg = d->demarshaller()->toShort();
620
621
622
623
624const QDBusArgument &QDBusArgument::operator>>(
int &arg)
const
626 if (QDBusArgumentPrivate::checkReadAndDetach(d))
627 arg = d->demarshaller()->toInt();
634
635
636
637
638const QDBusArgument &QDBusArgument::operator>>(uint &arg)
const
640 if (QDBusArgumentPrivate::checkReadAndDetach(d))
641 arg = d->demarshaller()->toUInt();
648
649
650
651
652const QDBusArgument &QDBusArgument::operator>>(qlonglong &arg)
const
654 if (QDBusArgumentPrivate::checkReadAndDetach(d))
655 arg = d->demarshaller()->toLongLong();
662
663
664
665
666const QDBusArgument &QDBusArgument::operator>>(qulonglong &arg)
const
668 if (QDBusArgumentPrivate::checkReadAndDetach(d))
669 arg = d->demarshaller()->toULongLong();
676
677
678
679
680const QDBusArgument &QDBusArgument::operator>>(
double &arg)
const
682 if (QDBusArgumentPrivate::checkReadAndDetach(d))
683 arg = d->demarshaller()->toDouble();
690
691
692
693
694const QDBusArgument &QDBusArgument::operator>>(QString &arg)
const
696 if (QDBusArgumentPrivate::checkReadAndDetach(d))
697 arg = d->demarshaller()->toString();
702
703
704
705
706
707const QDBusArgument &QDBusArgument::operator>>(QDBusObjectPath &arg)
const
709 if (QDBusArgumentPrivate::checkReadAndDetach(d))
710 arg = d->demarshaller()->toObjectPath();
715
716
717
718
719
720const QDBusArgument &QDBusArgument::operator>>(QDBusSignature &arg)
const
722 if (QDBusArgumentPrivate::checkReadAndDetach(d))
723 arg = d->demarshaller()->toSignature();
728
729
730
731
732
733
734const QDBusArgument &QDBusArgument::operator>>(QDBusUnixFileDescriptor &arg)
const
736 if (QDBusArgumentPrivate::checkReadAndDetach(d))
737 arg = d->demarshaller()->toUnixFileDescriptor();
742
743
744
745
746
747
748
749
750
751
752
753
754const QDBusArgument &QDBusArgument::operator>>(QDBusVariant &arg)
const
756 if (QDBusArgumentPrivate::checkReadAndDetach(d))
757 arg = d->demarshaller()->toVariant();
762
763
764
765
766
767
768
769
770
771
772const QDBusArgument &QDBusArgument::operator>>(QStringList &arg)
const
774 if (QDBusArgumentPrivate::checkReadAndDetach(d))
775 arg = d->demarshaller()->toStringList();
780
781
782
783
784
785
786
787
788
789
790const QDBusArgument &QDBusArgument::operator>>(QByteArray &arg)
const
792 if (QDBusArgumentPrivate::checkReadAndDetach(d))
793 arg = d->demarshaller()->toByteArray();
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812void QDBusArgument::beginStructure()
814 if (QDBusArgumentPrivate::checkWrite(d))
815 d = d->marshaller()->beginStructure();
819
820
821
822
823
824void QDBusArgument::endStructure()
826 if (QDBusArgumentPrivate::checkWrite(d))
827 d = d->marshaller()->endStructure();
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847void QDBusArgument::beginArray(QMetaType id)
849 if (QDBusArgumentPrivate::checkWrite(d))
850 d = d->marshaller()->beginArray(id);
854
855
856
857
858
859void QDBusArgument::endArray()
861 if (QDBusArgumentPrivate::checkWrite(d))
862 d = d->marshaller()->endArray();
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884void QDBusArgument::beginMap(QMetaType keyMetaType, QMetaType valueMetaType)
886 if (QDBusArgumentPrivate::checkWrite(d))
887 d = d->marshaller()->beginMap(keyMetaType, valueMetaType);
891
892
893
894
895
896void QDBusArgument::endMap()
898 if (QDBusArgumentPrivate::checkWrite(d))
899 d = d->marshaller()->endMap();
903
904
905
906
907
908
909
910
911void QDBusArgument::beginMapEntry()
913 if (QDBusArgumentPrivate::checkWrite(d))
914 d = d->marshaller()->beginMapEntry();
918
919
920
921
922
923void QDBusArgument::endMapEntry()
925 if (QDBusArgumentPrivate::checkWrite(d))
926 d = d->marshaller()->endMapEntry();
930
931
932
933
934
935
936
937
938
939void QDBusArgument::beginStructure()
const
941 if (QDBusArgumentPrivate::checkReadAndDetach(d))
942 d = d->demarshaller()->beginStructure();
946
947
948
949
950
951void QDBusArgument::endStructure()
const
953 if (QDBusArgumentPrivate::checkReadAndDetach(d))
954 d = d->demarshaller()->endStructure();
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975void QDBusArgument::beginArray()
const
977 if (QDBusArgumentPrivate::checkReadAndDetach(d))
978 d = d->demarshaller()->beginArray();
982
983
984
985
986
987void QDBusArgument::endArray()
const
989 if (QDBusArgumentPrivate::checkReadAndDetach(d))
990 d = d->demarshaller()->endArray();
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008void QDBusArgument::beginMap()
const
1010 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1011 d = d->demarshaller()->beginMap();
1015
1016
1017
1018
1019
1020void QDBusArgument::endMap()
const
1022 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1023 d = d->demarshaller()->endMap();
1027
1028
1029
1030
1031
1032
1033
1034void QDBusArgument::beginMapEntry()
const
1036 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1037 d = d->demarshaller()->beginMapEntry();
1041
1042
1043
1044
1045
1046void QDBusArgument::endMapEntry()
const
1048 if (QDBusArgumentPrivate::checkReadAndDetach(d))
1049 d = d->demarshaller()->endMapEntry();
1053
1054
1055
1056
1057bool QDBusArgument::atEnd()
const
1059 if (QDBusArgumentPrivate::checkRead(d))
1060 return d->demarshaller()->atEnd();
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085QVariant QDBusArgument::asVariant()
const
1087 if (QDBusArgumentPrivate::checkRead(d))
1088 return d->demarshaller()->toVariantInternal();
1112#ifndef QDBUS_NO_SPECIALTYPES
1120 if (y != 0 && m != 0 && d != 0)
1121 date.setDate(y, m, d);
1131 a << date.year() << date.month() << date.day();
1142 a >> h >> m >> s >> ms;
1148 time.setHMS(h, m, s, ms);
1156 a << time.hour() << time.minute() << time.second() << time.msec();
1158 a << -1 << -1 << -1 << -1;
1170 a >> date >> time >> timespec;
1173 switch (Qt::TimeSpec(timespec)) {
1175 qWarning(
"Restoring zoned date-time without zone info");
1178 dt = QDateTime(date, time);
1180 case Qt::OffsetFromUTC:
1181 qWarning(
"Restoring date-time without its offset");
1184 dt = QDateTime(date, time, QTimeZone::UTC);
1193 if (Q_UNLIKELY(dt.timeSpec() != Qt::UTC && dt.timeSpec() != Qt::LocalTime)) {
1194 qWarning() <<
"Serializing a date-time with unsupported time-spec" << dt.timeSpec();
1198 return a << (dt.timeSpec() == Qt::OffsetFromUTC ? dt.toUTC() : dt.toLocalTime());
1201 a << dt.date() << dt.time() <<
int(dt.timeSpec());
1208 int x, y, width, height;
1210 a >> x >> y >> width >> height;
1213 rect.setRect(x, y, width, height);
1220 a << rect.x() << rect.y() << rect.width() << rect.height();
1228 double x, y, width, height;
1230 a >> x >> y >> width >> height;
1233 rect.setRect(qreal(x), qreal(y), qreal(width), qreal(height));
1240 a <<
double(rect.x()) <<
double(rect.y()) <<
double(rect.width()) <<
double(rect.height());
1249 a >> size.rwidth() >> size.rheight();
1258 a << size.width() << size.height();
1266 double width, height;
1268 a >> width >> height;
1271 size.setWidth(qreal(width));
1272 size.setHeight(qreal(height));
1279 a <<
double(size.width()) <<
double(size.height());
1288 a >> pt.rx() >> pt.ry();
1297 a << pt.x() << pt.y();
1318 a <<
double(pt.x()) <<
double(pt.y());
1331 line = QLine(p1, p2);
1338 a << line.p1() << line.p2();
1351 line = QLineF(p1, p2);
1358 a << line.p1() << line.p2();
1366
1367
1368
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
Combined button and popup list for selecting options.
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)