5.6 KiB
5.6 KiB
t20028 - Conditional (ternary) '?:' operator test case
Config
compilation_database_dir: ..
output_directory: puml
diagrams:
t20028_sequence:
type: sequence
glob:
- ../../tests/t20028/t20028.cc
include:
namespaces:
- clanguml::t20028
exclude:
namespaces:
- clanguml::t20028::detail
using_namespace:
- clanguml::t20028
start_from:
- function: "clanguml::t20028::tmain()"
Source code
File t20028.cc
namespace clanguml {
namespace t20028 {
struct A {
int a() { return 0; }
int b() { return 1; }
int c() { return 2; }
int d() { return 3; }
};
namespace detail {
struct B {
int e() { return 4; }
};
} // namespace detail
int tmain()
{
A a;
detail::B b;
int result{};
result = b.e() ? b.e() : 12;
result += a.a() ? a.b() + a.c() : a.d();
return result;
}
}
}
Generated UML diagrams
Generated JSON models
{
"diagram_type": "sequence",
"metadata": {
"clang_uml_version": "0.3.5",
"llvm_version": "Ubuntu clang version 15.0.6",
"schema_version": 1
},
"name": "t20028_sequence",
"participants": [
{
"id": "1347206662193933194",
"name": "clanguml::t20028::tmain()",
"source_location": {
"file": "../../tests/t20028/t20028.cc",
"line": 17
},
"type": "function"
},
{
"id": "2073479923903128898",
"name": "clanguml::t20028::A",
"source_location": {
"file": "../../tests/t20028/t20028.cc",
"line": 4
},
"type": "class"
}
],
"sequences": [
{
"messages": [
{
"activity_id": "1347206662193933194",
"branches": [
{
"messages": [
{
"from": {
"activity_id": "1347206662193933194",
"activity_name": "clanguml::t20028::tmain()",
"participant_id": "1347206662193933194",
"participant_name": "clanguml::t20028::tmain()"
},
"name": "a()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20028/t20028.cc",
"line": 26
},
"to": {
"activity_id": "666210834901940781",
"activity_name": "clanguml::t20028::A::a()",
"participant_id": "2073479923903128898"
},
"type": "message"
},
{
"from": {
"activity_id": "1347206662193933194",
"activity_name": "clanguml::t20028::tmain()",
"participant_id": "1347206662193933194",
"participant_name": "clanguml::t20028::tmain()"
},
"name": "b()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20028/t20028.cc",
"line": 26
},
"to": {
"activity_id": "793793464184037795",
"activity_name": "clanguml::t20028::A::b()",
"participant_id": "2073479923903128898"
},
"type": "message"
},
{
"from": {
"activity_id": "1347206662193933194",
"activity_name": "clanguml::t20028::tmain()",
"participant_id": "1347206662193933194",
"participant_name": "clanguml::t20028::tmain()"
},
"name": "c()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20028/t20028.cc",
"line": 26
},
"to": {
"activity_id": "1582152567698110078",
"activity_name": "clanguml::t20028::A::c()",
"participant_id": "2073479923903128898"
},
"type": "message"
}
],
"type": "consequent"
},
{
"messages": [
{
"from": {
"activity_id": "1347206662193933194",
"activity_name": "clanguml::t20028::tmain()",
"participant_id": "1347206662193933194",
"participant_name": "clanguml::t20028::tmain()"
},
"name": "d()",
"return_type": "int",
"scope": "normal",
"source_location": {
"file": "../../tests/t20028/t20028.cc",
"line": 26
},
"to": {
"activity_id": "1178268687951492696",
"activity_name": "clanguml::t20028::A::d()",
"participant_id": "2073479923903128898"
},
"type": "message"
}
],
"type": "alternative"
}
],
"name": "conditional",
"type": "alt"
}
],
"start_from": {
"id": 1347206662193933194,
"location": "clanguml::t20028::tmain()"
}
}
],
"using_namespace": "clanguml::t20028"
}