DBus-1-TQt  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
329 const char* TQT_DBusData::typeName(Type type)
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_DBusData data;
737 
738  data.d->type = TQT_DBusData::Map;
739  data.d->keyType = map.keyType();
740  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT8>(map);
741 
742  return data;
743 }
744 
746 {
748  {
749  if (ok != 0) *ok = false;
750  return TQT_DBusDataMap<TQ_UINT8>();
751  }
752 
753  if (ok != 0) *ok = true;
754 
756 }
757 
759 {
760  TQT_DBusData data;
761 
762  data.d->type = TQT_DBusData::Map;
763  data.d->keyType = map.keyType();
764  data.d->value.pointer = new TQT_DBusDataMap<TQ_INT16>(map);
765 
766  return data;
767 }
768 
770 {
772  {
773  if (ok != 0) *ok = false;
774  return TQT_DBusDataMap<TQ_INT16>();
775  }
776 
777  if (ok != 0) *ok = true;
778 
780 }
781 
783 {
784  TQT_DBusData data;
785 
786  data.d->type = TQT_DBusData::Map;
787  data.d->keyType = map.keyType();
788  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT16>(map);
789 
790  return data;
791 }
792 
794 {
795  if (d->type != TQT_DBusData::Map &&
797  {
798  if (ok != 0) *ok = false;
800  }
801 
802  if (ok != 0) *ok = true;
803 
805 }
806 
808 {
809  TQT_DBusData data;
810 
811  data.d->type = TQT_DBusData::Map;
812  data.d->keyType = map.keyType();
813  data.d->value.pointer = new TQT_DBusDataMap<TQ_INT32>(map);
814 
815  return data;
816 }
817 
819 {
821  {
822  if (ok != 0) *ok = false;
823  return TQT_DBusDataMap<TQ_INT32>();
824  }
825 
826  if (ok != 0) *ok = true;
827 
829 }
830 
832 {
833  TQT_DBusData data;
834 
835  data.d->type = TQT_DBusData::Map;
836  data.d->keyType = map.keyType();
837  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT32>(map);
838 
839  return data;
840 }
841 
843 {
844  if (d->type != TQT_DBusData::Map &&
846  {
847  if (ok != 0) *ok = false;
849  }
850 
851  if (ok != 0) *ok = true;
852 
854 }
855 
857 {
858  TQT_DBusData data;
859 
860  data.d->type = TQT_DBusData::Map;
861  data.d->keyType = map.keyType();
862  data.d->value.pointer = new TQT_DBusDataMap<TQ_INT64>(map);
863 
864  return data;
865 }
866 
868 {
870  {
871  if (ok != 0) *ok = false;
872  return TQT_DBusDataMap<TQ_INT64>();
873  }
874 
875  if (ok != 0) *ok = true;
876 
878 }
879 
881 {
882  TQT_DBusData data;
883 
884  data.d->type = TQT_DBusData::Map;
885  data.d->keyType = map.keyType();
886  data.d->value.pointer = new TQT_DBusDataMap<TQ_UINT64>(map);
887 
888  return data;
889 }
890 
892 {
893  if (d->type != TQT_DBusData::Map &&
895  {
896  if (ok != 0) *ok = false;
898  }
899 
900  if (ok != 0) *ok = true;
901 
903 }
904 
906 {
907  TQT_DBusData data;
908 
909  data.d->type = TQT_DBusData::Map;
910  data.d->keyType = map.keyType();
911  data.d->value.pointer = new TQT_DBusDataMap<TQString>(map);
912 
913  return data;
914 }
915 
917 {
919  {
920  if (ok != 0) *ok = false;
921  return TQT_DBusDataMap<TQString>();
922  }
923 
924  if (ok != 0) *ok = true;
925 
927 }
928 
930 {
931  TQT_DBusData data;
932 
933  data.d->type = TQT_DBusData::Map;
934  data.d->keyType = map.keyType();
936 
937  return data;
938 }
939 
941 {
942  if (d->type != TQT_DBusData::Map &&
944  {
945  if (ok != 0) *ok = false;
947  }
948 
949  if (ok != 0) *ok = true;
950 
952 }
953 
955 {
956  TQT_DBusData data;
957 
958  data.d->type = TQT_DBusData::Map;
959  data.d->keyType = map.keyType();
961 
962  return data;
963 }
964 
966 {
967  if (d->type != TQT_DBusData::Map &&
969  {
970  if (ok != 0) *ok = false;
972  }
973 
974  if (ok != 0) *ok = true;
975 
977 }
978 
980 {
981  switch (type)
982  {
984  return 0;
985  case TQT_DBusData::Bool:
986  return DBUS_TYPE_BOOLEAN_AS_STRING;
987  case TQT_DBusData::Byte:
988  return DBUS_TYPE_BYTE_AS_STRING;
989  case TQT_DBusData::Int16:
990  return DBUS_TYPE_INT16_AS_STRING;
992  return DBUS_TYPE_UINT16_AS_STRING;
993  case TQT_DBusData::Int32:
994  return DBUS_TYPE_INT32_AS_STRING;
996  return DBUS_TYPE_UINT32_AS_STRING;
997  case TQT_DBusData::Int64:
998  return DBUS_TYPE_INT64_AS_STRING;
1000  return DBUS_TYPE_UINT64_AS_STRING;
1001  case TQT_DBusData::Double:
1002  return DBUS_TYPE_DOUBLE_AS_STRING;
1003  case TQT_DBusData::String:
1004  return DBUS_TYPE_STRING_AS_STRING;
1006  return DBUS_TYPE_OBJECT_PATH_AS_STRING;
1007  case TQT_DBusData::UnixFd:
1009  case TQT_DBusData::Variant:
1010  return DBUS_TYPE_VARIANT_AS_STRING;
1011  default:
1012  break;
1013  }
1014  return 0;
1015 }
1016 
1017 template <typename T>
1019 {
1020  if (map.hasContainerValueType())
1021  return map.containerValueType().buildDBusSignature();
1022  else
1023  return qDBusTypeForTQT_DBusType(map.valueType());
1024 }
1025 
1027 {
1028  TQCString signature;
1029 
1030  switch (d->type)
1031  {
1032  case TQT_DBusData::List:
1033  {
1035  signature = DBUS_TYPE_ARRAY_AS_STRING;
1036  if (list->hasContainerItemType())
1037  signature += list->containerItemType().buildDBusSignature();
1038  else
1039  signature += qDBusTypeForTQT_DBusType(list->type());
1040  break;
1041  }
1042 
1043  case TQT_DBusData::Struct:
1044  {
1045  signature += DBUS_STRUCT_BEGIN_CHAR;
1046 
1047  TQValueList<TQT_DBusData>* memberList =
1049 
1050  TQValueList<TQT_DBusData>::const_iterator it = (*memberList).begin();
1051  TQValueList<TQT_DBusData>::const_iterator endIt = (*memberList).end();
1052  for (; it != endIt; ++it)
1053  {
1054  signature += (*it).buildDBusSignature();
1055  }
1056  signature += DBUS_STRUCT_END_CHAR;
1057  break;
1058  }
1059 
1060  case TQT_DBusData::Map:
1061  signature += DBUS_TYPE_ARRAY_AS_STRING;
1062  signature += DBUS_DICT_ENTRY_BEGIN_CHAR;
1063 
1064  signature += qDBusTypeForTQT_DBusType(keyType());
1065 
1066  switch (keyType())
1067  {
1068  case TQT_DBusData::Byte:
1069  signature += qDBusSignatureForMapValue<TQ_UINT8>(
1071  break;
1072  case TQT_DBusData::Int16:
1073  signature += qDBusSignatureForMapValue<TQ_INT16>(
1075  break;
1076  case TQT_DBusData::UInt16:
1077  signature += qDBusSignatureForMapValue<TQ_UINT16>(
1079  break;
1080  case TQT_DBusData::Int32:
1081  signature += qDBusSignatureForMapValue<TQ_INT32>(
1083  break;
1084  case TQT_DBusData::UInt32:
1085  signature += qDBusSignatureForMapValue<TQ_UINT32>(
1087  break;
1088  case TQT_DBusData::Int64:
1089  signature += qDBusSignatureForMapValue<TQ_INT64>(
1091  break;
1092  case TQT_DBusData::UInt64:
1093  signature += qDBusSignatureForMapValue<TQ_UINT64>(
1095  break;
1096  case TQT_DBusData::String:
1097  signature += qDBusSignatureForMapValue<TQString>(
1099  break;
1101  signature += qDBusSignatureForMapValue<TQT_DBusObjectPath>(
1103  break;
1104  case TQT_DBusData::UnixFd:
1105  signature += qDBusSignatureForMapValue<TQT_DBusUnixFd>(
1107  break;
1108  default:
1109  break;
1110  }
1111 
1112  signature += DBUS_DICT_ENTRY_END_CHAR;
1113  break;
1114 
1115  default:
1116  signature = qDBusTypeForTQT_DBusType(d->type);
1117  break;
1118  }
1119 
1120  return signature;
1121 }
Type keyType() const
Returns the Type of the key type for maps.
Definition: tqdbusdata.cpp:322
const char * typeName() const
Returns the string representation of the object'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:880
bool operator==(const TQT_DBusData &other) const
Checks if the given other data object is equal to this instance.
Definition: tqdbusdata.cpp:205
Data type for representing a D-Bus variant.
Definition: tqdbusvariant.h:56
TQT_DBusData::Type valueType() const
Returns the value type of the map object.
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
Class to transport maps of D-Bus data types.
Definition: tqdbusdata.h:38
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'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
bool hasContainerValueType() const
Checks whether the value type is a data container itself.
static TQT_DBusData fromInt64KeyMap(const TQT_DBusDataMap< TQ_INT64 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:856
TQT_DBusDataList toList(bool *ok=0) const
Tries to get the encapsulated list.
Definition: tqdbusdata.cpp:649
Class to transport lists of D-Bus data types.
TQT_DBusData::Type keyType() const
Returns the key type of the map object.
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'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.
TQT_DBusData containerValueType() const
Returns a container prototype for the map's value type.
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
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:758
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:782
TQT_DBusDataMap< TQ_INT64 > toInt64KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:867
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
static TQT_DBusData fromUnixFdKeyMap(const TQT_DBusDataMap< TQT_DBusUnixFd > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:954
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:745
Private * d
Definition: tqdbusdata.h:1219
static TQT_DBusData fromStringKeyMap(const TQT_DBusDataMap< TQString > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:905
TQT_DBusDataMap< TQString > toStringKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:916
TQT_DBusDataMap< TQ_INT32 > toInt32KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:818
TQT_DBusDataMap< TQ_INT16 > toInt16KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:769
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:807
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:831
TQT_DBusDataMap< TQT_DBusObjectPath > toObjectPathKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:940
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:891
TQT_DBusDataMap< TQ_UINT16 > toUInt16KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:793
TQT_DBusDataMap< TQT_DBusUnixFd > toUnixFdKeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:965
static TQT_DBusData fromObjectPathKeyMap(const TQT_DBusDataMap< TQT_DBusObjectPath > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:929
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:979
bool isValid() const
Returns whether the current content is considered a valid object path.
static TQT_DBusData fromByteKeyMap(const TQT_DBusDataMap< TQ_UINT8 > &map)
Creates a data object for the given map.
Definition: tqdbusdata.cpp:734
TQT_DBusDataMap< TQ_UINT32 > toUInt32KeyMap(bool *ok=0) const
Tries to get the encapsulated map.
Definition: tqdbusdata.cpp:842