引用命名空间中声明的静态常量变量

发布于 2024-10-16 09:09:07 字数 470 浏览 5 评论 0原文

我正在充实我的模块的 doxygen 文档,并遇到了一个奇怪的问题。当引用位于命名空间中的变量时,自动链接不起作用。这是一个片段:

namespace isa {

const double H_max= 10000; //!< @brief Maximum altitude in meters.

//! @brief Calculate air densitity at altitude \a H.
//! @throw argument_exception when \a H exceeds ::H_max.
double rho(double H);

} // namespace isa

我希望 doxygen 在函数 rho(double) 的异常描述处放置一个指向 H_max 的链接,以引导读者找到该常量。但只有当我离开名称空间时它才会起作用,否则自动链接将不起作用。

我做错了什么?

提前致谢。

I am fleshing out the doxygen documentation for my modules and came across a strange problem. When referencing variables located in a namespace autolinking does not work. Here is a snippet:

namespace isa {

const double H_max= 10000; //!< @brief Maximum altitude in meters.

//! @brief Calculate air densitity at altitude \a H.
//! @throw argument_exception when \a H exceeds ::H_max.
double rho(double H);

} // namespace isa

I would expect doxygen to put a link to H_max at the exception description of function rho(double) to direct the reader to the constant. But it only does if I leave away the namespace, otherwise autolinking does not work.

What am I doing wrong?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月亮邮递员 2024-10-23 09:09:12

好的,所以这里的问题不是 doxygen 的错误行为,而是对全局命名空间前缀 :: 工作方式的误解。

::H_max 标识在全局命名空间中定义的符号,即在任何命名空间之外。恐怕 - 如果我错了,请纠正我 - 您希望它充当父目录 .. 标识符。

当 doxygen 处理您提供的代码片段时,它不会链接异常描述中的 ::H_max ,因为它在全局命名空间中找不到 H_max 变量。如果删除双冒号前缀,它应该提供指向 isa::H_max 的链接。

OK, so the problem here is not a doxygen wrong behavior, but a misunderstanding on how the global namespace prefix :: works.

::H_max identifies a symbol defined in the global namespace, that is, out of any namespace. I'm afraid - correct me if I'm wrong - that you where expecting it to behave as the parent directory .. identifier.

When doxygen processes the code snippet you provided, it doesn't link ::H_max in the exception description because it cannot find a H_max variable in the global namespace. If you remove the double colon prefix, it should provide a link to isa::H_max.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文