114 lines
2.4 KiB
Markdown
114 lines
2.4 KiB
Markdown
# t20026 - Virtual method call sequence diagram test case
|
|
## Config
|
|
```yaml
|
|
compilation_database_dir: ..
|
|
output_directory: puml
|
|
diagrams:
|
|
t20026_sequence:
|
|
type: sequence
|
|
glob:
|
|
- ../../tests/t20026/t20026.cc
|
|
include:
|
|
namespaces:
|
|
- clanguml::t20026
|
|
using_namespace:
|
|
- clanguml::t20026
|
|
start_from:
|
|
- function: "clanguml::t20026::tmain()"
|
|
```
|
|
## Source code
|
|
File t20026.cc
|
|
```cpp
|
|
namespace clanguml {
|
|
namespace t20026 {
|
|
|
|
struct A {
|
|
virtual void a() { }
|
|
};
|
|
|
|
struct B : public A {
|
|
void a() override { }
|
|
};
|
|
|
|
struct C : public B {
|
|
void a() override { }
|
|
};
|
|
|
|
int tmain()
|
|
{
|
|
C *a{};
|
|
|
|
dynamic_cast<A *>(a)->a();
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
```
|
|
## Generated UML diagrams
|
|

|
|
## Generated JSON models
|
|
```json
|
|
{
|
|
"diagram_type": "sequence",
|
|
"metadata": {
|
|
"clang_uml_version": "0.3.3-24-ge2a6b81",
|
|
"llvm_version": "Ubuntu clang version 15.0.6",
|
|
"schema_version": 1
|
|
},
|
|
"name": "t20026_sequence",
|
|
"participants": [
|
|
{
|
|
"id": "2268697350307997040",
|
|
"name": "clanguml::t20026::tmain()",
|
|
"source_location": {
|
|
"file": "../../tests/t20026/t20026.cc",
|
|
"line": 16
|
|
},
|
|
"type": "function"
|
|
},
|
|
{
|
|
"id": "1962121823853291899",
|
|
"name": "clanguml::t20026::A",
|
|
"source_location": {
|
|
"file": "../../tests/t20026/t20026.cc",
|
|
"line": 4
|
|
},
|
|
"type": "class"
|
|
}
|
|
],
|
|
"sequences": [
|
|
{
|
|
"messages": [
|
|
{
|
|
"from": {
|
|
"activity_id": "2268697350307997040",
|
|
"activity_name": "clanguml::t20026::tmain()",
|
|
"participant_id": "2268697350307997040",
|
|
"participant_name": "clanguml::t20026::tmain()"
|
|
},
|
|
"name": "a()",
|
|
"return_type": "void",
|
|
"scope": "normal",
|
|
"source_location": {
|
|
"file": "../../tests/t20026/t20026.cc",
|
|
"line": 20
|
|
},
|
|
"to": {
|
|
"activity_id": "600590770418147864",
|
|
"activity_name": "clanguml::t20026::A::a()",
|
|
"participant_id": "1962121823853291899"
|
|
},
|
|
"type": "message"
|
|
}
|
|
],
|
|
"start_from": {
|
|
"id": 2268697350307997040,
|
|
"location": "clanguml::t20026::tmain()"
|
|
}
|
|
}
|
|
],
|
|
"using_namespace": "clanguml::t20026"
|
|
}
|
|
```
|