Extended context filter config schema to accept optional radius parameter

This commit is contained in:
Bartek Kryza
2023-11-09 23:09:17 +01:00
parent 237ef26389
commit 055897f11b
6 changed files with 95 additions and 35 deletions

View File

@@ -33,6 +33,7 @@ using clanguml::common::model::relationship_t;
using clanguml::config::callee_type;
using clanguml::config::class_diagram;
using clanguml::config::config;
using clanguml::config::context_config;
using clanguml::config::diagram_template;
using clanguml::config::filter;
using clanguml::config::generate_links_config;
@@ -419,6 +420,23 @@ template <> struct convert<string_or_regex> {
}
};
template <> struct convert<context_config> {
static bool decode(const Node &node, context_config &rhs)
{
using namespace std::string_literals;
if (node.IsMap() && has_key(node, "match")) {
rhs.radius = node["match"]["radius"].as<unsigned>();
rhs.pattern = node["match"]["radius"].as<string_or_regex>();
}
else {
rhs.radius = 1;
rhs.pattern = node.as<string_or_regex>();
}
return true;
}
};
template <> struct convert<namespace_or_regex> {
static bool decode(const Node &node, namespace_or_regex &rhs)
{