带有Doxygen的自定义标签

Ris*_*hiD 37 doxygen

我想弄清楚是否有办法使用Doxygen创建自定义标签.我确实找到了ALIAS配置文件选项,但这并不能完全满足我的需要.基本上在我的代码中,我希望能够编写类似的东西

/// \req Requirement #322 - blah blah
Run Code Online (Sandbox Code Playgroud)

再有Doxygen的创建列表像它的\bug,并\todo具有此定制标记线命令.Doxygen可以实现吗?

mou*_*iel 44

的推广\bug\todo\xrefitem.

我建议的解决方案是:


Dan*_*iel 20

谢谢mouviciel!我已采用您的解决方案并将其扩展用于我的目的.

下面的文字进入我的Doxyfile:

ALIASES += req{1}="\ref SRTX_\1 \"SRTX-\1\" "
ALIASES += satisfy{1}="\xrefitem satisfy \"Satisfies requirement\" \"Requirement Implementation\" \1"
ALIASES += verify{1}="\xrefitem verify \"Verifies requirement\" \"Requirement Verification\" \1"
Run Code Online (Sandbox Code Playgroud)

其中SRTX是我的项目的名称,并用作需求的前缀.

然后我创建了一个名为Requirements.dox的文件,该文件在我的需求管理工具(我的问题跟踪器)中提供了需求ID和需求URL之间的链接.

/**
@page Requirements

@section Build1

@anchor SRTX_1113
<a href="https://foo.bar.com/mantis/view.php?id=1113">SRTX-1113</a>

@anchor SRTX_1114
<a href="https://foo.bar.com/mantis/view.php?id=1114">SRTX-1114</a>

*/
Run Code Online (Sandbox Code Playgroud)

如果您不需要链接到外部源,也可以将需求的文本放在锚标记中.

在我的代码中,我有:

/**
 * This is the basic executive that schedules processes.
 * @satisfy{@req{1114}}
 */
class Scheduler: public Process
{
    ...
}
Run Code Online (Sandbox Code Playgroud)

在我的测试中,我把:

/**
 * Provide a number of tests for process scheduling.
 * @verify{@req{1114}}
 */
class Scheduler_ut : public CppUnit::TestFixture
{
    ...
}
Run Code Online (Sandbox Code Playgroud)

这为我提供了需求,需求实现和需求验证的相关页面.它还提供了满足要求和验证类描述中的需求部分(或函数 - 无论您将标记放在何处).


小智 5

结合上面的两个答案,您可以拥有一个干净的需求标签,该标签将构建一个交叉引用表,并且还在您的文档中提供到需求存储库的直接链接:

Doxygen 配置文件:

别名 = "requirement{1}=@xrefitem requirement \"Requirements\" \"Requirements Traceability\" <a href=\"http://your.requirementtool.com/browse/\1\">\1</a>"

源代码:

@requirement{REQ-123} 此要求项目的简要文字摘要

这将在文档中呈现为:

要求:

  • REQ-123此要求项目的简短文本摘要