【问题标题】:How do I display only the class name in doxygen class diagrams?如何在 doxygen 类图中仅显示类名?
【发布时间】:2010-04-07 13:08:34
【问题描述】:
在我的 C# 项目中使用 doxygen 和 graphviz,我可以在文档页面中生成类图。这些图表中包含完整的类名和命名空间,例如
Acme.MyProduct.MyClasses.MyClass
是否可以配置 doxygen 将其缩减为仅类名?
MyClass
完全限定的路径使即使是简单的图表也相当宽泛和笨拙。我想尽量减少水平滚动的需要。
【问题讨论】:
标签:
c#
documentation
uml
diagram
doxygen
【解决方案1】:
我怀疑你已经解决了这个问题,因为它已经有一年了,但答案可能对其他搜索这个问题的人有用(就像我刚才所做的那样)。您可以使用“HIDE_SCOPE_NAMES”选项。将其设置为 YES(或在 doxywizard GUI 中检查)将隐藏命名空间。从我的 doxygen 文件中:
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = YES
【解决方案2】:
HIDE_SCOPE_NAMES 效果很好,但只隐藏了类图中的范围,而不是每个方法的调用者/被调用者图。
要将这些图表的宽度减小到可读大小,您可以使用输入过滤器重命名范围。这不会删除命名空间,但会将其减小到更可读的宽度。
例如要将命名空间“COMPANY_NAMESPACE”重命名为“sf”,请使用:
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output. If FILTER_PATTERNS is specified, this tag will be
# ignored.
INPUT_FILTER = "sed 's,COMPANY_NAMESPACE,sf,'"