Doxygen注释块的位置

一 一般写法

通常注释写在代码前面,例如

/** @brief int value a */
int a;
int b;

二 写在代码后面

int a; /** @brief int value a */
int b;

此写法当Doxygen生成文档时其实并不是修饰的a,而是b,如果此时希望能正确修饰a,写法如下:

int a; /**< @brief int value a */
int b;

注释开始的位置需要加上<。

三 写在其他位置

注释除了前面和后面之外,Doxygen还支持识别写在其他位置的注释,此时需要一些特殊命令的支持。Doxygen支持很多命令,类似于C++的标识符,例如前面的brief就是Doxygen支持的命令之一,命令必须以@或者\开头,后面再详细探究,这里不展开。

// a.hpp
class Demo{};

// b.hpp

/**
 * @class Demo
 * @brief describe it in some other place.
 * 
 */

如上,在b.hpp中的注释可以修饰a.hpp中的Demo类。提前是b.hpp的位置能够被Doxygen读取到即可。这里使用了特殊命令class,用于Class类型,针对其他类型也有相应的特殊命令:

  • \struct to document a C-struct.
  • \union to document a union.
  • \enum to document an enumeration type.
  • \fn to document a function.
  • \var to document a variable or typedef or enum value.
  • \def to document a #define.
  • \typedef to document a type definition.
  • \file to document a file.
  • \namespace to document a namespace.
  • \package to document a Java package.
  • \interface to document an IDL interface.

四 参考

Doxygen注释块的位置 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值