Extended context filter config schema to accept optional radius parameter
This commit is contained in:
@@ -141,6 +141,11 @@ struct mermaid {
|
||||
void append(const mermaid &r);
|
||||
};
|
||||
|
||||
struct context_config {
|
||||
common::string_or_regex pattern;
|
||||
unsigned radius{0};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Definition of diagram template
|
||||
*/
|
||||
@@ -316,9 +321,13 @@ struct filter {
|
||||
* include:
|
||||
* context:
|
||||
* - ns1::ns2::ClassA
|
||||
* - r: ns1::ns2::ClassB<.*>
|
||||
* - match:
|
||||
* pattern: ns1::ns2::ClassA
|
||||
* radius: 3
|
||||
* ```
|
||||
*/
|
||||
std::vector<common::string_or_regex> context;
|
||||
std::vector<context_config> context;
|
||||
|
||||
/*! @brief Paths filter
|
||||
*
|
||||
|
||||
@@ -112,6 +112,13 @@ types:
|
||||
- function
|
||||
- function_template
|
||||
- lambda
|
||||
context_filter_match_t:
|
||||
match:
|
||||
radius: int
|
||||
pattern: regex_or_string_t
|
||||
context_filter_t:
|
||||
- regex_or_string_t
|
||||
- context_filter_match_t
|
||||
filter_t:
|
||||
namespaces: !optional [regex_or_string_t]
|
||||
elements: !optional [regex_or_string_t]
|
||||
@@ -123,7 +130,7 @@ types:
|
||||
specializations: !optional [regex_or_string_t]
|
||||
dependants: !optional [regex_or_string_t]
|
||||
dependencies: !optional [regex_or_string_t]
|
||||
context: !optional [regex_or_string_t]
|
||||
context: !optional [context_filter_t]
|
||||
paths: !optional [string]
|
||||
method_types: !optional [method_type_filter_t]
|
||||
callee_types: !optional [callee_type_filter_t]
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -104,6 +104,19 @@ YAML::Emitter &operator<<(YAML::Emitter &out, const package_type_t &r)
|
||||
return out;
|
||||
}
|
||||
|
||||
YAML::Emitter &operator<<(YAML::Emitter &out, const context_config &c)
|
||||
{
|
||||
out << YAML::BeginMap;
|
||||
out << YAML::Key << "match";
|
||||
out << YAML::BeginMap;
|
||||
out << YAML::Key << "radius" << YAML::Value << c.radius;
|
||||
out << YAML::Key << "pattern" << YAML::Value << c.pattern;
|
||||
out << YAML::EndMap;
|
||||
out << YAML::EndMap;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
YAML::Emitter &operator<<(YAML::Emitter &out, const filter &f)
|
||||
{
|
||||
out << YAML::BeginMap;
|
||||
|
||||
Reference in New Issue
Block a user