doxygen#

doxygen 是一种可以抽取C语言(不局限于C语言)中注释生成文档的一种工具。

../_images/2023-09-28-21-34-20.png

doxygen生成文档效果图#

如何安装doxygen的文章资料#

../_images/2023-09-28-21-30-59.png

doxygen windows版本下载#

配置笔记#

Doxygen 安装完成后可以使用图形化界面配置,配置文件默认叫 Doxyfile

Graphviz 可以生成函数关系图

../_images/2023-09-28-21-22-26.png

Graphviz 安装完之后需要将其 bin 文件夹添加到 环境变量

../_images/2023-09-28-21-25-14.png

配置文件 Doxyfile#

下图是我配置的文件,可以直接导入 Doxygen Gui 进行一定修改,免去下次所有选项重新配置的工作.

../_images/2023-09-28-21-27-18.png

Doxyfile

如何在代码中插入图片#

如果只是单纯的生成一个文档对于我来说意义不是很大,但是如果能文档中插入图片那就有点秀了。

效果演示#

../_images/2023-09-28-22-01-38.png

图片有点大😝#

备注

图片大的解决方案可以在后面加上 width=10cm 之类的语句可以控制宽度

doxygen gui配置#

../_images/2023-09-28-22-02-59.png

代码增加注释如下#

../_images/2023-09-28-22-03-33.png

vscode插件-Doxygen#

vcode 中在 C语言文件中 输入 /** 然后按 Enter 就会自动生成 doxygen 注释

下载插件 Doxygen Documentation Generator

../_images/2023-09-29-19-14-18.png

Doxygen Documentation Generator#

参考配置如下:

// Doxygen documentation generator set
"doxdocgen.file.copyrightTag": [
    "@copyright Copyright (c) {year} xxx"
],
"doxdocgen.file.customTag": [
    "@par 修改日志:",
    "<table>",
    "<tr><th>Date       <th>Version <th>Author  <th>Description",
    "<tr><td>{date} <td>0.0     <td>xxx     <td>内容",
    "</table>",
],
"doxdocgen.file.fileOrder": [
    "file",
    "brief",
    "author",
    "version",
    "date",
    "empty",
    "copyright",
    "empty",
    "custom"
],
"doxdocgen.file.fileTemplate": "@file {name}",
"doxdocgen.file.versionTag": "@version 0.0",
"doxdocgen.generic.authorEmail": "xxx@xxx.com",
"doxdocgen.generic.authorName": "xxx",
"doxdocgen.generic.authorTag": "@author {xxx} ({xxx@xxx.com})",

"doxdocgen.generic.order": [
    "brief",
    "tparam",
    "param",
    "return"
],
"doxdocgen.generic.paramTemplate": "@param{indent:8}{param}{indent:25}xxx",
"doxdocgen.generic.returnTemplate": "@return {type} ",
"doxdocgen.generic.splitCasingSmartText": true,

doxygen语法#

官网语法 command🔗

../_images/2023-09-29-19-30-06.png

Doxygen#

doxygen command#

命令

字段名

语法

@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 }

@link

连接(与@see类库,{@link www.google.com})

link <link-object>

@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>