我可以使用现有的代码范围(指来自cpp
文件的一些代码行)作为doxygen中的示例吗?
/*!
* \brief My Foo class
* \details More about foo
* \example?? Foo used like here, some LOC from cpp follow (how can I do that??)
*/
class Foo
我想展示一下我如何使用Foo
的3-10行现有代码。这3-10行应该来自一个cpp
文件。
我知道我必须用\file
标记这个非常\file
的文件,但是如何引用一些代码行呢?
类似这样的东西(不正确的伪代码,因为我不知道怎么做)
somewhereelse.cpp
...
...
//! \example Foo (supposed to display with Foo docu). This is how Foo is used
//! @{
Foo f;
f.init(); // init first
f.start(); // then start
//! }@
...
发布于 2016-03-02 22:08:41
正如艾伯特(上面的注释)所指出的,可以使用\snippet
。在这里可以找到一个完整的例子,https://stackoverflow.com/a/16034375/356726
您引用了一个文件,在该文件中(在我的场景中是.cpp
),用[]
括号标记块。然后,它将显示为代码块。
https://stackoverflow.com/questions/35755867
复制相似问题