如何在 doxygen 类图中仅显示类名?

发布于 2024-08-27 23:44:33 字数 249 浏览 7 评论 0原文

在我的 C# 项目中使用 doxygen 和 graphviz,我可以在文档页面中生成类图。这些图表中包含完整的类名和命名空间,例如,

Acme.MyProduct.MyClasses.MyClass

是否可以配置 doxygen 将其缩减为仅包含类名?

MyClass

完全限定的路径甚至使简单的图表变得相当宽和笨拙。我想尽量减少水平滚动的需要。

Using doxygen and graphviz with my C# project, I can generate class diagrams in the documentation pages. These diagrams have the full class names and namespaces in them, e.g.

Acme.MyProduct.MyClasses.MyClass

Is it possible to configure doxygen to cut this down a bit to just the class name?

MyClass

The fully qualified paths make even simple diagrams rather wide and unwieldy. I'd like to minimize the need for horizontal scrolling.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

变身佩奇 2024-09-03 23:44:33

我怀疑您已经解决了这个问题,因为它已有一年了,但答案可能对其他搜索此问题的人有用(就像我刚刚所做的那样)。您可以使用“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

I suspect that you've already solved this as it is a year old, but an answer might be useful for anyone else searching for this (as I just did). You can use the "HIDE_SCOPE_NAMES" option. Setting it to YES (or checking it in the doxywizard GUI) will hide namespaces. From my doxygen file:

# 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
池予 2024-09-03 23:44:33

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,'"

The HIDE_SCOPE_NAMES works great but only hides the scope in the class diagram but not the caller/callee graphs for each method.

To reduce the width of those diagrams to a readable size you can rename the scope using the input filter. This will not remove the namespace but will reduce it to a more readable width.

For example to rename the namespace "COMPANY_NAMESPACE" to "sf" use:

# 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,'"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文