Author: lslezak Date: Thu Feb 5 16:33:46 2009 New Revision: 55283 URL: http://svn.opensuse.org/viewcvs/yast?rev=55283&view=rev Log: - fixed signature for YCPMap (key must be a simple complete type) - fixed returning void value Modified: branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc Modified: branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/dbus/namespac... ============================================================================== --- branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc (original) +++ branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc Thu Feb 5 16:33:46 2009 @@ -96,76 +96,76 @@ { Y2Namespace *ns = it->second; - if (ns) - { - unsigned symbols = ns->symbolCount(); - unsigned index = 0; - - while(index < symbols) + if (ns) { - SymbolEntryPtr symbol = ns->symbolEntry(index); + unsigned symbols = ns->symbolCount(); + unsigned index = 0; - if (symbol) + while(index < symbols) { - // name of the method - const char *name = symbol->name(); - // type - constTypePtr type = symbol->type(); + SymbolEntryPtr symbol = ns->symbolEntry(index); - if (type->isFunction()) + if (symbol) { - constFunctionTypePtr fptr = constFunctionTypePtr(type); + // name of the method + const char *name = symbol->name(); + // type + constTypePtr type = symbol->type(); - constTypePtr rettype = fptr->returnType(); + if (type->isFunction()) + { + constFunctionTypePtr fptr = constFunctionTypePtr(type); - DBusSignature sig; + constTypePtr rettype = fptr->returnType(); - // add return type - std::string rett(do_marshalling ? "(bsv)" : Y2Dtype(rettype)); + DBusSignature sig; - if (!rett.empty()) - { - sig.retval = DBusArgument("ret", rett); - } + // add return type + std::string rett(do_marshalling ? "(bsv)" : Y2Dtype(rettype)); - // add parameter types - int params = fptr->parameterCount(); - int parindex = 0; - DBusSignature::Params p; + if (!rett.empty()) + { + sig.retval = DBusArgument("ret", rett); + } - bool params_ok = true; - while(parindex < params) - { - std::string partype(do_marshalling ? "(bsv)" : Y2Dtype(fptr->parameterType(parindex))); + // add parameter types + int params = fptr->parameterCount(); + int parindex = 0; + DBusSignature::Params p; - if (!partype.empty()) + bool params_ok = true; + while(parindex < params) { - DBusArgument param("param", partype); - p.push_back(param); + std::string partype(do_marshalling ? "(bsv)" : Y2Dtype(fptr->parameterType(parindex))); + + if (!partype.empty()) + { + DBusArgument param("param", partype); + p.push_back(param); + } + else + { + y2warning("Function %s is not exported due to an unsupported parameter type", name); + params_ok = false; + break; + } + + parindex++; } - else + + if (params_ok) { - y2warning("Function %s is not exported due to an unsupported parameter type", name); - params_ok = false; - break; + sig.params = p; + // register the function: register_function(object, interface, method, signature, handler) + register_method(it->first, interface_prefix, name, sig, e); } - - parindex++; - } - - if (params_ok) - { - sig.params = p; - // register the function: register_function(object, interface, method, signature, handler) - register_method(it->first, interface_prefix, name, sig, e); } } - } - index++; + index++; + } } } - } } std::string DBusModulesServer::Y2Dtype(constTypePtr type) const @@ -184,8 +184,8 @@ case(YT_SYMBOL) : ret = DBUS_TYPE_STRING_AS_STRING; break; case(YT_LIST) : ret = DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_VARIANT_AS_STRING; break; /* av */ case(YT_MAP) : ret = DBUS_TYPE_ARRAY_AS_STRING - DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_VARIANT_AS_STRING - DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING; break; /* a{vv} */ + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING; break; /* a{sv} */ case(YT_TERM) : ret = DBUS_TYPE_STRING_AS_STRING; break; case(YT_CODE) : ret = DBUS_TYPE_STRING_AS_STRING; break; @@ -310,13 +310,21 @@ { y2milestone("Result: %s", ret->toString().c_str()); - if (interface == "org.opensuse.yast.modules.Values") + // return empty message for void functions + if (!ret->isVoid()) { - reply.addValue(ret); + if (interface == "org.opensuse.yast.modules.Values") + { + reply.addValue(ret); + } + else + { + reply.addYCPValue(ret); + } } else { - reply.addYCPValue(ret); + y2debug("Result is void"); } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org