diff --git a/docs/test_cases.md b/docs/test_cases.md index 3fbb9f9d..9f87eca0 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -23,6 +23,7 @@ * [t00022](./test_cases/t00022.md) - Template method pattern * [t00023](./test_cases/t00023.md) - Strategy pattern * [t00024](./test_cases/t00024.md) - Proxy pattern + * [t00025](./test_cases/t00025.md) - Template proxy pattern ## Sequence diagrams * [t20001](./test_cases/t20001.md) - Basic sequence diagram ## Configuration diagrams diff --git a/docs/test_cases/t00002_class.png b/docs/test_cases/t00002_class.png index 1afa8b14..3893723c 100644 Binary files a/docs/test_cases/t00002_class.png and b/docs/test_cases/t00002_class.png differ diff --git a/docs/test_cases/t00003_class.png b/docs/test_cases/t00003_class.png index 1275a434..5244f94c 100644 Binary files a/docs/test_cases/t00003_class.png and b/docs/test_cases/t00003_class.png differ diff --git a/docs/test_cases/t00004_class.png b/docs/test_cases/t00004_class.png index ba383e17..d77cb040 100644 Binary files a/docs/test_cases/t00004_class.png and b/docs/test_cases/t00004_class.png differ diff --git a/docs/test_cases/t00005_class.png b/docs/test_cases/t00005_class.png index 0b418da6..7d28d2b9 100644 Binary files a/docs/test_cases/t00005_class.png and b/docs/test_cases/t00005_class.png differ diff --git a/docs/test_cases/t00006_class.png b/docs/test_cases/t00006_class.png index 648d53ad..d16d6322 100644 Binary files a/docs/test_cases/t00006_class.png and b/docs/test_cases/t00006_class.png differ diff --git a/docs/test_cases/t00007_class.png b/docs/test_cases/t00007_class.png index f802af97..c36315f3 100644 Binary files a/docs/test_cases/t00007_class.png and b/docs/test_cases/t00007_class.png differ diff --git a/docs/test_cases/t00008_class.png b/docs/test_cases/t00008_class.png index 70837f03..694d620c 100644 Binary files a/docs/test_cases/t00008_class.png and b/docs/test_cases/t00008_class.png differ diff --git a/docs/test_cases/t00009_class.png b/docs/test_cases/t00009_class.png index 2e93ec78..e8be7a19 100644 Binary files a/docs/test_cases/t00009_class.png and b/docs/test_cases/t00009_class.png differ diff --git a/docs/test_cases/t00010_class.png b/docs/test_cases/t00010_class.png index b3c96344..ce2b69ef 100644 Binary files a/docs/test_cases/t00010_class.png and b/docs/test_cases/t00010_class.png differ diff --git a/docs/test_cases/t00011_class.png b/docs/test_cases/t00011_class.png index 99bdb36c..ef329d4c 100644 Binary files a/docs/test_cases/t00011_class.png and b/docs/test_cases/t00011_class.png differ diff --git a/docs/test_cases/t00012_class.png b/docs/test_cases/t00012_class.png index 7ebd9577..223502dc 100644 Binary files a/docs/test_cases/t00012_class.png and b/docs/test_cases/t00012_class.png differ diff --git a/docs/test_cases/t00013_class.png b/docs/test_cases/t00013_class.png index f011be6a..5032ee20 100644 Binary files a/docs/test_cases/t00013_class.png and b/docs/test_cases/t00013_class.png differ diff --git a/docs/test_cases/t00014_class.png b/docs/test_cases/t00014_class.png index c9f5390a..e6f8c223 100644 Binary files a/docs/test_cases/t00014_class.png and b/docs/test_cases/t00014_class.png differ diff --git a/docs/test_cases/t00015_class.png b/docs/test_cases/t00015_class.png index 24e8b4fb..bedf4146 100644 Binary files a/docs/test_cases/t00015_class.png and b/docs/test_cases/t00015_class.png differ diff --git a/docs/test_cases/t00016_class.png b/docs/test_cases/t00016_class.png index 82b5fc5b..b8e20f56 100644 Binary files a/docs/test_cases/t00016_class.png and b/docs/test_cases/t00016_class.png differ diff --git a/docs/test_cases/t00017_class.png b/docs/test_cases/t00017_class.png index 249ecba5..d7a0413d 100644 Binary files a/docs/test_cases/t00017_class.png and b/docs/test_cases/t00017_class.png differ diff --git a/docs/test_cases/t00018.md b/docs/test_cases/t00018.md index 1b72af09..760615a8 100644 --- a/docs/test_cases/t00018.md +++ b/docs/test_cases/t00018.md @@ -17,36 +17,6 @@ diagrams: ``` ## 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 ```cpp #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 ![t00018_class](./t00018_class.png "Pimpl pattern") diff --git a/docs/test_cases/t00018_class.png b/docs/test_cases/t00018_class.png index 4cd3f4cb..a5911e01 100644 Binary files a/docs/test_cases/t00018_class.png and b/docs/test_cases/t00018_class.png differ diff --git a/docs/test_cases/t00019.md b/docs/test_cases/t00019.md index 6a7a8b01..5d835bfc 100644 --- a/docs/test_cases/t00019.md +++ b/docs/test_cases/t00019.md @@ -22,21 +22,25 @@ diagrams: ``` ## Source code -File t00019.cc +File t00019_layer2.h ```cpp -#include "t00019_base.h" -#include "t00019_layer1.h" -#include "t00019_layer2.h" -#include "t00019_layer3.h" - -#include +#pragma once namespace clanguml { namespace t00019 { -class A { -public: - std::unique_ptr>>> layers; +template 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(); + } }; } } @@ -94,6 +98,26 @@ template 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 + +namespace clanguml { +namespace t00019 { + +class A { +public: + std::unique_ptr>>> layers; +}; +} +} + ``` File t00019_layer3.h ```cpp @@ -131,30 +155,6 @@ private: } } -``` -File t00019_layer2.h -```cpp -#pragma once - -namespace clanguml { -namespace t00019 { - -template 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 ![t00019_class](./t00019_class.png "Layercake pattern") diff --git a/docs/test_cases/t00019_class.png b/docs/test_cases/t00019_class.png index f8ac04d4..c2eb10e4 100644 Binary files a/docs/test_cases/t00019_class.png and b/docs/test_cases/t00019_class.png differ diff --git a/docs/test_cases/t00020_class.png b/docs/test_cases/t00020_class.png index 5b15ac07..719391aa 100644 Binary files a/docs/test_cases/t00020_class.png and b/docs/test_cases/t00020_class.png differ diff --git a/docs/test_cases/t00021_class.png b/docs/test_cases/t00021_class.png index ec18ba33..3dfb5c90 100644 Binary files a/docs/test_cases/t00021_class.png and b/docs/test_cases/t00021_class.png differ diff --git a/docs/test_cases/t00022_class.png b/docs/test_cases/t00022_class.png index abf6c9d6..e53ea8a4 100644 Binary files a/docs/test_cases/t00022_class.png and b/docs/test_cases/t00022_class.png differ diff --git a/docs/test_cases/t00023_class.png b/docs/test_cases/t00023_class.png index f9990de8..390eb881 100644 Binary files a/docs/test_cases/t00023_class.png and b/docs/test_cases/t00023_class.png differ diff --git a/docs/test_cases/t00024.md b/docs/test_cases/t00024.md index 1ecd4106..f4266f2e 100644 --- a/docs/test_cases/t00024.md +++ b/docs/test_cases/t00024.md @@ -33,20 +33,20 @@ public: class Target1 : public Target { public: - void m1() override { } - void m2() override { } + void m1() override {} + void m2() override {} }; class Target2 : public Target { public: - void m1() override { } - void m2() override { } + void m1() override {} + void m2() override {} }; class Proxy : public Target { public: Proxy(std::shared_ptr target) - : m_target {std::move(target)} + : m_target{std::move(target)} { } void m1() override { m_target->m1(); } @@ -55,7 +55,6 @@ public: private: std::shared_ptr m_target; }; - } } diff --git a/docs/test_cases/t00024_class.png b/docs/test_cases/t00024_class.png index 8cb2429a..6da3e6fc 100644 Binary files a/docs/test_cases/t00024_class.png and b/docs/test_cases/t00024_class.png differ diff --git a/docs/test_cases/t00025.md b/docs/test_cases/t00025.md new file mode 100644 index 00000000..d9cf06dd --- /dev/null +++ b/docs/test_cases/t00025.md @@ -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 + +namespace clanguml { +namespace t00025 { + +class Target1 { +public: + void m1() {} + void m2() {} +}; + +class Target2 { +public: + void m1() {} + void m2() {} +}; + +template class Proxy { +public: + Proxy(std::shared_ptr target) + : m_target{std::move(target)} + { + } + void m1() { m_target->m1(); } + void m2() { m_target->m2(); } + +private: + std::shared_ptr m_target; +}; + +class ProxyHolder { +public: + Proxy proxy1; + Proxy proxy2; +}; +} +} + +``` +## Generated UML diagrams +![t00025_class](./t00025_class.png "Template proxy pattern") diff --git a/docs/test_cases/t00025_class.png b/docs/test_cases/t00025_class.png new file mode 100644 index 00000000..414afdbd Binary files /dev/null and b/docs/test_cases/t00025_class.png differ diff --git a/docs/test_cases/t20001_sequence.png b/docs/test_cases/t20001_sequence.png index 9042abe3..8466db95 100644 Binary files a/docs/test_cases/t20001_sequence.png and b/docs/test_cases/t20001_sequence.png differ diff --git a/docs/test_cases/t90000_class.png b/docs/test_cases/t90000_class.png index 3a38629b..042201e5 100644 Binary files a/docs/test_cases/t90000_class.png and b/docs/test_cases/t90000_class.png differ