我正在尝试为我编写的模块编写一些通用文档,并希望operator<<在文档中引用我的方法.
我已将问题归结为几个示例文件.
C++源码
namespace outer {
namespace inner {
/** The example class is called Foo. */
class Foo
{
public:
/** Stream an int pointlessly to Foo.
* @param i Some integer that serves no purpose.
* @return The foo you invoked << upon.
*/
Foo& operator<< (int i)
{
return *this;
}
/** Foo always is and never is not. */
bool operator! ()
{
return false;
}
};
}
}
Run Code Online (Sandbox Code Playgroud)
降价文件:
Foo {#mainpage}
===
You can stream an int to @ref outer::inner::Foo "Foo" by using outer::inner::Foo::operator<<()
Did I mention you can stream an int to outer::inner::Foo by using @ref outer::inner::Foo::operator<<() "operator<<" ?
What about streaming an int with
@link outer::inner::Foo::operator<<()
operator <<
@endlink
Foo's always are, and never are not. outer::inner::Foo::operator!() tells you this.
I just said that @ref outer::inner::Foo::operator!() "operator!" tells you this.
Run Code Online (Sandbox Code Playgroud)
当我运行doxygen 1.8.4时,@ref并且@link无法解决,原因是:
Warning: unable to resolve reference to `outer::inner::Foo::operator' for \ref command
Warning: unable to resolve link to `outer::inner::Foo::operator' for \link command
Run Code Online (Sandbox Code Playgroud)
自动链接到运算符工作正常,但为了使文档更容易阅读,我想使用@ref删除整个命名空间和类前缀.
起初我想也许只是这样,operator<<但它似乎是所有操作员重载的问题.
有没有办法实现这个目标?我究竟做错了什么?
看来目前只能通过使用完整的参数列表来引用运算符。在你的情况下,这将是:
@ref outer::inner::Foo::operator<<(int) and @ref outer::inner::Foo::operator!()
Run Code Online (Sandbox Code Playgroud)