Visual C++ Class Designer, Page 2
As would be expected on any worthwhile native C++ code diagramming tool, the display of multiple inheritance is supported, and Figure 3 shows a type called Derived that has a public derivation from NativeClass and a private derivation from Base, as shown by the arrows. The base classes of a type are also displayed within the derived types details, which allows derived types to be identified even if their base types are not present on the diagram.
Figure 3: Multiple Inheritance View
In addition to the basic C++ native classes that have been shown so far, the Class Designer supports the display of template classes, structs, enums, and macros. Of these, the most interesting are templates, given the complexity in type construction that they support. The Class Designer can show only types defined in header files that are part of a C++ project, so if a Standard C++ library type needs to be displayed, the header file that defines the type must be included in the project. By adding the STL header file that defines the vector container in the project and dragging the header file into a Class Designer, the output shown in Figure 4 was generated. As can be seen, despite the complexity of the STL template, the display of information produced by the Class Designer is clear and meaningful.
Figure 4: Complex Template Class Display
The Class Designer allows a diagram to be exported to a variety of different image file formats, and this functionality was used to produce the diagram for Figure 4.
In addition to the two major limitations covered at the beginning of the article, there are a few other much smaller limitations worth covering:
- Type definitions must be in a header file.
- Global functions cannot be displayed.
- Unions cannot be displayed.
- Primitive types such as integers and floating point number cannot be displayed as individual types (but will be displayed when they are member variable or method parameters).
- COM types defined in IDL files cannot be displayed.
The MSDN documentation for Beta 2 of Visual Studio 2008 states that nested types cannot be displayed by the Class Designer, but as Figure 4 shows, this is clearly not the case.
Although the lack of support for managed type display in the Class Designer is in some ways surprising and a little disappointing, it is certainly in line with the new Visual C++ philosophy that focuses on native and interoperability development rather than managed development. The Visual C++ 2008 Class Designer is certainly a respectable offering for an initial release, and confirms Microsoft's continued commitment to Visual C++ as a product. For Visual C++ developers who haven't settled on a third-party UML tool for documenting their applications, the Class Designer will be a welcome addition to C++, and is certainly worth trying out.
About the Author
Nick Wienholt is an independent Windows and .NET consultant based in Sydney, Australia. He is the author of Maximizing .NET Performance from Apress, and specialises in system-level software architecture and development with a particular focus on performance, security, interoperability, and debugging. Nick can be reached at NickW@dotnetperformance.com.
Page 2 of 2