是否可以让 Doxygen 扩展枚举初始值设定项?

发布于 2024-10-24 18:41:33 字数 407 浏览 10 评论 0原文

对于以下输入:

enum A  
{  
  A1 = 1,
  A2 = 2  
};  
enum B  
{  
  B1 = A2,  
  B2 = A2 * A2 + 1  
}  

我希望 doxygen 扩展/解析 B::B1 和 B::B2 的初始值设定项。我希望在 B1 和 B2 的初始值设定项中使用 25,而不是 A2A2 * A2 + 1< /代码>。是否可以?如果可以,如何实现?
请注意,我只询问有关枚举初始值设定项的问题。这些在编译时是已知的,因此(理论上)doxygen 应该能够计算。

编辑:从枚举定义中删除了 ;

For the following input:

enum A  
{  
  A1 = 1,
  A2 = 2  
};  
enum B  
{  
  B1 = A2,  
  B2 = A2 * A2 + 1  
}  

I would like doxygen to expand/resolve initializers of B::B1 and B::B2. I would like to have respectably 2 and 5 in initializers of B1 and B2, rather then A2 and A2 * A2 + 1. Is it possible? If so, how can this be achieved?
Please mind that I am asking only about enum initializers. Those are known at the compile time, so (in theory) doxygen should be able to compute.

EDIT: Removed ; from enum definitions.

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

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

发布评论

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

评论(1

傲鸠 2024-10-31 18:41:33

我认为这是不可能的,但是,对于您提出的简单情况,您可以通过使用#define以某种方式伪造它这适用于您的代码,并且 doxygen 仍然可以解析这些值。

您的代码可能如下所示:

#define A_1 1
#define A_2 2
#define B_1 A_2
#define B_2 (A_2 * A_2 + 1)

enum A  
{  
  A1 = A_1,
  A2 = A_2
};

enum B  
{  
  B1 = B_1,
  B2 = B_2
};

并且在 doxygen 配置中,您需要启用 ENABLE_PREPROCESSINGMACRO_EXPANSION

I do not think this is possible, but, for a simple case as you presented, you can fake it by using #define in a way that would work for your code, and still be possible for doxygen to resolve the values.

Your code can look like this:

#define A_1 1
#define A_2 2
#define B_1 A_2
#define B_2 (A_2 * A_2 + 1)

enum A  
{  
  A1 = A_1,
  A2 = A_2
};

enum B  
{  
  B1 = B_1,
  B2 = B_2
};

And in the doxygen configuration you need to enable ENABLE_PREPROCESSING and MACRO_EXPANSION.

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