Fixed clang-tidy warnings
This commit is contained in:
@@ -25,8 +25,8 @@ using nlohmann::json;
|
||||
|
||||
void set_module(nlohmann::json &j, const common::model::element &e)
|
||||
{
|
||||
if (e.module()) {
|
||||
j["module"]["name"] = e.module().value();
|
||||
if (const auto &maybe_module = e.module(); maybe_module) {
|
||||
j["module"]["name"] = *maybe_module;
|
||||
j["module"]["is_private"] = e.module_private();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,6 @@ void generator::generate_alias(
|
||||
|
||||
void generator::generate(const class_ &c, std::ostream &ostr) const
|
||||
{
|
||||
namespace mermaid_common = clanguml::common::generators::mermaid;
|
||||
|
||||
std::string class_type{"class"};
|
||||
|
||||
ostr << indent(1) << "class " << c.alias();
|
||||
@@ -98,8 +96,7 @@ void generator::generate(const class_ &c, std::ostream &ostr) const
|
||||
catch (error::uml_alias_missing &e) {
|
||||
LOG_DBG("Skipping {} relation from {} to {} due "
|
||||
"to: {}",
|
||||
mermaid_common::to_mermaid(r.type(), r.style()), c.full_name(),
|
||||
r.destination(), e.what());
|
||||
to_string(r.type()), c.full_name(), r.destination(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,9 +284,6 @@ void generator::generate(const concept_ &c, std::ostream &ostr) const
|
||||
ostr << indent(1) << "class"
|
||||
<< " " << c.alias();
|
||||
|
||||
if (!c.style())
|
||||
ostr << " " << c.style().value();
|
||||
|
||||
ostr << " {" << '\n';
|
||||
ostr << indent(2) << "<<concept>>\n";
|
||||
|
||||
@@ -358,8 +352,7 @@ void generator::generate_relationship(
|
||||
{
|
||||
namespace mermaid_common = clanguml::common::generators::mermaid;
|
||||
|
||||
LOG_DBG("Processing relationship {}",
|
||||
mermaid_common::to_mermaid(r.type(), r.style()));
|
||||
LOG_DBG("Processing relationship {}", to_string(r.type()));
|
||||
|
||||
std::string destination;
|
||||
|
||||
@@ -377,7 +370,7 @@ void generator::generate_relationship(
|
||||
if (!r.multiplicity_source().empty())
|
||||
mmd_relation += "\"" + r.multiplicity_source() + "\" ";
|
||||
|
||||
mmd_relation += mermaid_common::to_mermaid(r.type(), r.style());
|
||||
mmd_relation += mermaid_common::to_mermaid(r.type());
|
||||
|
||||
if (!r.multiplicity_destination().empty())
|
||||
mmd_relation += " \"" + r.multiplicity_destination() + "\"";
|
||||
@@ -408,8 +401,7 @@ void generator::generate_relationships(
|
||||
if (!model().should_include(r.type()))
|
||||
continue;
|
||||
|
||||
LOG_DBG("== Processing relationship {}",
|
||||
mermaid_common::to_mermaid(r.type(), r.style()));
|
||||
LOG_DBG("== Processing relationship {}", to_string(r.type()));
|
||||
|
||||
std::stringstream relstr;
|
||||
clanguml::common::id_t destination{0};
|
||||
@@ -421,7 +413,7 @@ void generator::generate_relationships(
|
||||
if (!r.multiplicity_source().empty())
|
||||
relation_str += "\"" + r.multiplicity_source() + "\" ";
|
||||
|
||||
relation_str += mermaid_common::to_mermaid(r.type(), r.style());
|
||||
relation_str += mermaid_common::to_mermaid(r.type());
|
||||
|
||||
if (!r.multiplicity_destination().empty())
|
||||
relation_str += " \"" + r.multiplicity_destination() + "\"";
|
||||
@@ -471,8 +463,7 @@ void generator::generate_relationships(
|
||||
catch (error::uml_alias_missing &e) {
|
||||
LOG_DBG("=== Skipping {} relation from {} to {} due "
|
||||
"to: {}",
|
||||
mermaid_common::to_mermaid(r.type(), r.style()), c.full_name(),
|
||||
destination, e.what());
|
||||
to_string(r.type()), c.full_name(), destination, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,8 +509,7 @@ void generator::generate_relationships(
|
||||
if (!model().should_include(r.type()))
|
||||
continue;
|
||||
|
||||
LOG_DBG("== Processing relationship {}",
|
||||
mermaid_common::to_mermaid(r.type(), r.style()));
|
||||
LOG_DBG("== Processing relationship {}", to_string(r.type()));
|
||||
|
||||
std::stringstream relstr;
|
||||
clanguml::common::id_t destination{0};
|
||||
@@ -530,7 +520,7 @@ void generator::generate_relationships(
|
||||
if (!r.multiplicity_source().empty())
|
||||
mmd_relation += "\"" + r.multiplicity_source() + "\" ";
|
||||
|
||||
mmd_relation += mermaid_common::to_mermaid(r.type(), r.style());
|
||||
mmd_relation += mermaid_common::to_mermaid(r.type());
|
||||
|
||||
if (!r.multiplicity_destination().empty())
|
||||
mmd_relation += " \"" + r.multiplicity_destination() + "\"";
|
||||
@@ -580,8 +570,7 @@ void generator::generate_relationships(
|
||||
catch (error::uml_alias_missing &e) {
|
||||
LOG_DBG("=== Skipping {} relation from {} to {} due "
|
||||
"to: {}",
|
||||
mermaid_common::to_mermaid(r.type(), r.style()), c.full_name(),
|
||||
destination, e.what());
|
||||
to_string(r.type()), c.full_name(), destination, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,13 +597,13 @@ void generator::generate_relationships(const enum_ &e, std::ostream &ostr) const
|
||||
if (r.type() == relationship_t::kContainment) {
|
||||
relstr << indent(1) << target_alias << " "
|
||||
<< clanguml::common::generators::mermaid::to_mermaid(
|
||||
r.type(), r.style())
|
||||
r.type())
|
||||
<< " " << e.alias();
|
||||
}
|
||||
else {
|
||||
relstr << indent(1) << e.alias() << " "
|
||||
<< clanguml::common::generators::mermaid::to_mermaid(
|
||||
r.type(), r.style())
|
||||
r.type())
|
||||
<< " " << target_alias;
|
||||
}
|
||||
|
||||
@@ -631,8 +620,7 @@ void generator::generate_relationships(const enum_ &e, std::ostream &ostr) const
|
||||
catch (error::uml_alias_missing &ex) {
|
||||
LOG_DBG("Skipping {} relation from {} to {} due "
|
||||
"to: {}",
|
||||
clanguml::common::generators::mermaid::to_mermaid(
|
||||
r.type(), r.style()),
|
||||
clanguml::common::generators::mermaid::to_mermaid(r.type()),
|
||||
e.full_name(), destination, ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,8 +121,6 @@ void generator::generate_alias(const concept_ &c, std::ostream &ostr) const
|
||||
|
||||
void generator::generate(const class_ &c, std::ostream &ostr) const
|
||||
{
|
||||
namespace plantuml_common = clanguml::common::generators::plantuml;
|
||||
|
||||
std::string class_type{"class"};
|
||||
if (c.is_abstract())
|
||||
class_type = "abstract";
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
|
||||
namespace clanguml::common::generators::mermaid {
|
||||
|
||||
std::string to_mermaid(
|
||||
relationship_t r, const std::optional<std::string> & /*style*/)
|
||||
std::string to_mermaid(relationship_t r)
|
||||
{
|
||||
switch (r) {
|
||||
case relationship_t::kOwnership:
|
||||
|
||||
@@ -38,8 +38,7 @@ using clanguml::common::model::element;
|
||||
using clanguml::common::model::message_t;
|
||||
using clanguml::common::model::relationship_t;
|
||||
|
||||
std::string to_mermaid(
|
||||
relationship_t r, const std::optional<std::string> &style);
|
||||
std::string to_mermaid(relationship_t r);
|
||||
std::string to_mermaid(access_t scope);
|
||||
std::string to_mermaid(message_t r);
|
||||
|
||||
|
||||
@@ -457,8 +457,8 @@ void generator<C, D>::generate_style(std::ostream &ostr,
|
||||
{
|
||||
const auto &config = generators::generator<C, D>::config();
|
||||
|
||||
if (el.style() && !el.style().value().empty())
|
||||
ostr << " " << *el.style();
|
||||
if (el.style() && !el.style().value().empty()) // NOLINT
|
||||
ostr << " " << *el.style(); // NOLINT
|
||||
else if (config.puml) {
|
||||
if (const auto config_style = config.puml().get_style(element_type);
|
||||
config_style) {
|
||||
|
||||
@@ -132,7 +132,7 @@ struct plantuml {
|
||||
std::map<std::string, std::string> style;
|
||||
|
||||
std::optional<std::string> get_style(
|
||||
const common::model::relationship_t relationship_type) const;
|
||||
common::model::relationship_t relationship_type) const;
|
||||
|
||||
std::optional<std::string> get_style(const std::string &element_type) const;
|
||||
|
||||
|
||||
@@ -89,8 +89,7 @@ void generator::generate(const package &p, std::ostream &ostr) const
|
||||
generate_link(ostr, p);
|
||||
}
|
||||
|
||||
if (p.style())
|
||||
ostr << " " << p.style().value();
|
||||
generate_style(ostr, p.type_name(), p);
|
||||
|
||||
ostr << " {" << '\n';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user