From b2fd763a89770edc4f5b3fef1b99303680c50dea Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 5 Mar 2023 11:39:39 +0100 Subject: [PATCH 01/15] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcd3cda4..980df328 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # CHANGELOG + * Fixed namespace handling for nested template specializations + ### 0.3.2 * Added initial support for C++20 concept rendering (#96) * Added support for plain C11 translation units (#97) From f16c0e4a17578acedd9b5626a3982c0deaa4c46d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 5 Mar 2023 11:41:16 +0100 Subject: [PATCH 02/15] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 36 ++-- docs/test_cases/t00003_class.svg | 46 ++--- docs/test_cases/t00004.md | 9 +- docs/test_cases/t00004_class.svg | 76 ++++---- docs/test_cases/t00005.md | 33 ++-- docs/test_cases/t00005_class.svg | 110 ++++++------ docs/test_cases/t00006.md | 48 ++--- docs/test_cases/t00006_class.svg | 132 +++++++------- docs/test_cases/t00007.md | 9 +- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008.md | 15 ++ docs/test_cases/t00008_class.svg | 140 +++++++++------ docs/test_cases/t00009_class.svg | 32 ++-- docs/test_cases/t00010_class.svg | 34 ++-- docs/test_cases/t00011.md | 3 +- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 +++---- docs/test_cases/t00013_class.svg | 82 ++++----- docs/test_cases/t00014_class.svg | 116 ++++++------ docs/test_cases/t00015.md | 15 +- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 92 ++++------ docs/test_cases/t00017.md | 33 ++-- docs/test_cases/t00017_class.svg | 66 +++---- docs/test_cases/t00018_class.svg | 18 +- docs/test_cases/t00019_class.svg | 40 ++--- docs/test_cases/t00020_class.svg | 38 ++-- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 +-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++-- docs/test_cases/t00026_class.svg | 42 ++--- docs/test_cases/t00027_class.svg | 58 +++--- docs/test_cases/t00028.md | 15 +- docs/test_cases/t00028_class.svg | 82 ++++----- docs/test_cases/t00029.md | 18 +- docs/test_cases/t00029_class.svg | 50 +++--- docs/test_cases/t00030.md | 15 +- docs/test_cases/t00030_class.svg | 46 ++--- docs/test_cases/t00031.md | 6 +- docs/test_cases/t00031_class.svg | 50 +++--- docs/test_cases/t00032.md | 6 +- docs/test_cases/t00032_class.svg | 40 ++--- docs/test_cases/t00033_class.svg | 48 ++--- docs/test_cases/t00034.md | 3 +- docs/test_cases/t00034_class.svg | 168 ++++++++--------- docs/test_cases/t00035.md | 15 +- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036.md | 3 +- docs/test_cases/t00036_class.svg | 38 ++-- docs/test_cases/t00037_class.svg | 54 +++--- docs/test_cases/t00038.md | 30 ++-- docs/test_cases/t00038_class.svg | 270 ++++++++++++++-------------- docs/test_cases/t00039.md | 36 ++-- docs/test_cases/t00039_class.svg | 78 ++++---- docs/test_cases/t00040.md | 3 +- docs/test_cases/t00040_class.svg | 26 +-- docs/test_cases/t00041.md | 39 ++-- docs/test_cases/t00041_class.svg | 208 ++++++++++----------- docs/test_cases/t00042_class.svg | 159 ++++++++-------- docs/test_cases/t00043.md | 12 +- docs/test_cases/t00043_class.svg | 50 +++--- docs/test_cases/t00044.md | 3 +- docs/test_cases/t00044_class.svg | 140 +++++---------- docs/test_cases/t00045.md | 30 ++-- docs/test_cases/t00045_class.svg | 70 ++++---- docs/test_cases/t00046.md | 24 +-- docs/test_cases/t00046_class.svg | 64 +++---- docs/test_cases/t00047_class.svg | 90 +++++----- docs/test_cases/t00048_class.svg | 50 +++--- docs/test_cases/t00049_class.svg | 32 ++-- docs/test_cases/t00050.md | 21 +-- docs/test_cases/t00050_class.svg | 72 ++++---- docs/test_cases/t00051_class.svg | 106 +++++------ docs/test_cases/t00052_class.svg | 34 ++-- docs/test_cases/t00053.md | 42 ++--- docs/test_cases/t00053_class.svg | 70 ++++---- docs/test_cases/t00054.md | 42 ++--- docs/test_cases/t00054_class.svg | 78 ++++---- docs/test_cases/t00055.md | 30 ++-- docs/test_cases/t00055_class.svg | 42 ++--- docs/test_cases/t00056.md | 61 +++---- docs/test_cases/t00056_class.svg | 94 +++++----- docs/test_cases/t00057_class.svg | 114 ++++++------ docs/test_cases/t00058.md | 4 +- docs/test_cases/t00058_class.svg | 48 ++--- docs/test_cases/t00059.md | 19 +- docs/test_cases/t00059_class.svg | 50 +++--- docs/test_cases/t20001_sequence.svg | 62 +++---- docs/test_cases/t20002_sequence.svg | 48 ++--- docs/test_cases/t20003_sequence.svg | 48 ++--- docs/test_cases/t20004_sequence.svg | 120 ++++++------- docs/test_cases/t20005_sequence.svg | 36 ++-- docs/test_cases/t20006_sequence.svg | 150 ++++++++-------- docs/test_cases/t20007_sequence.svg | 48 ++--- docs/test_cases/t20008_sequence.svg | 84 ++++----- docs/test_cases/t20009_sequence.svg | 84 ++++----- docs/test_cases/t20010_sequence.svg | 72 ++++---- docs/test_cases/t20011_sequence.svg | 72 ++++---- docs/test_cases/t20012_sequence.svg | 204 ++++++++++----------- docs/test_cases/t20013_sequence.svg | 60 +++---- docs/test_cases/t20014_sequence.svg | 72 ++++---- docs/test_cases/t20015_sequence.svg | 24 +-- docs/test_cases/t20016_sequence.svg | 48 ++--- docs/test_cases/t20017_sequence.svg | 48 ++--- docs/test_cases/t20018_sequence.svg | 96 +++++----- docs/test_cases/t20019_sequence.svg | 84 ++++----- docs/test_cases/t20020_sequence.svg | 118 ++++++------ docs/test_cases/t20021_sequence.svg | 106 +++++------ docs/test_cases/t20022_sequence.svg | 36 ++-- docs/test_cases/t20023_sequence.svg | 50 +++--- docs/test_cases/t20024_sequence.svg | 88 ++++----- docs/test_cases/t20025_sequence.svg | 42 ++--- docs/test_cases/t20026_sequence.svg | 24 +-- docs/test_cases/t20027_sequence.svg | 24 +-- docs/test_cases/t20028_sequence.svg | 44 ++--- docs/test_cases/t20029_sequence.svg | 80 ++++----- docs/test_cases/t30001_package.svg | 54 +++--- docs/test_cases/t30002.md | 51 ++---- docs/test_cases/t30002_package.svg | 90 +++++----- docs/test_cases/t30003.md | 15 +- docs/test_cases/t30003_package.svg | 26 +-- docs/test_cases/t30004_package.svg | 38 ++-- docs/test_cases/t30005.md | 3 +- docs/test_cases/t30005_package.svg | 38 ++-- docs/test_cases/t30006.md | 6 +- docs/test_cases/t30006_package.svg | 18 +- docs/test_cases/t30007.md | 6 +- docs/test_cases/t30007_package.svg | 22 +-- docs/test_cases/t30008.md | 6 +- docs/test_cases/t30008_package.svg | 34 ++-- docs/test_cases/t30009_package.svg | 42 ++--- docs/test_cases/t40001_include.svg | 34 ++-- docs/test_cases/t40002_include.svg | 34 ++-- docs/test_cases/t40003_include.svg | 50 +++--- 136 files changed, 3475 insertions(+), 3773 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index de1de2bc..0f040410 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ foo_c() = 0 : void - - + + B @@ -31,8 +31,8 @@ foo_a() : void - - + + C @@ -41,18 +41,18 @@ foo_c() : void - - + + D - + - + as : std::vector<A *> @@ -60,18 +60,18 @@ foo_a() : void foo_c() : void - - + + E - + - + as : std::vector<A *> @@ -79,13 +79,13 @@ foo_a() : void foo_c() : void - + This is class A - + This is class B - + This is class D diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index 49c2403f..3f80c023 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - + + A - + - + public_member : int - + - + protected_member : int - + - + private_member : int - + - + a_ : int - + - + b_ : int - + - + c_ : int - + - + static_int : int - + - + static_const_int : const int - + - + auto_member : const unsigned long @@ -112,11 +112,11 @@ protected_method() : void private_method() : void - + - + compare : std::function<bool (const int)> diff --git a/docs/test_cases/t00004.md b/docs/test_cases/t00004.md index fc60fe3d..a20b9847 100644 --- a/docs/test_cases/t00004.md +++ b/docs/test_cases/t00004.md @@ -36,8 +36,7 @@ public: public: enum class Lights { Green, Yellow, Red }; - class AAA { - }; + class AAA { }; }; void foo2() const { } @@ -48,8 +47,7 @@ public: T t; class AA { - class AAA { - }; + class AAA { }; enum class CCC { CCC_1, CCC_2 }; }; @@ -68,8 +66,7 @@ class D { public: enum class AA { AA_1, AA_2, AA_3 }; - class DD { - }; + class DD { }; }; } diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index b89b82e5..9714a145 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + B - - + + B::AA @@ -28,8 +28,8 @@ AA_3 - - + + A @@ -40,16 +40,16 @@ foo2() const : void - - + + A::AA - - + + A::AA::Lights @@ -59,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005.md b/docs/test_cases/t00005.md index 8771f0e3..7e566ae1 100644 --- a/docs/test_cases/t00005.md +++ b/docs/test_cases/t00005.md @@ -20,38 +20,27 @@ File t00005.cc ```cpp namespace clanguml { namespace t00005 { -class A { -}; +class A { }; -class B { -}; +class B { }; -class C { -}; +class C { }; -class D { -}; +class D { }; -class E { -}; +class E { }; -class F { -}; +class F { }; -class G { -}; +class G { }; -class H { -}; +class H { }; -class I { -}; +class I { }; -class J { -}; +class J { }; -class K { -}; +class K { }; class R { public: diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index d3aafd19..7986711f 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,204 +9,204 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & - + - + a : A - + - + b : B * - + - + c : C & - + - + d : const D * - + - + e : const E & - + - + f : F && - + - + g : G ** - + - + h : H *** - + - + i : I *& - + - + j : volatile J * - + - + k : K * diff --git a/docs/test_cases/t00006.md b/docs/test_cases/t00006.md index 63912be4..7711000b 100644 --- a/docs/test_cases/t00006.md +++ b/docs/test_cases/t00006.md @@ -24,53 +24,37 @@ File t00006.cc namespace clanguml { namespace t00006 { -class A { -}; +class A { }; -class B { -}; +class B { }; -class C { -}; +class C { }; -class D { -}; +class D { }; -class E { -}; +class E { }; -class F { -}; +class F { }; -class G { -}; +class G { }; -class H { -}; +class H { }; -class I { -}; +class I { }; -class J { -}; +class J { }; -class K { -}; +class K { }; -class L { -}; +class L { }; -class M { -}; +class M { }; -class N { -}; +class N { }; -class NN { -}; +class NN { }; -class NNN { -}; +class NNN { }; template class custom_container { public: diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 4e105753..58464d1a 100644 --- a/docs/test_cases/t00006_class.svg +++ b/docs/test_cases/t00006_class.svg @@ -1,6 +1,6 @@ - + @@ -9,136 +9,136 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + L - - + + M - - + + N - - + + NN - - + + NNN - - + + custom_container @@ -146,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ E - - + + R - + - + a : std::vector<A> - + - + b : std::vector<B *> - + - + c : std::map<int,C> - + - + d : std::map<int,D *> - + - + e : custom_container<E> - + - + f : std::vector<std::vector<F>> - + - + g : std::map<int,std::vector<G *>> - + - + h : std::array<H,10> - + - + i : std::array<I *,5> - + - + j : J[10] - + - + k : K *[20] - + - + lm : std::vector<std::pair<L,M>> - + - + ns : std::tuple<N,NN,NNN> diff --git a/docs/test_cases/t00007.md b/docs/test_cases/t00007.md index 0401caf3..2864b1c6 100644 --- a/docs/test_cases/t00007.md +++ b/docs/test_cases/t00007.md @@ -22,14 +22,11 @@ File t00007.cc namespace clanguml { namespace t00007 { -class A { -}; +class A { }; -class B { -}; +class B { }; -class C { -}; +class C { }; class R { public: diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index 3bd0c033..e068c715 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> diff --git a/docs/test_cases/t00008.md b/docs/test_cases/t00008.md index 0da6070e..078627e1 100644 --- a/docs/test_cases/t00008.md +++ b/docs/test_cases/t00008.md @@ -52,6 +52,21 @@ struct D { void add(int i) { ints.template_template.values.push_back(i); } }; + +struct E { + template struct nested_template { + using DT = ET; + + static DT *get(ET *d) { return d; } + }; +}; + +template <> struct E::nested_template { + using DeclType = char; + + static DeclType *getDecl(char *c) { return c; } +}; + } // namespace t00008 } // namespace clanguml diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index 7efd2707..c64910a3 100644 --- a/docs/test_cases/t00008_class.svg +++ b/docs/test_cases/t00008_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,8 +9,8 @@ - - + + A @@ -18,51 +18,51 @@ T,P,CMP,int N - + - + value : T - + - + pointer : T * - + - + reference : T & - + - + values : std::vector<P> - + - + ints : std::array<int,N> - + - + comparator : CMP - - + + Vector @@ -70,51 +70,51 @@ T - + - + values : std::vector<T> - - - - - B - - T,C<> - + + + + + B + + T,C<> + - - - + + + - - template_template : C<T> + + template_template : C<T> - - - - - B - - int,Vector - - - - + + + + + B + + int,Vector + + + + D - + - + ints : B<int,Vector> @@ -122,11 +122,51 @@ add(int i) : void D<Items...>(std::tuple<Items...> * ) : void - - - - + + + + + E + + + + + + + + E::nested_template + + ET + + + + get(ET * d) : E::nested_template::DT * + + + + + + E::nested_template + + char + + + + + + + ints + + + + + + + + + + diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 29d753db..249fba1c 100644 --- a/docs/test_cases/t00009_class.svg +++ b/docs/test_cases/t00009_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ std::vector<std::string> - - + + B - + - + aint : A<int> - + - + astring : A<std::string> * - + - + avector : A<std::vector<std::string>> & diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index 7d2b82e4..f5937149 100644 --- a/docs/test_cases/t00010_class.svg +++ b/docs/test_cases/t00010_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011.md b/docs/test_cases/t00011.md index 036dd5d2..0c792259 100644 --- a/docs/test_cases/t00011.md +++ b/docs/test_cases/t00011.md @@ -19,8 +19,7 @@ diagrams: File t00011.cc ```cpp namespace external { -class C { -}; +class C { }; } namespace clanguml { diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index a666def9..08ab6b35 100644 --- a/docs/test_cases/t00011_class.svg +++ b/docs/test_cases/t00011_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + D @@ -18,16 +18,16 @@ T - + - + value : T - - + + A @@ -36,18 +36,18 @@ foo() : void - - + + B - + - + m_a : A * diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index e0c40a2a..d97448ac 100644 --- a/docs/test_cases/t00012_class.svg +++ b/docs/test_cases/t00012_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,23 +18,23 @@ T,Ts... - + - + value : T - + - + values : std::variant<Ts...> - - + + B @@ -43,15 +43,15 @@ - + - + ints : std::array<int,sizeof...(Is)> - - + + C @@ -60,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3 - - + + R - + - + a1 : A<int,std::string,float> - + - + a2 : A<int,std::string,bool> - + - + b1 : B<3,2,1> - + - + b2 : B<1,1,1,1> - + - + c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> - + Long template annotation diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index e765fa19..c4afae0a 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ABCD::F @@ -18,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 9e65c781..297aa28e 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + intstring : AIntString - + - + stringstring : AStringString - + - + bstringstring : BStringString - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015.md b/docs/test_cases/t00015.md index ff2cea51..96fafa5b 100644 --- a/docs/test_cases/t00015.md +++ b/docs/test_cases/t00015.md @@ -23,30 +23,25 @@ namespace t00015 { namespace ns1 { inline namespace ns2_v1_0_0 { -class A { -}; +class A { }; } namespace ns2_v0_9_0 { -class [[deprecated]] A { -}; +class [[deprecated]] A { }; } namespace { -class Anon final : public A { -}; +class Anon final : public A { }; } } // namespace ns1 namespace ns3 { namespace ns1::ns2 { -class Anon : public t00015::ns1::A { -}; +class Anon : public t00015::ns1::A { }; } -class B : public ns1::ns2::Anon { -}; +class B : public ns1::ns2::Anon { }; } } // namespace t00015 } // namespace clanguml diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 77195a8c..e4c2ec3f 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + ns1::A - - + + ns1::ns2_v0_9_0::A - - + + ns1::Anon - - + + ns3::ns1::ns2::Anon - - + + ns3::B diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg index 15d53ba8..65caea3b 100644 --- a/docs/test_cases/t00016_class.svg +++ b/docs/test_cases/t00016_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,95 +9,75 @@ - - - - - is_numeric<> - - - value : enum - + + + + + is_numeric<> + + + value : enum + - - - - - is_numeric - - - value : enum - - - - + + is_numeric float - - value : enum - + - - + + is_numeric char - - value : enum - + - - + + is_numeric unsigned int - - value : enum - + - - + + is_numeric int - - value : enum - + - - + + is_numeric bool - - value : enum - + - - - - - - - - - - + + + + + + + + + + diff --git a/docs/test_cases/t00017.md b/docs/test_cases/t00017.md index 7cb8f176..b5dc2913 100644 --- a/docs/test_cases/t00017.md +++ b/docs/test_cases/t00017.md @@ -23,38 +23,27 @@ File t00017.cc namespace clanguml { namespace t00017 { -class A { -}; +class A { }; -class B { -}; +class B { }; -class C { -}; +class C { }; -class D { -}; +class D { }; -class E { -}; +class E { }; -class F { -}; +class F { }; -class G { -}; +class G { }; -class H { -}; +class H { }; -class I { -}; +class I { }; -class J { -}; +class J { }; -class K { -}; +class K { }; class R { explicit R(int &some_int, C &cc, const E &ee, F &&ff, I *&ii) diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 9babd43d..4111d0ea 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,127 +9,127 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 1bcb6047..7654f395 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,18 +9,18 @@ - - + + impl::widget - + - + n : int @@ -30,18 +30,18 @@ draw(const widget & w) : void widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index e4864a43..81ad334b 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Base @@ -25,8 +25,8 @@ m2() : std::string - - + + Layer1 @@ -39,8 +39,8 @@ m2() : std::string - - + + Layer2 @@ -51,8 +51,8 @@ all_calls_count() const : int - - + + Layer3 @@ -60,18 +60,18 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int @@ -83,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index e61adb2e..67f16cc5 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ProductA @@ -21,8 +21,8 @@ sell(int price) const = 0 : bool - - + + ProductA1 @@ -31,8 +31,8 @@ sell(int price) const : bool - - + + ProductA2 @@ -41,8 +41,8 @@ sell(int price) const : bool - - + + ProductB @@ -53,8 +53,8 @@ buy(int price) const = 0 : bool - - + + ProductB1 @@ -63,8 +63,8 @@ buy(int price) const : bool - - + + ProductB2 @@ -73,8 +73,8 @@ buy(int price) const : bool - - + + AbstractFactory @@ -85,8 +85,8 @@ make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 @@ -97,8 +97,8 @@ make_b() const : std::unique_ptr<ProductB> - - + + Factory2 diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index be979eff..00a557dc 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Visitor @@ -23,8 +23,8 @@ visit_B(const B & item) const = 0 : void - - + + Visitor1 @@ -35,8 +35,8 @@ visit_B(const B & item) const : void - - + + Visitor2 @@ -47,8 +47,8 @@ visit_B(const B & item) const : void - - + + Visitor3 @@ -59,8 +59,8 @@ visit_B(const B & item) const : void - - + + Item @@ -71,8 +71,8 @@ accept(const Visitor & visitor) const = 0 : void - - + + A @@ -81,8 +81,8 @@ accept(const Visitor & visitor) const : void - - + + B diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 91e625fa..7def889f 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -23,8 +23,8 @@ method2() = 0 : void - - + + A1 @@ -35,8 +35,8 @@ method2() : void - - + + A2 diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 422f6f57..0321b98b 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Strategy @@ -21,8 +21,8 @@ algorithm() = 0 : void - - + + StrategyA @@ -31,8 +31,8 @@ algorithm() : void - - + + StrategyB @@ -41,8 +41,8 @@ algorithm() : void - - + + StrategyC @@ -51,18 +51,18 @@ algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index eb299e92..07f1efb8 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target @@ -23,8 +23,8 @@ m2() = 0 : void - - + + Target1 @@ -35,8 +35,8 @@ m2() : void - - + + Target2 @@ -47,18 +47,18 @@ m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index d9cc377c..aed9eb43 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target1 @@ -21,8 +21,8 @@ m2() : void - - + + Target2 @@ -33,8 +33,8 @@ m2() : void - - + + Proxy @@ -42,11 +42,11 @@ T - + - + m_target : std::shared_ptr<T> @@ -56,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index e1e0137b..06cf9806 100644 --- a/docs/test_cases/t00026_class.svg +++ b/docs/test_cases/t00026_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Memento @@ -18,11 +18,11 @@ T - + - + m_value : T @@ -30,8 +30,8 @@ Memento<T>(T && v) : void value() const : T - - + + Originator @@ -39,11 +39,11 @@ T - + - + m_value : T @@ -57,8 +57,8 @@ print() const : void set(T && v) : void - - + + Caretaker @@ -66,11 +66,11 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> @@ -78,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 033311c7..7e7e557c 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Shape @@ -21,14 +21,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028.md b/docs/test_cases/t00028.md index 30cba521..35ad898c 100644 --- a/docs/test_cases/t00028.md +++ b/docs/test_cases/t00028.md @@ -31,25 +31,21 @@ namespace clanguml { namespace t00028 { /// \uml{note[top] A class note.} -class A { -}; +class A { }; /// \uml{note[] B class note.} -class B { -}; +class B { }; /// /// @uml{note:t00028_class[bottom] C class note.} /// This is class C. -class C { -}; +class C { }; /// \uml{note /// D /// class /// note.} -class D { -}; +class D { }; /// \uml{note E template class note.} template class E { @@ -57,8 +53,7 @@ template class E { }; /// \uml{note:other_diagram[left] G class note.} -class G { -}; +class G { }; /// @uml{note[ bottom ] F enum note.} enum class F { one, two, three }; diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 8fa31e61..75895b7e 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + A - + A class note. - - + + B - + B class note. - - + + C - + C class note. - - + + D - + D class note. - - + + E @@ -64,27 +64,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -94,10 +94,10 @@ three - + F enum note. - + E @@ -105,65 +105,65 @@ int - - + + R - + - + aaa : A - + - + bbb : B * - + - + ccc : C & - + - + ddd : std::vector<std::shared_ptr<D>> - + - + eee : E<int> - + - + ggg : G ** R(C & c) : void - + R class note. - + R contains an instance of A. - + Reference to C. diff --git a/docs/test_cases/t00029.md b/docs/test_cases/t00029.md index 0a30ae14..fd3386b0 100644 --- a/docs/test_cases/t00029.md +++ b/docs/test_cases/t00029.md @@ -24,12 +24,10 @@ File t00029.cc namespace clanguml { namespace t00029 { -class A { -}; +class A { }; /// \uml{skip} -class B { -}; +class B { }; template class C { T param; @@ -45,17 +43,13 @@ enum class E { one, two, three }; /// \uml{skip} enum class F { red, green, blue }; -class G1 { -}; +class G1 { }; -class G2 { -}; +class G2 { }; -class G3 { -}; +class G3 { }; -class G4 { -}; +class G4 { }; struct R { G1 g1; diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 3484b5d5..dabf7fc9 100644 --- a/docs/test_cases/t00029_class.svg +++ b/docs/test_cases/t00029_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + A - - + + C @@ -26,16 +26,16 @@ T - + - + param : T - - + + E @@ -45,64 +45,64 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3 & - + - + g4 : std::shared_ptr<G4> diff --git a/docs/test_cases/t00030.md b/docs/test_cases/t00030.md index 0ce62ed0..235fc4c2 100644 --- a/docs/test_cases/t00030.md +++ b/docs/test_cases/t00030.md @@ -24,20 +24,15 @@ File t00030.cc namespace clanguml { namespace t00030 { -class A { -}; +class A { }; -class B { -}; +class B { }; -class C { -}; +class C { }; -class D { -}; +class D { }; -class E { -}; +class E { }; struct R { /// @uml{association[]} diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index ab96ab99..f9c02441 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,86 +9,86 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + - + eee : E * diff --git a/docs/test_cases/t00031.md b/docs/test_cases/t00031.md index a2d138d3..bc874f5a 100644 --- a/docs/test_cases/t00031.md +++ b/docs/test_cases/t00031.md @@ -25,8 +25,7 @@ namespace clanguml { namespace t00031 { /// @uml{style[#back:lightgreen|yellow;header:blue/red]} -class A { -}; +class A { }; /// @uml{style[#line.dotted:blue]} enum B { one, two, three }; @@ -36,8 +35,7 @@ template class C { T ttt; }; -class D { -}; +class D { }; struct R { /// @uml{style[#red,dashed,thickness=2]} diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 119e1871..2919ef26 100644 --- a/docs/test_cases/t00031_class.svg +++ b/docs/test_cases/t00031_class.svg @@ -1,33 +1,33 @@ - + - + - + - - - + + + A - - + + B @@ -37,8 +37,8 @@ three - - + + @@ -47,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032.md b/docs/test_cases/t00032.md index d0e3c147..4e75128e 100644 --- a/docs/test_cases/t00032.md +++ b/docs/test_cases/t00032.md @@ -24,11 +24,9 @@ File t00032.cc namespace clanguml { namespace t00032 { -struct Base { -}; +struct Base { }; -struct TBase { -}; +struct TBase { }; struct A { void operator()() { } diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index f35d0696..718c1f47 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,24 +9,24 @@ - - + + Base - - + + TBase - - + + A @@ -35,8 +35,8 @@ operator()() : void - - + + B @@ -45,8 +45,8 @@ operator()() : void - - + + C @@ -55,8 +55,8 @@ operator()() : void - - + + Overload @@ -64,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 3c8e2cff..94d44609 100644 --- a/docs/test_cases/t00033_class.svg +++ b/docs/test_cases/t00033_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + aaa : T - - + + B @@ -35,16 +35,16 @@ T - + - + bbb : T - - + + C @@ -52,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034.md b/docs/test_cases/t00034.md index 1583a524..5e2acd46 100644 --- a/docs/test_cases/t00034.md +++ b/docs/test_cases/t00034.md @@ -63,8 +63,7 @@ template <> struct drop_void { template using drop_void_t = typename drop_void::type; -struct A { -}; +struct A { }; struct R { lift_void_t *la; diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 22463255..2bf2c81a 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,8 +9,8 @@ - - + + Void @@ -21,103 +21,87 @@ operator!=(const Void & ) const : bool - - - - - lift_void - - T - - + + + + + lift_void + + T + + - - - - - lift_void - - + + + + + lift_void + + void + + - - - - - lift_void - - void - - + + + + + drop_void + + T + + - - - - - drop_void - - T - - + + + + + drop_void + + Void + + - - - - - drop_void - - + + + + + A + + - - - - - drop_void - - Void - - + + + + + R + - - - - - A - - + + + - - - - - R - + + la : lift_void_t<A> * - - - + + + - - la : lift_void_t<A> * + + lv : lift_void_t<void> * - - - - - - lv : lift_void_t<void> * - - - - - - - - - - la - - - - la + + + + + + + + + la + + + + la diff --git a/docs/test_cases/t00035.md b/docs/test_cases/t00035.md index ccb636bc..e8acaa28 100644 --- a/docs/test_cases/t00035.md +++ b/docs/test_cases/t00035.md @@ -27,20 +27,15 @@ File t00035.cc namespace clanguml { namespace t00035 { -struct Top { -}; +struct Top { }; -struct Left { -}; +struct Left { }; -struct Center { -}; +struct Center { }; -struct Bottom { -}; +struct Bottom { }; -struct Right { -}; +struct Right { }; } // namespace t00035 } // namespace clanguml diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 388755ce..95b5ba0b 100644 --- a/docs/test_cases/t00035_class.svg +++ b/docs/test_cases/t00035_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + Top - - + + Left - - + + Center - - + + Bottom - - + + Right diff --git a/docs/test_cases/t00036.md b/docs/test_cases/t00036.md index b1414819..82661f6c 100644 --- a/docs/test_cases/t00036.md +++ b/docs/test_cases/t00036.md @@ -45,8 +45,7 @@ namespace ns2 { namespace ns22 { // TODO: Fix for incomplete struct C declaration "struct C;" -struct C { -}; +struct C { }; } } diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg index 1402ed40..c8809f4e 100644 --- a/docs/test_cases/t00036_class.svg +++ b/docs/test_cases/t00036_class.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - + ns1 - + ns11 - + ns111 - + ns2 - + ns22 - - + + E @@ -34,8 +34,8 @@ yellow - - + + A @@ -43,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 3e4b4702..40ab1b28 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,98 +9,98 @@ - - + + ST - + - + dimensions : ST::(anonymous_662) - + - + units : ST::(anonymous_792) - - + + ST::(dimensions) - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + ST::(units) - + - + c : double - + - + h : double - - + + A - + - + st : ST diff --git a/docs/test_cases/t00038.md b/docs/test_cases/t00038.md index 7a916875..850e0e30 100644 --- a/docs/test_cases/t00038.md +++ b/docs/test_cases/t00038.md @@ -28,12 +28,10 @@ namespace thirdparty { namespace ns1 { enum class color_t { red, green, blue }; -struct E { -}; +struct E { }; } // namespace ns1 namespace ns2 { -struct F { -}; +struct F { }; } // namespace ns2 } // namespace thirdparty @@ -42,41 +40,33 @@ namespace t00038 { enum class property_t { property_a, property_b, property_c }; -struct A { -}; -struct B { -}; -struct C { -}; +struct A { }; +struct B { }; +struct C { }; struct key_t { std::string key; }; -template struct map { -}; +template struct map { }; using namespace thirdparty::ns1; -template <> struct map> : E { -}; +template <> struct map> : E { }; template <> struct map> : A { -}; + clanguml::t00038::property_t::property_a>> : A { }; template <> struct map>> - : B { -}; + : B { }; template <> struct map>>> - : C { -}; + : C { }; } // namespace t00038 } // namespace clanguml diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index c7e47307..1fee1d69 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,160 +9,150 @@ - - - - - thirdparty::ns1::color_t - - red - green - blue - + + + + + thirdparty::ns1::color_t + + red + green + blue + - - - - - thirdparty::ns1::E - - + + + + + thirdparty::ns1::E + + - - - - - property_t - - property_a - property_b - property_c - + + + + + property_t + + property_a + property_b + property_c + - - - - - A - - + + + + + A + + - - - - - B - - + + + + + B + + - - - - - C - - + + + + + C + + - - - - - key_t - + + + + + key_t + - - - + + + - - key : std::string + + key : std::string - - - - - - map - - T - - + + + + + + map + + T + + - - + + map - - + + std::integral_constant<thirdparty::ns1::color_t,thirdparty::ns1::color_t::red> + + - - - - - map - - std::integral_constant<thirdparty::ns1::color_t,thirdparty::ns1::color_t::red> - - + + + + + map + + std::integral_constant<property_t,property_t::property_a> + + - - - - - map - - std::integral_constant<property_t,property_t::property_a> - - + + + + + map + + std::vector<std::integral_constant<property_t,property_t::property_b>> + + - - - - - map - - std::vector<std::integral_constant<property_t,property_t::property_b>> - - + + + + + map + + std::map<key_t,std::vector<std::integral_constant<property_t,property_t::property_c>>> + + - - - - - map - - std::map<key_t,std::vector<std::integral_constant<property_t,property_t::property_c>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/test_cases/t00039.md b/docs/test_cases/t00039.md index b1d8b6e5..28f54d8c 100644 --- a/docs/test_cases/t00039.md +++ b/docs/test_cases/t00039.md @@ -32,50 +32,38 @@ File t00039.cc #include namespace clanguml::t00039 { -struct B { -}; +struct B { }; -struct C { -}; +struct C { }; -struct D { -}; +struct D { }; -struct E { -}; +struct E { }; namespace ns1 { -struct BB : public B { -}; +struct BB : public B { }; } // namespace ns1 -struct CD : public C, public D { -}; +struct CD : public C, public D { }; -struct DE : public D, public E { -}; +struct DE : public D, public E { }; -struct CDE : public C, public D, public E { -}; +struct CDE : public C, public D, public E { }; -struct A { -}; +struct A { }; -struct AA : public A { -}; +struct AA : public A { }; struct AAA : public AA { B *b; }; namespace ns2 { -struct AAAA : public virtual AAA { -}; +struct AAAA : public virtual AAA { }; } // namespace ns2 namespace detail { -struct AA : public A { -}; +struct AA : public A { }; } // namespace detail namespace ns3 { diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 8bc65c3d..ca5ac1e1 100644 --- a/docs/test_cases/t00039_class.svg +++ b/docs/test_cases/t00039_class.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - + + C - - + + D - - + + E - - + + CD - - + + DE - - + + CDE - - + + A - - + + AA - - + + AAA - + - + b : B * - - + + ns2::AAAA - - + + ns3::F @@ -105,16 +105,16 @@ T - + - + t : T * - - + + ns3::FF @@ -122,16 +122,16 @@ T,M - + - + m : M * - - + + ns3::FE @@ -139,16 +139,16 @@ T,M - + - + m : M * - - + + ns3::FFF @@ -156,11 +156,11 @@ T,M,N - + - + n : N * diff --git a/docs/test_cases/t00040.md b/docs/test_cases/t00040.md index fd62d589..717561b9 100644 --- a/docs/test_cases/t00040.md +++ b/docs/test_cases/t00040.md @@ -28,8 +28,7 @@ File t00040.cc ```cpp namespace clanguml::t00040 { -struct B { -}; +struct B { }; struct A { public: diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index 78e40dfa..ddcfc69f 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + - + ii_ : int get_a() : int - - + + AA - - + + AAA - + - + b : B * get_aaa() : int - - + + R diff --git a/docs/test_cases/t00041.md b/docs/test_cases/t00041.md index aaeb040d..01ec9d8d 100644 --- a/docs/test_cases/t00041.md +++ b/docs/test_cases/t00041.md @@ -21,23 +21,21 @@ diagrams: exclude: namespaces: - clanguml::t00041::detail + relationships: + - dependency ``` ## Source code File t00041.cc ```cpp namespace clanguml::t00041 { -struct B { -}; +struct B { }; -struct A { -}; +struct A { }; -class AA : public A { -}; +class AA : public A { }; -struct R { -}; +struct R { }; struct RR; @@ -45,35 +43,32 @@ struct D { RR *rr; }; -struct E { -}; +struct E { }; -struct F { -}; +struct F { }; namespace detail { -struct G { -}; +struct G { }; } // namespace detail +struct H { }; + struct RR : public R { E *e; F *f; detail::G *g; + + void foo(H *h) { } }; -struct RRR : public RR { -}; +struct RRR : public RR { }; namespace ns1 { -struct N { -}; +struct N { }; -struct NN : public N { -}; +struct NN : public N { }; -struct NM : public N { -}; +struct NM : public N { }; } } // namespace clanguml::t00041 diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index cd1a9fa2..a659a187 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,123 +9,125 @@ - - - - - R - - + + + + + R + + - - - - - D - + + + + + D + - - - + + + - - rr : RR * + + rr : RR * - - - - - - E - - + + + + + + E + + - - - - - F - - + + + + + F + + - - - - - RR - + + + + + RR + - - - + + + - - e : E * + + e : E * - - - + + + - - f : F * + + f : F * - - - + + + - - g : detail::G * + + g : detail::G * - - - - - - RRR - - + + + foo(H * h) : void + + + + + RRR + + - - - - - ns1::N - - + + + + + ns1::N + + - - - - - ns1::NN - - + + + + + ns1::NN + + - - - - - ns1::NM - - + + + + + ns1::NM + + - - - - rr - - - +e - - - +f - - - - - - - - + + + + rr + + + +e + + + +f + + + + + + + + diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index f4847467..e573b2f6 100644 --- a/docs/test_cases/t00042_class.svg +++ b/docs/test_cases/t00042_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,95 +9,88 @@ - - - - - A - - T - + + + + + A + + T + - - - + + + - - a : T + + a : T - - - - - - A - - void - + + + + + + A + + void + + - - - + + + + + B + + T,K + - - a : void * + + + - - - - - - B - - T,K - + + b : T - - - + + + - - b : T + + bb : K - - - - - - bb : K - - - - - - A - - double - - - - - - A - - std::string - - - - - - B - - int,float - - - - - - - - - - + + + + + A + + double + + + + + + A + + std::string + + + + + + B + + int,float + + + + + + + + + + diff --git a/docs/test_cases/t00043.md b/docs/test_cases/t00043.md index 6bc9fffa..5f6aa811 100644 --- a/docs/test_cases/t00043.md +++ b/docs/test_cases/t00043.md @@ -25,8 +25,7 @@ File t00043.cc namespace clanguml::t00043 { namespace dependants { -struct A { -}; +struct A { }; struct B { void b(A *a) { } @@ -49,17 +48,14 @@ struct E { void e(D *d) { } }; -struct F { -}; +struct F { }; } // namespace dependants namespace dependencies { -struct G { -}; +struct G { }; -struct GG { -}; +struct GG { }; struct H { void h(G *g) { } diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 7f7ab48a..8e65d290 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - + dependants - + dependencies - - + + A - - + + B @@ -33,8 +33,8 @@ b(dependants::A * a) : void - - + + BB @@ -43,8 +43,8 @@ bb(dependants::A * a) : void - - + + C @@ -53,8 +53,8 @@ c(dependants::B * b) : void - - + + D @@ -65,8 +65,8 @@ dd(dependants::BB * bb) : void - - + + E @@ -75,24 +75,24 @@ e(dependants::D * d) : void - - + + G - - + + GG - - + + H @@ -103,8 +103,8 @@ hh(dependencies::GG * gg) : void - - + + I @@ -113,8 +113,8 @@ i(dependencies::H * h) : void - - + + J diff --git a/docs/test_cases/t00044.md b/docs/test_cases/t00044.md index cf6016d9..8ca9b898 100644 --- a/docs/test_cases/t00044.md +++ b/docs/test_cases/t00044.md @@ -41,8 +41,7 @@ private: }; template -class signal_handler { -}; +class signal_handler { }; template sink(signal_handler &) diff --git a/docs/test_cases/t00044_class.svg b/docs/test_cases/t00044_class.svg index 93b73721..bc001960 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,105 +9,49 @@ - - - - signal_handler - - ,A - - - - - - - sink - - - - sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void + + + + + sink + + clanguml::t00044::signal_handler<,type-parameter-0-2> + + - - - + + + + + signal_handler + + Ret(Args...),A + + - - signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * + + + + + signal_handler + + T,A + + - - - - - sink - - clanguml::t00044::signal_handler<,type-parameter-0-2> - - - - sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...), type-parameter-0-2> >(sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t & sh) : void + + + + + sink + + T + + - - - - - - signal : sink<signal_handler<type-parameter-0-0 (type-parameter-0-1...),type-parameter-0-2>>::signal_t * - - - - - - signal_handler - - - - - - - - signal_handler - - Ret(Args...),A - - - - - - - - signal_handler - - T,A - - - - - - - - sink - - T - - - - - - - - - - - signal - - - - - - signal - - - - + + + + diff --git a/docs/test_cases/t00045.md b/docs/test_cases/t00045.md index 931c73f2..b3d0c1fe 100644 --- a/docs/test_cases/t00045.md +++ b/docs/test_cases/t00045.md @@ -15,14 +15,11 @@ diagrams: ## Source code File t00045.cc ```cpp -class A { -}; +class A { }; -class AA { -}; +class AA { }; -class AAA { -}; +class AAA { }; template class AAAA { T t; @@ -30,28 +27,21 @@ template class AAAA { namespace ns1 { -class A { -}; +class A { }; namespace ns2 { -class A { -}; +class A { }; -class B : public A { -}; +class B : public A { }; -class C : public ns1::A { -}; +class C : public ns1::A { }; -class D : public ns1::ns2::A { -}; +class D : public ns1::ns2::A { }; -class E : public ::A { -}; +class E : public ::A { }; -class AAA { -}; +class AAA { }; class R { public: diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index c321cb5f..bfeb498d 100644 --- a/docs/test_cases/t00045_class.svg +++ b/docs/test_cases/t00045_class.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + A - - + + AA - - + + AAA - - + + AAAA @@ -42,103 +42,103 @@ T - + - + t : T - - + + ns1::A - - + + ns1::ns2::A - - + + ns1::ns2::B - - + + ns1::ns2::C - - + + ns1::ns2::D - - + + ns1::ns2::E - - + + ns1::ns2::AAA - - + + ns1::ns2::R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * diff --git a/docs/test_cases/t00046.md b/docs/test_cases/t00046.md index 0a63fa02..1b531293 100644 --- a/docs/test_cases/t00046.md +++ b/docs/test_cases/t00046.md @@ -19,33 +19,25 @@ File t00046.cc #include #include -class A { -}; +class A { }; -class AA { -}; +class AA { }; namespace ns1 { -class A { -}; +class A { }; namespace ns2 { -class A { -}; +class A { }; -class B : public A { -}; +class B : public A { }; -class C : public ns1::A { -}; +class C : public ns1::A { }; -class D : public ns1::ns2::A { -}; +class D : public ns1::ns2::A { }; -class E : public ::A { -}; +class E : public ::A { }; class R { public: diff --git a/docs/test_cases/t00046_class.svg b/docs/test_cases/t00046_class.svg index 1336fdc4..bf1cac0e 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 87deabc1..20eca883 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,59 +9,51 @@ - - + + conditional_t - - + + Else + + - - - - - conditional_t - - Else - - + + + + + conditional_t + + std::true_type,Result,Tail... + + - - - - - conditional_t - - std::true_type,Result,Tail... - - + + + + + conditional_t + + std::false_type,Result,Tail... + + - - - - - conditional_t - - std::false_type,Result,Tail... - - + + + + + conditional_t + + Ts... + + - - - - - conditional_t - - Ts... - - - - - - - - - + + + + + + diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 9e6e861d..e83be052 100644 --- a/docs/test_cases/t00048_class.svg +++ b/docs/test_cases/t00048_class.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + Base - + - + base : int foo() = 0 : void - - + + BaseTemplate @@ -35,35 +35,35 @@ T - + - + base : T foo() = 0 : void - - + + B - + - + b : int foo() : void - - + + BTemplate @@ -71,35 +71,35 @@ T - + - + b : T foo() : void - - + + A - + - + a : int foo() : void - - + + ATemplate @@ -107,11 +107,11 @@ T - + - + a : T diff --git a/docs/test_cases/t00049_class.svg b/docs/test_cases/t00049_class.svg index 83ee46e5..88bedbfd 100644 --- a/docs/test_cases/t00049_class.svg +++ b/docs/test_cases/t00049_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ string_vector - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050.md b/docs/test_cases/t00050.md index 6d701f2a..7110fa96 100644 --- a/docs/test_cases/t00050.md +++ b/docs/test_cases/t00050.md @@ -86,14 +86,12 @@ File t00050.cc namespace clanguml { /// Vivamus integer non suscipit taciti mus -class A { -}; +class A { }; namespace t00050 { /// Lorem ipsum dolor sit -class A { -}; +class A { }; /** * \brief Lorem ipsum @@ -108,8 +106,7 @@ class A { * \todo 2. Write tests * \todo 3. Implement */ -class B { -}; +class B { }; /// \brief Long comment example /// @@ -138,8 +135,7 @@ class B { /// imperdiet praesent magnis ridiculus congue gravida curabitur dictum /// sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, /// aenean vel nostra tellus commodo pretium sapien sociosqu. -class C { -}; +class C { }; /// Mollis pretium lorem primis namespace utils { @@ -151,8 +147,7 @@ namespace utils { /// tellus ligula porttitor metus. /// /// \todo Implement... -class D { -}; +class D { }; } // namespace utils @@ -178,11 +173,9 @@ template class F { /// This is an intermediate description of class G. /// /// This is a long description of class G. -class G { -}; +class G { }; -class NoComment { -}; +class NoComment { }; } // namespace t00050 } // namespace clanguml diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 90f01157..72189a22 100644 --- a/docs/test_cases/t00050_class.svg +++ b/docs/test_cases/t00050_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + utils::D - - + + E @@ -52,8 +52,8 @@ E3 - - + + F @@ -61,44 +61,44 @@ T,V,int N - + - + t : T[N] - + - + v : V - - + + G - - + + NoComment - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies mollis dictumst, aenean non a in donec nulla. @@ -125,50 +125,50 @@ imperdiet praesent magnis ridiculus congue gravida curabitur dictum sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, aenean vel nostra tellus commodo pretium sapien sociosqu. - + This is a short description of class G. - + This is an intermediate description of class G. - + This is a long description of class G. - + Lorem ipsum - + TODO 1. Write meaningful comment - + TODO 2. Write tests - + TODO 3. Implement - + Long comment example - + TODO Implement... - + Simple array wrapper. - + Template parameters @@ -181,6 +181,6 @@ N Size of T array. - + diff --git a/docs/test_cases/t00051_class.svg b/docs/test_cases/t00051_class.svg index c58b32db..ef713a66 100644 --- a/docs/test_cases/t00051_class.svg +++ b/docs/test_cases/t00051_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,66 +9,46 @@ - - - - - B - - F,FF - + + + + + B + + F,FF + - - - + + + - - f_ : F + + f_ : F - - - + + + - - ff_ : FF + + ff_ : FF - - - B<F, FF>(F && f, FF && ff) : void - - f() : void - - ff() : void - - - - - B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> - - - - B((lambda at ../../tests/t00051/t00051.cc:43:18) && f, (lambda at ../../tests/t00051/t00051.cc:43:27) && ff) : void - - f() : void - - ff() : void + + + B<F, FF>(F && f, FF && ff) : void + + f() : void + + ff() : void + + + + + B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> + + - - - - - - f_ : (lambda at ../../tests/t00051/t00051.cc:43:18) - - - - - - - ff_ : (lambda at ../../tests/t00051/t00051.cc:43:27) - - - + + A @@ -83,8 +63,8 @@ get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) - - + + A::custom_thread1 @@ -93,8 +73,8 @@ custom_thread1<Function,Args...>(Function && f, Args &&... args) : void - - + + A::custom_thread2 @@ -103,9 +83,9 @@ thread((lambda at ../../tests/t00051/t00051.cc:59:27) && ) : void - - - + + + diff --git a/docs/test_cases/t00052_class.svg b/docs/test_cases/t00052_class.svg index 990482ec..31cc3519 100644 --- a/docs/test_cases/t00052_class.svg +++ b/docs/test_cases/t00052_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ aa<F,Q>(F && f, Q q) : void - - + + B @@ -35,8 +35,8 @@ bb<F>(F && f, T t) : T - - + + C @@ -47,7 +47,7 @@ c<P>(P p) : T - + B @@ -55,7 +55,7 @@ int - + C @@ -63,32 +63,32 @@ int - - + + R - + - + a : A - + - + b : B<int> - + - + c : C<int> diff --git a/docs/test_cases/t00053.md b/docs/test_cases/t00053.md index 6b45e5a9..24e04454 100644 --- a/docs/test_cases/t00053.md +++ b/docs/test_cases/t00053.md @@ -27,35 +27,21 @@ File t00053.cc ```cpp namespace clanguml { namespace t00053 { -struct a { -}; -struct b { -}; -struct c { -}; -struct d { -}; -struct e { -}; -struct f { -}; -struct g { -}; +struct a { }; +struct b { }; +struct c { }; +struct d { }; +struct e { }; +struct f { }; +struct g { }; -struct A { -}; -struct B { -}; -struct C { -}; -struct D { -}; -struct E { -}; -struct F { -}; -struct G { -}; +struct A { }; +struct B { }; +struct C { }; +struct D { }; +struct E { }; +struct F { }; +struct G { }; enum class h { hhh }; enum class i { iii }; diff --git a/docs/test_cases/t00053_class.svg b/docs/test_cases/t00053_class.svg index 2f46085f..1c244ad1 100644 --- a/docs/test_cases/t00053_class.svg +++ b/docs/test_cases/t00053_class.svg @@ -1,6 +1,6 @@ - + @@ -9,72 +9,72 @@ - - + + A - - + + C - - + + E - - + + F - - + + a - - + + c - - + + e - - + + f - - + + h @@ -82,8 +82,8 @@ hhh - - + + j @@ -91,56 +91,56 @@ jjj - - + + b - - + + d - - + + g - - + + B - - + + D - - + + G - - + + i diff --git a/docs/test_cases/t00054.md b/docs/test_cases/t00054.md index e66fdcbc..4563343c 100644 --- a/docs/test_cases/t00054.md +++ b/docs/test_cases/t00054.md @@ -31,43 +31,29 @@ File t00054.cc ```cpp namespace clanguml { namespace t00054 { -struct a { -}; -struct b { -}; +struct a { }; +struct b { }; namespace detail { -struct c { -}; -struct d { -}; -struct e { -}; +struct c { }; +struct d { }; +struct e { }; } // namespace detail -struct f { -}; -struct g { -}; +struct f { }; +struct g { }; -struct A { -}; -struct B { -}; +struct A { }; +struct B { }; namespace detail2 { -struct C { -}; +struct C { }; namespace detail3 { -struct D { -}; -struct E { -}; +struct D { }; +struct E { }; } // namespace detail3 -struct F { -}; +struct F { }; } // namespace detail2 -struct G { -}; +struct G { }; namespace detail4 { enum class h { hhh }; diff --git a/docs/test_cases/t00054_class.svg b/docs/test_cases/t00054_class.svg index b9aff610..56b20883 100644 --- a/docs/test_cases/t00054_class.svg +++ b/docs/test_cases/t00054_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - + detail - + detail2 - + detail3 - + detail4 - - + + d - - + + a - - + + c - - + + e - - + + C - - + + F - - + + D - - + + E - - + + A - - + + B - - + + f - - + + G - - + + h @@ -127,8 +127,8 @@ hhh - - + + i @@ -137,8 +137,8 @@ iii - - + + j @@ -147,16 +147,16 @@ jjj - - + + b - - + + g diff --git a/docs/test_cases/t00055.md b/docs/test_cases/t00055.md index 854ae31b..6ba7921e 100644 --- a/docs/test_cases/t00055.md +++ b/docs/test_cases/t00055.md @@ -24,26 +24,16 @@ File t00055.cc ```cpp namespace clanguml { namespace t00055 { -struct A { -}; -struct B { -}; -struct C { -}; -struct D { -}; -struct E { -}; -struct F { -}; -struct G { -}; -struct H { -}; -struct I { -}; -struct J { -}; +struct A { }; +struct B { }; +struct C { }; +struct D { }; +struct E { }; +struct F { }; +struct G { }; +struct H { }; +struct I { }; +struct J { }; } } ``` diff --git a/docs/test_cases/t00055_class.svg b/docs/test_cases/t00055_class.svg index 8f1d011f..b0005fbe 100644 --- a/docs/test_cases/t00055_class.svg +++ b/docs/test_cases/t00055_class.svg @@ -1,6 +1,6 @@ - + @@ -9,80 +9,80 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J diff --git a/docs/test_cases/t00056.md b/docs/test_cases/t00056.md index 81bd1a60..188159cb 100644 --- a/docs/test_cases/t00056.md +++ b/docs/test_cases/t00056.md @@ -26,10 +26,8 @@ template concept greater_than_simple = sizeof(T) > sizeof(L); template -concept greater_than_with_requires = requires(T l, P r) -{ - sizeof(l) > sizeof(r); -}; +concept greater_than_with_requires = + requires(T l, P r) { sizeof(l) > sizeof(r); }; // Constraint expression template @@ -37,31 +35,26 @@ concept max_four_bytes = sizeof(T) <= 4; // Simple requirement template -concept iterable = requires(T container) -{ - container.begin(); - container.end(); -}; +concept iterable = requires(T container) { + container.begin(); + container.end(); + }; // Type requirement template -concept has_value_type = requires -{ - typename T::value_type; -}; +concept has_value_type = requires { typename T::value_type; }; template -concept convertible_to_string = max_four_bytes && requires(T s) -{ - std::string{s}; - { - std::to_string(s) - } - noexcept; - { - std::to_string(s) - } -> std::same_as; -}; +concept convertible_to_string = + max_four_bytes && requires(T s) { + std::string{s}; + { + std::to_string(s) + } noexcept; + { + std::to_string(s) + } -> std::same_as; + }; // Compound requirement // ... @@ -81,29 +74,27 @@ template struct A { // Requires constant expression template -requires iterable_or_small_value_type + requires iterable_or_small_value_type struct B { T b; }; // Anonymous concept requirement (TODO) template -requires requires(T t) -{ - --t; - t--; -} + requires requires(T t) { + --t; + t--; + } struct C { T c; }; template -requires max_four_bytes && max_four_bytes -struct D { -}; + requires max_four_bytes && max_four_bytes +struct D { }; template -requires greater_than_with_requires + requires greater_than_with_requires struct E { T1 e1; T2 e2; @@ -111,7 +102,7 @@ struct E { }; template -requires greater_than_simple + requires greater_than_simple struct F { T1 f1; T2 f2; diff --git a/docs/test_cases/t00056_class.svg b/docs/test_cases/t00056_class.svg index 6fa41ae7..3028e0c9 100644 --- a/docs/test_cases/t00056_class.svg +++ b/docs/test_cases/t00056_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -20,8 +20,8 @@ - - + + «concept» @@ -33,8 +33,8 @@ sizeof (l) > sizeof (r) - - + + «concept» @@ -44,8 +44,8 @@ - - + + «concept» @@ -58,8 +58,8 @@ container.begin() container.end() - - + + «concept» @@ -71,8 +71,8 @@ typename T::value_type - - + + «concept» @@ -86,8 +86,8 @@ {std::to_string(s)} noexcept {std::to_string(s)} -> std::same_as<std::string> - - + + «concept» @@ -97,8 +97,8 @@ - - + + «concept» @@ -108,8 +108,8 @@ - - + + A @@ -117,16 +117,16 @@ max_four_bytes T - + - + a : T - - + + B @@ -134,16 +134,16 @@ T - + - + b : T - - + + C @@ -151,16 +151,16 @@ convertible_to_string T - + - + c : T - - + + D @@ -169,8 +169,8 @@ - - + + E @@ -178,30 +178,30 @@ T1,T2,T3 - + - + e1 : T1 - + - + e2 : T2 - + - + e3 : T3 - - + + F @@ -209,25 +209,25 @@ T1,T2,T3 - + - + f1 : T1 - + - + f2 : T2 - + - + f3 : T3 diff --git a/docs/test_cases/t00057_class.svg b/docs/test_cases/t00057_class.svg index 21f5c8b7..e240a4b6 100644 --- a/docs/test_cases/t00057_class.svg +++ b/docs/test_cases/t00057_class.svg @@ -1,6 +1,6 @@ - + @@ -9,210 +9,210 @@ - - + + t00057_A - + - + a1 : int - - + + t00057_B - + - + b1 : int - - + + t00057_C - + - + c1 : int - - + + «union» t00057_D - + - + d1 : int - + - + d2 : float - - + + t00057_E - + - + e : int - + - + coordinates : t00057_E::(anonymous_739) - + - + height : t00057_E::(anonymous_807) - - + + t00057_E::(coordinates) - + - + x : int - + - + y : int - - + + «union» t00057_E::(height) - + - + z : int - + - + t : double - - + + t00057_R - + - + a : struct t00057_A - + - + b : t00057_B - + - + c : struct t00057_C * - + - + d : union t00057_D - + - + e : struct t00057_E * - + - + f : struct t00057_F * - - + + t00057_F - + - + f1 : int diff --git a/docs/test_cases/t00058.md b/docs/test_cases/t00058.md index 375c0580..2a967e55 100644 --- a/docs/test_cases/t00058.md +++ b/docs/test_cases/t00058.md @@ -45,13 +45,13 @@ concept same_as_first_type = std::is_same_v, std::remove_cvref_t>>; template -requires same_as_first_type + requires same_as_first_type struct A { std::vector a; }; template -requires same_as_first_type + requires same_as_first_type struct B { std::vector b; P bb; diff --git a/docs/test_cases/t00058_class.svg b/docs/test_cases/t00058_class.svg index a96f7359..6e6207dc 100644 --- a/docs/test_cases/t00058_class.svg +++ b/docs/test_cases/t00058_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + first_type @@ -19,8 +19,8 @@ - - + + «concept» @@ -30,8 +30,8 @@ - - + + A @@ -39,16 +39,16 @@ T,Args... - + - + a : std::vector<T> - - + + B @@ -56,22 +56,22 @@ T,P,Args... - + - + b : std::vector<T> - + - + bb : P - + A @@ -79,7 +79,7 @@ int,int,double,std::string - + A @@ -87,7 +87,7 @@ int,int - + B @@ -95,25 +95,25 @@ int,std::string,int,double,A<int,int> - - + + R - + - + aa : A<int,int,double,std::string> - + - + bb : B<int,std::string,int,double,A<int,int>> diff --git a/docs/test_cases/t00059.md b/docs/test_cases/t00059.md index a7a3d826..aedaf7fa 100644 --- a/docs/test_cases/t00059.md +++ b/docs/test_cases/t00059.md @@ -23,23 +23,16 @@ namespace clanguml { namespace t00059 { template -concept fruit_c = requires(T t) -{ - T{}; - t.get_name(); -}; +concept fruit_c = requires(T t) { + T{}; + t.get_name(); + }; template -concept apple_c = fruit_c && requires(T t) -{ - t.get_sweetness(); -}; +concept apple_c = fruit_c && requires(T t) { t.get_sweetness(); }; template -concept orange_c = fruit_c && requires(T t) -{ - t.get_bitterness(); -}; +concept orange_c = fruit_c && requires(T t) { t.get_bitterness(); }; class gala_apple { public: diff --git a/docs/test_cases/t00059_class.svg b/docs/test_cases/t00059_class.svg index 686b1314..23c042ef 100644 --- a/docs/test_cases/t00059_class.svg +++ b/docs/test_cases/t00059_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -23,8 +23,8 @@ T{} t.get_name() - - + + «concept» @@ -36,8 +36,8 @@ t.get_sweetness() - - + + «concept» @@ -49,8 +49,8 @@ t.get_bitterness() - - + + gala_apple @@ -61,8 +61,8 @@ get_sweetness() const : float - - + + empire_apple @@ -73,8 +73,8 @@ get_sweetness() const : float - - + + lima_orange @@ -85,8 +85,8 @@ get_bitterness() const : float - - + + valencia_orange @@ -97,8 +97,8 @@ get_bitterness() const : float - - + + fruit_factory @@ -111,7 +111,7 @@ create_orange() const : TO - + fruit_factory @@ -119,7 +119,7 @@ gala_apple,valencia_orange - + fruit_factory @@ -127,25 +127,25 @@ empire_apple,lima_orange - - + + R - + - + factory_1 : fruit_factory_1 - + - + factory_2 : fruit_factory_2 diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 64e43a33..bba69086 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,59 +9,59 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - + + + + + + + + add(int,int) - + wrap_add3(int,int,int) - + add3(int,int,int) - + @@ -72,7 +72,7 @@ - + @@ -81,14 +81,14 @@ - + log_result(int) - + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index 504130cc..26db911f 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1() - + m1() - - + + m2() - + m2() - - + + m3() - + m3() - - + + m4() - + m4() - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 3155fa49..0045ebf3 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1<T>(T) - + m1<T>(T) - - + + m2<T>(T) - + m2<T>(T) - - + + m3<T>(T) - + m3<T>(T) - - + + m4<T>(T) - + m4<T>(T) - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index 504fa091..0e340208 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,87 +29,87 @@ - - + + main() - + main() - - + + m1<float>(float) - + m1<float>(float) - - + + m1<unsigned long>(unsigned long) - + m1<unsigned long>(unsigned long) - - + + m4<unsigned long>(unsigned long) - + m4<unsigned long>(unsigned long) - - + + m1<std::string>(std::string) - + m1<std::string>(std::string) - - + + m2<std::string>(std::string) - + m2<std::string>(std::string) - - + + m1<int>(int) - + m1<int>(int) - - + + m2<int>(int) - + m2<int>(int) - - + + m3<int>(int) - + m3<int>(int) - - + + m4<int>(int) - + m4<int>(int) - - - - - - - - - - - + + + + + + + + + + + - + - + @@ -117,11 +117,11 @@ - + - + @@ -129,19 +129,19 @@ - + - + - + - + diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index fd6f2658..5770bacc 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - + + + - - + + C<T> - + C<T> - - + + B<T> - + B<T> - - + + A<T> - + A<T> - - - + + + c(T) - + b(T) - + a(T) diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 2e52fe71..0550484a 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,82 +34,82 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + BB<int,int> - + BB<int,int> - - + + AA<int> - + AA<int> - - + + BB<int,std::string> - + BB<int,std::string> - - + + BB<int,float> - + BB<int,float> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + b(int) - + a1(int) @@ -118,12 +118,12 @@ - + b(std::string) - + a2(std::string) @@ -132,59 +132,59 @@ - + bb1(int,int) - + aa1(int) - + bb2(int,int) - + aa2(int) - + bb1(int,std::string) - + aa2(int) - + bb2(int,std::string) - + aa1(int) - + bb1(int,float) - + bb2(int,float) - + aa2(int) diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index a3447279..1511dd7a 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + Adder<int,int> - + Adder<int,int> - - + + Adder<int,float,double> - + Adder<int,float,double> - - + + Adder<std::string,std::string,std::string> - + Adder<std::string,std::string,std::string> - - - - - + + + + + add(int &&,int &&) - + add(int &&,float &&,double &&) - + add(std::string &&,std::string &&,std::string &&) diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index 85cf32aa..31427127 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<const char *> - + B<const char *> - - + + A<const char *> - + A<const char *> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - - - - - - - + + + + + + + + b(int) - + a1(int) - + b(const char *) - + a2(const char *) - + b(std::string) - + a3(std::string) diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index f3e8df2d..350c326f 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<float> - + B<float> - - + + A<float> - + A<float> - - - - - - - - + + + + + + + + b(std::string) - + a(std::string) - + b(int) - + a(int) - + b(float) - + a(float) diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index 492394bb..ed14b3a6 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A - + A - - - - - - - - - - + + + + + + + + + + b1() - + a1() - + b2() - + a2() - + b3() - + a3() - + b4() - + a4() diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 728be388..4eb3d61f 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - + + + + + + + + + + a(int) @@ -52,26 +52,26 @@ alt - + a(int) - + b(int) - + c(int) - + @@ -81,14 +81,14 @@ alt - + b(int) - + @@ -98,7 +98,7 @@ alt - + diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index b3a7a096..fc4db4fc 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -43,122 +43,122 @@ - - + + tmain() - + tmain() - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - - + + D - + D - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -167,67 +167,67 @@ - + operator()() - + c() - + cc() - + ccc() - + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -238,29 +238,29 @@ - + r() - + operator()() - + c() - + cc() - + @@ -269,7 +269,7 @@ - + add5(int) diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index 32deb5e6..9903c73d 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -58,12 +58,12 @@ - + b(double) - + a2(double) @@ -72,12 +72,12 @@ - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index 39900a6d..9834cf42 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - - - - - - - + + + + + + + + - - + + tmain() - + tmain() - - + + B - + B - - + + A - + A - - + + C<B,int> - + C<B,int> - - - - - - - - - + + + + + + + + + b1(int,int) - + a1(int,int) @@ -67,12 +67,12 @@ - + b2(int,int) - + a2(int,int) @@ -81,17 +81,17 @@ - + c1(int,int) - + b1(int,int) - + a1(int,int) diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index 7b8c45fe..e4cb9b27 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + B - + B - - - + + + setup_a(std::shared_ptr<detail::A> &) diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index 191a6b84..7369af4a 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - - - - + + + + + - - + + tmain() - + tmain() - - + + B<long> - + B<long> - - + + A - + A - - - - - - + + + + + + b1(long) - + a1(int) - + b2(long) - + a2(const long &) diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index 6a76d0e3..f47344f6 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,65 +9,65 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_a.h - + include/t20017_a.h - + include/t20017_b.h - + include/t20017_b.h - - - - - - + + + + + + tmain() - + a3(int,int) - + b1(int,int) - + a2(int,int) - + a1(int,int) - + b2<int>(int,int) diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index c3302ba3..ab041ff5 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + @@ -25,93 +25,93 @@ - - + + tmain() - + tmain() - - + + Answer<Factorial<5>,120> - + Answer<Factorial<5>,120> - - + + Factorial<5> - + Factorial<5> - - + + Factorial<4> - + Factorial<4> - - + + Factorial<3> - + Factorial<3> - - + + Factorial<2> - + Factorial<2> - - + + Factorial<1> - + Factorial<1> - - + + Factorial<0> - + Factorial<0> - - - - - - - - - + + + + + + + + + print() - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg index d5cd8141..e7f456fc 100644 --- a/docs/test_cases/t20019_sequence.svg +++ b/docs/test_cases/t20019_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + Base<D1> - + Base<D1> - - + + D1 - + D1 - - + + Base<D2> - + Base<D2> - - + + D2 - + D2 - - - - - - - - - - + + + + + + + + + + name() - + impl() - + name() - + impl() - + name() - + impl() - + name() - + impl() diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index 53a160ec..37411244 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,78 +9,78 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + C - + C - - + + B - + B - - + + D<int> - + D<int> - - - - - - - - - - - - - + + + + + + + + + + + + + alt - + a1() @@ -91,7 +91,7 @@ alt - + [ @@ -100,7 +100,7 @@ - + [ @@ -109,7 +109,7 @@ - + b1() @@ -117,7 +117,7 @@ - + [ @@ -126,21 +126,21 @@ - + b2() - + a4() - + log() @@ -148,7 +148,7 @@ alt - + c1() @@ -156,7 +156,7 @@ alt - + @@ -169,7 +169,7 @@ - + @@ -179,7 +179,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index 475e4ef1..1877b110 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + C - + C - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + loop - + [ c4() ] - + @@ -89,7 +89,7 @@ - + a3() @@ -102,7 +102,7 @@ loop - + [ @@ -111,7 +111,7 @@ - + [ @@ -120,7 +120,7 @@ - + [ @@ -129,14 +129,14 @@ - + a1() - + [ @@ -148,7 +148,7 @@ loop - + b2() @@ -158,7 +158,7 @@ loop - + [ @@ -167,7 +167,7 @@ - + b2() diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index e19277fa..3e69a8ff 100644 --- a/docs/test_cases/t20022_sequence.svg +++ b/docs/test_cases/t20022_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - + + + + a() - + b() diff --git a/docs/test_cases/t20023_sequence.svg b/docs/test_cases/t20023_sequence.svg index 0fdbc64c..6c48507a 100644 --- a/docs/test_cases/t20023_sequence.svg +++ b/docs/test_cases/t20023_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - + + + + + + + a() @@ -47,7 +47,7 @@ try - + @@ -60,7 +60,7 @@ [std::runtime_error &] - + @@ -73,7 +73,7 @@ [std::logic_error &] - + @@ -86,7 +86,7 @@ [...] - + diff --git a/docs/test_cases/t20024_sequence.svg b/docs/test_cases/t20024_sequence.svg index a86a873d..f888c6b3 100644 --- a/docs/test_cases/t20024_sequence.svg +++ b/docs/test_cases/t20024_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -33,36 +33,36 @@ - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + select(enum_a) @@ -72,7 +72,7 @@ switch [zero] - + @@ -85,7 +85,7 @@ [one] - + @@ -98,7 +98,7 @@ [two] - + @@ -111,7 +111,7 @@ [default] - + @@ -124,7 +124,7 @@ - + select(colors) @@ -134,7 +134,7 @@ switch [enum colors::red] - + @@ -143,7 +143,7 @@ [enum colors::orange] - + @@ -152,7 +152,7 @@ [enum colors::green] - + @@ -161,7 +161,7 @@ [default] - + diff --git a/docs/test_cases/t20025_sequence.svg b/docs/test_cases/t20025_sequence.svg index eca1ae5f..0e9d1084 100644 --- a/docs/test_cases/t20025_sequence.svg +++ b/docs/test_cases/t20025_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,41 +9,41 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + add(int,int) - + add(int,int) - - - - - + + + + + a() - + @@ -52,7 +52,7 @@ - + diff --git a/docs/test_cases/t20026_sequence.svg b/docs/test_cases/t20026_sequence.svg index ea4e74b2..a19daa0e 100644 --- a/docs/test_cases/t20026_sequence.svg +++ b/docs/test_cases/t20026_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20027_sequence.svg b/docs/test_cases/t20027_sequence.svg index 11ca0c04..00cf6b9e 100644 --- a/docs/test_cases/t20027_sequence.svg +++ b/docs/test_cases/t20027_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20028_sequence.svg b/docs/test_cases/t20028_sequence.svg index 79b466a6..9625ad91 100644 --- a/docs/test_cases/t20028_sequence.svg +++ b/docs/test_cases/t20028_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - - - - - + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - + + + + + alt - + a() - + b() - + c() @@ -60,7 +60,7 @@ - + d() diff --git a/docs/test_cases/t20029_sequence.svg b/docs/test_cases/t20029_sequence.svg index 4b5fae8a..efc96c98 100644 --- a/docs/test_cases/t20029_sequence.svg +++ b/docs/test_cases/t20029_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,60 +9,60 @@ - - - - - - - - - - - + + + + + + + + + + + - - + + tmain() - + tmain() - - + + Encoder<Retrier<ConnectionPool>> - + Encoder<Retrier<ConnectionPool>> - - + + Retrier<ConnectionPool> - + Retrier<ConnectionPool> - - + + ConnectionPool - + ConnectionPool - - + + encode_b64(std::string &&) - + encode_b64(std::string &&) - - - - - - - - + + + + + + + + connect() @@ -73,21 +73,21 @@ alt - + [ send(std::string &&) ] - + encode(std::string &&) - + @@ -97,7 +97,7 @@ - + send(std::string &&) @@ -108,7 +108,7 @@ alt - + [ diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 98a7666e..ea96c7a2 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,67 +9,67 @@ - - + + A - - + + AA - - + + B - - + + AA - - + + AAA - - + + BBB - - + + BB - - + + AAA - - + + BBB - - + + BB - + A AAA note... - + This is namespace AA in namespace A - + This is namespace AA in namespace B - - - + + + diff --git a/docs/test_cases/t30002.md b/docs/test_cases/t30002.md index f450efb5..27475505 100644 --- a/docs/test_cases/t30002.md +++ b/docs/test_cases/t30002.md @@ -33,72 +33,55 @@ namespace clanguml { namespace t30002 { namespace A::AA { namespace A1 { -struct CA { -}; +struct CA { }; } namespace A2 { -struct CB { -}; +struct CB { }; } namespace A3 { -struct CC { -}; +struct CC { }; } namespace A4 { -struct CD { -}; +struct CD { }; } namespace A5 { -struct CE { -}; +struct CE { }; } namespace A6 { -struct CF { -}; +struct CF { }; } namespace A7 { -struct CG { -}; +struct CG { }; } namespace A8 { -struct CH { -}; +struct CH { }; } namespace A9 { -struct CI { -}; +struct CI { }; } namespace A10 { -struct CJ { -}; +struct CJ { }; } namespace A11 { -struct CK { -}; +struct CK { }; } namespace A12 { -struct CL { -}; +struct CL { }; } namespace A13 { -struct CM { -}; +struct CM { }; } namespace A14 { -struct CN { -}; +struct CN { }; } namespace A15 { -struct CO { -}; +struct CO { }; } namespace A16 { -struct CP { -}; +struct CP { }; } namespace A17 { -struct CR { -}; +struct CR { }; } } namespace B::BB::BBB { diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg index beb66c14..1e8ef3c6 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003.md b/docs/test_cases/t30003.md index 66d81934..f8407a0c 100644 --- a/docs/test_cases/t30003.md +++ b/docs/test_cases/t30003.md @@ -25,30 +25,25 @@ namespace t30003 { namespace ns1 { namespace ns2_v1_0_0 { -class A { -}; +class A { }; } namespace [[deprecated]] ns2_v0_9_0 { -class A { -}; +class A { }; } namespace { -class Anon final { -}; +class Anon final { }; } } namespace [[deprecated]] ns3 { namespace ns1::ns2 { -class Anon : public t30003::ns1::ns2_v1_0_0::A { -}; +class Anon : public t30003::ns1::ns2_v1_0_0::A { }; } -class B : public ns1::ns2::Anon { -}; +class B : public ns1::ns2::Anon { }; } } } diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index fc4b6776..f42268ce 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,35 @@ - - + + ns1 - - + + ns3 «deprecated» - - + + ns1 - - + + ns2_v1_0_0 - - + + ns2_v0_9_0 «deprecated» - - + + ns2 diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg index f9930318..201e039b 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE - - - - + + + + diff --git a/docs/test_cases/t30005.md b/docs/test_cases/t30005.md index 1c9e5d32..273f2b41 100644 --- a/docs/test_cases/t30005.md +++ b/docs/test_cases/t30005.md @@ -24,8 +24,7 @@ namespace clanguml { namespace t30005 { namespace A::AA::AAA { -struct C1 { -}; +struct C1 { }; } namespace B::BB::BBB { diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 34f9f4f3..eb98c86f 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,48 +9,48 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + C - - + + CC - - + + AAA - - + + BBB - - + + CCC diff --git a/docs/test_cases/t30006.md b/docs/test_cases/t30006.md index 0db35247..859cc273 100644 --- a/docs/test_cases/t30006.md +++ b/docs/test_cases/t30006.md @@ -24,8 +24,7 @@ namespace clanguml { namespace t30006 { namespace B { -struct BB { -}; +struct BB { }; } /// \uml{note[top] Top A note.} @@ -36,8 +35,7 @@ struct A1 { } namespace C { -struct CC { -}; +struct CC { }; } /// \uml{note[bottom] Bottom A note.} diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg index 573ce3b1..6434f68d 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + B - - + + A - - + + C - + Top A note. - + diff --git a/docs/test_cases/t30007.md b/docs/test_cases/t30007.md index 3c128fb2..40e86e09 100644 --- a/docs/test_cases/t30007.md +++ b/docs/test_cases/t30007.md @@ -28,8 +28,7 @@ namespace clanguml { namespace t30007 { namespace B { -struct BB { -}; +struct BB { }; } /// \uml{note[top] Compare layout with t30006.} @@ -42,8 +41,7 @@ struct A1 { } namespace C { -struct CC { -}; +struct CC { }; } /// \uml{note[bottom] Bottom A note.} diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 3e5dd3b9..983b8383 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. - + diff --git a/docs/test_cases/t30008.md b/docs/test_cases/t30008.md index 9df956fc..2b61f3b7 100644 --- a/docs/test_cases/t30008.md +++ b/docs/test_cases/t30008.md @@ -29,8 +29,7 @@ namespace dependants { namespace X { } namespace A { -struct AA { -}; +struct AA { }; } namespace B { struct BB { @@ -50,8 +49,7 @@ namespace Y { } namespace D { -struct DD { -}; +struct DD { }; } namespace E { struct EE { diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 88731cc0..a432ea16 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F diff --git a/docs/test_cases/t30009_package.svg b/docs/test_cases/t30009_package.svg index ed0eb6c9..a4be26e9 100644 --- a/docs/test_cases/t30009_package.svg +++ b/docs/test_cases/t30009_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + One - - + + Two - - + + B - - + + D - - + + A - - + + C - - + + A - - + + B - - + + C - - + + D diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 45f1727c..43e2e37b 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + yaml-cpp/yaml.h - + This is a lib1 include dir - + This is a t40001_include1.h include file @@ -60,7 +60,7 @@ - - + + diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index f7a34272..48027dcb 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - + src - + lib1 - + lib2 - + include - + lib1 - + lib2 - - + + t40002.cc - - + + lib1.cc - - + + lib2.cc - - + + lib1.h - - + + lib2.h diff --git a/docs/test_cases/t40003_include.svg b/docs/test_cases/t40003_include.svg index c8618335..5e9cc5fb 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + src - + dependants - + dependencies - + include - + dependants - + dependencies - - + + t1.cc - - + + t2.cc - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h From 8ba0239283aae6bf91ead6728025c606f726c5c8 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 5 Mar 2023 19:34:06 +0100 Subject: [PATCH 03/15] Added option to read config file from stdin (related #105) --- docs/configuration_file.md | 13 +++++++ src/config/yaml_decoders.cc | 28 ++++++++++++--- src/main.cc | 72 +++++++++++++++++++++++-------------- 3 files changed, 81 insertions(+), 32 deletions(-) diff --git a/docs/configuration_file.md b/docs/configuration_file.md index a13bd5d2..e1111913 100644 --- a/docs/configuration_file.md +++ b/docs/configuration_file.md @@ -5,6 +5,7 @@ * [Top level options](#top-level-options) * [Diagram options](#diagram-options) * [Example complete config](#example-complete-config) +* [Determining config file location](#determining-config-file-location) * [Paths](#paths) @@ -121,6 +122,18 @@ diagrams: - 'title clang-uml class diagram model' ``` +## Determining config file location + +If `-c,--config` option is not provided, `clang-uml` will try to open file +`.clang-uml` in the current directory and fail if it doesn't exist. + +With `-c,--config` option pointing to a valid `.clang-uml` file path, the file +configuration will be loaded from that file. + +Furthermore, when the value of `-c,--config` option is `-` - the entire config +will be read from `stdin`, which can be useful for scripting and generating +config Yaml documents on the fly. + ## Paths By default, all paths specified in the configuration file, including: diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index ddf59669..3b4cf962 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -609,14 +609,32 @@ config load( const std::string &config_file, std::optional paths_relative_to_pwd) { try { - YAML::Node doc = YAML::LoadFile(config_file); + YAML::Node doc; + std::filesystem::path config_file_path{}; + + if (config_file == "-") { + std::istreambuf_iterator stdin_stream_begin{std::cin}; + std::istreambuf_iterator stdin_stream_end{}; + std::string stdin_stream_str{stdin_stream_begin, stdin_stream_end}; + + doc = YAML::Load(stdin_stream_str); + } + else { + doc = YAML::LoadFile(config_file); + } // Store the parent path of the config_file to properly resolve // the include files paths - auto config_file_path = - std::filesystem::absolute(std::filesystem::path{config_file}); - doc.force_insert( - "__parent_path", config_file_path.parent_path().string()); + if (config_file == "-") { + config_file_path = std::filesystem::current_path(); + doc.force_insert("__parent_path", config_file_path.string()); + } + else { + config_file_path = + std::filesystem::absolute(std::filesystem::path{config_file}); + doc.force_insert( + "__parent_path", config_file_path.parent_path().string()); + } // // If no relative_to path is specified in the config, make all paths diff --git a/src/main.cc b/src/main.cc index 4c968022..8c730cc0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -162,9 +162,9 @@ int main(int argc, const char *argv[]) std::optional compilation_database_dir{}; std::vector diagram_names{}; std::optional output_directory{}; - unsigned int thread_count{0}; + unsigned int thread_count{}; bool show_version{false}; - int verbose{0}; + int verbose{}; bool list_diagrams{false}; bool quiet{false}; bool initialize{false}; @@ -175,8 +175,8 @@ int main(int argc, const char *argv[]) bool dump_config{false}; std::optional paths_relative_to_pwd{}; - app.add_option( - "-c,--config", config_path, "Location of configuration file"); + app.add_option("-c,--config", config_path, + "Location of configuration file, when '-' read from stdin"); app.add_option("-d,--compile-database", compilation_database_dir, "Location of compilation database directory"); app.add_option("-n,--diagram-name", diagram_names, @@ -208,42 +208,60 @@ int main(int argc, const char *argv[]) CLI11_PARSE(app, argc, argv); + if (quiet || dump_config) + verbose = 0; + else + verbose++; + + clanguml::util::setup_logging(verbose); + if (show_version) { print_version(); return 0; } + if ((config_path == "-") && + (initialize || add_class_diagram.has_value() || + add_sequence_diagram.has_value() || + add_package_diagram.has_value() || + add_include_diagram.has_value())) { + + LOG_ERROR( + "ERROR: Cannot add a diagram config to configuration from stdin"); + + return 1; + } + if (initialize) { return create_config_file(); } - verbose++; + if (config_path != "-") { + if (add_class_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kClass, config_path, + *add_class_diagram); + } - if (quiet) - verbose = 0; + if (add_sequence_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kSequence, config_path, + *add_sequence_diagram); + } - if (add_class_diagram) { - return add_config_diagram(clanguml::common::model::diagram_t::kClass, - config_path, *add_class_diagram); + if (add_package_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kPackage, config_path, + *add_package_diagram); + } + + if (add_include_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kInclude, config_path, + *add_include_diagram); + } } - if (add_sequence_diagram) { - return add_config_diagram(clanguml::common::model::diagram_t::kSequence, - config_path, *add_sequence_diagram); - } - - if (add_package_diagram) { - return add_config_diagram(clanguml::common::model::diagram_t::kPackage, - config_path, *add_package_diagram); - } - - if (add_include_diagram) { - return add_config_diagram(clanguml::common::model::diagram_t::kInclude, - config_path, *add_include_diagram); - } - - clanguml::util::setup_logging(verbose); - clanguml::config::config config; try { config = clanguml::config::load(config_path, paths_relative_to_pwd); From 8f99e2fc2fe40596bf010d05c6fbf72a45d367a9 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 6 Mar 2023 22:32:02 +0100 Subject: [PATCH 04/15] Added parents (base classes) diagram filter --- docs/diagram_filters.md | 5 +++ src/common/model/diagram_filter.cc | 45 +++++++++++++++++++++++++++ src/common/model/diagram_filter.h | 11 +++++++ src/config/config.h | 2 ++ src/config/yaml_decoders.cc | 3 ++ src/config/yaml_emitters.cc | 2 ++ tests/t00060/.clang-uml | 15 +++++++++ tests/t00060/t00060.cc | 20 ++++++++++++ tests/t00060/test_case.h | 50 ++++++++++++++++++++++++++++++ tests/test_cases.cc | 2 ++ tests/test_cases.yaml | 3 ++ 11 files changed, 158 insertions(+) create mode 100644 tests/t00060/.clang-uml create mode 100644 tests/t00060/t00060.cc create mode 100644 tests/t00060/test_case.h diff --git a/docs/diagram_filters.md b/docs/diagram_filters.md index 39c7d88d..548f4e71 100644 --- a/docs/diagram_filters.md +++ b/docs/diagram_filters.md @@ -7,6 +7,7 @@ * [`context`](#context) * [`relationships`](#relationships) * [`subclasses`](#subclasses) +* [`parents`](#parents) * [`specializations`](#specializations) * [`dependants` and `dependencies`](#dependants-and-dependencies) @@ -89,6 +90,10 @@ The following relationships can be used in this filter: This filter allows to include or exclude all subclasses of a given class in the diagram. +## `parents` + +This filter allows to include or exclude all parents (base classes) of a given class in the diagram. + ## `specializations` This filter allows to include or exclude specializations and instantiations of a specific template from the diagram. diff --git a/src/common/model/diagram_filter.cc b/src/common/model/diagram_filter.cc index 8e04e573..e52c40d7 100644 --- a/src/common/model/diagram_filter.cc +++ b/src/common/model/diagram_filter.cc @@ -263,6 +263,45 @@ tvl::value_t subclass_filter::match(const diagram &d, const element &e) const return false; } +parents_filter::parents_filter(filter_t type, std::vector children) + : filter_visitor{type} + , children_{std::move(children)} +{ +} + +tvl::value_t parents_filter::match(const diagram &d, const element &e) const +{ + if (d.type() != diagram_t::kClass) + return {}; + + if (children_.empty()) + return {}; + + if (!d.complete()) + return {}; + + const auto &cd = dynamic_cast(d); + + // First get all parents of element e + clanguml::common::reference_set parents; + + for (const auto &child : children_) { + auto child_ref = cd.get_class(child); + if (!child_ref.has_value()) + continue; + parents.emplace(child_ref.value()); + } + + cd.get_parents(parents); + + for (const auto &parent : parents) { + if (e == parent.get()) + return true; + } + + return false; +} + relationship_filter::relationship_filter( filter_t type, std::vector relationships) : filter_visitor{type} @@ -465,6 +504,9 @@ void diagram_filter::init_filters(const config::diagram &c) element_filters.emplace_back(std::make_unique( filter_t::kInclusive, c.include().subclasses)); + element_filters.emplace_back(std::make_unique( + filter_t::kInclusive, c.include().parents)); + element_filters.emplace_back(std::make_unique< edge_traversal_filter>(filter_t::kInclusive, @@ -545,6 +587,9 @@ void diagram_filter::init_filters(const config::diagram &c) add_exclusive_filter(std::make_unique( filter_t::kExclusive, c.exclude().subclasses)); + add_exclusive_filter(std::make_unique( + filter_t::kExclusive, c.exclude().parents)); + add_exclusive_filter(std::make_unique>( filter_t::kExclusive, relationship_t::kInstantiation, diff --git a/src/common/model/diagram_filter.h b/src/common/model/diagram_filter.h index 49e69df3..24b61955 100644 --- a/src/common/model/diagram_filter.h +++ b/src/common/model/diagram_filter.h @@ -135,6 +135,17 @@ private: std::vector roots_; }; +struct parents_filter : public filter_visitor { + parents_filter(filter_t type, std::vector roots); + + ~parents_filter() override = default; + + tvl::value_t match(const diagram &d, const element &e) const override; + +private: + std::vector children_; +}; + template struct edge_traversal_filter : public filter_visitor { diff --git a/src/config/config.h b/src/config/config.h index 5cfd6779..942650ff 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -69,6 +69,8 @@ struct filter { std::vector subclasses; + std::vector parents; + std::vector specializations; std::vector dependants; diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index 3b4cf962..23d24ef0 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -275,6 +275,9 @@ template <> struct convert { if (node["subclasses"]) rhs.subclasses = node["subclasses"].as(); + if (node["parents"]) + rhs.parents = node["parents"].as(); + if (node["specializations"]) rhs.specializations = node["specializations"].as(); diff --git a/src/config/yaml_emitters.cc b/src/config/yaml_emitters.cc index b31eedf1..cb7a6be8 100644 --- a/src/config/yaml_emitters.cc +++ b/src/config/yaml_emitters.cc @@ -69,6 +69,8 @@ YAML::Emitter &operator<<(YAML::Emitter &out, const filter &f) << f.specializations; if (!f.subclasses.empty()) out << YAML::Key << "subclasses" << YAML::Value << f.subclasses; + if (!f.parents.empty()) + out << YAML::Key << "parents" << YAML::Value << f.parents; out << YAML::EndMap; return out; diff --git a/tests/t00060/.clang-uml b/tests/t00060/.clang-uml new file mode 100644 index 00000000..8e127f89 --- /dev/null +++ b/tests/t00060/.clang-uml @@ -0,0 +1,15 @@ +compilation_database_dir: .. +output_directory: puml +diagrams: + t00060_class: + type: class + glob: + - ../../tests/t00060/t00060.cc + include: + namespaces: + - clanguml::t00060 + parents: + - clanguml::t00060::D + - clanguml::t00060::H + using_namespace: + - clanguml::t00060 \ No newline at end of file diff --git a/tests/t00060/t00060.cc b/tests/t00060/t00060.cc new file mode 100644 index 00000000..5105c041 --- /dev/null +++ b/tests/t00060/t00060.cc @@ -0,0 +1,20 @@ +namespace clanguml { +namespace t00060 { +struct A { }; +struct B : public A { }; +struct C : public A { }; +struct D : public B, public C { }; +struct E : public C { }; +struct F : public D { }; + +template struct G { + T g; +}; + +template struct H : public G { + G h; + P hh; +}; + +} +} \ No newline at end of file diff --git a/tests/t00060/test_case.h b/tests/t00060/test_case.h new file mode 100644 index 00000000..c5a94071 --- /dev/null +++ b/tests/t00060/test_case.h @@ -0,0 +1,50 @@ +/** + * tests/t00060/test_case.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +TEST_CASE("t00060", "[test-case][class]") +{ + auto [config, db] = load_config("t00060"); + + auto diagram = config.diagrams["t00060_class"]; + + REQUIRE(diagram->name == "t00060_class"); + + auto model = generate_class_diagram(*db, diagram); + + REQUIRE(model->name() == "t00060_class"); + + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); + + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, !IsClass(_A("E"))); + REQUIRE_THAT(puml, !IsClass(_A("F"))); + + // Check if class templates exist + REQUIRE_THAT(puml, IsClassTemplate("G", "T")); + REQUIRE_THAT(puml, IsClassTemplate("H", "T,P")); + + save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index fa277f29..10c4bff4 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -263,6 +263,8 @@ using namespace clanguml::test::matchers; #include "t00058/test_case.h" #include "t00059/test_case.h" #endif +#include "t00060/test_case.h" + /// /// Sequence diagram tests /// diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index 6466cf82..60f29e77 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -174,6 +174,9 @@ test_cases: - name: t00059 title: Non-virtual abstract factory pattern using concepts test case description: + - name: t00060 + title: Parents (base classes) diagram filter test case + description: Sequence diagrams: - name: t20001 title: Basic sequence diagram test case From 029a28a0d33f6bf9a6c2f5cb9ff8cd7f70f0a867 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 6 Mar 2023 22:50:33 +0100 Subject: [PATCH 05/15] Added NUMPROC option to clang-tidy --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8135a982..6fa445bc 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,7 @@ format: .PHONY: debug_tidy tidy: debug_tidy - run-clang-tidy-15 -p debug_tidy ./src + run-clang-tidy-15 -j $(NUMPROC) -p debug_tidy ./src .PHONY: check-formatting check-formatting: From 0dc74459096327985b9c811c49333cc39bdecb4c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 6 Mar 2023 23:32:40 +0100 Subject: [PATCH 06/15] Updated test cases documentation --- CHANGELOG.md | 1 + docs/test_cases.md | 1 + docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++---- docs/test_cases/t00004_class.svg | 76 +++++------ docs/test_cases/t00005_class.svg | 110 +++++++-------- docs/test_cases/t00006_class.svg | 132 +++++++++--------- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008_class.svg | 68 +++++----- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 ++--- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++----- docs/test_cases/t00013_class.svg | 82 +++++------ docs/test_cases/t00014_class.svg | 116 ++++++++-------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 26 ++-- docs/test_cases/t00017_class.svg | 66 ++++----- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++--- docs/test_cases/t00020_class.svg | 38 +++--- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++--- docs/test_cases/t00026_class.svg | 42 +++--- docs/test_cases/t00027_class.svg | 58 ++++---- docs/test_cases/t00028_class.svg | 82 +++++------ docs/test_cases/t00029_class.svg | 50 +++---- docs/test_cases/t00030_class.svg | 46 +++---- docs/test_cases/t00031_class.svg | 50 +++---- docs/test_cases/t00032_class.svg | 40 +++--- docs/test_cases/t00033_class.svg | 48 +++---- docs/test_cases/t00034_class.svg | 38 +++--- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 +++--- docs/test_cases/t00037_class.svg | 54 ++++---- docs/test_cases/t00038_class.svg | 54 ++++---- docs/test_cases/t00039_class.svg | 78 +++++------ docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 ++++---- docs/test_cases/t00042_class.svg | 32 ++--- docs/test_cases/t00043_class.svg | 50 +++---- docs/test_cases/t00044_class.svg | 18 +-- docs/test_cases/t00045_class.svg | 70 +++++----- docs/test_cases/t00046_class.svg | 64 ++++----- docs/test_cases/t00047_class.svg | 18 +-- docs/test_cases/t00048_class.svg | 50 +++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 70 +++++----- docs/test_cases/t00051_class.svg | 30 ++-- docs/test_cases/t00052_class.svg | 34 ++--- docs/test_cases/t00053_class.svg | 70 +++++----- docs/test_cases/t00054_class.svg | 78 +++++------ docs/test_cases/t00055_class.svg | 42 +++--- docs/test_cases/t00056_class.svg | 94 ++++++------- docs/test_cases/t00057_class.svg | 114 ++++++++-------- docs/test_cases/t00058_class.svg | 48 +++---- docs/test_cases/t00059_class.svg | 50 +++---- docs/test_cases/t00060.md | 45 ++++++ docs/test_cases/t00060_class.svg | 99 ++++++++++++++ docs/test_cases/t20001_sequence.svg | 62 ++++----- docs/test_cases/t20002_sequence.svg | 48 +++---- docs/test_cases/t20003_sequence.svg | 48 +++---- docs/test_cases/t20004_sequence.svg | 120 ++++++++-------- docs/test_cases/t20005_sequence.svg | 36 ++--- docs/test_cases/t20006_sequence.svg | 150 ++++++++++---------- docs/test_cases/t20007_sequence.svg | 48 +++---- docs/test_cases/t20008_sequence.svg | 84 ++++++------ docs/test_cases/t20009_sequence.svg | 84 ++++++------ docs/test_cases/t20010_sequence.svg | 72 +++++----- docs/test_cases/t20011_sequence.svg | 72 +++++----- docs/test_cases/t20012_sequence.svg | 204 ++++++++++++++-------------- docs/test_cases/t20013_sequence.svg | 60 ++++---- docs/test_cases/t20014_sequence.svg | 72 +++++----- docs/test_cases/t20015_sequence.svg | 24 ++-- docs/test_cases/t20016_sequence.svg | 48 +++---- docs/test_cases/t20017_sequence.svg | 48 +++---- docs/test_cases/t20018_sequence.svg | 96 ++++++------- docs/test_cases/t20019_sequence.svg | 84 ++++++------ docs/test_cases/t20020_sequence.svg | 118 ++++++++-------- docs/test_cases/t20021_sequence.svg | 106 +++++++-------- docs/test_cases/t20022_sequence.svg | 36 ++--- docs/test_cases/t20023_sequence.svg | 50 +++---- docs/test_cases/t20024_sequence.svg | 88 ++++++------ docs/test_cases/t20025_sequence.svg | 42 +++--- docs/test_cases/t20026_sequence.svg | 24 ++-- docs/test_cases/t20027_sequence.svg | 24 ++-- docs/test_cases/t20028_sequence.svg | 44 +++--- docs/test_cases/t20029_sequence.svg | 80 +++++------ docs/test_cases/t30001_package.svg | 54 ++++---- docs/test_cases/t30002_package.svg | 90 ++++++------ docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 38 +++--- docs/test_cases/t30005_package.svg | 38 +++--- docs/test_cases/t30006_package.svg | 18 +-- docs/test_cases/t30007_package.svg | 22 +-- docs/test_cases/t30008_package.svg | 34 ++--- docs/test_cases/t30009_package.svg | 42 +++--- docs/test_cases/t40001_include.svg | 34 ++--- docs/test_cases/t40002_include.svg | 34 ++--- docs/test_cases/t40003_include.svg | 50 +++---- 103 files changed, 2887 insertions(+), 2741 deletions(-) create mode 100644 docs/test_cases/t00060.md create mode 100644 docs/test_cases/t00060_class.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 980df328..e3f7dc76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # CHANGELOG + * Added parents (base classes) diagram filter * Fixed namespace handling for nested template specializations ### 0.3.2 diff --git a/docs/test_cases.md b/docs/test_cases.md index 90628a8c..19217bd0 100644 --- a/docs/test_cases.md +++ b/docs/test_cases.md @@ -58,6 +58,7 @@ * [t00057](./test_cases/t00057.md) - Test case C99/C11 translation units with structs and unions * [t00058](./test_cases/t00058.md) - Test case for concepts with variadic parameters and type aliases * [t00059](./test_cases/t00059.md) - Non-virtual abstract factory pattern using concepts test case + * [t00060](./test_cases/t00060.md) - Parents (base classes) diagram filter test case ## Sequence diagrams * [t20001](./test_cases/t20001.md) - Basic sequence diagram test case * [t20002](./test_cases/t20002.md) - Free function sequence diagram test case diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 0f040410..2b7114b5 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ foo_c() = 0 : void - - + + B @@ -31,8 +31,8 @@ foo_a() : void - - + + C @@ -41,18 +41,18 @@ foo_c() : void - - + + D - + - + as : std::vector<A *> @@ -60,18 +60,18 @@ foo_a() : void foo_c() : void - - + + E - + - + as : std::vector<A *> @@ -79,13 +79,13 @@ foo_a() : void foo_c() : void - + This is class A - + This is class B - + This is class D diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index 3f80c023..5686ebe9 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - + + A - + - + public_member : int - + - + protected_member : int - + - + private_member : int - + - + a_ : int - + - + b_ : int - + - + c_ : int - + - + static_int : int - + - + static_const_int : const int - + - + auto_member : const unsigned long @@ -112,11 +112,11 @@ protected_method() : void private_method() : void - + - + compare : std::function<bool (const int)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 9714a145..6584c650 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + B - - + + B::AA @@ -28,8 +28,8 @@ AA_3 - - + + A @@ -40,16 +40,16 @@ foo2() const : void - - + + A::AA - - + + A::AA::Lights @@ -59,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 7986711f..b17f5708 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,204 +9,204 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & - + - + a : A - + - + b : B * - + - + c : C & - + - + d : const D * - + - + e : const E & - + - + f : F && - + - + g : G ** - + - + h : H *** - + - + i : I *& - + - + j : volatile J * - + - + k : K * diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 58464d1a..bd265e87 100644 --- a/docs/test_cases/t00006_class.svg +++ b/docs/test_cases/t00006_class.svg @@ -1,6 +1,6 @@ - + @@ -9,136 +9,136 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + L - - + + M - - + + N - - + + NN - - + + NNN - - + + custom_container @@ -146,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ E - - + + R - + - + a : std::vector<A> - + - + b : std::vector<B *> - + - + c : std::map<int,C> - + - + d : std::map<int,D *> - + - + e : custom_container<E> - + - + f : std::vector<std::vector<F>> - + - + g : std::map<int,std::vector<G *>> - + - + h : std::array<H,10> - + - + i : std::array<I *,5> - + - + j : J[10] - + - + k : K *[20] - + - + lm : std::vector<std::pair<L,M>> - + - + ns : std::tuple<N,NN,NNN> diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index e068c715..28b9f545 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index c64910a3..8bdec027 100644 --- a/docs/test_cases/t00008_class.svg +++ b/docs/test_cases/t00008_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,51 +18,51 @@ T,P,CMP,int N - + - + value : T - + - + pointer : T * - + - + reference : T & - + - + values : std::vector<P> - + - + ints : std::array<int,N> - + - + comparator : CMP - - + + Vector @@ -70,16 +70,16 @@ T - + - + values : std::vector<T> - - + + B @@ -87,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> @@ -122,16 +122,16 @@ add(int i) : void D<Items...>(std::tuple<Items...> * ) : void - - + + E - - + + E::nested_template @@ -142,8 +142,8 @@ get(ET * d) : E::nested_template::DT * - - + + E::nested_template diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 249fba1c..80224d2b 100644 --- a/docs/test_cases/t00009_class.svg +++ b/docs/test_cases/t00009_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ std::vector<std::string> - - + + B - + - + aint : A<int> - + - + astring : A<std::string> * - + - + avector : A<std::vector<std::string>> & diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index f5937149..70784b97 100644 --- a/docs/test_cases/t00010_class.svg +++ b/docs/test_cases/t00010_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 08ab6b35..b75e51bc 100644 --- a/docs/test_cases/t00011_class.svg +++ b/docs/test_cases/t00011_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + D @@ -18,16 +18,16 @@ T - + - + value : T - - + + A @@ -36,18 +36,18 @@ foo() : void - - + + B - + - + m_a : A * diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index d97448ac..d5ae5d6a 100644 --- a/docs/test_cases/t00012_class.svg +++ b/docs/test_cases/t00012_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,23 +18,23 @@ T,Ts... - + - + value : T - + - + values : std::variant<Ts...> - - + + B @@ -43,15 +43,15 @@ - + - + ints : std::array<int,sizeof...(Is)> - - + + C @@ -60,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3 - - + + R - + - + a1 : A<int,std::string,float> - + - + a2 : A<int,std::string,bool> - + - + b1 : B<3,2,1> - + - + b2 : B<1,1,1,1> - + - + c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> - + Long template annotation diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index c4afae0a..77d648b0 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ABCD::F @@ -18,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 297aa28e..ff79e7d7 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + intstring : AIntString - + - + stringstring : AStringString - + - + bstringstring : BStringString - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index e4c2ec3f..37864ba3 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + ns1::A - - + + ns1::ns2_v0_9_0::A - - + + ns1::Anon - - + + ns3::ns1::ns2::Anon - - + + ns3::B diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg index 65caea3b..4053f733 100644 --- a/docs/test_cases/t00016_class.svg +++ b/docs/test_cases/t00016_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + is_numeric<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ - - + + is_numeric @@ -39,8 +39,8 @@ - - + + is_numeric @@ -49,8 +49,8 @@ - - + + is_numeric @@ -59,8 +59,8 @@ - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 4111d0ea..3e89a97f 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,127 +9,127 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 7654f395..dce0b307 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,18 +9,18 @@ - - + + impl::widget - + - + n : int @@ -30,18 +30,18 @@ draw(const widget & w) : void widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 81ad334b..2d5ffbe7 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Base @@ -25,8 +25,8 @@ m2() : std::string - - + + Layer1 @@ -39,8 +39,8 @@ m2() : std::string - - + + Layer2 @@ -51,8 +51,8 @@ all_calls_count() const : int - - + + Layer3 @@ -60,18 +60,18 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int @@ -83,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 67f16cc5..2fb2cd2f 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ProductA @@ -21,8 +21,8 @@ sell(int price) const = 0 : bool - - + + ProductA1 @@ -31,8 +31,8 @@ sell(int price) const : bool - - + + ProductA2 @@ -41,8 +41,8 @@ sell(int price) const : bool - - + + ProductB @@ -53,8 +53,8 @@ buy(int price) const = 0 : bool - - + + ProductB1 @@ -63,8 +63,8 @@ buy(int price) const : bool - - + + ProductB2 @@ -73,8 +73,8 @@ buy(int price) const : bool - - + + AbstractFactory @@ -85,8 +85,8 @@ make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 @@ -97,8 +97,8 @@ make_b() const : std::unique_ptr<ProductB> - - + + Factory2 diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index 00a557dc..b19f4fca 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Visitor @@ -23,8 +23,8 @@ visit_B(const B & item) const = 0 : void - - + + Visitor1 @@ -35,8 +35,8 @@ visit_B(const B & item) const : void - - + + Visitor2 @@ -47,8 +47,8 @@ visit_B(const B & item) const : void - - + + Visitor3 @@ -59,8 +59,8 @@ visit_B(const B & item) const : void - - + + Item @@ -71,8 +71,8 @@ accept(const Visitor & visitor) const = 0 : void - - + + A @@ -81,8 +81,8 @@ accept(const Visitor & visitor) const : void - - + + B diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 7def889f..ee5f8b6d 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -23,8 +23,8 @@ method2() = 0 : void - - + + A1 @@ -35,8 +35,8 @@ method2() : void - - + + A2 diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 0321b98b..7a790c06 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Strategy @@ -21,8 +21,8 @@ algorithm() = 0 : void - - + + StrategyA @@ -31,8 +31,8 @@ algorithm() : void - - + + StrategyB @@ -41,8 +41,8 @@ algorithm() : void - - + + StrategyC @@ -51,18 +51,18 @@ algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 07f1efb8..8b019a4c 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target @@ -23,8 +23,8 @@ m2() = 0 : void - - + + Target1 @@ -35,8 +35,8 @@ m2() : void - - + + Target2 @@ -47,18 +47,18 @@ m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index aed9eb43..bf74d46b 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target1 @@ -21,8 +21,8 @@ m2() : void - - + + Target2 @@ -33,8 +33,8 @@ m2() : void - - + + Proxy @@ -42,11 +42,11 @@ T - + - + m_target : std::shared_ptr<T> @@ -56,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 06cf9806..1552fb4d 100644 --- a/docs/test_cases/t00026_class.svg +++ b/docs/test_cases/t00026_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Memento @@ -18,11 +18,11 @@ T - + - + m_value : T @@ -30,8 +30,8 @@ Memento<T>(T && v) : void value() const : T - - + + Originator @@ -39,11 +39,11 @@ T - + - + m_value : T @@ -57,8 +57,8 @@ print() const : void set(T && v) : void - - + + Caretaker @@ -66,11 +66,11 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> @@ -78,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 7e7e557c..6fb2ea37 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Shape @@ -21,14 +21,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 75895b7e..b0370ebc 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + A - + A class note. - - + + B - + B class note. - - + + C - + C class note. - - + + D - + D class note. - - + + E @@ -64,27 +64,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -94,10 +94,10 @@ three - + F enum note. - + E @@ -105,65 +105,65 @@ int - - + + R - + - + aaa : A - + - + bbb : B * - + - + ccc : C & - + - + ddd : std::vector<std::shared_ptr<D>> - + - + eee : E<int> - + - + ggg : G ** R(C & c) : void - + R class note. - + R contains an instance of A. - + Reference to C. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index dabf7fc9..f0e95b2f 100644 --- a/docs/test_cases/t00029_class.svg +++ b/docs/test_cases/t00029_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + A - - + + C @@ -26,16 +26,16 @@ T - + - + param : T - - + + E @@ -45,64 +45,64 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3 & - + - + g4 : std::shared_ptr<G4> diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index f9c02441..20c3701d 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,86 +9,86 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + - + eee : E * diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 2919ef26..ded9ace3 100644 --- a/docs/test_cases/t00031_class.svg +++ b/docs/test_cases/t00031_class.svg @@ -1,33 +1,33 @@ - + - + - + - - - + + + A - - + + B @@ -37,8 +37,8 @@ three - - + + @@ -47,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 718c1f47..e48fb86f 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,24 +9,24 @@ - - + + Base - - + + TBase - - + + A @@ -35,8 +35,8 @@ operator()() : void - - + + B @@ -45,8 +45,8 @@ operator()() : void - - + + C @@ -55,8 +55,8 @@ operator()() : void - - + + Overload @@ -64,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 94d44609..8691e0dd 100644 --- a/docs/test_cases/t00033_class.svg +++ b/docs/test_cases/t00033_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + aaa : T - - + + B @@ -35,16 +35,16 @@ T - + - + bbb : T - - + + C @@ -52,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 2bf2c81a..044335f4 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Void @@ -21,8 +21,8 @@ operator!=(const Void & ) const : bool - - + + lift_void @@ -31,8 +31,8 @@ - - + + lift_void @@ -41,8 +41,8 @@ - - + + drop_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,33 +61,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 95b5ba0b..3b589a36 100644 --- a/docs/test_cases/t00035_class.svg +++ b/docs/test_cases/t00035_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + Top - - + + Left - - + + Center - - + + Bottom - - + + Right diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg index c8809f4e..9e102f1c 100644 --- a/docs/test_cases/t00036_class.svg +++ b/docs/test_cases/t00036_class.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - + ns1 - + ns11 - + ns111 - + ns2 - + ns22 - - + + E @@ -34,8 +34,8 @@ yellow - - + + A @@ -43,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 40ab1b28..98f79206 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,98 +9,98 @@ - - + + ST - + - + dimensions : ST::(anonymous_662) - + - + units : ST::(anonymous_792) - - + + ST::(dimensions) - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + ST::(units) - + - + c : double - + - + h : double - - + + A - + - + st : ST diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index 1fee1d69..af974d05 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + thirdparty::ns1::color_t @@ -20,16 +20,16 @@ blue - - + + thirdparty::ns1::E - - + + property_t @@ -39,47 +39,47 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - + - + key : std::string - - + + map @@ -88,8 +88,8 @@ - - + + map @@ -98,8 +98,8 @@ - - + + map @@ -108,8 +108,8 @@ - - + + map @@ -118,8 +118,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index ca5ac1e1..09866834 100644 --- a/docs/test_cases/t00039_class.svg +++ b/docs/test_cases/t00039_class.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - + + C - - + + D - - + + E - - + + CD - - + + DE - - + + CDE - - + + A - - + + AA - - + + AAA - + - + b : B * - - + + ns2::AAAA - - + + ns3::F @@ -105,16 +105,16 @@ T - + - + t : T * - - + + ns3::FF @@ -122,16 +122,16 @@ T,M - + - + m : M * - - + + ns3::FE @@ -139,16 +139,16 @@ T,M - + - + m : M * - - + + ns3::FFF @@ -156,11 +156,11 @@ T,M,N - + - + n : N * diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index ddcfc69f..1875de1e 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + - + ii_ : int get_a() : int - - + + AA - - + + AAA - + - + b : B * get_aaa() : int - - + + R diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index a659a187..6095d953 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,102 +9,102 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * foo(H * h) : void - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index e573b2f6..76afa2d0 100644 --- a/docs/test_cases/t00042_class.svg +++ b/docs/test_cases/t00042_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + a : T - - + + A @@ -36,8 +36,8 @@ - - + + B @@ -45,22 +45,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -68,7 +68,7 @@ double - + A @@ -76,7 +76,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 8e65d290..0490f9d4 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - + dependants - + dependencies - - + + A - - + + B @@ -33,8 +33,8 @@ b(dependants::A * a) : void - - + + BB @@ -43,8 +43,8 @@ bb(dependants::A * a) : void - - + + C @@ -53,8 +53,8 @@ c(dependants::B * b) : void - - + + D @@ -65,8 +65,8 @@ dd(dependants::BB * bb) : void - - + + E @@ -75,24 +75,24 @@ e(dependants::D * d) : void - - + + G - - + + GG - - + + H @@ -103,8 +103,8 @@ hh(dependencies::GG * gg) : void - - + + I @@ -113,8 +113,8 @@ i(dependencies::H * h) : void - - + + J diff --git a/docs/test_cases/t00044_class.svg b/docs/test_cases/t00044_class.svg index bc001960..44068dd6 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + sink @@ -19,8 +19,8 @@ - - + + signal_handler @@ -29,8 +29,8 @@ - - + + signal_handler @@ -39,8 +39,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index bfeb498d..5e08bc04 100644 --- a/docs/test_cases/t00045_class.svg +++ b/docs/test_cases/t00045_class.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + A - - + + AA - - + + AAA - - + + AAAA @@ -42,103 +42,103 @@ T - + - + t : T - - + + ns1::A - - + + ns1::ns2::A - - + + ns1::ns2::B - - + + ns1::ns2::C - - + + ns1::ns2::D - - + + ns1::ns2::E - - + + ns1::ns2::AAA - - + + ns1::ns2::R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * diff --git a/docs/test_cases/t00046_class.svg b/docs/test_cases/t00046_class.svg index bf1cac0e..ac14b903 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 20eca883..785abe38 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + conditional_t @@ -19,8 +19,8 @@ - - + + conditional_t @@ -29,8 +29,8 @@ - - + + conditional_t @@ -39,8 +39,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index e83be052..7eb39e66 100644 --- a/docs/test_cases/t00048_class.svg +++ b/docs/test_cases/t00048_class.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + Base - + - + base : int foo() = 0 : void - - + + BaseTemplate @@ -35,35 +35,35 @@ T - + - + base : T foo() = 0 : void - - + + B - + - + b : int foo() : void - - + + BTemplate @@ -71,35 +71,35 @@ T - + - + b : T foo() : void - - + + A - + - + a : int foo() : void - - + + ATemplate @@ -107,11 +107,11 @@ T - + - + a : T diff --git a/docs/test_cases/t00049_class.svg b/docs/test_cases/t00049_class.svg index 88bedbfd..acfe5e99 100644 --- a/docs/test_cases/t00049_class.svg +++ b/docs/test_cases/t00049_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ string_vector - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 72189a22..b4bafb35 100644 --- a/docs/test_cases/t00050_class.svg +++ b/docs/test_cases/t00050_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + utils::D - - + + E @@ -52,8 +52,8 @@ E3 - - + + F @@ -61,44 +61,44 @@ T,V,int N - + - + t : T[N] - + - + v : V - - + + G - - + + NoComment - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies mollis dictumst, aenean non a in donec nulla. @@ -125,50 +125,50 @@ imperdiet praesent magnis ridiculus congue gravida curabitur dictum sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, aenean vel nostra tellus commodo pretium sapien sociosqu. - + This is a short description of class G. - + This is an intermediate description of class G. - + This is a long description of class G. - + Lorem ipsum - + TODO 1. Write meaningful comment - + TODO 2. Write tests - + TODO 3. Implement - + Long comment example - + TODO Implement... - + Simple array wrapper. - + Template parameters diff --git a/docs/test_cases/t00051_class.svg b/docs/test_cases/t00051_class.svg index ef713a66..5b71075f 100644 --- a/docs/test_cases/t00051_class.svg +++ b/docs/test_cases/t00051_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + B @@ -18,18 +18,18 @@ F,FF - + - + f_ : F - + - + ff_ : FF @@ -39,16 +39,16 @@ f() : void ff() : void - - + + B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> - - + + A @@ -63,8 +63,8 @@ get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) - - + + A::custom_thread1 @@ -73,8 +73,8 @@ custom_thread1<Function,Args...>(Function && f, Args &&... args) : void - - + + A::custom_thread2 diff --git a/docs/test_cases/t00052_class.svg b/docs/test_cases/t00052_class.svg index 31cc3519..a4c7973e 100644 --- a/docs/test_cases/t00052_class.svg +++ b/docs/test_cases/t00052_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ aa<F,Q>(F && f, Q q) : void - - + + B @@ -35,8 +35,8 @@ bb<F>(F && f, T t) : T - - + + C @@ -47,7 +47,7 @@ c<P>(P p) : T - + B @@ -55,7 +55,7 @@ int - + C @@ -63,32 +63,32 @@ int - - + + R - + - + a : A - + - + b : B<int> - + - + c : C<int> diff --git a/docs/test_cases/t00053_class.svg b/docs/test_cases/t00053_class.svg index 1c244ad1..ef5a07f5 100644 --- a/docs/test_cases/t00053_class.svg +++ b/docs/test_cases/t00053_class.svg @@ -1,6 +1,6 @@ - + @@ -9,72 +9,72 @@ - - + + A - - + + C - - + + E - - + + F - - + + a - - + + c - - + + e - - + + f - - + + h @@ -82,8 +82,8 @@ hhh - - + + j @@ -91,56 +91,56 @@ jjj - - + + b - - + + d - - + + g - - + + B - - + + D - - + + G - - + + i diff --git a/docs/test_cases/t00054_class.svg b/docs/test_cases/t00054_class.svg index 56b20883..1391a72d 100644 --- a/docs/test_cases/t00054_class.svg +++ b/docs/test_cases/t00054_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - + detail - + detail2 - + detail3 - + detail4 - - + + d - - + + a - - + + c - - + + e - - + + C - - + + F - - + + D - - + + E - - + + A - - + + B - - + + f - - + + G - - + + h @@ -127,8 +127,8 @@ hhh - - + + i @@ -137,8 +137,8 @@ iii - - + + j @@ -147,16 +147,16 @@ jjj - - + + b - - + + g diff --git a/docs/test_cases/t00055_class.svg b/docs/test_cases/t00055_class.svg index b0005fbe..ee60ac57 100644 --- a/docs/test_cases/t00055_class.svg +++ b/docs/test_cases/t00055_class.svg @@ -1,6 +1,6 @@ - + @@ -9,80 +9,80 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J diff --git a/docs/test_cases/t00056_class.svg b/docs/test_cases/t00056_class.svg index 3028e0c9..c5b6a2b3 100644 --- a/docs/test_cases/t00056_class.svg +++ b/docs/test_cases/t00056_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -20,8 +20,8 @@ - - + + «concept» @@ -33,8 +33,8 @@ sizeof (l) > sizeof (r) - - + + «concept» @@ -44,8 +44,8 @@ - - + + «concept» @@ -58,8 +58,8 @@ container.begin() container.end() - - + + «concept» @@ -71,8 +71,8 @@ typename T::value_type - - + + «concept» @@ -86,8 +86,8 @@ {std::to_string(s)} noexcept {std::to_string(s)} -> std::same_as<std::string> - - + + «concept» @@ -97,8 +97,8 @@ - - + + «concept» @@ -108,8 +108,8 @@ - - + + A @@ -117,16 +117,16 @@ max_four_bytes T - + - + a : T - - + + B @@ -134,16 +134,16 @@ T - + - + b : T - - + + C @@ -151,16 +151,16 @@ convertible_to_string T - + - + c : T - - + + D @@ -169,8 +169,8 @@ - - + + E @@ -178,30 +178,30 @@ T1,T2,T3 - + - + e1 : T1 - + - + e2 : T2 - + - + e3 : T3 - - + + F @@ -209,25 +209,25 @@ T1,T2,T3 - + - + f1 : T1 - + - + f2 : T2 - + - + f3 : T3 diff --git a/docs/test_cases/t00057_class.svg b/docs/test_cases/t00057_class.svg index e240a4b6..b60a5eee 100644 --- a/docs/test_cases/t00057_class.svg +++ b/docs/test_cases/t00057_class.svg @@ -1,6 +1,6 @@ - + @@ -9,210 +9,210 @@ - - + + t00057_A - + - + a1 : int - - + + t00057_B - + - + b1 : int - - + + t00057_C - + - + c1 : int - - + + «union» t00057_D - + - + d1 : int - + - + d2 : float - - + + t00057_E - + - + e : int - + - + coordinates : t00057_E::(anonymous_739) - + - + height : t00057_E::(anonymous_807) - - + + t00057_E::(coordinates) - + - + x : int - + - + y : int - - + + «union» t00057_E::(height) - + - + z : int - + - + t : double - - + + t00057_R - + - + a : struct t00057_A - + - + b : t00057_B - + - + c : struct t00057_C * - + - + d : union t00057_D - + - + e : struct t00057_E * - + - + f : struct t00057_F * - - + + t00057_F - + - + f1 : int diff --git a/docs/test_cases/t00058_class.svg b/docs/test_cases/t00058_class.svg index 6e6207dc..c394b8cf 100644 --- a/docs/test_cases/t00058_class.svg +++ b/docs/test_cases/t00058_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + first_type @@ -19,8 +19,8 @@ - - + + «concept» @@ -30,8 +30,8 @@ - - + + A @@ -39,16 +39,16 @@ T,Args... - + - + a : std::vector<T> - - + + B @@ -56,22 +56,22 @@ T,P,Args... - + - + b : std::vector<T> - + - + bb : P - + A @@ -79,7 +79,7 @@ int,int,double,std::string - + A @@ -87,7 +87,7 @@ int,int - + B @@ -95,25 +95,25 @@ int,std::string,int,double,A<int,int> - - + + R - + - + aa : A<int,int,double,std::string> - + - + bb : B<int,std::string,int,double,A<int,int>> diff --git a/docs/test_cases/t00059_class.svg b/docs/test_cases/t00059_class.svg index 23c042ef..a1e7b15e 100644 --- a/docs/test_cases/t00059_class.svg +++ b/docs/test_cases/t00059_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -23,8 +23,8 @@ T{} t.get_name() - - + + «concept» @@ -36,8 +36,8 @@ t.get_sweetness() - - + + «concept» @@ -49,8 +49,8 @@ t.get_bitterness() - - + + gala_apple @@ -61,8 +61,8 @@ get_sweetness() const : float - - + + empire_apple @@ -73,8 +73,8 @@ get_sweetness() const : float - - + + lima_orange @@ -85,8 +85,8 @@ get_bitterness() const : float - - + + valencia_orange @@ -97,8 +97,8 @@ get_bitterness() const : float - - + + fruit_factory @@ -111,7 +111,7 @@ create_orange() const : TO - + fruit_factory @@ -119,7 +119,7 @@ gala_apple,valencia_orange - + fruit_factory @@ -127,25 +127,25 @@ empire_apple,lima_orange - - + + R - + - + factory_1 : fruit_factory_1 - + - + factory_2 : fruit_factory_2 diff --git a/docs/test_cases/t00060.md b/docs/test_cases/t00060.md new file mode 100644 index 00000000..a2ebd074 --- /dev/null +++ b/docs/test_cases/t00060.md @@ -0,0 +1,45 @@ +# t00060 - Parents (base classes) diagram filter test case +## Config +```yaml +compilation_database_dir: .. +output_directory: puml +diagrams: + t00060_class: + type: class + glob: + - ../../tests/t00060/t00060.cc + include: + namespaces: + - clanguml::t00060 + parents: + - clanguml::t00060::D + - clanguml::t00060::H + using_namespace: + - clanguml::t00060 +``` +## Source code +File t00060.cc +```cpp +namespace clanguml { +namespace t00060 { +struct A { }; +struct B : public A { }; +struct C : public A { }; +struct D : public B, public C { }; +struct E : public C { }; +struct F : public D { }; + +template struct G { + T g; +}; + +template struct H : public G { + G h; + P hh; +}; + +} +} +``` +## Generated UML diagrams +![t00060_class](./t00060_class.svg "Parents (base classes) diagram filter test case") diff --git a/docs/test_cases/t00060_class.svg b/docs/test_cases/t00060_class.svg new file mode 100644 index 00000000..6dc03038 --- /dev/null +++ b/docs/test_cases/t00060_class.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + A + + + + + + + + B + + + + + + + + C + + + + + + + + D + + + + + + + + G + + T + + + + + + + + g : T + + + + + + + H + + T,P + + + + + + + + h : G<T> + + + + + + + hh : P + + + + + + + + + + + + + +h + + + + diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index bba69086..8024a355 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,59 +9,59 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - + + + + + + + + add(int,int) - + wrap_add3(int,int,int) - + add3(int,int,int) - + @@ -72,7 +72,7 @@ - + @@ -81,14 +81,14 @@ - + log_result(int) - + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index 26db911f..e52d0395 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1() - + m1() - - + + m2() - + m2() - - + + m3() - + m3() - - + + m4() - + m4() - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 0045ebf3..08fd6ba3 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1<T>(T) - + m1<T>(T) - - + + m2<T>(T) - + m2<T>(T) - - + + m3<T>(T) - + m3<T>(T) - - + + m4<T>(T) - + m4<T>(T) - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index 0e340208..3da93cb2 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,87 +29,87 @@ - - + + main() - + main() - - + + m1<float>(float) - + m1<float>(float) - - + + m1<unsigned long>(unsigned long) - + m1<unsigned long>(unsigned long) - - + + m4<unsigned long>(unsigned long) - + m4<unsigned long>(unsigned long) - - + + m1<std::string>(std::string) - + m1<std::string>(std::string) - - + + m2<std::string>(std::string) - + m2<std::string>(std::string) - - + + m1<int>(int) - + m1<int>(int) - - + + m2<int>(int) - + m2<int>(int) - - + + m3<int>(int) - + m3<int>(int) - - + + m4<int>(int) - + m4<int>(int) - - - - - - - - - - - + + + + + + + + + + + - + - + @@ -117,11 +117,11 @@ - + - + @@ -129,19 +129,19 @@ - + - + - + - + diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index 5770bacc..b6a19df1 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - + + + - - + + C<T> - + C<T> - - + + B<T> - + B<T> - - + + A<T> - + A<T> - - - + + + c(T) - + b(T) - + a(T) diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 0550484a..e2ce9975 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,82 +34,82 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + BB<int,int> - + BB<int,int> - - + + AA<int> - + AA<int> - - + + BB<int,std::string> - + BB<int,std::string> - - + + BB<int,float> - + BB<int,float> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + b(int) - + a1(int) @@ -118,12 +118,12 @@ - + b(std::string) - + a2(std::string) @@ -132,59 +132,59 @@ - + bb1(int,int) - + aa1(int) - + bb2(int,int) - + aa2(int) - + bb1(int,std::string) - + aa2(int) - + bb2(int,std::string) - + aa1(int) - + bb1(int,float) - + bb2(int,float) - + aa2(int) diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index 1511dd7a..4169b102 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + Adder<int,int> - + Adder<int,int> - - + + Adder<int,float,double> - + Adder<int,float,double> - - + + Adder<std::string,std::string,std::string> - + Adder<std::string,std::string,std::string> - - - - - + + + + + add(int &&,int &&) - + add(int &&,float &&,double &&) - + add(std::string &&,std::string &&,std::string &&) diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index 31427127..fe39916f 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<const char *> - + B<const char *> - - + + A<const char *> - + A<const char *> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - - - - - - - + + + + + + + + b(int) - + a1(int) - + b(const char *) - + a2(const char *) - + b(std::string) - + a3(std::string) diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index 350c326f..be562b57 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<float> - + B<float> - - + + A<float> - + A<float> - - - - - - - - + + + + + + + + b(std::string) - + a(std::string) - + b(int) - + a(int) - + b(float) - + a(float) diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index ed14b3a6..85437afb 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A - + A - - - - - - - - - - + + + + + + + + + + b1() - + a1() - + b2() - + a2() - + b3() - + a3() - + b4() - + a4() diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 4eb3d61f..005b04ff 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - + + + + + + + + + + a(int) @@ -52,26 +52,26 @@ alt - + a(int) - + b(int) - + c(int) - + @@ -81,14 +81,14 @@ alt - + b(int) - + @@ -98,7 +98,7 @@ alt - + diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index fc4db4fc..4c2ca213 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -43,122 +43,122 @@ - - + + tmain() - + tmain() - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - - + + D - + D - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -167,67 +167,67 @@ - + operator()() - + c() - + cc() - + ccc() - + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -238,29 +238,29 @@ - + r() - + operator()() - + c() - + cc() - + @@ -269,7 +269,7 @@ - + add5(int) diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index 9903c73d..88a2ad61 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -58,12 +58,12 @@ - + b(double) - + a2(double) @@ -72,12 +72,12 @@ - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index 9834cf42..bb3fd4b8 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - - - - - - - + + + + + + + + - - + + tmain() - + tmain() - - + + B - + B - - + + A - + A - - + + C<B,int> - + C<B,int> - - - - - - - - - + + + + + + + + + b1(int,int) - + a1(int,int) @@ -67,12 +67,12 @@ - + b2(int,int) - + a2(int,int) @@ -81,17 +81,17 @@ - + c1(int,int) - + b1(int,int) - + a1(int,int) diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index e4cb9b27..6dbd3664 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + B - + B - - - + + + setup_a(std::shared_ptr<detail::A> &) diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index 7369af4a..ff5e8948 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - - - - + + + + + - - + + tmain() - + tmain() - - + + B<long> - + B<long> - - + + A - + A - - - - - - + + + + + + b1(long) - + a1(int) - + b2(long) - + a2(const long &) diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index f47344f6..07bc69f9 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,65 +9,65 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_a.h - + include/t20017_a.h - + include/t20017_b.h - + include/t20017_b.h - - - - - - + + + + + + tmain() - + a3(int,int) - + b1(int,int) - + a2(int,int) - + a1(int,int) - + b2<int>(int,int) diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index ab041ff5..a71306a6 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + @@ -25,93 +25,93 @@ - - + + tmain() - + tmain() - - + + Answer<Factorial<5>,120> - + Answer<Factorial<5>,120> - - + + Factorial<5> - + Factorial<5> - - + + Factorial<4> - + Factorial<4> - - + + Factorial<3> - + Factorial<3> - - + + Factorial<2> - + Factorial<2> - - + + Factorial<1> - + Factorial<1> - - + + Factorial<0> - + Factorial<0> - - - - - - - - - + + + + + + + + + print() - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg index e7f456fc..9c1382df 100644 --- a/docs/test_cases/t20019_sequence.svg +++ b/docs/test_cases/t20019_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + Base<D1> - + Base<D1> - - + + D1 - + D1 - - + + Base<D2> - + Base<D2> - - + + D2 - + D2 - - - - - - - - - - + + + + + + + + + + name() - + impl() - + name() - + impl() - + name() - + impl() - + name() - + impl() diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index 37411244..a4f9a97a 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,78 +9,78 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + C - + C - - + + B - + B - - + + D<int> - + D<int> - - - - - - - - - - - - - + + + + + + + + + + + + + alt - + a1() @@ -91,7 +91,7 @@ alt - + [ @@ -100,7 +100,7 @@ - + [ @@ -109,7 +109,7 @@ - + b1() @@ -117,7 +117,7 @@ - + [ @@ -126,21 +126,21 @@ - + b2() - + a4() - + log() @@ -148,7 +148,7 @@ alt - + c1() @@ -156,7 +156,7 @@ alt - + @@ -169,7 +169,7 @@ - + @@ -179,7 +179,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index 1877b110..97c1d22d 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + C - + C - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + loop - + [ c4() ] - + @@ -89,7 +89,7 @@ - + a3() @@ -102,7 +102,7 @@ loop - + [ @@ -111,7 +111,7 @@ - + [ @@ -120,7 +120,7 @@ - + [ @@ -129,14 +129,14 @@ - + a1() - + [ @@ -148,7 +148,7 @@ loop - + b2() @@ -158,7 +158,7 @@ loop - + [ @@ -167,7 +167,7 @@ - + b2() diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index 3e69a8ff..f8a2d45c 100644 --- a/docs/test_cases/t20022_sequence.svg +++ b/docs/test_cases/t20022_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - + + + + a() - + b() diff --git a/docs/test_cases/t20023_sequence.svg b/docs/test_cases/t20023_sequence.svg index 6c48507a..7867304a 100644 --- a/docs/test_cases/t20023_sequence.svg +++ b/docs/test_cases/t20023_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - + + + + + + + a() @@ -47,7 +47,7 @@ try - + @@ -60,7 +60,7 @@ [std::runtime_error &] - + @@ -73,7 +73,7 @@ [std::logic_error &] - + @@ -86,7 +86,7 @@ [...] - + diff --git a/docs/test_cases/t20024_sequence.svg b/docs/test_cases/t20024_sequence.svg index f888c6b3..6ca2e536 100644 --- a/docs/test_cases/t20024_sequence.svg +++ b/docs/test_cases/t20024_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -33,36 +33,36 @@ - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + select(enum_a) @@ -72,7 +72,7 @@ switch [zero] - + @@ -85,7 +85,7 @@ [one] - + @@ -98,7 +98,7 @@ [two] - + @@ -111,7 +111,7 @@ [default] - + @@ -124,7 +124,7 @@ - + select(colors) @@ -134,7 +134,7 @@ switch [enum colors::red] - + @@ -143,7 +143,7 @@ [enum colors::orange] - + @@ -152,7 +152,7 @@ [enum colors::green] - + @@ -161,7 +161,7 @@ [default] - + diff --git a/docs/test_cases/t20025_sequence.svg b/docs/test_cases/t20025_sequence.svg index 0e9d1084..69e1f3c0 100644 --- a/docs/test_cases/t20025_sequence.svg +++ b/docs/test_cases/t20025_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,41 +9,41 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + add(int,int) - + add(int,int) - - - - - + + + + + a() - + @@ -52,7 +52,7 @@ - + diff --git a/docs/test_cases/t20026_sequence.svg b/docs/test_cases/t20026_sequence.svg index a19daa0e..d13b1f60 100644 --- a/docs/test_cases/t20026_sequence.svg +++ b/docs/test_cases/t20026_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20027_sequence.svg b/docs/test_cases/t20027_sequence.svg index 00cf6b9e..8b990f47 100644 --- a/docs/test_cases/t20027_sequence.svg +++ b/docs/test_cases/t20027_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20028_sequence.svg b/docs/test_cases/t20028_sequence.svg index 9625ad91..dcf30978 100644 --- a/docs/test_cases/t20028_sequence.svg +++ b/docs/test_cases/t20028_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - - - - - + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - + + + + + alt - + a() - + b() - + c() @@ -60,7 +60,7 @@ - + d() diff --git a/docs/test_cases/t20029_sequence.svg b/docs/test_cases/t20029_sequence.svg index efc96c98..097b0f5b 100644 --- a/docs/test_cases/t20029_sequence.svg +++ b/docs/test_cases/t20029_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,60 +9,60 @@ - - - - - - - - - - - + + + + + + + + + + + - - + + tmain() - + tmain() - - + + Encoder<Retrier<ConnectionPool>> - + Encoder<Retrier<ConnectionPool>> - - + + Retrier<ConnectionPool> - + Retrier<ConnectionPool> - - + + ConnectionPool - + ConnectionPool - - + + encode_b64(std::string &&) - + encode_b64(std::string &&) - - - - - - - - + + + + + + + + connect() @@ -73,21 +73,21 @@ alt - + [ send(std::string &&) ] - + encode(std::string &&) - + @@ -97,7 +97,7 @@ - + send(std::string &&) @@ -108,7 +108,7 @@ alt - + [ diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index ea96c7a2..488bc0c0 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,67 +9,67 @@ - - + + A - - + + AA - - + + B - - + + AA - - + + AAA - - + + BBB - - + + BB - - + + AAA - - + + BBB - - + + BB - + A AAA note... - + This is namespace AA in namespace A - + This is namespace AA in namespace B - - - + + + diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg index 1e8ef3c6..0f17e920 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index f42268ce..c90ac142 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,35 @@ - - + + ns1 - - + + ns3 «deprecated» - - + + ns1 - - + + ns2_v1_0_0 - - + + ns2_v0_9_0 «deprecated» - - + + ns2 diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg index 201e039b..1ae63f41 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE - - - - + + + + diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index eb98c86f..34e1730a 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,48 +9,48 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + C - - + + CC - - + + AAA - - + + BBB - - + + CCC diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg index 6434f68d..6baefa85 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + B - - + + A - - + + C - + Top A note. - + diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 983b8383..89f827d2 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. - + diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index a432ea16..eadffcfd 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F diff --git a/docs/test_cases/t30009_package.svg b/docs/test_cases/t30009_package.svg index a4be26e9..acfd0c3a 100644 --- a/docs/test_cases/t30009_package.svg +++ b/docs/test_cases/t30009_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + One - - + + Two - - + + B - - + + D - - + + A - - + + C - - + + A - - + + B - - + + C - - + + D diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 43e2e37b..5604c381 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + yaml-cpp/yaml.h - + This is a lib1 include dir - + This is a t40001_include1.h include file @@ -60,7 +60,7 @@ - - + + diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 48027dcb..d07f7835 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - + src - + lib1 - + lib2 - + include - + lib1 - + lib2 - - + + t40002.cc - - + + lib1.cc - - + + lib2.cc - - + + lib1.h - - + + lib2.h diff --git a/docs/test_cases/t40003_include.svg b/docs/test_cases/t40003_include.svg index 5e9cc5fb..c8c3447c 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + src - + dependants - + dependencies - + include - + dependants - + dependencies - - + + t1.cc - - + + t2.cc - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h From 2092a0e3e6405c10972e50d7ddbe02542440cb1a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 7 Mar 2023 23:03:02 +0100 Subject: [PATCH 07/15] Added diagram templates to config --- src/common/model/enums.cc | 15 +++++++ src/common/model/enums.h | 2 + src/config/config.h | 8 ++++ src/config/yaml_decoders.cc | 43 +++++++++++++++++++ tests/test_config.cc | 45 +++++++++++++++++++- tests/test_config_data/diagram_templates.yml | 39 +++++++++++++++++ 6 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 tests/test_config_data/diagram_templates.yml diff --git a/src/common/model/enums.cc b/src/common/model/enums.cc index feeb740c..7d199d62 100644 --- a/src/common/model/enums.cc +++ b/src/common/model/enums.cc @@ -18,6 +18,7 @@ #include "enums.h" #include +#include namespace clanguml::common::model { @@ -135,4 +136,18 @@ std::string to_string(const diagram_t t) } } +diagram_t from_string(const std::string &s) +{ + if (s == "class") + return diagram_t::kClass; + else if (s == "sequence") + return diagram_t::kSequence; + else if (s == "include") + return diagram_t::kInclude; + else if (s == "package") + return diagram_t::kPackage; + else + throw std::runtime_error{"Invalid diagram type: " + s}; +} + } // namespace clanguml::common::model diff --git a/src/common/model/enums.h b/src/common/model/enums.h index 399c812f..3ec183c4 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -80,4 +80,6 @@ std::string to_string(message_t m); std::string to_string(diagram_t r); +diagram_t from_string(const std::string &s); + } // namespace clanguml::common::model diff --git a/src/config/config.h b/src/config/config.h index 942650ff..71e7df42 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -50,6 +50,11 @@ struct plantuml { void append(const plantuml &r); }; +struct diagram_template { + common::model::diagram_t type; + std::string jinja_template; +}; + struct filter { std::vector namespaces; @@ -218,6 +223,9 @@ struct config : public inheritable_diagram_options { "compilation_database_dir", "."}; option output_directory{"output_directory"}; + option> diagram_templates{ + "diagram_templates"}; + std::map> diagrams; }; diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index 23d24ef0..5fa98f11 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -23,6 +23,7 @@ using clanguml::common::model::access_t; using clanguml::common::model::relationship_t; using clanguml::config::class_diagram; using clanguml::config::config; +using clanguml::config::diagram_template; using clanguml::config::filter; using clanguml::config::generate_links_config; using clanguml::config::git_config; @@ -101,6 +102,21 @@ void get_option(const Node &node, } } +template <> +void get_option>( + const Node &node, + clanguml::config::option< + std::map> &option) +{ + if (!node[option.name]) { + return; + } + + option.set( + node[option.name] + .as>()); +} + std::shared_ptr parse_diagram_config(const Node &d) { const auto diagram_type = d["type"].as(); @@ -526,6 +542,31 @@ template <> struct convert { } }; +// +// diagram_template Yaml decoder +// +template <> struct convert { + static bool decode(const Node &node, diagram_template &rhs) + { + assert(node.Type() == NodeType::Map || node.Type() == NodeType::Scalar); + + if (node.Type() == NodeType::Scalar) { + // Check that the template provided as string is at least valid YAML + const auto yaml_node = Load(node.as()); + const auto diagram_type = yaml_node["type"].as(); + rhs.type = clanguml::common::model::from_string(diagram_type); + rhs.jinja_template = Dump(yaml_node); + } + else { + const auto diagram_type = node["type"].as(); + rhs.type = clanguml::common::model::from_string(diagram_type); + rhs.jinja_template = Dump(node); + } + + return true; + } +}; + // // config Yaml decoder // @@ -547,6 +588,8 @@ template <> struct convert { rhs.base_directory.set(node["__parent_path"].as()); get_option(node, rhs.relative_to); + get_option(node, rhs.diagram_templates); + auto diagrams = node["diagrams"]; assert(diagrams.Type() == NodeType::Map); diff --git a/tests/test_config.cc b/tests/test_config.cc index a4f2d946..2759c706 100644 --- a/tests/test_config.cc +++ b/tests/test_config.cc @@ -258,4 +258,47 @@ TEST_CASE("Test config emitters", "[unit-test]") REQUIRE(cfg.diagrams.size() == cfg_emitted.diagrams.size()); std::filesystem::remove(tmp_file); -} \ No newline at end of file +} + +TEST_CASE("Test config diagram_templates", "[unit-test]") +{ + auto cfg = + clanguml::config::load("./test_config_data/diagram_templates.yml"); + + REQUIRE(cfg.diagram_templates().size() == 3); + + REQUIRE(cfg.diagram_templates()["bases_hierarchy_tmpl"].type == + clanguml::common::model::diagram_t::kClass); + REQUIRE(cfg.diagram_templates()["bases_hierarchy_tmpl"].jinja_template == + R"(name: "{{ class_name }}_parents_hierarchy" +type: class +include: + parents: "{{ class_name }}" + namespaces: "{{ namespace_name }}" +relationships: + - inheritance +exclude: + access: [public, protected, private] +plantuml: + before: + - left to right direction)"); + + REQUIRE(cfg.diagram_templates()["children_hierarchy_tmpl"].type == + clanguml::common::model::diagram_t::kClass); + REQUIRE(cfg.diagram_templates()["children_hierarchy_tmpl"].jinja_template == + R"(name: "{{ class_name }}_children_hierarchy" +type: class +include: + subclasses: "{{ class_name }}" + namespaces: "{{ namespace_name }}" +relationships: + - inheritance +exclude: + access: [public, protected, private] +plantuml: + before: + - left to right direction)"); + + REQUIRE(cfg.diagram_templates()["main_sequence_tmpl"].type == + clanguml::common::model::diagram_t::kSequence); +} diff --git a/tests/test_config_data/diagram_templates.yml b/tests/test_config_data/diagram_templates.yml new file mode 100644 index 00000000..5d442233 --- /dev/null +++ b/tests/test_config_data/diagram_templates.yml @@ -0,0 +1,39 @@ +compilation_database_dir: debug +output_directory: output + +diagram_templates: + bases_hierarchy_tmpl: + name: '{{ class_name }}_parents_hierarchy' + type: class + include: + parents: '{{ class_name }}' + namespaces: '{{ namespace_name }}' + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction + children_hierarchy_tmpl: | + name: '{{ class_name }}_children_hierarchy' + type: class + include: + subclasses: '{{ class_name }}' + namespaces: '{{ namespace_name }}' + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction + main_sequence_tmpl: | + name: main_sequence_diargam + type: sequence + glob: [ {{ }} ] + start_from: + - function: 'main(int,const char**)' +diagrams: + diagram1: + type: class \ No newline at end of file From 41537c540129967e6364eb0719f114781b5fb11b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 8 Mar 2023 01:25:20 +0100 Subject: [PATCH 08/15] Implement CLI options for adding diagrams to config from templates --- src/config/yaml_decoders.cc | 12 +- src/main.cc | 119 ++++++++++++++++++- tests/test_config.cc | 48 ++++---- tests/test_config_data/diagram_templates.yml | 58 ++++----- 4 files changed, 180 insertions(+), 57 deletions(-) diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index 5fa98f11..d394b35d 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -553,12 +553,20 @@ template <> struct convert { if (node.Type() == NodeType::Scalar) { // Check that the template provided as string is at least valid YAML const auto yaml_node = Load(node.as()); - const auto diagram_type = yaml_node["type"].as(); + const auto template_root_it = yaml_node.begin(); + const auto diagram_name_template = + template_root_it->first.as(); + const auto diagram_type = + template_root_it->second["type"].as(); rhs.type = clanguml::common::model::from_string(diagram_type); rhs.jinja_template = Dump(yaml_node); } else { - const auto diagram_type = node["type"].as(); + const auto template_root_it = node.begin(); + const auto diagram_name_template = + template_root_it->first.as(); + const auto diagram_type = + template_root_it->second["type"].as(); rhs.type = clanguml::common::model::from_string(diagram_type); rhs.jinja_template = Dump(node); } diff --git a/src/main.cc b/src/main.cc index 8c730cc0..d5824101 100644 --- a/src/main.cc +++ b/src/main.cc @@ -62,6 +62,14 @@ void print_version(); */ void print_diagrams_list(const clanguml::config::config &cfg); +/** + * Print list of available diagram templates, including their names + * and types. + * + * @param cfg + */ +void print_diagram_templates(const clanguml::config::config &cfg); + /** * Print effective config after loading and setting default values. * @@ -87,6 +95,18 @@ int create_config_file(); int add_config_diagram(clanguml::common::model::diagram_t type, const std::string &config_file_path, const std::string &name); +/** + * Add diagram based on template + * @param config_file_path + * @param cfg + * @param template_name + * @param template_variables + * @return + */ +int add_config_diagram_from_template(const std::string &config_file_path, + const config::config &cfg, const std::string &template_name, + const std::vector &template_variables); + /** * Check if diagram output directory exists, if not create it * @@ -172,8 +192,11 @@ int main(int argc, const char *argv[]) std::optional add_sequence_diagram; std::optional add_package_diagram; std::optional add_include_diagram; + std::optional add_diagram_from_template; bool dump_config{false}; std::optional paths_relative_to_pwd{}; + std::vector template_variables{}; + bool list_templates{false}; app.add_option("-c,--config", config_path, "Location of configuration file, when '-' read from stdin"); @@ -200,6 +223,12 @@ int main(int argc, const char *argv[]) "Add package diagram config"); app.add_option("--add-include-diagram", add_include_diagram, "Add include diagram config"); + app.add_option("--add-diagram-from-template", add_diagram_from_template, + "Add diagram config based on diagram template"); + app.add_option("--template-variable", template_variables, + "Specify a value for a template variable"); + app.add_flag("--list-templates", list_templates, + "List all available diagram templates"); app.add_flag( "--dump-config", dump_config, "Print effective config to stdout"); app.add_flag("--paths-relative-to-pwd", paths_relative_to_pwd, @@ -221,8 +250,8 @@ int main(int argc, const char *argv[]) } if ((config_path == "-") && - (initialize || add_class_diagram.has_value() || - add_sequence_diagram.has_value() || + (initialize || add_diagram_from_template || + add_class_diagram.has_value() || add_sequence_diagram.has_value() || add_package_diagram.has_value() || add_include_diagram.has_value())) { @@ -276,6 +305,16 @@ int main(int argc, const char *argv[]) return 0; } + if (list_templates) { + print_diagram_templates(config); + return 0; + } + + if (config_path != "-" && add_diagram_from_template) { + return add_config_diagram_from_template(config_path, config, + add_diagram_from_template.value(), template_variables); + } + LOG_INFO("Loaded clang-uml config from {}", config_path); // @@ -539,6 +578,23 @@ void print_diagrams_list(const clanguml::config::config &cfg) } } +void print_diagram_templates(const clanguml::config::config &cfg) +{ + using std::cout; + + if (!cfg.diagram_templates) { + cout << "No diagram templates are defined in the config file\n"; + return; + } + + cout << "The following diagram templates are available:\n"; + for (const auto &[name, diagram_template] : cfg.diagram_templates()) { + cout << " - " << name << " [" << to_string(diagram_template.type) + << "]"; + cout << '\n'; + } +} + int create_config_file() { namespace fs = std::filesystem; @@ -669,6 +725,65 @@ int add_config_diagram(clanguml::common::model::diagram_t type, return 0; } +int add_config_diagram_from_template(const std::string &config_file_path, + const config::config &cfg, const std::string &template_name, + const std::vector &template_variables) +{ + if (!cfg.diagram_templates || + !(cfg.diagram_templates().find(template_name) != + cfg.diagram_templates().end())) { + std::cerr << "ERROR: No such diagram template: " << template_name + << "\n"; + return 1; + } + + // First, try to render the template using inja and create a YAML node from + // it + inja::json ctx; + for (const auto &tv : template_variables) { + const auto var = util::split(tv, "="); + if (var.size() != 2) { + std::cerr << "ERROR: Invalid template variable " << tv << "\n"; + return 1; + } + + ctx[var.at(0)] = var.at(1); + } + + auto diagram_template_str = + cfg.diagram_templates().at(template_name).jinja_template; + + auto diagram_str = inja::render(diagram_template_str, ctx); + + auto diagram_node = YAML::Load(diagram_str); + + namespace fs = std::filesystem; + + fs::path config_file{config_file_path}; + + if (!fs::exists(config_file)) { + std::cerr << "ERROR: " << config_file_path << " file doesn't exists\n"; + return 1; + } + + YAML::Node doc = YAML::LoadFile(config_file.string()); + + const auto diagram_name = diagram_node.begin()->first.as(); + doc["diagrams"][diagram_name] = diagram_node.begin()->second; + + YAML::Emitter out; + out.SetIndent(2); + + out << doc; + out << YAML::Newline; + + std::ofstream ofs(config_file); + ofs << out.c_str(); + ofs.close(); + + return 0; +} + void print_config(const clanguml::config::config &cfg) { YAML::Emitter out; diff --git a/tests/test_config.cc b/tests/test_config.cc index 2759c706..a3f92441 100644 --- a/tests/test_config.cc +++ b/tests/test_config.cc @@ -270,34 +270,34 @@ TEST_CASE("Test config diagram_templates", "[unit-test]") REQUIRE(cfg.diagram_templates()["bases_hierarchy_tmpl"].type == clanguml::common::model::diagram_t::kClass); REQUIRE(cfg.diagram_templates()["bases_hierarchy_tmpl"].jinja_template == - R"(name: "{{ class_name }}_parents_hierarchy" -type: class -include: - parents: "{{ class_name }}" - namespaces: "{{ namespace_name }}" -relationships: - - inheritance -exclude: - access: [public, protected, private] -plantuml: - before: - - left to right direction)"); + R"("{{ class_name }}_parents_hierarchy": + type: class + include: + parents: "{{ class_name }}" + namespaces: "{{ namespace_name }}" + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction)"); REQUIRE(cfg.diagram_templates()["children_hierarchy_tmpl"].type == clanguml::common::model::diagram_t::kClass); REQUIRE(cfg.diagram_templates()["children_hierarchy_tmpl"].jinja_template == - R"(name: "{{ class_name }}_children_hierarchy" -type: class -include: - subclasses: "{{ class_name }}" - namespaces: "{{ namespace_name }}" -relationships: - - inheritance -exclude: - access: [public, protected, private] -plantuml: - before: - - left to right direction)"); + R"("{{ class_name }}_children_hierarchy": + type: class + include: + subclasses: "{{ class_name }}" + namespaces: "{{ namespace_name }}" + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction)"); REQUIRE(cfg.diagram_templates()["main_sequence_tmpl"].type == clanguml::common::model::diagram_t::kSequence); diff --git a/tests/test_config_data/diagram_templates.yml b/tests/test_config_data/diagram_templates.yml index 5d442233..3c877b88 100644 --- a/tests/test_config_data/diagram_templates.yml +++ b/tests/test_config_data/diagram_templates.yml @@ -3,37 +3,37 @@ output_directory: output diagram_templates: bases_hierarchy_tmpl: - name: '{{ class_name }}_parents_hierarchy' - type: class - include: - parents: '{{ class_name }}' - namespaces: '{{ namespace_name }}' - relationships: - - inheritance - exclude: - access: [public, protected, private] - plantuml: - before: - - left to right direction + '{{ class_name }}_parents_hierarchy': + type: class + include: + parents: '{{ class_name }}' + namespaces: '{{ namespace_name }}' + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction children_hierarchy_tmpl: | - name: '{{ class_name }}_children_hierarchy' - type: class - include: - subclasses: '{{ class_name }}' - namespaces: '{{ namespace_name }}' - relationships: - - inheritance - exclude: - access: [public, protected, private] - plantuml: - before: - - left to right direction + '{{ class_name }}_children_hierarchy': + type: class + include: + subclasses: '{{ class_name }}' + namespaces: '{{ namespace_name }}' + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction main_sequence_tmpl: | - name: main_sequence_diargam - type: sequence - glob: [ {{ }} ] - start_from: - - function: 'main(int,const char**)' + main_sequence_diagram: + type: sequence + glob: [ {{ glob }} ] + start_from: + - function: 'main(int,const char**)' diagrams: diagram1: type: class \ No newline at end of file From f1c125bf32e1aaffe83b9cd12e4200e1c39bc7a2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Mar 2023 18:59:53 +0100 Subject: [PATCH 09/15] Refactored command line handling --- .clang-uml | 16 +- src/cli/cli_handler.cc | 561 +++++++++++++++++++ src/cli/cli_handler.h | 153 +++++ src/config/config.cc | 1 + src/config/config.h | 5 + src/config/diagram_templates.cc | 93 +++ src/config/diagram_templates.h | 28 + src/config/yaml_decoders.cc | 93 ++- src/main.cc | 506 +---------------- src/util/util.cc | 21 - src/util/util.h | 37 +- tests/CMakeLists.txt | 1 + tests/test_cases.cc | 14 +- tests/test_cli_handler.cc | 74 +++ tests/test_config.cc | 40 +- tests/test_config_data/diagram_templates.yml | 31 +- tests/test_config_data/simple.yml | 1 - 17 files changed, 1066 insertions(+), 609 deletions(-) create mode 100644 src/cli/cli_handler.cc create mode 100644 src/cli/cli_handler.h create mode 100644 src/config/diagram_templates.cc create mode 100644 src/config/diagram_templates.h create mode 100644 tests/test_cli_handler.cc diff --git a/.clang-uml b/.clang-uml index f515256c..5923c9df 100644 --- a/.clang-uml +++ b/.clang-uml @@ -1,8 +1,8 @@ compilation_database_dir: debug output_directory: docs/diagrams generate_links: - link: 'https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }}' - tooltip: '{% if existsIn(element, "comment") and existsIn(element.comment, "brief") %}{{ abbrv(trim(replace(element.comment.brief.0, "\n+", " ")), 256) }}{% else %}{{ element.name }}{% endif %}' + link: https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }} + tooltip: "{% if existsIn(element, \"comment\") and existsIn(element.comment, \"brief\") %}{{ abbrv(trim(replace(element.comment.brief.0, \"\\n+\", \" \")), 256) }}{% else %}{{ element.name }}{% endif %}" diagrams: main_package: include!: uml/main_package_diagram.yml @@ -26,3 +26,15 @@ diagrams: include!: uml/package_model_class_diagram.yml include_graph: include!: uml/include_diagram.yml + include3_diagram_parents_hierarchy: + type: class + include: + parents: [clanguml::config::include_diagram] + namespaces: [clanguml] + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction \ No newline at end of file diff --git a/src/cli/cli_handler.cc b/src/cli/cli_handler.cc new file mode 100644 index 00000000..18820674 --- /dev/null +++ b/src/cli/cli_handler.cc @@ -0,0 +1,561 @@ +/** + * src/options/cli_options.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "cli_handler.h" + +#include "class_diagram/generators/plantuml/class_diagram_generator.h" +#include "include_diagram/generators/plantuml/include_diagram_generator.h" +#include "package_diagram/generators/plantuml/package_diagram_generator.h" +#include "sequence_diagram/generators/plantuml/sequence_diagram_generator.h" +#include "util/util.h" +#include "version.h" + +#include +#include + +namespace clanguml::cli { +cli_handler::cli_handler( + std::ostream &ostr, std::shared_ptr logger) + : ostr_{ostr} + , logger_{std::move(logger)} +{ +} + +void cli_handler::setup_logging() +{ + spdlog::drop("clanguml-logger"); + spdlog::register_logger(logger_); + + logger_->set_pattern("[%^%l%^] [tid %t] %v"); + + if (verbose == 0) { + logger_->set_level(spdlog::level::err); + } + else if (verbose == 1) { + logger_->set_level(spdlog::level::info); + } + else if (verbose == 2) { + logger_->set_level(spdlog::level::debug); + } + else { + logger_->set_level(spdlog::level::trace); + } +} + +cli_flow_t cli_handler::parse(int argc, const char *argv[]) +{ + app.add_option("-c,--config", config_path, + "Location of configuration file, when '-' read from stdin"); + app.add_option("-d,--compile-database", compilation_database_dir, + "Location of compilation database directory"); + app.add_option("-n,--diagram-name", diagram_names, + "List of diagram names to generate"); + app.add_option("-o,--output-directory", output_directory, + "Override output directory specified in config file"); + app.add_option("-t,--thread-count", thread_count, + "Thread pool size (0 = hardware concurrency)"); + app.add_flag("-V,--version", show_version, "Print version and exit"); + app.add_flag("-v,--verbose", verbose, + "Verbose logging (use multiple times to increase - e.g. -vvv)"); + app.add_flag("-q,--quiet", quiet, "Minimal logging"); + app.add_flag("-l,--list-diagrams", list_diagrams, + "Print list of diagrams defined in the config file"); + app.add_flag("--init", initialize, "Initialize example config file"); + app.add_option( + "--add-class-diagram", add_class_diagram, "Add class diagram config"); + app.add_option("--add-sequence-diagram", add_sequence_diagram, + "Add sequence diagram config"); + app.add_option("--add-package-diagram", add_package_diagram, + "Add package diagram config"); + app.add_option("--add-include-diagram", add_include_diagram, + "Add include diagram config"); + app.add_option("--add-diagram-from-template", add_diagram_from_template, + "Add diagram config based on diagram template"); + app.add_option("--template-var", template_variables, + "Specify a value for a template variable"); + app.add_flag("--list-templates", list_templates, + "List all available diagram templates"); + app.add_option("--show-template", show_template, + "Show specific diagram template definition"); + app.add_flag( + "--dump-config", dump_config, "Print effective config to stdout"); + app.add_flag("--paths-relative-to-pwd", paths_relative_to_pwd, + "If true, all paths in configuration files are relative to the $PWD " + "instead of actual location of `.clang-uml` file."); + + try { + app.parse(argc, argv); + } + catch (const CLI::Success &e) { + return cli_flow_t::kExit; + } + catch (const CLI::ParseError &e) { + exit(app.exit(e)); + } + + if (quiet || dump_config) + verbose = 0; + else + verbose++; + + return cli_flow_t::kContinue; +} + +cli_flow_t cli_handler::handle_options(int argc, const char *argv[]) +{ + auto res = parse(argc, argv); + + if (res != cli_flow_t::kContinue) + return res; + + setup_logging(); + + res = handle_pre_config_options(); + + if (res != cli_flow_t::kContinue) + return res; + + res = load_config(); + + if (res != cli_flow_t::kContinue) + return res; + + res = handle_post_config_options(); + + return res; +} + +cli_flow_t cli_handler::handle_pre_config_options() +{ + if (show_version) { + return print_version(); + } + + if ((config_path == "-") && + (initialize || add_diagram_from_template || + add_class_diagram.has_value() || add_sequence_diagram.has_value() || + add_package_diagram.has_value() || + add_include_diagram.has_value())) { + + LOG_ERROR( + "ERROR: Cannot add a diagram config to configuration from stdin"); + + return cli_flow_t::kError; + } + + if (initialize) { + return create_config_file(); + } + + if (config_path != "-") { + if (add_class_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kClass, config_path, + *add_class_diagram); + } + + if (add_sequence_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kSequence, config_path, + *add_sequence_diagram); + } + + if (add_package_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kPackage, config_path, + *add_package_diagram); + } + + if (add_include_diagram) { + return add_config_diagram( + clanguml::common::model::diagram_t::kInclude, config_path, + *add_include_diagram); + } + } + + return cli_flow_t::kContinue; +} + +cli_flow_t cli_handler::load_config() +{ + try { + config = clanguml::config::load(config_path, paths_relative_to_pwd); + return cli_flow_t::kContinue; + } + catch (std::runtime_error &e) { + LOG_ERROR(e.what()); + } + + return cli_flow_t::kError; +} + +cli_flow_t cli_handler::handle_post_config_options() +{ + if (dump_config) { + return print_config(); + } + + if (list_diagrams) { + return print_diagrams_list(); + } + + if (list_templates) { + return print_diagram_templates(); + } + + if (show_template) { + return print_diagram_template(show_template.value()); + } + + if (config_path != "-" && add_diagram_from_template) { + return add_config_diagram_from_template( + config_path, add_diagram_from_template.value(), template_variables); + } + + LOG_INFO("Loaded clang-uml config from {}", config_path); + + // + // Override selected config options from command line + // + if (compilation_database_dir) { + config.compilation_database_dir.set( + util::ensure_path_is_absolute(compilation_database_dir.value()) + .string()); + } + + effective_output_directory = config.output_directory(); + + // Override the output directory from the config + // with the value from the command line if any + if (output_directory) + effective_output_directory = output_directory.value(); + + if (output_directory) { + config.output_directory.set( + util::ensure_path_is_absolute(output_directory.value()).string()); + } + + LOG_INFO("Loading compilation database from {} directory", + config.compilation_database_dir()); + + if (!ensure_output_directory_exists(effective_output_directory)) + return cli_flow_t::kError; + + return cli_flow_t::kContinue; +} + +cli_flow_t cli_handler::print_version() +{ + constexpr auto kLLVMBackendPackageStringLength{5}; + ostr_ << "clang-uml " << clanguml::version::CLANG_UML_VERSION << '\n'; + ostr_ << "Copyright (C) 2021-2023 Bartek Kryza " << '\n'; + ostr_ << "Built against LLVM/Clang libraries version: " + << std::string{BACKEND_PACKAGE_STRING}.substr( + kLLVMBackendPackageStringLength) + << std::endl; + ostr_ << "Using LLVM/Clang libraries version: " + << clang::getClangFullVersion() << std::endl; + + return cli_flow_t::kExit; +} + +bool cli_handler::ensure_output_directory_exists(const std::string &dir) +{ + namespace fs = std::filesystem; + using std::cout; + + fs::path output_dir{dir}; + + if (fs::exists(output_dir) && !fs::is_directory(output_dir)) { + cout << "ERROR: " << dir << " is not a directory...\n"; + return false; + } + + if (!fs::exists(output_dir)) { + return fs::create_directories(output_dir); + } + + return true; +} + +cli_flow_t cli_handler::print_diagrams_list() +{ + using std::cout; + + ostr_ << "The following diagrams are defined in the config file:\n"; + for (const auto &[name, diagram] : config.diagrams) { + ostr_ << " - " << name << " [" << to_string(diagram->type()) << "]"; + ostr_ << '\n'; + } + + return cli_flow_t::kExit; +} + +cli_flow_t cli_handler::print_diagram_templates() +{ + using std::cout; + + if (!config.diagram_templates) { + ostr_ << "No diagram templates are defined in the config file\n"; + return cli_flow_t::kExit; + } + + ostr_ << "The following diagram templates are available:\n"; + for (const auto &[name, diagram_template] : config.diagram_templates()) { + ostr_ << " - " << name << " [" << to_string(diagram_template.type) + << "]"; + if (!diagram_template.description.empty()) + ostr_ << ": " << diagram_template.description; + ostr_ << '\n'; + } + + return cli_flow_t::kExit; +} + +cli_flow_t cli_handler::print_diagram_template(const std::string &template_name) +{ + if (!config.diagram_templates || + config.diagram_templates().count(template_name) == 0) { + ostr_ << "No such diagram template: " << template_name << "\n"; + return cli_flow_t::kError; + } + + for (const auto &[name, diagram_template] : config.diagram_templates()) { + if (template_name == name) { + ostr_ << diagram_template.jinja_template << "\n"; + return cli_flow_t::kExit; + } + } + + return cli_flow_t::kError; +} + +cli_flow_t cli_handler::create_config_file() +{ + namespace fs = std::filesystem; + + fs::path config_file{"./.clang-uml"}; + + if (fs::exists(config_file)) { + ostr_ << "ERROR: .clang-uml file already exists\n"; + return cli_flow_t::kError; + } + + YAML::Emitter out; + out.SetIndent(2); + out << YAML::BeginMap; + out << YAML::Comment("Change to directory where compile_commands.json is"); + out << YAML::Key << "compilation_database_dir" << YAML::Value << "."; + out << YAML::Newline + << YAML::Comment("Change to directory where diagram should be written"); + out << YAML::Key << "output_directory" << YAML::Value << "docs/diagrams"; + out << YAML::Key << "diagrams" << YAML::Value; + out << YAML::BeginMap; + out << YAML::Key << "example_class_diagram" << YAML::Value; + out << YAML::BeginMap; + out << YAML::Key << "type" << YAML::Value << "class"; + out << YAML::Key << "glob" << YAML::Value; + out << YAML::BeginSeq << "src/*.cpp" << YAML::EndSeq; + out << YAML::Key << "using_namespace" << YAML::Value; + out << YAML::BeginSeq << "myproject" << YAML::EndSeq; + out << YAML::Key << "include"; + out << YAML::BeginMap; + out << YAML::Key << "namespaces"; + out << YAML::BeginSeq << "myproject" << YAML::EndSeq; + out << YAML::EndMap; + out << YAML::Key << "exclude"; + out << YAML::BeginMap; + out << YAML::Key << "namespaces"; + out << YAML::BeginSeq << "myproject::detail" << YAML::EndSeq; + out << YAML::EndMap; + out << YAML::EndMap; + out << YAML::EndMap; + out << YAML::EndMap; + out << YAML::Newline; + + std::ofstream ofs(config_file); + ofs << out.c_str(); + ofs.close(); + + return cli_flow_t::kExit; +} + +cli_flow_t cli_handler::add_config_diagram( + clanguml::common::model::diagram_t type, + const std::string &config_file_path, const std::string &name) +{ + namespace fs = std::filesystem; + + fs::path config_file{config_file_path}; + + if (!fs::exists(config_file)) { + std::cerr << "ERROR: " << config_file_path << " file doesn't exists\n"; + return cli_flow_t::kError; + } + + YAML::Node doc = YAML::LoadFile(config_file.string()); + + for (YAML::const_iterator it = doc["diagrams"].begin(); + it != doc["diagrams"].end(); ++it) { + if (it->first.as() == name) { + std::cerr << "ERROR: " << config_file_path + << " file already contains '" << name << "' diagram"; + return cli_flow_t::kError; + } + } + + if (type == clanguml::common::model::diagram_t::kClass) { + doc["diagrams"][name]["type"] = "class"; + doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; + doc["diagrams"][name]["using_namespace"] = + std::vector{{"myproject"}}; + doc["diagrams"][name]["include"]["namespaces"] = + std::vector{{"myproject"}}; + doc["diagrams"][name]["exclude"]["namespaces"] = + std::vector{{"myproject::detail"}}; + } + else if (type == clanguml::common::model::diagram_t::kSequence) { + doc["diagrams"][name]["type"] = "sequence"; + doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; + doc["diagrams"][name]["combine_free_functions_into_file_participants"] = + true; + doc["diagrams"][name]["using_namespace"] = + std::vector{{"myproject"}}; + doc["diagrams"][name]["include"]["paths"] = + std::vector{{"src"}}; + doc["diagrams"][name]["exclude"]["namespaces"] = + std::vector{{"myproject::detail"}}; + doc["diagrams"][name]["start_from"] = + std::vector>{ + {{"function", "main(int,const char **)"}}}; + } + else if (type == clanguml::common::model::diagram_t::kPackage) { + doc["diagrams"][name]["type"] = "package"; + doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; + doc["diagrams"][name]["using_namespace"] = + std::vector{{"myproject"}}; + doc["diagrams"][name]["include"]["namespaces"] = + std::vector{{"myproject"}}; + doc["diagrams"][name]["exclude"]["namespaces"] = + std::vector{{"myproject::detail"}}; + } + else if (type == clanguml::common::model::diagram_t::kInclude) { + doc["diagrams"][name]["type"] = "include"; + doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; + doc["diagrams"][name]["relative_to"] = "."; + doc["diagrams"][name]["include"]["paths"] = + std::vector{{"src"}}; + } + + YAML::Emitter out; + out.SetIndent(2); + + out << doc; + out << YAML::Newline; + + std::ofstream ofs(config_file); + ofs << out.c_str(); + ofs.close(); + + return cli_flow_t::kExit; +} + +cli_flow_t cli_handler::add_config_diagram_from_template( + const std::string &config_file_path, const std::string &template_name, + const std::vector &template_variables) +{ + if (!config.diagram_templates || + !(config.diagram_templates().find(template_name) != + config.diagram_templates().end())) { + std::cerr << "ERROR: No such diagram template: " << template_name + << "\n"; + return cli_flow_t::kError; + } + + // First, try to render the template using inja and create a YAML node from + // it + inja::json ctx; + for (const auto &tv : template_variables) { + const auto var = util::split(tv, "="); + if (var.size() != 2) { + std::cerr << "ERROR: Invalid template variable " << tv << "\n"; + return cli_flow_t::kError; + } + + ctx[var.at(0)] = var.at(1); + } + + auto diagram_template_str = + config.diagram_templates().at(template_name).jinja_template; + + YAML::Node diagram_node; + + try { + auto diagram_str = inja::render(diagram_template_str, ctx); + diagram_node = YAML::Load(diagram_str); + } + catch (inja::InjaError &e) { + std::cerr << "ERROR: Failed to generate diagram template '" + << template_name << "': " << e.what() << "\n"; + return cli_flow_t::kError; + } + catch (YAML::Exception &e) { + std::cerr << "ERROR: Rendering diagram template '" << template_name + << "' resulted in invalid YAML: " << e.what() << "\n"; + return cli_flow_t::kError; + } + + namespace fs = std::filesystem; + + fs::path config_file{config_file_path}; + + if (!fs::exists(config_file)) { + std::cerr << "ERROR: " << config_file_path << " file doesn't exists\n"; + return cli_flow_t::kError; + } + + YAML::Node doc = YAML::LoadFile(config_file.string()); + + const auto diagram_name = diagram_node.begin()->first.as(); + doc["diagrams"][diagram_name] = diagram_node.begin()->second; + + YAML::Emitter out; + out.SetIndent(2); + + out << doc; + out << YAML::Newline; + + std::ofstream ofs(config_file); + ofs << out.c_str(); + ofs.close(); + + return cli_flow_t::kExit; +} + +cli_flow_t cli_handler::print_config() +{ + YAML::Emitter out; + out.SetIndent(2); + + out << config; + out << YAML::Newline; + + ostr_ << out.c_str(); + + return cli_flow_t::kExit; +} +} // namespace clanguml::options \ No newline at end of file diff --git a/src/cli/cli_handler.h b/src/cli/cli_handler.h new file mode 100644 index 00000000..11633087 --- /dev/null +++ b/src/cli/cli_handler.h @@ -0,0 +1,153 @@ +/** + * src/options/cli_options.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "common/model/enums.h" +#include "config/config.h" + +#include + +#include + +namespace clanguml::cli { + +enum class cli_flow_t { kExit, kError, kContinue }; + +class cli_handler { +public: + cli_handler(std::ostream &ostr = std::cout, + std::shared_ptr logger = spdlog::stdout_color_mt( + "clanguml-logger", spdlog::color_mode::automatic)); + + /** + * Main CLI handling method. + * + * @param argc + * @param argv + * @return + */ + cli_flow_t handle_options(int argc, const char *argv[]); + + /** + * Print the program version and basic information + */ + cli_flow_t print_version(); + + /** + * Print list of diagrams available in the configuration file + */ + cli_flow_t print_diagrams_list(); + + /** + * Print list of available diagram templates, including their names + * and types. + */ + cli_flow_t print_diagram_templates(); + + /** + * Print definition of a specific diagram template. + * + * @param template_name + * @return + */ + cli_flow_t print_diagram_template(const std::string &template_name); + + /** + * Print effective config after loading and setting default values. + */ + cli_flow_t print_config(); + + /** + * Generate sample configuration file and exit. + * + * @return 0 on success or error code + */ + cli_flow_t create_config_file(); + + /** + * Add example diagram of given type to the config file. + * + * @param type Type of the sample diagram to add + * @param config_file_path Path to the config file + * @param name Name of the new diagram + * @return 0 on success or error code + */ + cli_flow_t add_config_diagram(clanguml::common::model::diagram_t type, + const std::string &config_file_path, const std::string &name); + + /** + * Add diagram based on template + * + * @param config_file_path + * @param template_name + * @param template_variables + * @return + */ + cli_flow_t add_config_diagram_from_template( + const std::string &config_file_path, const std::string &template_name, + const std::vector &template_variables); + + /** + * Check if diagram output directory exists, if not create it + * + * @param dir Path to the output directory + * @return True if directory exists or has been created + */ + bool ensure_output_directory_exists(const std::string &dir); + + std::string config_path{".clang-uml"}; + std::optional compilation_database_dir{}; + std::vector diagram_names{}; + std::optional output_directory{}; + std::string effective_output_directory{}; + unsigned int thread_count{}; + bool show_version{false}; + int verbose{}; + bool list_diagrams{false}; + bool quiet{false}; + bool initialize{false}; + std::optional add_class_diagram; + std::optional add_sequence_diagram; + std::optional add_package_diagram; + std::optional add_include_diagram; + std::optional add_diagram_from_template; + bool dump_config{false}; + std::optional paths_relative_to_pwd{}; + std::vector template_variables{}; + bool list_templates{false}; + std::optional show_template; + + clanguml::config::config config; + +private: + cli_flow_t parse(int argc, const char *argv[]); + + cli_flow_t handle_pre_config_options(); + + cli_flow_t load_config(); + + cli_flow_t handle_post_config_options(); + + void setup_logging(); + + std::ostream &ostr_; + std::shared_ptr logger_; + CLI::App app{"Clang-based UML diagram generator for C++"}; +}; + +} // namespace clanguml::options \ No newline at end of file diff --git a/src/config/config.cc b/src/config/config.cc index 21aebe84..7e2190ca 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -17,6 +17,7 @@ */ #include "config.h" +#include "diagram_templates.h" #include "glob/glob.hpp" #include diff --git a/src/config/config.h b/src/config/config.h index 71e7df42..f3a147bd 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -51,6 +51,7 @@ struct plantuml { }; struct diagram_template { + std::string description; common::model::diagram_t type; std::string jinja_template; }; @@ -227,6 +228,8 @@ struct config : public inheritable_diagram_options { "diagram_templates"}; std::map> diagrams; + + void initialize_diagram_templates(); }; // @@ -287,6 +290,8 @@ YAML::Emitter &operator<<(YAML::Emitter &out, const option &o) config load(const std::string &config_file, std::optional paths_relative_to_pwd = {}); + +config load_plain(const std::string &config_file); } // namespace config namespace common::model { diff --git a/src/config/diagram_templates.cc b/src/config/diagram_templates.cc new file mode 100644 index 00000000..1293eebe --- /dev/null +++ b/src/config/diagram_templates.cc @@ -0,0 +1,93 @@ +/** + * src/config/diagram_templates.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "diagram_templates.h" + +namespace clanguml { +namespace config { + +const std::string &get_predefined_diagram_templates() +{ + static const std::string predefined_diagram_templates = + R"(# Predefined diagram templates +parents_hierarchy_tmpl: + description: Generate class parents inheritance diagram + type: class + template: | + {{ diagram_name }}: + type: class + {% if exists("glob") %} + glob: [{{ glob }}] + {% endif %} + {% if exists("using_namespace") %} + using_namespace: {{ using_namespace }} + {% endif %} + include: + parents: [{{ class_name }}] + namespaces: [{{ namespace_names }}] + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction +subclass_hierarchy_tmpl: + description: Generate class children inheritance diagram + type: class + template: | + {{ diagram_name }}: + type: class + {% if exists("glob") %} + glob: [{{ glob }}] + {% endif %} + {% if exists("using_namespace") %} + using_namespace: {{ using_namespace }} + {% endif %} + include: + parents: [{{ class_name }}] + namespaces: [{{ namespace_name }}] + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction +class_context_tmpl: + description: Generate class context diagram + type: class + template: | + "{{ diagram_name }}": + type: class + {% if exists("glob") %} + glob: [{{ glob }}] + {% endif %} + {% if exists("using_namespace") %} + using_namespace: {{ using_namespace }} + {% endif %} + include: + context: [{{ class_name }}] + namespaces: [{{ namespace_name }}] +)"; + + return predefined_diagram_templates; +} + +} // namespace config +} // namespace clanguml diff --git a/src/config/diagram_templates.h b/src/config/diagram_templates.h new file mode 100644 index 00000000..a3717e66 --- /dev/null +++ b/src/config/diagram_templates.h @@ -0,0 +1,28 @@ +/** + * src/config/diagram_templates.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include + +namespace clanguml { +namespace config { + +const std::string &get_predefined_diagram_templates(); + +} // namespace config +} // namespace clanguml diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index d394b35d..52c7befb 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -17,6 +17,7 @@ */ #include "config.h" +#include "diagram_templates.h" namespace YAML { using clanguml::common::model::access_t; @@ -112,9 +113,24 @@ void get_option>( return; } - option.set( - node[option.name] - .as>()); + if (node[option.name].IsMap() && node[option.name]["include!"]) { + auto parent_path = node["__parent_path"].as(); + + // Load templates from file + auto include_path = std::filesystem::path{parent_path}; + include_path /= node[option.name]["include!"].as(); + + YAML::Node included_node = YAML::LoadFile(include_path.string()); + + // diagram_config = parse_diagram_config(included_node); + option.set( + included_node.as< + std::map>()); + } + else + option.set(node[option.name] + .as>()); } std::shared_ptr parse_diagram_config(const Node &d) @@ -548,28 +564,12 @@ template <> struct convert { template <> struct convert { static bool decode(const Node &node, diagram_template &rhs) { - assert(node.Type() == NodeType::Map || node.Type() == NodeType::Scalar); + assert(node.Type() == NodeType::Map); - if (node.Type() == NodeType::Scalar) { - // Check that the template provided as string is at least valid YAML - const auto yaml_node = Load(node.as()); - const auto template_root_it = yaml_node.begin(); - const auto diagram_name_template = - template_root_it->first.as(); - const auto diagram_type = - template_root_it->second["type"].as(); - rhs.type = clanguml::common::model::from_string(diagram_type); - rhs.jinja_template = Dump(yaml_node); - } - else { - const auto template_root_it = node.begin(); - const auto diagram_name_template = - template_root_it->first.as(); - const auto diagram_type = - template_root_it->second["type"].as(); - rhs.type = clanguml::common::model::from_string(diagram_type); - rhs.jinja_template = Dump(node); - } + rhs.type = clanguml::common::model::from_string( + node["type"].as()); + rhs.jinja_template = node["template"].as(); + rhs.description = node["description"].as(); return true; } @@ -611,10 +611,11 @@ template <> struct convert { auto include_path = std::filesystem::path{parent_path}; include_path /= d.second["include!"].as(); - YAML::Node node = YAML::LoadFile(include_path.string()); - node.force_insert("__parent_path", parent_path); + YAML::Node included_node = + YAML::LoadFile(include_path.string()); + included_node.force_insert("__parent_path", parent_path); - diagram_config = parse_diagram_config(node); + diagram_config = parse_diagram_config(included_node); } else { d.second.force_insert("__parent_path", parent_path); @@ -638,6 +639,20 @@ template <> struct convert { namespace clanguml::config { +void config::initialize_diagram_templates() +{ + const auto &predefined_templates_str = get_predefined_diagram_templates(); + + YAML::Node predefined_templates = YAML::Load(predefined_templates_str); + + if (!diagram_templates) { + diagram_templates.set({}); + } + + diagram_templates().merge( + predefined_templates.as>()); +} + namespace { void resolve_option_path(YAML::Node &doc, const std::string &option) { @@ -729,6 +744,30 @@ config load( doc["git"] = git_config; } + auto d = doc.as(); + + d.initialize_diagram_templates(); + + return d; + } + catch (YAML::BadFile &e) { + throw std::runtime_error(fmt::format( + "Could not open config file {}: {}", config_file, e.what())); + } + catch (YAML::Exception &e) { + throw std::runtime_error(fmt::format( + "Cannot parse YAML file {}: {}", config_file, e.what())); + } +} + +config load_plain(const std::string &config_file) +{ + try { + YAML::Node doc; + std::filesystem::path config_file_path{}; + + doc = YAML::LoadFile(config_file); + auto d = doc.as(); return d; } diff --git a/src/main.cc b/src/main.cc index d5824101..06ca3449 100644 --- a/src/main.cc +++ b/src/main.cc @@ -17,6 +17,7 @@ */ #include "class_diagram/generators/plantuml/class_diagram_generator.h" +#include "cli/cli_handler.h" #include "config/config.h" #include "include_diagram/generators/plantuml/include_diagram_generator.h" #include "package_diagram/generators/plantuml/package_diagram_generator.h" @@ -30,8 +31,6 @@ #include #endif -#include -#include #include #include @@ -50,71 +49,6 @@ backward::SignalHandling sh; // NOLINT using namespace clanguml; -/** - * Print the program version and basic information - */ -void print_version(); - -/** - * Print list of diagrams available in the configuration file - * - * @param cfg Configuration instance loaded from configuration file - */ -void print_diagrams_list(const clanguml::config::config &cfg); - -/** - * Print list of available diagram templates, including their names - * and types. - * - * @param cfg - */ -void print_diagram_templates(const clanguml::config::config &cfg); - -/** - * Print effective config after loading and setting default values. - * - * @param cfg Configuration instance loaded from configuration file - */ -void print_config(const clanguml::config::config &cfg); - -/** - * Generate sample configuration file and exit. - * - * @return 0 on success or error code - */ -int create_config_file(); - -/** - * Add example diagram of given type to the config file. - * - * @param type Type of the sample diagram to add - * @param config_file_path Path to the config file - * @param name Name of the new diagram - * @return 0 on success or error code - */ -int add_config_diagram(clanguml::common::model::diagram_t type, - const std::string &config_file_path, const std::string &name); - -/** - * Add diagram based on template - * @param config_file_path - * @param cfg - * @param template_name - * @param template_variables - * @return - */ -int add_config_diagram_from_template(const std::string &config_file_path, - const config::config &cfg, const std::string &template_name, - const std::vector &template_variables); - -/** - * Check if diagram output directory exists, if not create it - * - * @param dir Path to the output directory - * @return True if directory exists or has been created - */ -bool ensure_output_directory_exists(const std::string &dir); - /** * Generate specific diagram identified by name * @@ -176,182 +110,22 @@ void generate_diagrams(const std::vector &diagram_names, int main(int argc, const char *argv[]) { - CLI::App app{"Clang-based PlantUML diagram generator for C++"}; + cli::cli_handler cli; + auto res = cli.handle_options(argc, argv); - std::string config_path{".clang-uml"}; - std::optional compilation_database_dir{}; - std::vector diagram_names{}; - std::optional output_directory{}; - unsigned int thread_count{}; - bool show_version{false}; - int verbose{}; - bool list_diagrams{false}; - bool quiet{false}; - bool initialize{false}; - std::optional add_class_diagram; - std::optional add_sequence_diagram; - std::optional add_package_diagram; - std::optional add_include_diagram; - std::optional add_diagram_from_template; - bool dump_config{false}; - std::optional paths_relative_to_pwd{}; - std::vector template_variables{}; - bool list_templates{false}; - - app.add_option("-c,--config", config_path, - "Location of configuration file, when '-' read from stdin"); - app.add_option("-d,--compile-database", compilation_database_dir, - "Location of compilation database directory"); - app.add_option("-n,--diagram-name", diagram_names, - "List of diagram names to generate"); - app.add_option("-o,--output-directory", output_directory, - "Override output directory specified in config file"); - app.add_option("-t,--thread-count", thread_count, - "Thread pool size (0 = hardware concurrency)"); - app.add_flag("-V,--version", show_version, "Print version and exit"); - app.add_flag("-v,--verbose", verbose, - "Verbose logging (use multiple times to increase - e.g. -vvv)"); - app.add_flag("-q,--quiet", quiet, "Minimal logging"); - app.add_flag("-l,--list-diagrams", list_diagrams, - "Print list of diagrams defined in the config file"); - app.add_flag("--init", initialize, "Initialize example config file"); - app.add_option( - "--add-class-diagram", add_class_diagram, "Add class diagram config"); - app.add_option("--add-sequence-diagram", add_sequence_diagram, - "Add sequence diagram config"); - app.add_option("--add-package-diagram", add_package_diagram, - "Add package diagram config"); - app.add_option("--add-include-diagram", add_include_diagram, - "Add include diagram config"); - app.add_option("--add-diagram-from-template", add_diagram_from_template, - "Add diagram config based on diagram template"); - app.add_option("--template-variable", template_variables, - "Specify a value for a template variable"); - app.add_flag("--list-templates", list_templates, - "List all available diagram templates"); - app.add_flag( - "--dump-config", dump_config, "Print effective config to stdout"); - app.add_flag("--paths-relative-to-pwd", paths_relative_to_pwd, - "If true, all paths in configuration files are relative to the $PWD " - "instead of actual location of `.clang-uml` file."); - - CLI11_PARSE(app, argc, argv); - - if (quiet || dump_config) - verbose = 0; - else - verbose++; - - clanguml::util::setup_logging(verbose); - - if (show_version) { - print_version(); + if (res == cli::cli_flow_t::kExit) return 0; - } - if ((config_path == "-") && - (initialize || add_diagram_from_template || - add_class_diagram.has_value() || add_sequence_diagram.has_value() || - add_package_diagram.has_value() || - add_include_diagram.has_value())) { - - LOG_ERROR( - "ERROR: Cannot add a diagram config to configuration from stdin"); - - return 1; - } - - if (initialize) { - return create_config_file(); - } - - if (config_path != "-") { - if (add_class_diagram) { - return add_config_diagram( - clanguml::common::model::diagram_t::kClass, config_path, - *add_class_diagram); - } - - if (add_sequence_diagram) { - return add_config_diagram( - clanguml::common::model::diagram_t::kSequence, config_path, - *add_sequence_diagram); - } - - if (add_package_diagram) { - return add_config_diagram( - clanguml::common::model::diagram_t::kPackage, config_path, - *add_package_diagram); - } - - if (add_include_diagram) { - return add_config_diagram( - clanguml::common::model::diagram_t::kInclude, config_path, - *add_include_diagram); - } - } - - clanguml::config::config config; - try { - config = clanguml::config::load(config_path, paths_relative_to_pwd); - } - catch (std::runtime_error &e) { - LOG_ERROR(e.what()); - return 1; - } - - if (list_diagrams) { - print_diagrams_list(config); - return 0; - } - - if (list_templates) { - print_diagram_templates(config); - return 0; - } - - if (config_path != "-" && add_diagram_from_template) { - return add_config_diagram_from_template(config_path, config, - add_diagram_from_template.value(), template_variables); - } - - LOG_INFO("Loaded clang-uml config from {}", config_path); - - // - // Override selected config options from command line - // - if (compilation_database_dir) { - config.compilation_database_dir.set( - util::ensure_path_is_absolute(compilation_database_dir.value()) - .string()); - } - if (output_directory) { - config.output_directory.set( - util::ensure_path_is_absolute(output_directory.value()).string()); - } - - LOG_INFO("Loading compilation database from {} directory", - config.compilation_database_dir()); - - auto od = config.output_directory(); - if (output_directory) - od = output_directory.value(); - - if (dump_config) { - print_config(config); - return 0; - } - - if (!ensure_output_directory_exists(od)) + if (res == cli::cli_flow_t::kError) return 1; std::string err{}; auto db = clang::tooling::CompilationDatabase::autoDetectFromDirectory( - config.compilation_database_dir(), err); + cli.config.compilation_database_dir(), err); if (!err.empty()) { LOG_ERROR("Failed to load compilation database from {}", - config.compilation_database_dir()); + cli.config.compilation_database_dir()); return 1; } @@ -364,10 +138,11 @@ int main(int argc, const char *argv[]) // We have to generate the translation units list for each diagram before // scheduling tasks, because std::filesystem::current_path cannot be trusted // with multiple threads - find_translation_units_for_diagrams(diagram_names, config, + find_translation_units_for_diagrams(cli.diagram_names, cli.config, compilation_database_files, translation_units_map); - generate_diagrams(diagram_names, config, od, db, verbose, thread_count, + generate_diagrams(cli.diagram_names, cli.config, + cli.effective_output_directory, db, cli.verbose, cli.thread_count, translation_units_map); return 0; @@ -533,264 +308,3 @@ void find_translation_units_for_diagrams( } } } - -bool ensure_output_directory_exists(const std::string &dir) -{ - namespace fs = std::filesystem; - using std::cout; - - fs::path output_dir{dir}; - - if (fs::exists(output_dir) && !fs::is_directory(output_dir)) { - cout << "ERROR: " << dir << " is not a directory...\n"; - return false; - } - - if (!fs::exists(output_dir)) { - return fs::create_directories(output_dir); - } - - return true; -} - -void print_version() -{ - constexpr auto kLLVMBackendPackageStringLength{5}; - std::cout << "clang-uml " << clanguml::version::CLANG_UML_VERSION << '\n'; - std::cout << "Copyright (C) 2021-2023 Bartek Kryza " - << '\n'; - std::cout << "Built against LLVM/Clang libraries version: " - << std::string{BACKEND_PACKAGE_STRING}.substr( - kLLVMBackendPackageStringLength) - << std::endl; - std::cout << "Using LLVM/Clang libraries version: " - << clang::getClangFullVersion() << std::endl; -} - -void print_diagrams_list(const clanguml::config::config &cfg) -{ - using std::cout; - - cout << "The following diagrams are defined in the config file:\n"; - for (const auto &[name, diagram] : cfg.diagrams) { - cout << " - " << name << " [" << to_string(diagram->type()) << "]"; - cout << '\n'; - } -} - -void print_diagram_templates(const clanguml::config::config &cfg) -{ - using std::cout; - - if (!cfg.diagram_templates) { - cout << "No diagram templates are defined in the config file\n"; - return; - } - - cout << "The following diagram templates are available:\n"; - for (const auto &[name, diagram_template] : cfg.diagram_templates()) { - cout << " - " << name << " [" << to_string(diagram_template.type) - << "]"; - cout << '\n'; - } -} - -int create_config_file() -{ - namespace fs = std::filesystem; - using std::cout; - - fs::path config_file{"./.clang-uml"}; - - if (fs::exists(config_file)) { - cout << "ERROR: .clang-uml file already exists\n"; - return 1; - } - - YAML::Emitter out; - out.SetIndent(2); - out << YAML::BeginMap; - out << YAML::Comment("Change to directory where compile_commands.json is"); - out << YAML::Key << "compilation_database_dir" << YAML::Value << "."; - out << YAML::Newline - << YAML::Comment("Change to directory where diagram should be written"); - out << YAML::Key << "output_directory" << YAML::Value << "docs/diagrams"; - out << YAML::Key << "diagrams" << YAML::Value; - out << YAML::BeginMap; - out << YAML::Key << "example_class_diagram" << YAML::Value; - out << YAML::BeginMap; - out << YAML::Key << "type" << YAML::Value << "class"; - out << YAML::Key << "glob" << YAML::Value; - out << YAML::BeginSeq << "src/*.cpp" << YAML::EndSeq; - out << YAML::Key << "using_namespace" << YAML::Value; - out << YAML::BeginSeq << "myproject" << YAML::EndSeq; - out << YAML::Key << "include"; - out << YAML::BeginMap; - out << YAML::Key << "namespaces"; - out << YAML::BeginSeq << "myproject" << YAML::EndSeq; - out << YAML::EndMap; - out << YAML::Key << "exclude"; - out << YAML::BeginMap; - out << YAML::Key << "namespaces"; - out << YAML::BeginSeq << "myproject::detail" << YAML::EndSeq; - out << YAML::EndMap; - out << YAML::EndMap; - out << YAML::EndMap; - out << YAML::EndMap; - out << YAML::Newline; - - std::ofstream ofs(config_file); - ofs << out.c_str(); - ofs.close(); - - return 0; -} - -int add_config_diagram(clanguml::common::model::diagram_t type, - const std::string &config_file_path, const std::string &name) -{ - namespace fs = std::filesystem; - - fs::path config_file{config_file_path}; - - if (!fs::exists(config_file)) { - std::cerr << "ERROR: " << config_file_path << " file doesn't exists\n"; - return 1; - } - - YAML::Node doc = YAML::LoadFile(config_file.string()); - - for (YAML::const_iterator it = doc["diagrams"].begin(); - it != doc["diagrams"].end(); ++it) { - if (it->first.as() == name) { - std::cerr << "ERROR: " << config_file_path - << " file already contains '" << name << "' diagram"; - return 1; - } - } - - if (type == clanguml::common::model::diagram_t::kClass) { - doc["diagrams"][name]["type"] = "class"; - doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; - doc["diagrams"][name]["using_namespace"] = - std::vector{{"myproject"}}; - doc["diagrams"][name]["include"]["namespaces"] = - std::vector{{"myproject"}}; - doc["diagrams"][name]["exclude"]["namespaces"] = - std::vector{{"myproject::detail"}}; - } - else if (type == clanguml::common::model::diagram_t::kSequence) { - doc["diagrams"][name]["type"] = "sequence"; - doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; - doc["diagrams"][name]["combine_free_functions_into_file_participants"] = - true; - doc["diagrams"][name]["using_namespace"] = - std::vector{{"myproject"}}; - doc["diagrams"][name]["include"]["paths"] = - std::vector{{"src"}}; - doc["diagrams"][name]["exclude"]["namespaces"] = - std::vector{{"myproject::detail"}}; - doc["diagrams"][name]["start_from"] = - std::vector>{ - {{"function", "main(int,const char **)"}}}; - } - else if (type == clanguml::common::model::diagram_t::kPackage) { - doc["diagrams"][name]["type"] = "package"; - doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; - doc["diagrams"][name]["using_namespace"] = - std::vector{{"myproject"}}; - doc["diagrams"][name]["include"]["namespaces"] = - std::vector{{"myproject"}}; - doc["diagrams"][name]["exclude"]["namespaces"] = - std::vector{{"myproject::detail"}}; - } - else if (type == clanguml::common::model::diagram_t::kInclude) { - doc["diagrams"][name]["type"] = "include"; - doc["diagrams"][name]["glob"] = std::vector{{"src/*.cpp"}}; - doc["diagrams"][name]["relative_to"] = "."; - doc["diagrams"][name]["include"]["paths"] = - std::vector{{"src"}}; - } - - YAML::Emitter out; - out.SetIndent(2); - - out << doc; - out << YAML::Newline; - - std::ofstream ofs(config_file); - ofs << out.c_str(); - ofs.close(); - - return 0; -} - -int add_config_diagram_from_template(const std::string &config_file_path, - const config::config &cfg, const std::string &template_name, - const std::vector &template_variables) -{ - if (!cfg.diagram_templates || - !(cfg.diagram_templates().find(template_name) != - cfg.diagram_templates().end())) { - std::cerr << "ERROR: No such diagram template: " << template_name - << "\n"; - return 1; - } - - // First, try to render the template using inja and create a YAML node from - // it - inja::json ctx; - for (const auto &tv : template_variables) { - const auto var = util::split(tv, "="); - if (var.size() != 2) { - std::cerr << "ERROR: Invalid template variable " << tv << "\n"; - return 1; - } - - ctx[var.at(0)] = var.at(1); - } - - auto diagram_template_str = - cfg.diagram_templates().at(template_name).jinja_template; - - auto diagram_str = inja::render(diagram_template_str, ctx); - - auto diagram_node = YAML::Load(diagram_str); - - namespace fs = std::filesystem; - - fs::path config_file{config_file_path}; - - if (!fs::exists(config_file)) { - std::cerr << "ERROR: " << config_file_path << " file doesn't exists\n"; - return 1; - } - - YAML::Node doc = YAML::LoadFile(config_file.string()); - - const auto diagram_name = diagram_node.begin()->first.as(); - doc["diagrams"][diagram_name] = diagram_node.begin()->second; - - YAML::Emitter out; - out.SetIndent(2); - - out << doc; - out << YAML::Newline; - - std::ofstream ofs(config_file); - ofs << out.c_str(); - ofs.close(); - - return 0; -} - -void print_config(const clanguml::config::config &cfg) -{ - YAML::Emitter out; - out.SetIndent(2); - - out << cfg; - out << YAML::Newline; - - std::cout << out.c_str(); -} \ No newline at end of file diff --git a/src/util/util.cc b/src/util/util.cc index 94f1f5fd..76de73ea 100644 --- a/src/util/util.cc +++ b/src/util/util.cc @@ -25,27 +25,6 @@ namespace clanguml::util { static const auto WHITESPACE = " \n\r\t\f\v"; -void setup_logging(int verbose) -{ - auto console = - spdlog::stdout_color_mt("console", spdlog::color_mode::automatic); - - console->set_pattern("[%^%l%^] [tid %t] %v"); - - if (verbose == 0) { - console->set_level(spdlog::level::err); - } - else if (verbose == 1) { - console->set_level(spdlog::level::info); - } - else if (verbose == 2) { - console->set_level(spdlog::level::debug); - } - else { - console->set_level(spdlog::level::trace); - } -} - std::string get_process_output(const std::string &command) { constexpr size_t kBufferSize{1024}; diff --git a/src/util/util.h b/src/util/util.h index 15c12335..bfdbe29c 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -28,29 +28,29 @@ #include #define LOG_ERROR(fmt__, ...) \ - spdlog::get("console")->error( \ - fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, __LINE__, \ - ##__VA_ARGS__) + spdlog::get("clanguml-logger") \ + ->error(fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, \ + __LINE__, ##__VA_ARGS__) #define LOG_WARN(fmt__, ...) \ - spdlog::get("console")->warn( \ - fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, __LINE__, \ - ##__VA_ARGS__) + spdlog::get("clanguml-logger") \ + ->warn(fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, \ + __LINE__, ##__VA_ARGS__) #define LOG_INFO(fmt__, ...) \ - spdlog::get("console")->info( \ - fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, __LINE__, \ - ##__VA_ARGS__) + spdlog::get("clanguml-logger") \ + ->info(fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, \ + __LINE__, ##__VA_ARGS__) #define LOG_DBG(fmt__, ...) \ - spdlog::get("console")->debug( \ - fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, __LINE__, \ - ##__VA_ARGS__) + spdlog::get("clanguml-logger") \ + ->debug(fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, \ + __LINE__, ##__VA_ARGS__) #define LOG_TRACE(fmt__, ...) \ - spdlog::get("console")->trace( \ - fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, __LINE__, \ - ##__VA_ARGS__) + spdlog::get("clanguml-logger") \ + ->trace(fmt::runtime(std::string("[{}:{}] ") + fmt__), FILENAME_, \ + __LINE__, ##__VA_ARGS__) namespace clanguml::util { @@ -61,13 +61,6 @@ std::string trim(const std::string &s); #define FILENAME_ \ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) -/** - * @brief Setup spdlog logger. - * - * @param verbose Whether the logging should be verbose or not. - */ -void setup_logging(int verbose); - std::string get_process_output(const std::string &command); std::string get_env(const std::string &name); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index daf64ccb..4c17b96e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -38,6 +38,7 @@ set(TEST_CASES test_cases test_decorator_parser test_config + test_cli_handler test_filters test_thread_pool_executor) diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 10c4bff4..926083ff 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -17,6 +17,8 @@ */ #include "test_cases.h" + +#include "cli/cli_handler.h" #include "common/generators/plantuml/generator.h" #include @@ -345,7 +347,17 @@ int main(int argc, char *argv[]) if (returnCode != 0) return returnCode; - clanguml::util::setup_logging(debug_log ? 3 : 1); + clanguml::cli::cli_handler clih; + + std::vector argvv = { + "clang-uml", "--config", "./test_config_data/simple.yml"}; + + if (debug_log) + argvv.push_back("-vvv"); + else + argvv.push_back("-q"); + + clih.handle_options(argvv.size(), argvv.data()); return session.run(); } diff --git a/tests/test_cli_handler.cc b/tests/test_cli_handler.cc new file mode 100644 index 00000000..65ad3523 --- /dev/null +++ b/tests/test_cli_handler.cc @@ -0,0 +1,74 @@ +/** + * tests/test_cli_handler.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#define CATCH_CONFIG_MAIN + +#include "cli/cli_handler.h" +#include "version.h" + +#include "catch.h" + +#include +#include + +std::shared_ptr make_sstream_logger(std::ostream &ostr) +{ + auto oss_sink = std::make_shared(ostr); + return std::make_shared( + "clanguml-logger", std::move(oss_sink)); +} + +TEST_CASE("Test cli handler print_version", "[unit-test]") +{ + using clanguml::cli::cli_flow_t; + using clanguml::cli::cli_handler; + + std::vector argv = {"clang-uml", "--version"}; + + std::ostringstream ostr; + cli_handler cli{ostr, make_sstream_logger(ostr)}; + + auto res = cli.handle_options(argv.size(), argv.data()); + + REQUIRE(res == cli_flow_t::kExit); + + auto output = ostr.str(); + + REQUIRE(output.find(fmt::format( + "clang-uml {}", clanguml::version::CLANG_UML_VERSION)) == 0); +} + +TEST_CASE("Test cli handler print_config", "[unit-test]") +{ + using clanguml::cli::cli_flow_t; + using clanguml::cli::cli_handler; + + std::vector argv = {"clang-uml", "--config", + "./test_config_data/simple.yml", "--dump-config"}; + + std::ostringstream ostr; + cli_handler cli{ostr, make_sstream_logger(ostr)}; + + auto res = cli.handle_options(argv.size(), argv.data()); + + REQUIRE(res == cli_flow_t::kExit); + + auto output = ostr.str(); + YAML::Node doc = YAML::Load(output); + + REQUIRE(doc["diagrams"]["class_main"]); +} \ No newline at end of file diff --git a/tests/test_config.cc b/tests/test_config.cc index a3f92441..ab95a3d5 100644 --- a/tests/test_config.cc +++ b/tests/test_config.cc @@ -265,39 +265,55 @@ TEST_CASE("Test config diagram_templates", "[unit-test]") auto cfg = clanguml::config::load("./test_config_data/diagram_templates.yml"); - REQUIRE(cfg.diagram_templates().size() == 3); + REQUIRE(cfg.diagram_templates().size() == 4); - REQUIRE(cfg.diagram_templates()["bases_hierarchy_tmpl"].type == + REQUIRE(cfg.diagram_templates()["parents_hierarchy_tmpl"].type == clanguml::common::model::diagram_t::kClass); - REQUIRE(cfg.diagram_templates()["bases_hierarchy_tmpl"].jinja_template == - R"("{{ class_name }}_parents_hierarchy": + REQUIRE(cfg.diagram_templates()["parents_hierarchy_tmpl"].jinja_template == + "{{ diagram_name }}:" + R"( type: class + {% if exists("glob") %} + glob: [{{ glob }}] + {% endif %} + {% if exists("using_namespace") %} + using_namespace: {{ using_namespace }} + {% endif %} include: - parents: "{{ class_name }}" - namespaces: "{{ namespace_name }}" + parents: [{{ class_name }}] + namespaces: [{{ namespace_names }}] relationships: - inheritance exclude: access: [public, protected, private] plantuml: before: - - left to right direction)"); + - left to right direction +)"); REQUIRE(cfg.diagram_templates()["children_hierarchy_tmpl"].type == clanguml::common::model::diagram_t::kClass); - REQUIRE(cfg.diagram_templates()["children_hierarchy_tmpl"].jinja_template == - R"("{{ class_name }}_children_hierarchy": + REQUIRE(cfg.diagram_templates()["subclass_hierarchy_tmpl"].jinja_template == + "{{ diagram_name }}:" + R"( type: class + {% if exists("glob") %} + glob: [{{ glob }}] + {% endif %} + {% if exists("using_namespace") %} + using_namespace: {{ using_namespace }} + {% endif %} include: - subclasses: "{{ class_name }}" - namespaces: "{{ namespace_name }}" + parents: [{{ class_name }}] + namespaces: [{{ namespace_name }}] relationships: - inheritance exclude: access: [public, protected, private] plantuml: before: - - left to right direction)"); + - left to right direction +)"); REQUIRE(cfg.diagram_templates()["main_sequence_tmpl"].type == clanguml::common::model::diagram_t::kSequence); diff --git a/tests/test_config_data/diagram_templates.yml b/tests/test_config_data/diagram_templates.yml index 3c877b88..e1af0e62 100644 --- a/tests/test_config_data/diagram_templates.yml +++ b/tests/test_config_data/diagram_templates.yml @@ -2,33 +2,10 @@ compilation_database_dir: debug output_directory: output diagram_templates: - bases_hierarchy_tmpl: - '{{ class_name }}_parents_hierarchy': - type: class - include: - parents: '{{ class_name }}' - namespaces: '{{ namespace_name }}' - relationships: - - inheritance - exclude: - access: [public, protected, private] - plantuml: - before: - - left to right direction - children_hierarchy_tmpl: | - '{{ class_name }}_children_hierarchy': - type: class - include: - subclasses: '{{ class_name }}' - namespaces: '{{ namespace_name }}' - relationships: - - inheritance - exclude: - access: [public, protected, private] - plantuml: - before: - - left to right direction - main_sequence_tmpl: | + main_sequence_tmpl: + description: Sequence diagram of the main() function + type: sequence + template: | main_sequence_diagram: type: sequence glob: [ {{ glob }} ] diff --git a/tests/test_config_data/simple.yml b/tests/test_config_data/simple.yml index 805123c6..ebc9be14 100644 --- a/tests/test_config_data/simple.yml +++ b/tests/test_config_data/simple.yml @@ -1,6 +1,5 @@ compilation_database_dir: debug output_directory: output - diagrams: class_main: type: class From e7353d7a032d881239a11bd572bd9a0c3fe7838c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Mar 2023 20:50:17 +0100 Subject: [PATCH 10/15] Added cli_handler tests --- tests/test_cli_handler.cc | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/test_cli_handler.cc b/tests/test_cli_handler.cc index 65ad3523..799b1d38 100644 --- a/tests/test_cli_handler.cc +++ b/tests/test_cli_handler.cc @@ -71,4 +71,89 @@ TEST_CASE("Test cli handler print_config", "[unit-test]") YAML::Node doc = YAML::Load(output); REQUIRE(doc["diagrams"]["class_main"]); +} + +TEST_CASE("Test cli handler print_diagrams_list", "[unit-test]") +{ + using clanguml::cli::cli_flow_t; + using clanguml::cli::cli_handler; + + std::vector argv = { + "clang-uml", "--config", "./test_config_data/simple.yml", "-l"}; + + std::ostringstream ostr; + cli_handler cli{ostr, make_sstream_logger(ostr)}; + + auto res = cli.handle_options(argv.size(), argv.data()); + + REQUIRE(res == cli_flow_t::kExit); + + auto output = ostr.str(); + + REQUIRE(output == + "The following diagrams are defined in the config file:" + R"( + - class_main [class] +)"); +} + +TEST_CASE("Test cli handler print_diagram_templates", "[unit-test]") +{ + using clanguml::cli::cli_flow_t; + using clanguml::cli::cli_handler; + + std::vector argv = {"clang-uml", "--config", + "./test_config_data/simple.yml", "--list-templates"}; + + std::ostringstream ostr; + cli_handler cli{ostr, make_sstream_logger(ostr)}; + + auto res = cli.handle_options(argv.size(), argv.data()); + + REQUIRE(res == cli_flow_t::kExit); + + auto output = ostr.str(); + + REQUIRE(output == + "The following diagram templates are available:" + R"( + - class_context_tmpl [class]: Generate class context diagram + - parents_hierarchy_tmpl [class]: Generate class parents inheritance diagram + - subclass_hierarchy_tmpl [class]: Generate class children inheritance diagram +)"); +} + +TEST_CASE("Test cli handler print_diagram_template", "[unit-test]") +{ + using clanguml::cli::cli_flow_t; + using clanguml::cli::cli_handler; + + std::vector argv = {"clang-uml", "--config", + "./test_config_data/simple.yml", "--show-template", + "class_context_tmpl"}; + + std::ostringstream ostr; + cli_handler cli{ostr, make_sstream_logger(ostr)}; + + auto res = cli.handle_options(argv.size(), argv.data()); + + REQUIRE(res == cli_flow_t::kExit); + + auto output = ostr.str(); + + REQUIRE(output == + "\"{{ diagram_name }}\":" + R"( + type: class + {% if exists("glob") %} + glob: [{{ glob }}] + {% endif %} + {% if exists("using_namespace") %} + using_namespace: {{ using_namespace }} + {% endif %} + include: + context: [{{ class_name }}] + namespaces: [{{ namespace_name }}] + +)"); } \ No newline at end of file From bcba612f65e9bad370f48e03e1135b6ee64cb641 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Mar 2023 22:06:53 +0100 Subject: [PATCH 11/15] Fixed clang-tidy warnings --- src/cli/cli_handler.cc | 8 ++++---- src/cli/cli_handler.h | 7 +++---- src/common/model/enums.cc | 10 +++++----- src/config/config.h | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/cli/cli_handler.cc b/src/cli/cli_handler.cc index 18820674..44a4c4f2 100644 --- a/src/cli/cli_handler.cc +++ b/src/cli/cli_handler.cc @@ -56,7 +56,7 @@ void cli_handler::setup_logging() } } -cli_flow_t cli_handler::parse(int argc, const char *argv[]) +cli_flow_t cli_handler::parse(int argc, const char **argv) { app.add_option("-c,--config", config_path, "Location of configuration file, when '-' read from stdin"); @@ -104,7 +104,7 @@ cli_flow_t cli_handler::parse(int argc, const char *argv[]) return cli_flow_t::kExit; } catch (const CLI::ParseError &e) { - exit(app.exit(e)); + exit(app.exit(e)); // NOLINT(concurrency-mt-unsafe) } if (quiet || dump_config) @@ -115,7 +115,7 @@ cli_flow_t cli_handler::parse(int argc, const char *argv[]) return cli_flow_t::kContinue; } -cli_flow_t cli_handler::handle_options(int argc, const char *argv[]) +cli_flow_t cli_handler::handle_options(int argc, const char **argv) { auto res = parse(argc, argv); @@ -558,4 +558,4 @@ cli_flow_t cli_handler::print_config() return cli_flow_t::kExit; } -} // namespace clanguml::options \ No newline at end of file +} // namespace clanguml::cli \ No newline at end of file diff --git a/src/cli/cli_handler.h b/src/cli/cli_handler.h index 11633087..7c917c77 100644 --- a/src/cli/cli_handler.h +++ b/src/cli/cli_handler.h @@ -41,7 +41,7 @@ public: * @param argv * @return */ - cli_flow_t handle_options(int argc, const char *argv[]); + cli_flow_t handle_options(int argc, const char **argv); /** * Print the program version and basic information @@ -135,7 +135,7 @@ public: clanguml::config::config config; private: - cli_flow_t parse(int argc, const char *argv[]); + cli_flow_t parse(int argc, const char **argv); cli_flow_t handle_pre_config_options(); @@ -149,5 +149,4 @@ private: std::shared_ptr logger_; CLI::App app{"Clang-based UML diagram generator for C++"}; }; - -} // namespace clanguml::options \ No newline at end of file +} // namespace clanguml::cli \ No newline at end of file diff --git a/src/common/model/enums.cc b/src/common/model/enums.cc index 7d199d62..3dfab613 100644 --- a/src/common/model/enums.cc +++ b/src/common/model/enums.cc @@ -140,14 +140,14 @@ diagram_t from_string(const std::string &s) { if (s == "class") return diagram_t::kClass; - else if (s == "sequence") + if (s == "sequence") return diagram_t::kSequence; - else if (s == "include") + if (s == "include") return diagram_t::kInclude; - else if (s == "package") + if (s == "package") return diagram_t::kPackage; - else - throw std::runtime_error{"Invalid diagram type: " + s}; + + throw std::runtime_error{"Invalid diagram type: " + s}; } } // namespace clanguml::common::model diff --git a/src/config/config.h b/src/config/config.h index f3a147bd..c13ffc08 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -52,7 +52,7 @@ struct plantuml { struct diagram_template { std::string description; - common::model::diagram_t type; + common::model::diagram_t type{common::model::diagram_t::kClass}; std::string jinja_template; }; From 9ba8fc9c05824cf0923331de667869751184a736 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Mar 2023 00:13:37 +0100 Subject: [PATCH 12/15] Added diagram template docs --- .clang-uml | 14 +------------- docs/Makefile | 1 + docs/README.md | 9 +++++---- src/config/diagram_templates.cc | 2 +- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.clang-uml b/.clang-uml index 5923c9df..0dacf720 100644 --- a/.clang-uml +++ b/.clang-uml @@ -25,16 +25,4 @@ diagrams: package_model_class: include!: uml/package_model_class_diagram.yml include_graph: - include!: uml/include_diagram.yml - include3_diagram_parents_hierarchy: - type: class - include: - parents: [clanguml::config::include_diagram] - namespaces: [clanguml] - relationships: - - inheritance - exclude: - access: [public, protected, private] - plantuml: - before: - - left to right direction \ No newline at end of file + include!: uml/include_diagram.yml \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile index 7b78c4f5..66ae9e98 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -28,6 +28,7 @@ toc: $(UPDATE_TOC) include_diagrams.md $(UPDATE_TOC) installation.md $(UPDATE_TOC) interactive_svg_diagrams.md + $(UPDATE_TOC) diagram_templates.md $(UPDATE_TOC) jinja_templates.md $(UPDATE_TOC) package_diagrams.md $(UPDATE_TOC) quick_start.md diff --git a/docs/README.md b/docs/README.md index 9f6a366b..0fb0ae20 100644 --- a/docs/README.md +++ b/docs/README.md @@ -8,10 +8,11 @@ * [Sequence diagrams](./sequence_diagrams.md) * [Package diagrams](./package_diagrams.md) * [Include diagrams](./include_diagrams.md) -* [Comment decorators](./comment_decorators.md) -* [Diagram filters](./diagram_filters.md) -* [Using Jinja templates](./jinja_templates.md) -* [Interactive SVG diagrams using links](./interactive_svg_diagrams.md) + * [Diagram templates](./diagram_templates.md) + * [Comment decorators](./comment_decorators.md) + * [Diagram filters](./diagram_filters.md) + * [Using Jinja templates in diagram configs](./jinja_templates.md) + * [Interactive SVG diagrams using links](./interactive_svg_diagrams.md) * [Configuration file reference](./configuration_file.md) * [Doxygen integration](./doxygen_integration.md) * [Test cases documentation](./test_cases.md) diff --git a/src/config/diagram_templates.cc b/src/config/diagram_templates.cc index 1293eebe..3356b3ae 100644 --- a/src/config/diagram_templates.cc +++ b/src/config/diagram_templates.cc @@ -39,7 +39,7 @@ parents_hierarchy_tmpl: {% endif %} include: parents: [{{ class_name }}] - namespaces: [{{ namespace_names }}] + namespaces: [{{ namespace_name }}] relationships: - inheritance exclude: From 07b71aa389ff46d894206a29570a6cd698a8b4f9 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Mar 2023 00:14:59 +0100 Subject: [PATCH 13/15] Updated CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3f7dc76..2658b920 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # CHANGELOG + * Added diagram templates support (#105) * Added parents (base classes) diagram filter * Fixed namespace handling for nested template specializations From eeb3d41a10de749fcac36743fa29a670b5c06f8f Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Mar 2023 00:15:42 +0100 Subject: [PATCH 14/15] Updated README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6257cd11..d7c58db6 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ legacy code. The configuration file or files for `clang-uml` define the type and contents of each generated diagram. Currently, the diagrams are generated in [PlantUML](https://plantuml.com) format. -`clang-uml` currently supports C++ up to version 17. +`clang-uml` currently supports C++ up to version 17 and partial support for C++ 20. ## Features From d5b279e096598c096fc50da496390ea20fceb2da Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Mar 2023 00:38:05 +0100 Subject: [PATCH 15/15] Fixed typo --- docs/diagram_templates.md | 97 +++++++++++++++++++++++++++++++++++++++ tests/test_config.cc | 2 +- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 docs/diagram_templates.md diff --git a/docs/diagram_templates.md b/docs/diagram_templates.md new file mode 100644 index 00000000..35a55d10 --- /dev/null +++ b/docs/diagram_templates.md @@ -0,0 +1,97 @@ +# Diagram templates + + + +* [Diagram template syntax](#diagram-template-syntax) +* [Adding templates to the configuration file](#adding-templates-to-the-configuration-file) +* [Adding diagram to configuration from a template](#adding-diagram-to-configuration-from-a-template) +* [Builtin templates](#builtin-templates) + + + +When working with large codebases, it is often necessary to create diagram +configurations for a large number of classes or groups of classes. + +Diagram templates feature makes this easier, by allowing to define (or use +one of the builtin) templates and generate using them any number of diagram +configurations. Diagram templates can be defined using Jinja like template +syntax (current renderer implementation is +[inja](https://github.com/pantor/inja)). + +## Diagram template syntax +Diagram templates are defined as part of the configuration file using the +following YAML node: + +```yaml +diagram_templates: + # Name of the template + parents_hierarchy_tmpl: + # Description of the template + description: Generate class parents inheritance diagram + # Diagram type + type: class + # Template definition - it has to be valid YAML after it is rendered + template: | + {{ diagram_name }}: + type: class + {% if exists("glob") %} + glob: [{{ glob }}] + {% endif %} + {% if exists("using_namespace") %} + using_namespace: {{ using_namespace }} + {% endif %} + include: + parents: [{{ class_name }}] + namespaces: [{{ namespace_names }}] + relationships: + - inheritance + exclude: + access: [public, protected, private] + plantuml: + before: + - left to right direction +``` + +## Adding templates to the configuration file +Diagram templates can be added directly to the `.clang-uml` configuration file, +under a `diagram_templates:` key. However, for practical reasons its better +to keep diagram template definitions in a separate Yaml file, and reference +it in the configuration file using `include!` directive, e.g.: + +```yaml +diagram_templates: + include!: .clang-uml-templates +``` + +## Adding diagram to configuration from a template +To add a new diagram definition to the configuration file based on the template, +simply call the `clang-uml` using the following options: + +```bash +clang-uml --add-diagram-from-template parents_hierarchy_tmpl \ + --template-var class_name=clanguml::config::include_diagram \ + --template-var namespace_names=clanguml \ + --template-var diagram_name=abcd \ + --template-var "glob=src/config/*.cc" \ + --template-var using_namespace=clanguml::config +``` + +To see what variables are necessary to provide for a template, the template +can be printed from the command line using the following command: + +```bash +clang-uml --show-template parents_hierarchy_tmpl +``` + +## Builtin templates +`clang-uml` has some predefined templates, which can be used directly. If the +users configuration file defines another template with a name which already +exists as built-in template it will override the predefined templates. + +Currently the following templates are built-in: +* `parents_hierarchy_tmpl` - generate inheritance hierarchy diagram including + parents of a specified class +* `subclass_hierarchy_tmpl` - generate inheritance hierarchy diagram including + c children of a specified class +* `class_context_tmpl` - generate diagram including all classes in direct + relationship (of any kind) with a specific class diff --git a/tests/test_config.cc b/tests/test_config.cc index ab95a3d5..f482d8b1 100644 --- a/tests/test_config.cc +++ b/tests/test_config.cc @@ -281,7 +281,7 @@ TEST_CASE("Test config diagram_templates", "[unit-test]") {% endif %} include: parents: [{{ class_name }}] - namespaces: [{{ namespace_names }}] + namespaces: [{{ namespace_name }}] relationships: - inheritance exclude: