From 9399d80f6fdaae8a521128d4db3246c9e3383fde Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 5 May 2022 00:33:15 +0200 Subject: [PATCH 01/19] Updated cppast ref --- thirdparty/cppast | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/cppast b/thirdparty/cppast index 27328473..b61374e3 160000 --- a/thirdparty/cppast +++ b/thirdparty/cppast @@ -1 +1 @@ -Subproject commit 273284739d8cb5c49e3c3a5dc13b8dcc01a3ffdc +Subproject commit b61374e37c4771279bf821006affb112ac08154f From 468393ddb8071994b216a85f4db74bdac6594d6c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 5 May 2022 00:34:23 +0200 Subject: [PATCH 02/19] WIP Refactoring alias template resolution based on clang canonical representation --- .../plantuml/class_diagram_generator.cc | 2 + src/class_diagram/model/class.cc | 9 +- src/class_diagram/model/class.h | 5 + src/class_diagram/model/class_template.cc | 16 +- src/class_diagram/model/class_template.h | 9 ++ .../visitor/translation_unit_visitor.cc | 152 ++++++++++++++---- .../visitor/translation_unit_visitor.h | 9 +- src/common/generators/plantuml/generator.cc | 2 + src/common/model/enums.cc | 2 + src/common/model/enums.h | 1 + src/cx/util.cc | 5 +- tests/t00014/t00014.cc | 20 ++- tests/t00014/test_case.h | 64 +++++--- 13 files changed, 235 insertions(+), 61 deletions(-) diff --git a/src/class_diagram/generators/plantuml/class_diagram_generator.cc b/src/class_diagram/generators/plantuml/class_diagram_generator.cc index 18d7aa3b..290eb540 100644 --- a/src/class_diagram/generators/plantuml/class_diagram_generator.cc +++ b/src/class_diagram/generators/plantuml/class_diagram_generator.cc @@ -64,6 +64,8 @@ void generator::generate_alias(const class_ &c, std::ostream &ostr) const else full_name = c.full_name(); + //util::replace_all(full_name, "std::basic_string", "std::string"); + if (full_name.empty()) full_name = "<>"; diff --git a/src/class_diagram/model/class.cc b/src/class_diagram/model/class.cc index c1d068ca..f295118c 100644 --- a/src/class_diagram/model/class.cc +++ b/src/class_diagram/model/class.cc @@ -139,10 +139,13 @@ std::ostringstream &class_::render_template_params( if (!templates_.empty()) { std::vector tnames; + std::vector tnames_simplified; + std::transform(templates_.cbegin(), templates_.cend(), - std::back_inserter(tnames), [this](const auto &tmplt) { - return tmplt.to_string(using_namespace()); - }); + std::back_inserter(tnames), + [ns = using_namespace()]( + const auto &tmplt) { return tmplt.to_string(ns); }); + ostr << fmt::format("<{}>", fmt::join(tnames, ",")); } return ostr; diff --git a/src/class_diagram/model/class.h b/src/class_diagram/model/class.h index ff1f194e..e9f17ef9 100644 --- a/src/class_diagram/model/class.h +++ b/src/class_diagram/model/class.h @@ -75,12 +75,17 @@ public: bool is_abstract() const; + bool is_alias() const { return is_alias_; } + + void is_alias(bool alias) { is_alias_ = alias; } + private: std::ostringstream &render_template_params(std::ostringstream &ostr) const; bool is_struct_{false}; bool is_template_{false}; bool is_template_instantiation_{false}; + bool is_alias_{false}; std::vector members_; std::vector methods_; std::vector bases_; diff --git a/src/class_diagram/model/class_template.cc b/src/class_diagram/model/class_template.cc index 589bdede..bb0d1a1f 100644 --- a/src/class_diagram/model/class_template.cc +++ b/src/class_diagram/model/class_template.cc @@ -24,16 +24,21 @@ namespace clanguml::class_diagram::model { class_template::class_template(const std::string &type, const std::string &name, const std::string &default_value, bool is_variadic) - : type_{type} - , name_{name} + : name_{name} , default_value_{default_value} , is_variadic_{is_variadic} { + set_type(type); if (is_variadic) name_ = name_ + "..."; } -void class_template::set_type(const std::string &type) { type_ = type; } +void class_template::set_type(const std::string &type) { + type_ = type; + // TODO: Add a configurable mapping for simplifying non-interesting + // std templates + util::replace_all(type_, "std::basic_string", "std::string"); +} std::string class_template::type() const { return type_; } @@ -60,6 +65,11 @@ bool operator==(const class_template &l, const class_template &r) return (l.name() == r.name()) && (l.type() == r.type()); } +bool operator!=(const class_template &l, const class_template &r) +{ + return !(l == r); +} + std::string class_template::to_string( const clanguml::common::model::namespace_ &using_namespace) const { diff --git a/src/class_diagram/model/class_template.h b/src/class_diagram/model/class_template.h index 603443e4..36cf42d8 100644 --- a/src/class_diagram/model/class_template.h +++ b/src/class_diagram/model/class_template.h @@ -42,9 +42,17 @@ public: bool is_variadic() const noexcept; friend bool operator==(const class_template &l, const class_template &r); + friend bool operator!=(const class_template &l, const class_template &r); std::vector template_params_; + bool is_template_parameter() const { return is_template_parameter_; } + + void is_template_parameter(bool is_template_parameter) + { + is_template_parameter_ = is_template_parameter; + } + std::string to_string( const clanguml::common::model::namespace_ &using_namespace) const; @@ -52,6 +60,7 @@ private: std::string type_; std::string name_; std::string default_value_; + bool is_template_parameter_{false}; bool is_variadic_{false}; }; } diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index bba81ad8..26393398 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -200,8 +200,9 @@ void translation_unit_visitor::process_type_alias_template( const cppast::cpp_alias_template &at) { auto alias_kind = at.type_alias().underlying_type().kind(); + if (alias_kind == cppast::cpp_type_kind::unexposed_t) { - LOG_DBG("Template alias has unexposed underlying type: {}", + LOG_DBG("Template alias has unexposed underlying type - ignoring: {}", static_cast( at.type_alias().underlying_type()) .name()); @@ -209,9 +210,16 @@ void translation_unit_visitor::process_type_alias_template( else { if (at.type_alias().underlying_type().kind() == cppast::cpp_type_kind::template_instantiation_t) { + found_relationships_t nested_relationships; auto tinst = build_template_instantiation( static_cast( - resolve_alias(at.type_alias().underlying_type()))); + resolve_alias(at.type_alias().underlying_type())), + nested_relationships); + + tinst->is_alias(true); + + if (tinst->get_namespace().is_empty()) + tinst->set_namespace(ctx.get_namespace()); ctx.add_type_alias_template( cx::util::full_name(ctx.get_namespace(), at), @@ -708,10 +716,20 @@ bool translation_unit_visitor::process_field_with_template_instantiation( auto tr_unaliased_declaration = cppast::to_string(unaliased); std::unique_ptr tinst_ptr; - if (util::contains(tr_declaration, "<")) - tinst_ptr = build_template_instantiation(template_instantiation_type); + // if (util::contains(tr_declaration, "<")) + // tinst_ptr = build_template_instantiation(template_instantiation_type); + // auto t_canon = cppast::to_string(tr.canonical()); + //(void)t_canon; + // else + found_relationships_t nested_relationships; + if (tr_declaration == tr_unaliased_declaration) + tinst_ptr = + build_template_instantiation(unaliased, nested_relationships); else - tinst_ptr = build_template_instantiation(unaliased); + tinst_ptr = build_template_instantiation( + static_cast( + tr.canonical()), + nested_relationships); auto &tinst = *tinst_ptr; @@ -739,6 +757,8 @@ bool translation_unit_visitor::process_field_with_template_instantiation( } } + // Add instantiation relationship from the generated template instantiation + // of the field type to its primary template if (ctx.diagram().should_include(tinst.get_namespace(), tinst.name())) { LOG_DBG("Adding field instantiation relationship {} {} {} : {}", rr.destination(), clanguml::common::model::to_string(rr.type()), @@ -746,18 +766,20 @@ bool translation_unit_visitor::process_field_with_template_instantiation( c.add_relationship(std::move(rr)); - if (tr_declaration != tr_unaliased_declaration) { - // Add template instantiation/specialization relationship; - tinst.add_relationship( - {relationship_t::kInstantiation, tr_unaliased_declaration}); - } - res = true; LOG_DBG("Created template instantiation: {}", tinst.full_name()); ctx.diagram().add_class(std::move(tinst_ptr)); } + else if (!nested_relationships.empty()) { + for (const auto &rel : nested_relationships) { + c.add_relationship({relationship_type, std::get<0>(rel), + detail::cpp_access_specifier_to_access(as), mv.name()}); + } + + res = true; + } return res; } @@ -805,6 +827,8 @@ void translation_unit_visitor::process_field( process_field_with_template_instantiation(mv, tr, c, m, as); } else if (tr.kind() == cppast::cpp_type_kind::template_instantiation_t) { + // This can be either template instantiation or an alias template + // instantiation template_instantiation_added_as_aggregation = process_field_with_template_instantiation(mv, tr, c, m, as); } @@ -1203,9 +1227,10 @@ void translation_unit_visitor:: c.add_relationship(std::move(rr)); } else { + found_relationships_t nested_relationships; // First check if tinst already exists - auto tinst_ptr = - build_template_instantiation(template_instantiation_type); + auto tinst_ptr = build_template_instantiation( + template_instantiation_type, nested_relationships); auto &tinst = *tinst_ptr; relationship rr{relationship_t::kDependency, tinst.full_name()}; @@ -1539,6 +1564,7 @@ bool translation_unit_visitor::find_relationships_in_unexposed_template_params( std::unique_ptr translation_unit_visitor::build_template_instantiation( const cppast::cpp_template_instantiation_type &t, + found_relationships_t &nested_relationships, std::optional parent) { // Create class_ instance to hold the template instantiation @@ -1546,13 +1572,31 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( auto &tinst = *tinst_ptr; std::string full_template_name; + auto tr_declaration = cppast::to_string(t); + + // If this is an alias - resolve the alias target + const auto &unaliased = + static_cast( + resolve_alias(t)); + auto t_unaliased_declaration = cppast::to_string(unaliased); + + bool t_is_alias = t_unaliased_declaration != tr_declaration; + + // Here we'll hold the template base params to replace with the instantiated + // values std::deque> template_base_params{}; tinst.set_namespace(ctx.get_namespace()); auto tinst_full_name = cppast::to_string(t); + // Typically, every template instantiation should have a primary_template() + // which should also be generated here if it doesn't exist yet in the model + // However if this is a template alias, then it does not have a primary + // template if (t.primary_template().get(ctx.entity_index()).size()) { + auto size = t.primary_template().get(ctx.entity_index()).size(); + (void)size; build_template_instantiation_primary_template( t, tinst, template_base_params, parent, full_template_name); } @@ -1573,11 +1617,8 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( else tinst.set_namespace(ns); - if (tinst_full_name.find('<') != std::string::npos) { - tinst.set_name(tinst_full_name.substr(0, tinst_full_name.find('<'))); - } - tinst.is_template_instantiation(true); + tinst.is_alias(t_is_alias); if (tinst.full_name().substr(0, tinst.full_name().find('<')).find("::") == std::string::npos) { @@ -1596,7 +1637,7 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( class_template ct; if (targ.type()) { build_template_instantiation_process_type_argument( - parent, tinst, targ, ct); + parent, tinst, targ, ct, nested_relationships); } else if (targ.expression()) { build_template_instantiation_process_expression_argument( @@ -1631,8 +1672,43 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( destination = cppast::to_string(ctx.get_type_alias(fn).get()); } else { - // Otherwise point to the base template - destination = tinst.base_template(); + std::string tmp_destination{}; + + int best_match = 0; + // First try to find the best match for this template in partially + // specialized templates + for (const auto &c : ctx.diagram().classes()) { + if (c->name_and_ns() == full_template_name && + // TODO: handle variadic templates + c->templates().size() == tinst.templates().size()) { + int tmp_match = 0; + for (int i = 0; i < c->templates().size(); i++) { + const auto& tinst_i = tinst.templates().at(i); + const auto& c_i = c->templates().at(i); + if ((c_i == tinst_i) && !c_i.is_template_parameter()) { + tmp_match++; + } + else if(c_i.is_template_parameter() || tinst_i.is_template_parameter()) { + // continue + } + else { + // Non-free types are not compatible + tmp_match = 0; + break; + } + } + if (tmp_match > best_match) { + best_match = tmp_match; + tmp_destination = c->full_name(false); + } + } + } + + if (!tmp_destination.empty()) + destination = tmp_destination; + else + // Otherwise point to the base template + destination = tinst.base_template(); } relationship r{relationship_t::kInstantiation, destination}; tinst.add_relationship(std::move(r)); @@ -1691,7 +1767,7 @@ void translation_unit_visitor:: build_template_instantiation_process_type_argument( const std::optional &parent, class_ &tinst, const cppast::cpp_template_argument &targ, - class_template &ct) + class_template &ct, found_relationships_t &nested_relationships) { ct.set_type(cppast::to_string(targ.type().value())); @@ -1702,7 +1778,10 @@ void translation_unit_visitor:: auto [fn_ns, fn_name] = cx::util::split_ns(fn); - if (targ.type().value().kind() == + if(targ.type().value().kind() == cppast::cpp_type_kind::template_parameter_t) { + ct.is_template_parameter(true); + } + else if (targ.type().value().kind() == cppast::cpp_type_kind::template_instantiation_t) { const auto &nested_template_parameter = @@ -1716,18 +1795,23 @@ void translation_unit_visitor:: auto [tinst_ns, tinst_name] = cx::util::split_ns(tinst.full_name(false)); - auto nested_tinst = - build_template_instantiation(nested_template_parameter, - ctx.diagram().should_include(tinst_ns, tinst_name) - ? std::make_optional(&tinst) - : parent); + auto nested_tinst = build_template_instantiation( + nested_template_parameter, nested_relationships, + ctx.diagram().should_include(tinst_ns, tinst_name) + ? std::make_optional(&tinst) + : parent); relationship tinst_dependency{ relationship_t::kDependency, nested_tinst->full_name()}; - auto nested_tinst_full_name = nested_tinst->full_name(); + auto nested_tinst_full_name = nested_tinst->full_name(false); - if (ctx.diagram().should_include(fn_ns, fn_name)) { + auto [nested_tinst_ns, nested_tinst_name] = + cx::util::split_ns(nested_tinst_full_name); + + if (ctx.diagram().should_include(nested_tinst_ns, nested_tinst_name)) { + nested_relationships.push_back( + {nested_tinst->full_name(false), relationship_t::kAggregation}); ctx.diagram().add_class(std::move(nested_tinst)); } @@ -1769,6 +1853,8 @@ void translation_unit_visitor:: if (ctx.diagram().should_include(fn_ns, fn_name)) { tinst.add_relationship(std::move(tinst_dependency)); + nested_relationships.push_back( + {tinst_dependency.destination(), relationship_t::kAggregation}); } else if (parent) { (*parent)->add_relationship(std::move(tinst_dependency)); @@ -1870,9 +1956,17 @@ const cppast::cpp_type &translation_unit_visitor::resolve_alias( if (util::contains(type_full_name, "<")) type_full_name = util::split(type_full_name, "<")[0]; + auto type_full_name_in_current_ns = ctx.get_namespace(); + type_full_name_in_current_ns |= common::model::namespace_{type_full_name}; + if (ctx.has_type_alias_template(type_full_name)) { return ctx.get_type_alias(type_full_name).get(); } + else if (ctx.has_type_alias_template( + type_full_name_in_current_ns.to_string())) { + return ctx.get_type_alias(type_full_name_in_current_ns.to_string()) + .get(); + } else if (ctx.has_type_alias(type_full_name)) { return ctx.get_type_alias_final(raw_type).get(); } diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 1a7fcf6d..3a9b4213 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -163,8 +163,15 @@ private: std::unique_ptr build_template_instantiation( const cppast::cpp_template_instantiation_type &t, + found_relationships_t &relationships, std::optional parent = {}); + // std::vector> + std::unique_ptr + build_alias_template_instantiation( + const cppast::cpp_template_instantiation_type &alias_templ, + std::optional parent); + /** * Try to resolve a type instance into a type referenced through an alias. * If t does not represent an alias, returns t. @@ -208,7 +215,7 @@ private: void build_template_instantiation_process_type_argument( const std::optional &parent, model::class_ &tinst, const cppast::cpp_template_argument &targ, - model::class_template &ct); + model::class_template &ct, found_relationships_t &relationships); void build_template_instantiation_process_expression_argument( const cppast::cpp_template_argument &targ, diff --git a/src/common/generators/plantuml/generator.cc b/src/common/generators/plantuml/generator.cc index eea26a9c..b10fd4c4 100644 --- a/src/common/generators/plantuml/generator.cc +++ b/src/common/generators/plantuml/generator.cc @@ -37,6 +37,8 @@ std::string to_plantuml(relationship_t r, std::string style) return style.empty() ? "<.." : fmt::format("<.[{}].", style); case relationship_t::kDependency: return style.empty() ? "..>" : fmt::format(".[{}].>", style); + case relationship_t::kAlias: + return style.empty() ? ".." : fmt::format(".[{}].", style); default: return ""; } diff --git a/src/common/model/enums.cc b/src/common/model/enums.cc index 218844b9..d6fdce79 100644 --- a/src/common/model/enums.cc +++ b/src/common/model/enums.cc @@ -44,6 +44,8 @@ std::string to_string(relationship_t r) return "friendship"; case relationship_t::kDependency: return "dependency"; + case relationship_t::kAlias: + return "alias"; default: assert(false); } diff --git a/src/common/model/enums.h b/src/common/model/enums.h index 7c2501c2..e9c3cd2e 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -35,6 +35,7 @@ enum class relationship_t { kAssociation, kInstantiation, kFriendship, + kAlias, kDependency }; diff --git a/src/cx/util.cc b/src/cx/util.cc index 40f0ad71..c589f0e7 100644 --- a/src/cx/util.cc +++ b/src/cx/util.cc @@ -162,8 +162,9 @@ std::string ns(const cppast::cpp_type &t, const cppast::cpp_entity_index &idx) .get(idx)[0] .get()); } - else - return ""; + else { + return {}; + } } else { auto canon = cppast::to_string(t.canonical()); diff --git a/tests/t00014/t00014.cc b/tests/t00014/t00014.cc index a1e3824a..8b13a7b2 100644 --- a/tests/t00014/t00014.cc +++ b/tests/t00014/t00014.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,13 @@ template struct A { }; template using AString = A; +template using AStringPtr = A>; + +template using VectorPtr = std::unique_ptr>; +template using APtr = std::unique_ptr>; +template using ASharedPtr = std::shared_ptr>; + template using AAPtr = + std::unique_ptr, A>>; template using GeneralCallback = std::function; using VoidCallback = GeneralCallback<>; @@ -42,12 +50,19 @@ using AIntString = AString; using AStringString = AString; using BStringString = AStringString; +template using PairPairBA = std::pair>, long>; + class R { - // clang-uml: tinst A + PairPairBA bapair; + + APtr abool; + AAPtr aboolfloat; + ASharedPtr afloat; A boolstring; - AString floatstring; + AStringPtr floatstring; AIntString intstring; AStringString stringstring; + BStringString bstringstring; protected: BVector bs; @@ -56,6 +71,7 @@ public: BVector2 bs2; GeneralCallback cb; VoidCallback vcb; + VectorPtr vps; }; } } diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index 70a414af..6e9790e5 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -36,31 +36,53 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::unique_ptr")); + REQUIRE_THAT(puml, IsClassTemplate("A", "double,T")); + REQUIRE_THAT(puml, IsClassTemplate("A", "long,U")); + REQUIRE_THAT(puml, IsClassTemplate("A", "long,T")); + REQUIRE_THAT(puml, IsClassTemplate("A", "long,bool")); + REQUIRE_THAT(puml, IsClassTemplate("A", "double,bool")); + REQUIRE_THAT(puml, IsClassTemplate("A", "long,float")); + REQUIRE_THAT(puml, IsClassTemplate("A", "double,float")); REQUIRE_THAT(puml, IsClassTemplate("A", "bool,std::string")); - REQUIRE_THAT(puml, IsClassTemplate("AString", "float")); - REQUIRE_THAT(puml, IsClassTemplate("AString", "int")); - REQUIRE_THAT(puml, IsClassTemplate("AString", "std::string")); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT( puml, !IsClassTemplate("std::std::function", "void(T...,int),int)")); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("AString"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("AString"))); - REQUIRE_THAT( - puml, !IsInstantiation(_A("AString"), _A("AString"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("A"), _A("AString"))); - REQUIRE_THAT(puml, - !IsInstantiation( - _A("AString"), _A("AString"))); - REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); - REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("AString"), "-floatstring")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "#bs")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+bs2")); +// REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); +// REQUIRE_THAT( +// puml, IsInstantiation(_A("A"), _A("AString"))); +// REQUIRE_THAT( +// puml, IsInstantiation(_A("A"), _A("AString"))); +// REQUIRE_THAT( +// puml, !IsInstantiation(_A("AString"), _A("AString"))); +// REQUIRE_THAT(puml, +// IsInstantiation(_A("A"), _A("AString"))); +// REQUIRE_THAT( +// puml, IsInstantiation(_A("A"), _A("A"))); +// +// REQUIRE_THAT(puml, +// !IsInstantiation( +// _A("AString"), _A("AString"))); + + + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vps")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair")); + +// REQUIRE_THAT( +// puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); +// +// +// +// REQUIRE_THAT( +// puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); +// REQUIRE_THAT( +// puml, IsAggregation(_A("R"), _A("AString"), "-floatstring")); +// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "#bs")); +// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+bs2")); +// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vsp")); +// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+bvsp")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From f264d71d3ba7f5cff6c23e9ba11dd1d0dd0b4615 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 5 May 2022 21:02:10 +0200 Subject: [PATCH 03/19] Updated test cases after refactoring template alias generation --- .../visitor/translation_unit_visitor.cc | 69 ++++++++++++------- .../visitor/translation_unit_visitor.h | 14 ++-- tests/t00014/test_case.h | 60 ++++++++-------- 3 files changed, 83 insertions(+), 60 deletions(-) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 26393398..6f14a5a4 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -716,20 +716,24 @@ bool translation_unit_visitor::process_field_with_template_instantiation( auto tr_unaliased_declaration = cppast::to_string(unaliased); std::unique_ptr tinst_ptr; - // if (util::contains(tr_declaration, "<")) - // tinst_ptr = build_template_instantiation(template_instantiation_type); - // auto t_canon = cppast::to_string(tr.canonical()); - //(void)t_canon; - // else + relationship_t nested_relationship_hint = relationship_t::kAggregation; + + if (tr_unaliased_declaration.find("std::shared_ptr") == 0) { + nested_relationship_hint = relationship_t::kAssociation; + } + else if (tr_unaliased_declaration.find("std::weak_ptr") == 0) { + nested_relationship_hint = relationship_t::kAssociation; + } + found_relationships_t nested_relationships; if (tr_declaration == tr_unaliased_declaration) - tinst_ptr = - build_template_instantiation(unaliased, nested_relationships); + tinst_ptr = build_template_instantiation( + unaliased, nested_relationships, nested_relationship_hint); else tinst_ptr = build_template_instantiation( static_cast( tr.canonical()), - nested_relationships); + nested_relationships, nested_relationship_hint); auto &tinst = *tinst_ptr; @@ -774,8 +778,18 @@ bool translation_unit_visitor::process_field_with_template_instantiation( } else if (!nested_relationships.empty()) { for (const auto &rel : nested_relationships) { - c.add_relationship({relationship_type, std::get<0>(rel), - detail::cpp_access_specifier_to_access(as), mv.name()}); + relationship nested_relationship{std::get<1>(rel), std::get<0>(rel), + detail::cpp_access_specifier_to_access(as), mv.name()}; + nested_relationship.set_style(m.style_spec()); + if (decorator_rtype != relationship_t::kNone) { + nested_relationship.set_type(decorator_rtype); + auto mult = util::split(decorator_rmult, ":"); + if (mult.size() == 2) { + nested_relationship.set_multiplicity_source(mult[0]); + nested_relationship.set_multiplicity_destination(mult[1]); + } + } + c.add_relationship(std::move(nested_relationship)); } res = true; @@ -838,12 +852,16 @@ void translation_unit_visitor::process_field( // TODO } + // Try to find relationships in the type of the member, unless it has + // been already added as part of template processing or it is marked + // to be skipped in the comment if (!m.skip_relationship() && !template_instantiation_added_as_aggregation && (tr.kind() != cppast::cpp_type_kind::builtin_t) && (tr.kind() != cppast::cpp_type_kind::template_parameter_t)) { const auto &ttt = resolve_alias(mv.type()); - std::vector> relationships; + + found_relationships_t relationships; auto found = find_relationships(ttt, relationships); for (const auto &[type, relationship_type] : relationships) { @@ -1565,6 +1583,7 @@ bool translation_unit_visitor::find_relationships_in_unexposed_template_params( std::unique_ptr translation_unit_visitor::build_template_instantiation( const cppast::cpp_template_instantiation_type &t, found_relationships_t &nested_relationships, + relationship_t nested_relationship_hint, std::optional parent) { // Create class_ instance to hold the template instantiation @@ -1592,8 +1611,6 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( // Typically, every template instantiation should have a primary_template() // which should also be generated here if it doesn't exist yet in the model - // However if this is a template alias, then it does not have a primary - // template if (t.primary_template().get(ctx.entity_index()).size()) { auto size = t.primary_template().get(ctx.entity_index()).size(); (void)size; @@ -1601,7 +1618,7 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( t, tinst, template_base_params, parent, full_template_name); } else { - LOG_DBG("Template instantiation {} has no primary template", + LOG_DBG("Template instantiation {} has no primary template?", cppast::to_string(t)); full_template_name = cppast::to_string(t); @@ -1636,8 +1653,9 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( for (const auto &targ : t.arguments().value()) { class_template ct; if (targ.type()) { - build_template_instantiation_process_type_argument( - parent, tinst, targ, ct, nested_relationships); + build_template_instantiation_process_type_argument(parent, + tinst, targ, ct, nested_relationships, + nested_relationship_hint); } else if (targ.expression()) { build_template_instantiation_process_expression_argument( @@ -1683,12 +1701,13 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( c->templates().size() == tinst.templates().size()) { int tmp_match = 0; for (int i = 0; i < c->templates().size(); i++) { - const auto& tinst_i = tinst.templates().at(i); - const auto& c_i = c->templates().at(i); + const auto &tinst_i = tinst.templates().at(i); + const auto &c_i = c->templates().at(i); if ((c_i == tinst_i) && !c_i.is_template_parameter()) { tmp_match++; } - else if(c_i.is_template_parameter() || tinst_i.is_template_parameter()) { + else if (c_i.is_template_parameter() || + tinst_i.is_template_parameter()) { // continue } else { @@ -1767,7 +1786,8 @@ void translation_unit_visitor:: build_template_instantiation_process_type_argument( const std::optional &parent, class_ &tinst, const cppast::cpp_template_argument &targ, - class_template &ct, found_relationships_t &nested_relationships) + class_template &ct, found_relationships_t &nested_relationships, + common::model::relationship_t relationship_hint) { ct.set_type(cppast::to_string(targ.type().value())); @@ -1778,7 +1798,8 @@ void translation_unit_visitor:: auto [fn_ns, fn_name] = cx::util::split_ns(fn); - if(targ.type().value().kind() == cppast::cpp_type_kind::template_parameter_t) { + if (targ.type().value().kind() == + cppast::cpp_type_kind::template_parameter_t) { ct.is_template_parameter(true); } else if (targ.type().value().kind() == @@ -1796,7 +1817,7 @@ void translation_unit_visitor:: cx::util::split_ns(tinst.full_name(false)); auto nested_tinst = build_template_instantiation( - nested_template_parameter, nested_relationships, + nested_template_parameter, nested_relationships, relationship_hint, ctx.diagram().should_include(tinst_ns, tinst_name) ? std::make_optional(&tinst) : parent); @@ -1811,7 +1832,7 @@ void translation_unit_visitor:: if (ctx.diagram().should_include(nested_tinst_ns, nested_tinst_name)) { nested_relationships.push_back( - {nested_tinst->full_name(false), relationship_t::kAggregation}); + {nested_tinst->full_name(false), relationship_hint}); ctx.diagram().add_class(std::move(nested_tinst)); } @@ -1854,7 +1875,7 @@ void translation_unit_visitor:: if (ctx.diagram().should_include(fn_ns, fn_name)) { tinst.add_relationship(std::move(tinst_dependency)); nested_relationships.push_back( - {tinst_dependency.destination(), relationship_t::kAggregation}); + {tinst_dependency.destination(), relationship_hint}); } else if (parent) { (*parent)->add_relationship(std::move(tinst_dependency)); diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 3a9b4213..56195fee 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -19,6 +19,7 @@ #include "class_diagram/model/diagram.h" #include "class_diagram/visitor/translation_unit_context.h" +#include "common/model/enums.h" #include "config/config.h" #include @@ -164,14 +165,10 @@ private: build_template_instantiation( const cppast::cpp_template_instantiation_type &t, found_relationships_t &relationships, + common::model::relationship_t nested_relationship_hint = + common::model::relationship_t::kAggregation, std::optional parent = {}); - // std::vector> - std::unique_ptr - build_alias_template_instantiation( - const cppast::cpp_template_instantiation_type &alias_templ, - std::optional parent); - /** * Try to resolve a type instance into a type referenced through an alias. * If t does not represent an alias, returns t. @@ -215,7 +212,10 @@ private: void build_template_instantiation_process_type_argument( const std::optional &parent, model::class_ &tinst, const cppast::cpp_template_argument &targ, - model::class_template &ct, found_relationships_t &relationships); + class_diagram::model::class_template &ct, + found_relationships_t &relationships, + common::model::relationship_t relationship_hint = + common::model::relationship_t::kAggregation); void build_template_instantiation_process_expression_argument( const cppast::cpp_template_argument &targ, diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index 6e9790e5..2530148d 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -50,39 +50,41 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE_THAT( puml, !IsClassTemplate("std::std::function", "void(T...,int),int)")); -// REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); -// REQUIRE_THAT( -// puml, IsInstantiation(_A("A"), _A("AString"))); -// REQUIRE_THAT( -// puml, IsInstantiation(_A("A"), _A("AString"))); -// REQUIRE_THAT( -// puml, !IsInstantiation(_A("AString"), _A("AString"))); -// REQUIRE_THAT(puml, -// IsInstantiation(_A("A"), _A("AString"))); -// REQUIRE_THAT( -// puml, IsInstantiation(_A("A"), _A("A"))); -// -// REQUIRE_THAT(puml, -// !IsInstantiation( -// _A("AString"), _A("AString"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + // TODO: Fix matching partial template specializations with differently + // named template paremeters + // REQUIRE_THAT( + // puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("A>"), + _A("A>"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("A"), _A("A>"))); REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vps")); REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair")); - -// REQUIRE_THAT( -// puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); -// -// -// -// REQUIRE_THAT( -// puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); -// REQUIRE_THAT( -// puml, IsAggregation(_A("R"), _A("AString"), "-floatstring")); -// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "#bs")); -// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+bs2")); -// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vsp")); -// REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+bvsp")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "-bapair")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "-afloat")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); + REQUIRE_THAT(puml, + IsAggregation(_A("R"), _A("A>"), + "-floatstring")); save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); From f5d80e90a39a1c677f70a6ee62440906049681c7 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 7 May 2022 19:59:13 +0200 Subject: [PATCH 04/19] Fixed class template handling --- .../plantuml/class_diagram_generator.cc | 2 +- src/class_diagram/model/class.cc | 4 +- src/class_diagram/model/class_template.cc | 56 ++++++++++--- src/class_diagram/model/class_template.h | 31 ++++++- src/class_diagram/model/diagram.cc | 39 +++++---- .../visitor/translation_unit_visitor.cc | 83 ++++++++++++------- src/common/model/nested_trait.h | 4 +- src/common/model/path.h | 2 +- tests/t00014/t00014.cc | 31 +++---- tests/t00014/test_case.h | 12 +-- tests/t00027/test_case.h | 12 +-- 11 files changed, 185 insertions(+), 91 deletions(-) diff --git a/src/class_diagram/generators/plantuml/class_diagram_generator.cc b/src/class_diagram/generators/plantuml/class_diagram_generator.cc index 290eb540..ff04e5c0 100644 --- a/src/class_diagram/generators/plantuml/class_diagram_generator.cc +++ b/src/class_diagram/generators/plantuml/class_diagram_generator.cc @@ -64,7 +64,7 @@ void generator::generate_alias(const class_ &c, std::ostream &ostr) const else full_name = c.full_name(); - //util::replace_all(full_name, "std::basic_string", "std::string"); + // util::replace_all(full_name, "std::basic_string", "std::string"); if (full_name.empty()) full_name = "<>"; diff --git a/src/class_diagram/model/class.cc b/src/class_diagram/model/class.cc index f295118c..dc2baeae 100644 --- a/src/class_diagram/model/class.cc +++ b/src/class_diagram/model/class.cc @@ -87,7 +87,8 @@ std::string class_::base_template() const { return base_template_full_name_; } bool operator==(const class_ &l, const class_ &r) { - return l.full_name() == r.full_name(); + return (l.name_and_ns() == r.name_and_ns()) && + (l.templates_ == r.templates_); } void class_::add_type_alias(type_alias &&ta) @@ -148,6 +149,7 @@ std::ostringstream &class_::render_template_params( ostr << fmt::format("<{}>", fmt::join(tnames, ",")); } + return ostr; } diff --git a/src/class_diagram/model/class_template.cc b/src/class_diagram/model/class_template.cc index bb0d1a1f..a1494852 100644 --- a/src/class_diagram/model/class_template.cc +++ b/src/class_diagram/model/class_template.cc @@ -24,27 +24,33 @@ namespace clanguml::class_diagram::model { class_template::class_template(const std::string &type, const std::string &name, const std::string &default_value, bool is_variadic) - : name_{name} - , default_value_{default_value} + : default_value_{default_value} , is_variadic_{is_variadic} { + set_name(name); set_type(type); - if (is_variadic) - name_ = name_ + "..."; } -void class_template::set_type(const std::string &type) { - type_ = type; - // TODO: Add a configurable mapping for simplifying non-interesting - // std templates - util::replace_all(type_, "std::basic_string", "std::string"); -} +void class_template::set_type(const std::string &type) { type_ = type; } std::string class_template::type() const { return type_; } -void class_template::set_name(const std::string &name) { name_ = name; } +void class_template::set_name(const std::string &name) +{ + name_ = name; + // TODO: Add a configurable mapping for simplifying non-interesting + // std templates + util::replace_all(name_, "std::basic_string", "std::string"); + util::replace_all(name_, "std::basic_string", "std::wstring"); +} -std::string class_template::name() const { return name_; } +std::string class_template::name() const +{ + if (is_variadic_) + return name_ + "..."; + + return name_; +} void class_template::set_default_value(const std::string &value) { @@ -60,9 +66,33 @@ void class_template::is_variadic(bool is_variadic) noexcept bool class_template::is_variadic() const noexcept { return is_variadic_; } +bool class_template::is_specialization_of(const class_template &ct) const +{ + if ((ct.is_template_parameter() || ct.is_template_template_parameter()) && + !is_template_parameter()) + return true; + + return false; +} + bool operator==(const class_template &l, const class_template &r) { - return (l.name() == r.name()) && (l.type() == r.type()); + bool res{false}; + + if (l.is_template_parameter() != r.is_template_parameter()) + return res; + + if (l.is_template_parameter()) { + // If this is a template parameter (e.g. 'typename T' or 'typename U' + // we don't actually care what it is called + res = (l.is_variadic() == r.is_variadic()) && + (l.default_value() == r.default_value()); + } + else + res = (l.name() == r.name()) && (l.type() == r.type()) && + (l.default_value() == r.default_value()); + + return res && (l.template_params_ == r.template_params_); } bool operator!=(const class_template &l, const class_template &r) diff --git a/src/class_diagram/model/class_template.h b/src/class_diagram/model/class_template.h index 36cf42d8..0a014c80 100644 --- a/src/class_diagram/model/class_template.h +++ b/src/class_diagram/model/class_template.h @@ -41,11 +41,11 @@ public: void is_variadic(bool is_variadic) noexcept; bool is_variadic() const noexcept; + bool is_specialization_of(const class_template &ct) const; + friend bool operator==(const class_template &l, const class_template &r); friend bool operator!=(const class_template &l, const class_template &r); - std::vector template_params_; - bool is_template_parameter() const { return is_template_parameter_; } void is_template_parameter(bool is_template_parameter) @@ -53,14 +53,41 @@ public: is_template_parameter_ = is_template_parameter; } + bool is_template_template_parameter() const + { + return is_template_template_parameter_; + } + + void is_template_template_parameter(bool is_template_template_parameter) + { + is_template_template_parameter_ = is_template_template_parameter; + } + std::string to_string( const clanguml::common::model::namespace_ &using_namespace) const; + std::vector template_params_; + private: + /// Represents the type of non-type template parameters + /// e.g. 'int' std::string type_; + + /// The name of the parameter (e.g. 'T' or 'N') std::string name_; + + /// Default value of the template parameter std::string default_value_; + + /// Whether the template parameter is a regular template parameter + /// When false, it is a non-type template parameter bool is_template_parameter_{false}; + + /// Whether the template parameter is a template template parameter + /// Can only be true when is_template_parameter_ is true + bool is_template_template_parameter_{false}; + + /// Whether the template parameter is variadic bool is_variadic_{false}; }; } diff --git a/src/class_diagram/model/diagram.cc b/src/class_diagram/model/diagram.cc index 527f6bac..e964244c 100644 --- a/src/class_diagram/model/diagram.cc +++ b/src/class_diagram/model/diagram.cc @@ -58,7 +58,7 @@ diagram::get(const std::string &full_name) const bool diagram::has_class(const class_ &c) const { return std::any_of(classes_.cbegin(), classes_.cend(), - [&c](const auto &cc) { return cc.get().full_name() == c.full_name(); }); + [&c](const auto &cc) { return cc.get() == c; }); } bool diagram::has_enum(const enum_ &e) const @@ -109,30 +109,37 @@ void diagram::add_package(std::unique_ptr &&p) void diagram::add_class(std::unique_ptr &&c) { + const auto base_name = c->name(); + const auto full_name = c->full_name(false); + LOG_DBG("Adding class: {}::{}, {}", c->get_namespace().to_string(), - c->name(), c->full_name()); + base_name, full_name); - if (util::contains(c->name(), "::")) - throw std::runtime_error("Name cannot contain namespace: " + c->name()); + if (util::contains(base_name, "::")) + throw std::runtime_error("Name cannot contain namespace: " + base_name); - if (util::contains(c->name(), "<")) - throw std::runtime_error("Name cannot contain <: " + c->name()); + if (util::contains(base_name, "<")) + throw std::runtime_error("Name cannot contain <: " + base_name); - if (util::contains(c->name(), "*")) - throw std::runtime_error("Name cannot contain *: " + c->name()); + if (util::contains(base_name, "*")) + throw std::runtime_error("Name cannot contain *: " + base_name); + + const auto ns = c->get_relative_namespace(); + auto name = base_name; + auto name_with_ns = c->name_and_ns(); + auto name_and_ns = ns | name; if (!has_class(*c)) { - classes_.emplace_back(*c); - auto ns = c->get_relative_namespace(); - auto name = c->name(); + classes_.push_back(type_safe::ref(*c)); + add_element(ns, std::move(c)); - ns |= name; - const auto ccc = get_element(ns); - assert(ccc.value().name() == name); + + const auto &el = get_element(name_and_ns).value(); + assert(el.name() == name); + assert(el.get_relative_namespace() == ns); } else - LOG_DBG( - "Class {} ({}) already in the model", c->name(), c->full_name()); + LOG_DBG("Class {} ({}) already in the model", base_name, full_name); } void diagram::add_enum(std::unique_ptr &&e) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 6f14a5a4..e3c00faf 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -216,6 +216,8 @@ void translation_unit_visitor::process_type_alias_template( resolve_alias(at.type_alias().underlying_type())), nested_relationships); + assert(tinst); + tinst->is_alias(true); if (tinst->get_namespace().is_empty()) @@ -774,6 +776,8 @@ bool translation_unit_visitor::process_field_with_template_instantiation( LOG_DBG("Created template instantiation: {}", tinst.full_name()); + assert(tinst_ptr); + ctx.diagram().add_class(std::move(tinst_ptr)); } else if (!nested_relationships.empty()) { @@ -1249,7 +1253,7 @@ void translation_unit_visitor:: // First check if tinst already exists auto tinst_ptr = build_template_instantiation( template_instantiation_type, nested_relationships); - auto &tinst = *tinst_ptr; + const auto &tinst = *tinst_ptr; relationship rr{relationship_t::kDependency, tinst.full_name()}; LOG_DBG("Adding field dependency relationship {} {} {} " @@ -1259,7 +1263,7 @@ void translation_unit_visitor:: c.add_relationship(std::move(rr)); - if (ctx.diagram().should_include(c)) + if (ctx.diagram().should_include(tinst)) ctx.diagram().add_class(std::move(tinst_ptr)); } } @@ -1268,20 +1272,40 @@ void translation_unit_visitor:: void translation_unit_visitor::process_template_type_parameter( const cppast::cpp_template_type_parameter &t, class_ &parent) { - parent.add_template({"", t.name(), "", t.is_variadic()}); + class_template ct; + ct.set_type(""); + ct.is_template_parameter(true); + ct.set_name(t.name()); + ct.set_default_value(""); + ct.is_variadic(t.is_variadic()); + + parent.add_template(std::move(ct)); } void translation_unit_visitor::process_template_nontype_parameter( const cppast::cpp_non_type_template_parameter &t, class_ &parent) { - parent.add_template( - {cppast::to_string(t.type()), t.name(), "", t.is_variadic()}); + class_template ct; + ct.set_type(cppast::to_string(t.type())); + ct.is_template_parameter(false); + ct.set_name(t.name()); + ct.set_default_value(""); + ct.is_variadic(t.is_variadic()); + + parent.add_template(std::move(ct)); } void translation_unit_visitor::process_template_template_parameter( const cppast::cpp_template_template_parameter &t, class_ &parent) { - parent.add_template({"", t.name() + "<>"}); + class_template ct; + ct.set_type(""); + ct.is_template_template_parameter(true); + ct.set_name(t.name() + "<>"); + ct.set_default_value(""); + ct.is_variadic(t.is_variadic()); + + parent.add_template(std::move(ct)); } void translation_unit_visitor::process_friend(const cppast::cpp_friend &f, @@ -1637,11 +1661,6 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( tinst.is_template_instantiation(true); tinst.is_alias(t_is_alias); - if (tinst.full_name().substr(0, tinst.full_name().find('<')).find("::") == - std::string::npos) { - tinst.set_name(name); - } - if (t.arguments_exposed()) { auto arg_index = 0U; // We can figure this only when we encounter variadic param in @@ -1671,7 +1690,7 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( ct); } - LOG_DBG("Adding template argument '{}'", ct.type()); + LOG_DBG("Adding template argument '{}'", ct.name()); tinst.add_template(std::move(ct)); } @@ -1695,23 +1714,21 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( int best_match = 0; // First try to find the best match for this template in partially // specialized templates - for (const auto &c : ctx.diagram().classes()) { + for (const auto c : ctx.diagram().classes()) { if (c->name_and_ns() == full_template_name && // TODO: handle variadic templates c->templates().size() == tinst.templates().size()) { int tmp_match = 0; - for (int i = 0; i < c->templates().size(); i++) { + for (int i = 0; i < tinst.templates().size(); i++) { const auto &tinst_i = tinst.templates().at(i); const auto &c_i = c->templates().at(i); - if ((c_i == tinst_i) && !c_i.is_template_parameter()) { + if (c_i == tinst_i) { tmp_match++; } - else if (c_i.is_template_parameter() || - tinst_i.is_template_parameter()) { - // continue + else if (tinst_i.is_specialization_of(c_i)) { + continue; } else { - // Non-free types are not compatible tmp_match = 0; break; } @@ -1754,11 +1771,11 @@ bool translation_unit_visitor::build_template_instantiation_add_base_classes( } if (add_template_argument_as_base_class) { - LOG_DBG("Adding template argument as base class '{}'", ct.type()); + LOG_DBG("Adding template argument as base class '{}'", ct.name()); class_parent cp; cp.set_access(access_t::kPublic); - cp.set_name(ct.type()); + cp.set_name(ct.name()); tinst.add_parent(std::move(cp)); } @@ -1779,7 +1796,7 @@ void translation_unit_visitor:: .expression() .as_string()); - LOG_DBG("Template argument is an expression {}", ct.type()); + LOG_DBG("Template argument is an expression {}", ct.name()); } void translation_unit_visitor:: @@ -1789,20 +1806,29 @@ void translation_unit_visitor:: class_template &ct, found_relationships_t &nested_relationships, common::model::relationship_t relationship_hint) { - ct.set_type(cppast::to_string(targ.type().value())); + ct.set_name(cppast::to_string(targ.type().value())); - LOG_DBG("Template argument is a type {}", ct.type()); + LOG_DBG("Template argument is a type {}", ct.name()); auto fn = cx::util::full_name( cppast::remove_cv(cx::util::unreferenced(targ.type().value())), ctx.entity_index(), false); auto [fn_ns, fn_name] = cx::util::split_ns(fn); + auto template_argument_kind = targ.type().value().kind(); - if (targ.type().value().kind() == + if (template_argument_kind == cppast::cpp_type_kind::unexposed_t) { + // Here we're on our own - just make a best guess + if (!fn.empty() && !util::contains(fn, "<") && + !util::contains(fn, ":") && std::isupper(fn.at(0))) + ct.is_template_parameter(true); + else + ct.is_template_parameter(false); + } + else if (template_argument_kind == cppast::cpp_type_kind::template_parameter_t) { ct.is_template_parameter(true); } - else if (targ.type().value().kind() == + else if (template_argument_kind == cppast::cpp_type_kind::template_instantiation_t) { const auto &nested_template_parameter = @@ -1822,6 +1848,8 @@ void translation_unit_visitor:: ? std::make_optional(&tinst) : parent); + assert(nested_tinst); + relationship tinst_dependency{ relationship_t::kDependency, nested_tinst->full_name()}; @@ -1861,8 +1889,7 @@ void translation_unit_visitor:: fn, tinst.full_name(), tinst_dependency.destination()); } } - else if (targ.type().value().kind() == - cppast::cpp_type_kind::user_defined_t) { + else if (template_argument_kind == cppast::cpp_type_kind::user_defined_t) { relationship tinst_dependency{relationship_t::kDependency, cx::util::full_name( cppast::remove_cv(cx::util::unreferenced(targ.type().value())), diff --git a/src/common/model/nested_trait.h b/src/common/model/nested_trait.h index 8894d4e1..b4e79cfe 100644 --- a/src/common/model/nested_trait.h +++ b/src/common/model/nested_trait.h @@ -56,8 +56,8 @@ public: { assert(p); - LOG_DBG( - "Adding nested element {} at path {}", p->name(), path.to_string()); + LOG_DBG("Adding nested element {} at path '{}'", p->name(), + path.to_string()); if (path.is_empty()) { add_element(std::move(p)); diff --git a/src/common/model/path.h b/src/common/model/path.h index 555b5085..44571bb3 100644 --- a/src/common/model/path.h +++ b/src/common/model/path.h @@ -39,7 +39,7 @@ public: std::copy(begin, end, std::back_inserter(path_)); } - path(const path &right) noexcept = default; + path(const path &right) { path_ = right.path_; } path &operator=(const path &right) noexcept = default; diff --git a/tests/t00014/t00014.cc b/tests/t00014/t00014.cc index 8b13a7b2..18929c44 100644 --- a/tests/t00014/t00014.cc +++ b/tests/t00014/t00014.cc @@ -27,22 +27,25 @@ template struct A { P p; }; -template using AString = A; -template using AStringPtr = A>; - -template using VectorPtr = std::unique_ptr>; -template using APtr = std::unique_ptr>; -template using ASharedPtr = std::shared_ptr>; - template using AAPtr = - std::unique_ptr, A>>; - -template using GeneralCallback = std::function; -using VoidCallback = GeneralCallback<>; - struct B { std::string value; }; +template using AString = A; +template using AStringPtr = A>; + +template +using PairPairBA = std::pair>, long>; + +template using VectorPtr = std::unique_ptr>; +template using APtr = std::unique_ptr>; +template using ASharedPtr = std::shared_ptr>; +template +using AAPtr = std::unique_ptr, A>>; + +template using GeneralCallback = std::function; +using VoidCallback = GeneralCallback<>; + using BVector = std::vector; using BVector2 = BVector; @@ -50,13 +53,11 @@ using AIntString = AString; using AStringString = AString; using BStringString = AStringString; -template using PairPairBA = std::pair>, long>; - class R { PairPairBA bapair; APtr abool; - AAPtr aboolfloat; + AAPtr aboolfloat; ASharedPtr afloat; A boolstring; AStringPtr floatstring; diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index 2530148d..e7dc0533 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -38,7 +38,7 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string")); REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::unique_ptr")); REQUIRE_THAT(puml, IsClassTemplate("A", "double,T")); - REQUIRE_THAT(puml, IsClassTemplate("A", "long,U")); + REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U")); REQUIRE_THAT(puml, IsClassTemplate("A", "long,T")); REQUIRE_THAT(puml, IsClassTemplate("A", "long,bool")); REQUIRE_THAT(puml, IsClassTemplate("A", "double,bool")); @@ -53,10 +53,9 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - // TODO: Fix matching partial template specializations with differently - // named template paremeters - // REQUIRE_THAT( - // puml, IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, !IsInstantiation(_A("A"), _A("A"))); REQUIRE_THAT( puml, IsInstantiation(_A("A"), _A("A"))); REQUIRE_THAT( @@ -79,7 +78,8 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "-bapair")); REQUIRE_THAT( puml, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "-afloat")); + REQUIRE_THAT( + puml, IsAssociation(_A("R"), _A("A"), "-afloat")); REQUIRE_THAT( puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); REQUIRE_THAT(puml, diff --git a/tests/t00027/test_case.h b/tests/t00027/test_case.h index f073b50b..0fd2e9ff 100644 --- a/tests/t00027/test_case.h +++ b/tests/t00027/test_case.h @@ -36,14 +36,14 @@ TEST_CASE("t00027", "[test-case][class]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); REQUIRE_THAT(puml, IsAbstractClass(_A("Shape"))); REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator"))); - REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>")); - REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>")); - REQUIRE_THAT(puml, IsInstantiation(_A("Line>"), _A("Line"))); + REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>...")); + REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>...")); + REQUIRE_THAT(puml, IsInstantiation(_A("Line...>"), _A("Line"))); REQUIRE_THAT( - puml, IsInstantiation(_A("Line>"), _A("Line"))); - REQUIRE_THAT(puml, IsInstantiation(_A("Text>"), _A("Text"))); + puml, IsInstantiation(_A("Line...>"), _A("Line"))); + REQUIRE_THAT(puml, IsInstantiation(_A("Text...>"), _A("Text"))); REQUIRE_THAT( - puml, IsInstantiation(_A("Text>"), _A("Text"))); + puml, IsInstantiation(_A("Text...>"), _A("Text"))); REQUIRE_THAT( puml, IsAggregation(_A("Window"), _A("Line"), "+border")); From 7b98cfb4bab6ec336c8656d07178f5e5a941db86 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 7 May 2022 20:04:48 +0200 Subject: [PATCH 05/19] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 68 ++--- docs/test_cases/t00003_class.svg | 139 +++++------ docs/test_cases/t00004_class.svg | 26 +- 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 | 64 ++--- docs/test_cases/t00009_class.svg | 32 +-- docs/test_cases/t00010_class.svg | 34 +-- docs/test_cases/t00011_class.svg | 30 +-- docs/test_cases/t00012_class.svg | 66 ++--- docs/test_cases/t00013_class.svg | 112 ++++----- docs/test_cases/t00014.md | 31 ++- docs/test_cases/t00014_class.svg | 389 ++++++++++++++++------------- docs/test_cases/t00015_class.svg | 28 +-- docs/test_cases/t00016_class.svg | 30 +-- docs/test_cases/t00017_class.svg | 100 ++++---- docs/test_cases/t00018_class.svg | 70 +++--- docs/test_cases/t00019_class.svg | 321 ++++++++++++------------ docs/test_cases/t00020_class.svg | 114 ++++----- docs/test_cases/t00021_class.svg | 114 ++++----- docs/test_cases/t00022_class.svg | 46 ++-- docs/test_cases/t00023_class.svg | 64 ++--- docs/test_cases/t00024_class.svg | 72 +++--- docs/test_cases/t00025_class.svg | 74 +++--- docs/test_cases/t00026_class.svg | 92 +++---- docs/test_cases/t00027_class.svg | 126 +++++----- docs/test_cases/t00028_class.svg | 118 ++++----- docs/test_cases/t00029_class.svg | 54 ++-- docs/test_cases/t00030_class.svg | 46 ++-- docs/test_cases/t00031_class.svg | 60 ++--- docs/test_cases/t00032_class.svg | 74 +++--- docs/test_cases/t00033_class.svg | 62 ++--- docs/test_cases/t00034_class.svg | 54 ++-- docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036_class.svg | 42 ++-- docs/test_cases/t00037_class.svg | 46 ++-- docs/test_cases/t00038_class.svg | 95 ++++--- docs/test_cases/t00039_class.svg | 104 ++++---- docs/test_cases/t00040_class.svg | 42 ++-- docs/test_cases/t00041_class.svg | 64 ++--- docs/test_cases/t00042_class.svg | 22 +- docs/test_cases/t00043_class.svg | 110 ++++---- docs/test_cases/t30001_package.svg | 54 ++-- docs/test_cases/t30002_package.svg | 112 ++++----- docs/test_cases/t30003_package.svg | 28 +-- docs/test_cases/t30004_package.svg | 42 ++-- docs/test_cases/t30005_package.svg | 42 ++-- docs/test_cases/t30006_package.svg | 26 +- docs/test_cases/t30007_package.svg | 30 +-- docs/test_cases/t30008_package.svg | 42 ++-- docs/test_cases/t40001_include.svg | 46 ++-- docs/test_cases/t40002_include.svg | 44 ++-- docs/test_cases/t40003_include.svg | 66 ++--- 54 files changed, 2044 insertions(+), 2017 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 215d62f1..2459f9b6 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + A - + - + foo_a() = 0 : void - + - + foo_c() = 0 : void - - + + B - + - + foo_a() : void - - + + C - + - + foo_c() : void - - + + D - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - - + + E - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - + This is class A - + This is class B - + This is class D which is a little like B diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index c9ac2a4c..767e8318 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,195 +9,188 @@ - - - - - A - + + + + + A + - + - + public_member : int - + - + static_int : int - + - + static_const_int : int const - + - + auto_member : unsigned long const - + - + protected_member : int - + - + private_member : int - + - + a : int - + - + b : int - + - + c : int - - + + - + A() : void - + - + A(int i) : void - + - + A(A&& ) : void - + - + A(A const& ) : void - + - + ~A() : void - + - + basic_method() : void - + - + static_method() : int - + - + const_method() const : void - + - + auto_method() : int - + - + double_int(int const i) : int - + - + sum(double const a, double const b) : double - + - + default_int(int i = 12) : int - + - - default_string(int i, std::string s = "abc") : std::string + + create_from_int(int i) : A - + - + - - create_from_int(int i) : A + + protected_method() : void - + - + - - protected_method() : void + + private_method() : void - + - + - - private_method() : void - - - - - - - compare : std::function<bool(int const)> + + compare : std::function<bool(int const)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 22b87327..3838661a 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,38 +9,38 @@ - - + + A - + - + foo() const : void - + - + foo2() const : void - - + + AA - - + + Lights @@ -50,8 +50,8 @@ Red - - + + AAA diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index e2d23182..dc1f6c70 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 : D const* - + - + e : E const& - + - + f : F&& - + - + g : G** - + - + h : H*** - + - + i : I*& - + - + j : J volatile* - + - + k : K* diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 1e3905dd..adc92688 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 a9dafb22..7dea4caf 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 f3de2788..61574c08 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,33 +103,33 @@ int,Vector - - + + D - + - + ints : B<int,Vector> - + - + D(std::tuple<Items...>* ) : void - + - + add(int i) : void diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index a061ff7d..a2fa1186 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 ca06e6e0..c5239c41 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 67b545d2..2e828763 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,49 +18,49 @@ T - + - + value : T - - + + A - + - + foo() : void - - + + B - + - + m_a : A* - + - + foo() : void diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index f428e13c..a1c9a112 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 : int - - + + 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 2c5437b5..b8b8d391 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,83 +18,83 @@ T - + - + f : T - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int - + - + print(R* r) : void - - + + E @@ -102,15 +102,15 @@ T - + - + e : T - + E @@ -118,7 +118,7 @@ int - + F @@ -126,7 +126,7 @@ int - + E @@ -134,96 +134,96 @@ std::string - - + + R - + - + estring : E<std::string> - + - + get_a(A* a) : int - + - + get_b(B& b) : int - + - + get_const_b(B const& b) : int - + - + get_c(C c) : int - + - + get_d(D&& d) : int - + - + get_d2(D&& d) : int - + - + get_e(E<T> e) : T - + - + get_int_e(E<int> const& e) : int - + - + get_int_e2(E<int>& e) : int - + - + get_f(F<T> const& f) : T - + - + get_int_f(F<int> const& f) : int diff --git a/docs/test_cases/t00014.md b/docs/test_cases/t00014.md index 4fb6d9be..9f801b3e 100644 --- a/docs/test_cases/t00014.md +++ b/docs/test_cases/t00014.md @@ -26,6 +26,7 @@ File t00014.cc #include #include #include +#include #include #include #include @@ -50,15 +51,25 @@ template struct A { P p; }; -template using AString = A; - -template using GeneralCallback = std::function; -using VoidCallback = GeneralCallback<>; - struct B { std::string value; }; +template using AString = A; +template using AStringPtr = A>; + +template +using PairPairBA = std::pair>, long>; + +template using VectorPtr = std::unique_ptr>; +template using APtr = std::unique_ptr>; +template using ASharedPtr = std::shared_ptr>; +template +using AAPtr = std::unique_ptr, A>>; + +template using GeneralCallback = std::function; +using VoidCallback = GeneralCallback<>; + using BVector = std::vector; using BVector2 = BVector; @@ -67,11 +78,16 @@ using AStringString = AString; using BStringString = AStringString; class R { - // clang-uml: tinst A + PairPairBA bapair; + + APtr abool; + AAPtr aboolfloat; + ASharedPtr afloat; A boolstring; - AString floatstring; + AStringPtr floatstring; AIntString intstring; AStringString stringstring; + BStringString bstringstring; protected: BVector bs; @@ -80,6 +96,7 @@ public: BVector2 bs2; GeneralCallback cb; VoidCallback vcb; + VectorPtr vps; }; } } diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 707b49f7..f9ccc904 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,204 +9,237 @@ - - - - - A - - T,P - + + + + + A + + T,P + - - - + + + - - t : T + + t : T - - - + + + - - p : P + + p : P - - - - - A - - T,std::string - - - - - - - B - + + + + + + B + + - - - + + + + A + + T,std::string + + + + + + A + + T,std::unique_ptr<std::string> + + + + + + A + + long,T + + + + + + A + + double,T + + + + + + A + + long,bool + + + + + + A + + double,bool + + + + + + A + + long,float + + + + + + A + + double,float + + + + + + A + + bool,std::string + + + + + + A + + float,std::unique_ptr<std::string> + + + + + + + R + - - value : std::string + + + - - - - - A - - bool,std::string - - - - - - AString - - float - - - - - - AString - - int - - - - - - AString - - std::string - - - - - - GeneralCallback - - AIntString - - - - - - GeneralCallback - - - - - - - R - + + bapair : PairPairBA<bool> - - - + + + - - boolstring : A<bool,std::string> + + abool : APtr<bool> - - - + + + - - floatstring : AString<float> + + aboolfloat : AAPtr<bool,float> - - - + + + - - intstring : AIntString + + afloat : ASharedPtr<float> - - - + + + - - stringstring : AStringString + + boolstring : A<bool,std::string> - - - + + + - - bs : BVector + + floatstring : AStringPtr<float> - - - + + + - - bs2 : BVector2 + + cb : GeneralCallback<AIntString> - - - + + + - - cb : GeneralCallback<AIntString> + + vps : VectorPtr<B> - - - - - - vcb : VoidCallback - - - - - - - - - - - - - - - - boolstring - - - - floatstring - - - - intstring - - - - stringstring - - - - bs - - - - bs2 - - - - cb - - - - vcb + + + + + + + + + + + + + + + + + + + + + + + + + bapair + + + + vps + + + + bapair + + + + abool + + + + aboolfloat + + + + aboolfloat + + + + afloat + + + + boolstring + + + + floatstring diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 443cfe93..abdd0c6d 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - + + 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 5c2bad26..a875f5e5 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 @@ -31,8 +31,8 @@ value : enum - - + + is_numeric @@ -43,8 +43,8 @@ value : enum - - + + is_numeric @@ -55,8 +55,8 @@ value : enum - - + + is_numeric @@ -67,13 +67,13 @@ value : enum - + - + - + - + diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 7655f36a..04e6f44e 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,176 +9,176 @@ - - + + 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& - + - + R(int& some_int, C& cc, E const& ee, F&& ff, I*& ii) : void - + - + -c - + - + -e - + - + -f - + - + -i - + -a - + -b - + -d - + -g - + -h - + -j - + -k diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 195b0c04..2394a534 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + impl::widget - + - + n : int - + - + draw(widget const& w) const : void - + - + draw(widget const& w) : void - + - + widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> - + - + draw() const : void - + - + draw() : void - + - + shown() const : bool - + - + widget(int ) : void - + - + ~widget() : void - + - + widget(widget&& ) : void - + - + widget(widget const& ) : void - + - + operator=(widget&& ) : widget& - + - + operator=(widget const& ) : widget& - + - + pImpl diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index fc950051..b09b807d 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,195 +9,186 @@ - - - - - Layer2 - - LowerLayer - - + + + + + Layer2 + + LowerLayer + + - - - + + + - - all_calls_count() const : int + + all_calls_count() const : int - - - - - Base - - + + + + + Base + + - - - + + + - - Base() : void + + Base() : void - - - + + + - - ~Base() : void + + ~Base() : void - - - + + + - - m1() : int + + m1() : int - - - + + + + + Layer1 + + LowerLayer + + - - m2() : std::string + + + - - - - - Layer1 - - LowerLayer - - + + m1() : int - - - + + + + + Layer3 + + LowerLayer + - - m1() : int + + + - - - + + m_m1_calls : int - - m2() : std::string + + + - - - - - Layer3 - - LowerLayer - + + m_m2_calls : int - - - + + + + - - m_m1_calls : int + + m1() : int - - - + + + - - m_m2_calls : int + + m1_calls() const : int - - - - + + + - - m1() : int + + m2_calls() const : int - - - + + + + Layer3 + + Base + + + + + + Layer2 + + Layer3<Base> + + + + + + Layer1 + + Layer2<Layer3<Base>> + + + + + + + A + - - m2() : std::string + + + - - - + + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> - - m1_calls() const : int - - - - - - - m2_calls() const : int - - - - - Layer3 - - Base - - - - - - Layer2 - - Layer3<Base> - - - - - - Layer1 - - Layer2<Layer3<Base>> - - - - - - - A - - - - - - - - layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> - - - - - - - - - - - - - - - - - - - - - - - - layers + + + + + + + + + + + + + + + + + + + + + + + layers + + + + layers + + + + layers + + + + layers diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 69db877a..862b694a 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,195 +9,195 @@ - - + + ProductA - + - + ~ProductA() : void - + - + sell(int price) const = 0 : bool - - + + ProductA1 - + - + sell(int price) const : bool - - + + ProductA2 - + - + sell(int price) const : bool - - + + ProductB - + - + ~ProductB() : void - + - + buy(int price) const = 0 : bool - - + + ProductB1 - + - + buy(int price) const : bool - - + + ProductB2 - + - + buy(int price) const : bool - - + + AbstractFactory - + - + make_a() const = 0 : std::unique_ptr<ProductA> - + - + make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - - + + Factory2 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index cf41db7b..ca37408f 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,184 +9,184 @@ - - + + Visitor - + - + ~Visitor() : void - + - + visit_A(A const& item) const = 0 : void - + - + visit_B(B const& item) const = 0 : void - - + + Visitor1 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor2 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor3 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Item - + - + ~Item() : void - + - + accept(Visitor const& visitor) const = 0 : void - - + + A - + - + accept(Visitor const& visitor) const : void - - + + B - + - + accept(Visitor const& visitor) const : void - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 086323f2..74d10d49 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,82 +9,82 @@ - - + + A - + - + template_method() : void - + - + method1() = 0 : void - + - + method2() = 0 : void - - + + A1 - + - + method1() : void - + - + method2() : void - - + + A2 - + - + method1() : void - + - + method2() : void - + - + diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index bca7f3a9..281e3534 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,111 +9,111 @@ - - + + Strategy - + - + ~Strategy() : void - + - + algorithm() = 0 : void - - + + StrategyA - + - + algorithm() : void - - + + StrategyB - + - + algorithm() : void - - + + StrategyC - + - + algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> - + - + Context(std::unique_ptr<Strategy> strategy) : void - + - + apply() : void - + - + - + - + - + m_strategy diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 471a9d40..22eb38e9 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,126 +9,126 @@ - - + + Target - + - + ~Target() : void - + - + m1() = 0 : void - + - + m2() = 0 : void - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> - + - + Proxy(std::shared_ptr<Target> target) : void - + - + m1() : void - + - + m2() : void - + - + - + - + m_target - + diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index c2de75c2..456e9cda 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,52 +9,52 @@ - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy @@ -62,36 +62,36 @@ T - + - + m_target : std::shared_ptr<T> - + - + Proxy(std::shared_ptr<T> target) : void - + - + m1() : void - + - + m2() : void - + Proxy @@ -99,7 +99,7 @@ Target1 - + Proxy @@ -107,41 +107,41 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> - + - + - + - + - + proxy1 - + proxy2 diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index f9133186..c98b81f5 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,30 +18,30 @@ T - + - + m_value : T - + - + Memento(T&& v) : void - + - + value() const : T - - + + Originator @@ -49,51 +49,51 @@ T - + - + m_value : T - + - + Originator(T&& v) : void - + - + memoize_value() const : Memento<T> - + - + load(Memento<T> const& m) : void - + - + print() const : void - + - + set(T&& v) : void - - + + Caretaker @@ -101,29 +101,29 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> - + - + state(std::string const& n) : Memento<T>& - + - + set_state(std::string const& s, Memento<T>&& m) : void - + Caretaker @@ -131,7 +131,7 @@ std::string - + Originator @@ -139,45 +139,45 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> - + - + - + m_mementos - + - + - + caretaker - + originator diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index fd2ad0eb..fcbb34d1 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,79 +9,79 @@ - - + + Shape - + - + display() = 0 : void - + - + ~Shape() : void - - - - - Line - - T<> + + + + + Line + + T<>... - + - + display() : void - - - - - Text - - T<> + + + + + Text + + T<>... - + - + display() : void - - + + ShapeDecorator - + - + display() = 0 : void - - + + Color @@ -90,15 +90,15 @@ - + - + display() : void - - + + Weight @@ -107,14 +107,14 @@ - + - + display() : void - + Line @@ -122,7 +122,7 @@ Color,Weight - + Line @@ -130,7 +130,7 @@ Color - + Text @@ -138,7 +138,7 @@ Color,Weight - + Text @@ -146,71 +146,71 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> - + - + - + - + - + - + - + - + - + border - + divider - + title - + description diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 9048affb..2ddb1450 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,68 +9,68 @@ - - + + A - + A class note. - + A class note. - - + + B - + B class note. - + B class note. - - + + C - + C class note. - + C class note. - - + + D - + D class note. - + D class note. - - + + E @@ -78,27 +78,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -108,13 +108,13 @@ three - + F enum note. - + F enum note. - + E @@ -122,97 +122,97 @@ 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 class note. - - - - + + + + - + - + ccc - + aaa - + bbb - - + + ddd - + eee - + ggg diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 2aa1ff03..1586e2c1 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,72 +45,72 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3& - + - + g4 : std::shared_ptr<G4> - + g1 - + g4 diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index d60e7ed1..6d82204a 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,91 +9,91 @@ - - + + A - - + + B - - + + C - - + + D - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + aaa - + bbb 0..1 1..* - + ccc 0..1 1..5 - + ddd diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 236a19c2..1fa3d45b 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,57 +71,57 @@ int - - + + R - + - + aaa : A* - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D* - + - + aaa - + bbb - + ccc - + ddd diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 8fe14280..ccf6f640 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,69 +9,69 @@ - - + + Base - - + + TBase - - + + A - + - + operator()() : void - - + + B - + - + operator()() : void - - + + C - + - + operator()() : void - - + + Overload @@ -79,15 +79,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -95,42 +95,42 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> - + - + - + - + - + - + - + - + - + - + - + overload diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 1eb69273..2cbfc439 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,34 +99,34 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> - + - + - + - + - + - + - + abc diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 2e0bad96..1ba3142d 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Void - + - + operator==(Void const& ) const : bool - + - + operator!=(Void const& ) const : bool - - + + lift_void @@ -41,8 +41,8 @@ - - + + lift_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,8 +61,8 @@ - - + + drop_void @@ -71,43 +71,43 @@ - - + + A - - + + R - + - + la : lift_void_t<A>* - + - + lv : lift_void_t<void>* - + - + - + - + la diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 85165720..94cf37a6 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 a98a51db..ae04f87c 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,32 +59,32 @@ int - - + + B - + - + a_int : A<int> - - + + C - + - + a_int diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index b43a6b40..06e68201 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,84 +9,84 @@ - - + + ST - + - + dimensions : «anonymous» - - + + <<anonymous>> - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + A - + - + st : ST - + - + A() : void - + - + st diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index 9b80a92b..45137046 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,40 @@ property_c - - + + A - - + + B - - + + C - - - - - key_t - + + + + + key_t + + - - - - - - key : std::string - - - - + + map @@ -88,8 +81,8 @@ - - + + map @@ -98,8 +91,8 @@ - - + + map @@ -108,8 +101,8 @@ - - + + map @@ -118,8 +111,8 @@ - - + + map @@ -128,31 +121,31 @@ - + - + - + - + - + - + - + - + - + - - - + + + - + - + diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index eb8b5788..009fbf23 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,39 +156,39 @@ T,M,N - + - + n : N* - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index 540c1433..882dcb75 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,76 +9,76 @@ - - + + A - + - + ii_ : int - + - + get_a() : int - - + + AA - - + + AAA - + - + b : B* - + - + get_aaa() : int - - + + R - + - + foo(A* a) : void - + - + diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index b9101d65..f97eb492 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - - + + R - - + + D - + - + rr : RR* - - + + E - - + + F - - + + RR - + - + e : E* - + - + f : F* - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM - + rr - + +e - + +f - + - + - + - + diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index ad1ae5f7..ef2718b3 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 - - + + B @@ -35,18 +35,18 @@ T,K - + - + b : T - + - + bb : K diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 35edf881..4304d099 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,189 +9,189 @@ - + dependants - + dependencies - - + + A - - + + B - + - + b(dependants::A* a) : void - - + + BB - + - + bb(dependants::A* a) : void - - + + C - + - + c(dependants::B* b) : void - - + + D - + - + d(dependants::C* c) : void - + - + dd(dependants::BB* bb) : void - - + + E - + - + e(dependants::D* d) : void - - + + G - - + + GG - - + + H - + - + h(dependencies::G* g) : void - + - + hh(dependencies::GG* gg) : void - - + + I - + - + i(dependencies::H* h) : void - - + + J - + - + i(dependencies::I* i) : void - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 67e87435..5cf403d2 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 62154bbc..ecdea7f8 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,135 +9,135 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + BBB - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index e7d1165d..20183df3 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - + + 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 bc86fbe3..a08353ae 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + Another CCC 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 a1133d0c..9abfbab4 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + 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 4a9906a1..47b80b52 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + B - - + + A - - + + C - + Top A note. - + Bottom A note. - - - + + + - + diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index df7b60ac..12f9cac7 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. - + Bottom A note. - - - + + + - + diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 1d451b34..0f3e0f01 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - + - + - + - + diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 217a9e1a..e789c862 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,58 +9,58 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + cppast/cpp_preprocessor.hpp - + This is a lib1 include dir - + This is a t40001_include1.h include file - + - + - + - + - + - + - - + + diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 162bb854..1e7359a0 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,58 +9,58 @@ - + 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 991a1157..be401cfb 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,84 +9,84 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc - + - + - + - + - + - + - + - + From 0f72dbdcae099f3c5ce5a44dae3e7127237f0e97 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 8 May 2022 23:23:55 +0200 Subject: [PATCH 06/19] Fix namespace handling of template type parameters --- src/cx/util.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cx/util.cc b/src/cx/util.cc index c589f0e7..08c99d28 100644 --- a/src/cx/util.cc +++ b/src/cx/util.cc @@ -181,6 +181,9 @@ std::string ns(const cppast::cpp_type &t, const cppast::cpp_entity_index &idx) return fmt::format( "{}", fmt::join(ns_toks.begin(), ns_toks.end(), "::")); } + else if (canon.find("type-parameter-") == 0) { + return ""; + } else { // This is a bug/feature in libclang, where canonical representation // of a template type with incomplete specialization doesn't have a From 641469d1bd4035cf42a9fa3e6ac3168fb7803b9d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 8 May 2022 23:53:03 +0200 Subject: [PATCH 07/19] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 68 +++++++-------- docs/test_cases/t00003_class.svg | 106 +++++++++++------------ docs/test_cases/t00004_class.svg | 26 +++--- 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 | 64 +++++++------- docs/test_cases/t00009_class.svg | 32 +++---- docs/test_cases/t00010_class.svg | 34 ++++---- docs/test_cases/t00011_class.svg | 30 +++---- docs/test_cases/t00012_class.svg | 66 +++++++-------- docs/test_cases/t00013_class.svg | 112 ++++++++++++------------ docs/test_cases/t00014_class.svg | 74 ++++++++-------- docs/test_cases/t00015_class.svg | 22 ++--- docs/test_cases/t00016_class.svg | 22 ++--- docs/test_cases/t00017_class.svg | 70 +++++++-------- docs/test_cases/t00018_class.svg | 66 +++++++-------- docs/test_cases/t00019_class.svg | 72 ++++++++-------- docs/test_cases/t00020_class.svg | 94 ++++++++++---------- docs/test_cases/t00021_class.svg | 82 +++++++++--------- docs/test_cases/t00022_class.svg | 42 ++++----- docs/test_cases/t00023_class.svg | 54 ++++++------ docs/test_cases/t00024_class.svg | 62 +++++++------- docs/test_cases/t00025_class.svg | 62 +++++++------- docs/test_cases/t00026_class.svg | 78 ++++++++--------- docs/test_cases/t00027_class.svg | 82 +++++++++--------- docs/test_cases/t00028_class.svg | 94 ++++++++++---------- docs/test_cases/t00029_class.svg | 50 +++++------ docs/test_cases/t00030_class.svg | 38 ++++----- docs/test_cases/t00031_class.svg | 50 +++++------ docs/test_cases/t00032_class.svg | 52 ++++++------ docs/test_cases/t00033_class.svg | 48 +++++------ docs/test_cases/t00034_class.svg | 46 +++++----- docs/test_cases/t00035_class.svg | 22 ++--- docs/test_cases/t00036_class.svg | 38 ++++----- docs/test_cases/t00037_class.svg | 42 ++++----- docs/test_cases/t00038_class.svg | 50 +++++------ docs/test_cases/t00039_class.svg | 78 ++++++++--------- docs/test_cases/t00040_class.svg | 38 ++++----- docs/test_cases/t00041_class.svg | 50 +++++------ docs/test_cases/t00042_class.svg | 22 ++--- docs/test_cases/t00043_class.svg | 90 ++++++++++---------- docs/test_cases/t30001_package.svg | 48 +++++------ docs/test_cases/t30002_package.svg | 82 +++++++++--------- docs/test_cases/t30003_package.svg | 26 +++--- docs/test_cases/t30004_package.svg | 32 +++---- 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/t40001_include.svg | 30 +++---- docs/test_cases/t40002_include.svg | 34 ++++---- docs/test_cases/t40003_include.svg | 50 +++++------ 53 files changed, 1457 insertions(+), 1457 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 2459f9b6..14368c04 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + A - + - + foo_a() = 0 : void - + - + foo_c() = 0 : void - - + + B - + - + foo_a() : void - - + + C - + - + foo_c() : void - - + + D - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - - + + E - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - + This is class A - + This is class B - + This is class D which is a little like B diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index 767e8318..d8b232af 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,187 +9,187 @@ - - + + A - + - + public_member : int - + - + static_int : int - + - + static_const_int : int const - + - + auto_member : unsigned long const - + - + protected_member : int - + - + private_member : int - + - + a : int - + - + b : int - + - + c : int - + - + A() : void - + - + A(int i) : void - + - + A(A&& ) : void - + - + A(A const& ) : void - + - + ~A() : void - + - + basic_method() : void - + - + static_method() : int - + - + const_method() const : void - + - + auto_method() : int - + - + double_int(int const i) : int - + - + sum(double const a, double const b) : double - + - + default_int(int i = 12) : int - + - + create_from_int(int i) : A - + - + protected_method() : void - + - + private_method() : void - + - + compare : std::function<bool(int const)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 3838661a..5d2cb65e 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,38 +9,38 @@ - - + + A - + - + foo() const : void - + - + foo2() const : void - - + + AA - - + + Lights @@ -50,8 +50,8 @@ Red - - + + AAA diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index dc1f6c70..2d976e9e 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 : D const* - + - + e : E const& - + - + f : F&& - + - + g : G** - + - + h : H*** - + - + i : I*& - + - + j : J volatile* - + - + k : K* diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index adc92688..831880eb 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 7dea4caf..628f6398 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 61574c08..13f44bd3 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,33 +103,33 @@ int,Vector - - + + D - + - + ints : B<int,Vector> - + - + D(std::tuple<Items...>* ) : void - + - + add(int i) : void diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index a2fa1186..1564ca7d 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 c5239c41..bbb462af 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 2e828763..0241eb6c 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,49 +18,49 @@ T - + - + value : T - - + + A - + - + foo() : void - - + + B - + - + m_a : A* - + - + foo() : void diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index a1c9a112..8b239d49 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 : int - - + + 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 b8b8d391..ff338fef 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,83 +18,83 @@ T - + - + f : T - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int - + - + print(R* r) : void - - + + E @@ -102,15 +102,15 @@ T - + - + e : T - + E @@ -118,7 +118,7 @@ int - + F @@ -126,7 +126,7 @@ int - + E @@ -134,96 +134,96 @@ std::string - - + + R - + - + estring : E<std::string> - + - + get_a(A* a) : int - + - + get_b(B& b) : int - + - + get_const_b(B const& b) : int - + - + get_c(C c) : int - + - + get_d(D&& d) : int - + - + get_d2(D&& d) : int - + - + get_e(E<T> e) : T - + - + get_int_e(E<int> const& e) : int - + - + get_int_e2(E<int>& e) : int - + - + get_f(F<T> const& f) : T - + - + get_int_f(F<int> const& f) : int diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index f9ccc904..678e3359 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,30 +18,30 @@ T,P - + - + t : T - + - + p : P - - + + B - + A @@ -49,7 +49,7 @@ T,std::string - + A @@ -57,7 +57,7 @@ T,std::unique_ptr<std::string> - + A @@ -65,7 +65,7 @@ long,T - + A @@ -73,7 +73,7 @@ double,T - + A @@ -81,7 +81,7 @@ long,bool - + A @@ -89,7 +89,7 @@ double,bool - + A @@ -97,7 +97,7 @@ long,float - + A @@ -105,7 +105,7 @@ double,float - + A @@ -113,7 +113,7 @@ bool,std::string - + A @@ -121,67 +121,67 @@ float,std::unique_ptr<std::string> - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + cb : GeneralCallback<AIntString> - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index abdd0c6d..d6e84947 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 a875f5e5..efa57c1a 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 @@ -31,8 +31,8 @@ value : enum - - + + is_numeric @@ -43,8 +43,8 @@ value : enum - - + + is_numeric @@ -55,8 +55,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 04e6f44e..1f9af4b4 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,135 +9,135 @@ - - + + 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& - + - + R(int& some_int, C& cc, E const& ee, F&& ff, I*& ii) : void diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 2394a534..56cf9526 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - - + + impl::widget - + - + n : int - + - + draw(widget const& w) const : void - + - + draw(widget const& w) : void - + - + widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> - + - + draw() const : void - + - + draw() : void - + - + shown() const : bool - + - + widget(int ) : void - + - + ~widget() : void - + - + widget(widget&& ) : void - + - + widget(widget const& ) : void - + - + operator=(widget&& ) : widget& - + - + operator=(widget const& ) : widget& diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index b09b807d..67e6d7eb 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Layer2 @@ -19,44 +19,44 @@ - + - + all_calls_count() const : int - - + + Base - + - + Base() : void - + - + ~Base() : void - + - + m1() : int - - + + Layer1 @@ -65,15 +65,15 @@ - + - + m1() : int - - + + Layer3 @@ -81,43 +81,43 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int - + - + m1() : int - + - + m1_calls() const : int - + - + m2_calls() const : int - + Layer3 @@ -125,7 +125,7 @@ Base - + Layer2 @@ -133,7 +133,7 @@ Layer3<Base> - + Layer1 @@ -141,18 +141,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 862b694a..b09aae1a 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,174 +9,174 @@ - - + + ProductA - + - + ~ProductA() : void - + - + sell(int price) const = 0 : bool - - + + ProductA1 - + - + sell(int price) const : bool - - + + ProductA2 - + - + sell(int price) const : bool - - + + ProductB - + - + ~ProductB() : void - + - + buy(int price) const = 0 : bool - - + + ProductB1 - + - + buy(int price) const : bool - - + + ProductB2 - + - + buy(int price) const : bool - - + + AbstractFactory - + - + make_a() const = 0 : std::unique_ptr<ProductA> - + - + make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - - + + Factory2 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index ca37408f..488ed240 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,151 +9,151 @@ - - + + Visitor - + - + ~Visitor() : void - + - + visit_A(A const& item) const = 0 : void - + - + visit_B(B const& item) const = 0 : void - - + + Visitor1 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor2 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor3 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Item - + - + ~Item() : void - + - + accept(Visitor const& visitor) const = 0 : void - - + + A - + - + accept(Visitor const& visitor) const : void - - + + B - + - + accept(Visitor const& visitor) const : void diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 74d10d49..4dd4c98f 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,77 +9,77 @@ - - + + A - + - + template_method() : void - + - + method1() = 0 : void - + - + method2() = 0 : void - - + + A1 - + - + method1() : void - + - + method2() : void - - + + A2 - + - + method1() : void - + - + method2() : void diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 281e3534..5e5e1557 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + Strategy - + - + ~Strategy() : void - + - + algorithm() = 0 : void - - + + StrategyA - + - + algorithm() : void - - + + StrategyB - + - + algorithm() : void - - + + StrategyC - + - + algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> - + - + Context(std::unique_ptr<Strategy> strategy) : void - + - + apply() : void diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 22eb38e9..1281f942 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + Target - + - + ~Target() : void - + - + m1() = 0 : void - + - + m2() = 0 : void - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> - + - + Proxy(std::shared_ptr<Target> target) : void - + - + m1() : void - + - + m2() : void diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index 456e9cda..d62845cf 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,52 +9,52 @@ - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy @@ -62,36 +62,36 @@ T - + - + m_target : std::shared_ptr<T> - + - + Proxy(std::shared_ptr<T> target) : void - + - + m1() : void - + - + m2() : void - + Proxy @@ -99,7 +99,7 @@ Target1 - + Proxy @@ -107,25 +107,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 c98b81f5..ab8dda35 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,30 +18,30 @@ T - + - + m_value : T - + - + Memento(T&& v) : void - + - + value() const : T - - + + Originator @@ -49,51 +49,51 @@ T - + - + m_value : T - + - + Originator(T&& v) : void - + - + memoize_value() const : Memento<T> - + - + load(Memento<T> const& m) : void - + - + print() const : void - + - + set(T&& v) : void - - + + Caretaker @@ -101,29 +101,29 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> - + - + state(std::string const& n) : Memento<T>& - + - + set_state(std::string const& s, Memento<T>&& m) : void - + Caretaker @@ -131,7 +131,7 @@ std::string - + Originator @@ -139,25 +139,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 fcbb34d1..0c3363f2 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Shape - + - + display() = 0 : void - + - + ~Shape() : void - - + + Line @@ -41,15 +41,15 @@ - + - + display() : void - - + + Text @@ -58,30 +58,30 @@ - + - + display() : void - - + + ShapeDecorator - + - + display() = 0 : void - - + + Color @@ -90,15 +90,15 @@ - + - + display() : void - - + + Weight @@ -107,14 +107,14 @@ - + - + display() : void - + Line @@ -122,7 +122,7 @@ Color,Weight - + Line @@ -130,7 +130,7 @@ Color - + Text @@ -138,7 +138,7 @@ Color,Weight - + Text @@ -146,39 +146,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 2ddb1450..60d023a9 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,68 +9,68 @@ - - + + A - + A class note. - + A class note. - - + + B - + B class note. - + B class note. - - + + C - + C class note. - + C class note. - - + + D - + D class note. - + D class note. - - + + E @@ -78,27 +78,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -108,13 +108,13 @@ three - + F enum note. - + F enum note. - + E @@ -122,67 +122,67 @@ 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 class note. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 1586e2c1..6cc156e1 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 6d82204a..04a4794b 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,71 +9,71 @@ - - + + A - - + + B - - + + C - - + + D - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 1fa3d45b..8851378b 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 ccf6f640..e402b096 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,69 +9,69 @@ - - + + Base - - + + TBase - - + + A - + - + operator()() : void - - + + B - + - + operator()() : void - - + + C - + - + operator()() : void - - + + Overload @@ -79,15 +79,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -95,18 +95,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 2cbfc439..10d979de 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 1ba3142d..0c1f28bf 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Void - + - + operator==(Void const& ) const : bool - + - + operator!=(Void const& ) const : bool - - + + lift_void @@ -41,8 +41,8 @@ - - + + lift_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,8 +61,8 @@ - - + + drop_void @@ -71,33 +71,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 94cf37a6..fdacdbec 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 ae04f87c..dae00c2f 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 06e68201..c4115ba5 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,77 +9,77 @@ - - + + ST - + - + dimensions : «anonymous» - - + + <<anonymous>> - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + A - + - + st : ST - + - + A() : void diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index 45137046..a8e55dd1 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,40 +39,40 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - - + + map @@ -81,8 +81,8 @@ - - + + map @@ -91,8 +91,8 @@ - - + + map @@ -101,8 +101,8 @@ - - + + map @@ -111,8 +111,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 009fbf23..b3aeaee5 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 882dcb75..b13e5130 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,71 +9,71 @@ - - + + A - + - + ii_ : int - + - + get_a() : int - - + + AA - - + + AAA - + - + b : B* - + - + get_aaa() : int - - + + R - + - + foo(A* a) : void diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index f97eb492..7ff03e21 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,93 +9,93 @@ - - + + R - - + + D - + - + rr : RR* - - + + E - - + + F - - + + RR - + - + e : E* - + - + f : F* - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index ef2718b3..22427b2e 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 - - + + B @@ -35,18 +35,18 @@ T,K - + - + b : T - + - + bb : K diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 4304d099..187db3b8 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,168 +9,168 @@ - + dependants - + dependencies - - + + A - - + + B - + - + b(dependants::A* a) : void - - + + BB - + - + bb(dependants::A* a) : void - - + + C - + - + c(dependants::B* b) : void - - + + D - + - + d(dependants::C* c) : void - + - + dd(dependants::BB* bb) : void - - + + E - + - + e(dependants::D* d) : void - - + + G - - + + GG - - + + H - + - + h(dependencies::G* g) : void - + - + hh(dependencies::GG* gg) : void - - + + I - + - + i(dependencies::H* h) : void - - + + J - + - + i(dependencies::I* i) : void diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 5cf403d2..20241e67 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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 ecdea7f8..64e534ef 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,103 +9,103 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 20183df3..57a3831d 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 a08353ae..5a34ce3b 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + Another CCC 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 9abfbab4..29f2c428 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 47b80b52..ab5ab8c1 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. - + Bottom A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 12f9cac7..c5b1aa37 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. - + Bottom A note. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 0f3e0f01..b639047c 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index e789c862..5fa3f1e6 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 - + cppast/cpp_preprocessor.hpp - + This is a lib1 include dir - + This is a t40001_include1.h include file diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 1e7359a0..ebbc743b 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 be401cfb..adfbb1d4 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From cf908434e2d35f4afd025282f7f65676f033eb75 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 9 May 2022 23:30:22 +0200 Subject: [PATCH 08/19] Refactored class template model --- src/class_diagram/model/class.cc | 4 +- src/class_diagram/model/class.h | 8 ++-- ...lass_template.cc => template_parameter.cc} | 44 ++++++++++++------- ...{class_template.h => template_parameter.h} | 29 ++++++++---- .../visitor/translation_unit_visitor.cc | 20 ++++----- .../visitor/translation_unit_visitor.h | 8 ++-- src/cx/util.cc | 23 +++++----- src/cx/util.h | 4 +- tests/test_util.cc | 24 +++++----- 9 files changed, 96 insertions(+), 68 deletions(-) rename src/class_diagram/model/{class_template.cc => template_parameter.cc} (69%) rename src/class_diagram/model/{class_template.h => template_parameter.h} (71%) diff --git a/src/class_diagram/model/class.cc b/src/class_diagram/model/class.cc index dc2baeae..60abcb23 100644 --- a/src/class_diagram/model/class.cc +++ b/src/class_diagram/model/class.cc @@ -62,7 +62,7 @@ void class_::add_parent(class_parent &&parent) bases_.emplace_back(std::move(parent)); } -void class_::add_template(class_template tmplt) +void class_::add_template(template_parameter tmplt) { templates_.emplace_back(std::move(tmplt)); } @@ -73,7 +73,7 @@ const std::vector &class_::methods() const { return methods_; } const std::vector &class_::parents() const { return bases_; } -const std::vector &class_::templates() const +const std::vector &class_::templates() const { return templates_; } diff --git a/src/class_diagram/model/class.h b/src/class_diagram/model/class.h index e9f17ef9..c4a714b7 100644 --- a/src/class_diagram/model/class.h +++ b/src/class_diagram/model/class.h @@ -20,10 +20,10 @@ #include "class_member.h" #include "class_method.h" #include "class_parent.h" -#include "class_template.h" #include "common/model/element.h" #include "common/model/enums.h" #include "common/model/stylable_element.h" +#include "template_parameter.h" #include "type_alias.h" #include @@ -55,12 +55,12 @@ public: void add_member(class_member &&member); void add_method(class_method &&method); void add_parent(class_parent &&parent); - void add_template(class_template tmplt); + void add_template(template_parameter tmplt); const std::vector &members() const; const std::vector &methods() const; const std::vector &parents() const; - const std::vector &templates() const; + const std::vector &templates() const; void set_base_template(const std::string &full_name); std::string base_template() const; @@ -89,7 +89,7 @@ private: std::vector members_; std::vector methods_; std::vector bases_; - std::vector templates_; + std::vector templates_; std::string base_template_full_name_; std::map type_aliases_; diff --git a/src/class_diagram/model/class_template.cc b/src/class_diagram/model/template_parameter.cc similarity index 69% rename from src/class_diagram/model/class_template.cc rename to src/class_diagram/model/template_parameter.cc index a1494852..a19f549b 100644 --- a/src/class_diagram/model/class_template.cc +++ b/src/class_diagram/model/template_parameter.cc @@ -1,5 +1,5 @@ /** - * src/class_diagram/model/class_template.cc + * src/class_diagram/model/template_parameter.cc * * Copyright (c) 2021-2022 Bartek Kryza * @@ -16,14 +16,14 @@ * limitations under the License. */ -#include "class_template.h" +#include "template_parameter.h" #include #include namespace clanguml::class_diagram::model { -class_template::class_template(const std::string &type, const std::string &name, - const std::string &default_value, bool is_variadic) +template_parameter::template_parameter(const std::string &type, + const std::string &name, const std::string &default_value, bool is_variadic) : default_value_{default_value} , is_variadic_{is_variadic} { @@ -31,11 +31,11 @@ class_template::class_template(const std::string &type, const std::string &name, set_type(type); } -void class_template::set_type(const std::string &type) { type_ = type; } +void template_parameter::set_type(const std::string &type) { type_ = type; } -std::string class_template::type() const { return type_; } +std::string template_parameter::type() const { return type_; } -void class_template::set_name(const std::string &name) +void template_parameter::set_name(const std::string &name) { name_ = name; // TODO: Add a configurable mapping for simplifying non-interesting @@ -44,7 +44,7 @@ void class_template::set_name(const std::string &name) util::replace_all(name_, "std::basic_string", "std::wstring"); } -std::string class_template::name() const +std::string template_parameter::name() const { if (is_variadic_) return name_ + "..."; @@ -52,21 +52,22 @@ std::string class_template::name() const return name_; } -void class_template::set_default_value(const std::string &value) +void template_parameter::set_default_value(const std::string &value) { default_value_ = value; } -std::string class_template::default_value() const { return default_value_; } +std::string template_parameter::default_value() const { return default_value_; } -void class_template::is_variadic(bool is_variadic) noexcept +void template_parameter::is_variadic(bool is_variadic) noexcept { is_variadic_ = is_variadic; } -bool class_template::is_variadic() const noexcept { return is_variadic_; } +bool template_parameter::is_variadic() const noexcept { return is_variadic_; } -bool class_template::is_specialization_of(const class_template &ct) const +bool template_parameter::is_specialization_of( + const template_parameter &ct) const { if ((ct.is_template_parameter() || ct.is_template_template_parameter()) && !is_template_parameter()) @@ -75,7 +76,18 @@ bool class_template::is_specialization_of(const class_template &ct) const return false; } -bool operator==(const class_template &l, const class_template &r) +void template_parameter::add_template_param(template_parameter &&ct) +{ + template_params_.emplace_back(std::move(ct)); +} + +const std::vector & +template_parameter::template_params() const +{ + return template_params_; +} + +bool operator==(const template_parameter &l, const template_parameter &r) { bool res{false}; @@ -95,12 +107,12 @@ bool operator==(const class_template &l, const class_template &r) return res && (l.template_params_ == r.template_params_); } -bool operator!=(const class_template &l, const class_template &r) +bool operator!=(const template_parameter &l, const template_parameter &r) { return !(l == r); } -std::string class_template::to_string( +std::string template_parameter::to_string( const clanguml::common::model::namespace_ &using_namespace) const { using clanguml::common::model::namespace_; diff --git a/src/class_diagram/model/class_template.h b/src/class_diagram/model/template_parameter.h similarity index 71% rename from src/class_diagram/model/class_template.h rename to src/class_diagram/model/template_parameter.h index 0a014c80..a25b0a8d 100644 --- a/src/class_diagram/model/class_template.h +++ b/src/class_diagram/model/template_parameter.h @@ -1,5 +1,5 @@ /** - * src/class_diagram/model/class_template.h + * src/class_diagram/model/template_parameter.h * * Copyright (c) 2021-2022 Bartek Kryza * @@ -24,10 +24,16 @@ namespace clanguml::class_diagram::model { -class class_template { +/// @brief Represents template parameter or template parameter instantiation +/// +/// This class can represent both template parameter and template parameter +/// instantiation, including variadic parameters and instantiations with +/// nested templates +class template_parameter { public: - class_template(const std::string &type = "", const std::string &name = "", - const std::string &default_value = "", bool is_variadic = false); + template_parameter(const std::string &type = "", + const std::string &name = "", const std::string &default_value = "", + bool is_variadic = false); void set_type(const std::string &type); std::string type() const; @@ -41,10 +47,12 @@ public: void is_variadic(bool is_variadic) noexcept; bool is_variadic() const noexcept; - bool is_specialization_of(const class_template &ct) const; + bool is_specialization_of(const template_parameter &ct) const; - friend bool operator==(const class_template &l, const class_template &r); - friend bool operator!=(const class_template &l, const class_template &r); + friend bool operator==( + const template_parameter &l, const template_parameter &r); + friend bool operator!=( + const template_parameter &l, const template_parameter &r); bool is_template_parameter() const { return is_template_parameter_; } @@ -66,7 +74,9 @@ public: std::string to_string( const clanguml::common::model::namespace_ &using_namespace) const; - std::vector template_params_; + void add_template_param(template_parameter &&ct); + + const std::vector &template_params() const; private: /// Represents the type of non-type template parameters @@ -89,5 +99,8 @@ private: /// Whether the template parameter is variadic bool is_variadic_{false}; + + // Nested template parameters + std::vector template_params_; }; } diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index e3c00faf..061113a3 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -40,10 +40,10 @@ using clanguml::class_diagram::model::class_; using clanguml::class_diagram::model::class_member; using clanguml::class_diagram::model::class_method; using clanguml::class_diagram::model::class_parent; -using clanguml::class_diagram::model::class_template; using clanguml::class_diagram::model::diagram; using clanguml::class_diagram::model::enum_; using clanguml::class_diagram::model::method_parameter; +using clanguml::class_diagram::model::template_parameter; using clanguml::class_diagram::model::type_alias; using clanguml::common::model::access_t; using clanguml::common::model::relationship; @@ -1272,7 +1272,7 @@ void translation_unit_visitor:: void translation_unit_visitor::process_template_type_parameter( const cppast::cpp_template_type_parameter &t, class_ &parent) { - class_template ct; + template_parameter ct; ct.set_type(""); ct.is_template_parameter(true); ct.set_name(t.name()); @@ -1285,7 +1285,7 @@ void translation_unit_visitor::process_template_type_parameter( void translation_unit_visitor::process_template_nontype_parameter( const cppast::cpp_non_type_template_parameter &t, class_ &parent) { - class_template ct; + template_parameter ct; ct.set_type(cppast::to_string(t.type())); ct.is_template_parameter(false); ct.set_name(t.name()); @@ -1298,7 +1298,7 @@ void translation_unit_visitor::process_template_nontype_parameter( void translation_unit_visitor::process_template_template_parameter( const cppast::cpp_template_template_parameter &t, class_ &parent) { - class_template ct; + template_parameter ct; ct.set_type(""); ct.is_template_template_parameter(true); ct.set_name(t.name() + "<>"); @@ -1577,7 +1577,7 @@ bool translation_unit_visitor::find_relationships_in_array( } bool translation_unit_visitor::find_relationships_in_unexposed_template_params( - const class_template &ct, found_relationships_t &relationships) const + const template_parameter &ct, found_relationships_t &relationships) const { bool found{false}; LOG_DBG("Finding relationships in user defined type: {}", @@ -1596,7 +1596,7 @@ bool translation_unit_visitor::find_relationships_in_unexposed_template_params( found = true; } - for (const auto &nested_template_params : ct.template_params_) { + for (const auto &nested_template_params : ct.template_params()) { found = find_relationships_in_unexposed_template_params( nested_template_params, relationships) || found; @@ -1670,7 +1670,7 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( auto has_variadic_params = false; for (const auto &targ : t.arguments().value()) { - class_template ct; + template_parameter ct; if (targ.type()) { build_template_instantiation_process_type_argument(parent, tinst, targ, ct, nested_relationships, @@ -1755,7 +1755,7 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( bool translation_unit_visitor::build_template_instantiation_add_base_classes( class_ &tinst, std::deque> &template_base_params, - int arg_index, bool variadic_params, const class_template &ct) const + int arg_index, bool variadic_params, const template_parameter &ct) const { bool add_template_argument_as_base_class = false; @@ -1785,7 +1785,7 @@ bool translation_unit_visitor::build_template_instantiation_add_base_classes( void translation_unit_visitor:: build_template_instantiation_process_expression_argument( - const cppast::cpp_template_argument &targ, class_template &ct) const + const cppast::cpp_template_argument &targ, template_parameter &ct) const { const auto &exp = targ.expression().value(); if (exp.kind() == cppast::cpp_expression_kind::literal_t) @@ -1803,7 +1803,7 @@ void translation_unit_visitor:: build_template_instantiation_process_type_argument( const std::optional &parent, class_ &tinst, const cppast::cpp_template_argument &targ, - class_template &ct, found_relationships_t &nested_relationships, + template_parameter &ct, found_relationships_t &nested_relationships, common::model::relationship_t relationship_hint) { ct.set_name(cppast::to_string(targ.type().value())); diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 56195fee..5768b8c1 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -199,7 +199,7 @@ private: common::model::relationship_t relationship_type) const; bool find_relationships_in_unexposed_template_params( - const model::class_template &ct, + const model::template_parameter &ct, found_relationships_t &relationships) const; void build_template_instantiation_primary_template( @@ -212,19 +212,19 @@ private: void build_template_instantiation_process_type_argument( const std::optional &parent, model::class_ &tinst, const cppast::cpp_template_argument &targ, - class_diagram::model::class_template &ct, + class_diagram::model::template_parameter &ct, found_relationships_t &relationships, common::model::relationship_t relationship_hint = common::model::relationship_t::kAggregation); void build_template_instantiation_process_expression_argument( const cppast::cpp_template_argument &targ, - model::class_template &ct) const; + model::template_parameter &ct) const; bool build_template_instantiation_add_base_classes(model::class_ &tinst, std::deque> &template_base_params, int arg_index, bool variadic_params, - const model::class_template &ct) const; + const model::template_parameter &ct) const; void process_function_parameter_find_relationships_in_template( model::class_ &c, const std::set &template_parameter_names, diff --git a/src/cx/util.cc b/src/cx/util.cc index 08c99d28..4de3512e 100644 --- a/src/cx/util.cc +++ b/src/cx/util.cc @@ -25,7 +25,7 @@ #include #include -#include +#include #include namespace clanguml { @@ -254,19 +254,19 @@ const cppast::cpp_type &unreferenced(const cppast::cpp_type &t) return t; } -std::vector +std::vector parse_unexposed_template_params(const std::string ¶ms, std::function ns_resolve) { - using class_diagram::model::class_template; + using class_diagram::model::template_parameter; - std::vector res; + std::vector res; int nested_template_level{0}; auto it = params.begin(); std::string type{}; - std::vector nested_params; + std::vector nested_params; bool complete_class_template{false}; while (it != params.end()) { @@ -293,7 +293,8 @@ parse_unexposed_template_params(const std::string ¶ms, nested_params = parse_unexposed_template_params(nested_params_str, ns_resolve); if (nested_params.empty()) - nested_params.emplace_back(class_template{nested_params_str}); + nested_params.emplace_back( + template_parameter{nested_params_str}); it = bracket_match_end - 1; } else if (*it == '>') { @@ -306,10 +307,11 @@ parse_unexposed_template_params(const std::string ¶ms, type += *it; } if (complete_class_template) { - class_template t; + template_parameter t; t.set_type(ns_resolve(clanguml::util::trim(type))); type = ""; - t.template_params_ = std::move(nested_params); + for (auto &¶m : nested_params) + t.add_template_param(std::move(param)); res.emplace_back(std::move(t)); complete_class_template = false; @@ -318,10 +320,11 @@ parse_unexposed_template_params(const std::string ¶ms, } if (!type.empty()) { - class_template t; + template_parameter t; t.set_type(ns_resolve(clanguml::util::trim(type))); type = ""; - t.template_params_ = std::move(nested_params); + for (auto &¶m : nested_params) + t.add_template_param(std::move(param)); res.emplace_back(std::move(t)); complete_class_template = false; diff --git a/src/cx/util.h b/src/cx/util.h index cd8e1564..6a052095 100644 --- a/src/cx/util.h +++ b/src/cx/util.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include namespace clanguml { @@ -54,7 +54,7 @@ std::pair split_ns( bool is_inside_class(const cppast::cpp_entity &e); -std::vector +std::vector parse_unexposed_template_params(const std::string ¶ms, std::function ns_resolve); diff --git a/tests/test_util.cc b/tests/test_util.cc index 0901000a..01bede11 100644 --- a/tests/test_util.cc +++ b/tests/test_util.cc @@ -99,9 +99,9 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") int_template_str, [](const auto &n) { return n; }); CHECK(int_template.size() == 1); - CHECK(int_template[0].template_params_.size() == 1); + CHECK(int_template[0].template_params().size() == 1); CHECK(int_template[0].type() == "ns1::ns2::class1"); - CHECK(int_template[0].template_params_[0].type() == "int"); + CHECK(int_template[0].template_params()[0].type() == "int"); const std::string int_int_template_str{"ns1::ns2::class1"}; @@ -109,10 +109,10 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") int_int_template_str, [](const auto &n) { return n; }); CHECK(int_int_template.size() == 1); - CHECK(int_int_template[0].template_params_.size() == 2); + CHECK(int_int_template[0].template_params().size() == 2); CHECK(int_int_template[0].type() == "ns1::ns2::class1"); - CHECK(int_int_template[0].template_params_[0].type() == "int"); - CHECK(int_int_template[0].template_params_[1].type() == "int"); + CHECK(int_int_template[0].template_params()[0].type() == "int"); + CHECK(int_int_template[0].template_params()[1].type() == "int"); const std::string nested_template_str{ "class1>>"}; @@ -121,13 +121,13 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") nested_template_str, [](const auto &n) { return n; }); CHECK(nested_template.size() == 1); - CHECK(nested_template[0].template_params_.size() == 2); + CHECK(nested_template[0].template_params().size() == 2); CHECK(nested_template[0].type() == "class1"); - CHECK(nested_template[0].template_params_[0].type() == "int"); - const auto &class2 = nested_template[0].template_params_[1]; + CHECK(nested_template[0].template_params()[0].type() == "int"); + const auto &class2 = nested_template[0].template_params()[1]; CHECK(class2.type() == "ns1::class2"); - CHECK(class2.template_params_[0].type() == "int"); - CHECK(class2.template_params_[1].type() == "std::vector"); - CHECK( - class2.template_params_[1].template_params_[0].type() == "std::string"); + CHECK(class2.template_params()[0].type() == "int"); + CHECK(class2.template_params()[1].type() == "std::vector"); + CHECK(class2.template_params()[1].template_params()[0].type() == + "std::string"); } From 300b4f681254ba9cf0dbc2eae0967180727a4160 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 19 May 2022 00:08:15 +0200 Subject: [PATCH 09/19] Updated cppast ref --- thirdparty/cppast | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/cppast b/thirdparty/cppast index b61374e3..6db9daf5 160000 --- a/thirdparty/cppast +++ b/thirdparty/cppast @@ -1 +1 @@ -Subproject commit b61374e37c4771279bf821006affb112ac08154f +Subproject commit 6db9daf5d2fa161855f70ad3deea0873f53e195f From 79be6ef78807f91b7ef9f6f3a1298fc386742656 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 19 May 2022 00:09:58 +0200 Subject: [PATCH 10/19] Updated t00013 test case for variable template instantiation --- tests/t00013/t00013.cc | 7 +++++++ tests/t00013/test_case.h | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/tests/t00013/t00013.cc b/tests/t00013/t00013.cc index d96d0e84..d132b142 100644 --- a/tests/t00013/t00013.cc +++ b/tests/t00013/t00013.cc @@ -34,6 +34,11 @@ template struct E { T e; }; +template struct G { + T g; + std::tuple args; +}; + using namespace ABCD; class R { public: @@ -52,6 +57,8 @@ public: template T get_f(const F &f) { return f.f; } int get_int_f(const F &f) { return f.f; } + G gintstring; + private: mutable E estring; }; diff --git a/tests/t00013/test_case.h b/tests/t00013/test_case.h index 5bcf89c4..28f672b1 100644 --- a/tests/t00013/test_case.h +++ b/tests/t00013/test_case.h @@ -40,6 +40,9 @@ TEST_CASE("t00013", "[test-case][class]") REQUIRE_THAT(puml, IsClass(_A("B"))); REQUIRE_THAT(puml, IsClass(_A("C"))); REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClassTemplate("E", "T")); + REQUIRE_THAT(puml, IsClassTemplate("G", "T,Args...")); + REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("R"))); REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); @@ -56,6 +59,9 @@ TEST_CASE("t00013", "[test-case][class]") REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F"), _A("F"))); REQUIRE_THAT(puml, IsDependency(_A("R"), _A("F"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("G"), _A("G"))); + save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } From 073b3d157d13d1a85ee01dcea4fd6ffb257f2e9e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 19 May 2022 00:11:51 +0200 Subject: [PATCH 11/19] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 68 ++--- docs/test_cases/t00003_class.svg | 106 +++---- docs/test_cases/t00004_class.svg | 26 +- 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 | 64 ++-- docs/test_cases/t00009_class.svg | 32 +- docs/test_cases/t00010_class.svg | 34 +-- docs/test_cases/t00011_class.svg | 30 +- docs/test_cases/t00012_class.svg | 66 ++--- docs/test_cases/t00013.md | 7 + docs/test_cases/t00013_class.svg | 449 ++++++++++++++++------------- docs/test_cases/t00014_class.svg | 112 +++---- docs/test_cases/t00015_class.svg | 28 +- docs/test_cases/t00016_class.svg | 30 +- docs/test_cases/t00017_class.svg | 100 +++---- docs/test_cases/t00018_class.svg | 70 ++--- docs/test_cases/t00019_class.svg | 98 +++---- docs/test_cases/t00020_class.svg | 114 ++++---- docs/test_cases/t00021_class.svg | 114 ++++---- docs/test_cases/t00022_class.svg | 46 +-- docs/test_cases/t00023_class.svg | 64 ++-- docs/test_cases/t00024_class.svg | 72 ++--- docs/test_cases/t00025_class.svg | 74 ++--- docs/test_cases/t00026_class.svg | 92 +++--- docs/test_cases/t00027_class.svg | 106 +++---- docs/test_cases/t00028_class.svg | 116 ++++---- docs/test_cases/t00029_class.svg | 54 ++-- docs/test_cases/t00030_class.svg | 46 +-- docs/test_cases/t00031_class.svg | 60 ++-- docs/test_cases/t00032_class.svg | 74 ++--- docs/test_cases/t00033_class.svg | 62 ++-- docs/test_cases/t00034_class.svg | 54 ++-- docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036_class.svg | 42 +-- docs/test_cases/t00037_class.svg | 46 +-- docs/test_cases/t00038_class.svg | 76 ++--- docs/test_cases/t00039_class.svg | 104 +++---- docs/test_cases/t00040_class.svg | 42 +-- docs/test_cases/t00041_class.svg | 64 ++-- docs/test_cases/t00042_class.svg | 22 +- docs/test_cases/t00043_class.svg | 110 +++---- docs/test_cases/t30001_package.svg | 54 ++-- docs/test_cases/t30002_package.svg | 112 +++---- docs/test_cases/t30003_package.svg | 28 +- docs/test_cases/t30004_package.svg | 42 +-- docs/test_cases/t30005_package.svg | 42 +-- docs/test_cases/t30006_package.svg | 26 +- docs/test_cases/t30007_package.svg | 30 +- docs/test_cases/t30008_package.svg | 42 +-- docs/test_cases/t40001_include.svg | 46 +-- docs/test_cases/t40002_include.svg | 44 +-- docs/test_cases/t40003_include.svg | 66 ++--- 54 files changed, 1926 insertions(+), 1874 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 14368c04..cb465a23 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + A - + - + foo_a() = 0 : void - + - + foo_c() = 0 : void - - + + B - + - + foo_a() : void - - + + C - + - + foo_c() : void - - + + D - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - - + + E - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - + This is class A - + This is class B - + This is class D which is a little like B diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index d8b232af..e1e2cc66 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,187 +9,187 @@ - - + + A - + - + public_member : int - + - + static_int : int - + - + static_const_int : int const - + - + auto_member : unsigned long const - + - + protected_member : int - + - + private_member : int - + - + a : int - + - + b : int - + - + c : int - + - + A() : void - + - + A(int i) : void - + - + A(A&& ) : void - + - + A(A const& ) : void - + - + ~A() : void - + - + basic_method() : void - + - + static_method() : int - + - + const_method() const : void - + - + auto_method() : int - + - + double_int(int const i) : int - + - + sum(double const a, double const b) : double - + - + default_int(int i = 12) : int - + - + create_from_int(int i) : A - + - + protected_method() : void - + - + private_method() : void - + - + compare : std::function<bool(int const)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 5d2cb65e..f459b89a 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,38 +9,38 @@ - - + + A - + - + foo() const : void - + - + foo2() const : void - - + + AA - - + + Lights @@ -50,8 +50,8 @@ Red - - + + AAA diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 2d976e9e..3011528d 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 : D const* - + - + e : E const& - + - + f : F&& - + - + g : G** - + - + h : H*** - + - + i : I*& - + - + j : J volatile* - + - + k : K* diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 831880eb..a82b28f1 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 628f6398..358ec79a 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 13f44bd3..f774d86c 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,33 +103,33 @@ int,Vector - - + + D - + - + ints : B<int,Vector> - + - + D(std::tuple<Items...>* ) : void - + - + add(int i) : void diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 1564ca7d..9d7aeb31 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 bbb462af..f1a373a7 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 0241eb6c..15164892 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,49 +18,49 @@ T - + - + value : T - - + + A - + - + foo() : void - - + + B - + - + m_a : A* - + - + foo() : void diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index 8b239d49..e73b17ea 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 : int - - + + 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.md b/docs/test_cases/t00013.md index bac2230a..b6da68aa 100644 --- a/docs/test_cases/t00013.md +++ b/docs/test_cases/t00013.md @@ -55,6 +55,11 @@ template struct E { T e; }; +template struct G { + T g; + std::tuple args; +}; + using namespace ABCD; class R { public: @@ -73,6 +78,8 @@ public: template T get_f(const F &f) { return f.f; } int get_int_f(const F &f) { return f.f; } + G gintstring; + private: mutable E estring; }; diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index ff338fef..f873bf88 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,250 +9,295 @@ - - - - - ABCD::F - - T - + + + + + ABCD::F + + T + - - - + + + - - f : T + + f : T - - - - - - A - + + + + + + A + - - - + + + - - a : int + + a : int - - - - - - B - + + + + + + B + - - - + + + - - b : int + + b : int - - - - - - C - + + + + + + C + - - - + + + - - c : int + + c : int - - - - - - D - + + + + + + D + - - - + + + - - d : int + + d : int - - - - + + + + - - print(R* r) : void + + print(R* r) : void - - - - - E - - T - + + + + + E + + T + - - - + + + - - e : T + + e : T - - - - - E - - int - - - - - - F - - int - - - - - - E - - std::string - - - - - - - R - + + + + + + G + + T,Args... + - - - + + + - - estring : E<std::string> + + g : T - - - - + + + - - get_a(A* a) : int + + args : std::tuple<Args...> - - - + + + + + E + + int + + + + + + F + + int + + + + + + G + + int,float,std::string + + + + + + E + + std::string + + + + + + + R + - - get_b(B& b) : int + + + - - - + + gintstring : G<int,float,std::string> - - get_const_b(B const& b) : int + + + - - - + + estring : E<std::string> - - get_c(C c) : int + + + + - - - + + get_a(A* a) : int - - get_d(D&& d) : int + + + - - - + + get_b(B& b) : int - - get_d2(D&& d) : int + + + - - - + + get_const_b(B const& b) : int - - get_e(E<T> e) : T + + + - - - + + get_c(C c) : int - - get_int_e(E<int> const& e) : int + + + - - - + + get_d(D&& d) : int - - get_int_e2(E<int>& e) : int + + + - - - + + get_d2(D&& d) : int - - get_f(F<T> const& f) : T + + + - - - + + get_e(E<T> e) : T - - get_int_f(F<int> const& f) : int + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - estring + + get_int_e(E<int> const& e) : int + + + + + + + get_int_e2(E<int>& e) : int + + + + + + + get_f(F<T> const& f) : T + + + + + + + get_int_f(F<int> const& f) : int + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gintstring + + + + estring diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 678e3359..768e63a1 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,30 +18,30 @@ T,P - + - + t : T - + - + p : P - - + + B - + A @@ -49,7 +49,7 @@ T,std::string - + A @@ -57,7 +57,7 @@ T,std::unique_ptr<std::string> - + A @@ -65,7 +65,7 @@ long,T - + A @@ -73,7 +73,7 @@ double,T - + A @@ -81,7 +81,7 @@ long,bool - + A @@ -89,7 +89,7 @@ double,bool - + A @@ -97,7 +97,7 @@ long,float - + A @@ -105,7 +105,7 @@ double,float - + A @@ -113,7 +113,7 @@ bool,std::string - + A @@ -121,123 +121,123 @@ float,std::unique_ptr<std::string> - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + cb : GeneralCallback<AIntString> - + - + vps : VectorPtr<B> - + - + - + - + - + - + - + - + - + - + - + bapair - + vps - + bapair - + abool - + aboolfloat - + aboolfloat - + afloat - + boolstring - + floatstring diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index d6e84947..61b9f3f8 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - + + 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 efa57c1a..7b130a70 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 @@ -31,8 +31,8 @@ value : enum - - + + is_numeric @@ -43,8 +43,8 @@ value : enum - - + + is_numeric @@ -55,8 +55,8 @@ value : enum - - + + is_numeric @@ -67,13 +67,13 @@ value : enum - + - + - + - + diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 1f9af4b4..7ded0974 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,176 +9,176 @@ - - + + 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& - + - + R(int& some_int, C& cc, E const& ee, F&& ff, I*& ii) : void - + - + -c - + - + -e - + - + -f - + - + -i - + -a - + -b - + -d - + -g - + -h - + -j - + -k diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 56cf9526..c539c590 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + impl::widget - + - + n : int - + - + draw(widget const& w) const : void - + - + draw(widget const& w) : void - + - + widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> - + - + draw() const : void - + - + draw() : void - + - + shown() const : bool - + - + widget(int ) : void - + - + ~widget() : void - + - + widget(widget&& ) : void - + - + widget(widget const& ) : void - + - + operator=(widget&& ) : widget& - + - + operator=(widget const& ) : widget& - + - + pImpl diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 67e6d7eb..9418941c 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Layer2 @@ -19,44 +19,44 @@ - + - + all_calls_count() const : int - - + + Base - + - + Base() : void - + - + ~Base() : void - + - + m1() : int - - + + Layer1 @@ -65,15 +65,15 @@ - + - + m1() : int - - + + Layer3 @@ -81,43 +81,43 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int - + - + m1() : int - + - + m1_calls() const : int - + - + m2_calls() const : int - + Layer3 @@ -125,7 +125,7 @@ Base - + Layer2 @@ -133,7 +133,7 @@ Layer3<Base> - + Layer1 @@ -141,52 +141,52 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> - + - + - + - + - + - + - + - + - + - + layers - + layers - + layers - + layers diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index b09aae1a..15dd2e73 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,195 +9,195 @@ - - + + ProductA - + - + ~ProductA() : void - + - + sell(int price) const = 0 : bool - - + + ProductA1 - + - + sell(int price) const : bool - - + + ProductA2 - + - + sell(int price) const : bool - - + + ProductB - + - + ~ProductB() : void - + - + buy(int price) const = 0 : bool - - + + ProductB1 - + - + buy(int price) const : bool - - + + ProductB2 - + - + buy(int price) const : bool - - + + AbstractFactory - + - + make_a() const = 0 : std::unique_ptr<ProductA> - + - + make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - - + + Factory2 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index 488ed240..b2c6c571 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,184 +9,184 @@ - - + + Visitor - + - + ~Visitor() : void - + - + visit_A(A const& item) const = 0 : void - + - + visit_B(B const& item) const = 0 : void - - + + Visitor1 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor2 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor3 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Item - + - + ~Item() : void - + - + accept(Visitor const& visitor) const = 0 : void - - + + A - + - + accept(Visitor const& visitor) const : void - - + + B - + - + accept(Visitor const& visitor) const : void - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 4dd4c98f..2d591e28 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,82 +9,82 @@ - - + + A - + - + template_method() : void - + - + method1() = 0 : void - + - + method2() = 0 : void - - + + A1 - + - + method1() : void - + - + method2() : void - - + + A2 - + - + method1() : void - + - + method2() : void - + - + diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 5e5e1557..1fe5dbcc 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,111 +9,111 @@ - - + + Strategy - + - + ~Strategy() : void - + - + algorithm() = 0 : void - - + + StrategyA - + - + algorithm() : void - - + + StrategyB - + - + algorithm() : void - - + + StrategyC - + - + algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> - + - + Context(std::unique_ptr<Strategy> strategy) : void - + - + apply() : void - + - + - + - + - + m_strategy diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 1281f942..a8867d2d 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,126 +9,126 @@ - - + + Target - + - + ~Target() : void - + - + m1() = 0 : void - + - + m2() = 0 : void - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> - + - + Proxy(std::shared_ptr<Target> target) : void - + - + m1() : void - + - + m2() : void - + - + - + - + m_target - + diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index d62845cf..abcb630d 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,52 +9,52 @@ - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy @@ -62,36 +62,36 @@ T - + - + m_target : std::shared_ptr<T> - + - + Proxy(std::shared_ptr<T> target) : void - + - + m1() : void - + - + m2() : void - + Proxy @@ -99,7 +99,7 @@ Target1 - + Proxy @@ -107,41 +107,41 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> - + - + - + - + - + proxy1 - + proxy2 diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index ab8dda35..1f5ea3ad 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,30 +18,30 @@ T - + - + m_value : T - + - + Memento(T&& v) : void - + - + value() const : T - - + + Originator @@ -49,51 +49,51 @@ T - + - + m_value : T - + - + Originator(T&& v) : void - + - + memoize_value() const : Memento<T> - + - + load(Memento<T> const& m) : void - + - + print() const : void - + - + set(T&& v) : void - - + + Caretaker @@ -101,29 +101,29 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> - + - + state(std::string const& n) : Memento<T>& - + - + set_state(std::string const& s, Memento<T>&& m) : void - + Caretaker @@ -131,7 +131,7 @@ std::string - + Originator @@ -139,45 +139,45 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> - + - + - + m_mementos - + - + - + caretaker - + originator diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 0c3363f2..dd030c14 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Shape - + - + display() = 0 : void - + - + ~Shape() : void - - + + Line @@ -41,15 +41,15 @@ - + - + display() : void - - + + Text @@ -58,30 +58,30 @@ - + - + display() : void - - + + ShapeDecorator - + - + display() = 0 : void - - + + Color @@ -90,15 +90,15 @@ - + - + display() : void - - + + Weight @@ -107,14 +107,14 @@ - + - + display() : void - + Line @@ -122,7 +122,7 @@ Color,Weight - + Line @@ -130,7 +130,7 @@ Color - + Text @@ -138,7 +138,7 @@ Color,Weight - + Text @@ -146,71 +146,71 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> - + - + - + - + - + - + - + - + - + border - + divider - + title - + description diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 60d023a9..d4493a2b 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,68 +9,68 @@ - - + + A - + A class note. - + A class note. - - + + B - + B class note. - + B class note. - - + + C - + C class note. - + C class note. - - + + D - + D class note. - + D class note. - - + + E @@ -78,27 +78,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -108,13 +108,13 @@ three - + F enum note. - + F enum note. - + E @@ -122,97 +122,97 @@ 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 class note. - - - - + + + + - + - + ccc - + aaa - + bbb - + ddd - + eee - + ggg diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 6cc156e1..9fa7fae3 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,72 +45,72 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3& - + - + g4 : std::shared_ptr<G4> - + g1 - + g4 diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index 04a4794b..75bd3ab0 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,91 +9,91 @@ - - + + A - - + + B - - + + C - - + + D - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + aaa - + bbb 0..1 1..* - + ccc 0..1 1..5 - + ddd diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 8851378b..da80248c 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,57 +71,57 @@ int - - + + R - + - + aaa : A* - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D* - + - + aaa - + bbb - + ccc - + ddd diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index e402b096..a68cc06c 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,69 +9,69 @@ - - + + Base - - + + TBase - - + + A - + - + operator()() : void - - + + B - + - + operator()() : void - - + + C - + - + operator()() : void - - + + Overload @@ -79,15 +79,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -95,42 +95,42 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> - + - + - + - + - + - + - + - + - + - + - + overload diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 10d979de..378e3e17 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,34 +99,34 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> - + - + - + - + - + - + - + abc diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 0c1f28bf..e6bca620 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Void - + - + operator==(Void const& ) const : bool - + - + operator!=(Void const& ) const : bool - - + + lift_void @@ -41,8 +41,8 @@ - - + + lift_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,8 +61,8 @@ - - + + drop_void @@ -71,43 +71,43 @@ - - + + A - - + + R - + - + la : lift_void_t<A>* - + - + lv : lift_void_t<void>* - + - + - + - + la diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index fdacdbec..fe9cd2d9 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 dae00c2f..55a13da3 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,32 +59,32 @@ int - - + + B - + - + a_int : A<int> - - + + C - + - + a_int diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index c4115ba5..987aaf66 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,84 +9,84 @@ - - + + ST - + - + dimensions : «anonymous» - - + + <<anonymous>> - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + A - + - + st : ST - + - + A() : void - + - + st diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index a8e55dd1..99db568d 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,40 +39,40 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - - + + map @@ -81,8 +81,8 @@ - - + + map @@ -91,8 +91,8 @@ - - + + map @@ -101,8 +101,8 @@ - - + + map @@ -111,8 +111,8 @@ - - + + map @@ -121,31 +121,31 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index b3aeaee5..a679c208 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,39 +156,39 @@ T,M,N - + - + n : N* - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index b13e5130..037f2c30 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,76 +9,76 @@ - - + + A - + - + ii_ : int - + - + get_a() : int - - + + AA - - + + AAA - + - + b : B* - + - + get_aaa() : int - - + + R - + - + foo(A* a) : void - + - + diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index 7ff03e21..0ea8b207 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - - + + R - - + + D - + - + rr : RR* - - + + E - - + + F - - + + RR - + - + e : E* - + - + f : F* - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM - + rr - + +e - + +f - + - + - + - + diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 22427b2e..13469f8f 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 - - + + B @@ -35,18 +35,18 @@ T,K - + - + b : T - + - + bb : K diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 187db3b8..86fce8a2 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,189 +9,189 @@ - + dependants - + dependencies - - + + A - - + + B - + - + b(dependants::A* a) : void - - + + BB - + - + bb(dependants::A* a) : void - - + + C - + - + c(dependants::B* b) : void - - + + D - + - + d(dependants::C* c) : void - + - + dd(dependants::BB* bb) : void - - + + E - + - + e(dependants::D* d) : void - - + + G - - + + GG - - + + H - + - + h(dependencies::G* g) : void - + - + hh(dependencies::GG* gg) : void - - + + I - + - + i(dependencies::H* h) : void - - + + J - + - + i(dependencies::I* i) : void - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 20241e67..e1d98a56 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 64e534ef..7a7efcf6 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,135 +9,135 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + BBB - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 57a3831d..19fac381 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - + + 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 5a34ce3b..1f740dad 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + Another CCC 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 29f2c428..cbd2e4e2 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + 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 ab5ab8c1..550d593f 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + B - - + + A - - + + C - + Top A note. - + Bottom A note. - - - + + + - + diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index c5b1aa37..6050d8d3 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. - + Bottom A note. - - - + + + - + diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index b639047c..c4df9c30 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - + - + - + - + diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 5fa3f1e6..0b18e5b2 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,58 +9,58 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + cppast/cpp_preprocessor.hpp - + This is a lib1 include dir - + This is a t40001_include1.h include file - + - + - + - + - + - + - - + + diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index ebbc743b..0762c9bc 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,58 +9,58 @@ - + 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 adfbb1d4..93c7a5d8 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,84 +9,84 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc - + - + - + - + - + - + - + - + From dc26d1354d64eaa694adad73be218618d803f4d2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 13:41:58 +0200 Subject: [PATCH 12/19] Fixed template instantiation matching --- src/class_diagram/model/class.cc | 11 +- src/class_diagram/model/class.h | 7 +- src/class_diagram/model/template_parameter.cc | 72 ++++++++-- src/class_diagram/model/template_parameter.h | 20 ++- .../visitor/translation_unit_visitor.cc | 131 ++++++++++++++---- .../visitor/translation_unit_visitor.h | 7 + tests/t00014/t00014.cc | 8 +- tests/t00019/test_case.h | 10 ++ 8 files changed, 215 insertions(+), 51 deletions(-) diff --git a/src/class_diagram/model/class.cc b/src/class_diagram/model/class.cc index 60abcb23..1d1597ff 100644 --- a/src/class_diagram/model/class.cc +++ b/src/class_diagram/model/class.cc @@ -105,7 +105,7 @@ std::string class_::full_name_no_ns() const ostr << name(); - render_template_params(ostr); + render_template_params(ostr, false); return ostr.str(); } @@ -118,7 +118,7 @@ std::string class_::full_name(bool relative) const std::ostringstream ostr; ostr << name_and_ns(); - render_template_params(ostr); + render_template_params(ostr, relative); std::string res; @@ -134,7 +134,7 @@ std::string class_::full_name(bool relative) const } std::ostringstream &class_::render_template_params( - std::ostringstream &ostr) const + std::ostringstream &ostr, bool relative) const { using clanguml::common::model::namespace_; @@ -144,8 +144,8 @@ std::ostringstream &class_::render_template_params( std::transform(templates_.cbegin(), templates_.cend(), std::back_inserter(tnames), - [ns = using_namespace()]( - const auto &tmplt) { return tmplt.to_string(ns); }); + [ns = using_namespace(), relative]( + const auto &tmplt) { return tmplt.to_string(ns, relative); }); ostr << fmt::format("<{}>", fmt::join(tnames, ",")); } @@ -160,4 +160,5 @@ bool class_::is_abstract() const return std::any_of(methods_.begin(), methods_.end(), [](const auto &method) { return method.is_pure_virtual(); }); } + } diff --git a/src/class_diagram/model/class.h b/src/class_diagram/model/class.h index c4a714b7..d48824e4 100644 --- a/src/class_diagram/model/class.h +++ b/src/class_diagram/model/class.h @@ -79,8 +79,13 @@ public: void is_alias(bool alias) { is_alias_ = alias; } + void find_relationships( + std::vector> + &nested_relationships); + private: - std::ostringstream &render_template_params(std::ostringstream &ostr) const; + std::ostringstream &render_template_params( + std::ostringstream &ostr, bool relative) const; bool is_struct_{false}; bool is_template_{false}; diff --git a/src/class_diagram/model/template_parameter.cc b/src/class_diagram/model/template_parameter.cc index a19f549b..58888841 100644 --- a/src/class_diagram/model/template_parameter.cc +++ b/src/class_diagram/model/template_parameter.cc @@ -17,6 +17,7 @@ */ #include "template_parameter.h" +#include "common/model/enums.h" #include #include @@ -81,6 +82,11 @@ void template_parameter::add_template_param(template_parameter &&ct) template_params_.emplace_back(std::move(ct)); } +void template_parameter::add_template_param(const template_parameter &ct) +{ + template_params_.push_back(ct); +} + const std::vector & template_parameter::template_params() const { @@ -113,28 +119,37 @@ bool operator!=(const template_parameter &l, const template_parameter &r) } std::string template_parameter::to_string( - const clanguml::common::model::namespace_ &using_namespace) const + const clanguml::common::model::namespace_ &using_namespace, + bool relative) const { using clanguml::common::model::namespace_; std::string res; - if (!type().empty()) - res += namespace_{type()}.relative_to(using_namespace).to_string(); - - // Render nested template params - if (!template_params_.empty()) { - std::vector params; - for (const auto &template_param : template_params_) { - params.push_back(template_param.to_string(using_namespace)); - } - - res += fmt::format("<{}>", fmt::join(params, ",")); + if (!type().empty()) { + if (!relative) + res += namespace_{type()}.to_string(); + else + res += namespace_{type()}.relative_to(using_namespace).to_string(); } if (!name().empty()) { if (!type().empty()) res += " "; - res += namespace_{name()}.relative_to(using_namespace).to_string(); + if (!relative) + res += namespace_{name()}.to_string(); + else + res += namespace_{name()}.relative_to(using_namespace).to_string(); + } + + // Render nested template params + if (!template_params_.empty()) { + std::vector params; + for (const auto &template_param : template_params_) { + params.push_back( + template_param.to_string(using_namespace, relative)); + } + + res += fmt::format("<{}>", fmt::join(params, ",")); } if (!default_value().empty()) { @@ -142,7 +157,38 @@ std::string template_parameter::to_string( res += default_value(); } + // TODO: Refactor this to external configurable class + util::replace_all(res, "std::basic_string", "std::string"); + util::replace_all(res, "std::basic_string", "std::wstring"); + return res; } +void template_parameter::find_nested_relationships( + std::vector> + &nested_relationships, + common::model::relationship_t hint, + std::function condition) const +{ + // If this type argument should be included in the relationship + // just add it and skip recursion (e.g. this is a user defined type) + if (condition(name())) { + nested_relationships.push_back({to_string({}, false), hint}); + } + // Otherwise (e.g. this is a std::shared_ptr) and we're actually + // interested what is stored inside it + else { + for (const auto &template_argument : template_params()) { + if (condition(template_argument.name())) { + nested_relationships.push_back( + {template_argument.to_string({}, false), hint}); + } + else { + template_argument.find_nested_relationships( + nested_relationships, hint, condition); + } + } + } +} + } diff --git a/src/class_diagram/model/template_parameter.h b/src/class_diagram/model/template_parameter.h index a25b0a8d..0599000d 100644 --- a/src/class_diagram/model/template_parameter.h +++ b/src/class_diagram/model/template_parameter.h @@ -17,6 +17,7 @@ */ #pragma once +#include "common/model/enums.h" #include "common/model/namespace.h" #include @@ -24,10 +25,10 @@ namespace clanguml::class_diagram::model { -/// @brief Represents template parameter or template parameter instantiation +/// @brief Represents template parameter or template argument /// -/// This class can represent both template parameter and template parameter -/// instantiation, including variadic parameters and instantiations with +/// This class can represent both template parameter and template arguments, +/// including variadic parameters and instantiations with /// nested templates class template_parameter { public: @@ -35,6 +36,8 @@ public: const std::string &name = "", const std::string &default_value = "", bool is_variadic = false); + template_parameter(const template_parameter &right) = default; + void set_type(const std::string &type); std::string type() const; @@ -72,12 +75,21 @@ public: } std::string to_string( - const clanguml::common::model::namespace_ &using_namespace) const; + const clanguml::common::model::namespace_ &using_namespace, + bool relative) const; void add_template_param(template_parameter &&ct); + void add_template_param(const template_parameter &ct); + const std::vector &template_params() const; + void find_nested_relationships( + std::vector> + &nested_relationships, + common::model::relationship_t hint, + std::function condition) const; + private: /// Represents the type of non-type template parameters /// e.g. 'int' diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 061113a3..da05f81a 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -746,7 +746,7 @@ bool translation_unit_visitor::process_field_with_template_instantiation( mv.type().kind() == cppast::cpp_type_kind::reference_t) relationship_type = relationship_t::kAssociation; else - relationship_type = relationship_t::kAggregation; + relationship_type = nested_relationship_hint; relationship rr{relationship_type, tinst.full_name(), detail::cpp_access_specifier_to_access(as), mv.name()}; @@ -780,8 +780,20 @@ bool translation_unit_visitor::process_field_with_template_instantiation( ctx.diagram().add_class(std::move(tinst_ptr)); } - else if (!nested_relationships.empty()) { - for (const auto &rel : nested_relationships) { + + found_relationships_t nested_relationships2; + if (!ctx.diagram().should_include(tinst.get_namespace(), tinst.name())) + for (const auto &template_argument : tinst.templates()) { + template_argument.find_nested_relationships(nested_relationships2, + relationship_type, + [&d = ctx.diagram()](const std::string &full_name) { + auto [ns, name] = cx::util::split_ns(full_name); + return d.should_include(ns, name); + }); + } + + if (!nested_relationships2.empty()) { + for (const auto &rel : nested_relationships2) { relationship nested_relationship{std::get<1>(rel), std::get<0>(rel), detail::cpp_access_specifier_to_access(as), mv.name()}; nested_relationship.set_style(m.style_spec()); @@ -1581,7 +1593,7 @@ bool translation_unit_visitor::find_relationships_in_unexposed_template_params( { bool found{false}; LOG_DBG("Finding relationships in user defined type: {}", - ct.to_string(ctx.config().using_namespace())); + ct.to_string(ctx.config().using_namespace(), false)); auto type_with_namespace = ctx.get_name_with_namespace(ct.type()); @@ -1610,14 +1622,18 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( relationship_t nested_relationship_hint, std::optional parent) { + // // Create class_ instance to hold the template instantiation + // auto tinst_ptr = std::make_unique(ctx.config().using_namespace()); auto &tinst = *tinst_ptr; std::string full_template_name; auto tr_declaration = cppast::to_string(t); + // // If this is an alias - resolve the alias target + // const auto &unaliased = static_cast( resolve_alias(t)); @@ -1625,16 +1641,20 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( bool t_is_alias = t_unaliased_declaration != tr_declaration; + // // Here we'll hold the template base params to replace with the instantiated // values + // std::deque> template_base_params{}; tinst.set_namespace(ctx.get_namespace()); auto tinst_full_name = cppast::to_string(t); + // // Typically, every template instantiation should have a primary_template() // which should also be generated here if it doesn't exist yet in the model + // if (t.primary_template().get(ctx.entity_index()).size()) { auto size = t.primary_template().get(ctx.entity_index()).size(); (void)size; @@ -1650,7 +1670,9 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( LOG_DBG("Building template instantiation for {}", full_template_name); + // // Extract namespace from base template name + // const auto [ns, name] = cx::util::split_ns(tinst_full_name); tinst.set_name(name); if (ns.is_empty()) @@ -1661,6 +1683,9 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( tinst.is_template_instantiation(true); tinst.is_alias(t_is_alias); + // + // Process exposed template arguments - if any + // if (t.arguments_exposed()) { auto arg_index = 0U; // We can figure this only when we encounter variadic param in @@ -1690,7 +1715,10 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( ct); } - LOG_DBG("Adding template argument '{}'", ct.name()); + LOG_DBG("Adding template argument '{}'", + ct.to_string(ctx.config().using_namespace(), false)); + + // assert(!ct.name().empty() || !ct.type().empty()); tinst.add_template(std::move(ct)); } @@ -1702,6 +1730,7 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( auto fn = cx::util::full_name(tt, ctx.entity_index(), false); fn = util::split(fn, "<")[0]; + // TODO: Refactor template instantiation search to a separate method std::string destination; if (ctx.has_type_alias(fn)) { // If this is a template alias - set the instantiation @@ -1715,9 +1744,12 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( // First try to find the best match for this template in partially // specialized templates for (const auto c : ctx.diagram().classes()) { - if (c->name_and_ns() == full_template_name && + std::string left = c->name_and_ns(); + auto left_count = c->templates().size(); + auto right_count = tinst.templates().size(); + if (c != tinst && left == full_template_name && // TODO: handle variadic templates - c->templates().size() == tinst.templates().size()) { + left_count == right_count) { int tmp_match = 0; for (int i = 0; i < tinst.templates().size(); i++) { const auto &tinst_i = tinst.templates().at(i); @@ -1771,11 +1803,12 @@ bool translation_unit_visitor::build_template_instantiation_add_base_classes( } if (add_template_argument_as_base_class) { - LOG_DBG("Adding template argument as base class '{}'", ct.name()); + LOG_DBG("Adding template argument as base class '{}'", + ct.to_string({}, false)); class_parent cp; cp.set_access(access_t::kPublic); - cp.set_name(ct.name()); + cp.set_name(ct.to_string({}, false)); tinst.add_parent(std::move(cp)); } @@ -1806,31 +1839,42 @@ void translation_unit_visitor:: template_parameter &ct, found_relationships_t &nested_relationships, common::model::relationship_t relationship_hint) { - ct.set_name(cppast::to_string(targ.type().value())); - - LOG_DBG("Template argument is a type {}", ct.name()); - auto fn = cx::util::full_name( + auto full_name = cx::util::full_name( cppast::remove_cv(cx::util::unreferenced(targ.type().value())), ctx.entity_index(), false); - auto [fn_ns, fn_name] = cx::util::split_ns(fn); + auto [fn_ns, fn_name] = cx::util::split_ns(full_name); auto template_argument_kind = targ.type().value().kind(); if (template_argument_kind == cppast::cpp_type_kind::unexposed_t) { // Here we're on our own - just make a best guess - if (!fn.empty() && !util::contains(fn, "<") && - !util::contains(fn, ":") && std::isupper(fn.at(0))) + if (!full_name.empty() && !util::contains(full_name, "<") && + !util::contains(full_name, ":") && std::isupper(full_name.at(0))) ct.is_template_parameter(true); else ct.is_template_parameter(false); + + ct.set_name(full_name); } else if (template_argument_kind == cppast::cpp_type_kind::template_parameter_t) { ct.is_template_parameter(true); + ct.set_name(full_name); + } + else if (template_argument_kind == cppast::cpp_type_kind::builtin_t) { + ct.is_template_parameter(false); + ct.set_type(full_name); } else if (template_argument_kind == cppast::cpp_type_kind::template_instantiation_t) { + // Check if this template should be simplified (e.g. system + // template aliases such as std:basic_string should be simply + // std::string + if (simplify_system_template(ct, full_name)) { + return; + } + const auto &nested_template_parameter = static_cast( targ.type().value()); @@ -1842,14 +1886,23 @@ void translation_unit_visitor:: auto [tinst_ns, tinst_name] = cx::util::split_ns(tinst.full_name(false)); - auto nested_tinst = build_template_instantiation( - nested_template_parameter, nested_relationships, relationship_hint, - ctx.diagram().should_include(tinst_ns, tinst_name) - ? std::make_optional(&tinst) - : parent); + ct.set_name(full_name.substr(0, full_name.find('<'))); + + assert(!ct.name().empty()); + + found_relationships_t sub_nested_relationships; + auto nested_tinst = + build_template_instantiation(nested_template_parameter, + sub_nested_relationships, relationship_hint, + ctx.diagram().should_include(tinst_ns, tinst_name) + ? std::make_optional(&tinst) + : parent); assert(nested_tinst); + for (const auto &t : nested_tinst->templates()) + ct.add_template_param(t); + relationship tinst_dependency{ relationship_t::kDependency, nested_tinst->full_name()}; @@ -1863,6 +1916,10 @@ void translation_unit_visitor:: {nested_tinst->full_name(false), relationship_hint}); ctx.diagram().add_class(std::move(nested_tinst)); } + else { + if (!sub_nested_relationships.empty()) + nested_relationships.push_back(sub_nested_relationships[0]); + } if (ctx.diagram().should_include(tinst_ns, tinst_name) // TODO: check why this breaks t00033: @@ -1871,7 +1928,7 @@ void translation_unit_visitor:: ) { LOG_DBG("Creating nested template dependency to template " "instantiation {}, {} -> {}", - fn, tinst.full_name(), tinst_dependency.destination()); + full_name, tinst.full_name(), tinst_dependency.destination()); tinst.add_relationship(std::move(tinst_dependency)); } @@ -1879,14 +1936,15 @@ void translation_unit_visitor:: LOG_DBG("Creating nested template dependency to parent " "template " "instantiation {}, {} -> {}", - fn, (*parent)->full_name(), tinst_dependency.destination()); + full_name, (*parent)->full_name(), + tinst_dependency.destination()); (*parent)->add_relationship(std::move(tinst_dependency)); } else { LOG_DBG("No nested template dependency to template " "instantiation: {}, {} -> {}", - fn, tinst.full_name(), tinst_dependency.destination()); + full_name, tinst.full_name(), tinst_dependency.destination()); } } else if (template_argument_kind == cppast::cpp_type_kind::user_defined_t) { @@ -1899,6 +1957,8 @@ void translation_unit_visitor:: "type {} -> {}", tinst.full_name(), tinst_dependency.destination()); + ct.set_name(full_name); + if (ctx.diagram().should_include(fn_ns, fn_name)) { tinst.add_relationship(std::move(tinst_dependency)); nested_relationships.push_back( @@ -2034,4 +2094,27 @@ const cppast::cpp_type &translation_unit_visitor::resolve_alias_template( return type; } + +bool translation_unit_visitor::simplify_system_template( + template_parameter &ct, const std::string &full_name) +{ + if (full_name == "std::basic_string") { + ct.set_name("std::string"); + return true; + } + else if (full_name == "std::basic_string") { + ct.set_name("std::wstring"); + return true; + } + else if (full_name == "std::basic_string") { + ct.set_name("std::u16string"); + return true; + } + else if (full_name == "std::basic_string") { + ct.set_name("std::u32string"); + return true; + } + else + return false; +} } diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 5768b8c1..04d613e2 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -49,6 +49,11 @@ namespace clanguml::class_diagram::visitor { using found_relationships_t = std::vector>; +// class nested_template_relationships { +// +// std::vector> children; +//}; + class translation_unit_visitor { public: translation_unit_visitor(cppast::cpp_entity_index &idx, @@ -232,5 +237,7 @@ private: // ctx allows to track current visitor context, e.g. current namespace translation_unit_context ctx; + bool simplify_system_template( + model::template_parameter ¶meter, const std::string &basicString); }; } diff --git a/tests/t00014/t00014.cc b/tests/t00014/t00014.cc index 18929c44..7978f432 100644 --- a/tests/t00014/t00014.cc +++ b/tests/t00014/t00014.cc @@ -1,11 +1,11 @@ -#include +//#include #include -#include +//#include #include #include -#include +//#include #include -#include +//#include #include #include diff --git a/tests/t00019/test_case.h b/tests/t00019/test_case.h index cddbdb28..31654680 100644 --- a/tests/t00019/test_case.h +++ b/tests/t00019/test_case.h @@ -44,6 +44,16 @@ TEST_CASE("t00019", "[test-case][class]") IsBaseClass( _A("Layer2>"), _A("Layer1>>"))); + REQUIRE_THAT(puml, + IsAggregation(_A("A"), _A("Layer1>>"), "+layers")); + + REQUIRE_THAT( + puml, !IsAggregation(_A("A"), _A("Layer2>"), "+layers")); + + REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Layer3"), "+layers")); + + REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Base"), "+layers")); + save_puml( "./" + config.output_directory() + "/" + diagram->name + ".puml", puml); } From 315c1d26e6152d518caa05e5bc58107c1e0cc67b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 16:06:20 +0200 Subject: [PATCH 13/19] Refactored type specialization and instantiation matching --- src/class_diagram/model/class.cc | 31 ++++ src/class_diagram/model/class.h | 3 + .../visitor/translation_unit_visitor.cc | 165 ++++++++---------- .../visitor/translation_unit_visitor.h | 20 ++- 4 files changed, 121 insertions(+), 98 deletions(-) diff --git a/src/class_diagram/model/class.cc b/src/class_diagram/model/class.cc index 1d1597ff..c623359f 100644 --- a/src/class_diagram/model/class.cc +++ b/src/class_diagram/model/class.cc @@ -161,4 +161,35 @@ bool class_::is_abstract() const [](const auto &method) { return method.is_pure_virtual(); }); } +int class_::calculate_template_specialization_match( + const class_ &other, const std::string &full_name) const +{ + int res{}; + + std::string left = name_and_ns(); + // TODO: handle variadic templates + if ((name_and_ns() != full_name) || + (templates().size() != other.templates().size())) { + return res; + } + + // Iterate over all template arguments + for (int i = 0; i < other.templates().size(); i++) { + const auto &template_arg = templates().at(i); + const auto &other_template_arg = other.templates().at(i); + + if (template_arg == other_template_arg) { + res++; + } + else if (other_template_arg.is_specialization_of(template_arg)) { + continue; + } + else { + res = 0; + break; + } + } + + return res; +} } diff --git a/src/class_diagram/model/class.h b/src/class_diagram/model/class.h index d48824e4..757c5850 100644 --- a/src/class_diagram/model/class.h +++ b/src/class_diagram/model/class.h @@ -83,6 +83,9 @@ public: std::vector> &nested_relationships); + int calculate_template_specialization_match( + const class_ &other, const std::string &full_name) const; + private: std::ostringstream &render_template_params( std::ostringstream &ostr, bool relative) const; diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index da05f81a..1158aa05 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -210,11 +210,9 @@ void translation_unit_visitor::process_type_alias_template( else { if (at.type_alias().underlying_type().kind() == cppast::cpp_type_kind::template_instantiation_t) { - found_relationships_t nested_relationships; auto tinst = build_template_instantiation( static_cast( - resolve_alias(at.type_alias().underlying_type())), - nested_relationships); + resolve_alias(at.type_alias().underlying_type()))); assert(tinst); @@ -698,18 +696,18 @@ void translation_unit_visitor::process_class_children( } bool translation_unit_visitor::process_field_with_template_instantiation( - const cppast::cpp_member_variable &mv, const cppast::cpp_type &tr, - class_ &c, class_member &m, cppast::cpp_access_specifier_kind as) + const cppast::cpp_member_variable &mv, const cppast::cpp_type &type, + class_ &c, class_member &member, cppast::cpp_access_specifier_kind as) { LOG_DBG("Processing field with template instantiation type {}", - cppast::to_string(tr)); + cppast::to_string(type)); bool res = false; - auto tr_declaration = cppast::to_string(tr); + auto tr_declaration = cppast::to_string(type); const auto &template_instantiation_type = - static_cast(tr); + static_cast(type); const auto &unaliased = static_cast( @@ -718,6 +716,21 @@ bool translation_unit_visitor::process_field_with_template_instantiation( auto tr_unaliased_declaration = cppast::to_string(unaliased); std::unique_ptr tinst_ptr; + + found_relationships_t nested_relationships; + if (tr_declaration == tr_unaliased_declaration) + tinst_ptr = build_template_instantiation(unaliased); + else + tinst_ptr = build_template_instantiation( + static_cast( + type.canonical())); + + auto &tinst = *tinst_ptr; + + // + // Infer the relationship of this field to the template + // instantiation + // TODO: Refactor this to a configurable mapping relationship_t nested_relationship_hint = relationship_t::kAggregation; if (tr_unaliased_declaration.find("std::shared_ptr") == 0) { @@ -727,20 +740,6 @@ bool translation_unit_visitor::process_field_with_template_instantiation( nested_relationship_hint = relationship_t::kAssociation; } - found_relationships_t nested_relationships; - if (tr_declaration == tr_unaliased_declaration) - tinst_ptr = build_template_instantiation( - unaliased, nested_relationships, nested_relationship_hint); - else - tinst_ptr = build_template_instantiation( - static_cast( - tr.canonical()), - nested_relationships, nested_relationship_hint); - - auto &tinst = *tinst_ptr; - - // Infer the relationship of this field to the template - // instantiation relationship_t relationship_type{}; if (mv.type().kind() == cppast::cpp_type_kind::pointer_t || mv.type().kind() == cppast::cpp_type_kind::reference_t) @@ -750,10 +749,10 @@ bool translation_unit_visitor::process_field_with_template_instantiation( relationship rr{relationship_type, tinst.full_name(), detail::cpp_access_specifier_to_access(as), mv.name()}; - rr.set_style(m.style_spec()); + rr.set_style(member.style_spec()); // Process field decorators - auto [decorator_rtype, decorator_rmult] = m.get_relationship(); + auto [decorator_rtype, decorator_rmult] = member.get_relationship(); if (decorator_rtype != relationship_t::kNone) { rr.set_type(decorator_rtype); auto mult = util::split(decorator_rmult, ":"); @@ -781,19 +780,38 @@ bool translation_unit_visitor::process_field_with_template_instantiation( ctx.diagram().add_class(std::move(tinst_ptr)); } - found_relationships_t nested_relationships2; - if (!ctx.diagram().should_include(tinst.get_namespace(), tinst.name())) - for (const auto &template_argument : tinst.templates()) { - template_argument.find_nested_relationships(nested_relationships2, - relationship_type, - [&d = ctx.diagram()](const std::string &full_name) { - auto [ns, name] = cx::util::split_ns(full_name); - return d.should_include(ns, name); - }); - } + // + // Only add nested template relationships to this class if the top level + // template is not in the diagram (e.g. it is a std::shared_ptr<>) + // + if (!ctx.diagram().should_include(tinst.get_namespace(), tinst.name())) { + res = add_nested_template_relationships(mv, c, member, as, tinst, + relationship_type, decorator_rtype, decorator_rmult); + } - if (!nested_relationships2.empty()) { - for (const auto &rel : nested_relationships2) { + return res; +} + +bool translation_unit_visitor::add_nested_template_relationships( + const cppast::cpp_member_variable &mv, class_ &c, class_member &m, + cppast::cpp_access_specifier_kind &as, const class_ &tinst, + relationship_t &relationship_type, relationship_t &decorator_rtype, + std::string &decorator_rmult) +{ + bool res{false}; + found_relationships_t nested_relationships; + + for (const auto &template_argument : tinst.templates()) { + template_argument.find_nested_relationships(nested_relationships, + relationship_type, + [&d = ctx.diagram()](const std::string &full_name) { + auto [ns, name] = cx::util::split_ns(full_name); + return d.should_include(ns, name); + }); + } + + if (!nested_relationships.empty()) { + for (const auto &rel : nested_relationships) { relationship nested_relationship{std::get<1>(rel), std::get<0>(rel), detail::cpp_access_specifier_to_access(as), mv.name()}; nested_relationship.set_style(m.style_spec()); @@ -868,9 +886,11 @@ void translation_unit_visitor::process_field( // TODO } + // // Try to find relationships in the type of the member, unless it has // been already added as part of template processing or it is marked // to be skipped in the comment + // if (!m.skip_relationship() && !template_instantiation_added_as_aggregation && (tr.kind() != cppast::cpp_type_kind::builtin_t) && @@ -1261,10 +1281,9 @@ void translation_unit_visitor:: c.add_relationship(std::move(rr)); } else { - found_relationships_t nested_relationships; // First check if tinst already exists - auto tinst_ptr = build_template_instantiation( - template_instantiation_type, nested_relationships); + auto tinst_ptr = + build_template_instantiation(template_instantiation_type); const auto &tinst = *tinst_ptr; relationship rr{relationship_t::kDependency, tinst.full_name()}; @@ -1618,8 +1637,6 @@ bool translation_unit_visitor::find_relationships_in_unexposed_template_params( std::unique_ptr translation_unit_visitor::build_template_instantiation( const cppast::cpp_template_instantiation_type &t, - found_relationships_t &nested_relationships, - relationship_t nested_relationship_hint, std::optional parent) { // @@ -1697,9 +1714,8 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( for (const auto &targ : t.arguments().value()) { template_parameter ct; if (targ.type()) { - build_template_instantiation_process_type_argument(parent, - tinst, targ, ct, nested_relationships, - nested_relationship_hint); + build_template_instantiation_process_type_argument( + parent, tinst, targ, ct); } else if (targ.expression()) { build_template_instantiation_process_expression_argument( @@ -1715,10 +1731,7 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( ct); } - LOG_DBG("Adding template argument '{}'", - ct.to_string(ctx.config().using_namespace(), false)); - - // assert(!ct.name().empty() || !ct.type().empty()); + LOG_DBG("Adding template argument '{}'", ct.to_string({}, false)); tinst.add_template(std::move(ct)); } @@ -1730,7 +1743,6 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( auto fn = cx::util::full_name(tt, ctx.entity_index(), false); fn = util::split(fn, "<")[0]; - // TODO: Refactor template instantiation search to a separate method std::string destination; if (ctx.has_type_alias(fn)) { // If this is a template alias - set the instantiation @@ -1738,46 +1750,31 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( destination = cppast::to_string(ctx.get_type_alias(fn).get()); } else { - std::string tmp_destination{}; + std::string best_match_full_name{}; int best_match = 0; // First try to find the best match for this template in partially // specialized templates for (const auto c : ctx.diagram().classes()) { - std::string left = c->name_and_ns(); - auto left_count = c->templates().size(); - auto right_count = tinst.templates().size(); - if (c != tinst && left == full_template_name && - // TODO: handle variadic templates - left_count == right_count) { - int tmp_match = 0; - for (int i = 0; i < tinst.templates().size(); i++) { - const auto &tinst_i = tinst.templates().at(i); - const auto &c_i = c->templates().at(i); - if (c_i == tinst_i) { - tmp_match++; - } - else if (tinst_i.is_specialization_of(c_i)) { - continue; - } - else { - tmp_match = 0; - break; - } - } - if (tmp_match > best_match) { - best_match = tmp_match; - tmp_destination = c->full_name(false); - } + if (c == tinst) + continue; + + auto match = c->calculate_template_specialization_match( + tinst, full_template_name); + + if (match > best_match) { + best_match = match; + best_match_full_name = c->full_name(false); } } - if (!tmp_destination.empty()) - destination = tmp_destination; + if (!best_match_full_name.empty()) + destination = best_match_full_name; else // Otherwise point to the base template destination = tinst.base_template(); } + relationship r{relationship_t::kInstantiation, destination}; tinst.add_relationship(std::move(r)); @@ -1836,8 +1833,7 @@ void translation_unit_visitor:: build_template_instantiation_process_type_argument( const std::optional &parent, class_ &tinst, const cppast::cpp_template_argument &targ, - template_parameter &ct, found_relationships_t &nested_relationships, - common::model::relationship_t relationship_hint) + template_parameter &ct) { auto full_name = cx::util::full_name( cppast::remove_cv(cx::util::unreferenced(targ.type().value())), @@ -1890,10 +1886,8 @@ void translation_unit_visitor:: assert(!ct.name().empty()); - found_relationships_t sub_nested_relationships; auto nested_tinst = build_template_instantiation(nested_template_parameter, - sub_nested_relationships, relationship_hint, ctx.diagram().should_include(tinst_ns, tinst_name) ? std::make_optional(&tinst) : parent); @@ -1912,14 +1906,9 @@ void translation_unit_visitor:: cx::util::split_ns(nested_tinst_full_name); if (ctx.diagram().should_include(nested_tinst_ns, nested_tinst_name)) { - nested_relationships.push_back( - {nested_tinst->full_name(false), relationship_hint}); + ctx.diagram().add_class(std::move(nested_tinst)); } - else { - if (!sub_nested_relationships.empty()) - nested_relationships.push_back(sub_nested_relationships[0]); - } if (ctx.diagram().should_include(tinst_ns, tinst_name) // TODO: check why this breaks t00033: @@ -1961,8 +1950,6 @@ void translation_unit_visitor:: if (ctx.diagram().should_include(fn_ns, fn_name)) { tinst.add_relationship(std::move(tinst_dependency)); - nested_relationships.push_back( - {tinst_dependency.destination(), relationship_hint}); } else if (parent) { (*parent)->add_relationship(std::move(tinst_dependency)); diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 04d613e2..00286c19 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -77,9 +77,9 @@ public: cppast::cpp_access_specifier_kind as); bool process_field_with_template_instantiation( - const cppast::cpp_member_variable &mv, const cppast::cpp_type &tr, + const cppast::cpp_member_variable &mv, const cppast::cpp_type &type, clanguml::class_diagram::model::class_ &c, - clanguml::class_diagram::model::class_member &m, + clanguml::class_diagram::model::class_member &member, cppast::cpp_access_specifier_kind as); void process_static_field(const cppast::cpp_variable &mv, @@ -169,9 +169,6 @@ private: std::unique_ptr build_template_instantiation( const cppast::cpp_template_instantiation_type &t, - found_relationships_t &relationships, - common::model::relationship_t nested_relationship_hint = - common::model::relationship_t::kAggregation, std::optional parent = {}); /** @@ -217,10 +214,7 @@ private: void build_template_instantiation_process_type_argument( const std::optional &parent, model::class_ &tinst, const cppast::cpp_template_argument &targ, - class_diagram::model::template_parameter &ct, - found_relationships_t &relationships, - common::model::relationship_t relationship_hint = - common::model::relationship_t::kAggregation); + class_diagram::model::template_parameter &ct); void build_template_instantiation_process_expression_argument( const cppast::cpp_template_argument &targ, @@ -239,5 +233,13 @@ private: translation_unit_context ctx; bool simplify_system_template( model::template_parameter ¶meter, const std::string &basicString); + + bool add_nested_template_relationships( + const cppast::cpp_member_variable &mv, model::class_ &c, + model::class_member &m, cppast::cpp_access_specifier_kind &as, + const model::class_ &tinst, + common::model::relationship_t &relationship_type, + common::model::relationship_t &decorator_rtype, + std::string &decorator_rmult); }; } From ec974148700f9ce8052736ae05c41ca127b3d2a1 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 20:36:35 +0200 Subject: [PATCH 14/19] Refactored template argument relationship hints to configuration file option --- .../visitor/translation_unit_visitor.cc | 54 +++++++-------- src/config/config.cc | 68 +++++++++++++++++++ src/config/config.h | 24 ++++++- tests/test_config.cc | 21 ++++++ tests/test_config_data/simple.yml | 12 +++- 5 files changed, 146 insertions(+), 33 deletions(-) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 1158aa05..4cacd599 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -1487,30 +1487,9 @@ bool translation_unit_visitor::find_relationships_in_template_instantiation( auto full_name = fmt::format("{}", fmt::join(ns_and_name, "::")); - // Try to match common containers - // TODO: Refactor to a separate class with configurable - // container list - if (full_name.find("std::unique_ptr") == 0) { - found = find_relationships(args[0u].type().value(), relationships, - relationship_t::kAggregation); - } - else if (full_name.find("std::shared_ptr") == 0) { - found = find_relationships(args[0u].type().value(), relationships, - relationship_t::kAssociation); - } - else if (full_name.find("std::weak_ptr") == 0) { - found = find_relationships(args[0u].type().value(), relationships, - relationship_t::kAssociation); - } - else if (full_name.find("std::vector") == 0) { - if (args[0u].type().has_value()) - found = find_relationships(args[0u].type().value(), relationships, - relationship_t::kAggregation); - else - LOG_DBG("Failed to process template argument of std::vector at: {}", - fn); - } - else if (ctx.diagram().should_include(ns, name)) { + auto full_base_name = full_name.substr(0, full_name.find('<')); + + if (ctx.diagram().should_include(ns, name)) { LOG_DBG("User defined template instantiation: {} | {}", cppast::to_string(t_), cppast::to_string(t_.canonical())); @@ -1529,11 +1508,23 @@ bool translation_unit_visitor::find_relationships_in_template_instantiation( } } else { + int argument_index = 0; + auto relationship_hint = relationship_type; for (const auto &arg : args) { - if (arg.type().has_value()) { - found = find_relationships( - arg.type().value(), relationships, relationship_type); + if (ctx.config().relationship_hints().count(full_base_name) > 0) { + relationship_hint = ctx.config() + .relationship_hints() + .at(full_base_name) + .get(argument_index); } + + if (arg.type().has_value()) { + found = found || + find_relationships( + arg.type().value(), relationships, relationship_hint); + } + + argument_index++; } } @@ -1659,8 +1650,8 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( bool t_is_alias = t_unaliased_declaration != tr_declaration; // - // Here we'll hold the template base params to replace with the instantiated - // values + // Here we'll hold the template base params to replace with the + // instantiated values // std::deque> template_base_params{}; @@ -1669,8 +1660,9 @@ std::unique_ptr translation_unit_visitor::build_template_instantiation( auto tinst_full_name = cppast::to_string(t); // - // Typically, every template instantiation should have a primary_template() - // which should also be generated here if it doesn't exist yet in the model + // Typically, every template instantiation should have a + // primary_template() which should also be generated here if it doesn't + // exist yet in the model // if (t.primary_template().get(ctx.entity_index()).size()) { auto size = t.primary_template().get(ctx.entity_index()).size(); diff --git a/src/config/config.cc b/src/config/config.cc index ba1f2b30..eb0f0c1e 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -120,6 +120,34 @@ common::model::diagram_t include_diagram::type() const return common::model::diagram_t::kInclude; } +void class_diagram::initialize_relationship_hints() +{ + using common::model::relationship_t; + + if (!relationship_hints().count("std::vector")) { + relationship_hints().insert({"std::vector", {}}); + } + if (!relationship_hints().count("std::unique_ptr")) { + relationship_hints().insert({"std::unique_ptr", {}}); + } + if (!relationship_hints().count("std::shared_ptr")) { + relationship_hints().insert( + {"std::shared_ptr", {relationship_t::kAssociation}}); + } + if (!relationship_hints().count("std::weak_ptr")) { + relationship_hints().insert( + {"std::weak_ptr", {relationship_t::kAssociation}}); + } + if (!relationship_hints().count("std::tuple")) { + relationship_hints().insert({"std::tuple", {}}); + } + if (!relationship_hints().count("std::map")) { + relationship_hint_t hint{relationship_t::kNone}; + hint.argument_hints.insert({1, relationship_t::kAggregation}); + relationship_hints().insert({"std::tuple", std::move(hint)}); + } +} + template <> void append_value(plantuml &l, const plantuml &r) { l.append(r); @@ -141,6 +169,7 @@ using clanguml::config::layout_hint; using clanguml::config::method_arguments; using clanguml::config::package_diagram; using clanguml::config::plantuml; +using clanguml::config::relationship_hint_t; using clanguml::config::sequence_diagram; using clanguml::config::source_location; @@ -459,6 +488,9 @@ template <> struct convert { get_option(node, rhs.include_relations_also_as_members); get_option(node, rhs.generate_method_arguments); get_option(node, rhs.generate_packages); + get_option(node, rhs.relationship_hints); + + rhs.initialize_relationship_hints(); return true; } @@ -551,6 +583,42 @@ template <> struct convert { } }; +// +// relationship_hint_t Yaml decoder +// +template <> struct convert { + static bool decode(const Node &node, relationship_hint_t &rhs) + { + assert(node.Type() == NodeType::Map || node.Type() == NodeType::Scalar); + + if (node.Type() == NodeType::Scalar) { + // This will be default relationship hint for all arguments + // of this template (useful for instance for tuples) + rhs.default_hint = node.as(); + } + else { + for (const auto &it : node) { + auto key = it.first.as(); + if (key == "default") { + rhs.default_hint = node["default"].as(); + } + else { + try { + auto index = stoul(key); + rhs.argument_hints[index] = + it.second.as(); + } + catch (std::exception &e) { + return false; + } + } + } + } + + return true; + } +}; + // // config Yaml decoder // diff --git a/src/config/config.h b/src/config/config.h index c663f88d..788871d4 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -95,6 +95,27 @@ struct git_config { std::string toplevel; }; +struct relationship_hint_t { + std::map argument_hints; + common::model::relationship_t default_hint; + + relationship_hint_t(common::model::relationship_t def = + common::model::relationship_t::kAggregation) + : default_hint{def} + { + } + + common::model::relationship_t get(unsigned int argument_index) const + { + if (argument_hints.count(argument_index) > 0) + return argument_hints.at(argument_index); + + return default_hint; + } +}; + +using relationship_hints_t = std::map; + std::string to_string(const hint_t t); struct inheritable_diagram_options { @@ -113,6 +134,7 @@ struct inheritable_diagram_options { option base_directory{"__parent_path"}; option relative_to{"relative_to"}; option generate_system_headers{"generate_system_headers", false}; + option relationship_hints{"relationship_hints"}; void inherit(const inheritable_diagram_options &parent); }; @@ -139,7 +161,7 @@ struct class_diagram : public diagram { option> classes{"classes"}; option layout{"layout"}; - bool has_class(std::string clazz); + void initialize_relationship_hints(); }; struct sequence_diagram : public diagram { diff --git a/tests/test_config.cc b/tests/test_config.cc index d4316568..297ce04d 100644 --- a/tests/test_config.cc +++ b/tests/test_config.cc @@ -68,6 +68,27 @@ TEST_CASE("Test config simple", "[unit-test]") contains(diagram.include().relationships, relationship_t::kOwnership)); CHECK(contains(diagram.exclude().relationships, relationship_t::kNone)); + + CHECK(diagram.relationship_hints().at("std::vector").get(0) == + relationship_t::kComposition); + CHECK(diagram.relationship_hints().at("std::tuple").get(10) == + relationship_t::kAggregation); + CHECK(diagram.relationship_hints().at("std::map").get(0) == + relationship_t::kNone); + CHECK(diagram.relationship_hints().at("std::map").get(1) == + relationship_t::kComposition); + CHECK(diagram.relationship_hints().at("std::shared_ptr").get(0) == + relationship_t::kAssociation); + CHECK(diagram.relationship_hints().at("std::weak_ptr").get(0) == + relationship_t::kAssociation); + CHECK(diagram.relationship_hints().at("std::unique_ptr").get(0) == + relationship_t::kAggregation); + CHECK(diagram.relationship_hints().at("ns1::n2::some_template").get(0) == + relationship_t::kAssociation); + CHECK(diagram.relationship_hints().at("ns1::n2::some_template").get(2) == + relationship_t::kComposition); + CHECK(diagram.relationship_hints().at("ns1::n2::some_template").get(10) == + relationship_t::kAggregation); } TEST_CASE("Test config inherited", "[unit-test]") diff --git a/tests/test_config_data/simple.yml b/tests/test_config_data/simple.yml index d6a44955..332fb1fa 100644 --- a/tests/test_config_data/simple.yml +++ b/tests/test_config_data/simple.yml @@ -33,4 +33,14 @@ diagrams: - dependency exclude: relationships: - - none \ No newline at end of file + - none + relationship_hints: + std::vector: composition + std::map: + default: none + 1: composition + std::tuple: aggregation + ns1::n2::some_template: + default: association + 2: composition + 10: aggregation From 28b0dc66b52a8f52237687dbbe9fa5116b4d8d5a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 20:43:27 +0200 Subject: [PATCH 15/19] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 74 +++---- docs/test_cases/t00003_class.svg | 106 +++++----- docs/test_cases/t00004_class.svg | 32 +-- docs/test_cases/t00005_class.svg | 132 ++++++------- docs/test_cases/t00006_class.svg | 168 ++++++++-------- docs/test_cases/t00007_class.svg | 36 ++-- docs/test_cases/t00008_class.svg | 68 +++---- docs/test_cases/t00009_class.svg | 44 ++--- docs/test_cases/t00010_class.svg | 42 ++-- docs/test_cases/t00011_class.svg | 34 ++-- docs/test_cases/t00012_class.svg | 86 ++++----- docs/test_cases/t00013_class.svg | 160 +++++++-------- docs/test_cases/t00014.md | 8 +- docs/test_cases/t00014_class.svg | 112 +++++------ docs/test_cases/t00015_class.svg | 28 +-- docs/test_cases/t00016_class.svg | 30 +-- docs/test_cases/t00017_class.svg | 100 +++++----- docs/test_cases/t00018_class.svg | 70 +++---- docs/test_cases/t00019_class.svg | 300 ++++++++++++++--------------- docs/test_cases/t00020_class.svg | 114 +++++------ docs/test_cases/t00021_class.svg | 114 +++++------ docs/test_cases/t00022_class.svg | 46 ++--- docs/test_cases/t00023_class.svg | 64 +++--- docs/test_cases/t00024_class.svg | 72 +++---- docs/test_cases/t00025_class.svg | 74 +++---- docs/test_cases/t00026_class.svg | 92 ++++----- docs/test_cases/t00027_class.svg | 106 +++++----- docs/test_cases/t00028_class.svg | 116 +++++------ docs/test_cases/t00029_class.svg | 54 +++--- docs/test_cases/t00030_class.svg | 46 ++--- docs/test_cases/t00031_class.svg | 60 +++--- docs/test_cases/t00032_class.svg | 74 +++---- docs/test_cases/t00033_class.svg | 62 +++--- docs/test_cases/t00034_class.svg | 54 +++--- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 42 ++-- docs/test_cases/t00037_class.svg | 46 ++--- docs/test_cases/t00038_class.svg | 76 ++++---- docs/test_cases/t00039_class.svg | 104 +++++----- docs/test_cases/t00040_class.svg | 42 ++-- docs/test_cases/t00041_class.svg | 64 +++--- docs/test_cases/t00042_class.svg | 22 +-- docs/test_cases/t00043_class.svg | 110 +++++------ docs/test_cases/t30001_package.svg | 54 +++--- docs/test_cases/t30002_package.svg | 112 +++++------ docs/test_cases/t30003_package.svg | 28 +-- docs/test_cases/t30004_package.svg | 42 ++-- docs/test_cases/t30005_package.svg | 42 ++-- docs/test_cases/t30006_package.svg | 26 +-- docs/test_cases/t30007_package.svg | 30 +-- docs/test_cases/t30008_package.svg | 42 ++-- docs/test_cases/t40001_include.svg | 46 ++--- docs/test_cases/t40002_include.svg | 44 ++--- docs/test_cases/t40003_include.svg | 66 +++---- 54 files changed, 1913 insertions(+), 1925 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index cb465a23..c7a2e3e8 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + A - + - + foo_a() = 0 : void - + - + foo_c() = 0 : void - - + + B - + - + foo_a() : void - - + + C - + - + foo_c() : void - - + + D - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - - + + E - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - + This is class A - + This is class B - + This is class D which is a little like B @@ -142,13 +142,13 @@ - + as - + - + diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index e1e2cc66..ae105448 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,187 +9,187 @@ - - + + A - + - + public_member : int - + - + static_int : int - + - + static_const_int : int const - + - + auto_member : unsigned long const - + - + protected_member : int - + - + private_member : int - + - + a : int - + - + b : int - + - + c : int - + - + A() : void - + - + A(int i) : void - + - + A(A&& ) : void - + - + A(A const& ) : void - + - + ~A() : void - + - + basic_method() : void - + - + static_method() : int - + - + const_method() const : void - + - + auto_method() : int - + - + double_int(int const i) : int - + - + sum(double const a, double const b) : double - + - + default_int(int i = 12) : int - + - + create_from_int(int i) : A - + - + protected_method() : void - + - + private_method() : void - + - + compare : std::function<bool(int const)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index f459b89a..09254117 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,38 +9,38 @@ - - + + A - + - + foo() const : void - + - + foo2() const : void - - + + AA - - + + Lights @@ -50,23 +50,23 @@ Red - - + + AAA - + - + - + diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 3011528d..90da9c59 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,238 +9,238 @@ - - + + 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 : D const* - + - + e : E const& - + - + f : F&& - + - + g : G** - + - + h : H*** - + - + i : I*& - + - + j : J volatile* - + - + k : K* - + +a - + +b - + +c - + +d - + +e - + +f - + +g - + +h - + +i - + +j - + +k diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index a82b28f1..a2f873a3 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,159 +162,159 @@ 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> - + - + - + +a - + +b - + +c - + +d - + +e - + +f - + +g - + +h - + +i - + +j - + +k - + lm - + lm - + ns - + ns - + ns diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index 358ec79a..65cb0c05 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> - + +a - + +b - + +c diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index f774d86c..912b10d9 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,38 +103,38 @@ int,Vector - - + + D - + - + ints : B<int,Vector> - + - + D(std::tuple<Items...>* ) : void - + - + add(int i) : void - + - + ints diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 9d7aeb31..d2a471b1 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,50 +50,50 @@ std::vector<std::string> - - + + B - + - + aint : A<int> - + - + astring : A<std::string>* - + - + avector : A<std::vector<std::string>>& - + - + - + - + aint - + astring - + avector diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index f1a373a7..e6b2db31 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,30 +66,30 @@ int - - + + C - + - + aintstring : B<int> - + - + astring - + - + aintstring diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 15164892..06d25cca 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,56 +18,56 @@ T - + - + value : T - - + + A - + - + foo() : void - - + + B - + - + m_a : A* - + - + foo() : void - + «friend» - + m_a diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index e73b17ea..db169895 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 : int - - + + 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,79 +107,79 @@ 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 - + - + - + - + - + - + a1 - + a2 - + b1 - + b2 - + c1 diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index f873bf88..c31604f5 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,83 +18,83 @@ T - + - + f : T - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int - + - + print(R* r) : void - - + + E @@ -102,16 +102,16 @@ T - + - + e : T - - + + G @@ -119,22 +119,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -142,7 +142,7 @@ int - + F @@ -150,7 +150,7 @@ int - + G @@ -158,7 +158,7 @@ int,float,std::string - + E @@ -166,136 +166,136 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> - + - + get_a(A* a) : int - + - + get_b(B& b) : int - + - + get_const_b(B const& b) : int - + - + get_c(C c) : int - + - + get_d(D&& d) : int - + - + get_d2(D&& d) : int - + - + get_e(E<T> e) : T - + - + get_int_e(E<int> const& e) : int - + - + get_int_e2(E<int>& e) : int - + - + get_f(F<T> const& f) : T - + - + get_int_f(F<int> const& f) : int - + - + - + - + - + - + - + - + - + - + - + - + - + - + gintstring - + estring diff --git a/docs/test_cases/t00014.md b/docs/test_cases/t00014.md index 9f801b3e..6e935eb9 100644 --- a/docs/test_cases/t00014.md +++ b/docs/test_cases/t00014.md @@ -22,14 +22,14 @@ diagrams: ## Source code File t00014.cc ```cpp -#include +//#include #include -#include +//#include #include #include -#include +//#include #include -#include +//#include #include #include diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 768e63a1..a5572a67 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,30 +18,30 @@ T,P - + - + t : T - + - + p : P - - + + B - + A @@ -49,7 +49,7 @@ T,std::string - + A @@ -57,7 +57,7 @@ T,std::unique_ptr<std::string> - + A @@ -65,7 +65,7 @@ long,T - + A @@ -73,7 +73,7 @@ double,T - + A @@ -81,7 +81,7 @@ long,bool - + A @@ -89,7 +89,7 @@ double,bool - + A @@ -97,7 +97,7 @@ long,float - + A @@ -105,7 +105,7 @@ double,float - + A @@ -113,7 +113,7 @@ bool,std::string - + A @@ -121,123 +121,123 @@ float,std::unique_ptr<std::string> - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + cb : GeneralCallback<AIntString> - + - + vps : VectorPtr<B> - + - + - + - + - + - + - + - + - + - + - + bapair - + vps - + bapair - + abool - + aboolfloat - + aboolfloat - + afloat - + boolstring - + floatstring diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 61b9f3f8..516e30a8 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - + + 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 7b130a70..57da739d 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 @@ -31,8 +31,8 @@ value : enum - - + + is_numeric @@ -43,8 +43,8 @@ value : enum - - + + is_numeric @@ -55,8 +55,8 @@ value : enum - - + + is_numeric @@ -67,13 +67,13 @@ value : enum - + - + - + - + diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 7ded0974..19dd3fe7 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,176 +9,176 @@ - - + + 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& - + - + R(int& some_int, C& cc, E const& ee, F&& ff, I*& ii) : void - + - + -c - + - + -e - + - + -f - + - + -i - + -a - + -b - + -d - + -g - + -h - + -j - + -k diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index c539c590..ac12ed6f 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + impl::widget - + - + n : int - + - + draw(widget const& w) const : void - + - + draw(widget const& w) : void - + - + widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> - + - + draw() const : void - + - + draw() : void - + - + shown() const : bool - + - + widget(int ) : void - + - + ~widget() : void - + - + widget(widget&& ) : void - + - + widget(widget const& ) : void - + - + operator=(widget&& ) : widget& - + - + operator=(widget const& ) : widget& - + - + pImpl diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 9418941c..4f366954 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,186 +9,174 @@ - - - - - Layer2 - - LowerLayer - - + + + + + Layer2 + + LowerLayer + + - - - + + + - - all_calls_count() const : int + + all_calls_count() const : int - - - - - Base - - + + + + + Base + + - - - + + + - - Base() : void + + Base() : void - - - + + + - - ~Base() : void + + ~Base() : void - - - + + + - - m1() : int + + m1() : int - - - - - Layer1 - - LowerLayer - - + + + + + Layer1 + + LowerLayer + + - - - + + + - - m1() : int + + m1() : int - - - - - Layer3 - - LowerLayer - + + + + + Layer3 + + LowerLayer + - - - + + + - - m_m1_calls : int + + m_m1_calls : int - - - + + + - - m_m2_calls : int + + m_m2_calls : int - - - - + + + + - - m1() : int + + m1() : int - - - + + + - - m1_calls() const : int + + m1_calls() const : int - - - + + + - - m2_calls() const : int + + m2_calls() const : int - - - - Layer3 - - Base - - - - - - Layer2 - - Layer3<Base> - - - - - - Layer1 - - Layer2<Layer3<Base>> - - - - - - - A - + + + + Layer3 + + Base + + + + + + Layer2 + + Layer3<Base> + + + + + + Layer1 + + Layer2<Layer3<Base>> + + + + + + + A + - - - + + + - - layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> + + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> - - - - - - - - - - - - - - - - - - - - - - - layers - - - - layers - - - - layers - - - - layers + + + + + + + + + + + + + + + + + + + + + + + layers diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 15dd2e73..86ab0649 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,195 +9,195 @@ - - + + ProductA - + - + ~ProductA() : void - + - + sell(int price) const = 0 : bool - - + + ProductA1 - + - + sell(int price) const : bool - - + + ProductA2 - + - + sell(int price) const : bool - - + + ProductB - + - + ~ProductB() : void - + - + buy(int price) const = 0 : bool - - + + ProductB1 - + - + buy(int price) const : bool - - + + ProductB2 - + - + buy(int price) const : bool - - + + AbstractFactory - + - + make_a() const = 0 : std::unique_ptr<ProductA> - + - + make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - - + + Factory2 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index b2c6c571..4357d398 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,184 +9,184 @@ - - + + Visitor - + - + ~Visitor() : void - + - + visit_A(A const& item) const = 0 : void - + - + visit_B(B const& item) const = 0 : void - - + + Visitor1 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor2 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor3 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Item - + - + ~Item() : void - + - + accept(Visitor const& visitor) const = 0 : void - - + + A - + - + accept(Visitor const& visitor) const : void - - + + B - + - + accept(Visitor const& visitor) const : void - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 2d591e28..1d759979 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,82 +9,82 @@ - - + + A - + - + template_method() : void - + - + method1() = 0 : void - + - + method2() = 0 : void - - + + A1 - + - + method1() : void - + - + method2() : void - - + + A2 - + - + method1() : void - + - + method2() : void - + - + diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 1fe5dbcc..35929ca1 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,111 +9,111 @@ - - + + Strategy - + - + ~Strategy() : void - + - + algorithm() = 0 : void - - + + StrategyA - + - + algorithm() : void - - + + StrategyB - + - + algorithm() : void - - + + StrategyC - + - + algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> - + - + Context(std::unique_ptr<Strategy> strategy) : void - + - + apply() : void - + - + - + - + - + m_strategy diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index a8867d2d..88219e61 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,126 +9,126 @@ - - + + Target - + - + ~Target() : void - + - + m1() = 0 : void - + - + m2() = 0 : void - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> - + - + Proxy(std::shared_ptr<Target> target) : void - + - + m1() : void - + - + m2() : void - + - + - + - + m_target - + diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index abcb630d..31341dc6 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,52 +9,52 @@ - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy @@ -62,36 +62,36 @@ T - + - + m_target : std::shared_ptr<T> - + - + Proxy(std::shared_ptr<T> target) : void - + - + m1() : void - + - + m2() : void - + Proxy @@ -99,7 +99,7 @@ Target1 - + Proxy @@ -107,41 +107,41 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> - + - + - + - + - + proxy1 - + proxy2 diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 1f5ea3ad..514f6421 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,30 +18,30 @@ T - + - + m_value : T - + - + Memento(T&& v) : void - + - + value() const : T - - + + Originator @@ -49,51 +49,51 @@ T - + - + m_value : T - + - + Originator(T&& v) : void - + - + memoize_value() const : Memento<T> - + - + load(Memento<T> const& m) : void - + - + print() const : void - + - + set(T&& v) : void - - + + Caretaker @@ -101,29 +101,29 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> - + - + state(std::string const& n) : Memento<T>& - + - + set_state(std::string const& s, Memento<T>&& m) : void - + Caretaker @@ -131,7 +131,7 @@ std::string - + Originator @@ -139,45 +139,45 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> - + - + - + m_mementos - + - + - + caretaker - + originator diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index dd030c14..8ca6d8cc 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Shape - + - + display() = 0 : void - + - + ~Shape() : void - - + + Line @@ -41,15 +41,15 @@ - + - + display() : void - - + + Text @@ -58,30 +58,30 @@ - + - + display() : void - - + + ShapeDecorator - + - + display() = 0 : void - - + + Color @@ -90,15 +90,15 @@ - + - + display() : void - - + + Weight @@ -107,14 +107,14 @@ - + - + display() : void - + Line @@ -122,7 +122,7 @@ Color,Weight - + Line @@ -130,7 +130,7 @@ Color - + Text @@ -138,7 +138,7 @@ Color,Weight - + Text @@ -146,71 +146,71 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> - + - + - + - + - + - + - + - + - + border - + divider - + title - + description diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index d4493a2b..68d2ba52 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,68 +9,68 @@ - - + + A - + A class note. - + A class note. - - + + B - + B class note. - + B class note. - - + + C - + C class note. - + C class note. - - + + D - + D class note. - + D class note. - - + + E @@ -78,27 +78,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -108,13 +108,13 @@ three - + F enum note. - + F enum note. - + E @@ -122,97 +122,97 @@ 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 class note. - - - - + + + + - + - + ccc - + aaa - + bbb - + ddd - + eee - + ggg diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 9fa7fae3..a66f8803 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,72 +45,72 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3& - + - + g4 : std::shared_ptr<G4> - + g1 - + g4 diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index 75bd3ab0..ce509dc5 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,91 +9,91 @@ - - + + A - - + + B - - + + C - - + + D - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + aaa - + bbb 0..1 1..* - + ccc 0..1 1..5 - + ddd diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index da80248c..893b9b8f 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,57 +71,57 @@ int - - + + R - + - + aaa : A* - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D* - + - + aaa - + bbb - + ccc - + ddd diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index a68cc06c..ca89c3e1 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,69 +9,69 @@ - - + + Base - - + + TBase - - + + A - + - + operator()() : void - - + + B - + - + operator()() : void - - + + C - + - + operator()() : void - - + + Overload @@ -79,15 +79,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -95,42 +95,42 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> - + - + - + - + - + - + - + - + - + - + - + overload diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 378e3e17..da6d500d 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,34 +99,34 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> - + - + - + - + - + - + - + abc diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index e6bca620..d69f1d07 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Void - + - + operator==(Void const& ) const : bool - + - + operator!=(Void const& ) const : bool - - + + lift_void @@ -41,8 +41,8 @@ - - + + lift_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,8 +61,8 @@ - - + + drop_void @@ -71,43 +71,43 @@ - - + + A - - + + R - + - + la : lift_void_t<A>* - + - + lv : lift_void_t<void>* - + - + - + - + la diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index fe9cd2d9..1b373442 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 55a13da3..0f3e7820 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,32 +59,32 @@ int - - + + B - + - + a_int : A<int> - - + + C - + - + a_int diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 987aaf66..1df5240b 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,84 +9,84 @@ - - + + ST - + - + dimensions : «anonymous» - - + + <<anonymous>> - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + A - + - + st : ST - + - + A() : void - + - + st diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index 99db568d..c22cf787 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,40 +39,40 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - - + + map @@ -81,8 +81,8 @@ - - + + map @@ -91,8 +91,8 @@ - - + + map @@ -101,8 +101,8 @@ - - + + map @@ -111,8 +111,8 @@ - - + + map @@ -121,31 +121,31 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index a679c208..0f4d4fcf 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,39 +156,39 @@ T,M,N - + - + n : N* - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index 037f2c30..8ecf5757 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,76 +9,76 @@ - - + + A - + - + ii_ : int - + - + get_a() : int - - + + AA - - + + AAA - + - + b : B* - + - + get_aaa() : int - - + + R - + - + foo(A* a) : void - + - + diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index 0ea8b207..5638efe6 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - - + + R - - + + D - + - + rr : RR* - - + + E - - + + F - - + + RR - + - + e : E* - + - + f : F* - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM - + rr - + +e - + +f - + - + - + - + diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 13469f8f..2f698d8a 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 - - + + B @@ -35,18 +35,18 @@ T,K - + - + b : T - + - + bb : K diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 86fce8a2..ec0d788d 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,189 +9,189 @@ - + dependants - + dependencies - - + + A - - + + B - + - + b(dependants::A* a) : void - - + + BB - + - + bb(dependants::A* a) : void - - + + C - + - + c(dependants::B* b) : void - - + + D - + - + d(dependants::C* c) : void - + - + dd(dependants::BB* bb) : void - - + + E - + - + e(dependants::D* d) : void - - + + G - - + + GG - - + + H - + - + h(dependencies::G* g) : void - + - + hh(dependencies::GG* gg) : void - - + + I - + - + i(dependencies::H* h) : void - - + + J - + - + i(dependencies::I* i) : void - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index e1d98a56..be83c4c5 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 7a7efcf6..3984b39d 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,135 +9,135 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + BBB - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 19fac381..7d99467a 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - + + 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 1f740dad..d75bf8bb 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + Another CCC 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 cbd2e4e2..157a46e8 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + 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 550d593f..b2f8c1e7 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + B - - + + A - - + + C - + Top A note. - + Bottom A note. - - - + + + - + diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 6050d8d3..0c2ba969 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. - + Bottom A note. - - - + + + - + diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index c4df9c30..0b8e534a 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - + - + - + - + diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 0b18e5b2..2bf2f22b 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,58 +9,58 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + cppast/cpp_preprocessor.hpp - + This is a lib1 include dir - + This is a t40001_include1.h include file - + - + - + - + - + - + - - + + diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 0762c9bc..5a20d90f 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,58 +9,58 @@ - + 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 93c7a5d8..91aef0a4 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,84 +9,84 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc - + - + - + - + - + - + - + - + From 13f0f3861ce2ae392f7c46be0650432e26fe50b5 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 20:48:36 +0200 Subject: [PATCH 16/19] Updated README --- README.md | 67 ++++++++++++++++++++++++++++---------- docs/configuration_file.md | 11 +++++++ tests/t00014/t00014.cc | 4 --- 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 3c85a81b..c2d8ef1a 100644 --- a/README.md +++ b/README.md @@ -146,30 +146,63 @@ and checkout the SVG diagrams in `docs/diagrams` folder. Source code: ```cpp -#include -#include - -namespace clanguml { -namespace t00009 { - -template class A { -public: - T value; +template struct A { + T t; + P p; }; -class B { -public: - A aint; - A *astring; - A> &avector; +struct B { + std::string value; +}; + +template using AString = A; +template using AStringPtr = A>; + +template +using PairPairBA = std::pair>, long>; + +template using VectorPtr = std::unique_ptr>; +template using APtr = std::unique_ptr>; +template using ASharedPtr = std::shared_ptr>; +template +using AAPtr = std::unique_ptr, A>>; + +template using GeneralCallback = std::function; +using VoidCallback = GeneralCallback<>; + +using BVector = std::vector; +using BVector2 = BVector; + +using AIntString = AString; +using AStringString = AString; +using BStringString = AStringString; + +class R { + PairPairBA bapair; + + APtr abool; + AAPtr aboolfloat; + ASharedPtr afloat; + A boolstring; + AStringPtr floatstring; + AIntString intstring; + AStringString stringstring; + BStringString bstringstring; + +protected: + BVector bs; + +public: + BVector2 bs2; + GeneralCallback cb; + VoidCallback vcb; + VectorPtr vps; }; -} -} ``` generates the following diagram (via PlantUML): -![class_diagram_example](docs/test_cases/t00009_class.svg) +![class_diagram_example](docs/test_cases/t00014_class.svg) > Open the raw image [here](https://raw.githubusercontent.com/bkryza/clang-uml/master/docs/test_cases/t00009_class.svg), > and checkout the hover tooltips and hyperlinks to classes and methods. diff --git a/docs/configuration_file.md b/docs/configuration_file.md index 2ce9ee6e..9d216993 100644 --- a/docs/configuration_file.md +++ b/docs/configuration_file.md @@ -101,6 +101,17 @@ diagrams: ClassA: - up: ClassB - left: ClassC + # Specify customized relationship hints for types which are + # arguments in template instantiations + relationship_hints: + # All tuple arguments should be treated as aggregation + std::tuple: aggregation + # All some_template arguments should be treated as associations + # except for arguments with indexes 2 and 10 + ns1::n2::some_template: + default: association + 2: composition + 10: aggregation # Entities from this namespace will be shortened # (can only contain one element at the moment) using_namespace: diff --git a/tests/t00014/t00014.cc b/tests/t00014/t00014.cc index 7978f432..dca89263 100644 --- a/tests/t00014/t00014.cc +++ b/tests/t00014/t00014.cc @@ -1,11 +1,7 @@ -//#include #include -//#include #include #include -//#include #include -//#include #include #include From f5e0515b7e172acbfdd06640bb03ec665aa934a9 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 23:16:51 +0200 Subject: [PATCH 17/19] Refactored standard template aliases to configuration file --- .../plantuml/class_diagram_generator.cc | 2 -- src/class_diagram/model/template_parameter.cc | 13 +----------- .../visitor/translation_unit_visitor.cc | 16 ++------------ src/config/config.cc | 21 +++++++++++++++++++ src/config/config.h | 5 +++++ 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/class_diagram/generators/plantuml/class_diagram_generator.cc b/src/class_diagram/generators/plantuml/class_diagram_generator.cc index ff04e5c0..18d7aa3b 100644 --- a/src/class_diagram/generators/plantuml/class_diagram_generator.cc +++ b/src/class_diagram/generators/plantuml/class_diagram_generator.cc @@ -64,8 +64,6 @@ void generator::generate_alias(const class_ &c, std::ostream &ostr) const else full_name = c.full_name(); - // util::replace_all(full_name, "std::basic_string", "std::string"); - if (full_name.empty()) full_name = "<>"; diff --git a/src/class_diagram/model/template_parameter.cc b/src/class_diagram/model/template_parameter.cc index 58888841..133bc364 100644 --- a/src/class_diagram/model/template_parameter.cc +++ b/src/class_diagram/model/template_parameter.cc @@ -36,14 +36,7 @@ void template_parameter::set_type(const std::string &type) { type_ = type; } std::string template_parameter::type() const { return type_; } -void template_parameter::set_name(const std::string &name) -{ - name_ = name; - // TODO: Add a configurable mapping for simplifying non-interesting - // std templates - util::replace_all(name_, "std::basic_string", "std::string"); - util::replace_all(name_, "std::basic_string", "std::wstring"); -} +void template_parameter::set_name(const std::string &name) { name_ = name; } std::string template_parameter::name() const { @@ -157,10 +150,6 @@ std::string template_parameter::to_string( res += default_value(); } - // TODO: Refactor this to external configurable class - util::replace_all(res, "std::basic_string", "std::string"); - util::replace_all(res, "std::basic_string", "std::wstring"); - return res; } diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 4cacd599..97259946 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -2077,20 +2077,8 @@ const cppast::cpp_type &translation_unit_visitor::resolve_alias_template( bool translation_unit_visitor::simplify_system_template( template_parameter &ct, const std::string &full_name) { - if (full_name == "std::basic_string") { - ct.set_name("std::string"); - return true; - } - else if (full_name == "std::basic_string") { - ct.set_name("std::wstring"); - return true; - } - else if (full_name == "std::basic_string") { - ct.set_name("std::u16string"); - return true; - } - else if (full_name == "std::basic_string") { - ct.set_name("std::u32string"); + if (ctx.config().template_aliases().count(full_name) > 0) { + ct.set_name(ctx.config().template_aliases().at(full_name)); return true; } else diff --git a/src/config/config.cc b/src/config/config.cc index eb0f0c1e..f327ab0d 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -148,6 +148,25 @@ void class_diagram::initialize_relationship_hints() } } +void class_diagram::initialize_template_aliases() +{ + if (!template_aliases().count("std::basic_string")) { + template_aliases().insert({"std::basic_string", "std::string"}); + } + if (!template_aliases().count("std::basic_string")) { + template_aliases().insert( + {"std::basic_string", "std::wstring"}); + } + if (!template_aliases().count("std::basic_string")) { + template_aliases().insert( + {"std::basic_string", "std::u16string"}); + } + if (!template_aliases().count("std::basic_string")) { + template_aliases().insert( + {"std::basic_string", "std::u32string"}); + } +} + template <> void append_value(plantuml &l, const plantuml &r) { l.append(r); @@ -489,8 +508,10 @@ template <> struct convert { get_option(node, rhs.generate_method_arguments); get_option(node, rhs.generate_packages); get_option(node, rhs.relationship_hints); + get_option(node, rhs.template_aliases); rhs.initialize_relationship_hints(); + rhs.initialize_template_aliases(); return true; } diff --git a/src/config/config.h b/src/config/config.h index 788871d4..0c2ad6e9 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -116,6 +116,8 @@ struct relationship_hint_t { using relationship_hints_t = std::map; +using template_aliases_t = std::map; + std::string to_string(const hint_t t); struct inheritable_diagram_options { @@ -135,6 +137,7 @@ struct inheritable_diagram_options { option relative_to{"relative_to"}; option generate_system_headers{"generate_system_headers", false}; option relationship_hints{"relationship_hints"}; + option template_aliases{"template_aliases"}; void inherit(const inheritable_diagram_options &parent); }; @@ -162,6 +165,8 @@ struct class_diagram : public diagram { option layout{"layout"}; void initialize_relationship_hints(); + + void initialize_template_aliases(); }; struct sequence_diagram : public diagram { From 58369ad40aaf76bcac73c147858b69990ea48d1a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 23:19:28 +0200 Subject: [PATCH 18/19] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 68 +++++++-------- docs/test_cases/t00003_class.svg | 106 +++++++++++------------ docs/test_cases/t00004_class.svg | 26 +++--- 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 | 64 +++++++------- docs/test_cases/t00009_class.svg | 32 +++---- docs/test_cases/t00010_class.svg | 34 ++++---- docs/test_cases/t00011_class.svg | 30 +++---- docs/test_cases/t00012_class.svg | 66 +++++++-------- docs/test_cases/t00013_class.svg | 130 ++++++++++++++-------------- docs/test_cases/t00014.md | 4 - docs/test_cases/t00014_class.svg | 74 ++++++++-------- docs/test_cases/t00015_class.svg | 22 ++--- docs/test_cases/t00016_class.svg | 22 ++--- docs/test_cases/t00017_class.svg | 70 +++++++-------- docs/test_cases/t00018_class.svg | 66 +++++++-------- docs/test_cases/t00019_class.svg | 72 ++++++++-------- docs/test_cases/t00020_class.svg | 94 ++++++++++---------- docs/test_cases/t00021_class.svg | 82 +++++++++--------- docs/test_cases/t00022_class.svg | 42 ++++----- docs/test_cases/t00023_class.svg | 54 ++++++------ docs/test_cases/t00024_class.svg | 62 +++++++------- docs/test_cases/t00025_class.svg | 62 +++++++------- docs/test_cases/t00026_class.svg | 78 ++++++++--------- docs/test_cases/t00027_class.svg | 82 +++++++++--------- docs/test_cases/t00028_class.svg | 94 ++++++++++---------- docs/test_cases/t00029_class.svg | 50 +++++------ docs/test_cases/t00030_class.svg | 38 ++++----- docs/test_cases/t00031_class.svg | 50 +++++------ docs/test_cases/t00032_class.svg | 52 ++++++------ docs/test_cases/t00033_class.svg | 48 +++++------ docs/test_cases/t00034_class.svg | 46 +++++----- docs/test_cases/t00035_class.svg | 22 ++--- docs/test_cases/t00036_class.svg | 38 ++++----- docs/test_cases/t00037_class.svg | 42 ++++----- docs/test_cases/t00038_class.svg | 50 +++++------ docs/test_cases/t00039_class.svg | 78 ++++++++--------- docs/test_cases/t00040_class.svg | 38 ++++----- docs/test_cases/t00041_class.svg | 50 +++++------ docs/test_cases/t00042_class.svg | 22 ++--- docs/test_cases/t00043_class.svg | 90 ++++++++++---------- docs/test_cases/t30001_package.svg | 48 +++++------ docs/test_cases/t30002_package.svg | 82 +++++++++--------- docs/test_cases/t30003_package.svg | 26 +++--- docs/test_cases/t30004_package.svg | 32 +++---- 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/t40001_include.svg | 30 +++---- docs/test_cases/t40002_include.svg | 34 ++++---- docs/test_cases/t40003_include.svg | 50 +++++------ 54 files changed, 1466 insertions(+), 1470 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index c7a2e3e8..f63fe482 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + A - + - + foo_a() = 0 : void - + - + foo_c() = 0 : void - - + + B - + - + foo_a() : void - - + + C - + - + foo_c() : void - - + + D - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - - + + E - + - + as : std::vector<A*> - + - + foo_a() : void - + - + foo_c() : void - + This is class A - + This is class B - + This is class D which is a little like B diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index ae105448..f081ca90 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,187 +9,187 @@ - - + + A - + - + public_member : int - + - + static_int : int - + - + static_const_int : int const - + - + auto_member : unsigned long const - + - + protected_member : int - + - + private_member : int - + - + a : int - + - + b : int - + - + c : int - + - + A() : void - + - + A(int i) : void - + - + A(A&& ) : void - + - + A(A const& ) : void - + - + ~A() : void - + - + basic_method() : void - + - + static_method() : int - + - + const_method() const : void - + - + auto_method() : int - + - + double_int(int const i) : int - + - + sum(double const a, double const b) : double - + - + default_int(int i = 12) : int - + - + create_from_int(int i) : A - + - + protected_method() : void - + - + private_method() : void - + - + compare : std::function<bool(int const)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 09254117..0be9ec6d 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,38 +9,38 @@ - - + + A - + - + foo() const : void - + - + foo2() const : void - - + + AA - - + + Lights @@ -50,8 +50,8 @@ Red - - + + AAA diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 90da9c59..7a144b96 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 : D const* - + - + e : E const& - + - + f : F&& - + - + g : G** - + - + h : H*** - + - + i : I*& - + - + j : J volatile* - + - + k : K* diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index a2f873a3..8533aef6 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 65cb0c05..c16df699 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 912b10d9..ca0f90f6 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,33 +103,33 @@ int,Vector - - + + D - + - + ints : B<int,Vector> - + - + D(std::tuple<Items...>* ) : void - + - + add(int i) : void diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index d2a471b1..718a3f69 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 e6b2db31..f9f273e7 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 06d25cca..50d8f399 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,49 +18,49 @@ T - + - + value : T - - + + A - + - + foo() : void - - + + B - + - + m_a : A* - + - + foo() : void diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index db169895..9a232fb7 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 : int - - + + 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 c31604f5..8f24c3e3 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,83 +18,83 @@ T - + - + f : T - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int - + - + print(R* r) : void - - + + E @@ -102,16 +102,16 @@ T - + - + e : T - - + + G @@ -119,22 +119,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -142,7 +142,7 @@ int - + F @@ -150,7 +150,7 @@ int - + G @@ -158,7 +158,7 @@ int,float,std::string - + E @@ -166,103 +166,103 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> - + - + get_a(A* a) : int - + - + get_b(B& b) : int - + - + get_const_b(B const& b) : int - + - + get_c(C c) : int - + - + get_d(D&& d) : int - + - + get_d2(D&& d) : int - + - + get_e(E<T> e) : T - + - + get_int_e(E<int> const& e) : int - + - + get_int_e2(E<int>& e) : int - + - + get_f(F<T> const& f) : T - + - + get_int_f(F<int> const& f) : int diff --git a/docs/test_cases/t00014.md b/docs/test_cases/t00014.md index 6e935eb9..6b2a366b 100644 --- a/docs/test_cases/t00014.md +++ b/docs/test_cases/t00014.md @@ -22,14 +22,10 @@ diagrams: ## Source code File t00014.cc ```cpp -//#include #include -//#include #include #include -//#include #include -//#include #include #include diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index a5572a67..97e00b0d 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,30 +18,30 @@ T,P - + - + t : T - + - + p : P - - + + B - + A @@ -49,7 +49,7 @@ T,std::string - + A @@ -57,7 +57,7 @@ T,std::unique_ptr<std::string> - + A @@ -65,7 +65,7 @@ long,T - + A @@ -73,7 +73,7 @@ double,T - + A @@ -81,7 +81,7 @@ long,bool - + A @@ -89,7 +89,7 @@ double,bool - + A @@ -97,7 +97,7 @@ long,float - + A @@ -105,7 +105,7 @@ double,float - + A @@ -113,7 +113,7 @@ bool,std::string - + A @@ -121,67 +121,67 @@ float,std::unique_ptr<std::string> - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + cb : GeneralCallback<AIntString> - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 516e30a8..63f2416c 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 57da739d..0f880409 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 @@ -31,8 +31,8 @@ value : enum - - + + is_numeric @@ -43,8 +43,8 @@ value : enum - - + + is_numeric @@ -55,8 +55,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 19dd3fe7..6374f922 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,135 +9,135 @@ - - + + 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& - + - + R(int& some_int, C& cc, E const& ee, F&& ff, I*& ii) : void diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index ac12ed6f..d688393b 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - - + + impl::widget - + - + n : int - + - + draw(widget const& w) const : void - + - + draw(widget const& w) : void - + - + widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> - + - + draw() const : void - + - + draw() : void - + - + shown() const : bool - + - + widget(int ) : void - + - + ~widget() : void - + - + widget(widget&& ) : void - + - + widget(widget const& ) : void - + - + operator=(widget&& ) : widget& - + - + operator=(widget const& ) : widget& diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 4f366954..22ddaafe 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Layer2 @@ -19,44 +19,44 @@ - + - + all_calls_count() const : int - - + + Base - + - + Base() : void - + - + ~Base() : void - + - + m1() : int - - + + Layer1 @@ -65,15 +65,15 @@ - + - + m1() : int - - + + Layer3 @@ -81,43 +81,43 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int - + - + m1() : int - + - + m1_calls() const : int - + - + m2_calls() const : int - + Layer3 @@ -125,7 +125,7 @@ Base - + Layer2 @@ -133,7 +133,7 @@ Layer3<Base> - + Layer1 @@ -141,18 +141,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 86ab0649..6e184e84 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,174 +9,174 @@ - - + + ProductA - + - + ~ProductA() : void - + - + sell(int price) const = 0 : bool - - + + ProductA1 - + - + sell(int price) const : bool - - + + ProductA2 - + - + sell(int price) const : bool - - + + ProductB - + - + ~ProductB() : void - + - + buy(int price) const = 0 : bool - - + + ProductB1 - + - + buy(int price) const : bool - - + + ProductB2 - + - + buy(int price) const : bool - - + + AbstractFactory - + - + make_a() const = 0 : std::unique_ptr<ProductA> - + - + make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - - + + Factory2 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index 4357d398..91c57152 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,151 +9,151 @@ - - + + Visitor - + - + ~Visitor() : void - + - + visit_A(A const& item) const = 0 : void - + - + visit_B(B const& item) const = 0 : void - - + + Visitor1 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor2 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Visitor3 - + - + visit_A(A const& item) const : void - + - + visit_B(B const& item) const : void - - + + Item - + - + ~Item() : void - + - + accept(Visitor const& visitor) const = 0 : void - - + + A - + - + accept(Visitor const& visitor) const : void - - + + B - + - + accept(Visitor const& visitor) const : void diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 1d759979..c7d8e8d2 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,77 +9,77 @@ - - + + A - + - + template_method() : void - + - + method1() = 0 : void - + - + method2() = 0 : void - - + + A1 - + - + method1() : void - + - + method2() : void - - + + A2 - + - + method1() : void - + - + method2() : void diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 35929ca1..3f18c1fa 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,100 +9,100 @@ - - + + Strategy - + - + ~Strategy() : void - + - + algorithm() = 0 : void - - + + StrategyA - + - + algorithm() : void - - + + StrategyB - + - + algorithm() : void - - + + StrategyC - + - + algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> - + - + Context(std::unique_ptr<Strategy> strategy) : void - + - + apply() : void diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 88219e61..733347eb 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + Target - + - + ~Target() : void - + - + m1() = 0 : void - + - + m2() = 0 : void - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> - + - + Proxy(std::shared_ptr<Target> target) : void - + - + m1() : void - + - + m2() : void diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index 31341dc6..e757c68b 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,52 +9,52 @@ - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy @@ -62,36 +62,36 @@ T - + - + m_target : std::shared_ptr<T> - + - + Proxy(std::shared_ptr<T> target) : void - + - + m1() : void - + - + m2() : void - + Proxy @@ -99,7 +99,7 @@ Target1 - + Proxy @@ -107,25 +107,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 514f6421..ce37b633 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,30 +18,30 @@ T - + - + m_value : T - + - + Memento(T&& v) : void - + - + value() const : T - - + + Originator @@ -49,51 +49,51 @@ T - + - + m_value : T - + - + Originator(T&& v) : void - + - + memoize_value() const : Memento<T> - + - + load(Memento<T> const& m) : void - + - + print() const : void - + - + set(T&& v) : void - - + + Caretaker @@ -101,29 +101,29 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> - + - + state(std::string const& n) : Memento<T>& - + - + set_state(std::string const& s, Memento<T>&& m) : void - + Caretaker @@ -131,7 +131,7 @@ std::string - + Originator @@ -139,25 +139,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 8ca6d8cc..e731c764 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Shape - + - + display() = 0 : void - + - + ~Shape() : void - - + + Line @@ -41,15 +41,15 @@ - + - + display() : void - - + + Text @@ -58,30 +58,30 @@ - + - + display() : void - - + + ShapeDecorator - + - + display() = 0 : void - - + + Color @@ -90,15 +90,15 @@ - + - + display() : void - - + + Weight @@ -107,14 +107,14 @@ - + - + display() : void - + Line @@ -122,7 +122,7 @@ Color,Weight - + Line @@ -130,7 +130,7 @@ Color - + Text @@ -138,7 +138,7 @@ Color,Weight - + Text @@ -146,39 +146,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 68d2ba52..cf74c801 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,68 +9,68 @@ - - + + A - + A class note. - + A class note. - - + + B - + B class note. - + B class note. - - + + C - + C class note. - + C class note. - - + + D - + D class note. - + D class note. - - + + E @@ -78,27 +78,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -108,13 +108,13 @@ three - + F enum note. - + F enum note. - + E @@ -122,67 +122,67 @@ 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 class note. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index a66f8803..1ec81141 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 ce509dc5..682b0409 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,71 +9,71 @@ - - + + A - - + + B - - + + C - - + + D - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 893b9b8f..02833f40 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 ca89c3e1..9c53078c 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,69 +9,69 @@ - - + + Base - - + + TBase - - + + A - + - + operator()() : void - - + + B - + - + operator()() : void - - + + C - + - + operator()() : void - - + + Overload @@ -79,15 +79,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -95,18 +95,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 da6d500d..c41d34c6 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 d69f1d07..a91d693b 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Void - + - + operator==(Void const& ) const : bool - + - + operator!=(Void const& ) const : bool - - + + lift_void @@ -41,8 +41,8 @@ - - + + lift_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,8 +61,8 @@ - - + + drop_void @@ -71,33 +71,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 1b373442..0292ca9f 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 0f3e7820..5ebb7364 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 1df5240b..c7f04e05 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,77 +9,77 @@ - - + + ST - + - + dimensions : «anonymous» - - + + <<anonymous>> - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + A - + - + st : ST - + - + A() : void diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index c22cf787..c6b3e505 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,40 +39,40 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - - + + map @@ -81,8 +81,8 @@ - - + + map @@ -91,8 +91,8 @@ - - + + map @@ -101,8 +101,8 @@ - - + + map @@ -111,8 +111,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 0f4d4fcf..ecd56701 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 8ecf5757..354d12a3 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,71 +9,71 @@ - - + + A - + - + ii_ : int - + - + get_a() : int - - + + AA - - + + AAA - + - + b : B* - + - + get_aaa() : int - - + + R - + - + foo(A* a) : void diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index 5638efe6..01dd0667 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,93 +9,93 @@ - - + + R - - + + D - + - + rr : RR* - - + + E - - + + F - - + + RR - + - + e : E* - + - + f : F* - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 2f698d8a..91cf9ad7 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 - - + + B @@ -35,18 +35,18 @@ T,K - + - + b : T - + - + bb : K diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index ec0d788d..50785359 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,168 +9,168 @@ - + dependants - + dependencies - - + + A - - + + B - + - + b(dependants::A* a) : void - - + + BB - + - + bb(dependants::A* a) : void - - + + C - + - + c(dependants::B* b) : void - - + + D - + - + d(dependants::C* c) : void - + - + dd(dependants::BB* bb) : void - - + + E - + - + e(dependants::D* d) : void - - + + G - - + + GG - - + + H - + - + h(dependencies::G* g) : void - + - + hh(dependencies::GG* gg) : void - - + + I - + - + i(dependencies::H* h) : void - - + + J - + - + i(dependencies::I* i) : void diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index be83c4c5..1f5eea5f 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + 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 3984b39d..bfae9442 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,103 +9,103 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 7d99467a..13b1a2dc 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 d75bf8bb..3b9914d5 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + Another CCC 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 157a46e8..fd7a24b6 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 b2f8c1e7..e6e3c245 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. - + Bottom A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 0c2ba969..1df74390 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. - + Bottom A note. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 0b8e534a..c91e6790 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/t40001_include.svg b/docs/test_cases/t40001_include.svg index 2bf2f22b..5e4bc0db 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 - + cppast/cpp_preprocessor.hpp - + This is a lib1 include dir - + This is a t40001_include1.h include file diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 5a20d90f..24896067 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 91aef0a4..34531f84 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + include - + dependants - + dependencies - + src - + dependants - + dependencies - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h - - + + t1.cc - - + + t2.cc From adda8300f265cc34ab95eccccc31f7bf4e3e3240 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 21 May 2022 23:24:16 +0200 Subject: [PATCH 19/19] Updated README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2d8ef1a..8708f725 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,7 @@ generates the following diagram (via PlantUML): ![class_diagram_example](docs/test_cases/t00014_class.svg) -> Open the raw image [here](https://raw.githubusercontent.com/bkryza/clang-uml/master/docs/test_cases/t00009_class.svg), +> Open the raw image [here](https://raw.githubusercontent.com/bkryza/clang-uml/master/docs/test_cases/t00014_class.svg), > and checkout the hover tooltips and hyperlinks to classes and methods. ### Sequence diagrams