24 #ifndef TQDBUSDATAMAP_H 25 #define TQDBUSDATAMAP_H 104 : TQMap<T, TQT_DBusData>(), m_valueType(simpleValueType) {}
117 : TQMap<T, TQT_DBusData>(), m_valueType(containerValueType.type())
119 if (hasContainerValueType()) m_containerValueType = containerValueType;
131 : TQMap<T, TQT_DBusData>(other), m_valueType(other.m_valueType),
132 m_containerValueType(other.m_containerValueType) {}
153 const_iterator it = begin();
154 if (it == end())
return;
156 m_valueType = (*it).type();
158 TQCString containerSignature;
159 if (hasContainerValueType())
161 m_containerValueType = it.data();
162 containerSignature = m_containerValueType.buildDBusSignature();
165 for (++it; it != end(); ++it)
167 if ((*it).type() != m_valueType)
175 else if (hasContainerValueType())
177 if (it.data().buildDBusSignature() != containerSignature)
204 typename TQMap<T, bool>::const_iterator it = other.
begin();
205 typename TQMap<T, bool>::const_iterator endIt = other.end();
206 for (; it != endIt; ++it)
227 typename TQMap<T, TQ_UINT8>::const_iterator it = other.
begin();
228 typename TQMap<T, TQ_UINT8>::const_iterator endIt = other.end();
229 for (; it != endIt; ++it)
250 typename TQMap<T, TQ_INT16>::const_iterator it = other.
begin();
251 typename TQMap<T, TQ_INT16>::const_iterator endIt = other.end();
252 for (; it != endIt; ++it)
273 typename TQMap<T, TQ_UINT16>::const_iterator it = other.
begin();
274 typename TQMap<T, TQ_UINT16>::const_iterator endIt = other.end();
275 for (; it != endIt; ++it)
296 typename TQMap<T, TQ_INT32>::const_iterator it = other.
begin();
297 typename TQMap<T, TQ_INT32>::const_iterator endIt = other.end();
298 for (; it != endIt; ++it)
319 typename TQMap<T, TQ_UINT32>::const_iterator it = other.
begin();
320 typename TQMap<T, TQ_UINT32>::const_iterator endIt = other.end();
321 for (; it != endIt; ++it)
342 typename TQMap<T, TQ_INT64>::const_iterator it = other.
begin();
343 typename TQMap<T, TQ_INT64>::const_iterator endIt = other.end();
344 for (; it != endIt; ++it)
365 typename TQMap<T, TQ_UINT64>::const_iterator it = other.
begin();
366 typename TQMap<T, TQ_UINT64>::const_iterator endIt = other.end();
367 for (; it != endIt; ++it)
388 typename TQMap<T, double>::const_iterator it = other.
begin();
389 typename TQMap<T, double>::const_iterator endIt = other.end();
390 for (; it != endIt; ++it)
411 typename TQMap<T, TQString>::const_iterator it = other.
begin();
412 typename TQMap<T, TQString>::const_iterator endIt = other.end();
413 for (; it != endIt; ++it)
434 typename TQMap<T, TQT_DBusObjectPath>::const_iterator it = other.
begin();
435 typename TQMap<T, TQT_DBusObjectPath>::const_iterator endIt = other.end();
436 for (; it != endIt; ++it)
457 typename TQMap<T, TQT_DBusUnixFd>::const_iterator it = other.
begin();
458 typename TQMap<T, TQT_DBusUnixFd>::const_iterator endIt = other.end();
459 for (; it != endIt; ++it)
480 typename TQMap<T, TQT_DBusVariant>::const_iterator it = other.
begin();
481 typename TQMap<T, TQT_DBusVariant>::const_iterator endIt = other.end();
482 for (; it != endIt; ++it)
497 typename TQMap<T, TQT_DBusDataMap<TQ_UINT8> >
::const_iterator endIt = other.end();
498 for (; it != endIt; ++it)
513 typename TQMap<T, TQT_DBusDataMap<TQ_INT16> >
::const_iterator endIt = other.end();
514 for (; it != endIt; ++it)
529 typename TQMap<T, TQT_DBusDataMap<TQ_UINT16> >
::const_iterator endIt = other.end();
530 for (; it != endIt; ++it)
545 typename TQMap<T, TQT_DBusDataMap<TQ_INT32> >
::const_iterator endIt = other.end();
546 for (; it != endIt; ++it)
561 typename TQMap<T, TQT_DBusDataMap<TQ_UINT32> >
::const_iterator endIt = other.end();
562 for (; it != endIt; ++it)
577 typename TQMap<T, TQT_DBusDataMap<TQ_INT64> >
::const_iterator endIt = other.end();
578 for (; it != endIt; ++it)
593 typename TQMap<T, TQT_DBusDataMap<TQ_UINT64> >
::const_iterator endIt = other.end();
594 for (; it != endIt; ++it)
609 typename TQMap<T, TQT_DBusDataMap<TQString> >
::const_iterator endIt = other.end();
610 for (; it != endIt; ++it)
625 typename TQMap<T, TQT_DBusDataMap<TQT_DBusObjectPath> >
::const_iterator endIt = other.end();
626 for (; it != endIt; ++it)
641 typename TQMap<T, TQT_DBusDataMap<TQT_DBusUnixFd > >
::const_iterator endIt = other.end();
642 for (; it != endIt; ++it)
660 TQMap<T, TQT_DBusData>::operator=(other);
684 TQMap<T, TQT_DBusData>::operator=(other);
689 const_iterator it = begin();
690 if (it == end())
return *
this;
692 m_valueType = (*it).type();
694 TQCString containerSignature;
695 if (hasContainerValueType())
697 m_containerValueType = it.data();
698 containerSignature = m_containerValueType.buildDBusSignature();
701 for (++it; it != end(); ++it)
703 if ((*it).type() != m_valueType)
711 else if (hasContainerValueType())
713 if (it.data()->buildSignature() != containerSignature)
800 bool isEmpty()
const {
return TQMap<T, TQT_DBusData>::empty(); }
809 uint
count()
const {
return TQMap<T, TQT_DBusData>::count(); }
826 if (m_valueType != other.
m_valueType)
return false;
828 if (count() != other.
count())
return false;
832 if (hasContainerValueType())
834 if (m_containerValueType.buildDBusSignature() !=
838 const_iterator it = begin();
839 const_iterator otherIt = other.
begin();
840 for (; it != end() && otherIt != other.
end(); ++it, ++otherIt)
842 if (it.key() != otherIt.key())
return false;
844 if (!(it.data() == otherIt.data()))
return false;
855 void clear() { TQMap<T, TQT_DBusData>::clear(); }
864 return TQMap<T, TQT_DBusData>::begin();
872 const_iterator
end()
const 874 return TQMap<T, TQT_DBusData>::end();
901 m_valueType = data.
type();
904 if (hasContainerValueType()) m_containerValueType = data;
906 TQMap<T, TQT_DBusData>::insert(key, data);
908 else if (data.
type() != m_valueType)
910 tqWarning(
"TQT_DBusDataMap: trying to add data of type %s to map of type %s",
913 else if (hasContainerValueType())
915 TQCString ourSignature = m_containerValueType.buildDBusSignature();
918 if (ourSignature != dataSignature)
920 tqWarning(
"TQT_DBusDataMap: trying to add data with signature %s " 921 "to map with value signature %s",
922 dataSignature.data(), ourSignature.data());
925 TQMap<T, TQT_DBusData>::insert(key, data);
928 TQMap<T, TQT_DBusData>::insert(key, data);
938 TQMap<T, TQT_DBusData>
toTQMap()
const {
return *
this; }
960 if (ok != 0) *ok =
false;
961 return TQMap<T, bool>();
964 TQMap<T, bool> result;
966 const_iterator it = begin();
967 const_iterator endIt = end();
968 for (; it != endIt; ++it)
970 result.insert(it.key(), (*it).toBool());
973 if (ok != 0) *ok =
true;
998 if (ok != 0) *ok =
false;
999 return TQMap<T, TQ_UINT8>();
1002 TQMap<T, TQ_UINT8> result;
1004 const_iterator it = begin();
1005 const_iterator endIt = end();
1006 for (; it != endIt; ++it)
1008 result.insert(it.key(), (*it).toByte());
1011 if (ok != 0) *ok =
true;
1037 if (ok != 0) *ok =
false;
1038 return TQMap<T, TQ_INT16>();
1041 TQMap<T, TQ_INT16> result;
1043 const_iterator it = begin();
1044 const_iterator endIt = end();
1045 for (; it != endIt; ++it)
1047 result.insert(it.key(), (*it).toInt16());
1050 if (ok != 0) *ok =
true;
1076 if (ok != 0) *ok =
false;
1077 return TQMap<T, TQ_UINT16>();
1080 TQMap<T, TQ_UINT16> result;
1082 const_iterator it = begin();
1083 const_iterator endIt = end();
1084 for (; it != endIt; ++it)
1086 result.insert(it.key(), (*it).toUInt16());
1089 if (ok != 0) *ok =
true;
1115 if (ok != 0) *ok =
false;
1116 return TQMap<T, TQ_INT32>();
1119 TQMap<T, TQ_INT32> result;
1121 const_iterator it = begin();
1122 const_iterator endIt = end();
1123 for (; it != endIt; ++it)
1125 result.insert(it.key(), (*it).toInt32());
1128 if (ok != 0) *ok =
true;
1154 if (ok != 0) *ok =
false;
1155 return TQMap<T, TQ_UINT32>();
1158 TQMap<T, TQ_UINT32> result;
1160 const_iterator it = begin();
1161 const_iterator endIt = end();
1162 for (; it != endIt; ++it)
1164 result.insert(it.key(), (*it).toUInt32());
1167 if (ok != 0) *ok =
true;
1193 if (ok != 0) *ok =
false;
1194 return TQMap<T, TQ_INT64>();
1197 TQMap<T, TQ_INT64> result;
1199 const_iterator it = begin();
1200 const_iterator endIt = end();
1201 for (; it != endIt; ++it)
1203 result.insert(it.key(), (*it).toInt64());
1206 if (ok != 0) *ok =
true;
1232 if (ok != 0) *ok =
false;
1233 return TQMap<T, TQ_UINT64>();
1236 TQMap<T, TQ_UINT64> result;
1238 const_iterator it = begin();
1239 const_iterator endIt = end();
1240 for (; it != endIt; ++it)
1242 result.insert(it.key(), (*it).toUInt64());
1245 if (ok != 0) *ok =
true;
1270 if (ok != 0) *ok =
false;
1271 return TQMap<T, double>();
1274 TQMap<T, double> result;
1276 const_iterator it = begin();
1277 const_iterator endIt = end();
1278 for (; it != endIt; ++it)
1280 result.insert(it.key(), (*it).toDouble());
1283 if (ok != 0) *ok =
true;
1308 if (ok != 0) *ok =
false;
1309 return TQMap<T, TQString>();
1312 TQMap<T, TQString> result;
1314 const_iterator it = begin();
1315 const_iterator endIt = end();
1316 for (; it != endIt; ++it)
1318 result.insert(it.key(), (*it).toString());
1321 if (ok != 0) *ok =
true;
1343 if (ok != 0) *ok =
false;
1344 return TQMap<T, TQT_DBusObjectPath>();
1347 TQMap<T, TQT_DBusObjectPath> result;
1349 const_iterator it = begin();
1350 const_iterator endIt = end();
1351 for (; it != endIt; ++it)
1353 result.insert(it.key(), (*it).toObjectPath());
1356 if (ok != 0) *ok =
true;
1378 if (ok != 0) *ok =
false;
1379 return TQMap<T, TQT_DBusUnixFd>();
1382 TQMap<T, TQT_DBusUnixFd> result;
1384 const_iterator it = begin();
1385 const_iterator endIt = end();
1386 for (; it != endIt; ++it)
1388 result.insert(it.key(), (*it).toUnixFd());
1391 if (ok != 0) *ok =
true;
1416 if (ok != 0) *ok =
false;
1417 return TQMap<T, TQT_DBusVariant>();
1420 TQMap<T, TQT_DBusVariant> result;
1422 const_iterator it = begin();
1423 const_iterator endIt = end();
1424 for (; it != endIt; ++it)
1426 result.insert(it.key(), (*it).toVariant());
1429 if (ok != 0) *ok =
true;
bool insert(const T &key, const TQT_DBusData &data)
Inserts a given value for a given key.
bool hasContainerValueType() const
Checks whether the value type is a data container itself.
const char * typeName() const
Returns the string representation of the object's Type.
static TQT_DBusData fromInt64(TQ_INT64 value)
Creates a data object for the given signed 64-bit integer value.
static TQT_DBusData fromUInt64KeyMap(const TQT_DBusDataMap< TQ_UINT64 > &map)
Creates a data object for the given map.
const_iterator end() const
Returns an iterator to an invalid position.
TQMap< T, TQ_UINT8 > toByteMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_UINT8.
TQT_DBusData::Type keyType() const
Returns the key type of the map object.
Data type for representing a D-Bus variant.
static const TQT_DBusData::Type m_keyType
TQMap< T, TQ_INT16 > toInt16Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_INT16.
uint count() const
Returns the number of key/value pairs of this map object.
TQMap< T, TQ_UINT32 > toUInt32Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_UINT32.
static TQT_DBusData fromObjectPath(const TQT_DBusObjectPath &value)
Creates a data object for the given object path value.
const_iterator begin() const
Returns an iterator to the first item according to the key sort order.
static TQT_DBusData fromString(const TQString &value)
Creates a data object for the given string value.
static TQT_DBusData fromByte(TQ_UINT8 value)
Creates a data object for the given byte (unsigned char) value.
Class for representing D-Bus unix file handles.
TQMap< T, TQT_DBusObjectPath > toObjectPathMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of object paths.
static TQT_DBusData fromInt64KeyMap(const TQT_DBusDataMap< TQ_INT64 > &map)
Creates a data object for the given map.
TQMap< T, TQT_DBusVariant > toVariantMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQT_DBusVariant.
TQT_DBusDataMap< T > & operator=(const TQMap< T, TQT_DBusData > &other)
Copies from the given other map.
TQMapConstIterator< T, TQT_DBusData > const_iterator
TQMap< T, TQ_UINT64 > toUInt64Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_UINT64.
TQMap< T, bool > toBoolMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of bool.
bool operator==(const TQT_DBusDataMap< T > &other) const
Checks whether the given other map is equal to this one.
static TQT_DBusData fromUInt64(TQ_UINT64 value)
Creates a data object for the given unsigned 64-bit integer value.
bool isValid() const
Checks whether this map object has a valid value type.
TQMap< T, TQT_DBusData > toTQMap() const
Converts the map object into a TQMap with TQT_DBusData elements.
static TQT_DBusData fromInt16(TQ_INT16 value)
Creates a data object for the given signed 16-bit integer value.
Type type() const
Returns the Type of the data object.
static TQT_DBusData fromUnixFd(const TQT_DBusUnixFd &value)
Creates a data object for the given unix file handle value.
bool isEmpty() const
Checks whether this map object has any key/value pairs.
TQMap< T, TQString > toStringMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQString.
TQT_DBusData::Type valueType() const
Returns the value type of the map object.
TQMap< T, TQ_UINT16 > toUInt16Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_UINT16.
Class for accurately representing D-Bus data types.
static TQT_DBusData fromUInt16(TQ_UINT16 value)
Creates a data object for the given unsigned 16-bit integer value.
static TQT_DBusData fromDouble(double value)
Creates a data object for the given double value.
Class for representing D-Bus object paths.
TQT_DBusData()
Creates an empty, Invalid data object.
TQCString buildDBusSignature() const
Creates the data objects D-Bus signature.
TQT_DBusDataMap< T > & operator=(const TQT_DBusDataMap< T > &other)
Copies from the given other map.
static TQT_DBusData fromInt16KeyMap(const TQT_DBusDataMap< TQ_INT16 > &map)
Creates a data object for the given map.
TQMap< T, TQ_INT64 > toInt64Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_INT64.
static TQT_DBusData fromUInt16KeyMap(const TQT_DBusDataMap< TQ_UINT16 > &map)
Creates a data object for the given map.
static TQT_DBusData fromBool(bool value)
Creates a data object for the given boolean value.
static TQT_DBusData fromUnixFdKeyMap(const TQT_DBusDataMap< TQT_DBusUnixFd > &map)
Creates a data object for the given map.
static TQT_DBusData fromInt32(TQ_INT32 value)
Creates a data object for the given signed 32-bit integer value.
static TQT_DBusData fromStringKeyMap(const TQT_DBusDataMap< TQString > &map)
Creates a data object for the given map.
TQMap< T, TQT_DBusObjectPath > toUnixFdMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQT_DBusUnixFd.
static TQT_DBusData fromUInt32(TQ_UINT32 value)
Creates a data object for the given unsigned 32-bit integer value.
TQT_DBusData m_containerValueType
static TQT_DBusData fromInt32KeyMap(const TQT_DBusDataMap< TQ_INT32 > &map)
Creates a data object for the given map.
static TQT_DBusData fromVariant(const TQT_DBusVariant &value)
Creates a data object for the given variant value.
static TQT_DBusData fromUInt32KeyMap(const TQT_DBusDataMap< TQ_UINT32 > &map)
Creates a data object for the given map.
TQT_DBusData::Type m_valueType
Type
Enum for the data types used in D-Bus messages.
static TQT_DBusData fromObjectPathKeyMap(const TQT_DBusDataMap< TQT_DBusObjectPath > &map)
Creates a data object for the given map.
Class to transport maps of D-Bus data types.
TQT_DBusData containerValueType() const
Returns a container prototype for the map's value type.
void clear()
Clears the map.
TQMap< T, TQ_INT32 > toInt32Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_INT32.
static TQT_DBusData fromByteKeyMap(const TQT_DBusDataMap< TQ_UINT8 > &map)
Creates a data object for the given map.
TQMap< T, double > toDoubleMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of double.