具有Doxygen(C ++)的模板类中的typedef [英] typedef in template class with Doxygen (C++)

查看:68
本文介绍了具有Doxygen(C ++)的模板类中的typedef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与如何使用Doxygen在模板类中注释typedef有关.我将举一个例子来说明我的问题:

My question is related to how to comment typedef in template class with Doxygen. I will give an example to illustrate my question:

 namespace fundamental
  {
    /**
    * Basic function
    */
    template <typename T>
    class Base
    {
    public:
      T x; ///< x coordinate
      T y; ///< y coordinate
    };
    typedef Base<float> Coordinate; ///< Point coordinate class
  }

使用Doxygen处理上述代码后,我可以获得一个HTML页面来显示Base类的定义.但是,对于typedef类的Coordinate,它不会与Base出现在同一页面中.实际上,所有typedef类型以及此命名空间中的所有类都在基本命名空间页面中列出.我想知道是否可以在基本HTML"页面中显示Coordinate类.这样,Base和Coordinate之间的链接将更加紧密.谢谢!

After using Doxygen to process the above codes, I can obtain a HTML page to show the definition of the class Base. However, for the typedef class Coordinate, it will not appear in the same page with Base. In fact all the typedef types are listed in the fundamental namespace page along with all the classes in this namespace. I was wondering whether it is possible to show Coordinate class in the Base HTML page. By doing so, the link between Base and Coordinate will become much closer. Thanks!

推荐答案

typedef是命名空间的一部分,因此您必须记录命名空间才能使其显示,即:

The typedef is part of a namespace, so you must document the namespace for it to appear, i.e.:

/// documentation for the namespace
namespace fundamental
{
   ...
   typedef Base<float> Coordinate; ///< Point coordinate class
}

或者,您可以使用 @relates ,但这会将成员置于基类的相关函数下:

Alternatively you could use @relates but it this will put the member under Related Functions of the Base class:

/// @relates Base
/// Point coordinate class
typedef Base<float> Coordinate;

通过使用 doxygen -l <​​/code>创建布局文件,然后编辑两次出现的 related Related Members .生成的 DoxygenLayout.xml 中的code>元素,如下所示:

You can change this title to for instance Related Members by creating a layout file using doxygen -l and then editing the two occurrences of the related element in the generated DoxygenLayout.xml as follows:

<related title="Related Members"/>

这篇关于具有Doxygen(C ++)的模板类中的typedef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆