C++类操作符的Doxygen Out of Line记录

Sqe*_*aky 3 c++ doxygen

如果我在一个文件中有一个类我无法改变,但我需要在doxygen中记录,最好的方法是什么?我知道最好在实际的.h或.cpp文件中记录,但在这个特定的例子中,这是不可能的.

我已经想出如何记录一些成员,但我不能以可靠的方式记录操作员.让我举个例子.这是一个示例类,其中包含导致问题的成员和一个运行良好的成员:

class Foo
{
public:
    int Bar();
    bool operator!() const;
};
Run Code Online (Sandbox Code Playgroud)

在其他一些doxygen透视的文件中,我提出了以下内容:

/// @fn Foo::Bar
/// @brief Some info about the constructor
/// @return Some stuff about what bar returns
Run Code Online (Sandbox Code Playgroud)

构造函数的文档有效,但这不符合:

/// @fn Foo::operator!
/// @brief Some info about the operator
/// @return Some stuff about what the operator! returns
Run Code Online (Sandbox Code Playgroud)

也不是:

/// @fn operator!
/// @memberof Foo
/// @brief Some info about the operator
/// @return Some stuff about what the operator! returns
Run Code Online (Sandbox Code Playgroud)

我也尝试用%和%来逃避各个部分.所以它看起来像"/// @fn%operator!","/// @fn operator%!" 或"/// @fn运算符!" 但没有人喜欢这有帮助.

关于操作员的信息永远不会出现.有几次我尝试将一个独特的值放入操作员doxygen注释中并在doxygen输出中对它进行grepping并且我空了.我究竟做错了什么?

Sam*_*ler 6

如果你看看你的doxygen输出,应该有一个警告

/path/to/Documentation: warning: no matching class member found for
  Foo::operator!()
Possible candidates:
  bool Foo::operator!() const
Run Code Online (Sandbox Code Playgroud)

在这种情况下,将您的文档更改为

/// @fn Foo::operator!() const
/// @brief Some info about the operator
/// @return Some stuff about what the operator! returns
Run Code Online (Sandbox Code Playgroud)

请注意() const附加到@fn标识符的附加内容.