Doxygen:如何在多个组中包含元素

时间:2013-05-29 15:09:22

标签: grouping doxygen

Doxygen文档说\ ingroup可用于将实体添加到多个组:

\ingroup (<groupname> [<groupname> <groupname>])

问题是我尝试了它并且Doxygen将权利添加到组列表中的最后一个组。像

这样的东西
/** \ingroup A B
 * ...
 */

将元素添加到模块A,但不添加到B.有人知道原因,以及如何解决它?

我尝试使用Doxygen版本1.7.6.1和1.8.1.2。

感谢您的帮助。

编辑:我意识到doxygen会输出一个警告:

Member X found in multiple @ingroup groups! The member will be put in group B, and not in group A

在我看来,这与文档相矛盾。

答案:我回答自己。我试图将函数添加到多个组,但文档说“注意复合实体(如类,文件和命名空间)可以放在多个组中,但成员(如变量,函数,typedef和枚举)只能是一个一组成员“。

2 个答案:

答案 0 :(得分:8)

您通常(对于允许的项目,比方说文件)只需要编写具有多个组的内组。为了完整起见,让我展示一下我使用的模板:

/**
 * \file
 * \ingroup GrpTest GrpLicense
 * \brief Here your brief explanation
 * \details And you put here a more detailed explanation to the 
 * contents of the file.
 * \version 1.0
 * \date 2014-09-27
 * \author Dr Beco
 * \par Webpage
 * <<http://www.program.pg/>>
 * \copyright (c) 2014 GNU GPL v3
 * \note This program is free software: you can redistribute it
 * and/or modify it under the terms of the
 * GNU General Public License as published by
 * the Free Software Foundation version 3 of the License.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.
 * If not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA. 02111-1307, USA.
 * Or read it online at <<http://www.gnu.org/licenses/>>.
 * 
 */

现在,从Doxygen Documentation,特别是此处链接的页面,您可以阅读:

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).

因此,简而言之,遗憾的是,您无法添加一个函数(或者您没有指定的所有类型的实体)到多个组。

我希望此链接可以帮助您解决更多问题。

答案 1 :(得分:2)

使用

/** \ingroup A B
 * ...
 */
只有在其他地方定义项目时,

才会将项目添加到论坛AB。如果未定义组,则不会仅仅因为它在\ingroup命令中使用而定义。

您应该可以使用

获取组B中的项目
/** \defgroup B
 * @{
 * @}
 */
/** \ingroup A B
 * ...
 */