summaryrefslogtreecommitdiffstats
path: root/tqdbusdatamap.h
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2013-11-18 21:21:15 +0100
committerSlávek Banko <[email protected]>2013-11-18 21:21:15 +0100
commit9a134f5699708c76d4abd12da71c9df03830556a (patch)
treeb44367da3f90252d7d9dffd12c71e1160174bd11 /tqdbusdatamap.h
parent52933e3b969e8b44f6a94db486cb27ddf5c322d7 (diff)
downloaddbus-1-tqt-9a134f5699708c76d4abd12da71c9df03830556a.tar.gz
dbus-1-tqt-9a134f5699708c76d4abd12da71c9df03830556a.zip
Add support for data type UnixFD
Diffstat (limited to 'tqdbusdatamap.h')
-rw-r--r--tqdbusdatamap.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/tqdbusdatamap.h b/tqdbusdatamap.h
index 24908c8..ecb06d2 100644
--- a/tqdbusdatamap.h
+++ b/tqdbusdatamap.h
@@ -29,6 +29,7 @@
class TQT_DBusData;
class TQT_DBusObjectPath;
+class TQT_DBusUnixFd;
class TQT_DBusVariant;
/**
@@ -439,6 +440,29 @@ public:
}
/**
+ * @brief Creates a map from the given TQMap of TQT_DBusUnixFd values
+ *
+ * Type information for the map object will be set to TQT_DBusData::UnixFd
+ * also when the @p other map is empty, i.e. this allows to create an
+ * empty but valid map object, comparable to using
+ * TQT_DBusDataMap<T>(TQT_DBusData::Type) with TQT_DBusData::UnixFd
+ *
+ * @param other the TQMap of TQT_DBusUnixFd values to copy from
+ *
+ * @see toUnixFdMap()
+ */
+ TQT_DBusDataMap<T>(const TQMap<T, TQT_DBusUnixFd>& other)
+ : TQMap<T, TQT_DBusData>(), m_valueType(TQT_DBusData::UnixFd)
+ {
+ typename TQMap<T, TQT_DBusUnixFd>::const_iterator it = other.begin();
+ typename TQMap<T, TQT_DBusUnixFd>::const_iterator endIt = other.end();
+ for (; it != endIt; ++it)
+ {
+ insert(it.key(), TQT_DBusData::fromUnixFd(it.data()));
+ }
+ }
+
+ /**
* @brief Creates a map from the given TQMap of TQT_DBusVariant values
*
* Type information for the map object will be set to TQT_DBusData::Variant
@@ -1175,6 +1199,41 @@ public:
}
/**
+ * @brief Tries to get the map object's pairs as a TQMap of TQT_DBusUnixFd
+ *
+ * @param ok optional pointer to a bool variable to store the
+ * success information in, i.e. will be set to @c true on success
+ * and to @c false if the conversion failed (not of value type
+ * TQT_DBusData::UnixFd)
+ *
+ * @return a TQMap of TQT_DBusUnixFd containing the map object's TQT_DBusUnixFd
+ * values or an empty map when converting fails
+ *
+ * @see TQT_DBusData::toUnixFd()
+ */
+ TQMap<T, TQT_DBusObjectPath> toUnixFdMap(bool* ok = 0) const
+ {
+ if (m_valueType != TQT_DBusData::UnixFd)
+ {
+ if (ok != 0) *ok = false;
+ return TQMap<T, TQT_DBusUnixFd>();
+ }
+
+ TQMap<T, TQT_DBusUnixFd> result;
+
+ const_iterator it = begin();
+ const_iterator endIt = end();
+ for (; it != endIt; ++it)
+ {
+ result.insert(it.key(), (*it).toUnixFd());
+ }
+
+ if (ok != 0) *ok = true;
+
+ return result;
+ }
+
+ /**
* @brief Tries to get the map object's pairs as a TQMap of TQT_DBusVariant
*
* This is a convenience overload for the case when the map is of