【问题标题】:How to add documentation to the class description from a comment within a function in doxygen?如何从 doxygen 函数中的注释向类描述中添加文档?
【发布时间】:2020-06-24 12:57:55
【问题描述】:

当使用带有 doxygen 的 C++ 时,我想从函数中添加到类描述中。我基本上想添加有关我正在进行的函数调用的信息。

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 中,则不会显示在任何地方,如示例所示。最后,我希望文档的读者看到类的描述,然后是我在示例中的 sn-p。这样可以更轻松地使我的文档与代码保持同步,并立即告诉用户我正在调用的重要函数。

我想这样做的原因是在一个地方记录该类发出的网络消息,而不是让用户搜索有关多个成员函数的文档。

编辑: doxygen 版本是 1.8.5

补充说明

【问题讨论】:

  • 您使用的是哪个版本的 doxygen?类描述的位置和注释在这里有点奇怪,它表明该类调用了 testData,但实际上是 randomFunction。对你来说一些有趣的命令可能是\snippet\defgroup,至少当我理解这个问题时。很高兴看到您想要实现的结果的模型。
  • Doxygen 版本 1.8.5 非常旧 2013 年 8 月 23 日),请更新到当前版本(1.8.17)也许这会带来更好的结果(但我怀疑),我想你可能有去执行我之前提到的命令。
  • 我测试了小组方法,我认为这会满足我的需要。它允许我把所有重要的东西放在一个页面上,这是我的目标。如果您将该建议添加为答案,我会将其标记为已回答。

标签: c++ comments doxygen


【解决方案1】:

使用的doxygen(1.8.5,2013年8月23日)版本有点旧,建议更新到当前版本(1.8.17)。

要在其他地方有代码 sn-ps 或文档 sn-ps 以及 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 文档 (http://doxygen.nl/manual/grouping.html) 中的分组章节。

【讨论】:

    猜你喜欢
    • 2023-03-12
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 2018-01-12
    • 1970-01-01
    • 1970-01-01
    • 2015-09-14
    • 2016-05-20
    相关资源
    最近更新 更多