Updated test cases documentation
@@ -23,6 +23,7 @@
|
|||||||
* [t00022](./test_cases/t00022.md) - Template method pattern
|
* [t00022](./test_cases/t00022.md) - Template method pattern
|
||||||
* [t00023](./test_cases/t00023.md) - Strategy pattern
|
* [t00023](./test_cases/t00023.md) - Strategy pattern
|
||||||
* [t00024](./test_cases/t00024.md) - Proxy pattern
|
* [t00024](./test_cases/t00024.md) - Proxy pattern
|
||||||
|
* [t00025](./test_cases/t00025.md) - Template proxy pattern
|
||||||
## Sequence diagrams
|
## Sequence diagrams
|
||||||
* [t20001](./test_cases/t20001.md) - Basic sequence diagram
|
* [t20001](./test_cases/t20001.md) - Basic sequence diagram
|
||||||
## Configuration diagrams
|
## Configuration diagrams
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 24 KiB |
@@ -17,36 +17,6 @@ diagrams:
|
|||||||
|
|
||||||
```
|
```
|
||||||
## Source code
|
## Source code
|
||||||
File t00018_impl.cc
|
|
||||||
```cpp
|
|
||||||
#include "t00018_impl.h"
|
|
||||||
#include "t00018.h"
|
|
||||||
|
|
||||||
namespace clanguml {
|
|
||||||
namespace t00018 {
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
widget::widget(int n)
|
|
||||||
: n(n)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void widget::draw(const clanguml::t00018::widget &w) const
|
|
||||||
{
|
|
||||||
if (w.shown())
|
|
||||||
std::cout << "drawing a const widget " << n << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
void widget::draw(const clanguml::t00018::widget &w)
|
|
||||||
{
|
|
||||||
if (w.shown())
|
|
||||||
std::cout << "drawing a non-const widget " << n << '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
File t00018_impl.h
|
File t00018_impl.h
|
||||||
```cpp
|
```cpp
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -131,6 +101,36 @@ widget &widget::operator=(widget &&) = default;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
File t00018_impl.cc
|
||||||
|
```cpp
|
||||||
|
#include "t00018_impl.h"
|
||||||
|
#include "t00018.h"
|
||||||
|
|
||||||
|
namespace clanguml {
|
||||||
|
namespace t00018 {
|
||||||
|
namespace impl {
|
||||||
|
|
||||||
|
widget::widget(int n)
|
||||||
|
: n(n)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void widget::draw(const clanguml::t00018::widget &w) const
|
||||||
|
{
|
||||||
|
if (w.shown())
|
||||||
|
std::cout << "drawing a const widget " << n << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
void widget::draw(const clanguml::t00018::widget &w)
|
||||||
|
{
|
||||||
|
if (w.shown())
|
||||||
|
std::cout << "drawing a non-const widget " << n << '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
## Generated UML diagrams
|
## Generated UML diagrams
|
||||||

|

|
||||||
|
|||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
@@ -22,21 +22,25 @@ diagrams:
|
|||||||
|
|
||||||
```
|
```
|
||||||
## Source code
|
## Source code
|
||||||
File t00019.cc
|
File t00019_layer2.h
|
||||||
```cpp
|
```cpp
|
||||||
#include "t00019_base.h"
|
#pragma once
|
||||||
#include "t00019_layer1.h"
|
|
||||||
#include "t00019_layer2.h"
|
|
||||||
#include "t00019_layer3.h"
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace clanguml {
|
namespace clanguml {
|
||||||
namespace t00019 {
|
namespace t00019 {
|
||||||
|
|
||||||
class A {
|
template <typename LowerLayer> class Layer2 : public LowerLayer {
|
||||||
public:
|
|
||||||
std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> layers;
|
using LowerLayer::LowerLayer;
|
||||||
|
|
||||||
|
using LowerLayer::m1;
|
||||||
|
|
||||||
|
using LowerLayer::m2;
|
||||||
|
|
||||||
|
int all_calls_count() const
|
||||||
|
{
|
||||||
|
return LowerLayer::m1_calls() + LowerLayer::m2_calls();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,6 +98,26 @@ template <typename LowerLayer> class Layer1 : public LowerLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
File t00019.cc
|
||||||
|
```cpp
|
||||||
|
#include "t00019_base.h"
|
||||||
|
#include "t00019_layer1.h"
|
||||||
|
#include "t00019_layer2.h"
|
||||||
|
#include "t00019_layer3.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace clanguml {
|
||||||
|
namespace t00019 {
|
||||||
|
|
||||||
|
class A {
|
||||||
|
public:
|
||||||
|
std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> layers;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
File t00019_layer3.h
|
File t00019_layer3.h
|
||||||
```cpp
|
```cpp
|
||||||
@@ -131,30 +155,6 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
|
||||||
File t00019_layer2.h
|
|
||||||
```cpp
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace clanguml {
|
|
||||||
namespace t00019 {
|
|
||||||
|
|
||||||
template <typename LowerLayer> class Layer2 : public LowerLayer {
|
|
||||||
|
|
||||||
using LowerLayer::LowerLayer;
|
|
||||||
|
|
||||||
using LowerLayer::m1;
|
|
||||||
|
|
||||||
using LowerLayer::m2;
|
|
||||||
|
|
||||||
int all_calls_count() const
|
|
||||||
{
|
|
||||||
return LowerLayer::m1_calls() + LowerLayer::m2_calls();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
```
|
||||||
## Generated UML diagrams
|
## Generated UML diagrams
|
||||||

|

|
||||||
|
|||||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 18 KiB |
@@ -33,20 +33,20 @@ public:
|
|||||||
|
|
||||||
class Target1 : public Target {
|
class Target1 : public Target {
|
||||||
public:
|
public:
|
||||||
void m1() override { }
|
void m1() override {}
|
||||||
void m2() override { }
|
void m2() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Target2 : public Target {
|
class Target2 : public Target {
|
||||||
public:
|
public:
|
||||||
void m1() override { }
|
void m1() override {}
|
||||||
void m2() override { }
|
void m2() override {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Proxy : public Target {
|
class Proxy : public Target {
|
||||||
public:
|
public:
|
||||||
Proxy(std::shared_ptr<Target> target)
|
Proxy(std::shared_ptr<Target> target)
|
||||||
: m_target {std::move(target)}
|
: m_target{std::move(target)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void m1() override { m_target->m1(); }
|
void m1() override { m_target->m1(); }
|
||||||
@@ -55,7 +55,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::shared_ptr<Target> m_target;
|
std::shared_ptr<Target> m_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
61
docs/test_cases/t00025.md
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# t00025 - Template proxy pattern
|
||||||
|
## Config
|
||||||
|
```yaml
|
||||||
|
compilation_database_dir: ..
|
||||||
|
output_directory: puml
|
||||||
|
diagrams:
|
||||||
|
t00025_class:
|
||||||
|
type: class
|
||||||
|
glob:
|
||||||
|
- ../../tests/t00025/t00025.cc
|
||||||
|
using_namespace:
|
||||||
|
- clanguml::t00025
|
||||||
|
include:
|
||||||
|
namespaces:
|
||||||
|
- clanguml::t00025
|
||||||
|
|
||||||
|
```
|
||||||
|
## Source code
|
||||||
|
File t00025.cc
|
||||||
|
```cpp
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace clanguml {
|
||||||
|
namespace t00025 {
|
||||||
|
|
||||||
|
class Target1 {
|
||||||
|
public:
|
||||||
|
void m1() {}
|
||||||
|
void m2() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class Target2 {
|
||||||
|
public:
|
||||||
|
void m1() {}
|
||||||
|
void m2() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T> class Proxy {
|
||||||
|
public:
|
||||||
|
Proxy(std::shared_ptr<T> target)
|
||||||
|
: m_target{std::move(target)}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void m1() { m_target->m1(); }
|
||||||
|
void m2() { m_target->m2(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<T> m_target;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProxyHolder {
|
||||||
|
public:
|
||||||
|
Proxy<Target1> proxy1;
|
||||||
|
Proxy<Target2> proxy2;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
## Generated UML diagrams
|
||||||
|

|
||||||
BIN
docs/test_cases/t00025_class.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |