Files
clang-uml/docs/test_cases/t20041.md
2024-02-14 00:17:47 +01:00

280 lines
6.8 KiB
Markdown

# t20041 - Test case for recursive variadic template class call
## Config
```yaml
diagrams:
t20041_sequence:
type: sequence
glob:
- t20041.cc
include:
namespaces:
- clanguml::t20041
using_namespace: clanguml::t20041
from:
- function: "clanguml::t20041::tmain()"
```
## Source code
File `tests/t20041/t20041.cc`
```cpp
#include <iostream>
#include <string>
namespace clanguml {
namespace t20041 {
template <typename... Args> struct A;
template <typename First, typename... Rest> struct A<First, Rest...> {
void print(First first, Rest... rest)
{
std::cout << first << std::endl;
A<Rest...> a;
a.print(rest...);
}
};
template <> struct A<> {
void print() { }
};
void tmain()
{
using namespace std::literals::string_literals;
A<int, double, std::string> a;
a.print(1, 3.14, "test"s);
}
}
}
```
## Generated PlantUML diagrams
![t20041_sequence](./t20041_sequence.svg "Test case for recursive variadic template class call")
## Generated Mermaid diagrams
![t20041_sequence](./t20041_sequence_mermaid.svg "Test case for recursive variadic template class call")
## Generated JSON models
```json
{
"diagram_type": "sequence",
"name": "t20041_sequence",
"participants": [
{
"display_name": "tmain()",
"id": "1389566400082670258",
"name": "tmain",
"namespace": "clanguml::t20041",
"source_location": {
"column": 6,
"file": "t20041.cc",
"line": 23,
"translation_unit": "t20041.cc"
},
"type": "function"
},
{
"activities": [
{
"display_name": "print(int,double,std::string)",
"id": "532000038063429229",
"name": "print",
"namespace": "",
"source_location": {
"column": 10,
"file": "t20041.cc",
"line": 10,
"translation_unit": "t20041.cc"
},
"type": "method"
}
],
"display_name": "A<int,double,std::string>",
"id": "832678750316145968",
"name": "A",
"namespace": "clanguml::t20041",
"source_location": {
"column": 52,
"file": "t20041.cc",
"line": 9,
"translation_unit": "t20041.cc"
},
"type": "class"
},
{
"activities": [
{
"display_name": "print(double,std::string)",
"id": "1403962403457522629",
"name": "print",
"namespace": "",
"source_location": {
"column": 10,
"file": "t20041.cc",
"line": 10,
"translation_unit": "t20041.cc"
},
"type": "method"
}
],
"display_name": "A<double,std::string>",
"id": "942399465509044163",
"name": "A",
"namespace": "clanguml::t20041",
"source_location": {
"column": 52,
"file": "t20041.cc",
"line": 9,
"translation_unit": "t20041.cc"
},
"type": "class"
},
{
"activities": [
{
"display_name": "print(std::string)",
"id": "1658479415048358058",
"name": "print",
"namespace": "",
"source_location": {
"column": 10,
"file": "t20041.cc",
"line": 10,
"translation_unit": "t20041.cc"
},
"type": "method"
}
],
"display_name": "A<std::string>",
"id": "1390965848075226081",
"name": "A",
"namespace": "clanguml::t20041",
"source_location": {
"column": 52,
"file": "t20041.cc",
"line": 9,
"translation_unit": "t20041.cc"
},
"type": "class"
},
{
"activities": [
{
"display_name": "print()",
"id": "1295142493768214222",
"name": "print",
"namespace": "",
"source_location": {
"column": 10,
"file": "t20041.cc",
"line": 20,
"translation_unit": "t20041.cc"
},
"type": "method"
}
],
"display_name": "A",
"id": "1052108783247143031",
"name": "A",
"namespace": "clanguml::t20041",
"source_location": {
"column": 52,
"file": "t20041.cc",
"line": 9,
"translation_unit": "t20041.cc"
},
"type": "class"
}
],
"sequences": [
{
"messages": [
{
"from": {
"activity_id": "1389566400082670258",
"participant_id": "1389566400082670258"
},
"name": "print(int,double,std::string)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 5,
"file": "t20041.cc",
"line": 28,
"translation_unit": "t20041.cc"
},
"to": {
"activity_id": "532000038063429229",
"participant_id": "832678750316145968"
},
"type": "message"
},
{
"from": {
"activity_id": "532000038063429229",
"participant_id": "832678750316145968"
},
"name": "print(double,std::string)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 9,
"file": "t20041.cc",
"line": 15,
"translation_unit": "t20041.cc"
},
"to": {
"activity_id": "1403962403457522629",
"participant_id": "942399465509044163"
},
"type": "message"
},
{
"from": {
"activity_id": "1403962403457522629",
"participant_id": "942399465509044163"
},
"name": "print(std::string)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 9,
"file": "t20041.cc",
"line": 15,
"translation_unit": "t20041.cc"
},
"to": {
"activity_id": "1658479415048358058",
"participant_id": "1390965848075226081"
},
"type": "message"
},
{
"from": {
"activity_id": "1658479415048358058",
"participant_id": "1390965848075226081"
},
"name": "print()",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 9,
"file": "t20041.cc",
"line": 15,
"translation_unit": "t20041.cc"
},
"to": {
"activity_id": "1295142493768214222",
"participant_id": "1052108783247143031"
},
"type": "message"
}
],
"start_from": {
"id": 1389566400082670258,
"location": "clanguml::t20041::tmain()"
}
}
],
"using_namespace": "clanguml::t20041"
}
```