当我使用qdbusxml2cpp程序将以下xml转换为Qt类时,出现了以下错误:
从这个网站(http://techbase.kde.org/Development/Tutorials/D-Bus/CustomTypes)我了解到,我需要在XML中添加注释才能使工具正常工作。
以下是我目前的进展:
qdbusxml2cpp -c ObjectManager -a ObjectManager:ObjectManager.cpp xml/object_manager.xml
Got unknown type `a{oa{sa{sv}}}'
You should add <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="<type>"/> to the XML description
D-Feet描述:
XML:
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node><interface name="org.freedesktop.DBus.Introspectable"><method name="Introspect"><arg name="xml" type="s" direction="out"/>
</method></interface><interface name="org.freedesktop.DBus.ObjectManager"><method name="GetManagedObjects"><arg name="objects" type="a{oa{sa{sv}}}" direction="out"/>
</method><signal name="InterfacesAdded"><arg name="object" type="o"/>
<arg name="interfaces" type="a{sa{sv}}"/>
</signal>
<signal name="InterfacesRemoved"><arg name="object" type="o"/>
<arg name="interfaces" type="as"/>
</signal>
</interface><node name="org"/></node>
从这个网站(http://techbase.kde.org/Development/Tutorials/D-Bus/CustomTypes)我了解到,我需要在XML中添加注释才能使工具正常工作。
以下是我目前的进展:
a{oa{sa{sv}}}
https://alteeve.ca/w/List_of_DBus_data_types
o == A UTF-8 string whose value is a valid DBus object path.
array { object_path array { string array { string variant } } }
<arg name="customdata" type="a{sv}" direction="in" />
QVariantMap in the arguments (type "a{sv}")
QMap<QString, QVariant>
然而,我不确定a{oa{sa{sv}}}的注释应该是什么,有人能帮助我理解吗?谢谢!
annotation
标签应该从arg
标签中取出,并单独放在它后面。 例子: <arg type="..." name="..."/><annotation name="..." value="..."/> 而不是 <arg type="..." name="..."><annotation name="..." value="..."/></arg> - Artem Pisarenko