Added method type diagram filter (#145)

This commit is contained in:
Bartek Kryza
2023-06-02 01:05:37 +02:00
parent e7f738c6dc
commit e40dc3a60c
20 changed files with 433 additions and 9 deletions

View File

@@ -34,6 +34,7 @@ using clanguml::config::layout_hint;
using clanguml::config::location_t;
using clanguml::config::member_order_t;
using clanguml::config::method_arguments;
using clanguml::config::method_type;
using clanguml::config::package_diagram;
using clanguml::config::package_type_t;
using clanguml::config::plantuml;
@@ -221,6 +222,32 @@ template <> struct convert<access_t> {
}
};
//
// config method_type decoder
//
template <> struct convert<method_type> {
static bool decode(const Node &node, method_type &rhs)
{
const auto &val = node.as<std::string>();
if (val == to_string(method_type::constructor))
rhs = method_type::constructor;
else if (val == to_string(method_type::assignment))
rhs = method_type::assignment;
else if (val == to_string(method_type::operator_))
rhs = method_type::operator_;
else if (val == to_string(method_type::defaulted))
rhs = method_type::defaulted;
else if (val == to_string(method_type::deleted))
rhs = method_type::deleted;
else if (val == to_string(method_type::static_))
rhs = method_type::static_;
else
return false;
return true;
}
};
//
// config relationship_t decoder
//
@@ -337,6 +364,10 @@ template <> struct convert<filter> {
rhs.element_types =
node["element_types"].as<decltype(rhs.element_types)>();
if (node["method_types"])
rhs.method_types =
node["method_types"].as<decltype(rhs.method_types)>();
if (node["access"])
rhs.access = node["access"].as<decltype(rhs.access)>();
@@ -515,7 +546,8 @@ template <> struct convert<include_diagram> {
rhs.relative_to.set(std::filesystem::current_path());
// Convert the path in relative_to to an absolute path, with respect
// to the directory where the `.clang-uml` configuration file is located
// to the directory where the `.clang-uml` configuration file is
// located
if (rhs.relative_to) {
auto absolute_relative_to =
std::filesystem::path{node["__parent_path"].as<std::string>()} /