Branch: master

97bfc41b 2019-05-20 14:29:12 Michele Calgaro
Added methods to create a TQT_DBusDataMap<T> object from a TQMap<T, TQT_DBusDataMap<U> > 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 <michele.calgaro@...>
M src/tqdbusdatamap.h

src/tqdbusdatamap.h

diff --git a/src/tqdbusdatamap.h b/src/tqdbusdatamap.h
index ecb06d2..df212d0 100644
--- a/src/tqdbusdatamap.h
+++ b/src/tqdbusdatamap.h
@@ -486,6 +486,166 @@
     }
 
     /**
+     * @brief Creates a map from the given TQMap of TQT_DBusDataMap<TQ_UINT8> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQ_UINT8> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQ_UINT8> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT8> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT8> >::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<TQ_INT16> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQ_INT16> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQ_INT16> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQ_INT16> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQ_INT16> >::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<TQ_UINT16> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQ_UINT16> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQ_UINT16> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT16> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT16> >::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<TQ_INT32> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQ_INT32> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQ_INT32> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQ_INT32> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQ_INT32> >::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<TQ_UINT32> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQ_UINT32> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQ_UINT32> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT32> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT32> >::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<TQ_INT64> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQ_INT64> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQ_INT64> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQ_INT64> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQ_INT64> >::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<TQ_UINT64> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQ_UINT64> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQ_UINT64> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT64> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQ_UINT64> >::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<TQString> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQString> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQString> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQString> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQString> >::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<TQT_DBusObjectPath> values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQT_DBusObjectPath> values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQT_DBusObjectPath> >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQT_DBusObjectPath> >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQT_DBusObjectPath> >::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<TQT_DBusUnixFd > values
+     *
+     * @param other the TQMap of TQT_DBusDataMap<TQT_DBusUnixFd > values to copy from
+     */
+    TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusDataMap<TQT_DBusUnixFd > >& other)
+        : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::Map)
+    {
+        typename TQMap<T, TQT_DBusDataMap<TQT_DBusUnixFd > >::const_iterator it    = other.begin();
+        typename TQMap<T, TQT_DBusDataMap<TQT_DBusUnixFd > >::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
      *
      * This behaves basically like copying a TQMap through its assignment