Closed fneddy closed 1 week ago
@fneddy type_aliases
allows to provide aliases for types, not variables. The problem in your case, is that you want to tell clang-uml
that ptr
field (note that ptr
is the name of the field not the type) has a different type than what is declared in the code (i.e. void*
).
Currently 2 options could be possible:
if you need to have id*
instead of void*
in the class node in the diagram you can redefine void to id in type_aliases
, but this will alter all void*
members and functions parameters
type_aliases:
"void *": "id *"
if you need to have a relationship from the table::(anonymous)
union to id
it can be added in the plantuml
config section:
diagram:
my_diagram:
type: class
# ...
plantuml:
after:
- '{{ alias("table::()") }} ..> {{ alias("id") }}'
which should result in the following diagram:
@startuml
class "id" as C_0013001791621350910261
class C_0013001791621350910261 {
__
+foo : unsigned int
}
class "table" as C_0013605029241056812048
class C_0013605029241056812048 {
__
+ : table::()
+number : int
}
class "table::()" as C_0003376134320007800112
class C_0003376134320007800112 {
__
+id : unsigned int[]
+ptr : id *
}
C_0013605029241056812048 o-- C_0003376134320007800112
C_0003376134320007800112 ..> C_0013001791621350910261
@enduml
I'll think about adding an option to override types of variables/members/function signatures in the future...
thank you this helps me a lot.
curious side note this seems to work:
type_aliases:
table::number: id
it aliases the field number to the type id.
@fneddy strange for me this alias:
type_aliases:
table::number: id
doesn't change anything in the diagram...
you are right. that must have been in an overlook of me.
i found myself in the situation where i want to map fields inside of anonymous struct fields to another type. It seems that the syntax does not support it. this is my usecase:
i tried to map the type via this but no option that i tried worked:
also it seems that clang-uml creates an extra type instance of the anonymous union for every instance of struct table .