当使用qdbusxml2cpp程序转换下面的XML到一个Qt类,我得到这个错误:qdbusxml2cpp未知类型
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英尺描述:
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)我知道nd我需要向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>
但是,我不知道注释应该是什么样的OA {{{SA SV}}},有人可以帮我明白了吗?谢谢!
鉴于注释语法不适用于我(Qt 5.9.2)。作为问题的作者,我从qdbusxml2cpp得到了同样的错误。 –
_(好吧,因为我试图修复答案被拒绝了,我不想发布全新的答案,只是为了解决这个完整和完美的答案这个小问题,我不得不写在这里修复,在评论中,我在哪里无法正确格式化代码。)_ XML语法的必需修改:每个'annotation'标签应该从'arg'标签中取出,并且在它之后单独放置。 **示例:** **而不是** [ ](http://dummy.url) –