65 lines
1.1 KiB
Markdown
65 lines
1.1 KiB
Markdown
# t20023 - Try/catch statement sequence diagram test case
|
|
## Config
|
|
```yaml
|
|
compilation_database_dir: ..
|
|
output_directory: puml
|
|
diagrams:
|
|
t20023_sequence:
|
|
type: sequence
|
|
glob:
|
|
- ../../tests/t20023/t20023.cc
|
|
include:
|
|
namespaces:
|
|
- clanguml::t20023
|
|
using_namespace:
|
|
- clanguml::t20023
|
|
start_from:
|
|
- function: "clanguml::t20023::tmain()"
|
|
```
|
|
## Source code
|
|
File t20023.cc
|
|
```cpp
|
|
#include <stdexcept>
|
|
|
|
namespace clanguml {
|
|
namespace t20023 {
|
|
|
|
struct A {
|
|
int a1() { return 1; }
|
|
int a2() { return 2; }
|
|
int a3() { return 3; }
|
|
int a4() { return 3; }
|
|
|
|
int a()
|
|
{
|
|
try {
|
|
return a1();
|
|
}
|
|
catch (std::runtime_error &) {
|
|
return a2();
|
|
}
|
|
catch (std::logic_error &) {
|
|
return a3();
|
|
}
|
|
catch (...) {
|
|
return a4();
|
|
}
|
|
}
|
|
};
|
|
|
|
int tmain()
|
|
{
|
|
A a;
|
|
|
|
int result{};
|
|
|
|
result = a.a();
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
```
|
|
## Generated UML diagrams
|
|

|