Fixed clang-tidy warnings

This commit is contained in:
Bartek Kryza
2023-09-09 20:46:29 +02:00
parent ae40a3b184
commit 2cc70bcd7e
7 changed files with 13 additions and 18 deletions

View File

@@ -19,7 +19,7 @@
namespace clanguml::common::generators::mermaid { namespace clanguml::common::generators::mermaid {
std::string to_mermaid(relationship_t r, const std::string &style) std::string to_mermaid(relationship_t r, const std::string & /*style*/)
{ {
switch (r) { switch (r) {
case relationship_t::kOwnership: case relationship_t::kOwnership:

View File

@@ -42,7 +42,7 @@ std::string to_mermaid(relationship_t r, const std::string &style);
std::string to_mermaid(access_t scope); std::string to_mermaid(access_t scope);
std::string to_mermaid(message_t r); std::string to_mermaid(message_t r);
std::string indent(const unsigned level); std::string indent(unsigned level);
std::string render_name(std::string name); std::string render_name(std::string name);
@@ -117,7 +117,7 @@ public:
* @param element Element to which the note should be attached * @param element Element to which the note should be attached
*/ */
virtual void generate_notes( virtual void generate_notes(
std::ostream &ostr, const model::element &element) const; std::ostream &ostr, const model::diagram_element &element) const;
/** /**
* @brief Generate comment with diagram metadata * @brief Generate comment with diagram metadata
@@ -300,7 +300,7 @@ void generator<C, D>::generate_mermaid_directives(
template <typename C, typename D> template <typename C, typename D>
void generator<C, D>::generate_notes( void generator<C, D>::generate_notes(
std::ostream &ostr, const model::element &e) const std::ostream &ostr, const model::diagram_element &e) const
{ {
const auto &config = generators::generator<C, D>::config(); const auto &config = generators::generator<C, D>::config();

View File

@@ -37,8 +37,6 @@ void generator::generate_relationships(
LOG_DBG("Generating relationships for file {}", f.full_name(true)); LOG_DBG("Generating relationships for file {}", f.full_name(true));
namespace mermaid_common = clanguml::common::generators::mermaid;
if (f.type() == common::model::source_file_t::kDirectory) { if (f.type() == common::model::source_file_t::kDirectory) {
util::for_each(f, [this, &ostr](const auto &file) { util::for_each(f, [this, &ostr](const auto &file) {
generate_relationships( generate_relationships(
@@ -96,7 +94,7 @@ void generator::generate(const source_file &f, std::ostream &ostr) const
} }
void generator::generate_notes( void generator::generate_notes(
std::ostream &ostr, const common::model::source_file &element) const std::ostream &ostr, const common::model::diagram_element &element) const
{ {
const auto &config = const auto &config =
common_generator<diagram_config, diagram_model>::config(); common_generator<diagram_config, diagram_model>::config();
@@ -133,4 +131,4 @@ void generator::generate_diagram(std::ostream &ostr) const
generate_notes(ostr, dynamic_cast<source_file &>(*f)); generate_notes(ostr, dynamic_cast<source_file &>(*f));
}); });
} }
} // namespace clanguml::include_diagram::generators::plantuml } // namespace clanguml::include_diagram::generators::mermaid

View File

@@ -78,8 +78,8 @@ public:
* @param ostr Output stream * @param ostr Output stream
* @param element Element with a note * @param element Element with a note
*/ */
void generate_notes( void generate_notes(std::ostream &ostr,
std::ostream &ostr, const common::model::source_file &element) const; const common::model::diagram_element &element) const override;
/** /**
* @brief Generate diagram element * @brief Generate diagram element
@@ -90,7 +90,7 @@ public:
void generate(const source_file &e, std::ostream &ostr) const; void generate(const source_file &e, std::ostream &ostr) const;
private: private:
mutable unsigned long note_id_{0UL}; mutable uint64_t note_id_{0UL};
}; };
} // namespace clanguml::include_diagram::generators::mermaid } // namespace clanguml::include_diagram::generators::mermaid

View File

@@ -124,7 +124,7 @@ void generator::generate_groups(std::ostream &ostr) const
} }
void generator::generate_notes( void generator::generate_notes(
std::ostream &ostr, const common::model::element &element) const std::ostream &ostr, const common::model::diagram_element &element) const
{ {
const auto &config = const auto &config =
common_generator<diagram_config, diagram_model>::config(); common_generator<diagram_config, diagram_model>::config();

View File

@@ -96,10 +96,10 @@ public:
* @param element Element with a note * @param element Element with a note
*/ */
void generate_notes(std::ostream &ostr, void generate_notes(std::ostream &ostr,
const common::model::element &element) const override; const common::model::diagram_element &element) const override;
private: private:
mutable unsigned long note_id_{0UL}; mutable uint64_t note_id_{0UL};
mutable common::generators::nested_element_stack<common::model::package> mutable common::generators::nested_element_stack<common::model::package>
together_group_stack_; together_group_stack_;
}; };

View File

@@ -27,7 +27,6 @@ using clanguml::sequence_diagram::model::message;
using namespace clanguml::util; using namespace clanguml::util;
using clanguml::common::generators::mermaid::indent; using clanguml::common::generators::mermaid::indent;
using clanguml::common::generators::mermaid::render_name;
std::string render_participant_name(std::string name) std::string render_participant_name(std::string name)
{ {
@@ -69,9 +68,7 @@ void generator::generate_call(const message &m, std::ostream &ostr) const
if (to.value().type_name() == "method") { if (to.value().type_name() == "method") {
const auto &f = dynamic_cast<const model::method &>(to.value()); const auto &f = dynamic_cast<const model::method &>(to.value());
const std::string_view style = f.is_static() ? "" : ""; message = f.message_name(render_mode);
message =
fmt::format("{}{}{}", style, f.message_name(render_mode), style);
} }
else if (config().combine_free_functions_into_file_participants()) { else if (config().combine_free_functions_into_file_participants()) {
if (to.value().type_name() == "function") { if (to.value().type_name() == "function") {