thibaultmarin / hpp2plantuml

Convert C++ header files to PlantUML
MIT License
223 stars 35 forks source link

Feature request: Represent arbitrary packages #12

Closed DavidRisch closed 3 years ago

DavidRisch commented 3 years ago

Drawing packages (see section 'Packages' in the PlantUML doc) would make the final diagram for larger projects more readable. These packages can be based on the directory structure but (in my opinion) they should not have to be.

My idea for the interface is a new argument to add a package based on a regular expression, all headers with a path which contains a match become part of a package. This would allow for the most common case where a package matches exactly with a directory. But it would also allow for more complicated situations where packages span over directories or one directory contains multiple packages (e.g. all classes with a certain prefix).

Example:

hpp2plantuml -i frontend/a.h -i frontend/b.h -i middleware/c.h -i backend/d.h \
--package "Front end" "frontend/" \
--package "Legacy code" "(middleware/c.h)|(backend/d.h)"

Some way of setting the package style (see section 'Packages style' in the PlantUML doc) would be a nice extra.

@thibaultmarin: If you dont want to do this, please tell me and I will make a pr when I find time for this.

DavidRisch commented 3 years ago

I just found out namespaces are drawn, that is probably enough for my use case.

thibaultmarin commented 3 years ago

Interesting thoughts. I wonder if most of what you propose should be managed via a custom template rather than command line options. Some work is required to allow filtering by file and regular expression in the template, but it may be the most flexible approach. I will try to take steps in this direction moving forward.

Thanks.