When working with large codebases, it is often necessary to create diagram configurations for a large number of classes or groups of classes.
Diagram templates feature makes this easier, by allowing to define (or use one of the builtin) templates and generate using them any number of diagram configurations. Diagram templates can be defined using Jinja like template syntax (current renderer implementation is inja).
Diagram templates are defined as part of the configuration file using the following YAML node:
Diagram templates can be added directly to the .clang-uml
configuration file, under a diagram_templates:
key. However, for practical reasons it is better to keep diagram template definitions in a separate Yaml file, and reference it in the configuration file using include!
directive, e.g.:
To generate a diagram from a template use the following command:
This command does not modify the .clang-uml
configuration file.
To add a new diagram definition to the configuration file based on the template, simply call the clang-uml
using the following options:
To see what variables are necessary to provide for a template, the template can be printed from the command line using the following command:
clang-uml
has some predefined templates, which can be used directly. If the users configuration file defines another template with a name which already exists as built-in template it will override the predefined templates.
Currently, the following templates are built-in:
parents_hierarchy_tmpl
- generate inheritance hierarchy diagram including parents of a specified classsubclass_hierarchy_tmpl
- generate inheritance hierarchy diagram including c children of a specified classclass_context_tmpl
- generate diagram including all classes in direct relationship (of any kind) with a specific class