【问题标题】:Extended Module/Group Documentation in external file外部文件中的扩展模块/组文档
【发布时间】:2015-11-17 16:46:11
【问题描述】:

我有一个可能很简单的问题,但我的 Google-Fu 没有产生任何结果。

我有一个这样的 doxygen 记录的头文件:

/**
 * @file filename.h
 *
 * @date today
 * @author me
 *
 *  @defgroup mygroup grouptitle
 *  @brief my nice functions
 *
 *  Here is a medium sized description, 4-5 lines, which outline the
 *  functions and the way these functions work together, what is init,
 *  what is the main function of this module and maybe additional
 *  information on used hardware (as it is mainly embedded software).
 *
 *  Here starts another description block, typical length around 20-50
 *  lines. Detailed Hardware description, code snippets as examples and
 *  so on. I want to remove this section from the header file and
 *  replace it by something like
 *  /special_doyxgen_command_to_insert extended_doc_mygroup.md
 *
 *  \addtogroup mygroup
 *  @{
 */

here are function definitions, enums, defines and what else

/** @} */

我不知道这是否可行,但我有一个额外的 mygroup.md,其中给出了一些示例并显示了一般用法。根据文件的不同,它有 10 到 50 行,主要是 1 或 2 个代码示例。

过去我在头文件/源文件中插入了示例,但我不喜欢这种方法,所以我创建了一个 markdown 文件并通过 doxygen ref 函数链接到这个文件。 我想要的是在我的组文档(HTML 和 Latex 文件)的“详细描述”部分中插入 .md 竞争的“插入”标签。

是否有这样的命令(或一组命令来获取我的方法?)

【问题讨论】:

  • 一些观察:1) 头文件用于提取/本地化跨多个文件所需的信息,因此它不应包含源文件。 2)defgroup 标签应该在本地 doxygen 初始化文件中,而不是埋在头文件中。
  • 啊,我看到这可能写得不好:我有一个带有上述代码的 *.h,包括 /defgroup mygroup title 语句,然后是 /addgroup mygroup。 “我的代码来了”是所有定义,没有声明,没有实际功能。这些在 *.c 文件中。我在文档here 中没有看到 doxygen 初始化文件的情况。我编辑了我的初始问题以使其更清楚。
  • doxygen 手册:stack.nl/~dimitri/doxygen/manual/starting.html>,第二段说:“可选地,可以使用可执行的 doxywizard,它是一个图形前端,用于编辑配置文件由 doxygen 使用并在图形环境中运行 doxygen。对于 Mac OS X,doxywizard 将通过单击 Doxygen 应用程序图标来启动。"
  • 我的错误,defgroup 可以在 doxygen 评论块中,很抱歉造成混淆。

标签: c doxygen


【解决方案1】:

有许多命令可以在您的文档中包含外部代码示例。查看配置标签EXAMPLE_PATH 和特殊命令@include@snippet。您可以创建一个名为“examples”的目录,将示例文件放入其中并通过在EXAMPLE_PATH 标签中输入此目录来告诉 doxygen:

EXAMPLE_PATH  = ./examples

然后创建一些示例文件,例如:examples_1.c

/// [Example1]
/// Here some more text to explain the example which is not shown by the \@snippet command.

// But normal comments are shown as a part of the code
for(;;)
{
     doSomething();
}
/// [Example1]

/// [Example2]
while(1)
{
    doSomething2();
}
/// [Example2]

现在您可以在您的组文档中使用@snippet 命令添加这些代码 sn-ps:

/**
* @defgroup ...
* ...
* @snippet examples_1.c Example1
* ...
* @snippet examples_1.c Example2
*/

您也可以包含整个源文件的代码:

/**
* ...
* @include examples_2.c 
* ...
*/

您应该注意的另一个方法是@copydoc@copydetails 命令的用法。

希望这能回答你的问题。

【讨论】:

    猜你喜欢
    • 2016-11-17
    • 1970-01-01
    • 2017-12-12
    • 1970-01-01
    • 2012-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多