Added support for class diagram filtering based on C++20 modules (#195)

This commit is contained in:
Bartek Kryza
2023-12-17 20:49:41 +01:00
parent f2fe1ca2cf
commit ea6892f754
21 changed files with 310 additions and 21 deletions

View File

@@ -180,6 +180,19 @@ struct filter {
*/
std::vector<common::namespace_or_regex> namespaces;
/*! @brief Modules filter
*
* Example:
*
* ```yaml
* include
* modules:
* - app.module1
* - r: ".*internal.*"
* ```
*/
std::vector<common::string_or_regex> modules;
/*! @brief Elements filter
*
* Example:

View File

@@ -64,10 +64,6 @@ types:
regex_t:
r: string
regex_or_string_t: [string, regex_t]
namespaces_filter_t:
namespaces: [regex_or_string_t]
elements_filter_t:
elements: [regex_or_string_t]
element_types_filter_t: !variant
- class
- enum
@@ -121,6 +117,7 @@ types:
- context_filter_match_t
filter_t:
namespaces: !optional [regex_or_string_t]
modules: !optional [regex_or_string_t]
elements: !optional [regex_or_string_t]
element_types: !optional [element_types_filter_t]
relationships: !optional [relationship_filter_t]

View File

@@ -475,6 +475,12 @@ template <> struct convert<filter> {
rhs.namespaces.push_back({ns});
}
if (node["modules"]) {
auto module_list = node["modules"].as<decltype(rhs.modules)>();
for (const auto &ns : module_list)
rhs.modules.push_back({ns});
}
if (node["relationships"])
rhs.relationships =
node["relationships"].as<decltype(rhs.relationships)>();

View File

@@ -122,6 +122,8 @@ YAML::Emitter &operator<<(YAML::Emitter &out, const filter &f)
out << YAML::BeginMap;
if (!f.namespaces.empty())
out << YAML::Key << "namespaces" << YAML::Value << f.namespaces;
if (!f.modules.empty())
out << YAML::Key << "modules" << YAML::Value << f.modules;
if (!f.access.empty())
out << YAML::Key << "access" << YAML::Value << f.access;
if (!f.context.empty())