Fixed clang-tidy warnings
This commit is contained in:
@@ -170,8 +170,8 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const
|
||||
m.from(), to, m.to());
|
||||
}
|
||||
|
||||
void generator::generate_activity(const activity &a,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const
|
||||
void generator::generate_activity(
|
||||
const activity &a, std::vector<common::id_t> &visited) const
|
||||
{
|
||||
// Generate calls from this activity to other activities
|
||||
for (const auto &m : a.messages()) {
|
||||
@@ -247,8 +247,8 @@ nlohmann::json &generator::current_block_statement() const
|
||||
return block_statements_stack_.back().get();
|
||||
}
|
||||
|
||||
void generator::process_call_message(const model::message &m,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const
|
||||
void generator::process_call_message(
|
||||
const model::message &m, std::vector<common::id_t> &visited) const
|
||||
{
|
||||
visited.push_back(m.from());
|
||||
|
||||
@@ -523,7 +523,7 @@ void generator::generate_participant(
|
||||
}
|
||||
|
||||
common::id_t generator::generate_participant(
|
||||
nlohmann::json &parent, common::id_t id, bool force) const
|
||||
nlohmann::json & /*parent*/, common::id_t id, bool force) const
|
||||
{
|
||||
common::id_t participant_id{0};
|
||||
|
||||
@@ -570,14 +570,13 @@ common::id_t generator::generate_participant(
|
||||
|
||||
return class_participant_id;
|
||||
}
|
||||
else {
|
||||
if (!is_participant_generated(participant_id)) {
|
||||
for (auto &p : json_["participants"]) {
|
||||
if (p.at("id") == std::to_string(class_participant_id)) {
|
||||
generated_participants_.emplace(participant_id);
|
||||
p["activities"].push_back(participant);
|
||||
return class_participant_id;
|
||||
}
|
||||
|
||||
if (!is_participant_generated(participant_id)) {
|
||||
for (auto &p : json_["participants"]) {
|
||||
if (p.at("id") == std::to_string(class_participant_id)) {
|
||||
generated_participants_.emplace(participant_id);
|
||||
p["activities"].push_back(participant);
|
||||
return class_participant_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -619,17 +618,17 @@ common::id_t generator::generate_participant(
|
||||
|
||||
return file_participant_id;
|
||||
}
|
||||
else {
|
||||
if (!is_participant_generated(participant_id)) {
|
||||
for (auto &p : json_["participants"]) {
|
||||
if (p.at("id") == std::to_string(file_participant_id)) {
|
||||
generated_participants_.emplace(participant_id);
|
||||
p["activities"].push_back(participant);
|
||||
}
|
||||
|
||||
if (!is_participant_generated(participant_id)) {
|
||||
for (auto &p : json_["participants"]) {
|
||||
if (p.at("id") == std::to_string(file_participant_id)) {
|
||||
generated_participants_.emplace(participant_id);
|
||||
p["activities"].push_back(participant);
|
||||
}
|
||||
}
|
||||
return file_participant_id;
|
||||
}
|
||||
|
||||
return file_participant_id;
|
||||
}
|
||||
else {
|
||||
json_["participants"].push_back(participant);
|
||||
@@ -745,7 +744,7 @@ void generator::generate_diagram(nlohmann::json &parent) const
|
||||
|
||||
for (const auto &sf : config().from()) {
|
||||
if (sf.location_type == location_t::function) {
|
||||
common::model::diagram_element::id_t start_from{0};
|
||||
common::id_t start_from{0};
|
||||
std::string start_from_str;
|
||||
for (const auto &[k, v] : model().sequences()) {
|
||||
const auto &caller = *model().participants().at(v.from());
|
||||
@@ -765,8 +764,7 @@ void generator::generate_diagram(nlohmann::json &parent) const
|
||||
}
|
||||
|
||||
// Use this to break out of recurrent loops
|
||||
std::vector<common::model::diagram_element::id_t>
|
||||
visited_participants;
|
||||
std::vector<common::id_t> visited_participants;
|
||||
|
||||
const auto &from =
|
||||
model().get_participant<model::function>(start_from);
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
* for breaking infinite recursion on recursive calls
|
||||
*/
|
||||
void generate_activity(const sequence_diagram::model::activity &a,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const;
|
||||
std::vector<common::id_t> &visited) const;
|
||||
|
||||
/**
|
||||
* @brief Get reference to the current block statement.
|
||||
@@ -126,8 +126,8 @@ private:
|
||||
* @param m Message model
|
||||
* @param visited List of already visited participants
|
||||
*/
|
||||
void process_call_message(const model::message &m,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const;
|
||||
void process_call_message(
|
||||
const model::message &m, std::vector<common::id_t> &visited) const;
|
||||
|
||||
/**
|
||||
* @brief Process `if` statement message
|
||||
|
||||
@@ -180,7 +180,7 @@ void generator::generate_return(const message &m, std::ostream &ostr) const
|
||||
}
|
||||
|
||||
void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const
|
||||
std::vector<common::id_t> &visited) const
|
||||
{
|
||||
for (const auto &m : a.messages()) {
|
||||
if (m.in_static_declaration_context()) {
|
||||
@@ -202,7 +202,7 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
|
||||
std::string to_alias = generate_alias(to.value());
|
||||
|
||||
ostr << indent(1) << "activate " << to_alias << std::endl;
|
||||
ostr << indent(1) << "activate " << to_alias << '\n';
|
||||
|
||||
if (model().sequences().find(m.to()) != model().sequences().end()) {
|
||||
if (std::find(visited.begin(), visited.end(), m.to()) ==
|
||||
@@ -220,7 +220,7 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
|
||||
generate_return(m, ostr);
|
||||
|
||||
ostr << indent(1) << "deactivate " << to_alias << std::endl;
|
||||
ostr << indent(1) << "deactivate " << to_alias << '\n';
|
||||
|
||||
visited.pop_back();
|
||||
}
|
||||
@@ -495,7 +495,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
<< " " << generate_alias(from.value()) << " : "
|
||||
<< from.value().message_name(
|
||||
select_method_arguments_render_mode())
|
||||
<< std::endl;
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
for (const auto &m : mc) {
|
||||
@@ -528,7 +528,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
<< " " << generate_alias(from.value()) << " : "
|
||||
<< from.value().message_name(
|
||||
select_method_arguments_render_mode())
|
||||
<< std::endl;
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
for (const auto &m : mc) {
|
||||
@@ -539,7 +539,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
|
||||
for (const auto &sf : config().from()) {
|
||||
if (sf.location_type == location_t::function) {
|
||||
common::model::diagram_element::id_t start_from{0};
|
||||
common::id_t start_from{0};
|
||||
for (const auto &[k, v] : model().sequences()) {
|
||||
const auto &caller = *model().participants().at(v.from());
|
||||
std::string vfrom = caller.full_name(false);
|
||||
@@ -558,8 +558,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
}
|
||||
|
||||
// Use this to break out of recurrent loops
|
||||
std::vector<common::model::diagram_element::id_t>
|
||||
visited_participants;
|
||||
std::vector<common::id_t> visited_participants;
|
||||
|
||||
const auto &from =
|
||||
model().get_participant<model::function>(start_from);
|
||||
@@ -588,10 +587,10 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
<< common::generators::mermaid::to_mermaid(
|
||||
message_t::kCall)
|
||||
<< " " << from_alias << " : "
|
||||
<< from.value().message_name(render_mode) << std::endl;
|
||||
<< from.value().message_name(render_mode) << '\n';
|
||||
}
|
||||
|
||||
ostr << indent(1) << "activate " << from_alias << std::endl;
|
||||
ostr << indent(1) << "activate " << from_alias << '\n';
|
||||
|
||||
generate_activity(
|
||||
model().get_activity(start_from), ostr, visited_participants);
|
||||
@@ -613,7 +612,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
}
|
||||
}
|
||||
|
||||
ostr << indent(1) << "deactivate " << from_alias << std::endl;
|
||||
ostr << indent(1) << "deactivate " << from_alias << '\n';
|
||||
}
|
||||
else {
|
||||
// TODO: Add support for other sequence start location types
|
||||
|
||||
@@ -117,8 +117,7 @@ public:
|
||||
* for breaking infinite recursion on recursive calls
|
||||
*/
|
||||
void generate_activity(const clanguml::sequence_diagram::model::activity &a,
|
||||
std::ostream &ostr,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const;
|
||||
std::ostream &ostr, std::vector<common::id_t> &visited) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -134,7 +134,7 @@ void generator::generate_return(const message &m, std::ostream &ostr) const
|
||||
}
|
||||
|
||||
void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const
|
||||
std::vector<common::id_t> &visited) const
|
||||
{
|
||||
for (const auto &m : a.messages()) {
|
||||
if (m.in_static_declaration_context()) {
|
||||
@@ -156,7 +156,7 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
|
||||
std::string to_alias = generate_alias(to.value());
|
||||
|
||||
ostr << "activate " << to_alias << std::endl;
|
||||
ostr << "activate " << to_alias << '\n';
|
||||
|
||||
if (model().sequences().find(m.to()) != model().sequences().end()) {
|
||||
if (std::find(visited.begin(), visited.end(), m.to()) ==
|
||||
@@ -174,7 +174,7 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
|
||||
generate_return(m, ostr);
|
||||
|
||||
ostr << "deactivate " << to_alias << std::endl;
|
||||
ostr << "deactivate " << to_alias << '\n';
|
||||
|
||||
visited.pop_back();
|
||||
}
|
||||
@@ -498,7 +498,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
<< " " << generate_alias(from.value()) << " : "
|
||||
<< from.value().message_name(
|
||||
select_method_arguments_render_mode())
|
||||
<< std::endl;
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
for (const auto &m : mc) {
|
||||
@@ -535,7 +535,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
<< " " << generate_alias(from.value()) << " : "
|
||||
<< from.value().message_name(
|
||||
select_method_arguments_render_mode())
|
||||
<< std::endl;
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
for (const auto &m : mc) {
|
||||
@@ -546,7 +546,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
|
||||
for (const auto &sf : config().from()) {
|
||||
if (sf.location_type == location_t::function) {
|
||||
common::model::diagram_element::id_t start_from{0};
|
||||
common::id_t start_from{0};
|
||||
for (const auto &[k, v] : model().sequences()) {
|
||||
const auto &caller = *model().participants().at(v.from());
|
||||
std::string vfrom = caller.full_name(false);
|
||||
@@ -565,8 +565,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
}
|
||||
|
||||
// Use this to break out of recurrent loops
|
||||
std::vector<common::model::diagram_element::id_t>
|
||||
visited_participants;
|
||||
std::vector<common::id_t> visited_participants;
|
||||
|
||||
const auto &from =
|
||||
model().get_participant<model::function>(start_from);
|
||||
@@ -593,10 +592,10 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
config().combine_free_functions_into_file_participants()) {
|
||||
ostr << "[->"
|
||||
<< " " << from_alias << " : "
|
||||
<< from.value().message_name(render_mode) << std::endl;
|
||||
<< from.value().message_name(render_mode) << '\n';
|
||||
}
|
||||
|
||||
ostr << "activate " << from_alias << std::endl;
|
||||
ostr << "activate " << from_alias << '\n';
|
||||
|
||||
generate_activity(
|
||||
model().get_activity(start_from), ostr, visited_participants);
|
||||
@@ -615,7 +614,7 @@ void generator::generate_diagram(std::ostream &ostr) const
|
||||
}
|
||||
}
|
||||
|
||||
ostr << "deactivate " << from_alias << std::endl;
|
||||
ostr << "deactivate " << from_alias << '\n';
|
||||
}
|
||||
else {
|
||||
// TODO: Add support for other sequence start location types
|
||||
|
||||
@@ -111,8 +111,7 @@ public:
|
||||
* for breaking infinite recursion on recursive calls
|
||||
*/
|
||||
void generate_activity(const clanguml::sequence_diagram::model::activity &a,
|
||||
std::ostream &ostr,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const;
|
||||
std::ostream &ostr, std::vector<common::id_t> &visited) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
namespace clanguml::sequence_diagram::model {
|
||||
|
||||
activity::activity(common::model::diagram_element::id_t id)
|
||||
activity::activity(common::id_t id)
|
||||
: from_{id}
|
||||
{
|
||||
}
|
||||
@@ -31,6 +31,6 @@ std::vector<message> &activity::messages() { return messages_; }
|
||||
|
||||
const std::vector<message> &activity::messages() const { return messages_; }
|
||||
|
||||
common::model::diagram_element::id_t activity::from() const { return from_; }
|
||||
common::id_t activity::from() const { return from_; }
|
||||
|
||||
} // namespace clanguml::sequence_diagram::model
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
*
|
||||
* @param id Id of the participant parent for the activity
|
||||
*/
|
||||
activity(common::model::diagram_element::id_t id);
|
||||
activity(common::id_t id);
|
||||
|
||||
/**
|
||||
* @brief Add a message call to the activity
|
||||
@@ -63,10 +63,10 @@ public:
|
||||
*
|
||||
* @return Id of activity participant
|
||||
*/
|
||||
common::model::diagram_element::id_t from() const;
|
||||
common::id_t from() const;
|
||||
|
||||
private:
|
||||
common::model::diagram_element::id_t from_;
|
||||
common::id_t from_;
|
||||
std::vector<message> messages_;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ common::optional_ref<common::model::diagram_element> diagram::get(
|
||||
}
|
||||
|
||||
common::optional_ref<common::model::diagram_element> diagram::get(
|
||||
const common::model::diagram_element::id_t id) const
|
||||
const common::id_t id) const
|
||||
{
|
||||
if (participants_.find(id) != participants_.end())
|
||||
return {*participants_.at(id)};
|
||||
@@ -88,21 +88,17 @@ void diagram::add_participant(std::unique_ptr<participant> p)
|
||||
}
|
||||
}
|
||||
|
||||
void diagram::add_active_participant(common::model::diagram_element::id_t id)
|
||||
void diagram::add_active_participant(common::id_t id)
|
||||
{
|
||||
active_participants_.emplace(id);
|
||||
}
|
||||
|
||||
const activity &diagram::get_activity(
|
||||
common::model::diagram_element::id_t id) const
|
||||
const activity &diagram::get_activity(common::id_t id) const
|
||||
{
|
||||
return sequences_.at(id);
|
||||
}
|
||||
|
||||
activity &diagram::get_activity(common::model::diagram_element::id_t id)
|
||||
{
|
||||
return sequences_.at(id);
|
||||
}
|
||||
activity &diagram::get_activity(common::id_t id) { return sequences_.at(id); }
|
||||
|
||||
void diagram::add_message(model::message &&message)
|
||||
{
|
||||
@@ -150,37 +146,30 @@ void diagram::add_case_stmt_message(model::message &&m)
|
||||
}
|
||||
}
|
||||
|
||||
std::map<common::model::diagram_element::id_t, activity> &diagram::sequences()
|
||||
std::map<common::id_t, activity> &diagram::sequences() { return sequences_; }
|
||||
|
||||
const std::map<common::id_t, activity> &diagram::sequences() const
|
||||
{
|
||||
return sequences_;
|
||||
}
|
||||
|
||||
const std::map<common::model::diagram_element::id_t, activity> &
|
||||
diagram::sequences() const
|
||||
{
|
||||
return sequences_;
|
||||
}
|
||||
|
||||
std::map<common::model::diagram_element::id_t, std::unique_ptr<participant>> &
|
||||
diagram::participants()
|
||||
std::map<common::id_t, std::unique_ptr<participant>> &diagram::participants()
|
||||
{
|
||||
return participants_;
|
||||
}
|
||||
|
||||
const std::map<common::model::diagram_element::id_t,
|
||||
std::unique_ptr<participant>> &
|
||||
const std::map<common::id_t, std::unique_ptr<participant>> &
|
||||
diagram::participants() const
|
||||
{
|
||||
return participants_;
|
||||
}
|
||||
|
||||
std::set<common::model::diagram_element::id_t> &diagram::active_participants()
|
||||
std::set<common::id_t> &diagram::active_participants()
|
||||
{
|
||||
return active_participants_;
|
||||
}
|
||||
|
||||
const std::set<common::model::diagram_element::id_t> &
|
||||
diagram::active_participants() const
|
||||
const std::set<common::id_t> &diagram::active_participants() const
|
||||
{
|
||||
return active_participants_;
|
||||
}
|
||||
@@ -232,10 +221,10 @@ std::vector<std::string> diagram::list_to_values() const
|
||||
return result;
|
||||
}
|
||||
|
||||
common::model::diagram_element::id_t diagram::get_to_activity_id(
|
||||
common::id_t diagram::get_to_activity_id(
|
||||
const config::source_location &to_location) const
|
||||
{
|
||||
common::model::diagram_element::id_t to_activity{0};
|
||||
common::id_t to_activity{0};
|
||||
|
||||
for (const auto &[k, v] : sequences()) {
|
||||
for (const auto &m : v.messages()) {
|
||||
@@ -261,10 +250,10 @@ common::model::diagram_element::id_t diagram::get_to_activity_id(
|
||||
return to_activity;
|
||||
}
|
||||
|
||||
common::model::diagram_element::id_t diagram::get_from_activity_id(
|
||||
common::id_t diagram::get_from_activity_id(
|
||||
const config::source_location &from_location) const
|
||||
{
|
||||
common::model::diagram_element::id_t from_activity{0};
|
||||
common::id_t from_activity{0};
|
||||
|
||||
for (const auto &[k, v] : sequences()) {
|
||||
const auto &caller = *participants().at(v.from());
|
||||
@@ -286,8 +275,7 @@ common::model::diagram_element::id_t diagram::get_from_activity_id(
|
||||
}
|
||||
|
||||
std::vector<message_chain_t> diagram::get_all_from_to_message_chains(
|
||||
const common::model::diagram_element::id_t from_activity,
|
||||
const common::model::diagram_element::id_t to_activity) const
|
||||
const common::id_t from_activity, const common::id_t to_activity) const
|
||||
{
|
||||
std::vector<message_chain_t> message_chains_unique{};
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
* @return Optional reference to a diagram element.
|
||||
*/
|
||||
common::optional_ref<common::model::diagram_element> get(
|
||||
common::model::diagram_element::id_t id) const override;
|
||||
common::id_t id) const override;
|
||||
|
||||
/**
|
||||
* @brief Get participant by id
|
||||
@@ -76,8 +76,7 @@ public:
|
||||
* @return Optional reference to a diagram element.
|
||||
*/
|
||||
template <typename T>
|
||||
common::optional_ref<T> get_participant(
|
||||
common::model::diagram_element::id_t id) const
|
||||
common::optional_ref<T> get_participant(common::id_t id) const
|
||||
{
|
||||
if (participants_.find(id) == participants_.end()) {
|
||||
return {};
|
||||
@@ -99,7 +98,7 @@ public:
|
||||
*
|
||||
* @param id Id of participant to activate
|
||||
*/
|
||||
void add_active_participant(common::model::diagram_element::id_t id);
|
||||
void add_active_participant(common::id_t id);
|
||||
|
||||
/**
|
||||
* @brief Get reference to current activity of a participant
|
||||
@@ -107,7 +106,7 @@ public:
|
||||
* @param id Participant id
|
||||
* @return
|
||||
*/
|
||||
const activity &get_activity(common::model::diagram_element::id_t id) const;
|
||||
const activity &get_activity(common::id_t id) const;
|
||||
|
||||
/**
|
||||
* @brief Get reference to current activity of a participant
|
||||
@@ -115,7 +114,7 @@ public:
|
||||
* @param id Participant id
|
||||
* @return
|
||||
*/
|
||||
activity &get_activity(common::model::diagram_element::id_t id);
|
||||
activity &get_activity(common::id_t id);
|
||||
|
||||
/**
|
||||
* @brief Add message to current activity
|
||||
@@ -156,31 +155,28 @@ public:
|
||||
*
|
||||
* @return Map of sequences in the diagram
|
||||
*/
|
||||
std::map<common::model::diagram_element::id_t, activity> &sequences();
|
||||
std::map<common::id_t, activity> &sequences();
|
||||
|
||||
/**
|
||||
* @brief Get all sequences in the diagram
|
||||
*
|
||||
* @return Map of sequences in the diagram
|
||||
*/
|
||||
const std::map<common::model::diagram_element::id_t, activity> &
|
||||
sequences() const;
|
||||
const std::map<common::id_t, activity> &sequences() const;
|
||||
|
||||
/**
|
||||
* @brief Get map of all participants in the diagram
|
||||
*
|
||||
* @return Map of participants in the diagram
|
||||
*/
|
||||
std::map<common::model::diagram_element::id_t, std::unique_ptr<participant>>
|
||||
&participants();
|
||||
std::map<common::id_t, std::unique_ptr<participant>> &participants();
|
||||
|
||||
/**
|
||||
* @brief Get map of all participants in the diagram
|
||||
*
|
||||
* @return Map of participants in the diagram
|
||||
*/
|
||||
const std::map<common::model::diagram_element::id_t,
|
||||
std::unique_ptr<participant>> &
|
||||
const std::map<common::id_t, std::unique_ptr<participant>> &
|
||||
participants() const;
|
||||
|
||||
/**
|
||||
@@ -188,15 +184,14 @@ public:
|
||||
*
|
||||
* @return Set of all active participant ids
|
||||
*/
|
||||
std::set<common::model::diagram_element::id_t> &active_participants();
|
||||
std::set<common::id_t> &active_participants();
|
||||
|
||||
/**
|
||||
* @brief Get all active participants in the diagram
|
||||
*
|
||||
* @return Set of all active participant ids
|
||||
*/
|
||||
const std::set<common::model::diagram_element::id_t> &
|
||||
active_participants() const;
|
||||
const std::set<common::id_t> &active_participants() const;
|
||||
|
||||
/**
|
||||
* @brief Convert element full name to PlantUML alias.
|
||||
@@ -256,8 +251,7 @@ public:
|
||||
* @return List of message chains
|
||||
*/
|
||||
std::vector<message_chain_t> get_all_from_to_message_chains(
|
||||
common::model::diagram_element::id_t from_activity,
|
||||
common::model::diagram_element::id_t to_activity) const;
|
||||
common::id_t from_activity, common::id_t to_activity) const;
|
||||
|
||||
/**
|
||||
* @brief Get id of a 'to' activity
|
||||
@@ -265,7 +259,7 @@ public:
|
||||
* @param to_location Target activity
|
||||
* @return Activity id
|
||||
*/
|
||||
common::model::diagram_element::id_t get_to_activity_id(
|
||||
common::id_t get_to_activity_id(
|
||||
const config::source_location &to_location) const;
|
||||
|
||||
/**
|
||||
@@ -274,7 +268,7 @@ public:
|
||||
* @param from_location Source activity
|
||||
* @return Activity id
|
||||
*/
|
||||
common::model::diagram_element::id_t get_from_activity_id(
|
||||
common::id_t get_from_activity_id(
|
||||
const config::source_location &from_location) const;
|
||||
|
||||
/**
|
||||
@@ -328,12 +322,11 @@ private:
|
||||
return block_end_types.count(mt) > 0;
|
||||
};
|
||||
|
||||
std::map<common::model::diagram_element::id_t, activity> sequences_;
|
||||
std::map<common::id_t, activity> sequences_;
|
||||
|
||||
std::map<common::model::diagram_element::id_t, std::unique_ptr<participant>>
|
||||
participants_;
|
||||
std::map<common::id_t, std::unique_ptr<participant>> participants_;
|
||||
|
||||
std::set<common::model::diagram_element::id_t> active_participants_;
|
||||
std::set<common::id_t> active_participants_;
|
||||
};
|
||||
|
||||
} // namespace clanguml::sequence_diagram::model
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
|
||||
namespace clanguml::sequence_diagram::model {
|
||||
|
||||
message::message(
|
||||
common::model::message_t type, common::model::diagram_element::id_t from)
|
||||
message::message(common::model::message_t type, common::id_t from)
|
||||
: type_{type}
|
||||
, from_{from}
|
||||
{
|
||||
@@ -39,13 +38,13 @@ void message::set_type(common::model::message_t t) { type_ = t; }
|
||||
|
||||
common::model::message_t message::type() const { return type_; }
|
||||
|
||||
void message::set_from(common::model::diagram_element::id_t f) { from_ = f; }
|
||||
void message::set_from(common::id_t f) { from_ = f; }
|
||||
|
||||
common::model::diagram_element::id_t message::from() const { return from_; }
|
||||
common::id_t message::from() const { return from_; }
|
||||
|
||||
void message::set_to(common::model::diagram_element::id_t t) { to_ = t; }
|
||||
void message::set_to(common::id_t t) { to_ = t; }
|
||||
|
||||
common::model::diagram_element::id_t message::to() const { return to_; }
|
||||
common::id_t message::to() const { return to_; }
|
||||
|
||||
void message::set_message_name(std::string name)
|
||||
{
|
||||
|
||||
@@ -38,8 +38,7 @@ public:
|
||||
* @param type Message type
|
||||
* @param from Id of originating sequence
|
||||
*/
|
||||
message(common::model::message_t type,
|
||||
common::model::diagram_element::id_t from);
|
||||
message(common::model::message_t type, common::id_t from);
|
||||
|
||||
/**
|
||||
* @brief Equality operator
|
||||
@@ -68,28 +67,28 @@ public:
|
||||
*
|
||||
* @param f Id of the participant from which message originates
|
||||
*/
|
||||
void set_from(common::model::diagram_element::id_t f);
|
||||
void set_from(common::id_t f);
|
||||
|
||||
/**
|
||||
* @brief Get the id of source of message
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
common::model::diagram_element::id_t from() const;
|
||||
common::id_t from() const;
|
||||
|
||||
/**
|
||||
* @brief Set the id of the message target
|
||||
*
|
||||
* @param t Id of the message target
|
||||
*/
|
||||
void set_to(common::model::diagram_element::id_t t);
|
||||
void set_to(common::id_t t);
|
||||
|
||||
/**
|
||||
* @brief Get the id of the message target
|
||||
*
|
||||
* @return Id of the message target
|
||||
*/
|
||||
common::model::diagram_element::id_t to() const;
|
||||
common::id_t to() const;
|
||||
|
||||
/**
|
||||
* @brief Set the message label
|
||||
@@ -163,9 +162,9 @@ public:
|
||||
private:
|
||||
common::model::message_t type_{common::model::message_t::kNone};
|
||||
|
||||
common::model::diagram_element::id_t from_{};
|
||||
common::id_t from_{};
|
||||
|
||||
common::model::diagram_element::id_t to_{};
|
||||
common::id_t to_{};
|
||||
|
||||
common::model::message_scope_t scope_{
|
||||
common::model::message_scope_t::kNormal};
|
||||
|
||||
@@ -189,7 +189,7 @@ void method::is_assignment(bool a) { is_assignment_ = a; }
|
||||
|
||||
void method::set_method_name(const std::string &name) { method_name_ = name; }
|
||||
|
||||
void method::set_class_id(diagram_element::id_t id) { class_id_ = id; }
|
||||
void method::set_class_id(common::id_t id) { class_id_ = id; }
|
||||
|
||||
void method::set_class_full_name(const std::string &name)
|
||||
{
|
||||
@@ -230,7 +230,7 @@ std::string method::message_name(message_render_mode mode) const
|
||||
fmt::join(parameters(), ","), is_const() ? " const" : "", style);
|
||||
}
|
||||
|
||||
class_::diagram_element::id_t method::class_id() const { return class_id_; }
|
||||
common::id_t method::class_id() const { return class_id_; }
|
||||
|
||||
std::string method::to_string() const
|
||||
{
|
||||
|
||||
@@ -384,7 +384,7 @@ struct method : public function {
|
||||
*
|
||||
* @param id Id of the class to which this method belongs to
|
||||
*/
|
||||
void set_class_id(diagram_element::id_t id);
|
||||
void set_class_id(common::id_t id);
|
||||
|
||||
/**
|
||||
* @brief Set full qualified name of the class
|
||||
@@ -414,7 +414,7 @@ struct method : public function {
|
||||
*
|
||||
* @return Class id
|
||||
*/
|
||||
diagram_element::id_t class_id() const;
|
||||
common::id_t class_id() const;
|
||||
|
||||
/**
|
||||
* @brief Create a string representation of the participant
|
||||
@@ -466,7 +466,7 @@ struct method : public function {
|
||||
void is_assignment(bool a);
|
||||
|
||||
private:
|
||||
diagram_element::id_t class_id_{};
|
||||
common::id_t class_id_{};
|
||||
std::string method_name_;
|
||||
std::string class_full_name_;
|
||||
bool is_constructor_{false};
|
||||
|
||||
@@ -1454,7 +1454,7 @@ translation_unit_visitor::create_class_model(clang::CXXRecordDecl *cls)
|
||||
// Here we have 2 options, either:
|
||||
// - the parent is a regular C++ class/struct
|
||||
// - the parent is a class template declaration/specialization
|
||||
std::optional<common::model::diagram_element::id_t> id_opt;
|
||||
std::optional<common::id_t> id_opt;
|
||||
const auto *parent_record_decl =
|
||||
clang::dyn_cast<clang::RecordDecl>(parent);
|
||||
|
||||
@@ -1626,15 +1626,15 @@ bool translation_unit_visitor::process_template_parameters(
|
||||
}
|
||||
|
||||
void translation_unit_visitor::set_unique_id(
|
||||
int64_t local_id, common::model::diagram_element::id_t global_id)
|
||||
int64_t local_id, common::id_t global_id)
|
||||
{
|
||||
LOG_TRACE("Setting local element mapping {} --> {}", local_id, global_id);
|
||||
|
||||
local_ast_id_map_[local_id] = global_id;
|
||||
}
|
||||
|
||||
std::optional<common::model::diagram_element::id_t>
|
||||
translation_unit_visitor::get_unique_id(int64_t local_id) const
|
||||
std::optional<common::id_t> translation_unit_visitor::get_unique_id(
|
||||
int64_t local_id) const
|
||||
{
|
||||
if (local_ast_id_map_.find(local_id) == local_ast_id_map_.end())
|
||||
return {};
|
||||
@@ -2228,7 +2228,7 @@ translation_unit_visitor::build_template_instantiation(
|
||||
std::string best_match_full_name{};
|
||||
auto full_template_name = template_instantiation.full_name(false);
|
||||
int best_match{};
|
||||
common::model::diagram_element::id_t best_match_id{0};
|
||||
common::id_t best_match_id{0};
|
||||
|
||||
for (const auto &[id, c] : diagram().participants()) {
|
||||
const auto *participant_as_class =
|
||||
@@ -2378,7 +2378,7 @@ void translation_unit_visitor::pop_message_to_diagram(
|
||||
|
||||
void translation_unit_visitor::finalize()
|
||||
{
|
||||
std::set<common::model::diagram_element::id_t> active_participants_unique;
|
||||
std::set<common::id_t> active_participants_unique;
|
||||
|
||||
// Change all active participants AST local ids to diagram global ids
|
||||
for (auto id : diagram().active_participants()) {
|
||||
|
||||
@@ -204,8 +204,7 @@ public:
|
||||
* @return Optional reference to participant diagram element
|
||||
*/
|
||||
template <typename T = model::participant>
|
||||
common::optional_ref<T> get_participant(
|
||||
const common::model::diagram_element::id_t id)
|
||||
common::optional_ref<T> get_participant(const common::id_t id)
|
||||
{
|
||||
if (diagram().participants().find(id) == diagram().participants().end())
|
||||
return {};
|
||||
@@ -222,8 +221,7 @@ public:
|
||||
* @return Optional reference to participant diagram element
|
||||
*/
|
||||
template <typename T = model::participant>
|
||||
common::optional_ref<T> get_participant(
|
||||
common::model::diagram_element::id_t id) const
|
||||
common::optional_ref<T> get_participant(common::id_t id) const
|
||||
{
|
||||
if (diagram().participants().find(id) == diagram().participants().end())
|
||||
return {};
|
||||
@@ -241,8 +239,7 @@ public:
|
||||
* @param local_id Local AST element id
|
||||
* @param global_id Globa diagram element id
|
||||
*/
|
||||
void set_unique_id(
|
||||
int64_t local_id, common::model::diagram_element::id_t global_id);
|
||||
void set_unique_id(int64_t local_id, common::id_t global_id);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the global `clang-uml` entity id based on the Clang
|
||||
@@ -250,8 +247,7 @@ public:
|
||||
* @param local_id AST local element id
|
||||
* @return Global diagram element id
|
||||
*/
|
||||
std::optional<common::model::diagram_element::id_t> get_unique_id(
|
||||
int64_t local_id) const;
|
||||
std::optional<common::id_t> get_unique_id(int64_t local_id) const;
|
||||
|
||||
/**
|
||||
* @brief Finalize diagram model for this translation unit
|
||||
@@ -531,7 +527,7 @@ private:
|
||||
std::map<clang::CXXConstructExpr *, model::message>
|
||||
construct_expr_message_map_;
|
||||
|
||||
std::map<common::model::diagram_element::id_t,
|
||||
std::map<common::id_t,
|
||||
std::unique_ptr<clanguml::sequence_diagram::model::class_>>
|
||||
forward_declarations_;
|
||||
|
||||
@@ -539,7 +535,7 @@ private:
|
||||
* @todo Refactor to @ref ast_id_mapper
|
||||
*/
|
||||
std::map</* local id from ->getID() */ int64_t,
|
||||
/* global ID based on full name */ common::model::diagram_element::id_t>
|
||||
/* global ID based on full name */ common::id_t>
|
||||
local_ast_id_map_;
|
||||
|
||||
std::map<int64_t /* local anonymous struct id */,
|
||||
|
||||
Reference in New Issue
Block a user