简体   繁体   English

如何将非成员函数与Doxygen中的类相关联?

[英]How to associate non-member functions with a class in Doxygen?

I'm sure there's some way to do this with the \\defgroup, \\addgroup and \\@{ \\@} tags, but after a couple of hours of trial and (obviously) error, I'm asking SO..... 我确定用\\ defgroup,\\ addgroup和\\ @ {\\ @}标签有一些方法可以做到这一点,但经过几个小时的试用和(显然)错误,我问的是.....

I have: 我有:

class C {
public:
    void foo () const;
};

and I have some helper non-member functions that really are part of C's interface, but aren't in the class: 我有一些辅助非成员函数,它们确实是C接口的一部分,但不在类中:

std::string
format (const C& c, const std::string &fmt);

I'd like the format function to appear on the same page as the class functions. 我希望format函数与类函数出现在同一页面上。 Is that just not possible? 那是不可能的吗? Is the best I can do a "module" page, which lists C as a class (with a hyperlink to C's comments, and format as a function? 是最好的我可以做一个“模块”页面,它将C列为一个类(带有C的注释的超链接,格式为函数?

\\ related(或\\ memberof)似乎就是你要找的东西。

Creating a group and assigning functions outside of your class in that group will work, but in the class documentation itself, you won't get references to your functions unless you use commands such as @see or @sa . 在该组中创建一个组并在类外部分配函数将起作用,但在类文档本身中,除非使用诸如@see@sa命令,否则不会获得对函数的引用。 Honestly, because a function takes a documented parameter doesn't mean this function is automatically part of the library, but you can link both classes and functions together using @defgroup and @addgroup . 老实说,因为函数接受文档化参数并不意味着此函数自动成为库的一部分,但您可以使用@defgroup@addgroup两个类和函数链接在一起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM