59 lines
1022 B
Markdown
59 lines
1022 B
Markdown
# t20028 - Conditional (ternary) '?:' operator test case
|
|
## Config
|
|
```yaml
|
|
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
|
|
```cpp
|
|
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
|
|
 '?:' operator test case")
|