【问题标题】:How to make doxygen include namespace members to group page如何使 doxygen 包含命名空间成员到组页面
【发布时间】:2019-06-30 04:16:19
【问题描述】:

我需要在 doxygen 组页面上获取所有类(和其他元素)的列表,即使它们是命名空间成员。 因此,如果我有类似这样的代码示例:

/*!
@defgroup test_group Example group
@{*/
    class some_class {};
/// @}

Doxygen 将生成组页面,包含我的“some_class”:

.

但是在命名空间添加 doxygen 之后,所有命名空间成员“隐藏”到新页面。下一个代码:

/*!
@defgroup test_group Example group
@{*/
namespace example_namespace {       
    class some_class {};
}
/// @}

产生一个组页面,包含指向命名空间页面的链接。

.

我们在群组页面上看不到命名空间成员。

接下来的 2 种方式给出相同的结果:

// 1. putting namespace content in brackets @{ @}:
    /// @defgroup test_group Example group        
    namespace example_namespace { 
        /*!
        @ingroup test_group 
        @{ */
        class some_class {};
        /// @}
    }        
// 2. putting namespace itself to group:

    /// @defgroup test_group Example group

    /// @ingroup test_group 
    namespace example_namespace {
        class some_class {};
    }

我想要一个组页面,它将包含来自命名空间和命名空间本身的所有类。我知道在类描述中添加“@ingroup”可以满足我的需求,但在实际程序中,一个命名空间中有数十个甚至数百个类。一定有更好的办法。

【问题讨论】:

    标签: c++ namespaces grouping doxygen


    【解决方案1】:

    我做了一些小测试和以下工作:

    /*!
    @defgroup test_group Example group
    @{*/
    namespace example_namespace {
        /*!
        @defgroup test_group Example group
        @{*/
        /** the class */
        class some_class {
          /*!
          @defgroup test_group Example group
          @{*/
          public:
             /** the fie */
             void fie(void);
          /// @}
        };
        /// @}
    };
    /// @}
    

    这有点开销,也许您还应该查看其他group 命令,例如\ingroup\addtogroup 以及手册中关于分组的段落。

    【讨论】:

    • 所以问题是如何在一个巨大的项目中避免成千上万的“复制粘贴”。 :)
    • 好的,我明白了,错过了问题的最后一段。我认为您只需在每个文件中添加一次\ingroup,其中类在命名空间中定义,也许它就足够了(没有测试它),创建一个(额外的).h 文件,只有命名空间和类名和适当的组。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-22
    • 2015-02-18
    • 1970-01-01
    • 2011-01-17
    • 2012-12-19
    • 2014-06-24
    • 1970-01-01
    相关资源
    最近更新 更多