Changed scope_t to access_t and fixed friend access specifier handling

This commit is contained in:
Bartek Kryza
2022-03-30 23:27:46 +02:00
parent a216a81e19
commit a8b57e4eb1
30 changed files with 134 additions and 137 deletions

View File

@@ -37,7 +37,7 @@ TEST_CASE("t00011", "[test-case][class]")
REQUIRE_THAT(puml, IsClass(_A("B")));
REQUIRE_THAT(puml, IsClass(_A("D<T>")));
REQUIRE_THAT(puml, IsFriend(_A("A"), _A("B")));
REQUIRE_THAT(puml, IsFriend<Private>(_A("A"), _A("B")));
// REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D<T>")));
save_puml(

View File

@@ -11,7 +11,7 @@ diagrams:
include:
namespaces:
- clanguml::t00040
scopes:
access:
- public
- protected
exclude:

View File

@@ -264,13 +264,6 @@ ContainsMatcher IsAssociation(std::string const &from, std::string const &to,
fmt::format(format_string, from, to, label), caseSensitivity));
}
ContainsMatcher IsFriend(std::string const &from, std::string const &to,
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
{
return ContainsMatcher(CasedString(
fmt::format("{} <.. {} : <<friend>>", from, to), caseSensitivity));
}
ContainsMatcher IsComposition(std::string const &from, std::string const &to,
std::string const &label, std::string multiplicity_source = "",
std::string multiplicity_dest = "",
@@ -424,6 +417,24 @@ ContainsMatcher IsField(std::string const &name,
CasedString(pattern + " : " + type, caseSensitivity));
}
template <typename... Ts>
ContainsMatcher IsFriend(std::string const &from, std::string const &to,
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
{
std::string pattern;
if constexpr (has_type<Public, Ts...>())
pattern = "+";
else if constexpr (has_type<Protected, Ts...>())
pattern = "#";
else
pattern = "-";
return ContainsMatcher(
CasedString(fmt::format("{} <.. {} : {}<<friend>>", from, to, pattern),
caseSensitivity));
}
ContainsMatcher IsPackage(std::string const &str,
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
{

View File

@@ -115,7 +115,7 @@ test_cases:
title: Subclass class diagram filter test
description:
- name: t00040
title: Relationship and scope filter test
title: Relationship and access filter test
description:
Sequence diagrams:
- name: t20001