5

我正在尝试为我编写的模块编写一些通用文档,我希望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;
    }
};

}
}

降价文档:

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.

当我运行 doxygen 1.8.4 时,@refand@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

自动链接到运算符可以正常工作,但为了使文档更易于阅读,我想使用 @ref 删除整个命名空间和类前缀。

起初我以为这可能只是与operator<<但它似乎是所有运算符重载的问题。

有没有办法做到这一点?我究竟做错了什么?

4

1 回答 1

1

似乎目前只能通过使用完整的参数列表来引用运算符。在您的情况下,这将是:

@ref outer::inner::Foo::operator<<(int) and @ref outer::inner::Foo::operator!()
于 2018-09-04T15:58:15.660 回答