當使用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) –