Added generate_links config option
This commit is contained in:
@@ -91,6 +91,7 @@ void inheritable_diagram_options::inherit(
|
||||
exclude.override(parent.exclude);
|
||||
puml.override(parent.puml);
|
||||
generate_method_arguments.override(parent.generate_method_arguments);
|
||||
generate_links.override(parent.generate_links);
|
||||
}
|
||||
|
||||
bool diagram::should_include_entities(const std::string &ent)
|
||||
@@ -268,6 +269,7 @@ using clanguml::common::model::scope_t;
|
||||
using clanguml::config::class_diagram;
|
||||
using clanguml::config::config;
|
||||
using clanguml::config::filter;
|
||||
using clanguml::config::generate_links_config;
|
||||
using clanguml::config::hint_t;
|
||||
using clanguml::config::layout_hint;
|
||||
using clanguml::config::method_arguments;
|
||||
@@ -439,6 +441,19 @@ template <> struct convert<filter> {
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// generate_links_config Yaml decoder
|
||||
//
|
||||
template <> struct convert<generate_links_config> {
|
||||
static bool decode(const Node &node, generate_links_config &rhs)
|
||||
{
|
||||
if (node["prefix"])
|
||||
rhs.prefix = node["prefix"].as<decltype(rhs.prefix)>();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> bool decode_diagram(const Node &node, T &rhs)
|
||||
{
|
||||
get_option(node, rhs.glob);
|
||||
@@ -464,6 +479,7 @@ template <> struct convert<class_diagram> {
|
||||
get_option(node, rhs.include_relations_also_as_members);
|
||||
get_option(node, rhs.generate_method_arguments);
|
||||
get_option(node, rhs.generate_packages);
|
||||
get_option(node, rhs.generate_links);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -479,6 +495,7 @@ template <> struct convert<sequence_diagram> {
|
||||
return false;
|
||||
|
||||
get_option(node, rhs.start_from);
|
||||
get_option(node, rhs.generate_links);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -494,6 +511,7 @@ template <> struct convert<package_diagram> {
|
||||
return false;
|
||||
|
||||
get_option(node, rhs.layout);
|
||||
get_option(node, rhs.generate_links);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -545,6 +563,7 @@ template <> struct convert<config> {
|
||||
get_option(node, rhs.puml);
|
||||
get_option(node, rhs.generate_method_arguments);
|
||||
get_option(node, rhs.generate_packages);
|
||||
get_option(node, rhs.generate_links);
|
||||
|
||||
auto diagrams = node["diagrams"];
|
||||
|
||||
|
||||
@@ -74,6 +74,10 @@ struct layout_hint {
|
||||
|
||||
using layout_hints = std::map<std::string, std::vector<layout_hint>>;
|
||||
|
||||
struct generate_links_config {
|
||||
std::string prefix;
|
||||
};
|
||||
|
||||
std::string to_string(const diagram_type t);
|
||||
std::string to_string(const hint_t t);
|
||||
|
||||
@@ -88,6 +92,7 @@ struct inheritable_diagram_options {
|
||||
option<method_arguments> generate_method_arguments{
|
||||
"generate_method_arguments", method_arguments::full};
|
||||
option<bool> generate_packages{"generate_packages", false};
|
||||
option<generate_links_config> generate_links{"generate_links"};
|
||||
|
||||
void inherit(const inheritable_diagram_options &parent);
|
||||
};
|
||||
@@ -97,8 +102,6 @@ struct diagram : public inheritable_diagram_options {
|
||||
|
||||
virtual diagram_type type() const = 0;
|
||||
|
||||
std::string name;
|
||||
|
||||
bool should_include_entities(const std::string &ent);
|
||||
|
||||
bool should_include_relationship(const std::string &rel);
|
||||
@@ -119,6 +122,7 @@ struct diagram : public inheritable_diagram_options {
|
||||
|
||||
bool should_include(const common::model::namespace_ &path) const;
|
||||
|
||||
std::string name;
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ template <typename T> struct option {
|
||||
option_inherit_mode im = option_inherit_mode::override)
|
||||
: name{name_}
|
||||
, value{initial_value}
|
||||
, has_value{true}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,6 +43,7 @@ template <typename T> struct option {
|
||||
{
|
||||
value = v;
|
||||
is_declared = true;
|
||||
has_value = true;
|
||||
}
|
||||
|
||||
void override(const option<T> &o)
|
||||
@@ -53,6 +55,7 @@ template <typename T> struct option {
|
||||
value = o.value;
|
||||
|
||||
is_declared = true;
|
||||
has_value = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,9 +65,12 @@ template <typename T> struct option {
|
||||
|
||||
const T &operator()() const { return value; }
|
||||
|
||||
operator bool() const { return has_value; }
|
||||
|
||||
std::string name;
|
||||
T value;
|
||||
bool is_declared{false};
|
||||
bool has_value{false};
|
||||
option_inherit_mode inheritance_mode;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user