Doxygen C/C++代码注释基本语法 您所在的位置:网站首页 书里的注释 Doxygen C/C++代码注释基本语法

Doxygen C/C++代码注释基本语法

2024-07-04 23:03| 来源: 网络整理| 查看: 265

该文译自Doxygen官方文档,仅作为学习规范自己代码之用,内容有增删,个人水平有限,难免有所错漏,欢迎指正,谢谢!

1.主要内容 如何给代码添加注释,以便于Doxygen将注释添加到生成的文档中 使代码注释在输出的文档中看起来更整洁 2.类C语言的注释

对于代码中的每行代码,都有两种(或在某些情况下为三种)注释,它们一起构成了该代码的功能描述;简要注释和详细注释都是可选的。对于方法和函数,还有第三种注释,即所谓的内部注释,它由方法或函数主体中找到的所有注释块的串联组成。

2.1详细注释的几种格式

A. Javadoc风格:

/** * ... text ... */

B.QT风格:

/*! * ... text ... */

注释中的*是可选的,可以省略

/*! ... text ... */

C.使用C++代码自带的斜杠注释方法(附加斜线或“!”): 注意:这种情况下空行会自动结束代码注释

/// /// ... text ... ///

//! //!... text ... //!

注意:这种情况下空行会自动结束代码注释 D.使注释更明显的注释风格:

/********************************************//** * ... text ***********************************************/

请注意两个斜杠以结束普通注释块并开始一个特殊注释块 或

/ /// ... text ... /

/************************************************ * ... text ***********************************************/

需设置JAVADOC_BANNER = YES

示例:

/** * A brief history of JavaDoc-style (C-style) comments. * * This is the typical JavaDoc-style C-style comment. It starts with two * asterisks. * * @param theory Even if there is only one possible unified theory. it is just a * set of rules and equations. */ void cstyle( int theory ); /******************************************************************************* * A brief history of JavaDoc-style (C-style) banner comments. * * This is the typical JavaDoc-style C-style "banner" comment. It starts with * a forward slash followed by so


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有