简体   繁体   English

Doxygen注释/属性被忽略

[英]Doxygen annotation/attribute are ignored

I use doxygen to generate xml which then i transform to a custom documentation. 我使用doxygen生成xml,然后将其转换为自定义文档。

Is there a possibility that doxygen includes the annotation of a field / class / function. doxygen是否可能包含字段/类/功能的注释。

The annotation are ignored in both java and c#. 在Java和C#中,注释都将被忽略。 ex: 例如:

class User
{ 
    [Required]
    string UserName {get;set;}              
}

the "Required" annotation is not parsed/displayed in doxygen. doxygen中没有解析/显示“必需”注释。

What I would like to have in the xml / html output of doxygen is all the annotated Annotations of a property / field / class (in the ex. "[Required]"). 我希望在doxygen的xml / html输出中具有的是属性/字段/类的所有带注释的注释(例如,在“ [Required]”中)。

EXTRACT_ALL=YES is useless in this case. 在这种情况下, EXTRACT_ALL=YES是没有用的。 Look at this answer, I think it is good idea: Doxygen and add a value of an attribute to the output documentation 看看这个答案,我认为这是个好主意: Doxygen并将属性值添加到输出文档中

So you have to create filter (for example in phyton) which will be used by Doxygen to convert annotation to comment. 因此,您必须创建过滤器(例如在phyton中),Doxygen将使用该过滤器将注释转换为注释。 Don't forget to inform Doxygen about your filter: INPUT_FILTER = doxygenFilter.py I have the same problem so I modified that example in this way: 不要忘了告诉Doxygen您的过滤器: INPUT_FILTER = doxygenFilter.py我有同样的问题,所以我以这种方式修改了该示例:

#!/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("\s*\[(.*)]\s*")
        re1.search(line)
        sys.stdout.write(re1.sub(r"/// <para>Annotation: [\1]</para>\n", line))
        #sys.stdout.write(line)
        line = f.readline()
    f.close()

So code like 所以像

[AnyAnnotation()]

Will be converted to: 将转换为:

/// <param> Annotation [AnyAnnotation()] </param>`

So I got very nice result. 所以我得到了很好的结果。 Tag <param> is to avoid Doxygen put this annotation description to main description. 标记<param>是为了避免Doxygen将此注释描述放在主要描述中。 Instead it will put it to remarks section. 而是将其放在备注部分。

I'm not sure what you're asking but I will say a few things that might help you. 我不确定您要问的是什么,但我会说一些可能对您有所帮助的事情。

Doxygen must be configured to produce documentation for code elements that have no Doxygen comments. 必须配置Doxygen才能为没有Doxygen注释的代码元素生成文档。 In other words, you can tell Doxygen to produce documentation for all functions, variables, macros, etc even if they aren't documented in the code. 换句话说,您可以告诉Doxygen生成所有函数,变量,宏等的文档,即使它们未在代码中记录。 Set EXTRACT_ALL=YES in your config file. 在配置文件中设置EXTRACT_ALL=YES

If you run DoxyWizard you will get a better feel for all of the available options and the effect of each option. 如果您运行DoxyWizard您将对所有可用选项以及每个选项的效果有更好的了解。 DoxyWizard is the GUI front end to Doxygen. DoxyWizard是Doxygen的GUI前端。

And by the way, bravo for documenting your code! 顺便说一下,很赞!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM