Added layout hints config option to class diagrams
This commit is contained in:
@@ -204,6 +204,8 @@ using clanguml::common::model::scope_t;
|
||||
using clanguml::config::class_diagram;
|
||||
using clanguml::config::config;
|
||||
using clanguml::config::filter;
|
||||
using clanguml::config::hint_t;
|
||||
using clanguml::config::layout_hint;
|
||||
using clanguml::config::method_arguments;
|
||||
using clanguml::config::package_diagram;
|
||||
using clanguml::config::plantuml;
|
||||
@@ -375,6 +377,7 @@ template <> struct convert<class_diagram> {
|
||||
return false;
|
||||
|
||||
get_option(node, rhs.classes);
|
||||
get_option(node, rhs.layout);
|
||||
get_option(node, rhs.include_relations_also_as_members);
|
||||
get_option(node, rhs.generate_method_arguments);
|
||||
|
||||
@@ -410,6 +413,41 @@ template <> struct convert<package_diagram> {
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// layout_hint Yaml decoder
|
||||
//
|
||||
template <> struct convert<layout_hint> {
|
||||
static bool decode(const Node &node, layout_hint &rhs)
|
||||
{
|
||||
assert(node.Type() == NodeType::Map);
|
||||
|
||||
if (node["up"]) {
|
||||
rhs.hint = hint_t::up;
|
||||
rhs.entity = node["up"].as<std::string>();
|
||||
}
|
||||
else if (node["down"]) {
|
||||
rhs.hint = hint_t::down;
|
||||
rhs.entity = node["down"].as<std::string>();
|
||||
}
|
||||
else if (node["left"]) {
|
||||
rhs.hint = hint_t::left;
|
||||
rhs.entity = node["left"].as<std::string>();
|
||||
}
|
||||
else if (node["right"]) {
|
||||
rhs.hint = hint_t::right;
|
||||
rhs.entity = node["right"].as<std::string>();
|
||||
}
|
||||
else if (node["hidden"]) {
|
||||
rhs.hint = hint_t::hidden;
|
||||
rhs.entity = node["hidden"].as<std::string>();
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// config Yaml decoder
|
||||
//
|
||||
|
||||
@@ -65,6 +65,15 @@ struct filter {
|
||||
std::vector<common::model::scope_t> scopes;
|
||||
};
|
||||
|
||||
enum class hint_t { up, down, left, right, hidden };
|
||||
|
||||
struct layout_hint {
|
||||
hint_t hint;
|
||||
std::string entity;
|
||||
};
|
||||
|
||||
using layout_hints = std::map<std::string, std::vector<layout_hint>>;
|
||||
|
||||
std::string to_string(const diagram_type t);
|
||||
|
||||
struct inheritable_diagram_options {
|
||||
@@ -109,6 +118,7 @@ struct class_diagram : public diagram {
|
||||
diagram_type type() const override;
|
||||
|
||||
option<std::vector<std::string>> classes{"classes"};
|
||||
option<layout_hints> layout{"layout"};
|
||||
|
||||
bool has_class(std::string clazz);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user