我正在使用 Qt 在 Linux 构建机器上扩展 DBus 接口(interface)。现有的接口(interface)工作正常,我需要添加另一个参数
XML生成方法生成为:
<method name="get_card_info">
<arg type="b" name="success" direction="out" />
<arg type="s" name="version" direction="out" />
<arg type="s" name="serial" direction="out" />
<arg type="s" name="BeginDate" direction="out" />
<arg type="s" name="ExpirationDate" direction="out" />
<arg type="s" name="RenewalDate" direction="out" />
<arg type="s" name="ZipCode" direction="out" />
<arg type="s" name="ZipCodeExtension" direction="out" />
<!-- <arg type="u" name="cardStatus" direction="out" /> -->
</method>
代码工作正常,直到我取消注释行,此时 qdbusxml2cpp 报告:
interface_dbus_p.h:39:103: error: wrong number of template arguments (9, should be 8)
即使我注释掉对此函数的所有调用也是如此;事实上,这是在链接代码被编译之前;这全部来自 qdbusxml2cpp 调用。
如果我将其更改为六个、七个或八个项目,XML 将编译,但如果我将其增加到九个,它就会崩溃。
除了 XML 代码之外,我没有更改其他配置文件。
怎么了?有八个参数的限制吗?
最佳答案
找到了;是的,有一个限制,感谢 QDBusPendingReply
“QDBusPendingReply 是一个模板类,最多有 8 个模板参数。这些参数是将用于提取回复数据内容的类型。”
所以对我来说不超过 8 个参数:(
关于c++ - qdbusxml2cpp 的最大参数数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12528490/