Skip to main content

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

Using pip

The package is available on PyPi and can be installed using pip:

pip install hpp2plantuml

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.

Source Distribution

hpp2plantuml-0.8.1.linux-x86_64.tar.gz (32.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hpp2plantuml-0.8.1-py3.9.egg (34.3 kB view details)

Uploaded Egg

hpp2plantuml-0.8.1-py2.py3-none-any.whl (17.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file hpp2plantuml-0.8.1.linux-x86_64.tar.gz.

File metadata

  • Download URL: hpp2plantuml-0.8.1.linux-x86_64.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for hpp2plantuml-0.8.1.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 5842c7be6652e64e0eb3b08da441d47fe324040d41eb82a75d485dbdf81948f4
MD5 0513bc6c9cd1fa7eb45132eca15c870a
BLAKE2b-256 e345ad5595a2adcbf47aa60a991e68c63e9c12b939fdd16346cff3702398421c

See more details on using hashes here.

File details

Details for the file hpp2plantuml-0.8.1-py3.9.egg.

File metadata

  • Download URL: hpp2plantuml-0.8.1-py3.9.egg
  • Upload date:
  • Size: 34.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for hpp2plantuml-0.8.1-py3.9.egg
Algorithm Hash digest
SHA256 2063e079381b18c6ebabf353fe8fd5ccc278229bf65229086eea072f1b8ff03a
MD5 d7ba95dfa56b428366109b1f8253cdbb
BLAKE2b-256 6668486f38428551a75458a4f5f90b2b48769217c2e17e2eac064d53a4654a92

See more details on using hashes here.

File details

Details for the file hpp2plantuml-0.8.1-py2.py3-none-any.whl.

File metadata

  • Download URL: hpp2plantuml-0.8.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for hpp2plantuml-0.8.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 903aa3cf5129e309dd9662443f448e994528e6a45f367e5a0bd6097dcd20f979
MD5 0640c9d555e758d832ca6b8dc7d0089e
BLAKE2b-256 1c928977086c5417bef5ea9e9d8866a7a592ba030647628e3f783943c5f2b8a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page