From 97bfc41b1b0c96544c9cee3b95825b5e4e8abdb0 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 18 May 2019 22:13:52 +0900 Subject: [PATCH] Added methods to create a TQT_DBusDataMap object from a TQMap > map. This fixes a compilation problem when objects with a signature like a{oa{...}} are generated. This refers to issue #7. Signed-off-by: Michele Calgaro --- src/tqdbusdatamap.h | 160 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/src/tqdbusdatamap.h b/src/tqdbusdatamap.h index ecb06d2..df212d0 100644 --- a/src/tqdbusdatamap.h +++ b/src/tqdbusdatamap.h @@ -485,6 +485,166 @@ public: } } + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromByteKeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromInt16KeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromUInt16KeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromInt32KeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromUInt32KeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromInt64KeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromUInt64KeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromStringKeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromObjectPathKeyMap(it.data())); + } + } + + /** + * @brief Creates a map from the given TQMap of TQT_DBusDataMap values + * + * @param other the TQMap of TQT_DBusDataMap values to copy from + */ + TQT_DBusDataMap(const TQMap >& other) + : TQMap(), m_valueType(TQT_DBusData::Map) + { + typename TQMap >::const_iterator it = other.begin(); + typename TQMap >::const_iterator endIt = other.end(); + for (; it != endIt; ++it) + { + insert(it.key(), TQT_DBusData::fromUnixFdKeyMap(it.data())); + } + } + /** * @brief Copies from the given @p other map *