如何使用Doxygen的“其他地方的文档”具有专门的模板类功能?

发布于 2024-10-31 07:14:49 字数 1308 浏览 5 评论 0原文

我面临着 Doxygen 的一个非常不重​​要的问题。但由于我无法在互联网上找到答案,并且我很好奇,所以我来这里请您分享您的知识。

当我在处理一个类时,我曾经在文档的标准位置定义小部分,但我也习惯在头文件的底部定义大的文档部分,例如代码示例或逐字记录,而不是在头文件的顶部定义它们每堂课。 那些我需要使用 Doxygen 的“其他地方的文档”功能。

这是一个有效的例子:

/** This is my class description */
class MyClass
    {
    ...
};


/*! @class MyClass
@code
    ...some code example
@endcode */

这通常效果很好。

但今天我尝试对专门的模板类使用相同的方法,但无法使其位于文档中的正确位置。

这是一个不起作用的例子:

/** This is my class description */
template < class Tr, class... Args >
class MyClass<Tr(Args...)> : public MyBaseClass {
    ...
};


/*! @class MyClass<Tr(Args...)>
@code
    ...some code example
@endcode */

我搜索了文档、Doxyfile 和互联网,但我仍然无法判断我是否没有按照应该做的那样去做,或者这是否是一个“错误”或非常规情况。

谢谢您的启发。


编辑:我用一个最简单的模板类(没有专门化)做了一些更多的测试,但这也不起作用。

/** This is my class description */
template < class Tr >
class MyClass
{
    ...
};


/*! @class MyClass // @class MyClass< Tr > // @class template < Tr > MyClass
@code
    ...some code example
@endcode */

我尝试在类名之后或之前指定模板,带或不带“template”关键字,并仅使用类名,但它似乎不起作用。


编辑 2:它确实适用于简单的模板类。之前的编辑测试不起作用,因为我已将类定义到名称空间中,而没有在 Doxygen 注释中指定名称空间:@class namespace::MyClass

但它仍然不适用于专用模板类,并且我仍然无法重定向专门模板类的注释块。

I'm facing a very unimportant problem with Doxygen. But as I was unable to find an answer over the Internet and as I am very curious, I come here to ask you to share your knowledge.

When I'm working on a class, I used to define small parts on documentation at their standard places, but I also used to define big documentation parts like code examples or verbatim at the bottom of the header file instead of defining them on top of each classes.
Those I need to use the "Documentation at other places" feature of Doxygen.

Here is a working example:

/** This is my class description */
class MyClass
    {
    ...
};


/*! @class MyClass
@code
    ...some code example
@endcode */

And that usually does work very well.

But today I'm trying to use the same method with a specialized template class, and I'm unable to make it go at the correct place in the documentation.

Here is a non working example:

/** This is my class description */
template < class Tr, class... Args >
class MyClass<Tr(Args...)> : public MyBaseClass {
    ...
};


/*! @class MyClass<Tr(Args...)>
@code
    ...some code example
@endcode */

I searched the documentation, the Doxyfile and over Internet but I'm still unable to tell if I don't do it as it should be done, or if this is a "bug" or non usual case.

Thank you for your enlightenment.


Edit : I did some more tests with a simplest template class (without specialization) and that does not work either.

/** This is my class description */
template < class Tr >
class MyClass
{
    ...
};


/*! @class MyClass // @class MyClass< Tr > // @class template < Tr > MyClass
@code
    ...some code example
@endcode */

I tried specifying the template after or before the class name, with or without the "template" keyword, and using the class name only, but it doesn't seems to work in any way.


Edit 2: It does works with simple template classes. The previous edit test was not working because I had defined the class into a namespace without specifying the namespace in the Doxygen comment : @class namespace::MyClass

But it still doesn't work with specialized template classes, and I am still unable to redirect a comment bloc to a specialized template class.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紅太極 2024-11-07 07:14:49

我认为你不应该把模板参数放在那里。做类似的事情:

/** This is my class description */
template < class Tr, class... Args >
class MyClass<Tr(Args...)> : public MyBaseClass {
    ...
};

/*! @class MyClass
@code 
    ...some code example
@endcode */

我不确定它是否有效(这里没有安装 doxygen),但我认为它应该有效。

I think you shouldn't put the template parameter there. Do something like that:

/** This is my class description */
template < class Tr, class... Args >
class MyClass<Tr(Args...)> : public MyBaseClass {
    ...
};

/*! @class MyClass
@code 
    ...some code example
@endcode */

I'm not sure if it works (don't have doxygen installed here), but I think it should.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文