Added initial json generator test cases
This commit is contained in:
@@ -113,6 +113,9 @@ generator::generator(diagram_config &config, diagram_model &model)
|
||||
|
||||
void generator::generate(std::ostream &ostr) const
|
||||
{
|
||||
json_["elements"] = std::vector<nlohmann::json>{};
|
||||
json_["relationships"] = std::vector<nlohmann::json>{};
|
||||
|
||||
generate_top_level_elements(json_);
|
||||
|
||||
generate_relationships(json_);
|
||||
|
||||
@@ -58,13 +58,6 @@ generator::generator(
|
||||
{
|
||||
}
|
||||
|
||||
std::string generator::render_name(std::string name) const
|
||||
{
|
||||
util::replace_all(name, "##", "::");
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
void generator::generate_call(const message &m, nlohmann::json &parent) const
|
||||
{
|
||||
const auto &from = m_model.get_participant<model::participant>(m.from());
|
||||
|
||||
@@ -67,19 +67,8 @@ public:
|
||||
|
||||
private:
|
||||
bool is_participant_generated(common::id_t id) const;
|
||||
|
||||
std::string render_name(std::string name) const;
|
||||
|
||||
mutable std::set<common::id_t> generated_participants_;
|
||||
|
||||
mutable nlohmann::json json_;
|
||||
|
||||
mutable std::vector<std::reference_wrapper<nlohmann::json>>
|
||||
block_statements_stack_;
|
||||
|
||||
void process_call_message(const model::message &m,
|
||||
std::vector<common::model::diagram_element::id_t> &visited) const;
|
||||
|
||||
void process_if_message(const model::message &m) const;
|
||||
void process_else_if_message() const;
|
||||
void process_end_if_message() const;
|
||||
@@ -98,6 +87,13 @@ private:
|
||||
void process_for_message(const model::message &m) const;
|
||||
void process_end_while_message() const;
|
||||
void process_while_message(const model::message &m) const;
|
||||
|
||||
mutable std::set<common::id_t> generated_participants_;
|
||||
|
||||
mutable nlohmann::json json_;
|
||||
|
||||
mutable std::vector<std::reference_wrapper<nlohmann::json>>
|
||||
block_statements_stack_;
|
||||
};
|
||||
|
||||
} // namespace clanguml::sequence_diagram::generators::json
|
||||
|
||||
Reference in New Issue
Block a user