我有两个类模板,需要使用Sphinx
对它们进行文档记录。和往常一样,我对类使用了Doxygen
样式的注释。但是,虽然我使用了doxygen指令,但我无法获得正确的文档。
Sample classes
namespace X
{
/// Base Class
/**
* Description of Base Class
* */
class A
{
// Intentionally kept blank
};
/// Child Class First
/**
* Description of First Child Class
* */
template <typename T, int length_x>
class B : public A
{
// Intentionally kept blank
};
/// Child Class Second
/**
* Description of Second Child Class
* */
template<typename T>
class B<T, 1> : public A
{
// Intentionally kept blank
};
}
rst file
的内容
.. _dummy class:
Dummy Class
===========
.. doxygenclass:: X::A
:members:
:protected-members:
:private-members:
.. doxygenclass:: X::B
:members:
:protected-members:
:private-members:
.. I know that the following will not work but given as my approach
.. doxygenclass:: X::B
:members:
:protected-members:
:private-members:
看到这里,我也尝试过以下方法,但没有成功。
.. _dummy class:
Dummy Class
===========
.. doxygenclass:: X::A
:members:
:protected-members:
:private-members:
.. doxygenclass:: X::B
:members:
:protected-members:
:private-members:
.. doxygenclass:: X::B<T, 1>
:members:
:protected-members:
:private-members:
是否有任何方法可以使用Sphinx
来记录这两个子类?
终于得到了答案。这是编写doxygendirective
的一个打字错误
.. _dummy class:
Dummy Class
===========
.. doxygenclass:: X::A
:members:
:protected-members:
:private-members:
.. doxygenclass:: X::B
:members:
:protected-members:
:private-members:
.. doxygenclass:: X::B< T, 1 >
:members:
:protected-members:
:private-members:
最重要的部分是这个.. doxygenclass:: X::B< T, 1 >
。在<gt;。文档在这里。