summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmanoil Kotsev <deloptes@gmail.com>2018-10-08 23:31:34 +0200
committerSlávek Banko <slavek.banko@axis.cz>2018-12-19 01:36:16 +0100
commitf126c449160792023e039c19e155242791728389 (patch)
tree50ad5e4889e8db893d3626b2f40bb1f02f7dff82
parent93e096976beab7a5c831f06c22fddaaf8aa986a1 (diff)
downloaddbus-1-tqt-f126c449160792023e039c19e155242791728389.tar.gz
dbus-1-tqt-f126c449160792023e039c19e155242791728389.zip
add a function to handle maps of objectpaths
Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
-rw-r--r--tqdbusmarshall.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/tqdbusmarshall.cpp b/tqdbusmarshall.cpp
index 7c21619..7f0781f 100644
--- a/tqdbusmarshall.cpp
+++ b/tqdbusmarshall.cpp
@@ -400,6 +400,19 @@ void qFetchUInt64KeyMapEntry(TQT_DBusDataMap<TQ_UINT64>& map, DBusMessageIter* i
map.insert(key, qFetchParameter(&itemIter));
}
+void qFetchObjectPathKeyMapEntry(TQT_DBusDataMap<TQT_DBusObjectPath>& map, DBusMessageIter* it)
+{
+ DBusMessageIter itemIter;
+ dbus_message_iter_recurse(it, &itemIter);
+ Q_ASSERT(dbus_message_iter_has_next(&itemIter));
+
+ TQT_DBusObjectPath key = qFetchParameter(&itemIter).toObjectPath();
+
+ dbus_message_iter_next(&itemIter);
+
+ map.insert(key, qFetchParameter(&itemIter));
+}
+
void qFetchStringKeyMapEntry(TQT_DBusDataMap<TQString>& map, DBusMessageIter* it)
{
DBusMessageIter itemIter;
@@ -487,8 +500,15 @@ static TQT_DBusData qFetchMap(DBusMessageIter *it, const TQT_DBusData& prototype
return TQT_DBusData::fromUInt64KeyMap(map);
}
+ case DBUS_TYPE_OBJECT_PATH: {
+ TQT_DBusDataMap<TQT_DBusObjectPath> map = prototype.toObjectPathKeyMap();
+ do {
+ qFetchObjectPathKeyMapEntry(map, it);
+ } while (dbus_message_iter_next(it));
+
+ return TQT_DBusData::fromObjectPathKeyMap(map);
+ }
case DBUS_TYPE_STRING: // fall through
- case DBUS_TYPE_OBJECT_PATH: // fall through
case DBUS_TYPE_SIGNATURE: {
TQT_DBusDataMap<TQString> map = prototype.toStringKeyMap();
do {
@@ -545,16 +565,6 @@ static TQT_DBusData qFetchParameter(DBusMessageIter *it)
dbus_message_iter_recurse(it, &sub);
return qFetchMap(&sub, prototypeList[0]);
-
-// } else if (arrayType == DBUS_TYPE_BYTE) {
-// DBusMessageIter sub;
-// dbus_message_iter_recurse(it, &sub);
-// int len = dbus_message_iter_get_array_len(&sub);
-// char* data;
-// dbus_message_iter_get_fixed_array(&sub,&data,&len);
-// return TQCString(data,len);
-// } else {
-
} else {
TQT_DBusDataList list = prototypeList[0].toList();