Convert C++ header files to PlantUML
Project description
Motivation
The purpose of this tool is to convert C++ header files to a UML representation in PlantUML syntax that can be used to generate diagrams with PlantUML.
PlantUML is a program rendering UML diagrams from plain text inputs using an expressive language.
This package generates the text input to PlantUML from C++ header files. Its ambition is limited but it should produce reasonable conversion for simple class hierarchies. It aims at supporting:
- class members with properties (private, method, protected), methods with basic qualifiers (static, abstract),
- inheritance relationships,
- aggregation relationships (very basic support).
- dependency relationships
The package relies on the CppHeaderParser package for parsing of C++ header files.
Usage
The hpp2plantuml package can be used from the command line or as a module in other applications.
Command line
The command line usage is (hpp2plantuml --help):
usage: hpp2plantuml [-h] -i HEADER-FILE [-o FILE] [-d] [-t JINJA-FILE] [--version] hpp2plantuml tool. optional arguments: -h, --help show this help message and exit -i HEADER-FILE, --input-file HEADER-FILE input file (must be quoted when using wildcards) -o FILE, --output-file FILE output file -d, --enable-dependency Extract dependency relationships from method arguments -t JINJA-FILE, --template-file JINJA-FILE path to jinja2 template file --version show program's version number and exit
Input files are added using the -i option. Inputs can be full file paths or include wildcards. Note that double quotes are required when using wildcards. The output file is selected with the -o option. The output is a text file following the PlantUML syntax.
For instance, the following command will generate an input file for PlantUML (output.puml) from several header files.
hpp2plantuml -i File_1.hpp -i "include/Helper_*.hpp" -o output.puml
To customize the output PlantUML file, templates can be used (using the -t parameter):
hpp2plantuml -i File_1.hpp -i "include/Helper_*.hpp" -o output.puml -t template.puml
This will use the template.puml file as template. Templates follow the jinja syntax. For instance, to add a preamble to the PlantUML output, the template file may contain:
{% extends 'default.puml' %} {% block preamble %} title "This is a title" skinparam backgroundColor #EEEBDC skinparam handwritten true {% endblock %}
This will inherit from the default template and override the preamble only.
Module
To use as a module, simply import hpp2plantuml. The CreatePlantUMLFile function can then be used to create a PlantUML file from a set of input files. Alternatively, the Diagram object can be used directly to build internal objects (from files or strings). The Diagram.render() method can be used to produce a string output instead of writing to a text file. See the API documentation for more details.
Installation
From source
The code uses setuptools, so it can be built using:
python setup.py install
To build the documentation, run:
python setup.py sphinx
To run the tests, run:
python setup.py test
The full documentation is available via:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size hpp2plantuml-0.6.linux-x86_64.tar.gz (28.8 kB) | File type Source | Python version None | Upload date | Hashes View |
Filename, size hpp2plantuml-0.6-py2.py3-none-any.whl (16.2 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size hpp2plantuml-0.6-py3.7.egg (31.6 kB) | File type Egg | Python version 3.7 | Upload date | Hashes View |
Filename, size hpp2plantuml-0.6-py3.8.egg (31.7 kB) | File type Egg | Python version 3.8 | Upload date | Hashes View |
Hashes for hpp2plantuml-0.6.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 575397f16e0675b200559c00f2054d0f154fb89139330f1a64eb31844d19ebaf |
|
MD5 | 94213ef5ed9dac8f5c81ea27337f1674 |
|
BLAKE2-256 | b9b27f072cc36bfbfea562368376b0427c44d4150531d73e3515c6cb84638b0d |
Hashes for hpp2plantuml-0.6-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7ae9279f2a87983f947ddffc6a74a3479772947503ae9c87ffffd5861f167d4 |
|
MD5 | fb710553bc8276aa05b381f5ebefb65d |
|
BLAKE2-256 | 062b32db209a940119d13222fa255c5e2b9f1531ae7a3c8eb4317ff34c253fe1 |