Added option --print-start-from to list all possible 'start_from' values (fixes #94)
This commit is contained in:
@@ -179,15 +179,15 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
else if (m.type() == message_t::kIf) {
|
||||
print_debug(m, ostr);
|
||||
ostr << "alt";
|
||||
if (m.condition_text())
|
||||
ostr << " " << m.condition_text().value();
|
||||
if (const auto &text = m.condition_text(); text.has_value())
|
||||
ostr << " " << text.value();
|
||||
ostr << '\n';
|
||||
}
|
||||
else if (m.type() == message_t::kElseIf) {
|
||||
print_debug(m, ostr);
|
||||
ostr << "else";
|
||||
if (m.condition_text())
|
||||
ostr << " " << m.condition_text().value();
|
||||
if (const auto &text = m.condition_text(); text.has_value())
|
||||
ostr << " " << text.value();
|
||||
ostr << '\n';
|
||||
}
|
||||
else if (m.type() == message_t::kElse) {
|
||||
@@ -200,8 +200,8 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
else if (m.type() == message_t::kWhile) {
|
||||
print_debug(m, ostr);
|
||||
ostr << "loop";
|
||||
if (m.condition_text())
|
||||
ostr << " " << m.condition_text().value();
|
||||
if (const auto &text = m.condition_text(); text.has_value())
|
||||
ostr << " " << text.value();
|
||||
ostr << '\n';
|
||||
}
|
||||
else if (m.type() == message_t::kWhileEnd) {
|
||||
@@ -210,8 +210,8 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
else if (m.type() == message_t::kFor) {
|
||||
print_debug(m, ostr);
|
||||
ostr << "loop";
|
||||
if (m.condition_text())
|
||||
ostr << " " << m.condition_text().value();
|
||||
if (const auto &text = m.condition_text(); text.has_value())
|
||||
ostr << " " << text.value();
|
||||
ostr << '\n';
|
||||
}
|
||||
else if (m.type() == message_t::kForEnd) {
|
||||
@@ -220,8 +220,8 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
else if (m.type() == message_t::kDo) {
|
||||
print_debug(m, ostr);
|
||||
ostr << "loop";
|
||||
if (m.condition_text())
|
||||
ostr << " " << m.condition_text().value();
|
||||
if (const auto &text = m.condition_text(); text.has_value())
|
||||
ostr << " " << text.value();
|
||||
ostr << '\n';
|
||||
}
|
||||
else if (m.type() == message_t::kDoEnd) {
|
||||
@@ -253,8 +253,8 @@ void generator::generate_activity(const activity &a, std::ostream &ostr,
|
||||
else if (m.type() == message_t::kConditional) {
|
||||
print_debug(m, ostr);
|
||||
ostr << "alt";
|
||||
if (m.condition_text())
|
||||
ostr << " " << m.condition_text().value();
|
||||
if (const auto &text = m.condition_text(); text.has_value())
|
||||
ostr << " " << text.value();
|
||||
ostr << '\n';
|
||||
}
|
||||
else if (m.type() == message_t::kConditionalElse) {
|
||||
|
||||
@@ -181,6 +181,22 @@ bool diagram::should_include(
|
||||
dynamic_cast<const common::model::source_location &>(p));
|
||||
}
|
||||
|
||||
std::vector<std::string> diagram::list_start_from_values() const
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
|
||||
for (const auto &[from_id, act] : sequences_) {
|
||||
|
||||
const auto &from_activity = *(participants_.at(from_id));
|
||||
|
||||
result.push_back(from_activity.full_name(false));
|
||||
}
|
||||
|
||||
std::sort(result.begin(), result.end());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void diagram::print() const
|
||||
{
|
||||
LOG_TRACE(" --- Participants ---");
|
||||
|
||||
@@ -212,6 +212,13 @@ public:
|
||||
*/
|
||||
bool should_include(const sequence_diagram::model::participant &p) const;
|
||||
|
||||
/**
|
||||
* @brief Get list of all possible 'start_from' values in the model
|
||||
*
|
||||
* @return List of all possible 'start_from' values
|
||||
*/
|
||||
std::vector<std::string> list_start_from_values() const;
|
||||
|
||||
/**
|
||||
* @brief Once the diagram is complete, run any final processing.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user