如何通过qdbusxml2cpp在自动生成的绑定代码中添加头文件?
问题描述:
$ qdbusxml2cpp -v -c CustomIf -p customif.h:customif.cpp org.item.custom.xml如何通过qdbusxml2cpp在自动生成的绑定代码中添加头文件?
org.item.custom.xml
<node>
<interface name="org.pace.custom">
<method name="Send_Custom_Msg">
<arg name="msg" type="a(ii)" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="Message"/>
</method>
<signal name="LateEvent">
<arg name="eventkind" type="s" direction="out"/>
</signal>
</interface>
</node>
如何添加标题 - 消息.h在生成的适配器customif.h中?我不想手动添加它作为#include“message.h”,但实际上希望qdbusxml2cpp添加包含。
答
使用以下选项:
-i <filename> Add #include to the output
所以,这将是相应的命令:
qdbusxml2cpp -v -i message.h -c CustomIf -p customif.h:customif.cpp org.item.custom.xml
$ qdbusxml2cpp -c CustomIfAdaptor -a -i customifadaptor.h:customifadaptor.cpp org.pace .custom.xml在此命令中,添加message.h的位置 –