add a function to handle maps of objectpaths

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
(cherry picked from commit f126c44916)
r14.0.x
Emanoil Kotsev 6 years ago committed by Slávek Banko
parent a06151a14f
commit f485bfd985
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -400,6 +400,19 @@ void qFetchUInt64KeyMapEntry(TQT_DBusDataMap<TQ_UINT64>& map, DBusMessageIter* i
map.insert(key, qFetchParameter(&itemIter)); 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) void qFetchStringKeyMapEntry(TQT_DBusDataMap<TQString>& map, DBusMessageIter* it)
{ {
DBusMessageIter itemIter; DBusMessageIter itemIter;
@ -487,8 +500,15 @@ static TQT_DBusData qFetchMap(DBusMessageIter *it, const TQT_DBusData& prototype
return TQT_DBusData::fromUInt64KeyMap(map); 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_STRING: // fall through
case DBUS_TYPE_OBJECT_PATH: // fall through
case DBUS_TYPE_SIGNATURE: { case DBUS_TYPE_SIGNATURE: {
TQT_DBusDataMap<TQString> map = prototype.toStringKeyMap(); TQT_DBusDataMap<TQString> map = prototype.toStringKeyMap();
do { do {
@ -545,16 +565,6 @@ static TQT_DBusData qFetchParameter(DBusMessageIter *it)
dbus_message_iter_recurse(it, &sub); dbus_message_iter_recurse(it, &sub);
return qFetchMap(&sub, prototypeList[0]); 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 { } else {
TQT_DBusDataList list = prototypeList[0].toList(); TQT_DBusDataList list = prototypeList[0].toList();

Loading…
Cancel
Save