8.4 KiB
8.4 KiB
t20008 - Constexpr if sequence diagram test case
Config
compilation_database_dir: ..
output_directory: puml
diagrams:
t20008_sequence:
type: sequence
glob:
- ../../tests/t20008/t20008.cc
include:
namespaces:
- clanguml::t20008
using_namespace:
- clanguml::t20008
start_from:
- function: "clanguml::t20008::tmain()"
Source code
File t20008.cc
#include <string>
#include <type_traits>
namespace clanguml {
namespace t20008 {
template <typename T> struct A {
void a1(T arg) { }
void a2(T arg) { }
void a3(T arg) { }
};
template <typename T> struct B {
A<T> a;
void b(T arg)
{
if constexpr (std::is_integral_v<T>) {
a.a1(arg);
}
else if constexpr (std::is_pointer_v<T>) {
a.a2(arg);
}
else {
a.a3(arg);
}
}
};
void tmain()
{
using namespace std::string_literals;
B<int> bint;
B<const char *> bcharp;
B<std::string> bstring;
bint.b(1);
bcharp.b("1");
bstring.b("1"s);
}
}
}
Generated UML diagrams
Generated JSON models
{
"diagram_type": "sequence",
"metadata": {
"clang_uml_version": "0.3.7-4-g43cc5cb",
"llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)",
"schema_version": 1
},
"name": "t20008_sequence",
"participants": [
{
"id": "1180776240543224244",
"name": "clanguml::t20008::tmain()",
"source_location": {
"column": 6,
"file": "../../tests/t20008/t20008.cc",
"line": 30,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"type": "function"
},
{
"id": "1906510289157013670",
"name": "clanguml::t20008::B<int>",
"source_location": {
"column": 30,
"file": "../../tests/t20008/t20008.cc",
"line": 13,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"type": "class"
},
{
"id": "1376149084762923197",
"name": "clanguml::t20008::A<int>",
"source_location": {
"column": 30,
"file": "../../tests/t20008/t20008.cc",
"line": 7,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"type": "class"
},
{
"id": "867098551202196741",
"name": "clanguml::t20008::B<const char *>",
"source_location": {
"column": 30,
"file": "../../tests/t20008/t20008.cc",
"line": 13,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"type": "class"
},
{
"id": "144833378017373200",
"name": "clanguml::t20008::A<const char *>",
"source_location": {
"column": 30,
"file": "../../tests/t20008/t20008.cc",
"line": 7,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"type": "class"
},
{
"id": "927702553742507923",
"name": "clanguml::t20008::B<std::string>",
"source_location": {
"column": 30,
"file": "../../tests/t20008/t20008.cc",
"line": 13,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"type": "class"
},
{
"id": "390605614583363778",
"name": "clanguml::t20008::A<std::string>",
"source_location": {
"column": 30,
"file": "../../tests/t20008/t20008.cc",
"line": 7,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"type": "class"
}
],
"sequences": [
{
"messages": [
{
"from": {
"activity_id": "1180776240543224244",
"activity_name": "clanguml::t20008::tmain()",
"participant_id": "1180776240543224244",
"participant_name": "clanguml::t20008::tmain()"
},
"name": "b(int)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 5,
"file": "../../tests/t20008/t20008.cc",
"line": 38,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"to": {
"activity_id": "379850145437051189",
"activity_name": "clanguml::t20008::B<int>::b(int)",
"participant_id": "1906510289157013670"
},
"type": "message"
},
{
"from": {
"activity_id": "379850145437051189",
"activity_name": "clanguml::t20008::B<int>::b(int)",
"participant_id": "1906510289157013670"
},
"name": "a1(int)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 13,
"file": "../../tests/t20008/t20008.cc",
"line": 19,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"to": {
"activity_id": "2066363630174644719",
"activity_name": "clanguml::t20008::A<int>::a1(int)",
"participant_id": "1376149084762923197"
},
"type": "message"
},
{
"from": {
"activity_id": "1180776240543224244",
"activity_name": "clanguml::t20008::tmain()",
"participant_id": "1180776240543224244",
"participant_name": "clanguml::t20008::tmain()"
},
"name": "b(const char *)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 5,
"file": "../../tests/t20008/t20008.cc",
"line": 39,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"to": {
"activity_id": "1347162523481637780",
"activity_name": "clanguml::t20008::B<const char *>::b(const char *)",
"participant_id": "867098551202196741"
},
"type": "message"
},
{
"from": {
"activity_id": "1347162523481637780",
"activity_name": "clanguml::t20008::B<const char *>::b(const char *)",
"participant_id": "867098551202196741"
},
"name": "a2(const char *)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 13,
"file": "../../tests/t20008/t20008.cc",
"line": 22,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"to": {
"activity_id": "718650834962275580",
"activity_name": "clanguml::t20008::A<const char *>::a2(const char *)",
"participant_id": "144833378017373200"
},
"type": "message"
},
{
"from": {
"activity_id": "1180776240543224244",
"activity_name": "clanguml::t20008::tmain()",
"participant_id": "1180776240543224244",
"participant_name": "clanguml::t20008::tmain()"
},
"name": "b(std::string)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 5,
"file": "../../tests/t20008/t20008.cc",
"line": 40,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"to": {
"activity_id": "1286410946666951254",
"activity_name": "clanguml::t20008::B<std::string>::b(std::string)",
"participant_id": "927702553742507923"
},
"type": "message"
},
{
"from": {
"activity_id": "1286410946666951254",
"activity_name": "clanguml::t20008::B<std::string>::b(std::string)",
"participant_id": "927702553742507923"
},
"name": "a3(std::string)",
"return_type": "void",
"scope": "normal",
"source_location": {
"column": 13,
"file": "../../tests/t20008/t20008.cc",
"line": 25,
"translation_unit": "../../tests/t20008/t20008.cc"
},
"to": {
"activity_id": "1404594247101138737",
"activity_name": "clanguml::t20008::A<std::string>::a3(std::string)",
"participant_id": "390605614583363778"
},
"type": "message"
}
],
"start_from": {
"id": 1180776240543224244,
"location": "clanguml::t20008::tmain()"
}
}
],
"using_namespace": "clanguml::t20008"
}