Wednesday, July 9, 2008

learn doxygen to document my code

Irene is really very nice girl who work very hard..

She works with me..I am very happy that I can learn so much from her as she graduated from computer science...

She know much program skill that I need.


Today

I learn how to use doxygen to document my code .
That will make my program more beautiful and easy to understand.


As I use suse Linux , it has installed doxygen, so I don't need to install it again.

Just do:

1,comment you file.
If this file is .cpp or .h, you need add /*! \file  "file's name"*/ to this headfile or source code file. If you don't do that ,you can't document it;
if you want to document some variable, you just need add /*!<"some comment"*/ after this variable.
you can use /def + macro name to document the definition of macro.
you can use /param or@param + [in/out]+"parameter's name" to document the function's document;
As in my head file, I will do this before a function:
//! "short comment about function"
/*!
"Detail comment"
or
@param[in] "parameter comments"
*/
Of course
you can use \fn to document a function, but you need write the function again. If you change function 's name or parameters , you also need remember to change the comment.so it's not convenient;



2,build configure file and html file
doxygen -g <your configure file's name which contain many setting informations. you can give a name or nothing.if nothing, then doxygen will build Doxygen file in present directory>

doxygen <configure file name>

then you can see html file in your directory.
open it and use firefox or other web browser to see it...
you will find your code is so beautiful....
I really enjoy it..

No comments: