使用Doxygen(C++)的模板类中的typedef

fee*_*ree 8 c++ doxygen

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

 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
  }
Run Code Online (Sandbox Code Playgroud)

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

dox*_*gen 5

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

/// documentation for the namespace
namespace fundamental
{
   ...
   typedef Base<float> Coordinate; ///< Point coordinate class
}
Run Code Online (Sandbox Code Playgroud)

或者你可以使用@relates但它会将成员置于Base类的相关函数下:

/// @relates Base
/// Point coordinate class
typedef Base<float> Coordinate;
Run Code Online (Sandbox Code Playgroud)

您可以通过创建布局文件,然后编辑生成的元素的两次出现,将此标题更改为例如相关成员,如下所示:doxygen -lrelatedDoxygenLayout.xml

<related title="Related Members"/>
Run Code Online (Sandbox Code Playgroud)