2009-02-11 155 views
36

我想弄清楚是否有方法使用Doxygen创建自定义标签。我找到了ALIAS配置文件选项,但是这并不完全符合我的需要。基本上在我的代码我希望能够写类似Doxygen的自定义标签

/// \req Requirement #322 - blah blah 

再有Doxygen的创建列表像它的\bug\todo命令具有此定制标记线。这可能与Doxygen有关吗?

+0

这似乎不适用于XML(C#)记录样式。 – 2012-08-14 08:35:54

回答

42

\bug\todo的推广是\xrefitem

我建议的解决方案是:

  • 中的Doxyfile

    ALIASES += "req=\xrefitem req \"Requirement\" \"Requirements\" " 
    
  • 中记录代码

    /// \req #42 - The system shall work in any situation 
    
+0

非常好,我在看手册时没有看到。 非常感谢。 – RishiD 2009-02-11 15:53:56

19

感谢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" 

哪里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> 

*/ 

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

在我的代码有:

/** 
* This is the basic executive that schedules processes. 
* @satisfy{@req{1114}} 
*/ 
class Scheduler: public Process 
{ 
    ... 
} 

而在我的测试中,我提出:

/** 
* Provide a number of tests for process scheduling. 
* @verify{@req{1114}} 
*/ 
class Scheduler_ut : public CppUnit::TestFixture 
{ 
    ... 
} 

这让我对需求相关的页面,要求执行,并要求验证。它还提供了满足要求和验证类描述(或功能 - 无论放置标签的位置)中的要求部分。

+0

在“需求实现”和“需求验证”页面中添加上面在`INPUT =`变量中指定的`Requirements.dox`以能够查看链接。 – parasrish 2017-11-08 10:27:13