Added module_access diagram filter (#101)
This commit is contained in:
@@ -194,6 +194,22 @@ struct filter {
|
||||
*/
|
||||
std::vector<common::string_or_regex> modules;
|
||||
|
||||
/*! @brief Access type filter
|
||||
*
|
||||
* This filter allows to filter class members methods based on their access:
|
||||
* - public
|
||||
* - private
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```yaml
|
||||
* include:
|
||||
* module_access:
|
||||
* - public
|
||||
* ```
|
||||
*/
|
||||
std::vector<common::model::module_access_t> module_access;
|
||||
|
||||
/*! @brief Elements filter
|
||||
*
|
||||
* Example:
|
||||
@@ -245,8 +261,8 @@ struct filter {
|
||||
*
|
||||
* ```yaml
|
||||
* include:
|
||||
* relationships:
|
||||
* - inheritance
|
||||
* access:
|
||||
* - public
|
||||
* ```
|
||||
*/
|
||||
std::vector<common::model::access_t> access;
|
||||
|
||||
@@ -91,6 +91,9 @@ types:
|
||||
- public
|
||||
- protected
|
||||
- private
|
||||
module_access_filter_t: !variant
|
||||
- public
|
||||
- private
|
||||
method_type_filter_t: !variant
|
||||
- constructor
|
||||
- destructor
|
||||
@@ -123,6 +126,7 @@ types:
|
||||
element_types: !optional [element_types_filter_t]
|
||||
relationships: !optional [relationship_filter_t]
|
||||
access: !optional [access_filter_t]
|
||||
module_access: !optional [module_access_filter_t]
|
||||
subclasses: !optional [regex_or_string_t]
|
||||
parents: !optional [regex_or_string_t]
|
||||
specializations: !optional [regex_or_string_t]
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace YAML {
|
||||
using clanguml::common::namespace_or_regex;
|
||||
using clanguml::common::string_or_regex;
|
||||
using clanguml::common::model::access_t;
|
||||
using clanguml::common::model::module_access_t;
|
||||
using clanguml::common::model::relationship_t;
|
||||
using clanguml::config::callee_type;
|
||||
using clanguml::config::class_diagram;
|
||||
@@ -241,6 +242,23 @@ template <> struct convert<access_t> {
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// config module_access_t decoder
|
||||
//
|
||||
template <> struct convert<module_access_t> {
|
||||
static bool decode(const Node &node, module_access_t &rhs)
|
||||
{
|
||||
if (node.as<std::string>() == "public")
|
||||
rhs = module_access_t::kPublic;
|
||||
else if (node.as<std::string>() == "private")
|
||||
rhs = module_access_t::kPrivate;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// config method_type decoder
|
||||
//
|
||||
@@ -483,6 +501,10 @@ template <> struct convert<filter> {
|
||||
rhs.modules.push_back({ns});
|
||||
}
|
||||
|
||||
if (node["module_access"])
|
||||
rhs.module_access =
|
||||
node["module_access"].as<decltype(rhs.module_access)>();
|
||||
|
||||
if (node["relationships"])
|
||||
rhs.relationships =
|
||||
node["relationships"].as<decltype(rhs.relationships)>();
|
||||
|
||||
@@ -69,6 +69,12 @@ YAML::Emitter &operator<<(YAML::Emitter &out, const access_t &a)
|
||||
return out;
|
||||
}
|
||||
|
||||
YAML::Emitter &operator<<(YAML::Emitter &out, const module_access_t &a)
|
||||
{
|
||||
out << to_string(a);
|
||||
return out;
|
||||
}
|
||||
|
||||
YAML::Emitter &operator<<(YAML::Emitter &out, const diagram_t &d)
|
||||
{
|
||||
out << to_string(d);
|
||||
@@ -124,6 +130,8 @@ YAML::Emitter &operator<<(YAML::Emitter &out, const filter &f)
|
||||
out << YAML::Key << "namespaces" << YAML::Value << f.namespaces;
|
||||
if (!f.modules.empty())
|
||||
out << YAML::Key << "modules" << YAML::Value << f.modules;
|
||||
if (!f.module_access.empty())
|
||||
out << YAML::Key << "module_access" << YAML::Value << f.module_access;
|
||||
if (!f.access.empty())
|
||||
out << YAML::Key << "access" << YAML::Value << f.access;
|
||||
if (!f.context.empty())
|
||||
|
||||
Reference in New Issue
Block a user