Refactored relationship and scope filter types
This commit is contained in:
@@ -151,6 +151,7 @@ template <> void append_value<plantuml>(plantuml &l, const plantuml &r)
|
||||
}
|
||||
|
||||
namespace YAML {
|
||||
using clanguml::common::model::relationship_t;
|
||||
using clanguml::common::model::scope_t;
|
||||
using clanguml::config::class_diagram;
|
||||
using clanguml::config::config;
|
||||
@@ -464,6 +465,53 @@ template <> struct convert<layout_hint> {
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// config relationship_t decoder
|
||||
//
|
||||
template <> struct convert<relationship_t> {
|
||||
static bool decode(const Node &node, relationship_t &rhs)
|
||||
{
|
||||
assert(node.Type() == NodeType::Scalar);
|
||||
|
||||
auto relationship_name = node.as<std::string>();
|
||||
if (relationship_name == "extension" ||
|
||||
relationship_name == "inheritance") {
|
||||
rhs = relationship_t::kExtension;
|
||||
}
|
||||
else if (relationship_name == "composition") {
|
||||
rhs = relationship_t::kComposition;
|
||||
}
|
||||
else if (relationship_name == "aggregation") {
|
||||
rhs = relationship_t::kAggregation;
|
||||
}
|
||||
else if (relationship_name == "containment") {
|
||||
rhs = relationship_t::kContainment;
|
||||
}
|
||||
else if (relationship_name == "ownership") {
|
||||
rhs = relationship_t::kOwnership;
|
||||
}
|
||||
else if (relationship_name == "association") {
|
||||
rhs = relationship_t::kAssociation;
|
||||
}
|
||||
else if (relationship_name == "instantiation") {
|
||||
rhs = relationship_t::kInstantiation;
|
||||
}
|
||||
else if (relationship_name == "friendship") {
|
||||
rhs = relationship_t::kFriendship;
|
||||
}
|
||||
else if (relationship_name == "dependency") {
|
||||
rhs = relationship_t::kDependency;
|
||||
}
|
||||
else if (relationship_name == "none") {
|
||||
rhs = relationship_t::kNone;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// config Yaml decoder
|
||||
//
|
||||
|
||||
@@ -51,16 +51,16 @@ struct filter {
|
||||
std::vector<std::string> elements;
|
||||
|
||||
// E.g.:
|
||||
// - inheritance
|
||||
// - inheritance/extension
|
||||
// - dependency
|
||||
// - instantiation
|
||||
std::vector<std::string> relationships;
|
||||
std::vector<common::model::relationship_t> relationships;
|
||||
|
||||
// E.g.:
|
||||
// - public
|
||||
// - protected
|
||||
// - private
|
||||
std::vector<std::string> scopes;
|
||||
std::vector<common::model::scope_t> scopes;
|
||||
|
||||
std::vector<std::string> subclasses;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user