?
在
google
上搜了很久的關(guān)于
Doxygen
使用方法的咚咚,只不過都是英文,而且都很多的規(guī)則。實(shí)際上大家只需要告訴基本的規(guī)則就可以。下面是我對
Doxygen
的摸索
?
首先熟知
Doxygen
產(chǎn)生的文件的基本結(jié)構(gòu)
(
以
Html
和
1.4.6
為例
)
Header
(頭部)
MainPage? Files ?Classes
?
那么我們首先建立兩個類吧,以典型的
Shape
和
它的繼承類
Rectangle
為例
(為了表示那些是我的解釋約定
~
為解釋符號
其他的頭文件和源文件的具體內(nèi)容)
// shape.h
?
~
在這個頭文件中首先要有一些關(guān)于本文件的一些信息或者公司的
copyright
信息
~
至于你想寫什么,發(fā)揮你的創(chuàng)意把。
?
/** \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
的兩個關(guān)鍵字
\author
為作者標(biāo)題
? \date
為日期標(biāo)題
?
* <pre>zengyongjoy@gmail.com</pre>
? <b>All rights reserved.</b>
*/
?
?
/** class shape define
?* this is the base class for all Shape
?*/
?
~
在
Shape
類定義的前面請加上解釋,否則這個類就不會產(chǎn)生很重要的
?
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
中加注釋比較好
~
每個函數(shù)的實(shí)現(xiàn)都必須加上注釋否則就沒有這個函數(shù)拉
?
/** default constructor*/
Shape
::Shape()
{
?
}
?
/** destructor */
Shape
::~Shape()
{
?
}
?
?
/** Draw funtion for this shape
?* \param CDC* pointer to MFC CDC
?*/
?
~ \param
為
Doxygen
的關(guān)鍵字
用于定義參數(shù)
~ \return
為返回關(guān)鍵字
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)
{
?
}
??
?
下面是
Doxygen
的主要操作步驟
首先我們在
MainPage
中看到
ProjectName
和
ProjectVersion
(在
Doxygen Wizhard Step1
中輸入就可以啦
)
??
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
然后在
Step2
中選擇保存文件的位置
?
Step3
選擇工作目錄
Step4
點(diǎn)擊
Start
按鈕,
ok
完成。
打開輸出文件的位置。
Html
文件就生成拉。