Thursday, April 12, 2012

Graphviz + Doxygen to generate UML class diagrams

I want to use Graphviz + Doxygen to generate a class diagram based on C++ code. This works already as Doxygen comes with a native DOT support; but is it possible, to produce a UML-like output with the corresponding access modificators (public, private etc.), return and parameter types of the class methods, similar to the diagram below?

I'm aware of thread How to use doxygen to create UML class diagrams from C++ source, but it doesn't answer the question, though.

enter image description here


Create the following source file example.cpp:
class Animal
    void die();
    string name;
    int age;

class Dog : public Animal
    void bark();

class Cat : public Animal
    void meow();
run doxygen -g and change the following options of the generated Doxyfile:
EXTRACT_ALL            = YES
HAVE_DOT               = YES
UML_LOOK               = YES
run doxygen and look at the output for the Animal class, it should be the similar as the above picture, although doxygen will not show the return types of the methods and fields.

No comments:

Post a Comment