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)
500 TQMap<T, TQT_DBusData>::operator=(other);
524 TQMap<T, TQT_DBusData>::operator=(other);
529 const_iterator it = begin();
530 if (it == end())
return *
this;
532 m_valueType = (*it).type();
534 TQCString containerSignature;
535 if (hasContainerValueType())
537 m_containerValueType = it.data();
538 containerSignature = m_containerValueType.buildDBusSignature();
541 for (++it; it != end(); ++it)
543 if ((*it).type() != m_valueType)
551 else if (hasContainerValueType())
553 if (it.data()->buildSignature() != containerSignature)
640 bool isEmpty()
const {
return TQMap<T, TQT_DBusData>::empty(); }
649 uint
count()
const {
return TQMap<T, TQT_DBusData>::count(); }
666 if (m_valueType != other.
m_valueType)
return false;
668 if (count() != other.
count())
return false;
672 if (hasContainerValueType())
674 if (m_containerValueType.buildDBusSignature() !=
678 const_iterator it = begin();
679 const_iterator otherIt = other.
begin();
680 for (; it != end() && otherIt != other.
end(); ++it, ++otherIt)
682 if (it.key() != otherIt.key())
return false;
684 if (!(it.data() == otherIt.data()))
return false;
695 void clear() { TQMap<T, TQT_DBusData>::clear(); }
704 return TQMap<T, TQT_DBusData>::begin();
712 const_iterator
end()
const
714 return TQMap<T, TQT_DBusData>::end();
741 m_valueType = data.
type();
744 if (hasContainerValueType()) m_containerValueType = data;
746 TQMap<T, TQT_DBusData>::insert(key, data);
748 else if (data.
type() != m_valueType)
750 tqWarning(
"TQT_DBusDataMap: trying to add data of type %s to map of type %s",
753 else if (hasContainerValueType())
755 TQCString ourSignature = m_containerValueType.buildDBusSignature();
758 if (ourSignature != dataSignature)
760 tqWarning(
"TQT_DBusDataMap: trying to add data with signature %s "
761 "to map with value signature %s",
762 dataSignature.data(), ourSignature.data());
765 TQMap<T, TQT_DBusData>::insert(key, data);
768 TQMap<T, TQT_DBusData>::insert(key, data);
778 TQMap<T, TQT_DBusData>
toTQMap()
const {
return *
this; }
800 if (ok != 0) *ok =
false;
801 return TQMap<T, bool>();
804 TQMap<T, bool> result;
806 const_iterator it = begin();
807 const_iterator endIt = end();
808 for (; it != endIt; ++it)
810 result.insert(it.key(), (*it).toBool());
813 if (ok != 0) *ok =
true;
838 if (ok != 0) *ok =
false;
839 return TQMap<T, TQ_UINT8>();
842 TQMap<T, TQ_UINT8> result;
844 const_iterator it = begin();
845 const_iterator endIt = end();
846 for (; it != endIt; ++it)
848 result.insert(it.key(), (*it).toByte());
851 if (ok != 0) *ok =
true;
877 if (ok != 0) *ok =
false;
878 return TQMap<T, TQ_INT16>();
881 TQMap<T, TQ_INT16> result;
883 const_iterator it = begin();
884 const_iterator endIt = end();
885 for (; it != endIt; ++it)
887 result.insert(it.key(), (*it).toInt16());
890 if (ok != 0) *ok =
true;
916 if (ok != 0) *ok =
false;
917 return TQMap<T, TQ_UINT16>();
920 TQMap<T, TQ_UINT16> result;
922 const_iterator it = begin();
923 const_iterator endIt = end();
924 for (; it != endIt; ++it)
926 result.insert(it.key(), (*it).toUInt16());
929 if (ok != 0) *ok =
true;
955 if (ok != 0) *ok =
false;
956 return TQMap<T, TQ_INT32>();
959 TQMap<T, TQ_INT32> result;
961 const_iterator it = begin();
962 const_iterator endIt = end();
963 for (; it != endIt; ++it)
965 result.insert(it.key(), (*it).toInt32());
968 if (ok != 0) *ok =
true;
994 if (ok != 0) *ok =
false;
995 return TQMap<T, TQ_UINT32>();
998 TQMap<T, TQ_UINT32> result;
1000 const_iterator it = begin();
1001 const_iterator endIt = end();
1002 for (; it != endIt; ++it)
1004 result.insert(it.key(), (*it).toUInt32());
1007 if (ok != 0) *ok =
true;
1033 if (ok != 0) *ok =
false;
1034 return TQMap<T, TQ_INT64>();
1037 TQMap<T, TQ_INT64> result;
1039 const_iterator it = begin();
1040 const_iterator endIt = end();
1041 for (; it != endIt; ++it)
1043 result.insert(it.key(), (*it).toInt64());
1046 if (ok != 0) *ok =
true;
1072 if (ok != 0) *ok =
false;
1073 return TQMap<T, TQ_UINT64>();
1076 TQMap<T, TQ_UINT64> result;
1078 const_iterator it = begin();
1079 const_iterator endIt = end();
1080 for (; it != endIt; ++it)
1082 result.insert(it.key(), (*it).toUInt64());
1085 if (ok != 0) *ok =
true;
1110 if (ok != 0) *ok =
false;
1111 return TQMap<T, double>();
1114 TQMap<T, double> result;
1116 const_iterator it = begin();
1117 const_iterator endIt = end();
1118 for (; it != endIt; ++it)
1120 result.insert(it.key(), (*it).toDouble());
1123 if (ok != 0) *ok =
true;
1148 if (ok != 0) *ok =
false;
1149 return TQMap<T, TQString>();
1152 TQMap<T, TQString> result;
1154 const_iterator it = begin();
1155 const_iterator endIt = end();
1156 for (; it != endIt; ++it)
1158 result.insert(it.key(), (*it).toString());
1161 if (ok != 0) *ok =
true;
1183 if (ok != 0) *ok =
false;
1184 return TQMap<T, TQT_DBusObjectPath>();
1187 TQMap<T, TQT_DBusObjectPath> result;
1189 const_iterator it = begin();
1190 const_iterator endIt = end();
1191 for (; it != endIt; ++it)
1193 result.insert(it.key(), (*it).toObjectPath());
1196 if (ok != 0) *ok =
true;
1218 if (ok != 0) *ok =
false;
1219 return TQMap<T, TQT_DBusUnixFd>();
1222 TQMap<T, TQT_DBusUnixFd> result;
1224 const_iterator it = begin();
1225 const_iterator endIt = end();
1226 for (; it != endIt; ++it)
1228 result.insert(it.key(), (*it).toUnixFd());
1231 if (ok != 0) *ok =
true;
1256 if (ok != 0) *ok =
false;
1257 return TQMap<T, TQT_DBusVariant>();
1260 TQMap<T, TQT_DBusVariant> result;
1262 const_iterator it = begin();
1263 const_iterator endIt = end();
1264 for (; it != endIt; ++it)
1266 result.insert(it.key(), (*it).toVariant());
1269 if (ok != 0) *ok =
true;
uint count() const
Returns the number of key/value pairs of this map object.
TQMap< T, TQ_INT64 > toInt64Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_INT64.
const char * typeName() const
Returns the string representation of the object's Type.
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 fromInt64(TQ_INT64 value)
Creates a data object for the given signed 64-bit integer value.
Data type for representing a D-Bus variant.
bool operator==(const TQT_DBusDataMap< T > &other) const
Checks whether the given other map is equal to this one.
bool isEmpty() const
Checks whether this map object has any key/value pairs.
TQT_DBusData::Type valueType() const
Returns the value type of the map object.
TQMap< T, TQ_UINT8 > toByteMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_UINT8.
static TQT_DBusData fromObjectPath(const TQT_DBusObjectPath &value)
Creates a data object for the given object path value.
TQT_DBusData m_containerValueType
Class to transport maps of D-Bus data types.
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.
TQT_DBusDataMap< T > & operator=(const TQT_DBusDataMap< T > &other)
Copies from the given other map.
TQMap< T, TQT_DBusVariant > toVariantMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQT_DBusVariant.
Class for representing D-Bus unix file handles.
TQMapConstIterator< T, TQT_DBusData > const_iterator
bool hasContainerValueType() const
Checks whether the value type is a data container itself.
TQMap< T, double > toDoubleMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of double.
TQMap< T, TQ_UINT16 > toUInt16Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_UINT16.
bool isValid() const
Checks whether this map object has a valid value type.
TQMap< T, TQ_UINT32 > toUInt32Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_UINT32.
TQT_DBusData::Type keyType() const
Returns the key type of the map object.
TQT_DBusDataMap< T > & operator=(const TQMap< T, TQT_DBusData > &other)
Copies from the given other map.
static TQT_DBusData fromUInt64(TQ_UINT64 value)
Creates a data object for the given unsigned 64-bit integer value.
static TQT_DBusData fromInt16(TQ_INT16 value)
Creates a data object for the given signed 16-bit integer value.
TQT_DBusData containerValueType() const
Returns a container prototype for the map's value type.
Type type() const
Returns the Type of the data object.
bool insert(const T &key, const TQT_DBusData &data)
Inserts a given value for a given key.
static TQT_DBusData fromUnixFd(const TQT_DBusUnixFd &value)
Creates a data object for the given unix file handle value.
static const TQT_DBusData::Type m_keyType
TQMap< T, TQT_DBusObjectPath > toUnixFdMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQT_DBusUnixFd.
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.
const_iterator begin() const
Returns an iterator to the first item according to the key sort order.
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.
const_iterator end() const
Returns an iterator to an invalid position.
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 fromBool(bool value)
Creates a data object for the given boolean value.
TQMap< T, bool > toBoolMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of bool.
static TQT_DBusData fromInt32(TQ_INT32 value)
Creates a data object for the given signed 32-bit integer value.
TQT_DBusData::Type m_valueType
TQMap< T, TQ_INT16 > toInt16Map(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQ_INT16.
static TQT_DBusData fromUInt32(TQ_UINT32 value)
Creates a data object for the given unsigned 32-bit integer value.
static TQT_DBusData fromVariant(const TQT_DBusVariant &value)
Creates a data object for the given variant value.
Type
Enum for the data types used in D-Bus messages.
TQMap< T, TQT_DBusData > toTQMap() const
Converts the map object into a TQMap with TQT_DBusData elements.
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, TQString > toStringMap(bool *ok=0) const
Tries to get the map object's pairs as a TQMap of TQString.
void clear()
Clears the map.