标记覆盖的功能 [英] Mark overridden functions
问题描述
是否存在像\deprecated
这样的命令,但是用于标记覆盖的功能?
Does a command exist, like \deprecated
, but to mark overridden functions?
Java为您已重写的功能添加了注释@override
.我想在C ++中做同样的事情,以便可以看到已重写的超类函数.充其量,文档页面上还应该显示所有继承的类成员函数,但不会被指向超类函数的超链接显式覆盖.
Java has an annotation @override
for functions you have overridden. I would like to do the same in C++, so that I can to see the superclass functions I've overridden. At best, the documentation page should also show all class member functions, which are inherited, but not explicitly overridden with hyper-links to the superclass functions.
我知道有一种方法可以从超类方法复制文档.但是我不想复制整个文档.我只想知道,一个函数是继承的.该行为应与不赞成使用的选项类似,以标出这些旧功能.
I know there is a way to copy the documentation from the superclass method. But I don't want to have the whole doc copied. I just want to know, that a function is inherited. The behavior should be similar to the deprecated option to mark those old functions with a bar.
推荐答案
每个被重写的函数都会自动收到一个通知,指出它已重新实现.例如,派生类中的重写函数会收到通知从MyBaseClass重新实现".
Every overridden function automatically gets a notice it has been reimplemented. For example the overridden function in a derived class gets the notice "Reimplemented from MyBaseClass."
它还会在基类的文档中发出通知.提到在测试中重新实现"
It also puts a notice in the documentation of the base class. There is mentions "Reimplemented in Test"
要显示所有功能,包括继承的功能,可以设置 INLINE_INHERITED_MEMB
到YES
.然后Doxygen将每个继承但未被覆盖的函数的文档复制到派生类的文档中.
To show all functions, including the inherited functions, you can set INLINE_INHERITED_MEMB
to YES
. Then Doxygen copies the documentation of every inherited, but not overridden, function into the documentation of the derived class.
例如,使用此源时:
class TestBase
{
public:
/**
* Base class function.
*/
virtual void function();
/**
* Another function.
*/
virtual void another();
};
class Test: public TestBase
{
public:
/**
* Overridden function.
*/
virtual void function();
};
并将INLINE_INHERITED_MEMB
设置为YES
将会得到Derived
类的以下文档:(带有Doxygen 1.7.6)
And setting INLINE_INHERITED_MEMB
to YES
will result in the following documentation for the Derived
class: (With Doxygen 1.7.6)
成员功能文档
virtual void TestBase::another ( ) [virtual, inherited]
另一个功能.
virtual void TestBase::another ( ) [virtual, inherited]
Another function.
virtual void Test::function ( ) [virtual]
派生
从TestBase重新实现.
virtual void Test::function ( ) [virtual]
Derived.
Reimplemented from TestBase.
我认为这就是您想要的.
I think this is what you are looking for.
这篇关于标记覆盖的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!