gpt4 book ai didi

c++ - Atomineer:确定返回类型是否为const

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:52:35 27 4
gpt4 key购买 nike

我正在使用 Atomineer 9.00 格式化我的代码注释,但我很难确定返回类型是否为 constdocumentation说明对于 MethodReturns,使用 %type% 将提供完整的返回类型(给出的示例是:const int*):

MethodReturns

Rules used to generate the description for the return values for methods (VB functions). The following special variables can be used in this section:

%type% The return type for the method (const int*)
%typeBase% The return type for the method, not including any modifiers (int)

但是,当我使用 %type% 时,它忽略了 const。来自 MethodReturns.xml 的示例:

<Set desc="zzz A %type%" />

将为该方法生成以下内容:

//! \brief  Performs the action.
//! \return zzz an int.
int PerformAction();

//! \brief Performs the different action.
//! \return zzz an int.
const int PerformDifferentAction();

//! \brief Practise action.
//! \return zzz A std::string&amp;
std::string& PractiseAction();

//! \brief Attempt action.
//! \return zzz A std::string&amp;
const std::string& AttemptAction();

struct Success;

//! \brief Performs the action with tips action.
//! \return zzz A success*.
Success* PerformActionWithTips();

//! \brief Succeed at action.
//! \return zzz An int*.
const int* SucceedAtAction();

我已经尝试了所有其他变体:%typeBase(来自 MethodReturns.xml)甚至 %retTypeBase%%retType%%typeBase%%specialType%(在记录 Methods.xml 中的方法时在确定返回类型时提到了这些)但是这些都不包括 const.

我还尝试了其他几种类型(doublestd::string 和自定义 struct),所以它不仅仅是int.

从上面的例子可以看出,我已经验证了我设置的描述确实是被调用的描述。

此外,这似乎完全适用于 Parameters.xml(确定参数类型是否为 const);但是,它似乎在 Methods.xml 中不起作用(其中 %retType% 可用于通过修饰符确定返回类型)

如何确定方法是否返回 const

最佳答案

这显然是 Atomineer 中的一个错误,并且在最新版本 (9.21.3.1510) 中仍然可以重现。正如在他们的规则和模板文档中所写的那样,MethodReturns.xml 中的 %type% 变量应该始终解析为完整类型(也包括 const-modifier)。那里的例子

%type% The return type for the method (const int*)

甚至使用了 const 修饰符并且应该解析为 (const int*) - 但不是。默认的 MethodReturns.xml 没有任何修改,问题仍然存在(即使使用了 %retType%,这根本不包含在 文档中 -但无论如何它的行为都是一样的:文档中没有显示 const 修饰符)。

我建议通过他们网站上的电子邮件 (support@atomineerutils.com) 联系 Atomineer Pro 文档的支持,并向他们报告此问题。

关于c++ - Atomineer:确定返回类型是否为const,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30448380/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com