记录C中用doxygen的常数

发布于 2025-01-31 13:25:49 字数 1321 浏览 1 评论 0原文

我想用doxygen记录的c .h文件中有各种组的常数。

示例:轴,方向,可能的值。

#define TYPE_LAT 0x01
#define TYPE_LONG 0x02

#define NORTH 0x01
#define SOUTH 0x02
#define EAST 0x01
#define WEST 0x02

#define TROPIC_OF_CANCER 23.5
#define EQUATOR 0
#define PRIME_MERIDIAN 0
#define SYD_LAT_DIR SOUTH
#define SYD_LNG_DIR EAST
#define SYD_LAT_VAL 151.21
#define SYD_LNG_VAL 33.9

这些将是参数的论点:

void SetOneDimension(int axis, int direction, float value);

对于悉尼,我要做的:

SetOneDimension(TYPE_LAT, SYD_LAT_DIR, SYD_LAT_VAL);
SetOneDimension(TYPE_LNG, SYD_LNG_DIR, SYD_LNG_VAL);

理想情况下,我想对常数进行分类,我将它们显示为适当的“父母”的子段,如

Dimension types:

#define TYPE_LAT 0x01
    Directions:
    #define NORTH 0x01
    #define SOUTH 0x02
    #define SYD_LAT_DIR SOUTH
        Key Values:
        #define EQUATOR 0
        #define TROPIC_OF_CANCER 23.5
        #define SYD_LAT_VAL 151.21


#define TYPE_LAT 0x02
    Directions:
    #define EAST 0x01
    #define WEST 0x02
    #define SYD_LNG_DIR EAST   
        Key Values:
        #define PRIME_MERIDIAN 0
        #define SYD_LNG_VAL 33.9

:每个人的相关评论。这可以快速目击参数的有效集 /组合。上面的示例很简单 - 我实际上具有具有多个命令,子命令和可能值的功能。

Doxygen成员团体会很棒,但我认为他们不允许像我这样的子组。有可能使用模块组的可能性,但我将这些都超出了我在这里的关注。

您对如何使用doxygen有任何建议吗?

I have various groups of constants in a C .h file that I'd like to document with Doxygen.

Example: axis, direction, possible values.

#define TYPE_LAT 0x01
#define TYPE_LONG 0x02

#define NORTH 0x01
#define SOUTH 0x02
#define EAST 0x01
#define WEST 0x02

#define TROPIC_OF_CANCER 23.5
#define EQUATOR 0
#define PRIME_MERIDIAN 0
#define SYD_LAT_DIR SOUTH
#define SYD_LNG_DIR EAST
#define SYD_LAT_VAL 151.21
#define SYD_LNG_VAL 33.9

These would be arguments for parameters in a function like:

void SetOneDimension(int axis, int direction, float value);

and for Sydney I'd do:

SetOneDimension(TYPE_LAT, SYD_LAT_DIR, SYD_LAT_VAL);
SetOneDimension(TYPE_LNG, SYD_LNG_DIR, SYD_LNG_VAL);

Ideally in the documentation I'd like to categorise the constants where I show them as sub-sections to their appropriate "parents," like this:

Dimension types:

#define TYPE_LAT 0x01
    Directions:
    #define NORTH 0x01
    #define SOUTH 0x02
    #define SYD_LAT_DIR SOUTH
        Key Values:
        #define EQUATOR 0
        #define TROPIC_OF_CANCER 23.5
        #define SYD_LAT_VAL 151.21


#define TYPE_LAT 0x02
    Directions:
    #define EAST 0x01
    #define WEST 0x02
    #define SYD_LNG_DIR EAST   
        Key Values:
        #define PRIME_MERIDIAN 0
        #define SYD_LNG_VAL 33.9

with a relevant comment for each. This allows a quick sighting for valid sets / combinations of parameters. The example above is simple - I would actually have functions with multiple commands, sub-commands and possible values.

Doxygen member groups would be great but I don't think they allow sub-groups like I am after. There is the possibility of using module groups but I htink these go beyond what I'm after here.

Do you have any suggestions on how to document these with Doxygen?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文