1. 前言
一直知道写代码应该需要写注释, 写说明文档, 可是真正要单独写起来的时候真的非常讨厌, 直到后来发现了这么一个工具 doxygen, 真的非常好用, 他可以通过类似java 注释的风格进行编写注释, 然后通过他可以自动生成注释文档, 神器呀~~
代码注释风格 : http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html
markdown 风格: http://www.stack.nl/~dimitri/doxygen/manual/markdown.html
2. 具体使用
2.1 工具
doxygen wizard
几个注意点:
配置相机源码目录, 生成代码目录
设置 javadoc_autobrief
输入编码风格 gbk 支持中文(这个其实应该根据文件保存时候的编码格式进行设置, 我们的vs2013 默认为 gbk风格)
2.2 说明
下面是照着官网的文档敲的注释代码
/**
* \mainpage
* \section Paragraphs
* Here is text for one paragraph
*
* We continue with some text in anther paragraph
*
* \section Headers
* This is a level 1 header
* ========================
*
* This is a level 2 header
* ------------------------
*
* # This is a level 1 header
*
* ### This is level 3 header ###
*
* \section quotes
* > This is a block quote
* > spanning multiple lines
*
* > 0 if OK \n
*
* >1 if NOK
*
* \section Lists
*
* - Item 1
*
* More text for this item
*
* - Item 2
* + nested list item.
* + another nested item.
* - Item 3
*
* 1. First item.
* 2. Second item
*
* 6. Third item
*
* \section code
* This is a normal paragraph
*
* This is a code block
*
* we continue with a normal paragraph again
*
* \section rulers
* - - -
* hello
*
* -----
* hello2
*
* hi
*
* \section emphasis
* __single underscores__
*
* _hi_
*
* \section spans
* Use the `printf()` function
*
*
* \links
* [zhyh2010](http://www.zhyh2010.cn)
*
* I get 10 times more traffic from [Google] than from [Yahoo] or [MSN]
*
* [google]: http://google.com.cn/ "Google"
* [yahoo]: http://search.yahoo.com/ "Yahoo Search"
* [msn]: http://search.msn.com/ "MSN Search"
*
* ![apple_logo](C:\Users\Administrator\Desktop\doxygen test\apple_logo.png)
* ![apple_logo](..\apple_logo.png)
*
* \section table
* [TOC]
*
* \section next
*
* First Header | Second Header
* ------------- | ------------
* Content Cell | Content Cell
* Content Cell | Content Cell
*
* | Right | Center | Left |
* | ---: | :----: | :---- |
* | 10 | 10 | 10 |
* | 1000 | 1000 | 1000 |
*
* \section fenced code blocks
* This is a paragraph introducing
*
* ~~~
* a one-line code block
* ~~~
*
* ~~~{.py}
* # A class
* class Dummy:
* pass
* ~~~
*
* ~~~{.c}
* int func(int a, int b){ return a * b;}
* ~~~
*
* ```
* china joy
* ```
*
* \section header id attributes
* Header 1 {#labelid}
* ========
*
* ## Header 2 ## {#labelid2}
* [next](#next)
*
*/
/**
* A test class
*/
class Javadoc_Test{
public:
/**
* An enum
* More detailed enum description
*/
enum TEnum {
TVal1, /**< enum value TVal1 */
TVal2, /**< enum value TVal2 */
TVal3 /**< enum value TVal3 */
}
* enumPtr, /**< enum pointer. Details */
enumVar; /**< enum variable. Details */
/**
* A constructor.
* A more elaborate description of the constructor
*/
Javadoc_Test();
/**
* A destructor.
* A more elaborate description of the destructor
*/
~Javadoc_Test();
/**
* a normal member taking two arguments and returning an integer value.
* @param a [description]
* @param s [description]
* @see Javadoc_Test()
* @see ~Javadoc_Test()
* @see testMeToo()
* @see publicVar()
* @return [description]
*/
int testMe(int a, const char * s);
/**
* A pure virtual member.
* @see testMe()
* @param c1 [description]
* @param c2 [description]
*/
virtual void testMeToo(char c1, char c2) = 0;
/**
* a public variable
* Details
*/
int publicVar;
/**
* a function variable
* Details
*/
int (*handler)(int a, int b);
};
2.3 实现效果