转载:Doxygen 源代码文档自动生成器的使用笔记:

来源:互联网 发布:页面等待加载js插件 编辑:程序博客网 时间:2024/03/29 14:51

转载自:http://www.cppblog.com/richardzeng/archive/2006/03/23/4508.html

google 上搜了很久的关于 Doxygen 使用方法的咚咚,只不过都是英文,而且都很多的规则。实际上大家只需要告诉基本的规则就可以。下面是我对 Doxygen 的摸索

 

首先熟知 Doxygen 产生的文件的基本结构 ( Html 1.4.6 为例 )

Header (头部)

MainPage  Files  Classes

 

那么我们首先建立两个类吧,以典型的 Shape 它的继承类 Rectangle 为例

(为了表示那些是我的解释约定 ~ 为解释符号 其他的头文件和源文件的具体内容)

// shape.h

 

~ 在这个头文件中首先要有一些关于本文件的一些信息或者公司的 copyright 信息

~ 至于你想写什么,发挥你的创意把。

 

/** /file 

 * <pre><b>Richard Zeng Shape Class File Source</b></pre>

   ~ <pre></pre> 为居中显示

*  <pre><b>Copyright and Use</b></pre>

 

* /author Richard Zeng

* /date 2006-3-23

 

~ /author /date Doxygen 的两个关键字

/author 为作者标题

  /date 为日期标题

 

* <pre>zengyongjoy@gmail.com</pre>

  <b>All rights reserved.</b>

*/

 

 

/** class shape define

 * this is the base class for all Shape

 */

 

~ Shape 类定义的前面请加上解释,否则这个类就不会产生很重要的

 

class Shape{

public :

       Shape();

       ~Shape();

 

       virtual void Draw(CDC* pDC);

};

 

 

// shape.cpp

 

/** /file

* <pre><b>Richard Zeng Shape Class File Source</b></pre>

 

*  <pre><b>Copyright and Use</b></pre>

 

* /author Richard Zeng

* /date 2006-3-23

 

* <pre>zengyongjoy@gmail.com</pre>

<b>All rights reserved.</b>

*/

 

~ 上面的就不用说了吧

#include "shape.h"

 

~ 解释,随便你写什么都可以的

~ 这里我们可以看出在 CPP 中加注释比较好

~ 每个函数的实现都必须加上注释否则就没有这个函数拉

 

/** default constructor*/

Shape ::Shape()

{

 

}

 

/** destructor */

Shape ::~Shape()

{

 

}

 

 

/** Draw funtion for this shape

 * /param CDC* pointer to MFC CDC

 */

 

~ /param Doxygen 的关键字 用于定义参数

~ /return 为返回关键字

void Shape::Draw(CDC* pDC)

{

 

}

 

//Rectangle.h

/** /file __FILE__

* <pre><b>Richard Zeng Shape Class File Source</b></pre>

 

*  <pre><b>Copyright and Use</b></pre>

 

* /author Richard Zeng

* /date 2006-3-23

 

* <pre>zengyongjoy@gmail.com</pre>

<b>All rights reserved.</b>

*/

 

 

#include "shape.h"

 

 

/** Rectangle class define

*/

class Rectangle:publicShape{

public :

       Rectangle();

       ~Rectangle();

 

       void Draw(CDC*pDC);

 

private :

       int width,height;

};

 

 

//Rectangle.cpp

 

/** /file __FILE__

* <pre><b>Richard Zeng Shape Class File Source</b></pre>

 

*  <pre><b>Copyright and Use</b></pre>

 

* /author Richard Zeng

* /date 2006-3-23

 

* <pre>zengyongjoy@gmail.com</pre>

<b>All rights reserved.</b>

*/

 

 

/** default constructor */

Rectangle ::Rectangle()

{

 

}

 

/** destructor */

Rectangle ::~Rectangle()

{

 

}

 

 

/** Draw function

 * /param CDC* pointer to MFC CDC Class

 */

void Rectangle::Draw(CDC* pDC)

{

 

}


o_1.PNG  

 

下面是 Doxygen 的主要操作步骤

首先我们在 MainPage 中看到 ProjectName ProjectVersion (在 Doxygen Wizhard Step1

中输入就可以啦 )

    

 

  o_2.PNG

 

 

 

 

 

 

 

 

 

 

 

 

然后在 Step2

中选择保存文件的位置

 

Step3 选择工作目录

Step4 点击 Start 按钮, ok 完成。

打开输出文件的位置。 Html 文件就生成拉。

posted on 2006-03-23 22:32 Beginning to 编程 阅读(1296) 评论(3)  编辑 收藏 引用 所属分类: 心得体会

评论

# re: Doxygen 源代码文档自动生成器的使用笔记 2006-03-24 10:29 任我行

用过点点,写注释的时候需要掌握一些规则。
  回复  更多评论   

# re: Doxygen 源代码文档自动生成器的使用笔记 2006-03-24 13:19 沐枫

我以前做了一个doxygen标记的小结,希望有帮助。
http://ly4cn.cnblogs.com/archive/2005/11/23/282637.html  回复  更多评论   

# re: Doxygen 源代码文档自动生成器的使用笔记 2006-03-29 12:54 lvlouisaslia

太过简单了, Doxygen用起来是很方便, 但想要达到自己所设想的样式很难, 它里面的选项太多了, 都难完全搞懂  回复  更多评论