使用Doxygen在C ++中记录函数

时间:2010-05-08 12:33:04

标签: c++ documentation doxygen

我有一个项目,我正在使用Doxygen来生成文档。这些类的文档很好,但我也有一些函数,我在main()中使用它来创建对象等。我也想将这些函数放入我的文档中,但我还没有想到如何做到这一点。有什么建议吗?

4 个答案:

答案 0 :(得分:23)

只有在记录了类的类时,才会记录属于类成员的实体。在命名空间范围内声明的实体仅在记录其命名空间时才会记录。在文件范围内声明的实体仅在其文件记录时才会记录。

因此,要记录全局命名空间中的自由函数,您还需要在头文件中的某个位置声明它:

/** @file */

或者像这样:

/*! \file */

答案 1 :(得分:10)

\fn \class区块中使用\\*!的地方使用*\

http://www.doxygen.nl/manual/docblocks.html 寻找“其他地方的文档”

http://www.doxygen.nl/manual/commands.html#cmdfn
它的工作方式类似于记录成员函数

答案 2 :(得分:5)

这种模式对我们很有用。

/*! Convert counts to kg for the reservoir.  
    \param counts The A/D counts to convert.` 
    \return The calculated kg based on the parameter.  
*/  
float RES_ConvertCountsToValue(uint_16 counts);  

答案 3 :(得分:2)

我喜欢这种模式

   ///////////////////////////////////////////////////////////////////////
   /// \brief setX
   /// \param x offset of the image.
   /// \return a new image as an QImage.
   /////////////////////////////////////////////////////////////////////////
    QImage  setX(int x);