Doxygen并将一个属性的值添加到输出文档 [英] Doxygen and add a value of an attribute to the output documentation

查看:138
本文介绍了Doxygen并将一个属性的值添加到输出文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ServiceStack 标记使用c#属性的Web服务的休息路径。

ServiceStack marks rest paths for web services using c# attributes.

例如

[RestService("/hello1")]
[RestService("/hello2")]
public class Hello

想让Doxygen在Hello类的doxygen输出中包含RestService属性的值。如果带有括号的全部行包含在输出文档中,我并不关心如何使用相当的格式化。

I would like to make Doxygen include values of the RestService attribute in the doxygen output for the Hello class. I'm not concerned too much with pretty formattin if the full line with brackets is included in the output document.

任何建议?

一个快速而肮脏的窍门是写一个Doxygen扩展的优点;)

A quick and dirty trick would be a preferable to writing a Doxygen extension ;)

干杯

Tymek

====编辑

doxygen 用户答案的​​Python版本(将在Windows上轻松工作)将是:

The Python version (so will work on Windows easily) of doxygen user's answer would be:

#!/usr/bin/env python
import sys
import re

if (len(sys.argv) < 2):
    print "No input file"
else:
    f = open(sys.argv[1])
    line = f.readline()
    while line:
        re1 = re.compile("\[RestService\(\"(.*)\",.*\"(.*)\"\)]")
        re1.search(line)
        sys.stdout.write(re1.sub(r"/** \\b RestService: \2 \1\\n */\n", line))
        #sys.stdout.write(line)
        line = f.readline()
    f.close()

,DOXYFILE将具有:

and the DOXYFILE would have:

INPUT_FILTER           = "doxygenFilter.py"


推荐答案

输入过滤器,转换为

[RestService("/hello1")]

/** \b RestService: "/hello1"\n */

例如通过放入以下的perl魔术在一个名为的文件中,filter.pl

like for instance by putting following piece of perl magic in a file called filter.pl:

open(F, "<", $ARGV[0]);
while(<F>) { /^\s*\[RestService\((.*)\)\]\s*$/ ? 
             print "/** \\b RestService: $1\\n */\n" : print $_; }

并使用它与 INPUT_FILTER 标签在Doxyfile中:

and use that with the INPUT_FILTER tag in the Doxyfile:

INPUT_FILTER           = "perl filter.pl"

这篇关于Doxygen并将一个属性的值添加到输出文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆