Doxygen and add attribute value in output

ServiceStack designates stopping paths for web services using C # attributes.

for instance

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

I would like Doxygen to include the values ​​of the RestService attribute in the doxygen output for the Hello class. I'm not too worried about a pretty formattin if a complete line with brackets is included in the output.

Any suggestions?

A quick and dirty trick would be preferable to write the Doxygen extension;)

Greetings

Tymek

==== EDIT

The Python version (this will work easily with Windows) from the doxygen user will 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() 

and DOXYFILE:

 INPUT_FILTER = "doxygenFilter.py" 
+6
source share
1 answer

You can create an input filter that converts a string using

 [RestService("/hello1")] 

to

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

for example, by adding the following piece of perl magic to a file called filter.pl :

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

and use this with the INPUT_FILTER tag in the Doxyfile:

 INPUT_FILTER = "perl filter.pl" 
+8
source

Source: https://habr.com/ru/post/908493/


All Articles