c++ - 如何在 plantuml 中编写 typedef 和别名

标签 c++ uml plantuml

例如我的 cpp 实现如下所示:

class B {
  int value;
}

typedef MyB B;

class A {
  MyB b;
}

我的 plantuml 代码:

class B {
  int value;
}
class A {
  MyB b;
}
A o-- B

如何在 plantuml 中表示这个别名。应该如何以正确的方式完成。我在 plantuml 教程中找不到这个。

最佳答案

别名仅在 UML 规范中与导入一起引用(尽管别名也可以在 namespace 中使用)。第 30 页给出了一个示例,它还解决了 typedef 的第二个问题:

In Figure 7.8, the ElementImport is combined with aliasing, meaning that the DataType Types::Real will be referred to by name as Double in the package Shapes.

enter image description here

我不知道 plantUML,但如果它符合 UML(应该符合),那么您可以按照上面的描述进行操作。

关于c++ - 如何在 plantuml 中编写 typedef 和别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46718471/

相关文章:

c++ - 为什么我得到 "error: ‘pthread_delay_np’ was not declared in this scope”?

c++ - 虚函数和多重继承情况下的对象布局

uml - 如何从 UML 类模型生成关系模型?

plantuml - 有没有办法在 PlantUML 组件图中包含一列元素?

C++ OpenMP 关键 : "one-way" locking?

C++ 套接字,发送和接收不同步

reactjs - 前端 UML 部署图

dependencies - 提供/要求表示法中接口(interface)之间的 UML 依赖关系

phpstorm - PlantUML 和 Graphviz 插件设置 PHPstorm

plantuml - 如何在 PlantUML 类图中设置类型样式?