Files
clang-uml/docs/test_cases/t20007.md
Bartek Kryza 3e97a37c5f Updated docs
2023-05-28 19:08:10 +02:00

174 lines
4.8 KiB
Markdown

# t20007 - Class template variadic argument list sequence diagram
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
t20007_sequence:
type: sequence
glob:
- ../../tests/t20007/t20007.cc
include:
namespaces:
- clanguml::t20007
using_namespace:
- clanguml::t20007
start_from:
- function: "clanguml::t20007::tmain()"
```
## Source code
File t20007.cc
```cpp
#include <string>
#include <utility>
namespace clanguml {
namespace t20007 {
template <typename First, typename... Args> struct Adder {
First add(First &&arg, Args &&...args) { return (arg + ... + args); }
};
void tmain()
{
using namespace std::string_literals;
Adder<int, int> adder1;
Adder<int, float, double> adder2;
Adder<std::string, std::string, std::string> adder3;
[[maybe_unused]] auto res1 = adder1.add(2, 2);
[[maybe_unused]] auto res2 = adder2.add(1, 2.0, 3.0);
[[maybe_unused]] auto res3 = adder3.add("one"s, "two"s, "three"s);
}
}
}
```
## Generated UML diagrams
![t20007_sequence](./t20007_sequence.svg "Class template variadic argument list sequence diagram")
## Generated JSON models
```json
{
"diagram_type": "sequence",
"metadata": {
"clang_uml_version": "0.3.5-27-g81c7ce7",
"llvm_version": "Ubuntu clang version 15.0.6",
"schema_version": 1
},
"name": "t20007_sequence",
"participants": [
{
"id": "622662006747239840",
"name": "clanguml::t20007::tmain()",
"source_location": {
"file": "../../tests/t20007/t20007.cc",
"line": 11
},
"type": "function"
},
{
"id": "1742497005509009302",
"name": "clanguml::t20007::Adder<int,int>",
"source_location": {
"file": "../../tests/t20007/t20007.cc",
"line": 7
},
"type": "class"
},
{
"id": "599640474306956868",
"name": "clanguml::t20007::Adder<int,float,double>",
"source_location": {
"file": "../../tests/t20007/t20007.cc",
"line": 7
},
"type": "class"
},
{
"id": "228191787514523926",
"name": "clanguml::t20007::Adder<std::string,std::string,std::string>",
"source_location": {
"file": "../../tests/t20007/t20007.cc",
"line": 7
},
"type": "class"
}
],
"sequences": [
{
"messages": [
{
"from": {
"activity_id": "622662006747239840",
"activity_name": "clanguml::t20007::tmain()",
"participant_id": "622662006747239840",
"participant_name": "clanguml::t20007::tmain()"
},
"name": "add(int &&,int &&)",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20007/t20007.cc",
"line": 19
},
"to": {
"activity_id": "438133719207269065",
"activity_name": "clanguml::t20007::Adder<int,int>::add(int &&,int &&)",
"participant_id": "1742497005509009302"
},
"type": "message"
},
{
"from": {
"activity_id": "622662006747239840",
"activity_name": "clanguml::t20007::tmain()",
"participant_id": "622662006747239840",
"participant_name": "clanguml::t20007::tmain()"
},
"name": "add(int &&,float &&,double &&)",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20007/t20007.cc",
"line": 20
},
"to": {
"activity_id": "9522724767688870",
"activity_name": "clanguml::t20007::Adder<int,float,double>::add(int &&,float &&,double &&)",
"participant_id": "599640474306956868"
},
"type": "message"
},
{
"from": {
"activity_id": "622662006747239840",
"activity_name": "clanguml::t20007::tmain()",
"participant_id": "622662006747239840",
"participant_name": "clanguml::t20007::tmain()"
},
"name": "add(std::string &&,std::string &&,std::string &&)",
"return_type": "class std::basic_string<char>",
"scope": "normal",
"source_location": {
"file": "../../tests/t20007/t20007.cc",
"line": 21
},
"to": {
"activity_id": "384866641042941480",
"activity_name": "clanguml::t20007::Adder<std::string,std::string,std::string>::add(std::string &&,std::string &&,std::string &&)",
"participant_id": "228191787514523926"
},
"type": "message"
}
],
"start_from": {
"id": 622662006747239840,
"location": "clanguml::t20007::tmain()"
}
}
],
"using_namespace": "clanguml::t20007"
}
```