如何从 doxygen 函数中的注释向 class 描述添加文档?
How to add documentation to the class description from a comment within a function in doxygen?
当使用带有 doxygen 的 C++ 时,我想从一个函数中添加到 class 描述中。我基本上想添加有关我正在进行的函数调用的信息。
class_name.h
/**
* This is the overall description of the class
*/
class ClassName
{
...
}
class_name.cpp:
void ClassName::randomFunction()
{
/**
* @class ClassName
*
* calls testData on stuff (this should be appended to the class description)
*/
testData(stuff);
}
氧气输出:
<b>Detailed Description</b>
<br>
This is the overall description of the class
<br>
calls testData on stuff
当我将注释放在函数外部时,此方法有效,但如果我将它放在 randomFunction 中,则不会显示在任何地方,如示例所示。最后,我希望文档的 reader 看到对 class 的描述,然后是示例中的代码片段。这样可以更轻松地使我的文档与代码保持同步,并立即告诉用户我正在调用的重要功能。
我想这样做的原因是在一个地方记录 class 发出的网络消息,而不是让用户搜索有关多个成员函数的文档。
编辑:
doxygen 版本为 1.8.5
补充说明
使用的doxygen版本(1.8.5, August 23, 2013)有点旧,建议更新到当前版本(1.8.17)。
要在其他地方拥有代码片段或文档片段,doxygen 也有命令 \snippet
(参见 http://doxygen.nl/manual/commands.html#cmdsnippet)。
为了在不同的地方对信息进行分组,doxygen 有像\defgroup
(http://doxygen.nl/manual/commands.html#cmddefgroup), \ingroup
(http://doxygen.nl/manual/commands.html#cmdingroup), \addtogroup
(http://doxygen.nl/manual/commands.html#cmdaddtogroup) 这样的分组命令。
另请参阅 doxgen 文档中的分组 chappetr (http://doxygen.nl/manual/grouping.html)。
当使用带有 doxygen 的 C++ 时,我想从一个函数中添加到 class 描述中。我基本上想添加有关我正在进行的函数调用的信息。
class_name.h
/**
* This is the overall description of the class
*/
class ClassName
{
...
}
class_name.cpp:
void ClassName::randomFunction()
{
/**
* @class ClassName
*
* calls testData on stuff (this should be appended to the class description)
*/
testData(stuff);
}
氧气输出:
<b>Detailed Description</b>
<br>
This is the overall description of the class
<br>
calls testData on stuff
当我将注释放在函数外部时,此方法有效,但如果我将它放在 randomFunction 中,则不会显示在任何地方,如示例所示。最后,我希望文档的 reader 看到对 class 的描述,然后是示例中的代码片段。这样可以更轻松地使我的文档与代码保持同步,并立即告诉用户我正在调用的重要功能。
我想这样做的原因是在一个地方记录 class 发出的网络消息,而不是让用户搜索有关多个成员函数的文档。
编辑: doxygen 版本为 1.8.5
补充说明
使用的doxygen版本(1.8.5, August 23, 2013)有点旧,建议更新到当前版本(1.8.17)。
要在其他地方拥有代码片段或文档片段,doxygen 也有命令 \snippet
(参见 http://doxygen.nl/manual/commands.html#cmdsnippet)。
为了在不同的地方对信息进行分组,doxygen 有像\defgroup
(http://doxygen.nl/manual/commands.html#cmddefgroup), \ingroup
(http://doxygen.nl/manual/commands.html#cmdingroup), \addtogroup
(http://doxygen.nl/manual/commands.html#cmdaddtogroup) 这样的分组命令。
另请参阅 doxgen 文档中的分组 chappetr (http://doxygen.nl/manual/grouping.html)。