简体   繁体   中英

Creating a C++ Class Diagram

In Visual Studio .NET projects you can add a "Class Diagram" to the project which renders a visual representation of all namespaces, classes, methods, and properties. Is there any way to do this for Win32 (not .NET) C++ projects? Either through Visual Studio itself or with a 3rd party tool?

Most UML tools should be able to do that. I know that Sparx Systems Enterprise Architect does.

If you have a Visual Studio 2008 solution composed of multiple C++ projects, you can only generate one class diagram per project.

For example, if you have one application project linking to 10 library projects, you'll have to generate 11 separate class diagrams.

There are two ways to work around this, neither of which is pleasant:

  1. Cram all the source into a single project.
  2. Create a class diagram for one project (the application, perhaps) and then drag files from all the other projects into the class diagram.

A more thorough exploration of the capabilities of the Visual Studio class designer is given in Visual C++ Class Designer .

Given the poor support for C++ class diagrams in Visual Studio, you're probably better off going with a commercial tool if you want anything more than a simple list of what classes you have. WinTranslator from Excel Software might be worth looking at, and someone I work with uses Source Insight .

我有VS2008 SP1 Professional,类图适用于C ++ WIN32和Makefile项目。

如果您使用的是Visual Studio,则直到Visual Studio 2008才能正确实现C ++的类图。

Class designer is not meant for C++, even in VS 2008. You will be better off with some more specialized tool. It works for simple projects which don't heavily use templates. Also, get modeling power toys from codeplex.

Try doing partial specializations and watch how it crams everything into a single shape.

一种便宜的方法是使用Doxygen记录您的源代码,并让此工具为您创建类图。

If your project is a c++ based project then you have to drawn class diagram of c++ first,If your project contain 'n' number of sub-projects then you have to drawn 'n+1' number of class diagram.

Basically a class diagram contains

  1. class variables.
  2. class functions.
  3. Relation between classes.

You should place all the properties which are required for a class inside a class diagram. It looks like a table (graphical structure) having 3 rows type box.

Row 1. class name(If it is an Object diagram it should and must under lined).
Row 2. Variable list(One variable in one line).
Row 3. Function list(One function in one line)

You have to make the Relation between one class to another class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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