如何从 C++ 生成 UML 类图源文件?

发布于 2024-09-24 12:13:49 字数 1539 浏览 3 评论 0原文

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

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

发布评论

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

评论(4

计㈡愣 2024-10-01 12:13:49

对于解析 C++ 代码,我使用过的最好的工具是 BoUML。它并不完美,也不会为您生成图表,但它确实理解其中的关系。如果您将两个类放入类图中,它会自动绘制关系,并且它允许您通过选择特定类并让工具调出相关类(依赖于所选类的类和依赖于所选类的类)来扩展关系图。所选择的取决于)。

For parsing C++ code, the best tool I have used is BoUML. It is not perfect, and it won't generate the diagrams for you, but it does understand the relationships. If you pull two classes into a class diagram, it will automatically draw the relationships, and it allows you to grow the diagram by selecting a particular class and having the tool bring up related classes (both classes that depend on the selected one and classes that the selected one depends on).

べ繥欢鉨o。 2024-10-01 12:13:49

它识别推导,但该工具无法理解其他关系。

Doxygen 还支持生成协作图,该图确实提供了非继承关系的图像。

来自 Doxygen 手册:

COLLABORATION_GRAPH
如果COLLABORATION_GRAPHHAVE_DOT标签设置为YES,那么doxygen将为每个记录的类生成一个图表,显示直接和间接的实现该类与其他已记录的类的依赖关系(继承、包含和类引用变量)。

我自己并没有对 UML 做任何花哨的事情,但是这些图表对于我的目的来说已经足够好了(用图形表示继承和组合)。

It recognizes derivation but other relations are not understood by the tool.

Doxygen also supports generating collaboration diagrams which does provide an image for non-inheritance relations.

From the Doxygen manual:

COLLABORATION_GRAPH
If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen will generate a graph for each documented class showing the direct and indirect implementation dependencies (inheritance, containment, and class references variables) of the class with other documented classes.

I myself don't do anything fancy with UML, but these diagrams are good enough for my purposes (graphing inheritance and composition).

凑诗 2024-10-01 12:13:49

@jdehaan 看起来我们很多人今天都在同一条船上航行;)

C++ 的 codedrawer(http://www.codedrawer .com/)就是这样的工具之一。

我将链接到今天开始的一些您可能感兴趣的内容。

Qt 依赖项可视化工具

代码重构

@jdehaan looks like lot of us are sailing in the same boat today ;)

codedrawer for C++(http://www.codedrawer.com/) is one such tool.

I will link to some started today that might interest you.

Qt Dependency Visualizer

Code refactoring

沉溺在你眼里的海 2024-10-01 12:13:49

企业架构师。深入分析代码,可以从代码生成图,从图生成代码,并支持往返代码生成,即修改生成的图并将更改保存到源代码中。它了解 C、C++、C#、Java、Python、VB.NET 和 C#。 VB、PHP、Java、德尔福。此外,它还支持一大堆图表类型,当然包括完整的 UML2.0。 (我不知道它在 C 中做了什么:P)

除了正确地做这些事情之外,它还做了很多其他事情,而且我认为它确实物有所值,根据版本的不同,价格为 135-239 美元。

Enterprise Architect. Deeply analyzes the code, can generate diagrams from code, code from diagram, and support round-trip code generation which means modifying the generated diagram and saving the changes into source code. And it knows C, C++, C#, Java, Python, VB.NET & VB, PHP, Java, Delphi. Also, it support a whole bunch of diagram types including complete UML2.0 of course. (I don't know what it does in C :P)

Besides doing these stuff right, it does LOTS of other things, and I think it's really worth its price, which is 135-239 USD depending on the edition.

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