12

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 和枚举)只能是一个团体的成员”。

4

2 回答 2

10

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

/**
 * \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 文档,特别是此处链接的页面,您可以阅读:

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

因此,简而言之,不幸的是,您无法将函数(或您未指定的所有类型的实体)添加到多个组中。

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

于 2014-09-29T21:37:22.430 回答
4

用于

/** \ingroup A B
 * ...
 */

将项目添加到组中A,并且B仅当它们在其他地方定义时。如果未定义组,则不会因为在\ingroup命令中使用而被定义。

您应该可以B通过使用获取组中的项目

/** \defgroup B
 * @{
 * @}
 */
/** \ingroup A B
 * ...
 */
于 2017-01-31T18:13:55.520 回答