Fixed plantuml config option inheritance
This commit is contained in:
@@ -35,8 +35,7 @@ enum class relationship_t {
|
||||
kAssociation,
|
||||
kInstantiation,
|
||||
kFriendship,
|
||||
kDependency,
|
||||
kInclusion
|
||||
kDependency
|
||||
};
|
||||
|
||||
enum class message_t { kCall, kReturn };
|
||||
|
||||
@@ -105,22 +105,6 @@ common::model::diagram_t class_diagram::type() const
|
||||
return common::model::diagram_t::kClass;
|
||||
}
|
||||
|
||||
bool class_diagram::has_class(std::string clazz)
|
||||
{
|
||||
for (const auto &c : classes()) {
|
||||
for (const auto &ns : using_namespace()) {
|
||||
std::string prefix{};
|
||||
if (!ns.empty()) {
|
||||
prefix = ns + "::";
|
||||
}
|
||||
if (prefix + c == clazz)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
common::model::diagram_t sequence_diagram::type() const
|
||||
{
|
||||
return common::model::diagram_t::kSequence;
|
||||
@@ -136,13 +120,6 @@ common::model::diagram_t include_diagram::type() const
|
||||
return common::model::diagram_t::kInclude;
|
||||
}
|
||||
|
||||
template <>
|
||||
void append_value<std::vector<std::string>>(
|
||||
std::vector<std::string> &l, const std::vector<std::string> &r)
|
||||
{
|
||||
l.insert(l.end(), r.begin(), r.end());
|
||||
}
|
||||
|
||||
template <> void append_value<plantuml>(plantuml &l, const plantuml &r)
|
||||
{
|
||||
l.append(r);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace clanguml {
|
||||
namespace config {
|
||||
|
||||
@@ -29,6 +31,7 @@ template <typename T> struct option {
|
||||
option_inherit_mode im = option_inherit_mode::kOverride)
|
||||
: name{name_}
|
||||
, value{}
|
||||
, inheritance_mode{im}
|
||||
{
|
||||
}
|
||||
option(const std::string &name_, const T &initial_value,
|
||||
@@ -36,6 +39,7 @@ template <typename T> struct option {
|
||||
: name{name_}
|
||||
, value{initial_value}
|
||||
, has_value{true}
|
||||
, inheritance_mode{im}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,12 +52,13 @@ template <typename T> struct option {
|
||||
|
||||
void override(const option<T> &o)
|
||||
{
|
||||
if (!is_declared && o.is_declared) {
|
||||
if (inheritance_mode == option_inherit_mode::kAppend)
|
||||
append_value(value, o.value);
|
||||
else
|
||||
value = o.value;
|
||||
|
||||
if (o.is_declared && inheritance_mode == option_inherit_mode::kAppend) {
|
||||
append_value(value, o.value);
|
||||
is_declared = true;
|
||||
has_value = true;
|
||||
}
|
||||
else if (!is_declared && o.is_declared) {
|
||||
value = o.value;
|
||||
is_declared = true;
|
||||
has_value = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user