【doxygen】doxygen 支持宏判断

配置 doxygen

在这里插入图片描述
定义自己的宏 HAL_CONFIG_USB

代码中判断宏

@if HAL_CONFIG_USB
your contents
@endif

需要注意的是 Doxygen不支持直接的 @elif 指令。Doxygen只提供了 @if @endif 指令来实现条件性文档生成。如果您需要多个条件进行判断,可以使用多个 @if 指令来实现,例如:

/**
 * @file example.h
 * @brief This is an example header file.
 */
#ifndef EXAMPLE_H
#define EXAMPLE_H
 /**
 * @brief This is a function that gets documented based on multiple conditions.
 *
 * @param[in] condition The condition to be checked.
 *
 * @if (HAL_CONFIG_USB)
 * This block is documented if condition is HAL_CONFIG_USB.
 * @endif
 *
 * @if (HAL_CONFIG_USBH)
 * This block is documented if condition is HAL_CONFIG_USBH.
 * @endif
 *
 * @if (HAL_CONFIG_USBD)
 * This block is documented if condition is HAL_CONFIG_USBD.
 * @endif
 */
void conditionalFunction(int condition);
 #endif // EXAMPLE_H

请确保每个 @if 都有对应的 @endif 来正确关闭条件块

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Doxygen 支持以下注释格式和标签: 1. C++ 风格的注释:以“///”或“//!”开头的注释,用于描述函数、类、成员变量等。 ```c++ /// This is a function that adds two integers. /// \param a The first integer to add. /// \param b The second integer to add. /// \return The sum of a and b. int add(int a, int b); ``` 2. C 风格的注释:以“/**”开头,以“*/”结尾的注释,用于描述函数、类、成员变量等。 ```c /** * This is a function that adds two integers. * @param a The first integer to add. * @param b The second integer to add. * @return The sum of a and b. */ int add(int a, int b); ``` 3. Qt 风格的注释:以“//!”开头的注释,用于描述类、成员变量等。 ```c++ //! This is a class that represents a person. class Person { public: //! The person's name. std::string name; //! The person's age. int age; }; ``` 4. JavaDoc 风格的注释:以“/**”开头,以“*/”结尾的注释,用于描述类、方法、参数、返回值等。 ```java /** * This is a class that represents a person. */ public class Person { /** * The person's name. */ public String name; /** * The person's age. */ public int age; } ``` Doxygen 支持的主要标签包括: - `\brief`:用于描述函数、类、成员变量等的简要说明。 - `\param`:用于描述函数的参数。 - `\return`:用于描述函数的返回值。 - `\author`:用于描述作者。 - `\date`:用于描述日期。 - `\version`:用于描述版本号。 - `\see`:用于引用其他相关文档或函数。 - `\todo`:用于标记待完成的任务。 - `\warning`:用于标记警告信息。 - `\note`:用于标记注释信息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值