DBus-1-TQt  1.0
tqdbusdata.cpp
Go to the documentation of this file.
1 /* qdbusdata.cpp DBUS data transport type
2  *
3  * Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
4  *
5  * Licensed under the Academic Free License version 2.1
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20  * USA.
21  *
22  */
23 
24 #include "dbus/dbus.h"
25 
26 #include "tqdbusdata.h"
27 #include "tqdbusdatalist.h"
28 #include "tqdbusdatamap.h"
29 #include "tqdbusobjectpath.h"
30 #include "tqdbusunixfd.h"
31 #include "tqdbusvariant.h"
32 
33 #include <tqshared.h>
34 #include <tqstring.h>
35 #include <tqvaluelist.h>
36 
37 class TQT_DBusData::Private : public TQShared
38 {
39 public:
41 
43  {
44  switch (type)
45  {
47  delete (TQString*)value.pointer;
48  break;
49 
51  delete (TQT_DBusObjectPath*)value.pointer;
52  break;
53 
55  delete (TQT_DBusUnixFd*)value.pointer;
56  break;
57 
58  case TQT_DBusData::List:
59  delete (TQT_DBusDataList*)value.pointer;
60  break;
61 
63  delete (TQValueList<TQT_DBusData>*)value.pointer;
64  break;
65 
67  delete (TQT_DBusVariant*)value.pointer;
68  break;
69 
70  case TQT_DBusData::Map:
71  switch (keyType)
72  {
73  case TQT_DBusData::Byte:
74  delete (TQT_DBusDataMap<TQ_UINT8>*)value.pointer;
75  break;
76 
78  delete (TQT_DBusDataMap<TQ_INT16>*)value.pointer;
79  break;
80 
82  delete (TQT_DBusDataMap<TQ_UINT16>*)value.pointer;
83  break;
84 
86  delete (TQT_DBusDataMap<TQ_INT32>*)value.pointer;
87  break;
88 
90  delete (TQT_DBusDataMap<TQ_UINT32>*)value.pointer;
91  break;
92 
94  delete (TQT_DBusDataMap<TQ_INT64>*)value.pointer;
95  break;
96 
98  delete (TQT_DBusDataMap<TQ_UINT64>*)value.pointer;
99  break;
100 
102  delete (TQT_DBusDataMap<TQString>*)value.pointer;
103  break;
104 
107  break;
108 
110  delete (TQT_DBusDataMap<TQT_DBusUnixFd>*)value.pointer;
111  break;
112 
113  default:
114  tqFatal("TQT_DBusData::Private: unhandled map key type %d(%s)",
116  break;
117  }
118  break;
119 
120  default:
121  break;
122  }
123  }
124 
125 public:
128 
129  union
130  {
131  bool boolValue;
132  TQ_UINT8 byteValue;
133  TQ_INT16 int16Value;
134  TQ_UINT16 uint16Value;
135  TQ_INT32 int32Value;
136  TQ_UINT32 uint32Value;
137  TQ_INT64 int64Value;
138  TQ_UINT64 uint64Value;
139  double doubleValue;
140  void* pointer;
141  } value;
142 };
143 
144 // key type definitions for TQT_DBusDataMap
145 template <>
147 
148 template <>
150 
151 template <>
153 
154 template <>
156 
157 template <>
159 
160 template <>
162 
163 template <>
165 
166 template <>
168 
169 template <>
171 
172 template <>
174 
175 
177 {
178 }
179 
181 {
182  d = other.d;
183 
184  d->ref();
185 }
186 
188 {
189  if (d->deref()) delete d;
190 }
191 
193 {
194  if (&other == this) return *this;
195 
196  if (d->deref()) delete d;
197 
198  d = other.d;
199 
200  d->ref();
201 
202  return *this;
203 }
204 
205 bool TQT_DBusData::operator==(const TQT_DBusData& other) const
206 {
207  if (&other == this) return true;
208 
209  if (d == other.d) return true;
210 
211  if (d->type == other.d->type)
212  {
213  switch (d->type)
214  {
216  return true;
217 
218  case TQT_DBusData::Bool:
219  return d->value.boolValue == other.d->value.boolValue;
220 
221  case TQT_DBusData::Byte:
222  return d->value.byteValue == other.d->value.byteValue;
223 
224  case TQT_DBusData::Int16:
225  return d->value.int16Value == other.d->value.int16Value;
226 
228  return d->value.uint16Value == other.d->value.uint16Value;
229 
230  case TQT_DBusData::Int32:
231  return d->value.int32Value == other.d->value.int32Value;
232 
234  return d->value.uint32Value == other.d->value.uint64Value;
235 
236  case TQT_DBusData::Int64:
237  return d->value.int64Value == other.d->value.int64Value;
238 
240  return d->value.uint64Value == other.d->value.uint64Value;
241 
243  // FIXME: should not compare doubles for equality like this
244  return d->value.doubleValue == other.d->value.doubleValue;
245 
247  return toString() == other.toString();
248 
250  return toObjectPath() == other.toObjectPath();
251 
253  return toUnixFd() == other.toUnixFd();
254 
255  case TQT_DBusData::List:
256  return toList() == other.toList();
257 
259  return toStruct() == other.toStruct();
260 
262  return toVariant() == other.toVariant();
263 
264  case TQT_DBusData::Map:
265  if (d->keyType != other.d->keyType) return false;
266 
267  switch (d->keyType)
268  {
269  case TQT_DBusData::Byte:
270  return toByteKeyMap() == other.toByteKeyMap();
271 
272  case TQT_DBusData::Int16:
273  return toInt16KeyMap() == other.toInt16KeyMap();
274 
276  return toUInt16KeyMap() == other.toUInt16KeyMap();
277 
278  case TQT_DBusData::Int32:
279  return toInt32KeyMap() == other.toInt32KeyMap();
280 
282  return toUInt32KeyMap() == other.toUInt32KeyMap();
283 
284  case TQT_DBusData::Int64:
285  return toInt64KeyMap() == other.toInt64KeyMap();
286 
288  return toUInt64KeyMap() == other.toUInt64KeyMap();
289 
291  return toStringKeyMap() == other.toStringKeyMap();
292 
294  return toObjectPathKeyMap() == other.toObjectPathKeyMap();
295 
297  return toUnixFdKeyMap() == other.toUnixFdKeyMap();
298 
299  default:
300  tqFatal("TQT_DBusData operator== unhandled map key type %d(%s)",
302  break;
303  }
304 
305  break;
306  }
307  }
308 
309  return false;
310 }
311 
312 bool TQT_DBusData::operator!=(const TQT_DBusData& other) const
313 {
314  return !operator==(other);
315 }
316 
318 {
319  return d->type;
320 }
321 
323 {
325 
326  return d->keyType;
327 }
328 
330 {
331  switch (type)
332  {
333  case TQT_DBusData::Invalid: return "Invalid";
334  case TQT_DBusData::Bool: return "Bool";
335  case TQT_DBusData::Byte: return "Byte";
336  case TQT_DBusData::Int16: return "Int16";
337  case TQT_DBusData::UInt16: return "UInt16";
338  case TQT_DBusData::Int32: return "Int32";
339  case TQT_DBusData::UInt32: return "UInt32";
340  case TQT_DBusData::Int64: return "Int64";
341  case TQT_DBusData::UInt64: return "UInt64";
342  case TQT_DBusData::Double: return "Double";
343  case TQT_DBusData::String: return "String";
344  case TQT_DBusData::ObjectPath: return "ObjectPath";
345  case TQT_DBusData::UnixFd: return "UnixFd";
346  case TQT_DBusData::List: return "List";
347  case TQT_DBusData::Struct: return "Struct";
348  case TQT_DBusData::Variant: return "Variant";
349  case TQT_DBusData::Map: return "Map";
350  }
351 
352  return 0;
353 }
354 
356 {
357  TQT_DBusData data;
358 
359  data.d->type = TQT_DBusData::Bool;
360  data.d->value.boolValue = value;
361 
362  return data;
363 }
364 
365 bool TQT_DBusData::toBool(bool* ok) const
366 {
367  if (d->type != TQT_DBusData::Bool)
368  {
369  if (ok != 0) *ok = false;
370  return false;
371  }
372 
373  if (ok != 0) *ok = true;
374 
375  return d->value.boolValue;
376 }
377 
379 {
380  TQT_DBusData data;
381 
382  data.d->type = TQT_DBusData::Byte;
383  data.d->value.byteValue = value;
384 
385  return data;
386 }
387 
388 TQ_UINT8 TQT_DBusData::toByte(bool* ok) const
389 {
390  if (d->type != TQT_DBusData::Byte)
391  {
392  if (ok != 0) *ok = false;
393  return 0;
394  }
395 
396  if (ok != 0) *ok = true;
397 
398  return d->value.byteValue;
399 }
400 
402 {
403  TQT_DBusData data;
404 
405  data.d->type = TQT_DBusData::Int16;
406  data.d->value.int16Value = value;
407 
408  return data;
409 }
410 
411 TQ_INT16 TQT_DBusData::toInt16(bool* ok) const
412 {
413  if (d->type != TQT_DBusData::Int16)
414  {
415  if (ok != 0) *ok = false;
416  return 0;
417  }
418 
419  if (ok != 0) *ok = true;
420 
421  return d->value.int16Value;
422 }
423 
425 {
426  TQT_DBusData data;
427 
428  data.d->type = TQT_DBusData::UInt16;
429  data.d->value.uint16Value = value;
430 
431  return data;
432 }
433 
434 TQ_UINT16 TQT_DBusData::toUInt16(bool* ok) const
435 {
436  if (d->type != TQT_DBusData::UInt16)
437  {
438  if (ok != 0) *ok = false;
439  return 0;
440  }
441 
442  if (ok != 0) *ok = true;
443 
444  return d->value.uint16Value;
445 }
446 
448 {
449  TQT_DBusData data;
450 
451  data.d->type = TQT_DBusData::Int32;
452  data.d->value.int32Value = value;
453 
454  return data;
455 }
456 
457 TQ_INT32 TQT_DBusData::toInt32(bool* ok) const
458 {
459  if (d->type != TQT_DBusData::Int32)
460  {
461  if (ok != 0) *ok = false;
462  return 0;
463  }
464 
465  if (ok != 0) *ok = true;
466 
467  return d->value.int32Value;
468 }
469 
471 {
472  TQT_DBusData data;
473 
474  data.d->type = TQT_DBusData::UInt32;
475  data.d->value.uint32Value = value;
476 
477  return data;
478 }
479 
480 TQ_UINT32 TQT_DBusData::toUInt32(bool* ok) const
481 {
482  if (d->type != TQT_DBusData::UInt32)
483  {
484  if (ok != 0) *ok = false;
485  return 0;
486  }
487 
488  if (ok != 0) *ok = true;
489 
490  return d->value.uint32Value;
491 }
492 
494 {
495  TQT_DBusData data;
496 
497  data.d->type = TQT_DBusData::Int64;
498  data.d->value.int64Value = value;
499 
500  return data;
501 }
502 
503 TQ_INT64 TQT_DBusData::toInt64(bool* ok) const
504 {
505  if (d->type != TQT_DBusData::Int64)
506  {
507  if (ok != 0) *ok = false;
508  return 0;
509  }
510 
511  if (ok != 0) *ok = true;
512 
513  return d->value.int64Value;
514 }
515 
517 {
518  TQT_DBusData data;
519 
520  data.d->type = TQT_DBusData::UInt64;
521  data.d->value.uint64Value = value;
522 
523  return data;
524 }
525 
526 TQ_UINT64 TQT_DBusData::toUInt64(bool* ok) const
527 {
528  if (d->type != TQT_DBusData::UInt64)
529  {
530  if (ok != 0) *ok = false;
531  return 0;
532  }
533 
534  if (ok != 0) *ok = true;
535 
536  return d->value.uint64Value;
537 }
538 
540 {
541  TQT_DBusData data;
542 
543  data.d->type = TQT_DBusData::Double;
544  data.d->value.doubleValue = value;
545 
546  return data;
547 }
548 
549 double TQT_DBusData::toDouble(bool* ok) const
550 {
551  if (d->type != TQT_DBusData::Double)
552  {
553  if (ok != 0) *ok = false;
554  return 0.0;
555  }
556 
557  if (ok != 0) *ok = true;
558 
559  return d->value.doubleValue;
560 }
561 
563 {
564  TQT_DBusData data;
565 
566  data.d->type = TQT_DBusData::String;
567  data.d->value.pointer = new TQString(value);
568 
569  return data;
570 }
571 
572 TQString TQT_DBusData::toString(bool* ok) const
573 {
574  if (d->type != TQT_DBusData::String)
575  {
576  if (ok != 0) *ok = false;
577  return TQString();
578  }
579 
580  if (ok != 0) *ok = true;
581 
582  return *((TQString*)d->value.pointer);
583 }
584 
586 {
587  TQT_DBusData data;
588 
589  if (value.isValid())
590  {
592  data.d->value.pointer = new TQT_DBusObjectPath(value);
593  }
594 
595  return data;
596 }
597 
599 {
601  {
602  if (ok != 0) *ok = false;
603  return TQT_DBusObjectPath();
604  }
605 
606  if (ok != 0) *ok = true;
607 
608  return *((TQT_DBusObjectPath*)d->value.pointer);
609 }
610 
612 {
613  TQT_DBusData data;
614 
615  if (value.isValid())
616  {
617  data.d->type = TQT_DBusData::UnixFd;
618  data.d->value.pointer = new TQT_DBusUnixFd(value);
619  }
620 
621  return data;
622 }
623 
625 {
626  if (d->type != TQT_DBusData::UnixFd)
627  {
628  if (ok != 0) *ok = false;
629  return TQT_DBusUnixFd();
630  }
631 
632  if (ok != 0) *ok = true;
633 
634  return *((TQT_DBusUnixFd*)d->value.pointer);
635 }
636 
638 {
639  TQT_DBusData data;
640 
641  if (list.type() == TQT_DBusData::Invalid) return data;
642 
643  data.d->type = TQT_DBusData::List;
644  data.d->value.pointer = new TQT_DBusDataList(list);
645 
646  return data;
647 }
648 
650 {
651  if (d->type != TQT_DBusData::List)
652  {
653  if (ok != 0) *ok = false;
654  return TQT_DBusDataList();
655  }
656 
657  if (ok != 0) *ok = true;
658 
659  return *((TQT_DBusDataList*)d->value.pointer);
660 }
661 
663 {
664  return fromList(TQT_DBusDataList(list));
665 }
666 
668 {
669  bool internalOk = false;
670  TQT_DBusDataList list = toList(&internalOk);
671 
672  if (!internalOk)
673  {
674  if (ok != 0) *ok = false;
675  return TQValueList<TQT_DBusData>();
676  }
677 
678  return list.toTQValueList();
679 }
680 
682 {
683  TQT_DBusData data;
684 
685  TQValueList<TQT_DBusData>::const_iterator it = memberList.begin();
686  TQValueList<TQT_DBusData>::const_iterator endIt = memberList.end();
687  for (; it != endIt; ++it)
688  {
689  if ((*it).d->type == Invalid) return data;
690  }
691 
692  data.d->type = TQT_DBusData::Struct;
693  data.d->value.pointer = new TQValueList<TQT_DBusData>(memberList);
694 
695  return data;
696 }
697 
699 {
700  if (d->type != TQT_DBusData::Struct)
701  {
702  if (ok != 0) *ok = false;
703  return TQValueList<TQT_DBusData>();
704  }
705 
706  if (ok != 0) *ok = true;
707 
709 }
710 
712 {
713  TQT_DBusData data;
714 
715  data.d->type = TQT_DBusData::Variant;
716  data.d->value.pointer = new TQT_DBusVariant(value);
717 
718  return data;
719 }
720 
722 {
723  if (d->type != TQT_DBusData::Variant)
724  {
725  if (ok != 0) *ok = false;
726  return TQT_DBusVariant();
727  }
728 
729  if (ok != 0) *ok = true;
730 
731  return *((TQT_DBusVariant*)d->value.pointer);
732 }
733 
735 {
736  TQT_DBusVariant variant;
737  variant.value = *this;
738  variant.signature = variant.value.buildDBusSignature();
739  return TQT_DBusData::fromVariant(variant);
740 }
741 
743 {
744  TQT_DBusData data;
745 
746  data.d->type = TQT_DBusData::Map;
747  data.d->keyType = map.keyType();
748  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT8>(map);
749 
750  return data;
751 }
752 
754 {
756  {
757  if (ok != 0) *ok = false;
758  return TQT_DBusDataMap<TQ_UINT8>();
759  }
760 
761  if (ok != 0) *ok = true;
762 
764 }
765 
767 {
768  TQT_DBusData data;
769 
770  data.d->type = TQT_DBusData::Map;
771  data.d->keyType = map.keyType();
772  data.d->value.pointer = new TQT_DBusDataMap<TQ_INT16>(map);
773 
774  return data;
775 }
776 
778 {
780  {
781  if (ok != 0) *ok = false;
782  return TQT_DBusDataMap<TQ_INT16>();
783  }
784 
785  if (ok != 0) *ok = true;
786 
788 }
789 
791 {
792  TQT_DBusData data;
793 
794  data.d->type = TQT_DBusData::Map;
795  data.d->keyType = map.keyType();
796  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT16>(map);
797 
798  return data;
799 }
800 
802 {
803  if (d->type != TQT_DBusData::Map &&
805  {
806  if (ok != 0) *ok = false;
808  }
809 
810  if (ok != 0) *ok = true;
811 
813 }
814 
816 {
817  TQT_DBusData data;
818 
819  data.d->type = TQT_DBusData::Map;
820  data.d->keyType = map.keyType();
821  data.d->value.pointer = new TQT_DBusDataMap<TQ_INT32>(map);
822 
823  return data;
824 }
825 
827 {
829  {
830  if (ok != 0) *ok = false;
831  return TQT_DBusDataMap<TQ_INT32>();
832  }
833 
834  if (ok != 0) *ok = true;
835 
837 }
838 
840 {
841  TQT_DBusData data;
842 
843  data.d->type = TQT_DBusData::Map;
844  data.d->keyType = map.keyType();
845  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT32>(map);
846 
847  return data;
848 }
849 
851 {
852  if (d->type != TQT_DBusData::Map &&
854  {
855  if (ok != 0) *ok = false;
857  }
858 
859  if (ok != 0) *ok = true;
860 
862 }
863 
865 {
866  TQT_DBusData data;
867 
868  data.d->type = TQT_DBusData::Map;
869  data.d->keyType = map.keyType();
870  data.d->value.pointer = new TQT_DBusDataMap<TQ_INT64>(map);
871 
872  return data;
873 }
874 
876 {
878  {
879  if (ok != 0) *ok = false;
880  return TQT_DBusDataMap<TQ_INT64>();
881  }
882 
883  if (ok != 0) *ok = true;
884 
886 }
887 
889 {
890  TQT_DBusData data;
891 
892  data.d->type = TQT_DBusData::Map;
893  data.d->keyType = map.keyType();
894  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT64>(map);
895 
896  return data;
897 }
898 
900 {
901  if (d->type != TQT_DBusData::Map &&
903  {
904  if (ok != 0) *ok = false;
906  }
907 
908  if (ok != 0) *ok = true;
909 
911 }
912 
914 {
915  TQT_DBusData data;
916 
917  data.d->type = TQT_DBusData::Map;
918  data.d->keyType = map.keyType();
919  data.d->value.pointer = new TQT_DBusDataMap<TQString>(map);
920 
921  return data;
922 }
923 
925 {
927  {
928  if (ok != 0) *ok = false;
929  return TQT_DBusDataMap<TQString>();
930  }
931 
932  if (ok != 0) *ok = true;
933 
935 }
936 
938 {
939  TQT_DBusData data;
940 
941  data.d->type = TQT_DBusData::Map;
942  data.d->keyType = map.keyType();
944 
945  return data;
946 }
947 
949 {
950  if (d->type != TQT_DBusData::Map &&
952  {
953  if (ok != 0) *ok = false;
955  }
956 
957  if (ok != 0) *ok = true;
958 
960 }
961 
963 {
964  TQT_DBusData data;
965 
966  data.d->type = TQT_DBusData::Map;
967  data.d->keyType = map.keyType();
969 
970  return data;
971 }
972 
974 {
975  if (d->type != TQT_DBusData::Map &&
977  {
978  if (ok != 0) *ok = false;
980  }
981 
982  if (ok != 0) *ok = true;
983 
985 }
986 
988 {
989  switch (type)
990  {
992  return 0;
993  case TQT_DBusData::Bool:
994  return DBUS_TYPE_BOOLEAN_AS_STRING;
995  case TQT_DBusData::Byte:
996  return DBUS_TYPE_BYTE_AS_STRING;
997  case TQT_DBusData::Int16:
998  return DBUS_TYPE_INT16_AS_STRING;
1000  return DBUS_TYPE_UINT16_AS_STRING;
1001  case TQT_DBusData::Int32:
1002  return DBUS_TYPE_INT32_AS_STRING;
1003  case TQT_DBusData::UInt32:
1004  return DBUS_TYPE_UINT32_AS_STRING;
1005  case TQT_DBusData::Int64:
1006  return DBUS_TYPE_INT64_AS_STRING;
1007  case TQT_DBusData::UInt64:
1008  return DBUS_TYPE_UINT64_AS_STRING;
1009  case TQT_DBusData::Double:
1010  return DBUS_TYPE_DOUBLE_AS_STRING;
1011  case TQT_DBusData::String:
1012  return DBUS_TYPE_STRING_AS_STRING;
1014  return DBUS_TYPE_OBJECT_PATH_AS_STRING;
1015  case TQT_DBusData::UnixFd:
1017  case TQT_DBusData::Variant:
1018  return DBUS_TYPE_VARIANT_AS_STRING;
1019  default:
1020  break;
1021  }
1022  return 0;
1023 }
1024 
1025 template <typename T>
1027 {
1028  if (map.hasContainerValueType())
1029  return map.containerValueType().buildDBusSignature();
1030  else
1031  return qDBusTypeForTQT_DBusType(map.valueType());
1032 }
1033 
1035 {
1036  TQCString signature;
1037 
1038  switch (d->type)
1039  {
1040  case TQT_DBusData::List:
1041  {
1043  signature = DBUS_TYPE_ARRAY_AS_STRING;
1044  if (list->hasContainerItemType())
1045  signature += list->containerItemType().buildDBusSignature();
1046  else
1047  signature += qDBusTypeForTQT_DBusType(list->type());
1048  break;
1049  }
1050 
1051  case TQT_DBusData::Struct:
1052  {
1053  signature += DBUS_STRUCT_BEGIN_CHAR;
1054 
1055  TQValueList<TQT_DBusData>* memberList =
1057 
1058  TQValueList<TQT_DBusData>::const_iterator it = (*memberList).begin();
1059  TQValueList<TQT_DBusData>::const_iterator endIt = (*memberList).end();
1060  for (; it != endIt; ++it)
1061  {
1062  signature += (*it).buildDBusSignature();
1063  }
1064  signature += DBUS_STRUCT_END_CHAR;
1065  break;
1066  }
1067 
1068  case TQT_DBusData::Map:
1069  signature += DBUS_TYPE_ARRAY_AS_STRING;
1070  signature += DBUS_DICT_ENTRY_BEGIN_CHAR;
1071 
1072  signature += qDBusTypeForTQT_DBusType(keyType());
1073 
1074  switch (keyType())
1075  {
1076  case TQT_DBusData::Byte:
1077  signature += qDBusSignatureForMapValue<TQ_UINT8>(
1079  break;
1080  case TQT_DBusData::Int16:
1081  signature += qDBusSignatureForMapValue<TQ_INT16>(
1083  break;
1084  case TQT_DBusData::UInt16:
1085  signature += qDBusSignatureForMapValue<TQ_UINT16>(
1087  break;
1088  case TQT_DBusData::Int32:
1089  signature += qDBusSignatureForMapValue<TQ_INT32>(
1091  break;
1092  case TQT_DBusData::UInt32:
1093  signature += qDBusSignatureForMapValue<TQ_UINT32>(
1095  break;
1096  case TQT_DBusData::Int64:
1097  signature += qDBusSignatureForMapValue<TQ_INT64>(
1099  break;
1100  case TQT_DBusData::UInt64:
1101  signature += qDBusSignatureForMapValue<TQ_UINT64>(
1103  break;
1104  case TQT_DBusData::String:
1105  signature += qDBusSignatureForMapValue<TQString>(
1107  break;
1109  signature += qDBusSignatureForMapValue<TQT_DBusObjectPath>(
1111  break;
1112  case TQT_DBusData::UnixFd:
1113  signature += qDBusSignatureForMapValue<TQT_DBusUnixFd>(
1115  break;
1116  default:
1117  break;
1118  }
1119 
1120  signature += DBUS_DICT_ENTRY_END_CHAR;
1121  break;
1122 
1123  default:
1124  signature = qDBusTypeForTQT_DBusType(d->type);
1125  break;
1126  }
1127 
1128  return signature;
1129 }
Type keyType() const
Returns the Type of the key type for maps.
Definition: tqdbusdata.cpp:322
bool hasContainerValueType() const
Checks whether the value type is a data container itself.
const char * typeName() const
Returns the string representation of the object&#39;s Type.
Definition: tqdbusdata.h:385
static TQT_DBusData fromInt64(TQ_INT64 value)
Creates a data object for the given signed 64-bit integer value.
Definition: tqdbusdata.cpp:493
TQT_DBusVariant toVariant(bool *ok=0) const
Tries to get the encapsulated variant value.
Definition: tqdbusdata.cpp:721
#define DBUS_TYPE_UNIX_FD_AS_STRING
Definition: tqdbusunixfd.h:39
static TQT_DBusData fromUInt64KeyMap(const TQT_DBusDataMap< TQ_UINT64 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:888
bool operator==(const TQT_DBusData &other) const
Checks if the given other data object is equal to this instance.
Definition: tqdbusdata.cpp:205
TQT_DBusData::Type keyType() const
Returns the key type of the map object.
Data type for representing a D-Bus variant.
Definition: tqdbusvariant.h:56
union TQT_DBusData::Private::@0 value
static TQT_DBusData fromObjectPath(const TQT_DBusObjectPath &value)
Creates a data object for the given object path value.
Definition: tqdbusdata.cpp:585
static TQT_DBusData fromString(const TQString &value)
Creates a data object for the given string value.
Definition: tqdbusdata.cpp:562
TQT_DBusData & operator=(const TQT_DBusData &other)
Copies a given other data object.
Definition: tqdbusdata.cpp:192
static TQT_DBusData fromByte(TQ_UINT8 value)
Creates a data object for the given byte (unsigned char) value.
Definition: tqdbusdata.cpp:378
TQ_UINT16 toUInt16(bool *ok=0) const
Tries to get the encapsulated unsigned 16-bit integer value.
Definition: tqdbusdata.cpp:434
TQT_DBusData containerItemType() const
Returns a container prototype for the list&#39;s element type.
TQT_DBusObjectPath toObjectPath(bool *ok=0) const
Tries to get the encapsulated object path value.
Definition: tqdbusdata.cpp:598
TQT_DBusData::Type type() const
Returns the element type of the list object.
Class for representing D-Bus unix file handles.
Definition: tqdbusunixfd.h:51
bool toBool(bool *ok=0) const
Tries to get the encapsulated boolean value.
Definition: tqdbusdata.cpp:365
static TQT_DBusData fromInt64KeyMap(const TQT_DBusDataMap< TQ_INT64 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:864
TQT_DBusDataList toList(bool *ok=0) const
Tries to get the encapsulated list.
Definition: tqdbusdata.cpp:649
TQString signature
The D-Bus data signature of the data contained in value.
Class to transport lists of D-Bus data types.
bool hasContainerItemType() const
Checks whether the element type is a data container itself.
TQValueList< TQT_DBusData > toTQValueList(bool *ok=0) const
Tries to get the encapsulated list.
Definition: tqdbusdata.cpp:667
static TQT_DBusData fromStruct(const TQValueList< TQT_DBusData > &memberList)
Creates a data object for the given struct&#39;s memberList.
Definition: tqdbusdata.cpp:681
TQValueList< TQT_DBusData > toStruct(bool *ok=0) const
Tries to get the encapsulated struct memberList.
Definition: tqdbusdata.cpp:698
~TQT_DBusData()
Destroys the data object.
Definition: tqdbusdata.cpp:187
static TQT_DBusData fromUInt64(TQ_UINT64 value)
Creates a data object for the given unsigned 64-bit integer value.
Definition: tqdbusdata.cpp:516
static TQT_DBusData fromInt16(TQ_INT16 value)
Creates a data object for the given signed 16-bit integer value.
Definition: tqdbusdata.cpp:401
bool isValid() const
Returns whether the current content is considered a valid unix file handle.
Type type() const
Returns the Type of the data object.
Definition: tqdbusdata.cpp:317
TQ_INT32 toInt32(bool *ok=0) const
Tries to get the encapsulated signed 32-bit integer value.
Definition: tqdbusdata.cpp:457
static TQT_DBusData fromTQValueList(const TQValueList< TQT_DBusData > &list)
Creates a data object for the given list.
Definition: tqdbusdata.cpp:662
static TQT_DBusData fromUnixFd(const TQT_DBusUnixFd &value)
Creates a data object for the given unix file handle value.
Definition: tqdbusdata.cpp:611
TQValueList< TQT_DBusData > toTQValueList() const
Converts the list object into a TQValueList with TQT_DBusData elements.
TQ_INT64 toInt64(bool *ok=0) const
Tries to get the encapsulated signed 64-bit integer value.
Definition: tqdbusdata.cpp:503
static TQT_DBusData fromList(const TQT_DBusDataList &list)
Creates a data object for the given list.
Definition: tqdbusdata.cpp:637
TQT_DBusData::Type valueType() const
Returns the value type of the map object.
double toDouble(bool *ok=0) const
Tries to get the encapsulated double value.
Definition: tqdbusdata.cpp:549
Class for accurately representing D-Bus data types.
Definition: tqdbusdata.h:58
static TQT_DBusData fromUInt16(TQ_UINT16 value)
Creates a data object for the given unsigned 16-bit integer value.
Definition: tqdbusdata.cpp:424
static TQT_DBusData fromDouble(double value)
Creates a data object for the given double value.
Definition: tqdbusdata.cpp:539
Class for representing D-Bus object paths.
TQT_DBusData()
Creates an empty, Invalid data object.
Definition: tqdbusdata.cpp:176
bool operator!=(const TQT_DBusData &other) const
Checks if the given other data object is different from this instance.
Definition: tqdbusdata.cpp:312
TQCString buildDBusSignature() const
Creates the data objects D-Bus signature.
static TQT_DBusData fromInt16KeyMap(const TQT_DBusDataMap< TQ_INT16 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:766
TQT_DBusUnixFd toUnixFd(bool *ok=0) const
Tries to get the encapsulated unix file handle value.
Definition: tqdbusdata.cpp:624
static TQT_DBusData fromUInt16KeyMap(const TQT_DBusDataMap< TQ_UINT16 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:790
TQT_DBusDataMap< TQ_INT64 > toInt64KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:875
static TQT_DBusData fromBool(bool value)
Creates a data object for the given boolean value.
Definition: tqdbusdata.cpp:355
TQ_UINT32 toUInt32(bool *ok=0) const
Tries to get the encapsulated unsigned 32-bit integer value.
Definition: tqdbusdata.cpp:480
TQT_DBusData value
The D-Bus data type to transport as a variant.
static TQT_DBusData fromUnixFdKeyMap(const TQT_DBusDataMap< TQT_DBusUnixFd > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:962
static TQT_DBusData fromInt32(TQ_INT32 value)
Creates a data object for the given signed 32-bit integer value.
Definition: tqdbusdata.cpp:447
TQ_UINT8 toByte(bool *ok=0) const
Tries to get the encapsulated byte (unsigned char) value.
Definition: tqdbusdata.cpp:388
TQT_DBusDataMap< TQ_UINT8 > toByteKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:753
Private * d
Definition: tqdbusdata.h:1226
static TQT_DBusData fromStringKeyMap(const TQT_DBusDataMap< TQString > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:913
TQT_DBusDataMap< TQString > toStringKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:924
TQT_DBusDataMap< TQ_INT32 > toInt32KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:826
TQT_DBusDataMap< TQ_INT16 > toInt16KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:777
TQString toString(bool *ok=0) const
Tries to get the encapsulated string value.
Definition: tqdbusdata.cpp:572
TQ_INT16 toInt16(bool *ok=0) const
Tries to get the encapsulated signed 16-bit integer value.
Definition: tqdbusdata.cpp:411
static TQT_DBusData fromUInt32(TQ_UINT32 value)
Creates a data object for the given unsigned 32-bit integer value.
Definition: tqdbusdata.cpp:470
static TQT_DBusData fromInt32KeyMap(const TQT_DBusDataMap< TQ_INT32 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:815
static TQT_DBusData fromVariant(const TQT_DBusVariant &value)
Creates a data object for the given variant value.
Definition: tqdbusdata.cpp:711
static TQT_DBusData fromUInt32KeyMap(const TQT_DBusDataMap< TQ_UINT32 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:839
TQT_DBusDataMap< TQT_DBusObjectPath > toObjectPathKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:948
TQCString qDBusSignatureForMapValue(const TQT_DBusDataMap< T > &map)
Type
Enum for the data types used in D-Bus messages.
Definition: tqdbusdata.h:73
TQT_DBusDataMap< TQ_UINT64 > toUInt64KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:899
TQT_DBusDataMap< TQ_UINT16 > toUInt16KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:801
TQT_DBusDataMap< TQT_DBusUnixFd > toUnixFdKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:973
static TQT_DBusData fromObjectPathKeyMap(const TQT_DBusDataMap< TQT_DBusObjectPath > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:937
TQ_UINT64 toUInt64(bool *ok=0) const
Tries to get the encapsulated unsigned 64-bit integer value.
Definition: tqdbusdata.cpp:526
static const char * qDBusTypeForTQT_DBusType(TQT_DBusData::Type type)
Definition: tqdbusdata.cpp:987
Class to transport maps of D-Bus data types.
Definition: tqdbusdata.h:38
bool isValid() const
Returns whether the current content is considered a valid object path.
TQT_DBusData containerValueType() const
Returns a container prototype for the map&#39;s value type.
TQT_DBusData getAsVariantData()
Creates a variant from this object and returns it as a TQT_DBusData object.
Definition: tqdbusdata.cpp:734
static TQT_DBusData fromByteKeyMap(const TQT_DBusDataMap< TQ_UINT8 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:742
TQT_DBusDataMap< TQ_UINT32 > toUInt32KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:850