Added sequence diagram model cleanup step to remove empty block statements
This commit is contained in:
@@ -212,6 +212,15 @@ public:
|
||||
*/
|
||||
bool should_include(const sequence_diagram::model::participant &p) const;
|
||||
|
||||
/**
|
||||
* @brief Once the diagram is complete, run any final processing.
|
||||
*
|
||||
* This method should be overriden by specific diagram models to do some
|
||||
* final tasks like cleaning up the model (e.g. some filters only work
|
||||
* on completed diagrams).
|
||||
*/
|
||||
void finalize() override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* This method checks the last messages in sequence (current_messages),
|
||||
@@ -233,6 +242,27 @@ private:
|
||||
common::model::message_t statement_begin,
|
||||
std::vector<message> ¤t_messages) const;
|
||||
|
||||
bool is_begin_block_message(common::model::message_t mt)
|
||||
{
|
||||
using common::model::message_t;
|
||||
static std::set<message_t> block_begin_types{message_t::kIf,
|
||||
message_t::kWhile, message_t::kDo, message_t::kFor, message_t::kTry,
|
||||
message_t::kSwitch, message_t::kConditional};
|
||||
|
||||
return block_begin_types.count(mt) > 0;
|
||||
};
|
||||
|
||||
bool is_end_block_message(common::model::message_t mt)
|
||||
{
|
||||
using common::model::message_t;
|
||||
static std::set<message_t> block_end_types{message_t::kIfEnd,
|
||||
message_t::kWhileEnd, message_t::kDoEnd, message_t::kForEnd,
|
||||
message_t::kTryEnd, message_t::kSwitchEnd,
|
||||
message_t::kConditionalEnd};
|
||||
|
||||
return block_end_types.count(mt) > 0;
|
||||
};
|
||||
|
||||
bool started_{false};
|
||||
|
||||
std::map<common::model::diagram_element::id_t, activity> sequences_;
|
||||
|
||||
Reference in New Issue
Block a user