Doxygen语法

版权声明:本文为itas109原创文章,未经允许不得转载引用或用于商业用途。【http://blog.csdn.net/itas109】【[email protected]】 https://blog.csdn.net/itas109/article/details/86479661

Doxygen语法


如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033

环境:

Doxygen:1.8.5


前言

Doxygen提供了大量特殊命令,XML命令和HTML命令。可用于增强或构建注释块内的文档。如果由于某种原因需要定义新命令,则可以通过别名定义来实现。

1.特殊命令(Special Commands)简介

所有命令都以反斜杠(\)或at符号(@)开头。

这里列出常用的命令

命令 字段名 语法
@file 文件名 file [<name>]
@brief 简介 brief { brief description }
@author 作者 author { list of authors }
@mainpage 主页信息 mainpage [(title)]
@date 年-月-日 date { date description }
@version 版本号 version { version number }
@copyright 版权 copyright { copyright description }
@param 参数 param [(dir)] <parameter-name> { parameter description }
@return 返回 return { description of the return value }
@retval 返回值 retval <return value> { description }
@bug 漏洞 bug { bug description }
@details 细节 details { detailed description }
@pre 前提条件 pre { description of the precondition }
@see 参考 see { references }
@throw 异常描述 throw <exception-object> { exception description }
@todo 待处理 todo { paragraph describing what is to be done }
@warning 警告信息 warning { warning message }
@deprecated 弃用说明。可用于描述替代方案,预期寿命等 deprecated { description }
@example 示例 example[{lineno}] <file-name>

2.文件注释

一般放在文件开头

/**
 * @file 文件名
 * @brief 简介
 * @details 细节
 * @author 作者
 * @version 版本号
 * @date 年-月-日
 * @copyright 版权
 */

示例

/**
 * @file Test.h
 * @brief 测试头文件
 * @details 测试Doxygen
 * @author admin
 * @version 1.0.0
 * @date 2019-01-14
 * @copyright MIT
 */

3.类注释

类对象的注释

 /**
 * @brief 类的详细描述
 */

示例

/**
 * @brief  The Test class
 * 测试类
 */
 class Test{

  };

4.函数注释

    /**
     * @brief 函数描述
     * @param 参数描述
     * @return 返回描述
     * @retval 返回值描述
     */

示例

    /**
     * @brief isExcellent 是否为优秀
     * @param score 分值 0 - 100
     * @return 是否为优秀
     * @retval false 不是优秀
     * @retval true 优秀
     */
    bool isExcellent(int score);

5.常量/变量注释

一般常量/变量可以有两种形式:

  • 常量/变量上一行注释
  • 常量/变量后注释

5.1 常量/变量上一行注释

/// 分值
int score;

/**
 * @brief score 分值
 */
int score;

5.2 常量/变量后注释

int score; /*!< 分值 */
int score; /**< 分值 */
int score; //!< 分值
int score; ///< 分值

Reference:

  1. http://www.doxygen.nl/manual/commands.html
  2. http://www.doxygen.nl/manual/docblocks.html

觉得文章对你有帮助,可以扫描二维码捐赠给博主,谢谢!
在这里插入图片描述
如需转载请标明出处:http://blog.csdn.net/itas109
QQ技术交流群:129518033

猜你喜欢

转载自blog.csdn.net/itas109/article/details/86479661