thibaultmarin / hpp2plantuml

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

Support for template signatures #19

Open mxmlnkn opened 3 years ago

mxmlnkn commented 3 years ago

Given this header:

template<
    typename Key,
    typename Value,
    typename CacheStrategy = CacheStrategy::LeastRecentlyUsed<Key>
>
class Cache
{};

I get this result:

@startuml
class Cache <template<typename Key, typename Value, typename CacheStrategy=CacheStrategy::LeastRecentlyUsed<Key>>> {
}
@enduml

This is rendered as:

template-signature

I would have expected something more formal UML, like here. I.e., I would expect something like:

@startuml
class Cache <Key, Value, CacheStrategy>{
}
@enduml

template-signature

I'm not sure what to do about the default value for template arguments.

thibaultmarin commented 3 years ago

Unfortunately, the parser returns the template specification as a string. Since this package does not have the ambition to parse c++ code, this is unlikely to get fixed until the parser returns a shortened template specification or the parsing library is changed (for instance to libclang, which offers a displayname property matching your desired output).

I can't give an estimate of when that may happen, but I will keep this in mind, thanks.