使用Doxygen记录命名空间 [英] Documenting namespaces with Doxygen
问题描述
我遇到了Doxygen识别命名空间和模块的问题。我相信问题围绕着是否将 \addtogroup
放在命名空间内或命名空间外。
I'm having issues with Doxygen recognizing namespaces and modules. I believe the issue surrounds whether to place the \addtogroup
within the namespace or outside the namespace.
/*!
* \addtogroup Records
* @{
*/
//! Generic record interfaces and implementations
namespace Records
{
//! Describes the record interface
class Interface;
} // End namespace Records
/*! @} End of Doxygen Groups*/
示例2 - 在命名空间内
Example 2 - within namespace
//! Generic record interfaces and implementations
namespace Records
{
/*!
* \addtogroup Records
* @{
*/
//! Describes the record interface
class Interface;
/*! @} End of Doxygen Groups*/
} // End namespace Records
我希望命名空间记录
出现在Doxygen 命名空间选项卡下,并且间接在模块点击命名空间页面中的项目应该会生成一个包含 Records :: Interface
的页面。点击模块标签中的项目也会生成一个包含 Records :: Interface
的页面。
I would like the namespace Records
to appear under the Doxygen Namespaces tab and indirectly under the Modules tab. Clicking on the item in the Namespaces page should produce a page containing Records::Interface
. Clicking on the item in the Modules tab should also produce a page containing Records::Interface
.
在我的Doxygen文档中,我有命名空间标签中缺少的模块项目,反之亦然,由于我这种困境造成的不一致。
In my Doxygen documentation, I have items missing from Namespaces tab that are in Modules and vice-versa, due to my inconsistency resulting from this dilemma.
那么这是正确的方法,例1或示例2?
{Doxygen手册不清楚此主题。}
Doxygen:\addtogroup
Doxygen:记录名称空间
So which is the proper method, Example 1 or Example 2?
{The Doxygen manual is not clear on this topic.}
Doxygen: \addtogroup
Doxygen: documenting namespaces
推荐答案
我已经使用Doxygen和两个例子进行了一个实验,这里是结果。
示例中的类名已重命名,以避免与Doxygen混淆。
I have performed an experiment using Doxygen and the two examples and here are the results. The class names in the examples have been renamed to avoid confusion with Doxygen.
/*!
* \addtogroup Records
* @{
*/
//! Generic record interfaces and implementations
namespace Records
{
//! Describes the record interface
class Interface;
} // End namespace Records
/*! @} End of Doxygen Groups*/
Doxygen结果:
单击模块按钮(在主栏中)。
单击窗口中的记录模块。
Doxygen Results:
Click on Modules button (in the main bar).
Click on "Records" module in the window.
//! Generic record interfaces and implementations
namespace Fields
{
/*!
* \addtogroup Fields
* @{
*/
//! Describes the record interface
class Interface;
/*! @} End of Doxygen Groups*/
} // End namespace Fields
Doxygen结果:
单击模块按钮(在主栏中)。
单击窗口中的记录模块。
Doxygen Results:
Click on Modules button (in the main bar).
Click on "Records" module in the window.
Doxygen的位置 \addtogroup
命令具有不同的结果,这取决于它是位于命名空间
定义内还是外部。当在命名空间外部声明时,Doxygen 模块选项卡将显示命名空间,如上面的示例1所示。当 \addtogroup
命令放置在命名空间内时,Doxygen Modules 选项卡不会显示上述示例2所示的命名空间。 如果您希望将命名空间列在Doxygen 模块选项卡中,请在命名空间外找到 \addtogroup
命令。 strong>
The location of Doxygen \addtogroup
command has different results depending on whether it is located within a namespace
definition or outside. When declared outside of a namespace, the Doxygen Modules tab will show the namespace, as shown in Example 1 above. When the \addtogroup
command is placed inside a namespace, the Doxygen Modules tab will not display the namespaces as shown in Example 2 above. If you want your namespace to be listed in the Doxygen Modules tab, locate the \addtogroup
command outside of the namespace.
这篇关于使用Doxygen记录命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!