向doxygen中的多个组添加一个函数

Adding a function to multiple groups in doxygen

我正在尝试向多个群组添加功能,但它似乎不起作用。

我遵循了 here

的说明

这是我添加的评论:

/**
 * \defgroup version1 version 1
 */

/**
 * \defgroup version2 version 2
 */

/**
 * \ingroup version1 version2
 */
BOOL CLoginFormDlg::OnInitDialog(){}

该函数只出现在version2模块中,version1模块中没有。

如果我这样写 version1 last:

/**
 * \ingroup version2 version1
 */
BOOL CLoginFormDlg::OnInitDialog(){}

那么该函数只出现在version1模块中,version2模块中没有。

我希望它们出现在两个模块中

您提供的 link 包含一段解释它为何不起作用的段落:

Note that compound entities (like classes, files and namespaces) can be put into multiple groups, but members (like variable, functions, typedefs and enums) can only be a member of one group (this restriction is in place to avoid ambiguous linking targets in case a member is not documented in the context of its class, namespace or file, but only visible as part of a group).

要考虑解决此问题的一种方法可能是为每个版本的代码创建不同的 Doxygen 项目。您将为每个版本创建一个 Doxyfile。

在这种情况下,与其尝试使用 \ingroup 命令在两组文档中 包含 公共代码,不如 排除 来自每个集合的不相关代码使用由 \if...\endif\cond...\endcond.

分隔的条件部分

因此在您的版本 1 模块中,您将执行以下操作:

/**
 * \if _VERSION1_
 */

    <all code in your version1 module>

/**
 * \endif
 */

并且在您的 version2 模块中:

/**
 * \if _VERSION2_
 */

    <all code in your version2 module>

/**
 * \endif
 */

需要出现在两个模块中的代码,例如您的 BOOL CLoginFormDlg::OnInitDialog(){} 函数,将没有此类条件命令,因此将包含在两组文档中。

在您的 version1 Doxyfile 中,添加以下行:

ENABLED_SECTIONS = _VERSION1_

并且在你的版本 2 Doxyfile 中:

ENABLED_SECTIONS = _VERSION2_

为了link你的version1和version2文档集在一起,你可以使用Doxygen的tag file机制。

另见