本文介绍了Doxygen的:隐藏私人/受保护的方法...和技巧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Doxygen的生成我们的API,用C#编写的文档。然而,它暴露私有/ protected成员。有没有一种方法来隐藏这些?



我想出如何隐藏文件:排除文件名=列表



不过,我需要更多的粒度从而避免不必要的API噪音屏蔽用户。样本Doxygen的文件,将不胜感激,以及提示/技巧。



你用什么工具来从源代码生成API?



我觉得有些留在18世纪,因为我用的Doxygen在C#由C ++的方式。


解决方案



有关隐藏私有成员,您可以更改的Doxyfile 配置文件如下:

  EXTRACT_PRIVATE = YES 

许多其他选项可以为各种提取/隐藏代码元素,例如,列举了可以设置的Doxyfile 本身:

 #如果EXTRACT_ALL标签设置为YES的doxygen将承担
#文档中的所有实体都记录在案,即使没有文件可用。
#私有类成员和静态文件成员,除非
#被隐藏的EXTRACT_PRIVATE和EXTRACT_STATIC标记设置为YES

EXTRACT_ALL = YES

#如果EXTRACT_PRIVATE标签设置为YES的一类
#所有私有成员将被包含的文件中。

EXTRACT_PRIVATE = YES

#如果EXTRACT_STATIC标签设置为YES的文件
#所有静态成员将被包含的文件中。

EXTRACT_STATIC = YES

#如果EXTRACT_LOCAL_CLASSES标签设置为YES类(和结构)
#在源文件中本地定义将被包含的文件中。
#如果设置为在头文件中定义NO只有类都包括在内。

EXTRACT_LOCAL_CLASSES = YES

#这个标志只为Objective-C代码非常有用。当设置为YES当地
#方法,这是在实现部分定义的,但不是在
#接口包含的文件中。
#如果设置为NO(默认值)只在接口方法都包括在内。

EXTRACT_LOCAL_METHODS = YES

#如果这个标志被设置为YES,匿名命名空间的成员将
#提取并出现在文档的命名空间称为
#'anonymous_namespace {文件},其中文件将与包含匿名命名的文件的基
#名称来代替。默认情况下
#匿名命名空间是隐藏的。

EXTRACT_ANON_NSPACES = NO

#如果HIDE_UNDOC_MEMBERS标签设置为YES,Doxygen的将隐藏的文档类,文件或命名空间的所有
#无证成员。
#如果设置为NO(默认值),这些成员将被包含在
#各种概述,但不产生文档部分。
#如果启用EXTRACT_ALL此选项无效。

HIDE_UNDOC_MEMBERS = NO

#如果HIDE_UNDOC_CLASSES标签设置为YES,Doxygen的将隐藏所有
#无证类,通常在类层次结构可见。
#如果设置为NO(默认值)这些类将包括在各个
#概述。如果启用此EXTRACT_ALL选项无效。

HIDE_UNDOC_CLASSES = NO

#如果HIDE_FRIEND_COMPOUNDS标签设置为YES,Doxygen的将隐藏所有
#的朋友(类|结构|联盟)声明。
#如果设置为NO(默认值),这些声明将包括在
#文档中获得。

HIDE_FRIEND_COMPOUNDS = NO


I am using Doxygen to generate documentation for our API, written in C#. However, it exposes private/protected members. Is there a way to hide those?

I figured out how to hide files: EXCLUDE = List of file names

Yet, I need more granularity and thus shield users from unnecessary API noise. A sample Doxygen file would be appreciated as well as tips/tricks.

What tools do you use to generate API from the source code?

I feel somewhat left in the 18th century as I use Doxygen in C# by way of C++.

解决方案

I don't know how well C# is supported by Doxygen.

For hiding private members, you change Doxyfile configuration file as following:

EXTRACT_PRIVATE        = YES

Many other options can be set for various kinds of extracting/hiding code elements, e.g., citing Doxyfile itself:

# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES

EXTRACT_ALL            = YES

# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.

EXTRACT_PRIVATE        = YES

# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.

EXTRACT_STATIC         = YES

# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.

EXTRACT_LOCAL_CLASSES  = YES

# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.

EXTRACT_LOCAL_METHODS  = YES

# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.

EXTRACT_ANON_NSPACES   = NO

# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_MEMBERS     = NO

# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.

HIDE_UNDOC_CLASSES     = NO

# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.

HIDE_FRIEND_COMPOUNDS  = NO

这篇关于Doxygen的:隐藏私人/受保护的方法...和技巧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 03:41