Added option style to plantuml config section

This commit is contained in:
Bartek Kryza
2024-03-03 17:01:31 +01:00
parent c4ec8bef8a
commit 76fa811869
34 changed files with 363 additions and 128 deletions

View File

@@ -168,6 +168,24 @@ std::string to_string(member_order_t mo)
}
}
std::optional<std::string> plantuml::get_style(
const common::model::relationship_t relationship_type) const
{
if (style.count(to_string(relationship_type)) == 0)
return {};
return style.at(to_string(relationship_type));
}
std::optional<std::string> plantuml::get_style(
const std::string &element_type) const
{
if (style.count(element_type) == 0)
return {};
return style.at(element_type);
}
void plantuml::append(const plantuml &r)
{
before.insert(before.end(), r.before.begin(), r.before.end());

View File

@@ -109,6 +109,11 @@ enum class comment_parser_t {
std::string to_string(comment_parser_t cp);
struct plantuml_keyword_mapping_t {
std::map<common::model::relationship_t, std::pair<std::string, std::string>>
relationships;
};
/**
* @brief PlantUML diagram config section
*
@@ -123,6 +128,13 @@ struct plantuml {
std::vector<std::string> after;
/*! Command template to render diagram using PlantUML */
std::string cmd;
/*! Provide customized styles for various elements */
std::map<std::string, std::string> style;
std::optional<std::string> get_style(
const common::model::relationship_t relationship_type) const;
std::optional<std::string> get_style(const std::string &element_type) const;
void append(const plantuml &r);
};

View File

@@ -160,6 +160,7 @@ types:
before: !optional [string]
after: !optional [string]
cmd: !optional string
style: !optional map_t<string;string>
mermaid: !optional
before: !optional [string]
after: !optional [string]

View File

@@ -411,6 +411,9 @@ template <> struct convert<plantuml> {
if (node["cmd"])
rhs.cmd = node["cmd"].as<decltype(rhs.cmd)>();
if (node["style"])
rhs.style = node["style"].as<decltype(rhs.style)>();
return true;
}
};