[yast-commit] r55850 - /branches/tmp/lslezak/core/liby2dbus/src/DBusMsg.cc
Author: lslezak Date: Mon Mar 2 16:07:36 2009 New Revision: 55850 URL: http://svn.opensuse.org/viewcvs/yast?rev=55850&view=rev Log: - DBus service - added support for reading raw Dbus arrays and lists Modified: branches/tmp/lslezak/core/liby2dbus/src/DBusMsg.cc Modified: branches/tmp/lslezak/core/liby2dbus/src/DBusMsg.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/liby2dbus/src/DBusMsg.cc?rev=55850&r1=55849&r2=55850&view=diff ============================================================================== --- branches/tmp/lslezak/core/liby2dbus/src/DBusMsg.cc (original) +++ branches/tmp/lslezak/core/liby2dbus/src/DBusMsg.cc Mon Mar 2 16:07:36 2009 @@ -783,6 +783,58 @@ YCPTerm term(term_name, term_list); ret = term; } + else if (ycp_type.empty()) + { + y2debug("Reading RAW DBus array"); + + // is the container a map or a list? + if (dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_DICT_ENTRY) + { + y2debug("Found a map"); + + YCPMap map; + + while (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_INVALID) + { + // is it a map or a list? + if (dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_DICT_ENTRY) + { + DBusMessageIter mapit; + dbus_message_iter_recurse(&sub, &mapit); + + // read the key without the header + YCPValue key = getYCPValueRaw(&mapit); + + dbus_message_iter_next(&mapit); + + // read the value + YCPValue val = getYCPValueRaw(&mapit); + + map->add(key, val); + } + + dbus_message_iter_next(&sub); + } + + ret = map; + } + else + { + y2debug("Found a list"); + + YCPList lst; + + while (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_INVALID) + { + YCPValue list_val = getYCPValue(&sub); + lst->add(list_val); + + dbus_message_iter_next(&sub); + } + + ret = lst; + } + } else { y2error("Unknown container type for DBUS_TYPE_ARRAY: %s", ycp_type.c_str()); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org