使用doxygen引用C ++运算符重载

时间:2013-08-28 05:00:44

标签: doxygen

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

}
}

Markdown文档:

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时,@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

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

起初我想也许这只与operator<<有关,但它似乎是所有运算符重载的问题。

有没有办法实现这个目标? 我做错了什么?

1 个答案:

答案 0 :(得分:0)

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

@ref outer::inner::Foo::operator<<(int) and @ref outer::inner::Foo::operator!()