From bffe9913aa5f31ffdfb72aaaba46ecd6c1208cbb Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 13 Mar 2023 00:30:04 +0100 Subject: [PATCH 01/30] Added cli options for cppidx generator --- .../cppidx/class_diagram_generator.cc | 60 +++ .../cppidx/class_diagram_generator.h | 78 ++++ src/cli/cli_handler.cc | 10 +- src/cli/cli_handler.h | 4 +- src/common/generators/cppidx/generator.h | 86 ++++ src/common/generators/generators.h | 368 ++++++++++++++++++ src/common/generators/nested_element_stack.h | 6 + src/common/generators/plantuml/generator.h | 127 +----- src/common/types.h | 2 + src/main.cc | 240 +----------- tests/test_cases.cc | 14 +- 11 files changed, 631 insertions(+), 364 deletions(-) create mode 100644 src/class_diagram/generators/cppidx/class_diagram_generator.cc create mode 100644 src/class_diagram/generators/cppidx/class_diagram_generator.h create mode 100644 src/common/generators/cppidx/generator.h create mode 100644 src/common/generators/generators.h diff --git a/src/class_diagram/generators/cppidx/class_diagram_generator.cc b/src/class_diagram/generators/cppidx/class_diagram_generator.cc new file mode 100644 index 00000000..47cdd504 --- /dev/null +++ b/src/class_diagram/generators/cppidx/class_diagram_generator.cc @@ -0,0 +1,60 @@ +/** + * src/class_diagram/generators/cppidx/class_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "class_diagram_generator.h" + +#include "util/error.h" + +namespace clanguml::class_diagram::generators::cppidx { + +generator::generator(diagram_config &config, diagram_model &model) + : common_generator{config, model} +{ +} + +void generator::generate(std::ostream &ostr) const +{ + generate_top_level_elements(ostr); + + ostr << json_; +} + +void generator::generate_top_level_elements(std::ostream &ostr) const +{ + for (const auto &p : m_model) { + if (auto *cls = dynamic_cast(p.get()); cls) { + if (m_model.should_include(*cls)) { + generate(*cls, ostr); + } + } + } +} + +void generator::generate(const class_ &c, std::ostream & /*ostr*/) const +{ + + nlohmann::json object; + object["id"] = std::to_string(c.id()); + object["name"] = c.name(); + object["namespace"] = c.get_namespace().to_string(); + object["type"] = c.type_name(); + object["display_name"] = c.full_name(false); + json_["elements"].push_back(std::move(object)); +} + +} // namespace clanguml::class_diagram::generators::plantuml diff --git a/src/class_diagram/generators/cppidx/class_diagram_generator.h b/src/class_diagram/generators/cppidx/class_diagram_generator.h new file mode 100644 index 00000000..28841fbd --- /dev/null +++ b/src/class_diagram/generators/cppidx/class_diagram_generator.h @@ -0,0 +1,78 @@ +/** + * src/class_diagram/generators/cppidx/class_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "class_diagram/model/class.h" +#include "class_diagram/model/concept.h" +#include "class_diagram/model/diagram.h" +#include "class_diagram/model/enum.h" +#include "class_diagram/visitor/translation_unit_visitor.h" +#include "common/generators/cppidx/generator.h" +#include "common/generators/nested_element_stack.h" +#include "common/model/relationship.h" +#include "config/config.h" +#include "util/util.h" + +#include +#include + +#include +#include +#include +#include + +namespace clanguml { +namespace class_diagram { +namespace generators { +namespace cppidx { + +using diagram_config = clanguml::config::class_diagram; +using diagram_model = clanguml::class_diagram::model::diagram; +template +using common_generator = clanguml::common::generators::cppidx::generator; + +using clanguml::class_diagram::model::class_; +using clanguml::class_diagram::model::class_element; +using clanguml::class_diagram::model::concept_; +using clanguml::class_diagram::model::enum_; +using clanguml::common::model::access_t; +using clanguml::common::model::package; +using clanguml::common::model::relationship_t; + +using namespace clanguml::util; + +class generator : public common_generator { +public: + generator(diagram_config &config, diagram_model &model); + + void generate(const class_ &c, std::ostream &ostr) const; + + void generate_top_level_elements(std::ostream &ostr) const; + + void generate(std::ostream &ostr) const override; + +private: + std::string render_name(std::string name) const; + + mutable nlohmann::json json_; +}; + +} // namespace cppidx +} // namespace generators +} // namespace class_diagram +} // namespace clanguml diff --git a/src/cli/cli_handler.cc b/src/cli/cli_handler.cc index 44a4c4f2..084f9188 100644 --- a/src/cli/cli_handler.cc +++ b/src/cli/cli_handler.cc @@ -1,5 +1,5 @@ /** - * src/options/cli_options.cc + * src/options/cli_handler.cc * * Copyright (c) 2021-2023 Bartek Kryza * @@ -58,12 +58,20 @@ void cli_handler::setup_logging() cli_flow_t cli_handler::parse(int argc, const char **argv) { + static const std::map + generator_type_names{ + {"plantuml", clanguml::common::generator_type_t::plantuml}, + {"cppidx", clanguml::common::generator_type_t::cppidx}}; + app.add_option("-c,--config", config_path, "Location of configuration file, when '-' read from stdin"); app.add_option("-d,--compile-database", compilation_database_dir, "Location of compilation database directory"); app.add_option("-n,--diagram-name", diagram_names, "List of diagram names to generate"); + app.add_option("-g,--generator", generators, + "Name of the generator (default: plantuml)") + ->transform(CLI::CheckedTransformer(generator_type_names)); app.add_option("-o,--output-directory", output_directory, "Override output directory specified in config file"); app.add_option("-t,--thread-count", thread_count, diff --git a/src/cli/cli_handler.h b/src/cli/cli_handler.h index 7c917c77..2581ec9c 100644 --- a/src/cli/cli_handler.h +++ b/src/cli/cli_handler.h @@ -1,5 +1,5 @@ /** - * src/options/cli_options.h + * src/options/cli_handler.h * * Copyright (c) 2021-2023 Bartek Kryza * @@ -131,6 +131,8 @@ public: std::vector template_variables{}; bool list_templates{false}; std::optional show_template; + std::vector generators{ + clanguml::common::generator_type_t::plantuml}; clanguml::config::config config; diff --git a/src/common/generators/cppidx/generator.h b/src/common/generators/cppidx/generator.h new file mode 100644 index 00000000..9a70063e --- /dev/null +++ b/src/common/generators/cppidx/generator.h @@ -0,0 +1,86 @@ +/** + * src/common/generators/cppidx/generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "common/model/diagram_filter.h" +#include "config/config.h" +#include "util/error.h" +#include "util/util.h" + +#include +#include +#include +#include + +#include + +namespace clanguml::common::generators::cppidx { + +using clanguml::common::model::access_t; +using clanguml::common::model::element; +using clanguml::common::model::message_t; +using clanguml::common::model::relationship_t; + +/** + * @brief Base class for diagram generators + * + * @tparam ConfigType Configuration type + * @tparam DiagramType Diagram model type + */ +template class generator { +public: + /** + * @brief Constructor + * + * @param config Reference to instance of @link clanguml::config::diagram + * @param model Reference to instance of @link clanguml::model::diagram + */ + generator(ConfigType &config, DiagramType &model) + : m_config{config} + , m_model{model} + { + } + + virtual ~generator() = default; + + /** + * @brief Generate diagram + * + * This method must be implemented in subclasses for specific diagram + * types. It is responsible for calling other methods in appropriate + * order to generate the diagram into the output stream. + * + * @param ostr Output stream + */ + virtual void generate(std::ostream &ostr) const = 0; + +private: +protected: + ConfigType &m_config; + DiagramType &m_model; +}; + +template +std::ostream &operator<<( + std::ostream &os, const generator &g) +{ + g.generate(os); + return os; +} + +} // namespace clanguml::common::generators::cppidx \ No newline at end of file diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h new file mode 100644 index 00000000..17e4d3a0 --- /dev/null +++ b/src/common/generators/generators.h @@ -0,0 +1,368 @@ +/** + * src/common/generators/generators.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "class_diagram/generators/cppidx/class_diagram_generator.h" +#include "class_diagram/generators/plantuml/class_diagram_generator.h" +#include "cli/cli_handler.h" +#include "common/generators/generators.h" +#include "common/model/diagram_filter.h" +#include "config/config.h" +#include "include_diagram/generators/plantuml/include_diagram_generator.h" +#include "package_diagram/generators/plantuml/package_diagram_generator.h" +#include "sequence_diagram/generators/plantuml/sequence_diagram_generator.h" +#include "util/util.h" +#include "version.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace clanguml::common::generators { + +void find_translation_units_for_diagrams( + const std::vector &diagram_names, + clanguml::config::config &config, + const std::vector &compilation_database_files, + std::map> &translation_units_map) +{ + for (const auto &[name, diagram] : config.diagrams) { + // If there are any specific diagram names provided on the command line, + // and this diagram is not in that list - skip it + if (!diagram_names.empty() && !util::contains(diagram_names, name)) + continue; + + // If glob is not defined use all translation units from the + // compilation database + if (!diagram->glob.has_value) { + translation_units_map[name] = compilation_database_files; + } + // Otherwise, get all translation units matching the glob from diagram + // configuration + else { + const std::vector translation_units = + diagram->get_translation_units(); + + std::vector valid_translation_units{}; + std::copy_if(compilation_database_files.begin(), + compilation_database_files.end(), + std::back_inserter(valid_translation_units), + [&translation_units](const auto &tu) { + return util::contains(translation_units, tu); + }); + + translation_units_map[name] = std::move(valid_translation_units); + } + } +} + +template +class diagram_ast_consumer : public clang::ASTConsumer { + TranslationUnitVisitor visitor_; + +public: + explicit diagram_ast_consumer(clang::CompilerInstance &ci, + DiagramModel &diagram, const DiagramConfig &config) + : visitor_{ci.getSourceManager(), diagram, config} + { + } + + void HandleTranslationUnit(clang::ASTContext &ast_context) override + { + visitor_.TraverseDecl(ast_context.getTranslationUnitDecl()); + visitor_.finalize(); + } +}; + +template +class diagram_fronted_action : public clang::ASTFrontendAction { +public: + explicit diagram_fronted_action( + DiagramModel &diagram, const DiagramConfig &config) + : diagram_{diagram} + , config_{config} + { + } + + std::unique_ptr CreateASTConsumer( + clang::CompilerInstance &CI, clang::StringRef /*file*/) override + { + return std::make_unique< + diagram_ast_consumer>( + CI, diagram_, config_); + } + +protected: + bool BeginSourceFileAction(clang::CompilerInstance &ci) override + { + LOG_DBG("Visiting source file: {}", getCurrentFile().str()); + + if constexpr (std::is_same_v) { + auto find_includes_callback = + std::make_unique( + ci.getSourceManager(), diagram_, config_); + + clang::Preprocessor &pp = ci.getPreprocessor(); + + pp.addPPCallbacks(std::move(find_includes_callback)); + } + + return true; + } + +private: + DiagramModel &diagram_; + const DiagramConfig &config_; +}; + +template +class diagram_action_visitor_factory + : public clang::tooling::FrontendActionFactory { +public: + explicit diagram_action_visitor_factory( + DiagramModel &diagram, const DiagramConfig &config) + : diagram_{diagram} + , config_{config} + { + } + + std::unique_ptr create() override + { + return std::make_unique>(diagram_, config_); + } + +private: + DiagramModel &diagram_; + const DiagramConfig &config_; +}; + +template +std::unique_ptr generate( + const clang::tooling::CompilationDatabase &db, const std::string &name, + DiagramConfig &config, const std::vector &translation_units, + bool /*verbose*/ = false) +{ + LOG_INFO("Generating diagram {}.puml", name); + + auto diagram = std::make_unique(); + diagram->set_name(name); + diagram->set_filter( + std::make_unique(*diagram, config)); + + LOG_DBG("Found translation units for diagram {}: {}", name, + fmt::join(translation_units, ", ")); + + clang::tooling::ClangTool clang_tool(db, translation_units); + auto action_factory = + std::make_unique>(*diagram, config); + + auto res = clang_tool.run(action_factory.get()); + + if (res != 0) { + throw std::runtime_error("Diagram " + name + " generation failed"); + } + + diagram->set_complete(true); + + return diagram; +} + +void generate_diagram(const std::string &od, const std::string &name, + std::shared_ptr diagram, + const clang::tooling::CompilationDatabase &db, + const std::vector &translation_units, + const std::vector generators, + bool verbose) +{ + using clanguml::common::generator_type_t; + using clanguml::common::model::diagram_t; + using clanguml::config::class_diagram; + using clanguml::config::include_diagram; + using clanguml::config::package_diagram; + using clanguml::config::sequence_diagram; + + if (diagram->type() == diagram_t::kClass) { + using diagram_config = class_diagram; + using diagram_model = clanguml::class_diagram::model::diagram; + using diagram_visitor = + clanguml::class_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + for (const auto generator_type : generators) { + if (generator_type == generator_type_t::plantuml) { + auto path = + std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::class_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (generator_type == generator_type_t::cppidx) { + auto path = + std::filesystem::path{od} / fmt::format("{}.json", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::class_diagram::generators::cppidx::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + } + } + else if (diagram->type() == diagram_t::kSequence) { + using diagram_config = sequence_diagram; + using diagram_model = clanguml::sequence_diagram::model::diagram; + using diagram_visitor = + clanguml::sequence_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::sequence_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), + *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (diagram->type() == diagram_t::kPackage) { + using diagram_config = package_diagram; + using diagram_model = clanguml::package_diagram::model::diagram; + using diagram_visitor = + clanguml::package_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + + ofs << clanguml::package_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (diagram->type() == diagram_t::kInclude) { + using diagram_config = include_diagram; + using diagram_model = clanguml::include_diagram::model::diagram; + using diagram_visitor = + clanguml::include_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + + ofs << clanguml::include_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } +} + +void generate_diagrams(const std::vector &diagram_names, + clanguml::config::config &config, const std::string &od, + const std::unique_ptr &db, + const int verbose, const unsigned int thread_count, + const std::vector generators, + const std::map> + &translation_units_map) +{ + util::thread_pool_executor generator_executor{thread_count}; + std::vector> futs; + + for (const auto &[name, diagram] : config.diagrams) { + // If there are any specific diagram names provided on the command line, + // and this diagram is not in that list - skip it + if (!diagram_names.empty() && !util::contains(diagram_names, name)) + continue; + + const auto &valid_translation_units = translation_units_map.at(name); + + if (valid_translation_units.empty()) { + LOG_ERROR( + "Diagram {} generation failed: no translation units found", + name); + continue; + } + + futs.emplace_back(generator_executor.add( + [&od, &generators, &name = name, &diagram = diagram, + db = std::ref(*db), translation_units = valid_translation_units, + verbose]() { + try { + generate_diagram(od, name, diagram, db, translation_units, + generators, verbose != 0); + } + catch (std::runtime_error &e) { + LOG_ERROR(e.what()); + } + })); + } + + for (auto &fut : futs) { + fut.get(); + } +} + +} // namespace clanguml::common::generators \ No newline at end of file diff --git a/src/common/generators/nested_element_stack.h b/src/common/generators/nested_element_stack.h index c18770c9..1bc77d6b 100644 --- a/src/common/generators/nested_element_stack.h +++ b/src/common/generators/nested_element_stack.h @@ -23,6 +23,12 @@ namespace clanguml::common::generators { +/** + * This is a helper class for generating nested groups of elements + * in the diagrams, e.g. PlantUML `together` option. + * + * @tparam T Type of stack elements + */ template class nested_element_stack { public: nested_element_stack(bool is_flat) diff --git a/src/common/generators/plantuml/generator.h b/src/common/generators/plantuml/generator.h index 6fd4d0cc..e6663061 100644 --- a/src/common/generators/plantuml/generator.h +++ b/src/common/generators/plantuml/generator.h @@ -167,13 +167,6 @@ protected: mutable inja::Environment m_env; }; -template -std::ostream &operator<<(std::ostream &os, const generator &g) -{ - g.generate(os); - return os; -} - template const inja::json &generator::context() const { @@ -436,122 +429,12 @@ void generator::print_debug( ostr << "' " << e.file() << ":" << e.line() << '\n'; } -template -class diagram_ast_consumer : public clang::ASTConsumer { - TranslationUnitVisitor visitor_; - -public: - explicit diagram_ast_consumer(clang::CompilerInstance &ci, - DiagramModel &diagram, const DiagramConfig &config) - : visitor_{ci.getSourceManager(), diagram, config} - { - } - - void HandleTranslationUnit(clang::ASTContext &ast_context) override - { - visitor_.TraverseDecl(ast_context.getTranslationUnitDecl()); - visitor_.finalize(); - } -}; - -template -class diagram_fronted_action : public clang::ASTFrontendAction { -public: - explicit diagram_fronted_action( - DiagramModel &diagram, const DiagramConfig &config) - : diagram_{diagram} - , config_{config} - { - } - - std::unique_ptr CreateASTConsumer( - clang::CompilerInstance &CI, clang::StringRef /*file*/) override - { - return std::make_unique< - diagram_ast_consumer>( - CI, diagram_, config_); - } - -protected: - bool BeginSourceFileAction(clang::CompilerInstance &ci) override - { - LOG_DBG("Visiting source file: {}", getCurrentFile().str()); - - if constexpr (std::is_same_v) { - auto find_includes_callback = - std::make_unique( - ci.getSourceManager(), diagram_, config_); - - clang::Preprocessor &pp = ci.getPreprocessor(); - - pp.addPPCallbacks(std::move(find_includes_callback)); - } - - return true; - } - -private: - DiagramModel &diagram_; - const DiagramConfig &config_; -}; - -template -class diagram_action_visitor_factory - : public clang::tooling::FrontendActionFactory { -public: - explicit diagram_action_visitor_factory( - DiagramModel &diagram, const DiagramConfig &config) - : diagram_{diagram} - , config_{config} - { - } - - std::unique_ptr create() override - { - return std::make_unique>(diagram_, config_); - } - -private: - DiagramModel &diagram_; - const DiagramConfig &config_; -}; - -template -std::unique_ptr generate( - const clang::tooling::CompilationDatabase &db, const std::string &name, - DiagramConfig &config, const std::vector &translation_units, - bool /*verbose*/ = false) +template +std::ostream &operator<<( + std::ostream &os, const generator &g) { - LOG_INFO("Generating diagram {}.puml", name); - - auto diagram = std::make_unique(); - diagram->set_name(name); - diagram->set_filter( - std::make_unique(*diagram, config)); - - LOG_DBG("Found translation units for diagram {}: {}", name, - fmt::join(translation_units, ", ")); - - clang::tooling::ClangTool clang_tool(db, translation_units); - auto action_factory = - std::make_unique>(*diagram, config); - - auto res = clang_tool.run(action_factory.get()); - - if (res != 0) { - throw std::runtime_error("Diagram " + name + " generation failed"); - } - - diagram->set_complete(true); - - return diagram; + g.generate(os); + return os; } template void generator::init_context() diff --git a/src/common/types.h b/src/common/types.h index 5122afff..557a3c3c 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -27,6 +27,8 @@ namespace clanguml::common { using id_t = int64_t; +enum class generator_type_t { plantuml, cppidx }; + template class optional_ref { public: using optional_type = T; diff --git a/src/main.cc b/src/main.cc index 06ca3449..f8ef1031 100644 --- a/src/main.cc +++ b/src/main.cc @@ -16,14 +16,10 @@ * limitations under the License. */ -#include "class_diagram/generators/plantuml/class_diagram_generator.h" #include "cli/cli_handler.h" -#include "config/config.h" +#include "common/generators/generators.h" #include "include_diagram/generators/plantuml/include_diagram_generator.h" -#include "package_diagram/generators/plantuml/package_diagram_generator.h" -#include "sequence_diagram/generators/plantuml/sequence_diagram_generator.h" #include "util/util.h" -#include "version.h" #ifdef ENABLE_BACKWARD_CPP #define BACKWARD_HAS_DW 1 @@ -35,9 +31,6 @@ #include #include -#include -#include -#include #include #include @@ -49,65 +42,6 @@ backward::SignalHandling sh; // NOLINT using namespace clanguml; -/** - * Generate specific diagram identified by name - * - * @param od Diagram output directory - * @param name Name of the diagram as specified in the config file - * @param diagram Diagram model instance - * @param db Compilation database - * @param translation_units List of translation units to be used for this - * diagram - * @param verbose Logging level - */ -void generate_diagram(const std::string &od, const std::string &name, - std::shared_ptr diagram, - const clang::tooling::CompilationDatabase &db, - const std::vector &translation_units, bool verbose); - -/** - * Find translation units for diagrams. - * - * For each diagram to be generated, this function selects translation units - * to be used for this diagram. The files are selected as an intersection - * between all translation units found in the compilation database and the - * `glob` patterns specified for each diagram in the configuration file. - * - * @param diagram_names List of diagram names to be generated - * @param config Configuration instance - * @param compilation_database_files All translation units in compilation - * database - * @param translation_units_map The output map containing translation - * units for each diagram by name - */ -void find_translation_units_for_diagrams( - const std::vector &diagram_names, - clanguml::config::config &config, - const std::vector &compilation_database_files, - std::map> &translation_units_map); - -/** - * Generate diagrams. - * - * This function generates all diagrams specified in the configuration file - * and in the command line. - * - * @param diagram_names List of diagram names to be generated - * @param config Configuration instance - * @param od Output directory where diagrams should be written - * @param db Compilation database instance - * @param verbose Verbosity level - * @param thread_count Number of diagrams to be generated in parallel - * @param translation_units_map List of translation units to be used for each - * diagram - */ -void generate_diagrams(const std::vector &diagram_names, - clanguml::config::config &config, const std::string &od, - const std::unique_ptr &db, int verbose, - unsigned int thread_count, - const std::map> - &translation_units_map); - int main(int argc, const char *argv[]) { cli::cli_handler cli; @@ -138,173 +72,13 @@ int main(int argc, const char *argv[]) // We have to generate the translation units list for each diagram before // scheduling tasks, because std::filesystem::current_path cannot be trusted // with multiple threads - find_translation_units_for_diagrams(cli.diagram_names, cli.config, - compilation_database_files, translation_units_map); - - generate_diagrams(cli.diagram_names, cli.config, - cli.effective_output_directory, db, cli.verbose, cli.thread_count, + clanguml::common::generators::find_translation_units_for_diagrams( + cli.diagram_names, cli.config, compilation_database_files, translation_units_map); + clanguml::common::generators::generate_diagrams(cli.diagram_names, + cli.config, cli.effective_output_directory, db, cli.verbose, + cli.thread_count, cli.generators, translation_units_map); + return 0; } - -void generate_diagram(const std::string &od, const std::string &name, - std::shared_ptr diagram, - const clang::tooling::CompilationDatabase &db, - const std::vector &translation_units, bool verbose) -{ - using clanguml::common::model::diagram_t; - using clanguml::config::class_diagram; - using clanguml::config::include_diagram; - using clanguml::config::package_diagram; - using clanguml::config::sequence_diagram; - - auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - - if (diagram->type() == diagram_t::kClass) { - using diagram_config = class_diagram; - using diagram_model = clanguml::class_diagram::model::diagram; - using diagram_visitor = - clanguml::class_diagram::visitor::translation_unit_visitor; - - auto model = - clanguml::common::generators::plantuml::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - ofs << clanguml::class_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); - } - else if (diagram->type() == diagram_t::kSequence) { - using diagram_config = sequence_diagram; - using diagram_model = clanguml::sequence_diagram::model::diagram; - using diagram_visitor = - clanguml::sequence_diagram::visitor::translation_unit_visitor; - - auto model = - clanguml::common::generators::plantuml::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - ofs << clanguml::sequence_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), - *model); - } - else if (diagram->type() == diagram_t::kPackage) { - using diagram_config = package_diagram; - using diagram_model = clanguml::package_diagram::model::diagram; - using diagram_visitor = - clanguml::package_diagram::visitor::translation_unit_visitor; - - auto model = - clanguml::common::generators::plantuml::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - ofs << clanguml::package_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); - } - else if (diagram->type() == diagram_t::kInclude) { - using diagram_config = include_diagram; - using diagram_model = clanguml::include_diagram::model::diagram; - using diagram_visitor = - clanguml::include_diagram::visitor::translation_unit_visitor; - - auto model = - clanguml::common::generators::plantuml::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - ofs << clanguml::include_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); - } - - LOG_INFO("Written {} diagram to {}", name, path.string()); - - ofs.close(); -} - -void generate_diagrams(const std::vector &diagram_names, - clanguml::config::config &config, const std::string &od, - const std::unique_ptr &db, - const int verbose, const unsigned int thread_count, - const std::map> - &translation_units_map) -{ - util::thread_pool_executor generator_executor{thread_count}; - std::vector> futs; - - for (const auto &[name, diagram] : config.diagrams) { - // If there are any specific diagram names provided on the command line, - // and this diagram is not in that list - skip it - if (!diagram_names.empty() && !util::contains(diagram_names, name)) - continue; - - const auto &valid_translation_units = translation_units_map.at(name); - - if (valid_translation_units.empty()) { - LOG_ERROR( - "Diagram {} generation failed: no translation units found", - name); - continue; - } - - futs.emplace_back(generator_executor.add( - [&od, &name = name, &diagram = diagram, db = std::ref(*db), - translation_units = valid_translation_units, verbose]() { - try { - generate_diagram( - od, name, diagram, db, translation_units, verbose != 0); - } - catch (std::runtime_error &e) { - LOG_ERROR(e.what()); - } - })); - } - - for (auto &fut : futs) { - fut.get(); - } -} - -void find_translation_units_for_diagrams( - const std::vector &diagram_names, - clanguml::config::config &config, - const std::vector &compilation_database_files, - std::map> &translation_units_map) -{ - for (const auto &[name, diagram] : config.diagrams) { - // If there are any specific diagram names provided on the command line, - // and this diagram is not in that list - skip it - if (!diagram_names.empty() && !util::contains(diagram_names, name)) - continue; - - // If glob is not defined use all translation units from the - // compilation database - if (!diagram->glob.has_value) { - translation_units_map[name] = compilation_database_files; - } - // Otherwise, get all translation units matching the glob from diagram - // configuration - else { - const std::vector translation_units = - diagram->get_translation_units(); - - std::vector valid_translation_units{}; - std::copy_if(compilation_database_files.begin(), - compilation_database_files.end(), - std::back_inserter(valid_translation_units), - [&translation_units](const auto &tu) { - return util::contains(translation_units, tu); - }); - - translation_units_map[name] = std::move(valid_translation_units); - } - } -} diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 926083ff..e3434ef0 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -19,7 +19,7 @@ #include "test_cases.h" #include "cli/cli_handler.h" -#include "common/generators/plantuml/generator.h" +#include "common/generators/generators.h" #include @@ -67,7 +67,7 @@ generate_sequence_diagram(clang::tooling::CompilationDatabase &db, inject_diagram_options(diagram); - auto model = clanguml::common::generators::plantuml::generate(db, diagram->name, dynamic_cast(*diagram), diagram->get_translation_units()); @@ -86,7 +86,7 @@ std::unique_ptr generate_class_diagram( inject_diagram_options(diagram); - auto model = clanguml::common::generators::plantuml::generate(db, diagram->name, dynamic_cast(*diagram), diagram->get_translation_units()); @@ -105,8 +105,8 @@ generate_package_diagram(clang::tooling::CompilationDatabase &db, inject_diagram_options(diagram); - return clanguml::common::generators::plantuml::generate(db, diagram->name, + return clanguml::common::generators::generate(db, diagram->name, dynamic_cast(*diagram), diagram->get_translation_units()); } @@ -122,8 +122,8 @@ generate_include_diagram(clang::tooling::CompilationDatabase &db, inject_diagram_options(diagram); - return clanguml::common::generators::plantuml::generate(db, diagram->name, + return clanguml::common::generators::generate(db, diagram->name, dynamic_cast(*diagram), diagram->get_translation_units()); } From 19ae58f493a9fcc0fad6560aaa2fb1bf99a0c7e3 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 13 Mar 2023 22:14:26 +0100 Subject: [PATCH 02/30] Refactored cppidx generator name to json --- .../{cppidx => json}/class_diagram_generator.cc | 4 ++-- .../{cppidx => json}/class_diagram_generator.h | 10 +++++----- src/cli/cli_handler.cc | 2 +- src/common/generators/generators.h | 6 +++--- src/common/generators/{cppidx => json}/generator.h | 6 +++--- src/common/types.h | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) rename src/class_diagram/generators/{cppidx => json}/class_diagram_generator.cc (93%) rename src/class_diagram/generators/{cppidx => json}/class_diagram_generator.h (90%) rename src/common/generators/{cppidx => json}/generator.h (94%) diff --git a/src/class_diagram/generators/cppidx/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc similarity index 93% rename from src/class_diagram/generators/cppidx/class_diagram_generator.cc rename to src/class_diagram/generators/json/class_diagram_generator.cc index 47cdd504..e367cd5b 100644 --- a/src/class_diagram/generators/cppidx/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -1,5 +1,5 @@ /** - * src/class_diagram/generators/cppidx/class_diagram_generator.cc + * src/class_diagram/generators/json/class_diagram_generator.cc * * Copyright (c) 2021-2023 Bartek Kryza * @@ -20,7 +20,7 @@ #include "util/error.h" -namespace clanguml::class_diagram::generators::cppidx { +namespace clanguml::class_diagram::generators::json { generator::generator(diagram_config &config, diagram_model &model) : common_generator{config, model} diff --git a/src/class_diagram/generators/cppidx/class_diagram_generator.h b/src/class_diagram/generators/json/class_diagram_generator.h similarity index 90% rename from src/class_diagram/generators/cppidx/class_diagram_generator.h rename to src/class_diagram/generators/json/class_diagram_generator.h index 28841fbd..1d58f2d9 100644 --- a/src/class_diagram/generators/cppidx/class_diagram_generator.h +++ b/src/class_diagram/generators/json/class_diagram_generator.h @@ -1,5 +1,5 @@ /** - * src/class_diagram/generators/cppidx/class_diagram_generator.h + * src/class_diagram/generators/json/class_diagram_generator.h * * Copyright (c) 2021-2023 Bartek Kryza * @@ -22,7 +22,7 @@ #include "class_diagram/model/diagram.h" #include "class_diagram/model/enum.h" #include "class_diagram/visitor/translation_unit_visitor.h" -#include "common/generators/cppidx/generator.h" +#include "common/generators/json/generator.h" #include "common/generators/nested_element_stack.h" #include "common/model/relationship.h" #include "config/config.h" @@ -39,12 +39,12 @@ namespace clanguml { namespace class_diagram { namespace generators { -namespace cppidx { +namespace json { using diagram_config = clanguml::config::class_diagram; using diagram_model = clanguml::class_diagram::model::diagram; template -using common_generator = clanguml::common::generators::cppidx::generator; +using common_generator = clanguml::common::generators::json::generator; using clanguml::class_diagram::model::class_; using clanguml::class_diagram::model::class_element; @@ -72,7 +72,7 @@ private: mutable nlohmann::json json_; }; -} // namespace cppidx +} // namespace json } // namespace generators } // namespace class_diagram } // namespace clanguml diff --git a/src/cli/cli_handler.cc b/src/cli/cli_handler.cc index 084f9188..7bad2977 100644 --- a/src/cli/cli_handler.cc +++ b/src/cli/cli_handler.cc @@ -61,7 +61,7 @@ cli_flow_t cli_handler::parse(int argc, const char **argv) static const std::map generator_type_names{ {"plantuml", clanguml::common::generator_type_t::plantuml}, - {"cppidx", clanguml::common::generator_type_t::cppidx}}; + {"json", clanguml::common::generator_type_t::json}}; app.add_option("-c,--config", config_path, "Location of configuration file, when '-' read from stdin"); diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h index 17e4d3a0..5e260619 100644 --- a/src/common/generators/generators.h +++ b/src/common/generators/generators.h @@ -17,7 +17,7 @@ */ #pragma once -#include "class_diagram/generators/cppidx/class_diagram_generator.h" +#include "class_diagram/generators/json/class_diagram_generator.h" #include "class_diagram/generators/plantuml/class_diagram_generator.h" #include "cli/cli_handler.h" #include "common/generators/generators.h" @@ -237,12 +237,12 @@ void generate_diagram(const std::string &od, const std::string &name, LOG_INFO("Written {} diagram to {}", name, path.string()); } - else if (generator_type == generator_type_t::cppidx) { + else if (generator_type == generator_type_t::json) { auto path = std::filesystem::path{od} / fmt::format("{}.json", name); std::ofstream ofs; ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::class_diagram::generators::cppidx::generator( + ofs << clanguml::class_diagram::generators::json::generator( dynamic_cast(*diagram), *model); ofs.close(); diff --git a/src/common/generators/cppidx/generator.h b/src/common/generators/json/generator.h similarity index 94% rename from src/common/generators/cppidx/generator.h rename to src/common/generators/json/generator.h index 9a70063e..0a542edb 100644 --- a/src/common/generators/cppidx/generator.h +++ b/src/common/generators/json/generator.h @@ -1,5 +1,5 @@ /** - * src/common/generators/cppidx/generator.h + * src/common/generators/json/generator.h * * Copyright (c) 2021-2023 Bartek Kryza * @@ -29,7 +29,7 @@ #include -namespace clanguml::common::generators::cppidx { +namespace clanguml::common::generators::json { using clanguml::common::model::access_t; using clanguml::common::model::element; @@ -83,4 +83,4 @@ std::ostream &operator<<( return os; } -} // namespace clanguml::common::generators::cppidx \ No newline at end of file +} // namespace clanguml::common::generators::json \ No newline at end of file diff --git a/src/common/types.h b/src/common/types.h index 557a3c3c..65a8d980 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -27,7 +27,7 @@ namespace clanguml::common { using id_t = int64_t; -enum class generator_type_t { plantuml, cppidx }; +enum class generator_type_t { plantuml, json }; template class optional_ref { public: From 08d6f87d230952d0637ea192a556cedaab56abc6 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Mar 2023 00:53:57 +0100 Subject: [PATCH 03/30] Added complete json generation for class diagrams --- .../json/class_diagram_generator.cc | 286 +++++++++++++++++- .../generators/json/class_diagram_generator.h | 23 +- 2 files changed, 294 insertions(+), 15 deletions(-) diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index e367cd5b..40ce347e 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -20,6 +20,127 @@ #include "util/error.h" +namespace clanguml::common::model { +using nlohmann::json; + +void to_json(nlohmann::json &j, const source_location &sl) +{ + j = json{{"file", sl.file()}, {"line", sl.line()}}; +} + +void to_json(nlohmann::json &j, const element &c) +{ + j = json{{"id", std::to_string(c.id())}, {"name", c.name()}, + {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()}, + {"display_name", c.full_name(false)}}; + + if (!c.file().empty()) + j["source_location"] = + dynamic_cast(c); +} + +void to_json(nlohmann::json &j, const template_parameter &c) +{ + j["type"] = c.type(); + j["name"] = c.name(); + if (!c.default_value().empty()) + j["default_value"] = c.default_value(); + j["is_template_parameter"] = c.is_template_parameter(); + j["is_template_template_parameter"] = c.is_template_template_parameter(); + if (c.concept_constraint()) + j["concept_constraint"] = c.concept_constraint().value(); + j["is_variadic"] = c.is_variadic(); +} + +void to_json(nlohmann::json &j, const relationship &c) +{ + j["type"] = to_string(c.type()); + j["destination"] = std::to_string(c.destination()); + if (!c.multiplicity_source().empty()) + j["multiplicity_source"] = c.multiplicity_source(); + if (!c.multiplicity_destination().empty()) + j["multiplicity_destination"] = c.multiplicity_destination(); + j["access"] = to_string(c.access()); +} + +} + +namespace clanguml::class_diagram::model { +using nlohmann::json; +void to_json(nlohmann::json &j, const class_element &c) +{ + j = {{"name", c.name()}, {"type", c.type()}, + {"access", to_string(c.access())}}; + if (!c.file().empty()) + j["source_location"] = + dynamic_cast(c); +} + +void to_json(nlohmann::json &j, const class_member &c) +{ + j = dynamic_cast(c); + j["is_static"] = c.is_static(); +} + +void to_json(nlohmann::json &j, const method_parameter &c) +{ + j["name"] = c.name(); + j["type"] = c.type(); + if (!c.default_value().empty()) + j["default_value"] = c.default_value(); +} + +void to_json(nlohmann::json &j, const class_method &c) +{ + j["is_static"] = c.is_static(); + j["is_const"] = c.is_const(); + j["is_defaulted"] = c.is_defaulted(); + j["is_pure_virtual"] = c.is_pure_virtual(); + j["is_virtual"] = c.is_virtual(); + j["is_implicit"] = c.is_implicit(); + + j["parameters"] = c.parameters(); +} + +void to_json(nlohmann::json &j, const class_parent &c) +{ + j["is_virtual"] = c.is_virtual(); + j["id"] = std::to_string(c.id()); + j["access"] = to_string(c.access()); + j["name"] = c.name(); +} + +void to_json(nlohmann::json &j, const class_ &c) +{ + j = dynamic_cast(c); + j["is_struct"] = c.is_struct(); + j["is_abstract"] = c.is_abstract(); + j["is_union"] = c.is_union(); + j["is_nested"] = c.is_nested(); + j["is_template"] = c.is_template(); + + j["members"] = c.members(); + j["methods"] = c.methods(); + j["bases"] = c.parents(); + + j["template_parameters"] = c.templates(); +} + +void to_json(nlohmann::json &j, const enum_ &c) +{ + j = dynamic_cast(c); + j["is_nested"] = c.is_nested(); + j["constants"] = c.constants(); +} + +void to_json(nlohmann::json &j, const concept_ &c) +{ + j = dynamic_cast(c); + j["parameters"] = c.requires_parameters(); + j["statements"] = c.requires_statements(); +} +} + namespace clanguml::class_diagram::generators::json { generator::generator(diagram_config &config, diagram_model &model) @@ -29,32 +150,175 @@ generator::generator(diagram_config &config, diagram_model &model) void generator::generate(std::ostream &ostr) const { - generate_top_level_elements(ostr); + generate_top_level_elements(json_); ostr << json_; } -void generator::generate_top_level_elements(std::ostream &ostr) const +void generator::generate_top_level_elements(nlohmann::json &parent) const { for (const auto &p : m_model) { - if (auto *cls = dynamic_cast(p.get()); cls) { + if (auto *pkg = dynamic_cast(p.get()); pkg) { + if (!pkg->is_empty()) + generate(*pkg, parent); + } + else if (auto *cls = dynamic_cast(p.get()); cls) { if (m_model.should_include(*cls)) { - generate(*cls, ostr); + generate(*cls, parent); } } } } -void generator::generate(const class_ &c, std::ostream & /*ostr*/) const +void generator::generate(const package &p, nlohmann::json &parent) const { + const auto &uns = m_config.using_namespace(); - nlohmann::json object; - object["id"] = std::to_string(c.id()); - object["name"] = c.name(); - object["namespace"] = c.get_namespace().to_string(); - object["type"] = c.type_name(); - object["display_name"] = c.full_name(false); + nlohmann::json package_object; + + if (m_config.generate_packages()) { + LOG_DBG("Generating package {}", p.name()); + + // Don't generate packages from namespaces filtered out by + // using_namespace + if (!uns.starts_with({p.full_name(false)})) { + package_object["type"] = "namespace"; + package_object["name"] = p.name(); + package_object["display_name"] = p.full_name(false); + } + } + + for (const auto &subpackage : p) { + if (dynamic_cast(subpackage.get()) != nullptr) { + // TODO: add option - generate_empty_packages + const auto &sp = dynamic_cast(*subpackage); + if (!sp.is_empty()) { + if (m_config.generate_packages()) + generate(sp, package_object); + else + generate(sp, parent); + } + } + else if (auto *cls = dynamic_cast(subpackage.get()); cls) { + const auto &sp = dynamic_cast(*subpackage); + if (m_model.should_include(*subpackage)) { + if (m_config.generate_packages()) + generate(sp, package_object); + else + generate(sp, parent); + } + } + else if (auto *enm = dynamic_cast(subpackage.get()); enm) { + const auto &sp = dynamic_cast(*subpackage); + if (m_model.should_include(*subpackage)) { + if (m_config.generate_packages()) + generate(sp, package_object); + else + generate(sp, parent); + } + } + else if (auto *cpt = dynamic_cast(subpackage.get()); cpt) { + const auto &sp = dynamic_cast(*subpackage); + if (m_model.should_include(*subpackage)) { + if (m_config.generate_packages()) + generate(sp, package_object); + else + generate(sp, parent); + } + } + } + + if (m_config.generate_packages()) { + parent["elements"].push_back(std::move(package_object)); + } +} + +void generator::generate(const class_ &c, nlohmann::json &parent) const +{ + nlohmann::json object = c; json_["elements"].push_back(std::move(object)); } +void generator::generate(const enum_ &e, nlohmann::json &parent) const +{ + nlohmann::json object = e; + json_["elements"].push_back(std::move(object)); +} + +void generator::generate(const concept_ &c, nlohmann::json &parent) const +{ + nlohmann::json object = c; + json_["elements"].push_back(std::move(object)); + generate_relationships(json_); +} + +void generator::generate_relationships(nlohmann::json &parent) const +{ + for (const auto &p : m_model) { + if (auto *pkg = dynamic_cast(p.get()); pkg) { + generate_relationships(*pkg, parent); + } + else if (auto *cls = dynamic_cast(p.get()); cls) { + if (m_model.should_include(*cls)) { + generate_relationships(*cls, parent); + } + } + else if (auto *enm = dynamic_cast(p.get()); enm) { + if (m_model.should_include(*enm)) { + generate_relationships(*enm, parent); + } + } + else if (auto *cpt = dynamic_cast(p.get()); cpt) { + if (m_model.should_include(*cpt)) { + generate_relationships(*cpt, parent); + } + } + } +} + +void generator::generate_relationships( + const class_ &c, nlohmann::json &parent) const +{ + for (const auto &r : c.relationships()) { + nlohmann::json rel = r; + rel["source"] = std::to_string(c.id()); + parent["relationships"].push_back(rel); + } + + if (m_model.should_include(relationship_t::kExtension)) { + for (const auto &b : c.parents()) { + common::model::relationship r( + relationship_t::kExtension, b.id(), b.access()); + nlohmann::json rel = r; + rel["source"] = std::to_string(c.id()); + parent["relationships"].push_back(rel); + } + } +} + +void generator::generate_relationships( + const enum_ &c, nlohmann::json &parent) const +{ + for (const auto &r : c.relationships()) { + nlohmann::json rel = r; + rel["source"] = std::to_string(c.id()); + parent["relationships"].push_back(rel); + } +} + +void generator::generate_relationships( + const concept_ &c, nlohmann::json &parent) const +{ + for (const auto &r : c.relationships()) { + nlohmann::json rel = r; + rel["source"] = std::to_string(c.id()); + parent["relationships"].push_back(rel); + } +} + +void generator::generate_relationships( + const package &p, nlohmann::json &parent) const +{ +} + } // namespace clanguml::class_diagram::generators::plantuml diff --git a/src/class_diagram/generators/json/class_diagram_generator.h b/src/class_diagram/generators/json/class_diagram_generator.h index 1d58f2d9..30f51f5b 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.h +++ b/src/class_diagram/generators/json/class_diagram_generator.h @@ -60,15 +60,30 @@ class generator : public common_generator { public: generator(diagram_config &config, diagram_model &model); - void generate(const class_ &c, std::ostream &ostr) const; + void generate(const class_ &c, nlohmann::json &parent) const; - void generate_top_level_elements(std::ostream &ostr) const; + void generate(const enum_ &c, nlohmann::json &parent) const; + + void generate(const concept_ &c, nlohmann::json &parent) const; + + void generate(const package &p, nlohmann::json &parent) const; + + void generate_top_level_elements(nlohmann::json &parent) const; void generate(std::ostream &ostr) const override; -private: - std::string render_name(std::string name) const; + void generate_relationships(nlohmann::json &parent) const; + void generate_relationships(const class_ &c, nlohmann::json &parent) const; + + void generate_relationships(const enum_ &c, nlohmann::json &parent) const; + + void generate_relationships( + const concept_ &c, nlohmann::json &parent) const; + + void generate_relationships(const package &p, nlohmann::json &parent) const; + +private: mutable nlohmann::json json_; }; From 34131324ec49eeea24023de85c51cc067c26d402 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 15 Mar 2023 00:46:42 +0100 Subject: [PATCH 04/30] Added json class generator test cases --- .../json/class_diagram_generator.cc | 119 ++- tests/t00002/test_case.h | 441 ++++++++ tests/t00014/test_case.h | 961 ++++++++++++++++++ tests/t00036/test_case.h | 193 ++++ tests/t00056/test_case.h | 555 ++++++++++ tests/test_cases.cc | 24 + 6 files changed, 2269 insertions(+), 24 deletions(-) diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index 40ce347e..9ff39d7d 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -34,6 +34,9 @@ void to_json(nlohmann::json &j, const element &c) {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()}, {"display_name", c.full_name(false)}}; + if (c.comment()) + j["comment"] = c.comment().value(); + if (!c.file().empty()) j["source_location"] = dynamic_cast(c); @@ -60,7 +63,12 @@ void to_json(nlohmann::json &j, const relationship &c) j["multiplicity_source"] = c.multiplicity_source(); if (!c.multiplicity_destination().empty()) j["multiplicity_destination"] = c.multiplicity_destination(); - j["access"] = to_string(c.access()); + if (c.access() != access_t::kNone) + j["access"] = to_string(c.access()); + if (!c.label().empty()) + j["label"] = c.label(); + if (c.comment()) + j["comment"] = c.comment().value(); } } @@ -69,11 +77,15 @@ namespace clanguml::class_diagram::model { using nlohmann::json; void to_json(nlohmann::json &j, const class_element &c) { - j = {{"name", c.name()}, {"type", c.type()}, - {"access", to_string(c.access())}}; + j["name"] = c.name(); + j["type"] = c.type(); + if (c.access() != common::model::access_t::kNone) + j["access"] = to_string(c.access()); if (!c.file().empty()) j["source_location"] = dynamic_cast(c); + if (c.comment()) + j["comment"] = c.comment().value(); } void to_json(nlohmann::json &j, const class_member &c) @@ -92,6 +104,8 @@ void to_json(nlohmann::json &j, const method_parameter &c) void to_json(nlohmann::json &j, const class_method &c) { + j = dynamic_cast(c); + j["is_static"] = c.is_static(); j["is_const"] = c.is_const(); j["is_defaulted"] = c.is_defaulted(); @@ -106,7 +120,8 @@ void to_json(nlohmann::json &j, const class_parent &c) { j["is_virtual"] = c.is_virtual(); j["id"] = std::to_string(c.id()); - j["access"] = to_string(c.access()); + if (c.access() != common::model::access_t::kNone) + j["access"] = to_string(c.access()); j["name"] = c.name(); } @@ -152,6 +167,8 @@ void generator::generate(std::ostream &ostr) const { generate_top_level_elements(json_); + generate_relationships(json_); + ostr << json_; } @@ -167,6 +184,16 @@ void generator::generate_top_level_elements(nlohmann::json &parent) const generate(*cls, parent); } } + else if (auto *enm = dynamic_cast(p.get()); enm) { + if (m_model.should_include(*enm)) { + generate(*enm, parent); + } + } + else if (auto *cpt = dynamic_cast(p.get()); cpt) { + if (m_model.should_include(*cpt)) { + generate(*cpt, parent); + } + } } } @@ -177,11 +204,11 @@ void generator::generate(const package &p, nlohmann::json &parent) const nlohmann::json package_object; if (m_config.generate_packages()) { - LOG_DBG("Generating package {}", p.name()); - // Don't generate packages from namespaces filtered out by // using_namespace if (!uns.starts_with({p.full_name(false)})) { + LOG_DBG("Generating package {}", p.name()); + package_object["type"] = "namespace"; package_object["name"] = p.name(); package_object["display_name"] = p.full_name(false); @@ -190,7 +217,6 @@ void generator::generate(const package &p, nlohmann::json &parent) const for (const auto &subpackage : p) { if (dynamic_cast(subpackage.get()) != nullptr) { - // TODO: add option - generate_empty_packages const auto &sp = dynamic_cast(*subpackage); if (!sp.is_empty()) { if (m_config.generate_packages()) @@ -200,35 +226,32 @@ void generator::generate(const package &p, nlohmann::json &parent) const } } else if (auto *cls = dynamic_cast(subpackage.get()); cls) { - const auto &sp = dynamic_cast(*subpackage); - if (m_model.should_include(*subpackage)) { + if (m_model.should_include(*cls)) { if (m_config.generate_packages()) - generate(sp, package_object); + generate(*cls, package_object); else - generate(sp, parent); + generate(*cls, parent); } } else if (auto *enm = dynamic_cast(subpackage.get()); enm) { - const auto &sp = dynamic_cast(*subpackage); - if (m_model.should_include(*subpackage)) { + if (m_model.should_include(*enm)) { if (m_config.generate_packages()) - generate(sp, package_object); + generate(*enm, package_object); else - generate(sp, parent); + generate(*enm, parent); } } else if (auto *cpt = dynamic_cast(subpackage.get()); cpt) { - const auto &sp = dynamic_cast(*subpackage); - if (m_model.should_include(*subpackage)) { + if (m_model.should_include(*cpt)) { if (m_config.generate_packages()) - generate(sp, package_object); + generate(*cpt, package_object); else - generate(sp, parent); + generate(*cpt, parent); } } } - if (m_config.generate_packages()) { + if (m_config.generate_packages() && !package_object.empty()) { parent["elements"].push_back(std::move(package_object)); } } @@ -236,20 +259,19 @@ void generator::generate(const package &p, nlohmann::json &parent) const void generator::generate(const class_ &c, nlohmann::json &parent) const { nlohmann::json object = c; - json_["elements"].push_back(std::move(object)); + parent["elements"].push_back(std::move(object)); } void generator::generate(const enum_ &e, nlohmann::json &parent) const { nlohmann::json object = e; - json_["elements"].push_back(std::move(object)); + parent["elements"].push_back(std::move(object)); } void generator::generate(const concept_ &c, nlohmann::json &parent) const { nlohmann::json object = c; - json_["elements"].push_back(std::move(object)); - generate_relationships(json_); + parent["elements"].push_back(std::move(object)); } void generator::generate_relationships(nlohmann::json &parent) const @@ -280,6 +302,14 @@ void generator::generate_relationships( const class_ &c, nlohmann::json &parent) const { for (const auto &r : c.relationships()) { + auto target_element = m_model.get(r.destination()); + if (!target_element.has_value()) { + LOG_DBG("Skipping {} relation from {} to {} due " + "to unresolved destination id", + to_string(r.type()), c.full_name(), r.destination()); + continue; + } + nlohmann::json rel = r; rel["source"] = std::to_string(c.id()); parent["relationships"].push_back(rel); @@ -300,6 +330,14 @@ void generator::generate_relationships( const enum_ &c, nlohmann::json &parent) const { for (const auto &r : c.relationships()) { + auto target_element = m_model.get(r.destination()); + if (!target_element.has_value()) { + LOG_DBG("Skipping {} relation from {} to {} due " + "to unresolved destination id", + to_string(r.type()), c.full_name(), r.destination()); + continue; + } + nlohmann::json rel = r; rel["source"] = std::to_string(c.id()); parent["relationships"].push_back(rel); @@ -310,6 +348,14 @@ void generator::generate_relationships( const concept_ &c, nlohmann::json &parent) const { for (const auto &r : c.relationships()) { + auto target_element = m_model.get(r.destination()); + if (!target_element.has_value()) { + LOG_DBG("Skipping {} relation from {} to {} due " + "to unresolved destination id", + to_string(r.type()), c.full_name(), r.destination()); + continue; + } + nlohmann::json rel = r; rel["source"] = std::to_string(c.id()); parent["relationships"].push_back(rel); @@ -319,6 +365,31 @@ void generator::generate_relationships( void generator::generate_relationships( const package &p, nlohmann::json &parent) const { + for (const auto &subpackage : p) { + if (dynamic_cast(subpackage.get()) != nullptr) { + const auto &sp = dynamic_cast(*subpackage); + if (!sp.is_empty()) + generate_relationships(sp, parent); + } + else if (dynamic_cast(subpackage.get()) != nullptr) { + if (m_model.should_include(*subpackage)) { + generate_relationships( + dynamic_cast(*subpackage), parent); + } + } + else if (dynamic_cast(subpackage.get()) != nullptr) { + if (m_model.should_include(*subpackage)) { + generate_relationships( + dynamic_cast(*subpackage), parent); + } + } + else if (dynamic_cast(subpackage.get()) != nullptr) { + if (m_model.should_include(*subpackage)) { + generate_relationships( + dynamic_cast(*subpackage), parent); + } + } + } } } // namespace clanguml::class_diagram::generators::plantuml diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h index 72f328cd..2441faab 100644 --- a/tests/t00002/test_case.h +++ b/tests/t00002/test_case.h @@ -74,4 +74,445 @@ TEST_CASE("t00002", "[test-case][class]") "This is class B")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + const std::string expected_json = R"##( +{ + "elements": [ + { + "bases": [], + "comment": { + "brief": [ + " This is class A\n" + ], + "formatted": "\\brief This is class A", + "paragraph": [ + " \n" + ], + "raw": "/// \\brief This is class A", + "text": "\n \n" + }, + "display_name": "clanguml::t00002::A", + "id": "987634239855407298", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "Abstract foo_a", + "paragraph": [ + " Abstract foo_a\n" + ], + "raw": "/// Abstract foo_a", + "text": "\n Abstract foo_a\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "comment": { + "formatted": "Abstract foo_c", + "paragraph": [ + " Abstract foo_c\n" + ], + "raw": "/// Abstract foo_c", + "text": "\n Abstract foo_c\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00002", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "987634239855407298", + "is_virtual": false, + "name": "clanguml::t00002::A" + } + ], + "comment": { + "brief": [ + " This is class B\n" + ], + "formatted": "\\brief This is class B", + "paragraph": [ + " \n" + ], + "raw": "/// \\brief This is class B", + "text": "\n \n" + }, + "display_name": "clanguml::t00002::B", + "id": "594234458687375950", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00002", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "987634239855407298", + "is_virtual": false, + "name": "clanguml::t00002::A" + } + ], + "comment": { + "brief": [ + " This is class C - class C has a long comment\n" + ], + "formatted": "@brief This is class C - class C has a long comment\n\nVivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\neuismod libero facilisi aptent elementum felis blandit cursus gravida sociis\nerat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\nad.", + "paragraph": [ + " \n", + " Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad.\n" + ], + "raw": "/// @brief This is class C - class C has a long comment\n///\n/// Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n/// euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n/// erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n/// ad.", + "text": "\n \n\n Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad.\n" + }, + "display_name": "clanguml::t00002::C", + "id": "1142499429598587507", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "Do nothing unless override is provided", + "paragraph": [ + " Do nothing unless override is provided\n" + ], + "raw": "/// Do nothing unless override is provided", + "text": "\n Do nothing unless override is provided\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "C", + "namespace": "clanguml::t00002", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "594234458687375950", + "is_virtual": false, + "name": "clanguml::t00002::B" + }, + { + "access": "public", + "id": "1142499429598587507", + "is_virtual": false, + "name": "clanguml::t00002::C" + } + ], + "comment": { + "formatted": "This is class D\nwhich is a little like B\nand a little like C", + "paragraph": [ + " This is class D\n which is a little like B\n and a little like C\n" + ], + "raw": "/// This is class D\n/// which is a little like B\n/// and a little like C", + "text": "\n This is class D\n which is a little like B\n and a little like C\n" + }, + "display_name": "clanguml::t00002::D", + "id": "60950494980414724", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "comment": { + "formatted": "All the A pointers", + "paragraph": [ + " All the A pointers\n" + ], + "raw": "/// All the A pointers", + "text": "\n All the A pointers\n" + }, + "is_static": false, + "name": "as", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "line": 58 + }, + "type": "std::vector" + } + ], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_a\n ", + "paragraph": [ + " Forward foo_a\n" + ], + "raw": "/**\n * Forward foo_a\n */", + "text": "\n Forward foo_a\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_c\n ", + "paragraph": [ + " Forward foo_c\n" + ], + "raw": "/**\n * Forward foo_c\n */", + "text": "\n Forward foo_c\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "D", + "namespace": "clanguml::t00002", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "line": 36 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "594234458687375950", + "is_virtual": true, + "name": "clanguml::t00002::B" + }, + { + "access": "public", + "id": "1142499429598587507", + "is_virtual": true, + "name": "clanguml::t00002::C" + } + ], + "display_name": "clanguml::t00002::E", + "id": "2237886670308966220", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "comment": { + "formatted": "All the A pointers", + "paragraph": [ + " All the A pointers\n" + ], + "raw": "/// All the A pointers", + "text": "\n All the A pointers\n" + }, + "is_static": false, + "name": "as", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "line": 83 + }, + "type": "std::vector" + } + ], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_a", + "paragraph": [ + " Forward foo_a\n" + ], + "raw": "///\n /// Forward foo_a\n ///", + "text": "\n Forward foo_a\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_c", + "paragraph": [ + " Forward foo_c\n" + ], + "raw": "///\n /// Forward foo_c\n ///", + "text": "\n Forward foo_c\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "E", + "namespace": "clanguml::t00002", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "line": 61 + }, + "template_parameters": [], + "type": "class" + } + ], + "relationships": [ + { + "access": "public", + "destination": "987634239855407298", + "source": "594234458687375950", + "type": "extension" + }, + { + "access": "public", + "destination": "987634239855407298", + "source": "1142499429598587507", + "type": "extension" + }, + { + "access": "private", + "destination": "987634239855407298", + "label": "as", + "source": "60950494980414724", + "type": "association" + }, + { + "access": "public", + "destination": "594234458687375950", + "source": "60950494980414724", + "type": "extension" + }, + { + "access": "public", + "destination": "1142499429598587507", + "source": "60950494980414724", + "type": "extension" + }, + { + "access": "private", + "destination": "987634239855407298", + "label": "as", + "source": "2237886670308966220", + "type": "association" + }, + { + "access": "public", + "destination": "594234458687375950", + "source": "2237886670308966220", + "type": "extension" + }, + { + "access": "public", + "destination": "1142499429598587507", + "source": "2237886670308966220", + "type": "extension" + } + ] } +)##"; + auto j = generate_class_json(diagram, *model); + + REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); +} \ No newline at end of file diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index c20bedb8..f0e16d21 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -115,4 +115,965 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + std::string expected_json = R"##( +{ + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "765890579167335652", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 22 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "p", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 23 + }, + "type": "P" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 21 + }, + "template_parameters": [ + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "P", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::B", + "id": "934136012292043506", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "value", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 27 + }, + "type": "std::string" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00014", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 26 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "2186387853087008570", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::string", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A>", + "id": "947292733740993297", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::unique_ptr", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "1700006390494465667", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "long", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "2017665567517853203", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "double", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "906557320263235873", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "long", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "U", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "378898020828430636", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "long", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "bool", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "2082013375525130414", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "double", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "bool", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "51978493292659230", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "long", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "float", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "197769253782961588", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "double", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "float", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "895940711566401184", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "bool", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::string", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A>", + "id": "1751732625010742161", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "float", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::unique_ptr", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "887121441210847583", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "int", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::string", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "1119452495635561975", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::string", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::string", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "640294848489463071", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "char", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::string", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "139599686499155694", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "wchar_t", + "type": "" + }, + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "std::string", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::R", + "id": "1192822659863756768", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "bapair", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 58 + }, + "type": "PairPairBA" + }, + { + "access": "private", + "is_static": false, + "name": "abool", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 60 + }, + "type": "APtr" + }, + { + "access": "private", + "is_static": false, + "name": "aboolfloat", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 61 + }, + "type": "AAPtr" + }, + { + "access": "private", + "is_static": false, + "name": "afloat", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 62 + }, + "type": "ASharedPtr" + }, + { + "access": "private", + "is_static": false, + "name": "boolstring", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 63 + }, + "type": "A" + }, + { + "access": "private", + "is_static": false, + "name": "floatstring", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 64 + }, + "type": "AStringPtr" + }, + { + "access": "private", + "is_static": false, + "name": "intstring", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 65 + }, + "type": "clanguml::t00014::AIntString" + }, + { + "access": "private", + "is_static": false, + "name": "stringstring", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 66 + }, + "type": "clanguml::t00014::AStringString" + }, + { + "access": "private", + "is_static": false, + "name": "bstringstring", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 67 + }, + "type": "clanguml::t00014::BStringString" + }, + { + "access": "protected", + "is_static": false, + "name": "bs", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 70 + }, + "type": "clanguml::t00014::BVector" + }, + { + "access": "public", + "is_static": false, + "name": "bs2", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 73 + }, + "type": "clanguml::t00014::BVector2" + }, + { + "access": "public", + "is_static": false, + "name": "cb", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 74 + }, + "type": "SimpleCallback" + }, + { + "access": "public", + "is_static": false, + "name": "gcb", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 75 + }, + "type": "GenericCallback" + }, + { + "access": "public", + "is_static": false, + "name": "vcb", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 76 + }, + "type": "clanguml::t00014::VoidCallback" + }, + { + "access": "public", + "is_static": false, + "name": "vps", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 77 + }, + "type": "VectorPtr" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00014", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "line": 55 + }, + "template_parameters": [], + "type": "class" + } + ], + "relationships": [ + { + "access": "public", + "destination": "765890579167335652", + "source": "2186387853087008570", + "type": "instantiation" + }, + { + "access": "public", + "destination": "765890579167335652", + "source": "947292733740993297", + "type": "instantiation" + }, + { + "access": "public", + "destination": "765890579167335652", + "source": "1700006390494465667", + "type": "instantiation" + }, + { + "access": "public", + "destination": "765890579167335652", + "source": "2017665567517853203", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1700006390494465667", + "source": "906557320263235873", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1700006390494465667", + "source": "378898020828430636", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2017665567517853203", + "source": "2082013375525130414", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1700006390494465667", + "source": "51978493292659230", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2017665567517853203", + "source": "197769253782961588", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "895940711566401184", + "type": "instantiation" + }, + { + "access": "public", + "destination": "947292733740993297", + "source": "1751732625010742161", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "887121441210847583", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "1119452495635561975", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "640294848489463071", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "139599686499155694", + "type": "instantiation" + }, + { + "access": "public", + "destination": "378898020828430636", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "934136012292043506", + "label": "bapair", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "378898020828430636", + "label": "bapair", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2082013375525130414", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "2082013375525130414", + "label": "abool", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "51978493292659230", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "2082013375525130414", + "label": "aboolfloat", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "51978493292659230", + "label": "aboolfloat", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "197769253782961588", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "197769253782961588", + "label": "afloat", + "source": "1192822659863756768", + "type": "association" + }, + { + "access": "private", + "destination": "895940711566401184", + "label": "boolstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1751732625010742161", + "label": "floatstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "887121441210847583", + "label": "intstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1119452495635561975", + "label": "stringstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1119452495635561975", + "label": "bstringstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "protected", + "destination": "934136012292043506", + "label": "bs", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "934136012292043506", + "label": "bs2", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "640294848489463071", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "public", + "destination": "139599686499155694", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "public", + "destination": "934136012292043506", + "label": "vps", + "source": "1192822659863756768", + "type": "aggregation" + } + ] +} +)##"; + auto j = generate_class_json(diagram, *model); + + REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00036/test_case.h b/tests/t00036/test_case.h index 4e52ada0..0a87bfa5 100644 --- a/tests/t00036/test_case.h +++ b/tests/t00036/test_case.h @@ -46,4 +46,197 @@ TEST_CASE("t00036", "[test-case][class]") REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+a_int")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + const std::string expected_json = R"##( +{ + "elements": [ + { + "display_name": "clanguml::t00036::ns1", + "elements": [ + { + "constants": [ + "blue", + "yellow" + ], + "display_name": "clanguml::t00036::ns1::E", + "id": "2144761953049158478", + "is_nested": false, + "name": "E", + "namespace": "clanguml::t00036::ns1", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "line": 6 + }, + "type": "enum" + }, + { + "display_name": "clanguml::t00036::ns1::ns11", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00036::ns1::ns11::A", + "id": "571573305652194946", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "line": 11 + }, + "type": "T" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00036::ns1::ns11", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "line": 10 + }, + "template_parameters": [ + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + } + ], + "type": "class" + }, + { + "display_name": "clanguml::t00036::ns1::ns11::ns111", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00036::ns1::ns11::ns111::B", + "id": "1964031933563607376", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a_int", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "line": 17 + }, + "type": "A" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00036::ns1::ns11::ns111", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "ns111", + "type": "namespace" + }, + { + "bases": [], + "display_name": "clanguml::t00036::ns1::ns11::A", + "id": "1832710427462319797", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00036::ns1::ns11", + "template_parameters": [ + { + "is_template_parameter": false, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "int", + "type": "" + } + ], + "type": "class" + } + ], + "name": "ns11", + "type": "namespace" + } + ], + "name": "ns1", + "type": "namespace" + }, + { + "display_name": "clanguml::t00036::ns2", + "elements": [ + { + "display_name": "clanguml::t00036::ns2::ns22", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00036::ns2::ns22::C", + "id": "2038956882066165590", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00036::ns2::ns22", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "ns22", + "type": "namespace" + } + ], + "name": "ns2", + "type": "namespace" + } + ], + "relationships": [ + { + "access": "public", + "destination": "1832710427462319797", + "label": "a_int", + "source": "1964031933563607376", + "type": "aggregation" + }, + { + "access": "public", + "destination": "571573305652194946", + "source": "1832710427462319797", + "type": "instantiation" + } + ] +} +)##"; + + auto j = generate_class_json(diagram, *model); + + REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index a1cce9f9..cdae7c0d 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -114,4 +114,559 @@ TEST_CASE("t00056", "[test-case][class]") _A("F"), _A("greater_than_simple"), "T1,T3")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + const std::string expected_json = R"##( +{ + "elements": [ + { + "display_name": "clanguml::t00056::greater_than_simple", + "id": "902541696362244204", + "name": "greater_than_simple", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 7 + }, + "statements": [], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::greater_than_with_requires", + "id": "1830716585637735576", + "name": "greater_than_with_requires", + "namespace": "clanguml::t00056", + "parameters": [ + { + "name": "clanguml::t00056::l", + "type": "T" + }, + { + "name": "clanguml::t00056::r", + "type": "P" + } + ], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 10 + }, + "statements": [ + "sizeof (l) > sizeof (r)" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::max_four_bytes", + "id": "385255522691733325", + "name": "max_four_bytes", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 15 + }, + "statements": [], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::iterable", + "id": "392540961352249242", + "name": "iterable", + "namespace": "clanguml::t00056", + "parameters": [ + { + "name": "clanguml::t00056::container", + "type": "T" + } + ], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 19 + }, + "statements": [ + "container.begin()", + "container.end()" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::has_value_type", + "id": "1850394311226276678", + "name": "has_value_type", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 26 + }, + "statements": [ + "typename T::value_type" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::convertible_to_string", + "id": "137304962071054497", + "name": "convertible_to_string", + "namespace": "clanguml::t00056", + "parameters": [ + { + "name": "clanguml::t00056::s", + "type": "T" + } + ], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 29 + }, + "statements": [ + "std::string{s}", + "{std::to_string(s)} noexcept", + "{std::to_string(s)} -> std::same_as" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::iterable_with_value_type", + "id": "1043398062146751019", + "name": "iterable_with_value_type", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 45 + }, + "statements": [], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::iterable_or_small_value_type", + "id": "866345615551223718", + "name": "iterable_or_small_value_type", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 48 + }, + "statements": [], + "type": "concept" + }, + { + "bases": [], + "display_name": "clanguml::t00056::A", + "id": "1418333499545421661", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 53 + }, + "type": "T" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00056", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 52 + }, + "template_parameters": [ + { + "concept_constraint": "clanguml::t00056::max_four_bytes", + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::B", + "id": "1814355496814977880", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 60 + }, + "type": "T" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00056", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 59 + }, + "template_parameters": [ + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::C", + "id": "1512618198241549089", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 70 + }, + "type": "T" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00056", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 69 + }, + "template_parameters": [ + { + "concept_constraint": "clanguml::t00056::convertible_to_string", + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::D", + "id": "1635109601630198093", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00056", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 75 + }, + "template_parameters": [ + { + "concept_constraint": "clanguml::t00056::iterable", + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T1", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T2", + "type": "" + }, + { + "concept_constraint": "clanguml::t00056::iterable", + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T3", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T4", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T5", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::E", + "id": "1429225801945621089", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "e1", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 80 + }, + "type": "T1" + }, + { + "access": "public", + "is_static": false, + "name": "e2", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 81 + }, + "type": "T2" + }, + { + "access": "public", + "is_static": false, + "name": "e3", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 82 + }, + "type": "T3" + } + ], + "methods": [], + "name": "E", + "namespace": "clanguml::t00056", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 79 + }, + "template_parameters": [ + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T1", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T2", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T3", + "type": "" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::F", + "id": "856301122972546034", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "f1", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 88 + }, + "type": "T1" + }, + { + "access": "public", + "is_static": false, + "name": "f2", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 89 + }, + "type": "T2" + }, + { + "access": "public", + "is_static": false, + "name": "f3", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 90 + }, + "type": "T3" + } + ], + "methods": [], + "name": "F", + "namespace": "clanguml::t00056", + "source_location": { + "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "line": 87 + }, + "template_parameters": [ + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T1", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T2", + "type": "" + }, + { + "is_template_parameter": true, + "is_template_template_parameter": false, + "is_variadic": false, + "name": "T3", + "type": "" + } + ], + "type": "class" + } + ], + "relationships": [ + { + "destination": "385255522691733325", + "label": "T", + "source": "137304962071054497", + "type": "constraint" + }, + { + "destination": "392540961352249242", + "label": "T", + "source": "1043398062146751019", + "type": "constraint" + }, + { + "destination": "1850394311226276678", + "label": "T", + "source": "1043398062146751019", + "type": "constraint" + }, + { + "destination": "1043398062146751019", + "label": "T", + "source": "866345615551223718", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T", + "source": "866345615551223718", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T", + "source": "1418333499545421661", + "type": "constraint" + }, + { + "destination": "866345615551223718", + "label": "T", + "source": "1814355496814977880", + "type": "constraint" + }, + { + "destination": "137304962071054497", + "label": "T", + "source": "1512618198241549089", + "type": "constraint" + }, + { + "destination": "392540961352249242", + "label": "T1", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "392540961352249242", + "label": "T3", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T2", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T5", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "1830716585637735576", + "label": "T1,T3", + "source": "1429225801945621089", + "type": "constraint" + }, + { + "destination": "902541696362244204", + "label": "T1,T3", + "source": "856301122972546034", + "type": "constraint" + } + ] +} +)##"; + auto j = generate_class_json(diagram, *model); + + REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index e3434ef0..c7b52c8c 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -156,6 +156,20 @@ std::string generate_class_puml( return ss.str(); } +nlohmann::json generate_class_json( + std::shared_ptr config, + clanguml::class_diagram::model::diagram &model) +{ + using namespace clanguml::class_diagram::generators::json; + + std::stringstream ss; + + ss << generator( + dynamic_cast(*config), model); + + return nlohmann::json::parse(ss.str()); +} + std::string generate_package_puml( std::shared_ptr config, clanguml::package_diagram::model::diagram &model) @@ -198,6 +212,16 @@ void save_puml(const std::string &path, const std::string &puml) ofs.close(); } +void save_json(const std::string &path, const nlohmann::json &j) +{ + std::filesystem::path p{path}; + std::filesystem::create_directory(p.parent_path()); + std::ofstream ofs; + ofs.open(p, std::ofstream::out | std::ofstream::trunc); + ofs << std::setw(2) << j; + ofs.close(); +} + using namespace clanguml::test::matchers; /// From 2848090ad8caa42befa42ba5411e813d63b69203 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 15 Mar 2023 01:23:10 +0100 Subject: [PATCH 05/30] Fix clang-tidy warnings --- .../json/class_diagram_generator.cc | 23 +- src/common/generators/generators.cc | 224 ++++++++++++++++++ src/common/generators/generators.h | 195 +-------------- 3 files changed, 243 insertions(+), 199 deletions(-) create mode 100644 src/common/generators/generators.cc diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index 9ff39d7d..581a5cfd 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -34,8 +34,8 @@ void to_json(nlohmann::json &j, const element &c) {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()}, {"display_name", c.full_name(false)}}; - if (c.comment()) - j["comment"] = c.comment().value(); + if (const auto &comment = c.comment(); comment) + j["comment"] = comment.value(); if (!c.file().empty()) j["source_location"] = @@ -50,8 +50,8 @@ void to_json(nlohmann::json &j, const template_parameter &c) j["default_value"] = c.default_value(); j["is_template_parameter"] = c.is_template_parameter(); j["is_template_template_parameter"] = c.is_template_template_parameter(); - if (c.concept_constraint()) - j["concept_constraint"] = c.concept_constraint().value(); + if (const auto &constraint = c.concept_constraint(); constraint) + j["concept_constraint"] = constraint.value(); j["is_variadic"] = c.is_variadic(); } @@ -67,11 +67,11 @@ void to_json(nlohmann::json &j, const relationship &c) j["access"] = to_string(c.access()); if (!c.label().empty()) j["label"] = c.label(); - if (c.comment()) - j["comment"] = c.comment().value(); + if (const auto &comment = c.comment(); comment) + j["comment"] = comment.value(); } -} +} // namespace clanguml::common::model namespace clanguml::class_diagram::model { using nlohmann::json; @@ -84,8 +84,8 @@ void to_json(nlohmann::json &j, const class_element &c) if (!c.file().empty()) j["source_location"] = dynamic_cast(c); - if (c.comment()) - j["comment"] = c.comment().value(); + if (const auto &comment = c.comment(); comment) + j["comment"] = comment.value(); } void to_json(nlohmann::json &j, const class_member &c) @@ -154,7 +154,8 @@ void to_json(nlohmann::json &j, const concept_ &c) j["parameters"] = c.requires_parameters(); j["statements"] = c.requires_statements(); } -} + +} // namespace clanguml::class_diagram::model namespace clanguml::class_diagram::generators::json { @@ -392,4 +393,4 @@ void generator::generate_relationships( } } -} // namespace clanguml::class_diagram::generators::plantuml +} // namespace clanguml::class_diagram::generators::json diff --git a/src/common/generators/generators.cc b/src/common/generators/generators.cc new file mode 100644 index 00000000..02823113 --- /dev/null +++ b/src/common/generators/generators.cc @@ -0,0 +1,224 @@ +/** + * src/common/generators/generators.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "generators.h" + +namespace clanguml::common::generators { +void find_translation_units_for_diagrams( + const std::vector &diagram_names, + clanguml::config::config &config, + const std::vector &compilation_database_files, + std::map> &translation_units_map) +{ + for (const auto &[name, diagram] : config.diagrams) { + // If there are any specific diagram names provided on the command line, + // and this diagram is not in that list - skip it + if (!diagram_names.empty() && !util::contains(diagram_names, name)) + continue; + + // If glob is not defined use all translation units from the + // compilation database + if (!diagram->glob.has_value) { + translation_units_map[name] = compilation_database_files; + } + // Otherwise, get all translation units matching the glob from diagram + // configuration + else { + const std::vector translation_units = + diagram->get_translation_units(); + + std::vector valid_translation_units{}; + std::copy_if(compilation_database_files.begin(), + compilation_database_files.end(), + std::back_inserter(valid_translation_units), + [&translation_units](const auto &tu) { + return util::contains(translation_units, tu); + }); + + translation_units_map[name] = std::move(valid_translation_units); + } + } +} + +void generate_diagram(const std::string &od, const std::string &name, + std::shared_ptr diagram, + const clang::tooling::CompilationDatabase &db, + const std::vector &translation_units, + const std::vector &generators, + bool verbose) +{ + using clanguml::common::generator_type_t; + using clanguml::common::model::diagram_t; + using clanguml::config::class_diagram; + using clanguml::config::include_diagram; + using clanguml::config::package_diagram; + using clanguml::config::sequence_diagram; + + if (diagram->type() == diagram_t::kClass) { + using diagram_config = class_diagram; + using diagram_model = clanguml::class_diagram::model::diagram; + using diagram_visitor = + clanguml::class_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + for (const auto generator_type : generators) { + if (generator_type == generator_type_t::plantuml) { + auto path = + std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::class_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (generator_type == generator_type_t::json) { + auto path = + std::filesystem::path{od} / fmt::format("{}.json", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::class_diagram::generators::json::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + } + } + else if (diagram->type() == diagram_t::kSequence) { + using diagram_config = sequence_diagram; + using diagram_model = clanguml::sequence_diagram::model::diagram; + using diagram_visitor = + clanguml::sequence_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::sequence_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), + *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (diagram->type() == diagram_t::kPackage) { + using diagram_config = package_diagram; + using diagram_model = clanguml::package_diagram::model::diagram; + using diagram_visitor = + clanguml::package_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + + ofs << clanguml::package_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (diagram->type() == diagram_t::kInclude) { + using diagram_config = include_diagram; + using diagram_model = clanguml::include_diagram::model::diagram; + using diagram_visitor = + clanguml::include_diagram::visitor::translation_unit_visitor; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, + verbose); + + auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + + ofs << clanguml::include_diagram::generators::plantuml::generator( + dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } +} + +void generate_diagrams(const std::vector &diagram_names, + clanguml::config::config &config, const std::string &od, + const std::unique_ptr &db, + const int verbose, const unsigned int thread_count, + const std::vector &generators, + const std::map> + &translation_units_map) +{ + util::thread_pool_executor generator_executor{thread_count}; + std::vector> futs; + + for (const auto &[name, diagram] : config.diagrams) { + // If there are any specific diagram names provided on the command line, + // and this diagram is not in that list - skip it + if (!diagram_names.empty() && !util::contains(diagram_names, name)) + continue; + + const auto &valid_translation_units = translation_units_map.at(name); + + if (valid_translation_units.empty()) { + LOG_ERROR( + "Diagram {} generation failed: no translation units found", + name); + continue; + } + + futs.emplace_back(generator_executor.add( + [&od, &generators, &name = name, &diagram = diagram, + db = std::ref(*db), translation_units = valid_translation_units, + verbose]() { + try { + generate_diagram(od, name, diagram, db, translation_units, + generators, verbose != 0); + } + catch (std::runtime_error &e) { + LOG_ERROR(e.what()); + } + })); + } + + for (auto &fut : futs) { + fut.get(); + } +} + +} // namespace clanguml::common::generators \ No newline at end of file diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h index 5e260619..8cf7874a 100644 --- a/src/common/generators/generators.h +++ b/src/common/generators/generators.h @@ -49,37 +49,7 @@ void find_translation_units_for_diagrams( const std::vector &diagram_names, clanguml::config::config &config, const std::vector &compilation_database_files, - std::map> &translation_units_map) -{ - for (const auto &[name, diagram] : config.diagrams) { - // If there are any specific diagram names provided on the command line, - // and this diagram is not in that list - skip it - if (!diagram_names.empty() && !util::contains(diagram_names, name)) - continue; - - // If glob is not defined use all translation units from the - // compilation database - if (!diagram->glob.has_value) { - translation_units_map[name] = compilation_database_files; - } - // Otherwise, get all translation units matching the glob from diagram - // configuration - else { - const std::vector translation_units = - diagram->get_translation_units(); - - std::vector valid_translation_units{}; - std::copy_if(compilation_database_files.begin(), - compilation_database_files.end(), - std::back_inserter(valid_translation_units), - [&translation_units](const auto &tu) { - return util::contains(translation_units, tu); - }); - - translation_units_map[name] = std::move(valid_translation_units); - } - } -} + std::map> &translation_units_map); template @@ -203,166 +173,15 @@ void generate_diagram(const std::string &od, const std::string &name, std::shared_ptr diagram, const clang::tooling::CompilationDatabase &db, const std::vector &translation_units, - const std::vector generators, - bool verbose) -{ - using clanguml::common::generator_type_t; - using clanguml::common::model::diagram_t; - using clanguml::config::class_diagram; - using clanguml::config::include_diagram; - using clanguml::config::package_diagram; - using clanguml::config::sequence_diagram; - - if (diagram->type() == diagram_t::kClass) { - using diagram_config = class_diagram; - using diagram_model = clanguml::class_diagram::model::diagram; - using diagram_visitor = - clanguml::class_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - for (const auto generator_type : generators) { - if (generator_type == generator_type_t::plantuml) { - auto path = - std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::class_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - else if (generator_type == generator_type_t::json) { - auto path = - std::filesystem::path{od} / fmt::format("{}.json", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::class_diagram::generators::json::generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - } - } - else if (diagram->type() == diagram_t::kSequence) { - using diagram_config = sequence_diagram; - using diagram_model = clanguml::sequence_diagram::model::diagram; - using diagram_visitor = - clanguml::sequence_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::sequence_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), - *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - else if (diagram->type() == diagram_t::kPackage) { - using diagram_config = package_diagram; - using diagram_model = clanguml::package_diagram::model::diagram; - using diagram_visitor = - clanguml::package_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - - ofs << clanguml::package_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - else if (diagram->type() == diagram_t::kInclude) { - using diagram_config = include_diagram; - using diagram_model = clanguml::include_diagram::model::diagram; - using diagram_visitor = - clanguml::include_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - - ofs << clanguml::include_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } -} + const std::vector &generators, + bool verbose); void generate_diagrams(const std::vector &diagram_names, clanguml::config::config &config, const std::string &od, - const std::unique_ptr &db, - const int verbose, const unsigned int thread_count, - const std::vector generators, + const std::unique_ptr &db, int verbose, + unsigned int thread_count, + const std::vector &generators, const std::map> - &translation_units_map) -{ - util::thread_pool_executor generator_executor{thread_count}; - std::vector> futs; - - for (const auto &[name, diagram] : config.diagrams) { - // If there are any specific diagram names provided on the command line, - // and this diagram is not in that list - skip it - if (!diagram_names.empty() && !util::contains(diagram_names, name)) - continue; - - const auto &valid_translation_units = translation_units_map.at(name); - - if (valid_translation_units.empty()) { - LOG_ERROR( - "Diagram {} generation failed: no translation units found", - name); - continue; - } - - futs.emplace_back(generator_executor.add( - [&od, &generators, &name = name, &diagram = diagram, - db = std::ref(*db), translation_units = valid_translation_units, - verbose]() { - try { - generate_diagram(od, name, diagram, db, translation_units, - generators, verbose != 0); - } - catch (std::runtime_error &e) { - LOG_ERROR(e.what()); - } - })); - } - - for (auto &fut : futs) { - fut.get(); - } -} + &translation_units_map); } // namespace clanguml::common::generators \ No newline at end of file From 3a01d8689cf3125ff5bd0d31f1050d64363df34a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 15 Mar 2023 18:01:39 +0100 Subject: [PATCH 06/30] Updated troubleshooting --- docs/troubleshooting.md | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index bc5ede87..434a8e9f 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -4,6 +4,7 @@ * [General issues](#general-issues) * [Diagram generated with PlantUML is cropped](#diagram-generated-with-plantuml-is-cropped) + * [YAML anchors and aliases are not fully supported](#yaml-anchors-and-aliases-are-not-fully-supported) * [Class diagrams](#class-diagrams) * ["fatal error: 'stddef.h' file not found"](#fatal-error-stddefh-file-not-found) * [Sequence diagrams](#sequence-diagrams) @@ -16,17 +17,51 @@ ### Diagram generated with PlantUML is cropped When generating diagrams with PlantUML without specifying an output file format, the default is PNG. Unfortunately PlantUML will not check if the diagram will fit in the default PNG size, and often the diagram -will be be incomplete in the picture. A better option is to specify SVG as output format and then convert +will be incomplete in the picture. A better option is to specify SVG as output format and then convert to PNG, e.g.: ```bash $ plantuml -tsvg mydiagram.puml $ convert +antialias mydiagram.svg mydiagram.png ``` +### YAML anchors and aliases are not fully supported +`clang-uml` uses [yaml-cpp](https://github.com/jbeder/yaml-cpp) library, which +currently does not support +[merging YAML anchor dictionaries](https://github.com/jbeder/yaml-cpp/issues/41), +e.g. in the following configuration file the `main_sequence_diagram` will work, +but the `foo_sequence_diagram` will fail with parse error: + +```yaml +compilation_database_dir: debug +output_directory: output + +.sequence_diagram_anchor: &sequence_diagram_anchor + type: sequence + glob: [] + start_from: + - function: 'main(int,const char**)' + +diagrams: + main_sequence_diagram: *sequence_diagram_anchor + foo_sequence_diagram: + <<: *sequence_diagram_anchor + glob: [src/foo.cc] + start_from: + - function: 'foo(int,float)' +``` + +One option around this is to use some YAML preprocessor, such as +[yq](https://github.com/mikefarah/yq) on such file and passing +the configuration file to `clang-uml` using `stdin`, e.g.: + +```bash +yq 'explode(.)' .clang-uml | clang-uml --config - +``` + ## Class diagrams ### "fatal error: 'stddef.h' file not found" This error means that Clang cannot find some standard headers in the include paths -specified in the `compile_commands.json`. This typically happens on macos and sometimes on Linux, when +specified in the `compile_commands.json`. This typically happens on macOS and sometimes on Linux, when the code was compiled with different Clang version than `clang-uml` itself. One solution to this issue is to add the following line to your `CMakeLists.txt` file: @@ -65,4 +100,4 @@ from files in a subdirectory of your project, e.g.: - myproject paths: - src -``` \ No newline at end of file +``` From 6d4533018b6e35ee8bee375ed87c9b045e4556c3 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 16 Mar 2023 01:53:10 +0100 Subject: [PATCH 07/30] Refactoring template_parameter model --- .../json/class_diagram_generator.cc | 25 ++- .../visitor/translation_unit_visitor.cc | 178 +++++++++--------- .../visitor/translation_unit_visitor.h | 21 +-- src/common/clang_utils.cc | 18 +- src/common/model/template_parameter.cc | 99 +++++++--- src/common/model/template_parameter.h | 116 ++++++++++-- .../visitor/translation_unit_visitor.cc | 137 +++++++------- .../visitor/translation_unit_visitor.h | 23 ++- tests/t00008/test_case.h | 2 +- tests/test_util.cc | 28 +-- 10 files changed, 393 insertions(+), 254 deletions(-) diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index 581a5cfd..39a8ebaa 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -44,15 +44,22 @@ void to_json(nlohmann::json &j, const element &c) void to_json(nlohmann::json &j, const template_parameter &c) { - j["type"] = c.type(); - j["name"] = c.name(); - if (!c.default_value().empty()) - j["default_value"] = c.default_value(); - j["is_template_parameter"] = c.is_template_parameter(); - j["is_template_template_parameter"] = c.is_template_template_parameter(); - if (const auto &constraint = c.concept_constraint(); constraint) - j["concept_constraint"] = constraint.value(); - j["is_variadic"] = c.is_variadic(); + j["kind"] = to_string(c.kind()); + + if(c.kind() == template_parameter_kind_t::template_type) { + j["name"] = c.name().value(); + } + + +// j["type"] = c.type(); +// j["name"] = c.name(); +// if (!c.default_value().empty()) +// j["default_value"] = c.default_value(); +// j["is_template_parameter"] = c.is_template_parameter(); +// j["is_template_template_parameter"] = c.is_template_template_parameter(); +// if (const auto &constraint = c.concept_constraint(); constraint) +// j["concept_constraint"] = constraint.value(); +// j["is_variadic"] = c.is_variadic(); } void to_json(nlohmann::json &j, const relationship &c) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index d80d1e68..c3f66a00 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -949,12 +949,15 @@ bool translation_unit_visitor::process_template_parameters( nullptr) { const auto *template_type_parameter = clang::dyn_cast_or_null(parameter); - template_parameter ct; - ct.set_type(""); - ct.is_template_parameter(true); - ct.set_name(template_type_parameter->getNameAsString()); - ct.set_default_value(""); - ct.is_variadic(template_type_parameter->isParameterPack()); + + std::optional default_arg; + if (template_type_parameter->hasDefaultArgument()) { + default_arg = + template_type_parameter->getDefaultArgument().getAsString(); + } + auto ct = template_parameter::make_template_type( + template_type_parameter->getNameAsString(), default_arg, + template_type_parameter->isParameterPack()); if (template_type_parameter->getTypeConstraint() != nullptr) { util::apply_if_not_null( @@ -970,7 +973,7 @@ bool translation_unit_visitor::process_template_parameters( {relationship_t::kConstraint, get_ast_local_id(named_concept->getID()) .value(), - access_t::kNone, ct.name()}); + access_t::kNone, ct.name().value()}); } }); } @@ -982,12 +985,14 @@ bool translation_unit_visitor::process_template_parameters( const auto *template_nontype_parameter = clang::dyn_cast_or_null( parameter); - template_parameter ct; - ct.set_type(template_nontype_parameter->getType().getAsString()); - ct.set_name(template_nontype_parameter->getNameAsString()); - ct.is_template_parameter(false); - ct.set_default_value(""); - ct.is_variadic(template_nontype_parameter->isParameterPack()); + std::optional default_arg; + if (template_nontype_parameter->hasDefaultArgument()) + default_arg = common::to_string( + template_nontype_parameter->getDefaultArgument()); + auto ct = template_parameter::make_non_type_template( + template_nontype_parameter->getType().getAsString(), + template_nontype_parameter->getNameAsString(), default_arg, + template_nontype_parameter->isParameterPack()); c.add_template(std::move(ct)); } @@ -996,12 +1001,15 @@ bool translation_unit_visitor::process_template_parameters( const auto *template_template_parameter = clang::dyn_cast_or_null( parameter); - template_parameter ct; - ct.set_type(""); - ct.set_name(template_template_parameter->getNameAsString() + "<>"); - ct.is_template_parameter(true); - ct.set_default_value(""); - ct.is_variadic(template_template_parameter->isParameterPack()); + std::optional default_arg; + if (template_template_parameter->hasDefaultArgument()) + default_arg = common::to_string( + template_template_parameter->getDefaultArgument() + .getArgument() + .getAsExpr()); + auto ct = template_parameter::make_template_template_type( + template_template_parameter->getNameAsString(), default_arg, + template_template_parameter->isParameterPack()); c.add_template(std::move(ct)); } @@ -1798,8 +1806,7 @@ void translation_unit_visitor::process_template_specialization_argument( const auto argument_kind = arg.getKind(); if (argument_kind == clang::TemplateArgument::Type) { - template_parameter argument; - argument.is_template_parameter(false); + auto argument = template_parameter::make_argument({}); // If this is a nested template type - add nested templates as // template arguments @@ -1812,7 +1819,7 @@ void translation_unit_visitor::process_template_specialization_argument( .getAsTemplateDecl() ->getQualifiedNameAsString(); - argument.set_name(nested_template_name); + argument.set_type(nested_template_name); auto nested_template_instantiation = build_template_instantiation( *nested_template_type, {&template_instantiation}); @@ -1821,12 +1828,6 @@ void translation_unit_visitor::process_template_specialization_argument( for (const auto &t : nested_template_instantiation->templates()) argument.add_template_param(t); - - // Check if this template should be simplified (e.g. system - // template aliases such as 'std:basic_string' should be - // simply 'std::string') - simplify_system_template(argument, - argument.to_string(config().using_namespace(), false)); } else if (arg.getAsType()->getAs() != nullptr) { @@ -1857,7 +1858,7 @@ void translation_unit_visitor::process_template_specialization_argument( } } - argument.set_name(type_name); + argument.set_type(type_name); } else { auto type_name = @@ -1879,7 +1880,7 @@ void translation_unit_visitor::process_template_specialization_argument( type_name.substr(0, type_name.find('<')); ensure_lambda_type_is_relative(unexposed_type_name); - argument.set_name(unexposed_type_name); + argument.set_type(unexposed_type_name); } else if (type_name.find("type-parameter-") == 0) { auto declaration_text = common::get_source_text_raw( @@ -1903,10 +1904,10 @@ void translation_unit_visitor::process_template_specialization_argument( // Otherwise just set the name for the template argument to // whatever clang says - argument.set_name(type_name); + argument.set_type(type_name); } else { - argument.set_name(type_name); + argument.set_type(type_name); } } @@ -1919,23 +1920,18 @@ void translation_unit_visitor::process_template_specialization_argument( template_instantiation.add_template(std::move(argument)); } else if (argument_kind == clang::TemplateArgument::Integral) { - template_parameter argument; - argument.is_template_parameter(false); - argument.set_type(std::to_string(arg.getAsIntegral().getExtValue())); + auto argument = template_parameter::make_argument( + std::to_string(arg.getAsIntegral().getExtValue())); template_instantiation.add_template(std::move(argument)); } else if (argument_kind == clang::TemplateArgument::Expression) { - template_parameter argument; - argument.is_template_parameter(false); - argument.set_type(common::get_source_text( - arg.getAsExpr()->getSourceRange(), source_manager())); + auto argument = + template_parameter::make_argument(common::get_source_text( + arg.getAsExpr()->getSourceRange(), source_manager())); template_instantiation.add_template(std::move(argument)); } else if (argument_kind == clang::TemplateArgument::TemplateExpansion) { - template_parameter argument; - argument.is_template_parameter(true); - - cls->getLocation().dump(source_manager()); + // TODO } else if (argument_kind == clang::TemplateArgument::Pack) { // This will only work for now if pack is at the end @@ -1973,17 +1969,18 @@ void translation_unit_visitor:: bool translation_unit_visitor::find_relationships_in_unexposed_template_params( const template_parameter &ct, found_relationships_t &relationships) { + assert(ct.type()); + bool found{false}; LOG_DBG("Finding relationships in user defined type: {}", ct.to_string(config().using_namespace(), false)); - // auto type_with_namespace = ctx.get_name_with_namespace(ct.type()); auto type_with_namespace = - std::make_optional(ct.type()); + std::make_optional(ct.type().value()); if (!type_with_namespace.has_value()) { // Couldn't find declaration of this type - type_with_namespace = common::model::namespace_{ct.type()}; + type_with_namespace = common::model::namespace_{ct.type().value()}; } auto element_opt = diagram().get(type_with_namespace.value().to_string()); @@ -2293,26 +2290,27 @@ void translation_unit_visitor:: auto arg_index = 0; for (const auto &arg : template_args) { const auto argument_kind = arg.getKind(); - template_parameter argument; + std::optional argument; if (argument_kind == clang::TemplateArgument::Template) { - build_template_instantiation_process_template_argument( - arg, argument); + argument = + build_template_instantiation_process_template_argument(arg); } else if (argument_kind == clang::TemplateArgument::Type) { - build_template_instantiation_process_type_argument(parent, - full_template_specialization_name, template_decl, arg, - template_instantiation, argument); + argument = build_template_instantiation_process_type_argument( + parent, full_template_specialization_name, template_decl, arg, + template_instantiation); } else if (argument_kind == clang::TemplateArgument::Integral) { - build_template_instantiation_process_integral_argument( - arg, argument); + argument = + build_template_instantiation_process_integral_argument(arg); } else if (argument_kind == clang::TemplateArgument::Expression) { - build_template_instantiation_process_expression_argument( - arg, argument); + argument = + build_template_instantiation_process_expression_argument(arg); } else { LOG_ERROR("Unsupported argument type {}", arg.getKind()); + continue; } // We can figure this only when we encounter variadic param in @@ -2326,43 +2324,42 @@ void translation_unit_visitor:: if (!template_base_params.empty()) { variadic_params = build_template_instantiation_add_base_classes( template_instantiation, template_base_params, arg_index, - variadic_params, argument); + variadic_params, argument.value()); } LOG_DBG("Adding template argument {} to template " "specialization/instantiation {}", - argument.name(), template_instantiation.name()); + argument.value().to_string(config().using_namespace(), false), + template_instantiation.name()); - simplify_system_template( - argument, argument.to_string(config().using_namespace(), false)); + simplify_system_template(argument.value(), + argument.value().to_string(config().using_namespace(), false)); - template_instantiation.add_template(std::move(argument)); + template_instantiation.add_template(std::move(argument.value())); arg_index++; } } -void translation_unit_visitor:: +template_parameter translation_unit_visitor:: build_template_instantiation_process_template_argument( - const clang::TemplateArgument &arg, template_parameter &argument) const + const clang::TemplateArgument &arg) const { - argument.is_template_parameter(true); auto arg_name = arg.getAsTemplate().getAsTemplateDecl()->getQualifiedNameAsString(); - argument.set_type(arg_name); + return template_parameter::make_template_type(arg_name); } -void translation_unit_visitor:: - build_template_instantiation_process_type_argument( - std::optional &parent, - const std::string &full_template_specialization_name, - const clang::TemplateDecl *template_decl, - const clang::TemplateArgument &arg, class_ &template_instantiation, - template_parameter &argument) +template_parameter +translation_unit_visitor::build_template_instantiation_process_type_argument( + std::optional &parent, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl, + const clang::TemplateArgument &arg, class_ &template_instantiation) { assert(arg.getKind() == clang::TemplateArgument::Type); - argument.is_template_parameter(false); + auto argument = template_parameter::make_argument({}); // If this is a nested template type - add nested templates as // template arguments @@ -2414,12 +2411,11 @@ void translation_unit_visitor:: arg.getAsType()->getAs(); nested_template_type != nullptr) { - const auto nested_template_name = - nested_template_type->getTemplateName() - .getAsTemplateDecl() - ->getQualifiedNameAsString(); + const auto nested_type_name = nested_template_type->getTemplateName() + .getAsTemplateDecl() + ->getQualifiedNameAsString(); - argument.set_name(nested_template_name); + argument.set_type(nested_type_name); auto nested_template_instantiation = build_template_instantiation(*nested_template_type, @@ -2462,7 +2458,7 @@ void translation_unit_visitor:: } else if (arg.getAsType()->getAs() != nullptr) { argument.is_template_parameter(true); - argument.set_name( + argument.set_type( common::to_string(arg.getAsType(), template_decl->getASTContext())); } else { @@ -2471,26 +2467,26 @@ void translation_unit_visitor:: template_instantiation, full_template_specialization_name, template_decl, arg, argument); } + + return argument; } -void translation_unit_visitor:: +template_parameter translation_unit_visitor:: build_template_instantiation_process_integral_argument( - const clang::TemplateArgument &arg, template_parameter &argument) const + const clang::TemplateArgument &arg) const { assert(arg.getKind() == clang::TemplateArgument::Integral); - argument.is_template_parameter(false); - argument.set_type(std::to_string(arg.getAsIntegral().getExtValue())); + return template_parameter::make_argument( + std::to_string(arg.getAsIntegral().getExtValue())); } -void translation_unit_visitor:: +template_parameter translation_unit_visitor:: build_template_instantiation_process_expression_argument( - const clang::TemplateArgument &arg, template_parameter &argument) const + const clang::TemplateArgument &arg) const { assert(arg.getKind() == clang::TemplateArgument::Expression); - - argument.is_template_parameter(false); - argument.set_type(common::get_source_text( + return template_parameter::make_argument(common::get_source_text( arg.getAsExpr()->getSourceRange(), source_manager())); } @@ -2505,7 +2501,7 @@ void translation_unit_visitor:: argument.is_template_parameter(false); - argument.set_name( + argument.set_type( common::to_string(arg.getAsType(), template_decl->getASTContext())); if (const auto *record_type = arg.getAsType()->getAs(); @@ -2688,7 +2684,7 @@ void translation_unit_visitor::process_field( for (const auto &template_argument : template_specialization.templates()) { - LOG_DBG("Looking for nested relationships from {}:{} in " + LOG_DBG("Looking for nested relationships from {}::{} in " "template {}", c.full_name(false), field_name, template_argument.to_string( @@ -2792,7 +2788,7 @@ bool translation_unit_visitor::simplify_system_template( template_parameter &ct, const std::string &full_name) const { if (config().type_aliases().count(full_name) > 0) { - ct.set_name(config().type_aliases().at(full_name)); + ct.set_type(config().type_aliases().at(full_name)); ct.clear_params(); return true; } diff --git a/src/class_diagram/visitor/translation_unit_visitor.h b/src/class_diagram/visitor/translation_unit_visitor.h index 22cbf048..e18573a8 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.h +++ b/src/class_diagram/visitor/translation_unit_visitor.h @@ -218,25 +218,22 @@ private: const clang::TemplateArgument &arg, common::model::template_parameter &argument); - void build_template_instantiation_process_expression_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const; + template_parameter build_template_instantiation_process_expression_argument( + const clang::TemplateArgument &arg) const; - void build_template_instantiation_process_integral_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const; + template_parameter build_template_instantiation_process_integral_argument( + const clang::TemplateArgument &arg) const; - void build_template_instantiation_process_type_argument( + template_parameter build_template_instantiation_process_type_argument( std::optional &parent, const std::string &full_template_specialization_name, const clang::TemplateDecl *template_decl, const clang::TemplateArgument &arg, - model::class_ &template_instantiation, - common::model::template_parameter &argument); + model::class_ &template_instantiation); - void build_template_instantiation_process_template_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const; + common::model::template_parameter + build_template_instantiation_process_template_argument( + const clang::TemplateArgument &arg) const; void ensure_lambda_type_is_relative(std::string ¶meter_type) const; diff --git a/src/common/clang_utils.cc b/src/common/clang_utils.cc index 543a40b3..f9c42fcf 100644 --- a/src/common/clang_utils.cc +++ b/src/common/clang_utils.cc @@ -368,8 +368,14 @@ std::vector parse_unexposed_template_params( nested_params = parse_unexposed_template_params( nested_params_str, ns_resolve, depth + 1); - if (nested_params.empty()) - nested_params.emplace_back(nested_params_str); + if (nested_params.empty()) { + // We couldn't extract any nested template parameters from + // `nested_params_str` so just add it as type of template + // argument as is + nested_params.emplace_back( + template_parameter::make_unexposed_argument( + nested_params_str)); + } it = bracket_match_end - 1; } @@ -386,8 +392,8 @@ std::vector parse_unexposed_template_params( type += *it; } if (complete_class_template_argument) { - template_parameter t; - t.set_type(ns_resolve(clanguml::util::trim(type))); + auto t = template_parameter::make_unexposed_argument( + ns_resolve(clanguml::util::trim(type))); type = ""; for (auto &¶m : nested_params) t.add_template_param(std::move(param)); @@ -399,8 +405,8 @@ std::vector parse_unexposed_template_params( } if (!type.empty()) { - template_parameter t; - t.set_type(ns_resolve(clanguml::util::trim(type))); + auto t = template_parameter::make_unexposed_argument( + ns_resolve(clanguml::util::trim(type))); type = ""; for (auto &¶m : nested_params) t.add_template_param(std::move(param)); diff --git a/src/common/model/template_parameter.cc b/src/common/model/template_parameter.cc index 61e58d30..f7c4aca5 100644 --- a/src/common/model/template_parameter.cc +++ b/src/common/model/template_parameter.cc @@ -23,18 +23,38 @@ #include namespace clanguml::common::model { - -template_parameter::template_parameter(const std::string &type, - const std::string &name, std::string default_value, bool is_variadic) - : default_value_{std::move(default_value)} - , is_variadic_{is_variadic} +std::string to_string(template_parameter_kind_t k) { - set_name(name); - set_type(type); + switch (k) { + case template_parameter_kind_t::template_type: + return "template_type"; + case template_parameter_kind_t::template_template_type: + return "template_template_type"; + case template_parameter_kind_t::non_type_template: + return "non_type_template"; + case template_parameter_kind_t::argument: + return "argument"; + case template_parameter_kind_t::concept_constraint: + return "concept_constraint"; + default: + assert(0); + } } +// template_parameter::template_parameter(const std::optional +// &type, +// const std::optional &name, +// const std::optional &default_value, bool is_variadic) +// : type_{type} +// , name_{name} +// , default_value_{std::move(default_value)} +// , is_variadic_{is_variadic} +//{ +// } void template_parameter::set_type(const std::string &type) { + assert(kind_ != template_parameter_kind_t::template_type); + if (util::ends_with(type, std::string{"..."})) { type_ = type.substr(0, type.size() - 3); is_variadic_ = true; @@ -43,16 +63,24 @@ void template_parameter::set_type(const std::string &type) type_ = type; } -std::string template_parameter::type() const +std::optional template_parameter::type() const { - if (is_variadic_ && !type_.empty()) - return type_ + "..."; + if (!type_) + return {}; + + if (is_variadic_) + return type_.value() + "..."; return type_; } void template_parameter::set_name(const std::string &name) { + assert(kind_ != template_parameter_kind_t::argument); + + if (name.empty()) + return; + if (util::ends_with(name, std::string{"..."})) { name_ = name.substr(0, name.size() - 3); is_variadic_ = true; @@ -61,10 +89,13 @@ void template_parameter::set_name(const std::string &name) name_ = name; } -std::string template_parameter::name() const +std::optional template_parameter::name() const { - if (is_variadic_ && type_.empty()) - return name_ + "..."; + if (!name_) + return {}; + + if (is_variadic_ && (kind_ != template_parameter_kind_t::non_type_template)) + return name_.value() + "..."; return name_; } @@ -74,7 +105,10 @@ void template_parameter::set_default_value(const std::string &value) default_value_ = value; } -std::string template_parameter::default_value() const { return default_value_; } +const std::optional &template_parameter::default_value() const +{ + return default_value_; +} void template_parameter::is_variadic(bool is_variadic) noexcept { @@ -138,14 +172,17 @@ std::string template_parameter::to_string( { using clanguml::common::model::namespace_; - assert(!(!type().empty() && concept_constraint().has_value())); + assert(!(type().has_value() && concept_constraint().has_value())); std::string res; - if (!type().empty()) { + const auto maybe_type = type(); + if (maybe_type) { if (!relative) - res += namespace_{type()}.to_string(); + res += namespace_{*maybe_type}.to_string(); else - res += namespace_{type()}.relative_to(using_namespace).to_string(); + res += namespace_{*maybe_type} + .relative_to(using_namespace) + .to_string(); } const auto &maybe_concept_constraint = concept_constraint(); @@ -159,14 +196,19 @@ std::string template_parameter::to_string( .to_string(); } - if (!name().empty()) { - if (!type().empty() || maybe_concept_constraint) + const auto maybe_name = name(); + + if (maybe_name) { + if ((maybe_type && !maybe_type.value().empty()) || + maybe_concept_constraint) res += " "; if (!relative) - res += namespace_{name()}.to_string(); + res += namespace_{*maybe_name}.to_string(); else - res += namespace_{name()}.relative_to(using_namespace).to_string(); + res += namespace_{*maybe_name} + .relative_to(using_namespace) + .to_string(); } // Render nested template params @@ -181,9 +223,10 @@ std::string template_parameter::to_string( res += fmt::format("<{}>", fmt::join(params, ",")); } - if (!default_value().empty()) { + const auto &maybe_default_value = default_value(); + if (maybe_default_value) { res += "="; - res += default_value(); + res += maybe_default_value.value(); } return res; @@ -200,7 +243,8 @@ bool template_parameter::find_nested_relationships( // If this type argument should be included in the relationship // just add it and skip recursion (e.g. this is a user defined type) - if (should_include(name())) { + const auto maybe_type = type(); + if (maybe_type && should_include(maybe_type.value())) { const auto maybe_id = id(); if (maybe_id) { nested_relationships.emplace_back(maybe_id.value(), hint); @@ -212,8 +256,11 @@ bool template_parameter::find_nested_relationships( // interested what is stored inside it else { for (const auto &template_argument : template_params()) { + const auto maybe_id = template_argument.id(); - if (should_include(template_argument.name()) && maybe_id) { + const auto maybe_arg_type = template_argument.type(); + + if (maybe_id && maybe_arg_type && should_include(*maybe_arg_type)) { nested_relationships.emplace_back(maybe_id.value(), hint); diff --git a/src/common/model/template_parameter.h b/src/common/model/template_parameter.h index b9ce70eb..7ebba8de 100644 --- a/src/common/model/template_parameter.h +++ b/src/common/model/template_parameter.h @@ -26,30 +26,105 @@ namespace clanguml::common::model { -/// @brief Represents template parameter or template argument +enum class template_parameter_kind_t { + template_type, + template_template_type, + non_type_template, + argument, // a.k.a. type parameter specialization + concept_constraint +}; + +std::string to_string(template_parameter_kind_t k); + +/// @brief Represents template parameter, template arguments or concept +/// constraints /// /// This class can represent both template parameter and template arguments, /// including variadic parameters and instantiations with /// nested templates class template_parameter { -public: - template_parameter(const std::string &type = "", - const std::string &name = "", std::string default_value = "", - bool is_variadic = false); + template_parameter() = default; - template_parameter(const template_parameter &right) = default; +public: + static template_parameter make_template_type(std::string name, + const std::optional &default_value = {}, + bool is_variadic = false) + { + template_parameter p; + p.set_kind(template_parameter_kind_t::template_type); + p.set_name(std::move(name)); + p.is_variadic(is_variadic); + if (default_value) + p.set_default_value(default_value.value()); + return p; + } + + static template_parameter make_template_template_type(std::string name, + const std::optional &default_value = {}, + bool is_variadic = false) + { + template_parameter p; + p.set_kind(template_parameter_kind_t::template_template_type); + p.set_name(name + "<>"); + if (default_value) + p.set_default_value(default_value.value()); + p.is_variadic(is_variadic); + return p; + } + + static template_parameter make_non_type_template(std::string type, + const std::optional &name, + const std::optional &default_value = {}, + bool is_variadic = false) + { + template_parameter p; + p.set_kind(template_parameter_kind_t::non_type_template); + p.set_type(std::move(type)); + if (name) + p.set_name(name.value()); + if (default_value) + p.set_default_value(default_value.value()); + p.is_variadic(is_variadic); + return p; + } + + static template_parameter make_argument( + std::string type, const std::optional &default_value = {}) + { + template_parameter p; + p.set_kind(template_parameter_kind_t::argument); + p.set_type(std::move(type)); + if (default_value) + p.set_default_value(default_value.value()); + return p; + } + + static template_parameter make_unexposed_argument( + std::string type, const std::optional &default_value = {}) + { + template_parameter p = make_argument(std::move(type), default_value); + p.set_unexposed(true); + return p; + } + + // template_parameter(const std::optional &type = {}, + // const std::optional &name = {}, + // const std::optional &default_value = {}, + // bool is_variadic = false); + + // template_parameter(const template_parameter &right) = default; void set_type(const std::string &type); - std::string type() const; + std::optional type() const; void set_id(const int64_t id) { id_ = id; } - std::optional id() const { return id_; } + const std::optional &id() const { return id_; } void set_name(const std::string &name); - std::string name() const; + std::optional name() const; void set_default_value(const std::string &value); - std::string default_value() const; + const std::optional &default_value() const; void is_variadic(bool is_variadic) noexcept; bool is_variadic() const noexcept; @@ -101,18 +176,29 @@ public: const; void set_concept_constraint(std::string constraint); + const std::optional &concept_constraint() const; + template_parameter_kind_t kind() const { return kind_; } + + void set_kind(template_parameter_kind_t kind) { kind_ = kind; } + + bool is_unexposed() const { return is_unexposed_; } + + void set_unexposed(bool unexposed) { is_unexposed_ = unexposed; } + private: + template_parameter_kind_t kind_; + /// Represents the type of non-type template parameters - /// e.g. 'int' - std::string type_; + /// e.g. 'int' or type of template arguments + std::optional type_; /// The name of the parameter (e.g. 'T' or 'N') - std::string name_; + std::optional name_; /// Default value of the template parameter - std::string default_value_; + std::optional default_value_; /// Whether the template parameter is a regular template parameter /// When false, it is a non-type template parameter @@ -136,5 +222,7 @@ private: std::vector template_params_; std::optional id_; + + bool is_unexposed_{false}; }; } // namespace clanguml::common::model diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 758afcfc..6630c391 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -1353,12 +1353,14 @@ bool translation_unit_visitor::process_template_parameters( nullptr) { const auto *template_type_parameter = clang::dyn_cast_or_null(parameter); - template_parameter ct; - ct.set_type(""); - ct.is_template_parameter(true); - ct.set_name(template_type_parameter->getNameAsString()); - ct.set_default_value(""); - ct.is_variadic(template_type_parameter->isParameterPack()); + std::optional default_arg; + if (template_type_parameter->hasDefaultArgument()) { + default_arg = + template_type_parameter->getDefaultArgument().getAsString(); + } + auto ct = template_parameter::make_template_type( + template_type_parameter->getNameAsString(), default_arg, + template_type_parameter->isParameterPack()); c.add_template(std::move(ct)); } @@ -1367,12 +1369,13 @@ bool translation_unit_visitor::process_template_parameters( const auto *template_nontype_parameter = clang::dyn_cast_or_null( parameter); - template_parameter ct; - ct.set_type(template_nontype_parameter->getType().getAsString()); - ct.set_name(template_nontype_parameter->getNameAsString()); - ct.is_template_parameter(false); - ct.set_default_value(""); - ct.is_variadic(template_nontype_parameter->isParameterPack()); + std::optional default_arg; + if (template_nontype_parameter->hasDefaultArgument()) + default_arg = common::to_string( + template_nontype_parameter->getDefaultArgument()); + auto ct = template_parameter::make_non_type_template( + template_nontype_parameter->getType().getAsString(), + template_nontype_parameter->getNameAsString(), default_arg); c.add_template(std::move(ct)); } @@ -1381,12 +1384,15 @@ bool translation_unit_visitor::process_template_parameters( const auto *template_template_parameter = clang::dyn_cast_or_null( parameter); - template_parameter ct; - ct.set_type(""); - ct.set_name(template_template_parameter->getNameAsString() + "<>"); - ct.is_template_parameter(true); - ct.set_default_value(""); - ct.is_variadic(template_template_parameter->isParameterPack()); + std::optional default_arg; + if (template_template_parameter->hasDefaultArgument()) + default_arg = common::to_string( + template_template_parameter->getDefaultArgument() + .getArgument() + .getAsExpr()); + auto ct = template_parameter::make_template_template_type( + template_template_parameter->getNameAsString(), default_arg, + template_template_parameter->isParameterPack()); c.add_template(std::move(ct)); } @@ -1513,66 +1519,61 @@ void translation_unit_visitor:: { for (const auto &arg : template_args) { const auto argument_kind = arg.getKind(); - common::model::template_parameter argument; + std::optional argument; if (argument_kind == clang::TemplateArgument::Template) { - build_template_instantiation_process_template_argument( - arg, argument); + argument = + build_template_instantiation_process_template_argument(arg); } else if (argument_kind == clang::TemplateArgument::Type) { - build_template_instantiation_process_type_argument(parent, - full_template_specialization_name, template_decl, arg, - template_instantiation, argument); + argument = build_template_instantiation_process_type_argument( + parent, full_template_specialization_name, template_decl, arg, + template_instantiation); } else if (argument_kind == clang::TemplateArgument::Integral) { - build_template_instantiation_process_integral_argument( - arg, argument); + argument = + build_template_instantiation_process_integral_argument(arg); } else if (argument_kind == clang::TemplateArgument::Expression) { - build_template_instantiation_process_expression_argument( - arg, argument); + argument = + build_template_instantiation_process_expression_argument(arg); } else { LOG_INFO("Unsupported argument type {}", arg.getKind()); + continue; } - simplify_system_template( - argument, argument.to_string(config().using_namespace(), false)); + simplify_system_template(argument.value(), + argument.value().to_string(config().using_namespace(), false)); - template_instantiation.add_template(std::move(argument)); + template_instantiation.add_template(std::move(argument.value())); } } -void translation_unit_visitor:: +template_parameter translation_unit_visitor:: build_template_instantiation_process_template_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const + const clang::TemplateArgument &arg) const { - argument.is_template_parameter(true); auto arg_name = arg.getAsTemplate().getAsTemplateDecl()->getQualifiedNameAsString(); - argument.set_type(arg_name); + return template_parameter::make_template_type(arg_name); } -void translation_unit_visitor:: +template_parameter translation_unit_visitor:: build_template_instantiation_process_integral_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const + const clang::TemplateArgument &arg) const { assert(arg.getKind() == clang::TemplateArgument::Integral); - argument.is_template_parameter(false); - argument.set_type(std::to_string(arg.getAsIntegral().getExtValue())); + return template_parameter::make_argument( + std::to_string(arg.getAsIntegral().getExtValue())); } -void translation_unit_visitor:: +template_parameter translation_unit_visitor:: build_template_instantiation_process_expression_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const + const clang::TemplateArgument &arg) const { assert(arg.getKind() == clang::TemplateArgument::Expression); - - argument.is_template_parameter(false); - argument.set_type(common::get_source_text( + return template_parameter::make_argument(common::get_source_text( arg.getAsExpr()->getSourceRange(), source_manager())); } @@ -1592,17 +1593,18 @@ void translation_unit_visitor:: common::to_string(arg.getAsType(), template_decl->getASTContext())); } -void translation_unit_visitor:: - build_template_instantiation_process_type_argument( - model::template_trait * /*parent*/, - const std::string &full_template_specialization_name, - const clang::TemplateDecl *template_decl, - const clang::TemplateArgument &arg, - model::template_trait &template_instantiation, - common::model::template_parameter &argument) +common::model::template_parameter +translation_unit_visitor::build_template_instantiation_process_type_argument( + model::template_trait * /*parent*/, + const std::string &full_template_specialization_name, + const clang::TemplateDecl *template_decl, + const clang::TemplateArgument &arg, + model::template_trait &template_instantiation) { assert(arg.getKind() == clang::TemplateArgument::Type); + auto argument = template_parameter::make_argument({}); + argument.is_template_parameter(false); // If this is a nested template type - add nested templates as @@ -1619,7 +1621,7 @@ void translation_unit_visitor:: .getAsTemplateDecl() ->getQualifiedNameAsString(); - argument.set_name(nested_template_name); + argument.set_type(nested_template_name); // Check if this template should be simplified (e.g. system // template aliases such as 'std:basic_string' should @@ -1629,7 +1631,7 @@ void translation_unit_visitor:: } else if (arg.getAsType()->getAs() != nullptr) { argument.is_template_parameter(true); - argument.set_name( + argument.set_type( common::to_string(arg.getAsType(), template_decl->getASTContext())); } else { @@ -1638,6 +1640,8 @@ void translation_unit_visitor:: template_instantiation, full_template_specialization_name, template_decl, arg, argument); } + + return argument; } std::unique_ptr @@ -1688,7 +1692,7 @@ void translation_unit_visitor::process_template_specialization_argument( const auto argument_kind = arg.getKind(); if (argument_kind == clang::TemplateArgument::Type) { - common::model::template_parameter argument; + auto argument = template_parameter::make_argument({}); argument.is_template_parameter(false); // If this is a nested template type - add nested templates as @@ -1817,23 +1821,18 @@ void translation_unit_visitor::process_template_specialization_argument( template_instantiation.add_template(std::move(argument)); } else if (argument_kind == clang::TemplateArgument::Integral) { - common::model::template_parameter argument; - argument.is_template_parameter(false); - argument.set_type(std::to_string(arg.getAsIntegral().getExtValue())); + auto argument = template_parameter::make_argument( + std::to_string(arg.getAsIntegral().getExtValue())); template_instantiation.add_template(std::move(argument)); } else if (argument_kind == clang::TemplateArgument::Expression) { - common::model::template_parameter argument; - argument.is_template_parameter(false); - argument.set_type(common::get_source_text( - arg.getAsExpr()->getSourceRange(), source_manager())); + auto argument = + template_parameter::make_argument(common::get_source_text( + arg.getAsExpr()->getSourceRange(), source_manager())); template_instantiation.add_template(std::move(argument)); } else if (argument_kind == clang::TemplateArgument::TemplateExpansion) { - common::model::template_parameter argument; - argument.is_template_parameter(true); - - cls->getLocation().dump(source_manager()); + // TODO } else if (argument_kind == clang::TemplateArgument::Pack) { // This will only work for now if pack is at the end diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 9429c5eb..1ba9d80c 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -202,17 +202,17 @@ private: const std::string &full_template_specialization_name, const clang::TemplateDecl *template_decl); - void build_template_instantiation_process_template_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const; + common::model::template_parameter + build_template_instantiation_process_template_argument( + const clang::TemplateArgument &arg) const; - void build_template_instantiation_process_integral_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const; + common::model::template_parameter + build_template_instantiation_process_integral_argument( + const clang::TemplateArgument &arg) const; - void build_template_instantiation_process_expression_argument( - const clang::TemplateArgument &arg, - common::model::template_parameter &argument) const; + common::model::template_parameter + build_template_instantiation_process_expression_argument( + const clang::TemplateArgument &arg) const; void build_template_instantiation_process_tag_argument( model::template_trait &template_instantiation, @@ -221,13 +221,12 @@ private: const clang::TemplateArgument &arg, common::model::template_parameter &argument) const; - void build_template_instantiation_process_type_argument( + common::model::template_parameter build_template_instantiation_process_type_argument( model::template_trait *parent, const std::string &full_template_specialization_name, const clang::TemplateDecl *template_decl, const clang::TemplateArgument &arg, - model::template_trait &template_instantiation, - common::model::template_parameter &argument); + model::template_trait &template_instantiation); std::unique_ptr process_template_specialization( clang::ClassTemplateSpecializationDecl *cls); diff --git a/tests/t00008/test_case.h b/tests/t00008/test_case.h index 446541d0..aad94ba6 100644 --- a/tests/t00008/test_case.h +++ b/tests/t00008/test_case.h @@ -36,7 +36,7 @@ TEST_CASE("t00008", "[test-case][class]") // TODO: add option to resolve using declared types // REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int), int // N")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,P,CMP,int N")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3")); REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>")); REQUIRE_THAT(puml, (IsField("value", "T"))); diff --git a/tests/test_util.cc b/tests/test_util.cc index 28905eaa..2a1b26de 100644 --- a/tests/test_util.cc +++ b/tests/test_util.cc @@ -105,8 +105,8 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") CHECK(int_template.size() == 1); CHECK(int_template[0].template_params().size() == 1); - CHECK(int_template[0].type() == "ns1::ns2::class1"); - CHECK(int_template[0].template_params()[0].type() == "int"); + CHECK(int_template[0].type().value() == "ns1::ns2::class1"); + CHECK(int_template[0].template_params()[0].type().value() == "int"); const std::string int_int_template_str{"ns1::ns2::class1"}; @@ -115,9 +115,9 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") CHECK(int_int_template.size() == 1); CHECK(int_int_template[0].template_params().size() == 2); - CHECK(int_int_template[0].type() == "ns1::ns2::class1"); - CHECK(int_int_template[0].template_params()[0].type() == "int"); - CHECK(int_int_template[0].template_params()[1].type() == "int"); + CHECK(int_int_template[0].type().value() == "ns1::ns2::class1"); + CHECK(int_int_template[0].template_params()[0].type().value() == "int"); + CHECK(int_int_template[0].template_params()[1].type().value() == "int"); const std::string nested_template_str{ "class1>>"}; @@ -127,13 +127,13 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") CHECK(nested_template.size() == 1); CHECK(nested_template[0].template_params().size() == 2); - CHECK(nested_template[0].type() == "class1"); - CHECK(nested_template[0].template_params()[0].type() == "int"); + CHECK(nested_template[0].type().value() == "class1"); + CHECK(nested_template[0].template_params()[0].type().value() == "int"); const auto &class2 = nested_template[0].template_params()[1]; CHECK(class2.type() == "ns1::class2"); - CHECK(class2.template_params()[0].type() == "int"); - CHECK(class2.template_params()[1].type() == "std::vector"); - CHECK(class2.template_params()[1].template_params()[0].type() == + CHECK(class2.template_params()[0].type().value() == "int"); + CHECK(class2.template_params()[1].type().value() == "std::vector"); + CHECK(class2.template_params()[1].template_params()[0].type().value() == "std::string"); const std::string empty_string = R"( @@ -153,7 +153,7 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") single_template_string, [](const auto &n) { return n; }); CHECK(single_template.size() == 1); - CHECK(single_template[0].type() == "Else"); + CHECK(single_template[0].type().value() == "Else"); const std::string declaration_string = R"( @@ -165,9 +165,9 @@ TEST_CASE("Test parse_unexposed_template_params", "[unit-test]") declaration_string, [](const auto &n) { return n; }); CHECK(declaration_template.size() == 3); - CHECK(declaration_template[0].type() == "std::true_type"); - CHECK(declaration_template[1].type() == "Result"); - CHECK(declaration_template[2].type() == "Tail"); + CHECK(declaration_template[0].type().value() == "std::true_type"); + CHECK(declaration_template[1].type().value() == "Result"); + CHECK(declaration_template[2].type().value() == "Tail"); } TEST_CASE("Test remove_prefix", "[unit-test]") From e0447f28c1406a2c9415a20ce48843a667312373 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 16 Mar 2023 21:44:51 +0100 Subject: [PATCH 08/30] Fixed class template parameter generation in class visitor --- .../json/class_diagram_generator.cc | 22 ++++----- .../visitor/translation_unit_visitor.cc | 45 ++++++++++++------- .../visitor/translation_unit_visitor.cc | 14 +++--- .../visitor/translation_unit_visitor.h | 3 +- tests/t00002/test_case.h | 2 +- tests/t00014/test_case.h | 2 +- tests/t00036/test_case.h | 2 +- tests/t00051/test_case.h | 4 +- tests/t00056/test_case.h | 2 +- 9 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index 39a8ebaa..bcccc383 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -46,20 +46,20 @@ void to_json(nlohmann::json &j, const template_parameter &c) { j["kind"] = to_string(c.kind()); - if(c.kind() == template_parameter_kind_t::template_type) { + if (c.kind() == template_parameter_kind_t::template_type) { j["name"] = c.name().value(); } - -// j["type"] = c.type(); -// j["name"] = c.name(); -// if (!c.default_value().empty()) -// j["default_value"] = c.default_value(); -// j["is_template_parameter"] = c.is_template_parameter(); -// j["is_template_template_parameter"] = c.is_template_template_parameter(); -// if (const auto &constraint = c.concept_constraint(); constraint) -// j["concept_constraint"] = constraint.value(); -// j["is_variadic"] = c.is_variadic(); + // j["type"] = c.type(); + // j["name"] = c.name(); + // if (!c.default_value().empty()) + // j["default_value"] = c.default_value(); + // j["is_template_parameter"] = c.is_template_parameter(); + // j["is_template_template_parameter"] = + // c.is_template_template_parameter(); if (const auto &constraint = + // c.concept_constraint(); constraint) + // j["concept_constraint"] = constraint.value(); + // j["is_variadic"] = c.is_variadic(); } void to_json(nlohmann::json &j, const relationship &c) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index c3f66a00..9c286c6c 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -1806,38 +1806,41 @@ void translation_unit_visitor::process_template_specialization_argument( const auto argument_kind = arg.getKind(); if (argument_kind == clang::TemplateArgument::Type) { - auto argument = template_parameter::make_argument({}); + std::optional argument; // If this is a nested template type - add nested templates as // template arguments if (const auto *nested_template_type = arg.getAsType()->getAs(); nested_template_type != nullptr) { + argument = template_parameter::make_argument({}); const auto nested_template_name = nested_template_type->getTemplateName() .getAsTemplateDecl() ->getQualifiedNameAsString(); - argument.set_type(nested_template_name); + argument->set_type(nested_template_name); auto nested_template_instantiation = build_template_instantiation( *nested_template_type, {&template_instantiation}); - argument.set_id(nested_template_instantiation->id()); + argument->set_id(nested_template_instantiation->id()); for (const auto &t : nested_template_instantiation->templates()) - argument.add_template_param(t); + argument->add_template_param(t); } else if (arg.getAsType()->getAs() != nullptr) { - auto type_name = + argument = template_parameter::make_template_type({}); + + auto parameter_name = common::to_string(arg.getAsType(), cls->getASTContext()); // clang does not provide declared template parameter/argument // names in template specializations - so we have to extract // them from raw source code... - if (type_name.find("type-parameter-") == 0) { + if (parameter_name.find("type-parameter-") == 0) { auto declaration_text = common::get_source_text_raw( cls->getSourceRange(), source_manager()); @@ -1849,22 +1852,24 @@ void translation_unit_visitor::process_template_specialization_argument( declaration_text, [](const auto &t) { return t; }); if (template_params.size() > argument_index) - type_name = template_params[argument_index].to_string( + parameter_name = template_params[argument_index].to_string( config().using_namespace(), false); else { LOG_DBG("Failed to find type specialization for argument " "{} at index {} in declaration \n===\n{}\n===\n", - type_name, argument_index, declaration_text); + parameter_name, argument_index, declaration_text); } } - argument.set_type(type_name); + argument->set_name(parameter_name); } else { auto type_name = common::to_string(arg.getAsType(), cls->getASTContext()); ensure_lambda_type_is_relative(type_name); if (type_name.find('<') != std::string::npos) { + argument = template_parameter::make_argument({}); + // Sometimes template instantiation is reported as // RecordType in the AST and getAs to // TemplateSpecializationType returns null pointer so we @@ -1874,15 +1879,17 @@ void translation_unit_visitor::process_template_specialization_argument( process_unexposed_template_specialization_parameters( type_name.substr(type_name.find('<') + 1, type_name.size() - (type_name.find('<') + 2)), - argument, template_instantiation); + *argument, template_instantiation); auto unexposed_type_name = type_name.substr(0, type_name.find('<')); ensure_lambda_type_is_relative(unexposed_type_name); - argument.set_type(unexposed_type_name); + argument->set_type(unexposed_type_name); } else if (type_name.find("type-parameter-") == 0) { + argument = template_parameter::make_template_type({}); + auto declaration_text = common::get_source_text_raw( cls->getSourceRange(), source_manager()); @@ -1904,20 +1911,24 @@ void translation_unit_visitor::process_template_specialization_argument( // Otherwise just set the name for the template argument to // whatever clang says - argument.set_type(type_name); + argument->set_name(type_name); } else { - argument.set_type(type_name); + argument = template_parameter::make_argument({}); + argument->set_type(type_name); } } + if (!argument) + return; + LOG_DBG("Adding template instantiation argument {}", - argument.to_string(config().using_namespace(), false)); + argument.value().to_string(config().using_namespace(), false)); - simplify_system_template( - argument, argument.to_string(config().using_namespace(), false)); + simplify_system_template(*argument, + argument.value().to_string(config().using_namespace(), false)); - template_instantiation.add_template(std::move(argument)); + template_instantiation.add_template(std::move(argument.value())); } else if (argument_kind == clang::TemplateArgument::Integral) { auto argument = template_parameter::make_argument( diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 6630c391..27a7fb8f 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -1589,7 +1589,7 @@ void translation_unit_visitor:: argument.is_template_parameter(false); - argument.set_name( + argument.set_type( common::to_string(arg.getAsType(), template_decl->getASTContext())); } @@ -1751,20 +1751,20 @@ void translation_unit_visitor::process_template_specialization_argument( } } - argument.set_name(type_name); + argument.set_type(type_name); } else if ((arg.getAsType()->getAsCXXRecordDecl() != nullptr) && arg.getAsType()->getAsCXXRecordDecl()->isLambda()) { const auto maybe_id = get_unique_id(arg.getAsType()->getAsCXXRecordDecl()->getID()); if (maybe_id.has_value()) { - argument.set_name( + argument.set_type( get_participant(maybe_id.value()).value().full_name(false)); } else { const auto type_name = make_lambda_name(arg.getAsType()->getAsCXXRecordDecl()); - argument.set_name(type_name); + argument.set_type(type_name); } } else { @@ -1782,7 +1782,7 @@ void translation_unit_visitor::process_template_specialization_argument( type_name.size() - (type_name.find('<') + 2)), argument, template_instantiation); - argument.set_name(type_name.substr(0, type_name.find('<'))); + argument.set_type(type_name.substr(0, type_name.find('<'))); } else if (type_name.find("type-parameter-") == 0) { auto declaration_text = common::get_source_text_raw( @@ -1809,7 +1809,7 @@ void translation_unit_visitor::process_template_specialization_argument( argument.set_name(type_name); } else - argument.set_name(type_name); + argument.set_type(type_name); } LOG_TRACE("Adding template instantiation argument {}", @@ -2052,7 +2052,7 @@ bool translation_unit_visitor::simplify_system_template( common::model::template_parameter &ct, const std::string &full_name) const { if (config().type_aliases().count(full_name) > 0) { - ct.set_name(config().type_aliases().at(full_name)); + ct.set_type(config().type_aliases().at(full_name)); ct.clear_params(); return true; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.h b/src/sequence_diagram/visitor/translation_unit_visitor.h index 1ba9d80c..a9e1bb58 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.h +++ b/src/sequence_diagram/visitor/translation_unit_visitor.h @@ -221,7 +221,8 @@ private: const clang::TemplateArgument &arg, common::model::template_parameter &argument) const; - common::model::template_parameter build_template_instantiation_process_type_argument( + common::model::template_parameter + build_template_instantiation_process_type_argument( model::template_trait *parent, const std::string &full_template_specialization_name, const clang::TemplateDecl *template_decl, diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h index 2441faab..c11ace9b 100644 --- a/tests/t00002/test_case.h +++ b/tests/t00002/test_case.h @@ -512,7 +512,7 @@ TEST_CASE("t00002", "[test-case][class]") )##"; auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + // REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index f0e16d21..d14b9221 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -1073,7 +1073,7 @@ TEST_CASE("t00014", "[test-case][class]") )##"; auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + // REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00036/test_case.h b/tests/t00036/test_case.h index 0a87bfa5..f526f6fb 100644 --- a/tests/t00036/test_case.h +++ b/tests/t00036/test_case.h @@ -236,7 +236,7 @@ TEST_CASE("t00036", "[test-case][class]") auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + // REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00051/test_case.h b/tests/t00051/test_case.h index 2e573b29..8bffaba7 100644 --- a/tests/t00051/test_case.h +++ b/tests/t00051/test_case.h @@ -53,7 +53,7 @@ TEST_CASE("t00051", "[test-case][class]") (IsMethod( "get_function", "(lambda at ../../tests/t00051/t00051.cc:48:16)"))); - REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF")); + REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F")); REQUIRE_THAT(puml, (IsMethod("f", "void"))); REQUIRE_THAT(puml, (IsMethod("ff", "void"))); @@ -63,7 +63,7 @@ TEST_CASE("t00051", "[test-case][class]") "../../tests/t00051/t00051.cc:43:27)")); REQUIRE_THAT(puml, - IsInstantiation(_A("B"), + IsInstantiation(_A("B"), _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " "../../tests/t00051/t00051.cc:43:27)>"))); diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index cdae7c0d..c30f9ccf 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -666,7 +666,7 @@ TEST_CASE("t00056", "[test-case][class]") )##"; auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + // REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file From f13ce5684093a53f28f8fc5736ba7c49f0be4a44 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 16 Mar 2023 23:45:05 +0100 Subject: [PATCH 09/30] Fixed class template parameter generation in sequence visitor --- .../json/class_diagram_generator.cc | 20 ++++++------------- src/common/model/template_parameter.cc | 10 ---------- src/common/model/template_parameter.h | 17 ++-------------- .../visitor/translation_unit_visitor.cc | 19 ++++++++---------- 4 files changed, 16 insertions(+), 50 deletions(-) diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index bcccc383..451ec035 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -45,21 +45,13 @@ void to_json(nlohmann::json &j, const element &c) void to_json(nlohmann::json &j, const template_parameter &c) { j["kind"] = to_string(c.kind()); - - if (c.kind() == template_parameter_kind_t::template_type) { + if (c.type()) + j["type"] = c.type().value(); + if (c.name()) j["name"] = c.name().value(); - } - - // j["type"] = c.type(); - // j["name"] = c.name(); - // if (!c.default_value().empty()) - // j["default_value"] = c.default_value(); - // j["is_template_parameter"] = c.is_template_parameter(); - // j["is_template_template_parameter"] = - // c.is_template_template_parameter(); if (const auto &constraint = - // c.concept_constraint(); constraint) - // j["concept_constraint"] = constraint.value(); - // j["is_variadic"] = c.is_variadic(); + if (c.default_value()) + j["default"] = c.default_value().value(); + j["is_variadic"] = c.is_variadic(); } void to_json(nlohmann::json &j, const relationship &c) diff --git a/src/common/model/template_parameter.cc b/src/common/model/template_parameter.cc index f7c4aca5..662f6286 100644 --- a/src/common/model/template_parameter.cc +++ b/src/common/model/template_parameter.cc @@ -40,16 +40,6 @@ std::string to_string(template_parameter_kind_t k) assert(0); } } -// template_parameter::template_parameter(const std::optional -// &type, -// const std::optional &name, -// const std::optional &default_value, bool is_variadic) -// : type_{type} -// , name_{name} -// , default_value_{std::move(default_value)} -// , is_variadic_{is_variadic} -//{ -// } void template_parameter::set_type(const std::string &type) { diff --git a/src/common/model/template_parameter.h b/src/common/model/template_parameter.h index 7ebba8de..4a8453c2 100644 --- a/src/common/model/template_parameter.h +++ b/src/common/model/template_parameter.h @@ -43,8 +43,6 @@ std::string to_string(template_parameter_kind_t k); /// including variadic parameters and instantiations with /// nested templates class template_parameter { - template_parameter() = default; - public: static template_parameter make_template_type(std::string name, const std::optional &default_value = {}, @@ -107,13 +105,6 @@ public: return p; } - // template_parameter(const std::optional &type = {}, - // const std::optional &name = {}, - // const std::optional &default_value = {}, - // bool is_variadic = false); - - // template_parameter(const template_parameter &right) = default; - void set_type(const std::string &type); std::optional type() const; @@ -129,9 +120,6 @@ public: void is_variadic(bool is_variadic) noexcept; bool is_variadic() const noexcept; - void is_pack(bool is_pack) noexcept; - bool is_pack() const noexcept; - bool is_specialization_of(const template_parameter &ct) const; friend bool operator==( @@ -188,6 +176,8 @@ public: void set_unexposed(bool unexposed) { is_unexposed_ = unexposed; } private: + template_parameter() = default; + template_parameter_kind_t kind_; /// Represents the type of non-type template parameters @@ -211,9 +201,6 @@ private: /// Whether the template parameter is variadic bool is_variadic_{false}; - /// Whether the argument specializes argument pack from parent template - bool is_pack_{false}; - /// Stores optional fully qualified name of constraint for this template /// parameter std::optional concept_constraint_; diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 27a7fb8f..b93c1e73 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -1588,7 +1588,6 @@ void translation_unit_visitor:: assert(arg.getKind() == clang::TemplateArgument::Type); argument.is_template_parameter(false); - argument.set_type( common::to_string(arg.getAsType(), template_decl->getASTContext())); } @@ -1603,9 +1602,7 @@ translation_unit_visitor::build_template_instantiation_process_type_argument( { assert(arg.getKind() == clang::TemplateArgument::Type); - auto argument = template_parameter::make_argument({}); - - argument.is_template_parameter(false); + std::optional argument; // If this is a nested template type - add nested templates as // template arguments @@ -1621,27 +1618,27 @@ translation_unit_visitor::build_template_instantiation_process_type_argument( .getAsTemplateDecl() ->getQualifiedNameAsString(); - argument.set_type(nested_template_name); + argument = template_parameter::make_argument(nested_template_name); // Check if this template should be simplified (e.g. system // template aliases such as 'std:basic_string' should // be simply 'std::string') - simplify_system_template( - argument, argument.to_string(config().using_namespace(), false)); + simplify_system_template(*argument, + argument.value().to_string(config().using_namespace(), false)); } else if (arg.getAsType()->getAs() != nullptr) { - argument.is_template_parameter(true); - argument.set_type( + argument = template_parameter::make_template_type( common::to_string(arg.getAsType(), template_decl->getASTContext())); } else { + argument = template_parameter::make_argument({}); // This is just a regular record type build_template_instantiation_process_tag_argument( template_instantiation, full_template_specialization_name, - template_decl, arg, argument); + template_decl, arg, *argument); } - return argument; + return *argument; } std::unique_ptr From 4e404a362e540d69f96ed518544199529d5537d5 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 17 Mar 2023 00:39:52 +0100 Subject: [PATCH 10/30] Changed JSON generator paths to relative --- Makefile | 2 +- .../json/class_diagram_generator.cc | 5 +- src/common/model/source_location.h | 5 + .../visitor/translation_unit_visitor.cc | 4 + src/common/visitor/translation_unit_visitor.h | 2 + tests/t00002/test_case.h | 16 +- tests/t00014/test_case.h | 236 +++++++----------- tests/t00036/test_case.h | 26 +- tests/t00056/test_case.h | 136 ++++------ 9 files changed, 172 insertions(+), 260 deletions(-) diff --git a/Makefile b/Makefile index 6fa445bc..b01ed963 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ document_test_cases: test_plantuml clanguml_diagrams: debug mkdir -p docs/diagrams - debug/src/clang-uml + debug/src/clang-uml -g plantuml -g json plantuml -tsvg -nometadata docs/diagrams/*.puml python3 util/format_svg.py docs/diagrams/*.svg diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index 451ec035..a4b889fe 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -25,7 +25,7 @@ using nlohmann::json; void to_json(nlohmann::json &j, const source_location &sl) { - j = json{{"file", sl.file()}, {"line", sl.line()}}; + j = json{{"file", sl.file_relative()}, {"line", sl.line()}}; } void to_json(nlohmann::json &j, const element &c) @@ -37,9 +37,10 @@ void to_json(nlohmann::json &j, const element &c) if (const auto &comment = c.comment(); comment) j["comment"] = comment.value(); - if (!c.file().empty()) + if (!c.file().empty()) { j["source_location"] = dynamic_cast(c); + } } void to_json(nlohmann::json &j, const template_parameter &c) diff --git a/src/common/model/source_location.h b/src/common/model/source_location.h index ee96c4f3..3b2e89f5 100644 --- a/src/common/model/source_location.h +++ b/src/common/model/source_location.h @@ -36,6 +36,10 @@ public: void set_file(const std::string &file) { file_ = file; } + const std::string &file_relative() const { return file_relative_; } + + void set_file_relative(const std::string &file) { file_relative_ = file; } + unsigned int line() const { return line_; } void set_line(const unsigned line) { line_ = line; } @@ -46,6 +50,7 @@ public: private: std::string file_; + std::string file_relative_; unsigned int line_{0}; unsigned int hash_{0}; }; diff --git a/src/common/visitor/translation_unit_visitor.cc b/src/common/visitor/translation_unit_visitor.cc index bfbb178b..d786db7e 100644 --- a/src/common/visitor/translation_unit_visitor.cc +++ b/src/common/visitor/translation_unit_visitor.cc @@ -26,6 +26,7 @@ namespace clanguml::common::visitor { translation_unit_visitor::translation_unit_visitor( clang::SourceManager &sm, const clanguml::config::diagram &config) : source_manager_{sm} + , relative_to_path_{config.relative_to()} { if (config.comment_parser() == config::comment_parser_t::plain) { comment_visitor_ = @@ -86,6 +87,9 @@ void translation_unit_visitor::set_source_location( { if (location.isValid()) { element.set_file(source_manager_.getFilename(location).str()); + element.set_file_relative(util::path_to_url( + std::filesystem::relative(element.file(), relative_to_path_) + .string())); element.set_line(source_manager_.getSpellingLineNumber(location)); element.set_location_id(location.getHashValue()); } diff --git a/src/common/visitor/translation_unit_visitor.h b/src/common/visitor/translation_unit_visitor.h index 8faa8b8a..5b0d920f 100644 --- a/src/common/visitor/translation_unit_visitor.h +++ b/src/common/visitor/translation_unit_visitor.h @@ -106,5 +106,7 @@ private: clang::SourceManager &source_manager_; std::unique_ptr comment_visitor_; + + std::filesystem::path relative_to_path_; }; } // namespace clanguml::common::visitor diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h index c11ace9b..95e9e94b 100644 --- a/tests/t00002/test_case.h +++ b/tests/t00002/test_case.h @@ -144,7 +144,7 @@ TEST_CASE("t00002", "[test-case][class]") "name": "A", "namespace": "clanguml::t00002", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "file": "../../tests/t00002/t00002.cc", "line": 7 }, "template_parameters": [], @@ -195,7 +195,7 @@ TEST_CASE("t00002", "[test-case][class]") "name": "B", "namespace": "clanguml::t00002", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "file": "../../tests/t00002/t00002.cc", "line": 16 }, "template_parameters": [], @@ -255,7 +255,7 @@ TEST_CASE("t00002", "[test-case][class]") "name": "C", "namespace": "clanguml::t00002", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "file": "../../tests/t00002/t00002.cc", "line": 27 }, "template_parameters": [], @@ -305,7 +305,7 @@ TEST_CASE("t00002", "[test-case][class]") "is_static": false, "name": "as", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "file": "../../tests/t00002/t00002.cc", "line": 58 }, "type": "std::vector" @@ -356,7 +356,7 @@ TEST_CASE("t00002", "[test-case][class]") "name": "D", "namespace": "clanguml::t00002", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "file": "../../tests/t00002/t00002.cc", "line": 36 }, "template_parameters": [], @@ -398,7 +398,7 @@ TEST_CASE("t00002", "[test-case][class]") "is_static": false, "name": "as", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "file": "../../tests/t00002/t00002.cc", "line": 83 }, "type": "std::vector" @@ -449,7 +449,7 @@ TEST_CASE("t00002", "[test-case][class]") "name": "E", "namespace": "clanguml::t00002", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00002/t00002.cc", + "file": "../../tests/t00002/t00002.cc", "line": 61 }, "template_parameters": [], @@ -512,7 +512,7 @@ TEST_CASE("t00002", "[test-case][class]") )##"; auto j = generate_class_json(diagram, *model); - // REQUIRE(j == nlohmann::json::parse(expected_json)); + REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index d14b9221..17b6f38d 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -134,7 +134,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "t", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 22 }, "type": "T" @@ -144,7 +144,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "p", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 23 }, "type": "P" @@ -154,23 +154,19 @@ TEST_CASE("t00014", "[test-case][class]") "name": "A", "namespace": "clanguml::t00014", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 21 }, "template_parameters": [ { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "template_type", + "name": "T" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "P", - "type": "" + "kind": "template_type", + "name": "P" } ], "type": "class" @@ -190,7 +186,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "value", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 27 }, "type": "std::string" @@ -200,7 +196,7 @@ TEST_CASE("t00014", "[test-case][class]") "name": "B", "namespace": "clanguml::t00014", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 26 }, "template_parameters": [], @@ -221,18 +217,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "argument", + "type": "T" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::string", - "type": "" + "kind": "argument", + "type": "std::string" } ], "type": "class" @@ -252,18 +244,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "argument", + "type": "T" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::unique_ptr", - "type": "" + "kind": "argument", + "type": "std::unique_ptr" } ], "type": "class" @@ -283,18 +271,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "long", - "type": "" + "kind": "argument", + "type": "long" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "argument", + "type": "T" } ], "type": "class" @@ -314,18 +298,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "double", - "type": "" + "kind": "argument", + "type": "double" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "argument", + "type": "T" } ], "type": "class" @@ -345,18 +325,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "long", - "type": "" + "kind": "argument", + "type": "long" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "U", - "type": "" + "kind": "argument", + "type": "U" } ], "type": "class" @@ -376,18 +352,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "long", - "type": "" + "kind": "argument", + "type": "long" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "bool", - "type": "" + "kind": "argument", + "type": "bool" } ], "type": "class" @@ -407,18 +379,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "double", - "type": "" + "kind": "argument", + "type": "double" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "bool", - "type": "" + "kind": "argument", + "type": "bool" } ], "type": "class" @@ -438,18 +406,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "long", - "type": "" + "kind": "argument", + "type": "long" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "float", - "type": "" + "kind": "argument", + "type": "float" } ], "type": "class" @@ -469,18 +433,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "double", - "type": "" + "kind": "argument", + "type": "double" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "float", - "type": "" + "kind": "argument", + "type": "float" } ], "type": "class" @@ -500,18 +460,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "bool", - "type": "" + "kind": "argument", + "type": "bool" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::string", - "type": "" + "kind": "argument", + "type": "std::string" } ], "type": "class" @@ -531,18 +487,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "float", - "type": "" + "kind": "argument", + "type": "float" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::unique_ptr", - "type": "" + "kind": "argument", + "type": "std::unique_ptr" } ], "type": "class" @@ -562,18 +514,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "int", - "type": "" + "kind": "argument", + "type": "int" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::string", - "type": "" + "kind": "argument", + "type": "std::string" } ], "type": "class" @@ -593,18 +541,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::string", - "type": "" + "kind": "argument", + "type": "std::string" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::string", - "type": "" + "kind": "argument", + "type": "std::string" } ], "type": "class" @@ -624,18 +568,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "char", - "type": "" + "kind": "argument", + "type": "char" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::string", - "type": "" + "kind": "argument", + "type": "std::string" } ], "type": "class" @@ -655,18 +595,14 @@ TEST_CASE("t00014", "[test-case][class]") "namespace": "clanguml::t00014", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "wchar_t", - "type": "" + "kind": "argument", + "type": "wchar_t" }, { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "std::string", - "type": "" + "kind": "argument", + "type": "std::string" } ], "type": "class" @@ -686,7 +622,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "bapair", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 58 }, "type": "PairPairBA" @@ -696,7 +632,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "abool", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 60 }, "type": "APtr" @@ -706,7 +642,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "aboolfloat", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 61 }, "type": "AAPtr" @@ -716,7 +652,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "afloat", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 62 }, "type": "ASharedPtr" @@ -726,7 +662,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "boolstring", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 63 }, "type": "A" @@ -736,7 +672,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "floatstring", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 64 }, "type": "AStringPtr" @@ -746,7 +682,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "intstring", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 65 }, "type": "clanguml::t00014::AIntString" @@ -756,7 +692,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "stringstring", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 66 }, "type": "clanguml::t00014::AStringString" @@ -766,7 +702,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "bstringstring", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 67 }, "type": "clanguml::t00014::BStringString" @@ -776,7 +712,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "bs", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 70 }, "type": "clanguml::t00014::BVector" @@ -786,7 +722,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "bs2", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 73 }, "type": "clanguml::t00014::BVector2" @@ -796,7 +732,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "cb", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 74 }, "type": "SimpleCallback" @@ -806,7 +742,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "gcb", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 75 }, "type": "GenericCallback" @@ -816,7 +752,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "vcb", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 76 }, "type": "clanguml::t00014::VoidCallback" @@ -826,7 +762,7 @@ TEST_CASE("t00014", "[test-case][class]") "is_static": false, "name": "vps", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 77 }, "type": "VectorPtr" @@ -836,7 +772,7 @@ TEST_CASE("t00014", "[test-case][class]") "name": "R", "namespace": "clanguml::t00014", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00014/t00014.cc", + "file": "../../tests/t00014/t00014.cc", "line": 55 }, "template_parameters": [], @@ -1073,7 +1009,7 @@ TEST_CASE("t00014", "[test-case][class]") )##"; auto j = generate_class_json(diagram, *model); - // REQUIRE(j == nlohmann::json::parse(expected_json)); + REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00036/test_case.h b/tests/t00036/test_case.h index f526f6fb..b9b43ec9 100644 --- a/tests/t00036/test_case.h +++ b/tests/t00036/test_case.h @@ -64,7 +64,7 @@ TEST_CASE("t00036", "[test-case][class]") "name": "E", "namespace": "clanguml::t00036::ns1", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "file": "../../tests/t00036/t00036.cc", "line": 6 }, "type": "enum" @@ -87,7 +87,7 @@ TEST_CASE("t00036", "[test-case][class]") "is_static": false, "name": "a", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "file": "../../tests/t00036/t00036.cc", "line": 11 }, "type": "T" @@ -97,16 +97,14 @@ TEST_CASE("t00036", "[test-case][class]") "name": "A", "namespace": "clanguml::t00036::ns1::ns11", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "file": "../../tests/t00036/t00036.cc", "line": 10 }, "template_parameters": [ { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "template_type", + "name": "T" } ], "type": "class" @@ -129,7 +127,7 @@ TEST_CASE("t00036", "[test-case][class]") "is_static": false, "name": "a_int", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "file": "../../tests/t00036/t00036.cc", "line": 17 }, "type": "A" @@ -139,7 +137,7 @@ TEST_CASE("t00036", "[test-case][class]") "name": "B", "namespace": "clanguml::t00036::ns1::ns11::ns111", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "file": "../../tests/t00036/t00036.cc", "line": 16 }, "template_parameters": [], @@ -164,11 +162,9 @@ TEST_CASE("t00036", "[test-case][class]") "namespace": "clanguml::t00036::ns1::ns11", "template_parameters": [ { - "is_template_parameter": false, - "is_template_template_parameter": false, "is_variadic": false, - "name": "int", - "type": "" + "kind": "argument", + "type": "int" } ], "type": "class" @@ -201,7 +197,7 @@ TEST_CASE("t00036", "[test-case][class]") "name": "C", "namespace": "clanguml::t00036::ns2::ns22", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00036/t00036.cc", + "file": "../../tests/t00036/t00036.cc", "line": 28 }, "template_parameters": [], @@ -236,7 +232,7 @@ TEST_CASE("t00036", "[test-case][class]") auto j = generate_class_json(diagram, *model); - // REQUIRE(j == nlohmann::json::parse(expected_json)); + REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index c30f9ccf..655f3dff 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -125,7 +125,7 @@ TEST_CASE("t00056", "[test-case][class]") "namespace": "clanguml::t00056", "parameters": [], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 7 }, "statements": [], @@ -147,7 +147,7 @@ TEST_CASE("t00056", "[test-case][class]") } ], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 10 }, "statements": [ @@ -162,7 +162,7 @@ TEST_CASE("t00056", "[test-case][class]") "namespace": "clanguml::t00056", "parameters": [], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 15 }, "statements": [], @@ -180,7 +180,7 @@ TEST_CASE("t00056", "[test-case][class]") } ], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 19 }, "statements": [ @@ -196,7 +196,7 @@ TEST_CASE("t00056", "[test-case][class]") "namespace": "clanguml::t00056", "parameters": [], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 26 }, "statements": [ @@ -216,7 +216,7 @@ TEST_CASE("t00056", "[test-case][class]") } ], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 29 }, "statements": [ @@ -233,7 +233,7 @@ TEST_CASE("t00056", "[test-case][class]") "namespace": "clanguml::t00056", "parameters": [], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 45 }, "statements": [], @@ -246,7 +246,7 @@ TEST_CASE("t00056", "[test-case][class]") "namespace": "clanguml::t00056", "parameters": [], "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 48 }, "statements": [], @@ -267,7 +267,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "a", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 53 }, "type": "T" @@ -277,17 +277,14 @@ TEST_CASE("t00056", "[test-case][class]") "name": "A", "namespace": "clanguml::t00056", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 52 }, "template_parameters": [ { - "concept_constraint": "clanguml::t00056::max_four_bytes", - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "template_type", + "name": "T" } ], "type": "class" @@ -307,7 +304,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "b", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 60 }, "type": "T" @@ -317,16 +314,14 @@ TEST_CASE("t00056", "[test-case][class]") "name": "B", "namespace": "clanguml::t00056", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 59 }, "template_parameters": [ { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "template_type", + "name": "T" } ], "type": "class" @@ -346,7 +341,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "c", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 70 }, "type": "T" @@ -356,17 +351,14 @@ TEST_CASE("t00056", "[test-case][class]") "name": "C", "namespace": "clanguml::t00056", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 69 }, "template_parameters": [ { - "concept_constraint": "clanguml::t00056::convertible_to_string", - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T", - "type": "" + "kind": "template_type", + "name": "T" } ], "type": "class" @@ -385,46 +377,34 @@ TEST_CASE("t00056", "[test-case][class]") "name": "D", "namespace": "clanguml::t00056", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 75 }, "template_parameters": [ { - "concept_constraint": "clanguml::t00056::iterable", - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T1", - "type": "" + "kind": "template_type", + "name": "T1" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T2", - "type": "" + "kind": "template_type", + "name": "T2" }, { - "concept_constraint": "clanguml::t00056::iterable", - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T3", - "type": "" + "kind": "template_type", + "name": "T3" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T4", - "type": "" + "kind": "template_type", + "name": "T4" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T5", - "type": "" + "kind": "template_type", + "name": "T5" } ], "type": "class" @@ -444,7 +424,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "e1", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 80 }, "type": "T1" @@ -454,7 +434,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "e2", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 81 }, "type": "T2" @@ -464,7 +444,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "e3", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 82 }, "type": "T3" @@ -474,30 +454,24 @@ TEST_CASE("t00056", "[test-case][class]") "name": "E", "namespace": "clanguml::t00056", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 79 }, "template_parameters": [ { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T1", - "type": "" + "kind": "template_type", + "name": "T1" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T2", - "type": "" + "kind": "template_type", + "name": "T2" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T3", - "type": "" + "kind": "template_type", + "name": "T3" } ], "type": "class" @@ -517,7 +491,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "f1", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 88 }, "type": "T1" @@ -527,7 +501,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "f2", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 89 }, "type": "T2" @@ -537,7 +511,7 @@ TEST_CASE("t00056", "[test-case][class]") "is_static": false, "name": "f3", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 90 }, "type": "T3" @@ -547,30 +521,24 @@ TEST_CASE("t00056", "[test-case][class]") "name": "F", "namespace": "clanguml::t00056", "source_location": { - "file": "/home/bartek/devel/clang-uml/tests/t00056/t00056.cc", + "file": "../../tests/t00056/t00056.cc", "line": 87 }, "template_parameters": [ { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T1", - "type": "" + "kind": "template_type", + "name": "T1" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T2", - "type": "" + "kind": "template_type", + "name": "T2" }, { - "is_template_parameter": true, - "is_template_template_parameter": false, "is_variadic": false, - "name": "T3", - "type": "" + "kind": "template_type", + "name": "T3" } ], "type": "class" @@ -666,7 +634,7 @@ TEST_CASE("t00056", "[test-case][class]") )##"; auto j = generate_class_json(diagram, *model); - // REQUIRE(j == nlohmann::json::parse(expected_json)); + REQUIRE(j == nlohmann::json::parse(expected_json)); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file From e620c86f31fc39ced591a59e0e6cdab1974ae6bc Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 17 Mar 2023 00:42:47 +0100 Subject: [PATCH 11/30] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++--- docs/test_cases/t00004_class.svg | 76 ++++----- docs/test_cases/t00005_class.svg | 110 ++++++------- docs/test_cases/t00006_class.svg | 132 ++++++++-------- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008_class.svg | 236 ++++++++++++++-------------- docs/test_cases/t00009_class.svg | 32 ++-- docs/test_cases/t00010_class.svg | 34 ++-- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++---- docs/test_cases/t00013_class.svg | 82 +++++----- docs/test_cases/t00014_class.svg | 116 +++++++------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 26 +-- docs/test_cases/t00017_class.svg | 66 ++++---- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 ++--- docs/test_cases/t00020_class.svg | 38 ++--- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 +-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++-- docs/test_cases/t00026_class.svg | 42 ++--- docs/test_cases/t00027_class.svg | 58 +++---- docs/test_cases/t00028_class.svg | 82 +++++----- docs/test_cases/t00029_class.svg | 50 +++--- docs/test_cases/t00030_class.svg | 46 +++--- docs/test_cases/t00031_class.svg | 50 +++--- docs/test_cases/t00032_class.svg | 40 ++--- docs/test_cases/t00033_class.svg | 48 +++--- docs/test_cases/t00034_class.svg | 38 ++--- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 ++--- docs/test_cases/t00037_class.svg | 54 +++---- docs/test_cases/t00038_class.svg | 54 +++---- docs/test_cases/t00039_class.svg | 78 ++++----- docs/test_cases/t00040_class.svg | 26 +-- docs/test_cases/t00041_class.svg | 54 +++---- docs/test_cases/t00042_class.svg | 32 ++-- docs/test_cases/t00043_class.svg | 50 +++--- docs/test_cases/t00044_class.svg | 18 +-- docs/test_cases/t00045_class.svg | 70 ++++----- docs/test_cases/t00046_class.svg | 64 ++++---- docs/test_cases/t00047_class.svg | 18 +-- docs/test_cases/t00048_class.svg | 50 +++--- docs/test_cases/t00049_class.svg | 32 ++-- docs/test_cases/t00050_class.svg | 70 ++++----- docs/test_cases/t00051_class.svg | 42 ++--- docs/test_cases/t00052_class.svg | 34 ++-- docs/test_cases/t00053_class.svg | 70 ++++----- docs/test_cases/t00054_class.svg | 78 ++++----- docs/test_cases/t00055_class.svg | 42 ++--- docs/test_cases/t00056_class.svg | 94 +++++------ docs/test_cases/t00057_class.svg | 114 +++++++------- docs/test_cases/t00058_class.svg | 48 +++--- docs/test_cases/t00059_class.svg | 50 +++--- docs/test_cases/t00060_class.svg | 38 ++--- docs/test_cases/t20001_sequence.svg | 62 ++++---- docs/test_cases/t20002_sequence.svg | 48 +++--- docs/test_cases/t20003_sequence.svg | 48 +++--- docs/test_cases/t20004_sequence.svg | 120 +++++++------- docs/test_cases/t20005_sequence.svg | 36 ++--- docs/test_cases/t20006_sequence.svg | 150 +++++++++--------- docs/test_cases/t20007_sequence.svg | 48 +++--- docs/test_cases/t20008_sequence.svg | 84 +++++----- docs/test_cases/t20009_sequence.svg | 84 +++++----- docs/test_cases/t20010_sequence.svg | 72 ++++----- docs/test_cases/t20011_sequence.svg | 72 ++++----- docs/test_cases/t20012_sequence.svg | 204 ++++++++++++------------ docs/test_cases/t20013_sequence.svg | 60 +++---- docs/test_cases/t20014_sequence.svg | 72 ++++----- docs/test_cases/t20015_sequence.svg | 24 +-- docs/test_cases/t20016_sequence.svg | 48 +++--- docs/test_cases/t20017_sequence.svg | 48 +++--- docs/test_cases/t20018_sequence.svg | 96 +++++------ docs/test_cases/t20019_sequence.svg | 84 +++++----- docs/test_cases/t20020_sequence.svg | 118 +++++++------- docs/test_cases/t20021_sequence.svg | 106 ++++++------- docs/test_cases/t20022_sequence.svg | 36 ++--- docs/test_cases/t20023_sequence.svg | 50 +++--- docs/test_cases/t20024_sequence.svg | 88 +++++------ docs/test_cases/t20025_sequence.svg | 42 ++--- docs/test_cases/t20026_sequence.svg | 24 +-- docs/test_cases/t20027_sequence.svg | 24 +-- docs/test_cases/t20028_sequence.svg | 44 +++--- docs/test_cases/t20029_sequence.svg | 80 +++++----- docs/test_cases/t30001_package.svg | 48 +++--- docs/test_cases/t30002_package.svg | 90 +++++------ docs/test_cases/t30003_package.svg | 26 +-- docs/test_cases/t30004_package.svg | 30 ++-- docs/test_cases/t30005_package.svg | 38 ++--- docs/test_cases/t30006_package.svg | 16 +- docs/test_cases/t30007_package.svg | 20 +-- docs/test_cases/t30008_package.svg | 34 ++-- docs/test_cases/t30009_package.svg | 42 ++--- docs/test_cases/t40001_include.svg | 30 ++-- docs/test_cases/t40002_include.svg | 34 ++-- docs/test_cases/t40003_include.svg | 50 +++--- 100 files changed, 2839 insertions(+), 2839 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 2b7114b5..9633ace5 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ foo_c() = 0 : void - - + + B @@ -31,8 +31,8 @@ foo_a() : void - - + + C @@ -41,18 +41,18 @@ foo_c() : void - - + + D - + - + as : std::vector<A *> @@ -60,18 +60,18 @@ foo_a() : void foo_c() : void - - + + E - + - + as : std::vector<A *> @@ -79,13 +79,13 @@ foo_a() : void foo_c() : void - + This is class A - + This is class B - + This is class D diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index 5686ebe9..c8d275c1 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - + + A - + - + public_member : int - + - + protected_member : int - + - + private_member : int - + - + a_ : int - + - + b_ : int - + - + c_ : int - + - + static_int : int - + - + static_const_int : const int - + - + auto_member : const unsigned long @@ -112,11 +112,11 @@ protected_method() : void private_method() : void - + - + compare : std::function<bool (const int)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 6584c650..5056564a 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + B - - + + B::AA @@ -28,8 +28,8 @@ AA_3 - - + + A @@ -40,16 +40,16 @@ foo2() const : void - - + + A::AA - - + + A::AA::Lights @@ -59,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index b17f5708..0fa870af 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,204 +9,204 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & - + - + a : A - + - + b : B * - + - + c : C & - + - + d : const D * - + - + e : const E & - + - + f : F && - + - + g : G ** - + - + h : H *** - + - + i : I *& - + - + j : volatile J * - + - + k : K * diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index bd265e87..65171aaa 100644 --- a/docs/test_cases/t00006_class.svg +++ b/docs/test_cases/t00006_class.svg @@ -1,6 +1,6 @@ - + @@ -9,136 +9,136 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + L - - + + M - - + + N - - + + NN - - + + NNN - - + + custom_container @@ -146,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ E - - + + R - + - + a : std::vector<A> - + - + b : std::vector<B *> - + - + c : std::map<int,C> - + - + d : std::map<int,D *> - + - + e : custom_container<E> - + - + f : std::vector<std::vector<F>> - + - + g : std::map<int,std::vector<G *>> - + - + h : std::array<H,10> - + - + i : std::array<I *,5> - + - + j : J[10] - + - + k : K *[20] - + - + lm : std::vector<std::pair<L,M>> - + - + ns : std::tuple<N,NN,NNN> diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index 28b9f545..19d91b9b 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index 8bdec027..3056b44d 100644 --- a/docs/test_cases/t00008_class.svg +++ b/docs/test_cases/t00008_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,164 +9,164 @@ - - - - - A - - T,P,CMP,int N - + + + + + A + + T,P=T,CMP=nullptr,int N=3 + - + - + value : T - + - + pointer : T * - + - + reference : T & - + - + values : std::vector<P> - + - + ints : std::array<int,N> - + - + comparator : CMP - - - - - - Vector - - T - + + + + + + Vector + + T + - - - + + + - - values : std::vector<T> + + values : std::vector<T> - - - - - - B - - T,C<> - + + + + + + B + + T,C<> + - - - + + + - - template_template : C<T> + + template_template : C<T> - - - - - B - - int,Vector - - - - - - - D - + + + + + B + + int,Vector + + + + + + + D + - - - + + + - - ints : B<int,Vector> + + ints : B<int,Vector> - - - add(int i) : void - - D<Items...>(std::tuple<Items...> * ) : void - - - - - E - - + + + add(int i) : void + + D<Items...>(std::tuple<Items...> * ) : void + + + + + E + + - - - - - E::nested_template - - ET - - - - get(ET * d) : E::nested_template::DT * + + + + + E::nested_template + + ET + + + + get(ET * d) : E::nested_template::DT * - - - - - E::nested_template - - char - - + + + + + E::nested_template + + char + + - - - - - - ints - - - - - - - - - - + + + + + + ints + + + + + + + + + + diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 80224d2b..21629ef9 100644 --- a/docs/test_cases/t00009_class.svg +++ b/docs/test_cases/t00009_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ std::vector<std::string> - - + + B - + - + aint : A<int> - + - + astring : A<std::string> * - + - + avector : A<std::vector<std::string>> & diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index 70784b97..df030bc2 100644 --- a/docs/test_cases/t00010_class.svg +++ b/docs/test_cases/t00010_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index b75e51bc..69e902f1 100644 --- a/docs/test_cases/t00011_class.svg +++ b/docs/test_cases/t00011_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + D @@ -18,16 +18,16 @@ T - + - + value : T - - + + A @@ -36,18 +36,18 @@ foo() : void - - + + B - + - + m_a : A * diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index d5ae5d6a..415f4e3c 100644 --- a/docs/test_cases/t00012_class.svg +++ b/docs/test_cases/t00012_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,23 +18,23 @@ T,Ts... - + - + value : T - + - + values : std::variant<Ts...> - - + + B @@ -43,15 +43,15 @@ - + - + ints : std::array<int,sizeof...(Is)> - - + + C @@ -60,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3 - - + + R - + - + a1 : A<int,std::string,float> - + - + a2 : A<int,std::string,bool> - + - + b1 : B<3,2,1> - + - + b2 : B<1,1,1,1> - + - + c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> - + Long template annotation diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index 77d648b0..10405d04 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ABCD::F @@ -18,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index ff79e7d7..0e8c833e 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + intstring : AIntString - + - + stringstring : AStringString - + - + bstringstring : BStringString - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 37864ba3..aceec1bf 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + ns1::A - - + + ns1::ns2_v0_9_0::A - - + + ns1::Anon - - + + ns3::ns1::ns2::Anon - - + + ns3::B diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg index 4053f733..1e3195b3 100644 --- a/docs/test_cases/t00016_class.svg +++ b/docs/test_cases/t00016_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + is_numeric<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ - - + + is_numeric @@ -39,8 +39,8 @@ - - + + is_numeric @@ -49,8 +49,8 @@ - - + + is_numeric @@ -59,8 +59,8 @@ - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 3e89a97f..3aa8f097 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,127 +9,127 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index dce0b307..c2f5fa62 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,18 +9,18 @@ - - + + impl::widget - + - + n : int @@ -30,18 +30,18 @@ draw(const widget & w) : void widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 2d5ffbe7..fb79a242 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Base @@ -25,8 +25,8 @@ m2() : std::string - - + + Layer1 @@ -39,8 +39,8 @@ m2() : std::string - - + + Layer2 @@ -51,8 +51,8 @@ all_calls_count() const : int - - + + Layer3 @@ -60,18 +60,18 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int @@ -83,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 2fb2cd2f..8d0285cf 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ProductA @@ -21,8 +21,8 @@ sell(int price) const = 0 : bool - - + + ProductA1 @@ -31,8 +31,8 @@ sell(int price) const : bool - - + + ProductA2 @@ -41,8 +41,8 @@ sell(int price) const : bool - - + + ProductB @@ -53,8 +53,8 @@ buy(int price) const = 0 : bool - - + + ProductB1 @@ -63,8 +63,8 @@ buy(int price) const : bool - - + + ProductB2 @@ -73,8 +73,8 @@ buy(int price) const : bool - - + + AbstractFactory @@ -85,8 +85,8 @@ make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 @@ -97,8 +97,8 @@ make_b() const : std::unique_ptr<ProductB> - - + + Factory2 diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index b19f4fca..4aaa781f 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Visitor @@ -23,8 +23,8 @@ visit_B(const B & item) const = 0 : void - - + + Visitor1 @@ -35,8 +35,8 @@ visit_B(const B & item) const : void - - + + Visitor2 @@ -47,8 +47,8 @@ visit_B(const B & item) const : void - - + + Visitor3 @@ -59,8 +59,8 @@ visit_B(const B & item) const : void - - + + Item @@ -71,8 +71,8 @@ accept(const Visitor & visitor) const = 0 : void - - + + A @@ -81,8 +81,8 @@ accept(const Visitor & visitor) const : void - - + + B diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index ee5f8b6d..77149e2a 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -23,8 +23,8 @@ method2() = 0 : void - - + + A1 @@ -35,8 +35,8 @@ method2() : void - - + + A2 diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 7a790c06..8bc7e504 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Strategy @@ -21,8 +21,8 @@ algorithm() = 0 : void - - + + StrategyA @@ -31,8 +31,8 @@ algorithm() : void - - + + StrategyB @@ -41,8 +41,8 @@ algorithm() : void - - + + StrategyC @@ -51,18 +51,18 @@ algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 8b019a4c..3d5979e3 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target @@ -23,8 +23,8 @@ m2() = 0 : void - - + + Target1 @@ -35,8 +35,8 @@ m2() : void - - + + Target2 @@ -47,18 +47,18 @@ m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index bf74d46b..6e2cff91 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target1 @@ -21,8 +21,8 @@ m2() : void - - + + Target2 @@ -33,8 +33,8 @@ m2() : void - - + + Proxy @@ -42,11 +42,11 @@ T - + - + m_target : std::shared_ptr<T> @@ -56,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 1552fb4d..82641929 100644 --- a/docs/test_cases/t00026_class.svg +++ b/docs/test_cases/t00026_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Memento @@ -18,11 +18,11 @@ T - + - + m_value : T @@ -30,8 +30,8 @@ Memento<T>(T && v) : void value() const : T - - + + Originator @@ -39,11 +39,11 @@ T - + - + m_value : T @@ -57,8 +57,8 @@ print() const : void set(T && v) : void - - + + Caretaker @@ -66,11 +66,11 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> @@ -78,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 6fb2ea37..cadd73ad 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Shape @@ -21,14 +21,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index b0370ebc..a0fc906d 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + A - + A class note. - - + + B - + B class note. - - + + C - + C class note. - - + + D - + D class note. - - + + E @@ -64,27 +64,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -94,10 +94,10 @@ three - + F enum note. - + E @@ -105,65 +105,65 @@ int - - + + R - + - + aaa : A - + - + bbb : B * - + - + ccc : C & - + - + ddd : std::vector<std::shared_ptr<D>> - + - + eee : E<int> - + - + ggg : G ** R(C & c) : void - + R class note. - + R contains an instance of A. - + Reference to C. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index f0e95b2f..37ac1cd7 100644 --- a/docs/test_cases/t00029_class.svg +++ b/docs/test_cases/t00029_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + A - - + + C @@ -26,16 +26,16 @@ T - + - + param : T - - + + E @@ -45,64 +45,64 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3 & - + - + g4 : std::shared_ptr<G4> diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index 20c3701d..9f96f86d 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,86 +9,86 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + - + eee : E * diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index ded9ace3..5ada614f 100644 --- a/docs/test_cases/t00031_class.svg +++ b/docs/test_cases/t00031_class.svg @@ -1,33 +1,33 @@ - + - + - + - - - + + + A - - + + B @@ -37,8 +37,8 @@ three - - + + @@ -47,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index e48fb86f..12fc21eb 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,24 +9,24 @@ - - + + Base - - + + TBase - - + + A @@ -35,8 +35,8 @@ operator()() : void - - + + B @@ -45,8 +45,8 @@ operator()() : void - - + + C @@ -55,8 +55,8 @@ operator()() : void - - + + Overload @@ -64,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 8691e0dd..38853689 100644 --- a/docs/test_cases/t00033_class.svg +++ b/docs/test_cases/t00033_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + aaa : T - - + + B @@ -35,16 +35,16 @@ T - + - + bbb : T - - + + C @@ -52,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 044335f4..23e59f9b 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Void @@ -21,8 +21,8 @@ operator!=(const Void & ) const : bool - - + + lift_void @@ -31,8 +31,8 @@ - - + + lift_void @@ -41,8 +41,8 @@ - - + + drop_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,33 +61,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 3b589a36..48572509 100644 --- a/docs/test_cases/t00035_class.svg +++ b/docs/test_cases/t00035_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + Top - - + + Left - - + + Center - - + + Bottom - - + + Right diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg index 9e102f1c..9764d5ee 100644 --- a/docs/test_cases/t00036_class.svg +++ b/docs/test_cases/t00036_class.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - + ns1 - + ns11 - + ns111 - + ns2 - + ns22 - - + + E @@ -34,8 +34,8 @@ yellow - - + + A @@ -43,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 98f79206..98c6f40c 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,98 +9,98 @@ - - + + ST - + - + dimensions : ST::(anonymous_662) - + - + units : ST::(anonymous_792) - - + + ST::(dimensions) - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + ST::(units) - + - + c : double - + - + h : double - - + + A - + - + st : ST diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index af974d05..5a3ec793 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + thirdparty::ns1::color_t @@ -20,16 +20,16 @@ blue - - + + thirdparty::ns1::E - - + + property_t @@ -39,47 +39,47 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - + - + key : std::string - - + + map @@ -88,8 +88,8 @@ - - + + map @@ -98,8 +98,8 @@ - - + + map @@ -108,8 +108,8 @@ - - + + map @@ -118,8 +118,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 09866834..c2f7d303 100644 --- a/docs/test_cases/t00039_class.svg +++ b/docs/test_cases/t00039_class.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - + + C - - + + D - - + + E - - + + CD - - + + DE - - + + CDE - - + + A - - + + AA - - + + AAA - + - + b : B * - - + + ns2::AAAA - - + + ns3::F @@ -105,16 +105,16 @@ T - + - + t : T * - - + + ns3::FF @@ -122,16 +122,16 @@ T,M - + - + m : M * - - + + ns3::FE @@ -139,16 +139,16 @@ T,M - + - + m : M * - - + + ns3::FFF @@ -156,11 +156,11 @@ T,M,N - + - + n : N * diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index 1875de1e..e38717b0 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + - + ii_ : int get_a() : int - - + + AA - - + + AAA - + - + b : B * get_aaa() : int - - + + R diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index 6095d953..6e80efb7 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,102 +9,102 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * foo(H * h) : void - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 76afa2d0..fdfc3357 100644 --- a/docs/test_cases/t00042_class.svg +++ b/docs/test_cases/t00042_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + a : T - - + + A @@ -36,8 +36,8 @@ - - + + B @@ -45,22 +45,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -68,7 +68,7 @@ double - + A @@ -76,7 +76,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 0490f9d4..151d49ca 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - + dependants - + dependencies - - + + A - - + + B @@ -33,8 +33,8 @@ b(dependants::A * a) : void - - + + BB @@ -43,8 +43,8 @@ bb(dependants::A * a) : void - - + + C @@ -53,8 +53,8 @@ c(dependants::B * b) : void - - + + D @@ -65,8 +65,8 @@ dd(dependants::BB * bb) : void - - + + E @@ -75,24 +75,24 @@ e(dependants::D * d) : void - - + + G - - + + GG - - + + H @@ -103,8 +103,8 @@ hh(dependencies::GG * gg) : void - - + + I @@ -113,8 +113,8 @@ i(dependencies::H * h) : void - - + + J diff --git a/docs/test_cases/t00044_class.svg b/docs/test_cases/t00044_class.svg index 44068dd6..24b17829 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + sink @@ -19,8 +19,8 @@ - - + + signal_handler @@ -29,8 +29,8 @@ - - + + signal_handler @@ -39,8 +39,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index 5e08bc04..a1546c15 100644 --- a/docs/test_cases/t00045_class.svg +++ b/docs/test_cases/t00045_class.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + A - - + + AA - - + + AAA - - + + AAAA @@ -42,103 +42,103 @@ T - + - + t : T - - + + ns1::A - - + + ns1::ns2::A - - + + ns1::ns2::B - - + + ns1::ns2::C - - + + ns1::ns2::D - - + + ns1::ns2::E - - + + ns1::ns2::AAA - - + + ns1::ns2::R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * diff --git a/docs/test_cases/t00046_class.svg b/docs/test_cases/t00046_class.svg index ac14b903..52da4a40 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 785abe38..291ef34a 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + conditional_t @@ -19,8 +19,8 @@ - - + + conditional_t @@ -29,8 +29,8 @@ - - + + conditional_t @@ -39,8 +39,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 7eb39e66..48029937 100644 --- a/docs/test_cases/t00048_class.svg +++ b/docs/test_cases/t00048_class.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + Base - + - + base : int foo() = 0 : void - - + + BaseTemplate @@ -35,35 +35,35 @@ T - + - + base : T foo() = 0 : void - - + + B - + - + b : int foo() : void - - + + BTemplate @@ -71,35 +71,35 @@ T - + - + b : T foo() : void - - + + A - + - + a : int foo() : void - - + + ATemplate @@ -107,11 +107,11 @@ T - + - + a : T diff --git a/docs/test_cases/t00049_class.svg b/docs/test_cases/t00049_class.svg index acfe5e99..92482219 100644 --- a/docs/test_cases/t00049_class.svg +++ b/docs/test_cases/t00049_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ string_vector - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index b4bafb35..ff20ac50 100644 --- a/docs/test_cases/t00050_class.svg +++ b/docs/test_cases/t00050_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + utils::D - - + + E @@ -52,8 +52,8 @@ E3 - - + + F @@ -61,44 +61,44 @@ T,V,int N - + - + t : T[N] - + - + v : V - - + + G - - + + NoComment - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies mollis dictumst, aenean non a in donec nulla. @@ -125,50 +125,50 @@ imperdiet praesent magnis ridiculus congue gravida curabitur dictum sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, aenean vel nostra tellus commodo pretium sapien sociosqu. - + This is a short description of class G. - + This is an intermediate description of class G. - + This is a long description of class G. - + Lorem ipsum - + TODO 1. Write meaningful comment - + TODO 2. Write tests - + TODO 3. Implement - + Long comment example - + TODO Implement... - + Simple array wrapper. - + Template parameters diff --git a/docs/test_cases/t00051_class.svg b/docs/test_cases/t00051_class.svg index 5b71075f..df0ab88a 100644 --- a/docs/test_cases/t00051_class.svg +++ b/docs/test_cases/t00051_class.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - - - - B - - F,FF + + + + + B + + F,FF=F - + - + f_ : F - + - + ff_ : FF @@ -39,16 +39,16 @@ f() : void ff() : void - - + + B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> - - + + A @@ -63,8 +63,8 @@ get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) - - + + A::custom_thread1 @@ -73,8 +73,8 @@ custom_thread1<Function,Args...>(Function && f, Args &&... args) : void - - + + A::custom_thread2 @@ -83,7 +83,7 @@ thread((lambda at ../../tests/t00051/t00051.cc:59:27) && ) : void - + diff --git a/docs/test_cases/t00052_class.svg b/docs/test_cases/t00052_class.svg index a4c7973e..fc42ddc9 100644 --- a/docs/test_cases/t00052_class.svg +++ b/docs/test_cases/t00052_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ aa<F,Q>(F && f, Q q) : void - - + + B @@ -35,8 +35,8 @@ bb<F>(F && f, T t) : T - - + + C @@ -47,7 +47,7 @@ c<P>(P p) : T - + B @@ -55,7 +55,7 @@ int - + C @@ -63,32 +63,32 @@ int - - + + R - + - + a : A - + - + b : B<int> - + - + c : C<int> diff --git a/docs/test_cases/t00053_class.svg b/docs/test_cases/t00053_class.svg index ef5a07f5..d47d42e5 100644 --- a/docs/test_cases/t00053_class.svg +++ b/docs/test_cases/t00053_class.svg @@ -1,6 +1,6 @@ - + @@ -9,72 +9,72 @@ - - + + A - - + + C - - + + E - - + + F - - + + a - - + + c - - + + e - - + + f - - + + h @@ -82,8 +82,8 @@ hhh - - + + j @@ -91,56 +91,56 @@ jjj - - + + b - - + + d - - + + g - - + + B - - + + D - - + + G - - + + i diff --git a/docs/test_cases/t00054_class.svg b/docs/test_cases/t00054_class.svg index 1391a72d..58d8752f 100644 --- a/docs/test_cases/t00054_class.svg +++ b/docs/test_cases/t00054_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - + detail - + detail2 - + detail3 - + detail4 - - + + d - - + + a - - + + c - - + + e - - + + C - - + + F - - + + D - - + + E - - + + A - - + + B - - + + f - - + + G - - + + h @@ -127,8 +127,8 @@ hhh - - + + i @@ -137,8 +137,8 @@ iii - - + + j @@ -147,16 +147,16 @@ jjj - - + + b - - + + g diff --git a/docs/test_cases/t00055_class.svg b/docs/test_cases/t00055_class.svg index ee60ac57..1fc2307b 100644 --- a/docs/test_cases/t00055_class.svg +++ b/docs/test_cases/t00055_class.svg @@ -1,6 +1,6 @@ - + @@ -9,80 +9,80 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J diff --git a/docs/test_cases/t00056_class.svg b/docs/test_cases/t00056_class.svg index c5b6a2b3..f27bfd7c 100644 --- a/docs/test_cases/t00056_class.svg +++ b/docs/test_cases/t00056_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -20,8 +20,8 @@ - - + + «concept» @@ -33,8 +33,8 @@ sizeof (l) > sizeof (r) - - + + «concept» @@ -44,8 +44,8 @@ - - + + «concept» @@ -58,8 +58,8 @@ container.begin() container.end() - - + + «concept» @@ -71,8 +71,8 @@ typename T::value_type - - + + «concept» @@ -86,8 +86,8 @@ {std::to_string(s)} noexcept {std::to_string(s)} -> std::same_as<std::string> - - + + «concept» @@ -97,8 +97,8 @@ - - + + «concept» @@ -108,8 +108,8 @@ - - + + A @@ -117,16 +117,16 @@ max_four_bytes T - + - + a : T - - + + B @@ -134,16 +134,16 @@ T - + - + b : T - - + + C @@ -151,16 +151,16 @@ convertible_to_string T - + - + c : T - - + + D @@ -169,8 +169,8 @@ - - + + E @@ -178,30 +178,30 @@ T1,T2,T3 - + - + e1 : T1 - + - + e2 : T2 - + - + e3 : T3 - - + + F @@ -209,25 +209,25 @@ T1,T2,T3 - + - + f1 : T1 - + - + f2 : T2 - + - + f3 : T3 diff --git a/docs/test_cases/t00057_class.svg b/docs/test_cases/t00057_class.svg index b60a5eee..9b424947 100644 --- a/docs/test_cases/t00057_class.svg +++ b/docs/test_cases/t00057_class.svg @@ -1,6 +1,6 @@ - + @@ -9,210 +9,210 @@ - - + + t00057_A - + - + a1 : int - - + + t00057_B - + - + b1 : int - - + + t00057_C - + - + c1 : int - - + + «union» t00057_D - + - + d1 : int - + - + d2 : float - - + + t00057_E - + - + e : int - + - + coordinates : t00057_E::(anonymous_739) - + - + height : t00057_E::(anonymous_807) - - + + t00057_E::(coordinates) - + - + x : int - + - + y : int - - + + «union» t00057_E::(height) - + - + z : int - + - + t : double - - + + t00057_R - + - + a : struct t00057_A - + - + b : t00057_B - + - + c : struct t00057_C * - + - + d : union t00057_D - + - + e : struct t00057_E * - + - + f : struct t00057_F * - - + + t00057_F - + - + f1 : int diff --git a/docs/test_cases/t00058_class.svg b/docs/test_cases/t00058_class.svg index c394b8cf..99b869c8 100644 --- a/docs/test_cases/t00058_class.svg +++ b/docs/test_cases/t00058_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + first_type @@ -19,8 +19,8 @@ - - + + «concept» @@ -30,8 +30,8 @@ - - + + A @@ -39,16 +39,16 @@ T,Args... - + - + a : std::vector<T> - - + + B @@ -56,22 +56,22 @@ T,P,Args... - + - + b : std::vector<T> - + - + bb : P - + A @@ -79,7 +79,7 @@ int,int,double,std::string - + A @@ -87,7 +87,7 @@ int,int - + B @@ -95,25 +95,25 @@ int,std::string,int,double,A<int,int> - - + + R - + - + aa : A<int,int,double,std::string> - + - + bb : B<int,std::string,int,double,A<int,int>> diff --git a/docs/test_cases/t00059_class.svg b/docs/test_cases/t00059_class.svg index a1e7b15e..c784af76 100644 --- a/docs/test_cases/t00059_class.svg +++ b/docs/test_cases/t00059_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -23,8 +23,8 @@ T{} t.get_name() - - + + «concept» @@ -36,8 +36,8 @@ t.get_sweetness() - - + + «concept» @@ -49,8 +49,8 @@ t.get_bitterness() - - + + gala_apple @@ -61,8 +61,8 @@ get_sweetness() const : float - - + + empire_apple @@ -73,8 +73,8 @@ get_sweetness() const : float - - + + lima_orange @@ -85,8 +85,8 @@ get_bitterness() const : float - - + + valencia_orange @@ -97,8 +97,8 @@ get_bitterness() const : float - - + + fruit_factory @@ -111,7 +111,7 @@ create_orange() const : TO - + fruit_factory @@ -119,7 +119,7 @@ gala_apple,valencia_orange - + fruit_factory @@ -127,25 +127,25 @@ empire_apple,lima_orange - - + + R - + - + factory_1 : fruit_factory_1 - + - + factory_2 : fruit_factory_2 diff --git a/docs/test_cases/t00060_class.svg b/docs/test_cases/t00060_class.svg index 6dc03038..ce46cf35 100644 --- a/docs/test_cases/t00060_class.svg +++ b/docs/test_cases/t00060_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + D - - + + G @@ -50,16 +50,16 @@ T - + - + g : T - - + + H @@ -67,18 +67,18 @@ T,P - + - + h : G<T> - + - + hh : P diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 8024a355..9e01b57e 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,59 +9,59 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - + + + + + + + + add(int,int) - + wrap_add3(int,int,int) - + add3(int,int,int) - + @@ -72,7 +72,7 @@ - + @@ -81,14 +81,14 @@ - + log_result(int) - + Main test function diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index e52d0395..5fa454fb 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1() - + m1() - - + + m2() - + m2() - - + + m3() - + m3() - - + + m4() - + m4() - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 08fd6ba3..a24732b3 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1<T>(T) - + m1<T>(T) - - + + m2<T>(T) - + m2<T>(T) - - + + m3<T>(T) - + m3<T>(T) - - + + m4<T>(T) - + m4<T>(T) - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index 3da93cb2..fd57b6f7 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,87 +29,87 @@ - - + + main() - + main() - - + + m1<float>(float) - + m1<float>(float) - - + + m1<unsigned long>(unsigned long) - + m1<unsigned long>(unsigned long) - - + + m4<unsigned long>(unsigned long) - + m4<unsigned long>(unsigned long) - - + + m1<std::string>(std::string) - + m1<std::string>(std::string) - - + + m2<std::string>(std::string) - + m2<std::string>(std::string) - - + + m1<int>(int) - + m1<int>(int) - - + + m2<int>(int) - + m2<int>(int) - - + + m3<int>(int) - + m3<int>(int) - - + + m4<int>(int) - + m4<int>(int) - - - - - - - - - - - + + + + + + + + + + + - + - + @@ -117,11 +117,11 @@ - + - + @@ -129,19 +129,19 @@ - + - + - + - + diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index b6a19df1..e6ecf1ba 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - + + + - - + + C<T> - + C<T> - - + + B<T> - + B<T> - - + + A<T> - + A<T> - - - + + + c(T) - + b(T) - + a(T) diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index e2ce9975..01f4bdf4 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,82 +34,82 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + BB<int,int> - + BB<int,int> - - + + AA<int> - + AA<int> - - + + BB<int,std::string> - + BB<int,std::string> - - + + BB<int,float> - + BB<int,float> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + b(int) - + a1(int) @@ -118,12 +118,12 @@ - + b(std::string) - + a2(std::string) @@ -132,59 +132,59 @@ - + bb1(int,int) - + aa1(int) - + bb2(int,int) - + aa2(int) - + bb1(int,std::string) - + aa2(int) - + bb2(int,std::string) - + aa1(int) - + bb1(int,float) - + bb2(int,float) - + aa2(int) diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index 4169b102..931fac7a 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + Adder<int,int> - + Adder<int,int> - - + + Adder<int,float,double> - + Adder<int,float,double> - - + + Adder<std::string,std::string,std::string> - + Adder<std::string,std::string,std::string> - - - - - + + + + + add(int &&,int &&) - + add(int &&,float &&,double &&) - + add(std::string &&,std::string &&,std::string &&) diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index fe39916f..90eb3492 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<const char *> - + B<const char *> - - + + A<const char *> - + A<const char *> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - - - - - - - + + + + + + + + b(int) - + a1(int) - + b(const char *) - + a2(const char *) - + b(std::string) - + a3(std::string) diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index be562b57..ddf296cb 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<float> - + B<float> - - + + A<float> - + A<float> - - - - - - - - + + + + + + + + b(std::string) - + a(std::string) - + b(int) - + a(int) - + b(float) - + a(float) diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index 85437afb..020e4ec8 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A - + A - - - - - - - - - - + + + + + + + + + + b1() - + a1() - + b2() - + a2() - + b3() - + a3() - + b4() - + a4() diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 005b04ff..13bf80a0 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - + + + + + + + + + + a(int) @@ -52,26 +52,26 @@ alt - + a(int) - + b(int) - + c(int) - + @@ -81,14 +81,14 @@ alt - + b(int) - + @@ -98,7 +98,7 @@ alt - + diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index 4c2ca213..33bc84c6 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -43,122 +43,122 @@ - - + + tmain() - + tmain() - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - - + + D - + D - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -167,67 +167,67 @@ - + operator()() - + c() - + cc() - + ccc() - + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -238,29 +238,29 @@ - + r() - + operator()() - + c() - + cc() - + @@ -269,7 +269,7 @@ - + add5(int) diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index 88a2ad61..7fb367d9 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -58,12 +58,12 @@ - + b(double) - + a2(double) @@ -72,12 +72,12 @@ - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index bb3fd4b8..40796222 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - - - - - - - + + + + + + + + - - + + tmain() - + tmain() - - + + B - + B - - + + A - + A - - + + C<B,int> - + C<B,int> - - - - - - - - - + + + + + + + + + b1(int,int) - + a1(int,int) @@ -67,12 +67,12 @@ - + b2(int,int) - + a2(int,int) @@ -81,17 +81,17 @@ - + c1(int,int) - + b1(int,int) - + a1(int,int) diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index 6dbd3664..e77a03e3 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + B - + B - - - + + + setup_a(std::shared_ptr<detail::A> &) diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index ff5e8948..a75b3c5a 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - - - - + + + + + - - + + tmain() - + tmain() - - + + B<long> - + B<long> - - + + A - + A - - - - - - + + + + + + b1(long) - + a1(int) - + b2(long) - + a2(const long &) diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index 07bc69f9..86e801c7 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,65 +9,65 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_a.h - + include/t20017_a.h - + include/t20017_b.h - + include/t20017_b.h - - - - - - + + + + + + tmain() - + a3(int,int) - + b1(int,int) - + a2(int,int) - + a1(int,int) - + b2<int>(int,int) diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index a71306a6..dcec0e02 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + @@ -25,93 +25,93 @@ - - + + tmain() - + tmain() - - + + Answer<Factorial<5>,120> - + Answer<Factorial<5>,120> - - + + Factorial<5> - + Factorial<5> - - + + Factorial<4> - + Factorial<4> - - + + Factorial<3> - + Factorial<3> - - + + Factorial<2> - + Factorial<2> - - + + Factorial<1> - + Factorial<1> - - + + Factorial<0> - + Factorial<0> - - - - - - - - - + + + + + + + + + print() - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg index 9c1382df..34c8e115 100644 --- a/docs/test_cases/t20019_sequence.svg +++ b/docs/test_cases/t20019_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + Base<D1> - + Base<D1> - - + + D1 - + D1 - - + + Base<D2> - + Base<D2> - - + + D2 - + D2 - - - - - - - - - - + + + + + + + + + + name() - + impl() - + name() - + impl() - + name() - + impl() - + name() - + impl() diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index a4f9a97a..0d520991 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,78 +9,78 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + C - + C - - + + B - + B - - + + D<int> - + D<int> - - - - - - - - - - - - - + + + + + + + + + + + + + alt - + a1() @@ -91,7 +91,7 @@ alt - + [ @@ -100,7 +100,7 @@ - + [ @@ -109,7 +109,7 @@ - + b1() @@ -117,7 +117,7 @@ - + [ @@ -126,21 +126,21 @@ - + b2() - + a4() - + log() @@ -148,7 +148,7 @@ alt - + c1() @@ -156,7 +156,7 @@ alt - + @@ -169,7 +169,7 @@ - + @@ -179,7 +179,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index 97c1d22d..a26edf43 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + C - + C - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + loop - + [ c4() ] - + @@ -89,7 +89,7 @@ - + a3() @@ -102,7 +102,7 @@ loop - + [ @@ -111,7 +111,7 @@ - + [ @@ -120,7 +120,7 @@ - + [ @@ -129,14 +129,14 @@ - + a1() - + [ @@ -148,7 +148,7 @@ loop - + b2() @@ -158,7 +158,7 @@ loop - + [ @@ -167,7 +167,7 @@ - + b2() diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index f8a2d45c..65d0dfe3 100644 --- a/docs/test_cases/t20022_sequence.svg +++ b/docs/test_cases/t20022_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - + + + + a() - + b() diff --git a/docs/test_cases/t20023_sequence.svg b/docs/test_cases/t20023_sequence.svg index 7867304a..5f7368e5 100644 --- a/docs/test_cases/t20023_sequence.svg +++ b/docs/test_cases/t20023_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - + + + + + + + a() @@ -47,7 +47,7 @@ try - + @@ -60,7 +60,7 @@ [std::runtime_error &] - + @@ -73,7 +73,7 @@ [std::logic_error &] - + @@ -86,7 +86,7 @@ [...] - + diff --git a/docs/test_cases/t20024_sequence.svg b/docs/test_cases/t20024_sequence.svg index 6ca2e536..3cd09910 100644 --- a/docs/test_cases/t20024_sequence.svg +++ b/docs/test_cases/t20024_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -33,36 +33,36 @@ - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + select(enum_a) @@ -72,7 +72,7 @@ switch [zero] - + @@ -85,7 +85,7 @@ [one] - + @@ -98,7 +98,7 @@ [two] - + @@ -111,7 +111,7 @@ [default] - + @@ -124,7 +124,7 @@ - + select(colors) @@ -134,7 +134,7 @@ switch [enum colors::red] - + @@ -143,7 +143,7 @@ [enum colors::orange] - + @@ -152,7 +152,7 @@ [enum colors::green] - + @@ -161,7 +161,7 @@ [default] - + diff --git a/docs/test_cases/t20025_sequence.svg b/docs/test_cases/t20025_sequence.svg index 69e1f3c0..0d6e5f21 100644 --- a/docs/test_cases/t20025_sequence.svg +++ b/docs/test_cases/t20025_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,41 +9,41 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + add(int,int) - + add(int,int) - - - - - + + + + + a() - + @@ -52,7 +52,7 @@ - + diff --git a/docs/test_cases/t20026_sequence.svg b/docs/test_cases/t20026_sequence.svg index d13b1f60..d8b230d7 100644 --- a/docs/test_cases/t20026_sequence.svg +++ b/docs/test_cases/t20026_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20027_sequence.svg b/docs/test_cases/t20027_sequence.svg index 8b990f47..06d3dc7e 100644 --- a/docs/test_cases/t20027_sequence.svg +++ b/docs/test_cases/t20027_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20028_sequence.svg b/docs/test_cases/t20028_sequence.svg index dcf30978..d5d0402d 100644 --- a/docs/test_cases/t20028_sequence.svg +++ b/docs/test_cases/t20028_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - - - - - + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - + + + + + alt - + a() - + b() - + c() @@ -60,7 +60,7 @@ - + d() diff --git a/docs/test_cases/t20029_sequence.svg b/docs/test_cases/t20029_sequence.svg index 097b0f5b..3cb2fc4a 100644 --- a/docs/test_cases/t20029_sequence.svg +++ b/docs/test_cases/t20029_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,60 +9,60 @@ - - - - - - - - - - - + + + + + + + + + + + - - + + tmain() - + tmain() - - + + Encoder<Retrier<ConnectionPool>> - + Encoder<Retrier<ConnectionPool>> - - + + Retrier<ConnectionPool> - + Retrier<ConnectionPool> - - + + ConnectionPool - + ConnectionPool - - + + encode_b64(std::string &&) - + encode_b64(std::string &&) - - - - - - - - + + + + + + + + connect() @@ -73,21 +73,21 @@ alt - + [ send(std::string &&) ] - + encode(std::string &&) - + @@ -97,7 +97,7 @@ - + send(std::string &&) @@ -108,7 +108,7 @@ alt - + [ diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 488bc0c0..021a78a6 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + A - - + + AA - - + + B - - + + AA - - + + AAA - - + + BBB - - + + BB - - + + AAA - - + + BBB - - + + BB - + A AAA note... - + This is namespace AA in namespace A - + This is namespace AA in namespace B diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg index 0f17e920..48d097b8 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index c90ac142..a216c1b2 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,35 @@ - - + + ns1 - - + + ns3 «deprecated» - - + + ns1 - - + + ns2_v1_0_0 - - + + ns2_v0_9_0 «deprecated» - - + + ns2 diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg index 1ae63f41..7c0f42ba 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 34e1730a..a4e5785d 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,48 +9,48 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + C - - + + CC - - + + AAA - - + + BBB - - + + CCC diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg index 6baefa85..8e55e359 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 89f827d2..96a79144 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index eadffcfd..fca2649e 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F diff --git a/docs/test_cases/t30009_package.svg b/docs/test_cases/t30009_package.svg index acfd0c3a..6ea3a7db 100644 --- a/docs/test_cases/t30009_package.svg +++ b/docs/test_cases/t30009_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + One - - + + Two - - + + B - - + + D - - + + A - - + + C - - + + A - - + + B - - + + C - - + + D diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 5604c381..4d50cc51 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + yaml-cpp/yaml.h - + This is a lib1 include dir - + This is a t40001_include1.h include file diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index d07f7835..ab86090c 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - + src - + lib1 - + lib2 - + include - + lib1 - + lib2 - - + + t40002.cc - - + + lib1.cc - - + + lib2.cc - - + + lib1.h - - + + lib2.h diff --git a/docs/test_cases/t40003_include.svg b/docs/test_cases/t40003_include.svg index c8c3447c..6719d62d 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + src - + dependants - + dependencies - + include - + dependants - + dependencies - - + + t1.cc - - + + t2.cc - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h From f0497e934dfd8292c1cd1772d389131196a7fd2d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 19 Mar 2023 18:29:45 +0100 Subject: [PATCH 12/30] First working version of JSON sequence diagram generator --- README.md | 2 +- .../json/class_diagram_generator.cc | 56 +- .../generators/json/class_diagram_generator.h | 4 +- src/common/generators/generators.h | 1 + src/common/generators/json/generator.cc | 72 +++ src/common/generators/json/generator.h | 12 + src/common/model/enums.cc | 13 + src/common/model/enums.h | 2 + .../json/sequence_diagram_generator.cc | 546 ++++++++++++++++++ .../json/sequence_diagram_generator.h | 81 +++ .../plantuml/sequence_diagram_generator.cc | 4 + tests/t20001/test_case.h | 16 + tests/t20002/test_case.h | 6 + tests/t20003/test_case.h | 6 + tests/t20004/test_case.h | 6 + tests/t20005/test_case.h | 6 + tests/t20006/test_case.h | 6 + tests/t20007/test_case.h | 6 + tests/t20008/test_case.h | 6 + tests/t20009/test_case.h | 6 + tests/t20010/test_case.h | 6 + tests/t20011/test_case.h | 6 + tests/t20012/test_case.h | 6 + tests/t20013/test_case.h | 6 + tests/t20014/test_case.h | 6 + tests/t20015/test_case.h | 6 + tests/t20016/test_case.h | 6 + tests/t20017/test_case.h | 6 + tests/t20018/test_case.h | 6 + tests/t20019/test_case.h | 6 + tests/t20020/test_case.h | 6 + tests/t20021/test_case.h | 6 + tests/t20022/test_case.h | 6 + tests/t20023/test_case.h | 6 + tests/t20024/test_case.h | 6 + tests/t20025/test_case.h | 6 + tests/t20026/test_case.h | 6 + tests/t20027/test_case.h | 6 + tests/t20028/test_case.h | 6 + tests/t20029/test_case.h | 227 ++++++++ tests/test_cases.cc | 14 + util/generate_test_cases_docs.py | 9 + 42 files changed, 1165 insertions(+), 56 deletions(-) create mode 100644 src/common/generators/json/generator.cc create mode 100644 src/sequence_diagram/generators/json/sequence_diagram_generator.cc create mode 100644 src/sequence_diagram/generators/json/sequence_diagram_generator.h diff --git a/README.md b/README.md index d7c58db6..a0126b87 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ YAML configuration files. The main idea behind the project is to easily maintain up-to-date diagrams within a code-base or document legacy code. The configuration file or files for `clang-uml` define the type and contents of each generated diagram. -Currently, the diagrams are generated in [PlantUML](https://plantuml.com) format. +Currently, the diagrams are generated in [PlantUML](https://plantuml.com) and JSON formats. `clang-uml` currently supports C++ up to version 17 and partial support for C++ 20. diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index a4b889fe..50be3967 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -20,59 +20,6 @@ #include "util/error.h" -namespace clanguml::common::model { -using nlohmann::json; - -void to_json(nlohmann::json &j, const source_location &sl) -{ - j = json{{"file", sl.file_relative()}, {"line", sl.line()}}; -} - -void to_json(nlohmann::json &j, const element &c) -{ - j = json{{"id", std::to_string(c.id())}, {"name", c.name()}, - {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()}, - {"display_name", c.full_name(false)}}; - - if (const auto &comment = c.comment(); comment) - j["comment"] = comment.value(); - - if (!c.file().empty()) { - j["source_location"] = - dynamic_cast(c); - } -} - -void to_json(nlohmann::json &j, const template_parameter &c) -{ - j["kind"] = to_string(c.kind()); - if (c.type()) - j["type"] = c.type().value(); - if (c.name()) - j["name"] = c.name().value(); - if (c.default_value()) - j["default"] = c.default_value().value(); - j["is_variadic"] = c.is_variadic(); -} - -void to_json(nlohmann::json &j, const relationship &c) -{ - j["type"] = to_string(c.type()); - j["destination"] = std::to_string(c.destination()); - if (!c.multiplicity_source().empty()) - j["multiplicity_source"] = c.multiplicity_source(); - if (!c.multiplicity_destination().empty()) - j["multiplicity_destination"] = c.multiplicity_destination(); - if (c.access() != access_t::kNone) - j["access"] = to_string(c.access()); - if (!c.label().empty()) - j["label"] = c.label(); - if (const auto &comment = c.comment(); comment) - j["comment"] = comment.value(); -} - -} // namespace clanguml::common::model - namespace clanguml::class_diagram::model { using nlohmann::json; void to_json(nlohmann::json &j, const class_element &c) @@ -170,6 +117,9 @@ void generator::generate(std::ostream &ostr) const generate_relationships(json_); + json_["name"] = m_model.name(); + json_["diagram_type"] = "class"; + ostr << json_; } diff --git a/src/class_diagram/generators/json/class_diagram_generator.h b/src/class_diagram/generators/json/class_diagram_generator.h index 30f51f5b..ef29a680 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.h +++ b/src/class_diagram/generators/json/class_diagram_generator.h @@ -60,6 +60,8 @@ class generator : public common_generator { public: generator(diagram_config &config, diagram_model &model); + void generate(std::ostream &ostr) const override; + void generate(const class_ &c, nlohmann::json &parent) const; void generate(const enum_ &c, nlohmann::json &parent) const; @@ -70,8 +72,6 @@ public: void generate_top_level_elements(nlohmann::json &parent) const; - void generate(std::ostream &ostr) const override; - void generate_relationships(nlohmann::json &parent) const; void generate_relationships(const class_ &c, nlohmann::json &parent) const; diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h index 8cf7874a..67d924ad 100644 --- a/src/common/generators/generators.h +++ b/src/common/generators/generators.h @@ -25,6 +25,7 @@ #include "config/config.h" #include "include_diagram/generators/plantuml/include_diagram_generator.h" #include "package_diagram/generators/plantuml/package_diagram_generator.h" +#include "sequence_diagram/generators/json/sequence_diagram_generator.h" #include "sequence_diagram/generators/plantuml/sequence_diagram_generator.h" #include "util/util.h" #include "version.h" diff --git a/src/common/generators/json/generator.cc b/src/common/generators/json/generator.cc new file mode 100644 index 00000000..b02f8710 --- /dev/null +++ b/src/common/generators/json/generator.cc @@ -0,0 +1,72 @@ +/** + * src/common/generators/json/generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "generator.h" + +namespace clanguml::common::model { +using nlohmann::json; + +void to_json(nlohmann::json &j, const source_location &sl) +{ + j = json{{"file", sl.file_relative()}, {"line", sl.line()}}; +} + +void to_json(nlohmann::json &j, const element &c) +{ + j = json{{"id", std::to_string(c.id())}, {"name", c.name()}, + {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()}, + {"display_name", c.full_name(false)}}; + + if (const auto &comment = c.comment(); comment) + j["comment"] = comment.value(); + + if (!c.file().empty()) { + j["source_location"] = + dynamic_cast(c); + } +} + +void to_json(nlohmann::json &j, const template_parameter &c) +{ + j["kind"] = to_string(c.kind()); + if (c.type()) + j["type"] = c.type().value(); + if (c.name()) + j["name"] = c.name().value(); + if (c.default_value()) + j["default"] = c.default_value().value(); + j["is_variadic"] = c.is_variadic(); +} + +void to_json(nlohmann::json &j, const relationship &c) +{ + j["type"] = to_string(c.type()); + j["destination"] = std::to_string(c.destination()); + if (!c.multiplicity_source().empty()) + j["multiplicity_source"] = c.multiplicity_source(); + if (!c.multiplicity_destination().empty()) + j["multiplicity_destination"] = c.multiplicity_destination(); + if (c.access() != access_t::kNone) + j["access"] = to_string(c.access()); + if (!c.label().empty()) + j["label"] = c.label(); + if (const auto &comment = c.comment(); comment) + j["comment"] = comment.value(); +} + +} // namespace clanguml::common::model diff --git a/src/common/generators/json/generator.h b/src/common/generators/json/generator.h index 0a542edb..0d2f143d 100644 --- a/src/common/generators/json/generator.h +++ b/src/common/generators/json/generator.h @@ -29,6 +29,18 @@ #include +namespace clanguml::common::model { +using nlohmann::json; + +void to_json(nlohmann::json &j, const source_location &sl); + +void to_json(nlohmann::json &j, const element &c); + +void to_json(nlohmann::json &j, const template_parameter &c); + +void to_json(nlohmann::json &j, const relationship &c); +} // namespace clanguml::common::model + namespace clanguml::common::generators::json { using clanguml::common::model::access_t; diff --git a/src/common/model/enums.cc b/src/common/model/enums.cc index 3dfab613..d321102c 100644 --- a/src/common/model/enums.cc +++ b/src/common/model/enums.cc @@ -136,6 +136,19 @@ std::string to_string(const diagram_t t) } } +std::string to_string(const message_scope_t t) +{ + switch (t) { + case message_scope_t::kNormal: + return "normal"; + case message_scope_t::kCondition: + return "condition"; + default: + assert(false); + return ""; + } +} + diagram_t from_string(const std::string &s) { if (s == "class") diff --git a/src/common/model/enums.h b/src/common/model/enums.h index 3ec183c4..633a236f 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -80,6 +80,8 @@ std::string to_string(message_t m); std::string to_string(diagram_t r); +std::string to_string(message_scope_t); + diagram_t from_string(const std::string &s); } // namespace clanguml::common::model diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc new file mode 100644 index 00000000..1313d150 --- /dev/null +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -0,0 +1,546 @@ +/** + * src/sequence_diagram/generators/json/sequence_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "sequence_diagram_generator.h" + +namespace clanguml::sequence_diagram::model { +using nlohmann::json; + +void to_json(nlohmann::json &j, const participant &c) +{ + j["name"] = c.full_name(false); + j["id"] = std::to_string(c.id()); + j["type"] = c.type_name(); + if (!c.file().empty()) + j["source_location"] = + dynamic_cast(c); + if (const auto &comment = c.comment(); comment) + j["comment"] = comment.value(); +} + +void to_json(nlohmann::json &j, const activity &c) +{ + j["participant_id"] = std::to_string(c.from()); +} + +} // namespace clanguml::class_diagram::model + +namespace clanguml::sequence_diagram::generators::json { + +using clanguml::common::model::message_t; +using clanguml::config::location_t; +using clanguml::sequence_diagram::model::activity; +using clanguml::sequence_diagram::model::message; +using namespace clanguml::util; + +// +// generator +// + +generator::generator( + clanguml::config::sequence_diagram &config, diagram_model &model) + : common_generator{config, model} +{ +} + +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(m.from()); + const auto &to = m_model.get_participant(m.to()); + + if (!from || !to) { + LOG_DBG("Skipping empty call from '{}' to '{}'", m.from(), m.to()); + return; + } + + generate_participant(json_, m.from()); + generate_participant(json_, m.to()); + + std::string message; + + model::function::message_render_mode render_mode = + model::function::message_render_mode::full; + + if (to.value().type_name() == "method") { + message = dynamic_cast(to.value()) + .message_name(render_mode); + } + else if (m_config.combine_free_functions_into_file_participants()) { + if (to.value().type_name() == "function") { + message = dynamic_cast(to.value()) + .message_name(render_mode); + } + else if (to.value().type_name() == "function_template") { + message = dynamic_cast(to.value()) + .message_name(render_mode); + } + } + // + // const std::string from_alias = generate_alias(from.value()); + // const std::string to_alias = generate_alias(to.value()); + + nlohmann::json msg; + + msg["name"] = message; + msg["type"] = "message"; + msg["from"]["name"] = from.value().full_name(false); + msg["from"]["id"] = std::to_string(from.value().id()); + msg["to"]["activity_id"] = std::to_string(to.value().id()); + msg["to"]["activity_name"] = to.value().full_name(false); + + if (to.value().type_name() == "method") { + const auto &class_participant = + m_model.get_participant(to.value().id()).value(); + msg["to"]["participant_id"] = + std::to_string(class_participant.class_id()); + msg["to"]["participant_name"] = + m_model.get_participant(class_participant.class_id()) + .value() + .full_name(false); + } + else if (to.value().type_name() == "function" && + m_config.combine_free_functions_into_file_participants()) { + const auto &file_participant = + m_model.get_participant(to.value().id()).value(); + msg["to"]["participant_id"] = + std::to_string(common::to_id(file_participant.file())); + msg["to"]["participant_name"] = file_participant.file_relative(); + } + + msg["source_location"] = + dynamic_cast(m); + + msg["scope"] = to_string(m.message_scope()); + msg["return_type"] = m.return_type(); + + parent["messages"].push_back(std::move(msg)); + + LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, + m.from(), to, m.to()); +} + +void generator::generate_activity( + common::model::diagram_element::id_t activity_id, const activity &a, + nlohmann::json &unused, + std::vector &visited, + std::optional nested_block) const +{ + // Generate calls from this activity to other activities + for (const auto &m : a.messages()) { + if (m.type() == message_t::kCall) { + const auto &to = + m_model.get_participant(m.to()); + if (!to || to.value().skip()) + continue; + + visited.push_back(m.from()); + + LOG_DBG("Generating message {} --> {}", m.from(), m.to()); + + generate_call(m, current_block_statement()); + + if (m_model.sequences().find(m.to()) != m_model.sequences().end()) { + if (std::find(visited.begin(), visited.end(), m.to()) == + visited + .end()) { // break infinite recursion on recursive calls + + LOG_DBG("Creating activity {} --> {} - missing sequence {}", + m.from(), m.to(), m.to()); + + generate_activity(m.to(), m_model.get_activity(m.to()), + current_block_statement(), visited, {}); + } + } + else + LOG_DBG("Skipping activity {} --> {} - missing sequence {}", + m.from(), m.to(), m.to()); + } + else if (m.type() == message_t::kIf) { + nlohmann::json if_block; + if_block["type"] = "alt"; + if_block["name"] = "if"; + if_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back( + std::move(if_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + + nlohmann::json branch; + branch["type"] = "consequent"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); + } + else if (m.type() == message_t::kElseIf || + m.type() == message_t::kElse) { + // remove previous branch from the stack + block_statements_stack_.pop_back(); + + nlohmann::json branch; + branch["type"] = "alternative"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); + } + else if (m.type() == message_t::kIfEnd) { + // Remove last if branch from the stack + block_statements_stack_.pop_back(); + + // Remove the if statement block from the stack + block_statements_stack_.pop_back(); + } + else if (m.type() == message_t::kWhile) { + nlohmann::json while_block; + while_block["type"] = "loop"; + while_block["name"] = "while"; + while_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back( + std::move(while_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + } + else if (m.type() == message_t::kWhileEnd) { + // Remove the while statement block from the stack + block_statements_stack_.pop_back(); + } + else if (m.type() == message_t::kFor) { + nlohmann::json for_block; + for_block["type"] = "loop"; + for_block["name"] = "for"; + for_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back( + std::move(for_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + } + else if (m.type() == message_t::kForEnd) { + // Remove the while statement block from the stack + block_statements_stack_.pop_back(); + } + else if (m.type() == message_t::kDo) { + nlohmann::json do_block; + do_block["type"] = "loop"; + do_block["name"] = "do"; + do_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back( + std::move(do_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + } + else if (m.type() == message_t::kDoEnd) { + // Remove the do statement block from the stack + block_statements_stack_.pop_back(); + } + else if (m.type() == message_t::kTry) { + nlohmann::json try_block; + try_block["type"] = "break"; + try_block["name"] = "try"; + try_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back( + std::move(try_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + + nlohmann::json branch; + branch["type"] = "main"; + current_block_statement()["blocks"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["blocks"].back())); + } + else if (m.type() == message_t::kCatch) { + // remove previous block from the stack + block_statements_stack_.pop_back(); + + nlohmann::json branch; + branch["type"] = "catch"; + current_block_statement()["blocks"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["blocks"].back())); + } + else if (m.type() == message_t::kTryEnd) { + // Remove last if block from the stack + block_statements_stack_.pop_back(); + + // Remove the try statement block from the stack + block_statements_stack_.pop_back(); + } + else if (m.type() == message_t::kSwitch) { + nlohmann::json if_block; + if_block["type"] = "alt"; + if_block["name"] = "switch"; + if_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back( + std::move(if_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + } + else if (m.type() == message_t::kCase) { + if (current_block_statement()["type"] == "case") + block_statements_stack_.pop_back(); + + nlohmann::json case_block; + case_block["type"] = "case"; + case_block["name"] = m.message_name(); + current_block_statement()["cases"].push_back(std::move(case_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["cases"].back())); + } + else if (m.type() == message_t::kSwitchEnd) { + // Remove last case block from the stack + block_statements_stack_.pop_back(); + + // Remove the switch statement block from the stack + block_statements_stack_.pop_back(); + } + else if (m.type() == message_t::kConditional) { + nlohmann::json if_block; + if_block["type"] = "alt"; + if_block["name"] = "conditional"; + if_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back( + std::move(if_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + + nlohmann::json branch; + branch["type"] = "consequent"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); + } + else if (m.type() == message_t::kElse) { + // remove previous branch from the stack + block_statements_stack_.pop_back(); + + nlohmann::json branch; + branch["type"] = "alternative"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); + } + else if (m.type() == message_t::kConditionalEnd) { + // Remove last if branch from the stack + block_statements_stack_.pop_back(); + + // Remove the if statement block from the stack + block_statements_stack_.pop_back(); + } + else { + // Unhandled message_t case + assert(false); + } + } +} + +void generator::generate_participant( + nlohmann::json &parent, const std::string &name) const +{ + auto p = m_model.get(name); + + if (!p.has_value()) { + LOG_WARN("Cannot find participant {} from `participants_order` option", + name); + return; + } + + generate_participant(parent, p.value().id(), true); +} + +common::id_t generator::generate_participant( + nlohmann::json &parent, common::id_t id, bool force) const +{ + common::id_t participant_id{0}; + + if (!force) { + for (const auto pid : m_model.active_participants()) { + if (pid == id) { + participant_id = pid; + break; + } + } + } + else + participant_id = id; + + if (participant_id == 0) + return participant_id; + + if (is_participant_generated(participant_id)) + return participant_id; + + const auto &participant = + m_model.get_participant(participant_id).value(); + + if (participant.type_name() == "method") { + const auto class_id = + m_model.get_participant(participant_id) + .value() + .class_id(); + + if (is_participant_generated(class_id)) + return participant_id; + + const auto &class_participant = + m_model.get_participant(class_id).value(); + + parent["participants"].push_back(class_participant); + + generated_participants_.emplace(class_id); + } + else if ((participant.type_name() == "function" || + participant.type_name() == "function_template") && + m_config.combine_free_functions_into_file_participants()) { + // Create a single participant for all functions declared in a + // single file + const auto &function_participant = + m_model.get_participant(participant_id).value(); + + parent["participants"].push_back(function_participant); + + generated_participants_.emplace( + common::to_id(function_participant.file())); + } + else { + parent["participants"].push_back(participant); + + generated_participants_.emplace(participant_id); + } + + return participant_id; +} + +bool generator::is_participant_generated(common::id_t id) const +{ + return std::find(generated_participants_.begin(), + generated_participants_.end(), + id) != generated_participants_.end(); +} + +void generator::generate(std::ostream &ostr) const +{ + m_model.print(); + + json_["name"] = m_model.name(); + json_["diagram_type"] = "sequence"; + if (m_config.using_namespace) + json_["using_namespace"] = m_config.using_namespace().to_string(); + + if (m_config.participants_order.has_value) { + for (const auto &p : m_config.participants_order()) { + LOG_DBG("Pregenerating participant {}", p); + generate_participant(json_, p); + } + } + + for (const auto &sf : m_config.start_from()) { + if (sf.location_type == location_t::function) { + common::model::diagram_element::id_t start_from{0}; + std::string start_from_str; + for (const auto &[k, v] : m_model.sequences()) { + const auto &caller = *m_model.participants().at(v.from()); + std::string vfrom = caller.full_name(false); + if (vfrom == sf.location) { + LOG_DBG("Found sequence diagram start point: {}", k); + start_from = k; + break; + } + } + + if (start_from == 0) { + LOG_WARN("Failed to find participant with {} for start_from " + "condition", + sf.location); + continue; + } + + // Use this to break out of recurrent loops + std::vector + visited_participants; + + const auto &from = + m_model.get_participant(start_from); + + if (!from.has_value()) { + LOG_WARN("Failed to find participant {} for start_from " + "condition", + sf.location); + continue; + } + + generate_participant(json_, start_from); + + [[maybe_unused]] model::function::message_render_mode render_mode = + model::function::message_render_mode::full; + + nlohmann::json sequence; + sequence["start_from"]["location"] = sf.location; + sequence["start_from"]["id"] = start_from; + + block_statements_stack_.push_back(std::ref(sequence)); + + generate_activity(start_from, m_model.get_activity(start_from), + sequence, visited_participants, {}); + + json_["sequences"].push_back(std::move(sequence)); + + block_statements_stack_.pop_back(); + + if (from.value().type_name() == "method" || + m_config.combine_free_functions_into_file_participants()) { + + // TODO + // sequence["return_type"] = from.value().id() + } + } + else { + // TODO: Add support for other sequence start location types + continue; + } + } + + ostr << json_; +} +} // namespace clanguml::sequence_diagram::generators::plantuml diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.h b/src/sequence_diagram/generators/json/sequence_diagram_generator.h new file mode 100644 index 00000000..bb383b0c --- /dev/null +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.h @@ -0,0 +1,81 @@ +/** + * src/sequence_diagram/generators/json/sequence_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "common/generators/json/generator.h" +#include "config/config.h" +#include "sequence_diagram/model/diagram.h" +#include "util/util.h" + +#include + +#include +#include +#include +#include +#include + +namespace clanguml::sequence_diagram::generators::json { + +using diagram_config = clanguml::config::sequence_diagram; +using diagram_model = clanguml::sequence_diagram::model::diagram; + +template +using common_generator = clanguml::common::generators::json::generator; + +class generator : public common_generator { +public: + generator(diagram_config &config, diagram_model &model); + + void generate_call(const sequence_diagram::model::message &m, + nlohmann::json &parent) const; + + common::id_t generate_participant( + nlohmann::json &parent, common::id_t id, bool force = false) const; + + void generate_participant( + nlohmann::json &parent, const std::string &name) const; + + void generate_activity(common::model::diagram_element::id_t activity_id, + const sequence_diagram::model::activity &a, nlohmann::json &parent, + std::vector &visited, + std::optional nested_block) const; + + void generate(std::ostream &ostr) const override; + + nlohmann::json ¤t_block_statement() const + { + assert(!block_statements_stack_.empty()); + + return block_statements_stack_.back().get(); + } + +private: + bool is_participant_generated(common::id_t id) const; + + std::string render_name(std::string name) const; + + mutable std::set generated_participants_; + + mutable nlohmann::json json_; + + mutable std::vector> + block_statements_stack_; +}; + +} // namespace clanguml::sequence_diagram::generators::json diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 0695d68d..a0a3b5bc 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -433,6 +433,10 @@ void generator::generate(std::ostream &ostr) const render_mode = model::function::message_render_mode::no_arguments; + // For methods or functions in diagrams where they are combined into + // file participants, we need to add an 'entry' point call to know + // which method relates to the first activity for this 'start_from' + // condition if (from.value().type_name() == "method" || m_config.combine_free_functions_into_file_participants()) { ostr << "[->" diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index b14e887a..19d1694d 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -47,4 +47,20 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE_THAT(puml, HasComment("t20001 test diagram of type sequence")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + REQUIRE(j["participants"][0]["name"] == "clanguml::t20001::tmain()"); + REQUIRE(j["participants"][1]["name"] == "clanguml::t20001::A"); + REQUIRE(j["participants"][2]["name"] == "clanguml::t20001::B"); + + auto &messages = j["sequences"][0]["messages"]; + REQUIRE(messages[0]["name"] == "add(int,int)"); + REQUIRE(messages[1]["name"] == "wrap_add3(int,int,int)"); + REQUIRE(messages[2]["name"] == "add3(int,int,int)"); + REQUIRE(messages[3]["name"] == "add(int,int)"); + REQUIRE(messages[4]["name"] == "__log_result(int)__"); + REQUIRE(messages[5]["name"] == "__log_result(int)__"); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t20002/test_case.h b/tests/t20002/test_case.h index 39e7a1dd..1008c217 100644 --- a/tests/t20002/test_case.h +++ b/tests/t20002/test_case.h @@ -39,4 +39,10 @@ TEST_CASE("t20002", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t20003/test_case.h b/tests/t20003/test_case.h index 46e3d2db..cbd0b78e 100644 --- a/tests/t20003/test_case.h +++ b/tests/t20003/test_case.h @@ -39,4 +39,10 @@ TEST_CASE("t20003", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("m3(T)"), _A("m4(T)"), "")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index de1ea0cd..14ff035a 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -57,4 +57,10 @@ TEST_CASE("t20004", "[test-case][sequence]") REQUIRE_THAT(puml, EndsWith("@enduml\n")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h index c5d65d87..3517260b 100644 --- a/tests/t20005/test_case.h +++ b/tests/t20005/test_case.h @@ -40,4 +40,10 @@ TEST_CASE("t20005", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(T)")); REQUIRE_THAT(puml, HasExitpoint(_A("C"))); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index 8280336f..534af040 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -70,4 +70,10 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20007/test_case.h b/tests/t20007/test_case.h index 504000cd..8a3d9fc3 100644 --- a/tests/t20007/test_case.h +++ b/tests/t20007/test_case.h @@ -45,4 +45,10 @@ TEST_CASE("t20007", "[test-case][sequence]") "add(std::string &&,std::string &&,std::string &&)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20008/test_case.h b/tests/t20008/test_case.h index 663de6f7..2ee3fc37 100644 --- a/tests/t20008/test_case.h +++ b/tests/t20008/test_case.h @@ -52,4 +52,10 @@ TEST_CASE("t20008", "[test-case][sequence]") HasCall(_A("B"), _A("A"), "a3(std::string)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20009/test_case.h b/tests/t20009/test_case.h index 97dd7f83..cc284870 100644 --- a/tests/t20009/test_case.h +++ b/tests/t20009/test_case.h @@ -46,4 +46,10 @@ TEST_CASE("t20009", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(float)")); REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(float)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20010/test_case.h b/tests/t20010/test_case.h index 613cfd44..6e01b636 100644 --- a/tests/t20010/test_case.h +++ b/tests/t20010/test_case.h @@ -48,4 +48,10 @@ TEST_CASE("t20010", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a4()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20011/test_case.h b/tests/t20011/test_case.h index 0fd58f8c..dd4f623e 100644 --- a/tests/t20011/test_case.h +++ b/tests/t20011/test_case.h @@ -44,4 +44,10 @@ TEST_CASE("t20011", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b(int)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index b47b0954..f76ba804 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -77,4 +77,10 @@ TEST_CASE("t20012", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20013/test_case.h b/tests/t20013/test_case.h index f661971e..5b92f91a 100644 --- a/tests/t20013/test_case.h +++ b/tests/t20013/test_case.h @@ -46,4 +46,10 @@ TEST_CASE("t20013", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20014/test_case.h b/tests/t20014/test_case.h index f7d7aeb9..85c13ba8 100644 --- a/tests/t20014/test_case.h +++ b/tests/t20014/test_case.h @@ -45,4 +45,10 @@ TEST_CASE("t20014", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b1(int,int)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20015/test_case.h b/tests/t20015/test_case.h index 0794f8b4..1bc01504 100644 --- a/tests/t20015/test_case.h +++ b/tests/t20015/test_case.h @@ -47,4 +47,10 @@ TEST_CASE("t20015", "[test-case][sequence]") REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_z(int)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20016/test_case.h b/tests/t20016/test_case.h index a2f2c3f5..03967382 100644 --- a/tests/t20016/test_case.h +++ b/tests/t20016/test_case.h @@ -42,4 +42,10 @@ TEST_CASE("t20016", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(const long &)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20017/test_case.h b/tests/t20017/test_case.h index b48821d2..101741ed 100644 --- a/tests/t20017/test_case.h +++ b/tests/t20017/test_case.h @@ -49,4 +49,10 @@ TEST_CASE("t20017", "[test-case][sequence]") REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc"))); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20018/test_case.h b/tests/t20018/test_case.h index 675441ef..82771236 100644 --- a/tests/t20018/test_case.h +++ b/tests/t20018/test_case.h @@ -52,4 +52,10 @@ TEST_CASE("t20018", "[test-case][sequence]") HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print(int)__")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20019/test_case.h b/tests/t20019/test_case.h index 73eb87a8..7276929f 100644 --- a/tests/t20019/test_case.h +++ b/tests/t20019/test_case.h @@ -41,4 +41,10 @@ TEST_CASE("t20019", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D2"), "impl()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20020/test_case.h b/tests/t20020/test_case.h index 21beae59..0c995955 100644 --- a/tests/t20020/test_case.h +++ b/tests/t20020/test_case.h @@ -51,4 +51,10 @@ TEST_CASE("t20020", "[test-case][sequence]") puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20021/test_case.h b/tests/t20021/test_case.h index 61e0c84f..5e68aea7 100644 --- a/tests/t20021/test_case.h +++ b/tests/t20021/test_case.h @@ -58,4 +58,10 @@ TEST_CASE("t20021", "[test-case][sequence]") puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "contents()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20022/test_case.h b/tests/t20022/test_case.h index 6a12c019..56c81b26 100644 --- a/tests/t20022/test_case.h +++ b/tests/t20022/test_case.h @@ -39,4 +39,10 @@ TEST_CASE("t20022", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("A"), _A("B"), "b()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20023/test_case.h b/tests/t20023/test_case.h index 71e3b0bc..9a66753a 100644 --- a/tests/t20023/test_case.h +++ b/tests/t20023/test_case.h @@ -42,4 +42,10 @@ TEST_CASE("t20023", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a4()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20024/test_case.h b/tests/t20024/test_case.h index 5c432062..e049cd0b 100644 --- a/tests/t20024/test_case.h +++ b/tests/t20024/test_case.h @@ -47,4 +47,10 @@ TEST_CASE("t20024", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "green()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20025/test_case.h b/tests/t20025/test_case.h index 3874cd53..b62945cb 100644 --- a/tests/t20025/test_case.h +++ b/tests/t20025/test_case.h @@ -42,4 +42,10 @@ TEST_CASE("t20025", "[test-case][sequence]") REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("add2(int,int)"), "")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20026/test_case.h b/tests/t20026/test_case.h index 934d8ad2..1fa56093 100644 --- a/tests/t20026/test_case.h +++ b/tests/t20026/test_case.h @@ -38,4 +38,10 @@ TEST_CASE("t20026", "[test-case][sequence]") REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20027/test_case.h b/tests/t20027/test_case.h index c8d807a6..410f86af 100644 --- a/tests/t20027/test_case.h +++ b/tests/t20027/test_case.h @@ -40,4 +40,10 @@ TEST_CASE("t20027", "[test-case][sequence]") REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aaa()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20028/test_case.h b/tests/t20028/test_case.h index 6d97fb09..da0c0e7e 100644 --- a/tests/t20028/test_case.h +++ b/tests/t20028/test_case.h @@ -42,4 +42,10 @@ TEST_CASE("t20028", "[test-case][sequence]") REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "e()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_sequence_json(diagram, *model); + + // REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20029/test_case.h b/tests/t20029/test_case.h index cc63df20..d6e54ee5 100644 --- a/tests/t20029/test_case.h +++ b/tests/t20029/test_case.h @@ -57,4 +57,231 @@ TEST_CASE("t20029", "[test-case][sequence]") !HasCall(_A("ConnectionPool"), _A("ConnectionPool"), "connect_impl()")); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + const std::string expected_json = R"###( +{ + "diagram_type": "sequence", + "name": "t20029_sequence", + "participants": [ + { + "id": "2091374738808319642", + "name": "clanguml::t20029::tmain()", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 55 + }, + "type": "function" + }, + { + "id": "1673261195873192383", + "name": "clanguml::t20029::Encoder>", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 11 + }, + "type": "class" + }, + { + "id": "658058855590948094", + "name": "clanguml::t20029::Retrier", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 22 + }, + "type": "class" + }, + { + "id": "1896406205097618937", + "name": "clanguml::t20029::ConnectionPool", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 39 + }, + "type": "class" + }, + { + "id": "1362646431260879440", + "name": "clanguml::t20029::encode_b64(std::string &&)", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 9 + }, + "type": "function" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "id": "2091374738808319642", + "name": "clanguml::t20029::tmain()" + }, + "name": "connect()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 59 + }, + "to": { + "activity_id": "940428568182104530", + "activity_name": "clanguml::t20029::ConnectionPool::connect()", + "participant_id": "1896406205097618937", + "participant_name": "clanguml::t20029::ConnectionPool" + }, + "type": "message" + }, + { + "activity_id": "2091374738808319642", + "messages": [ + { + "activity_id": "2091374738808319642", + "branches": [ + { + "messages": [ + { + "from": { + "id": "2091374738808319642", + "name": "clanguml::t20029::tmain()" + }, + "name": "send(std::string &&)", + "return_type": "_Bool", + "scope": "condition", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 62 + }, + "to": { + "activity_id": "2026763864005979273", + "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", + "participant_id": "1673261195873192383", + "participant_name": "clanguml::t20029::Encoder>" + }, + "type": "message" + }, + { + "from": { + "id": "2026763864005979273", + "name": "clanguml::t20029::Encoder>::send(std::string &&)" + }, + "name": "encode(std::string &&)", + "return_type": "std::string", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 15 + }, + "to": { + "activity_id": "1468258269466480773", + "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", + "participant_id": "1673261195873192383", + "participant_name": "clanguml::t20029::Encoder>" + }, + "type": "message" + }, + { + "from": { + "id": "1468258269466480773", + "name": "clanguml::t20029::Encoder>::encode(std::string &&)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 19 + }, + "to": { + "activity_id": "1362646431260879440", + "activity_name": "clanguml::t20029::encode_b64(std::string &&)" + }, + "type": "message" + }, + { + "from": { + "id": "2026763864005979273", + "name": "clanguml::t20029::Encoder>::send(std::string &&)" + }, + "name": "send(std::string &&)", + "return_type": "_Bool", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 15 + }, + "to": { + "activity_id": "30515971485361302", + "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", + "participant_id": "658058855590948094", + "participant_name": "clanguml::t20029::Retrier" + }, + "type": "message" + }, + { + "activity_id": "30515971485361302", + "messages": [ + { + "activity_id": "30515971485361302", + "branches": [ + { + "messages": [ + { + "from": { + "id": "30515971485361302", + "name": "clanguml::t20029::Retrier::send(std::string &&)" + }, + "name": "send(const std::string &)", + "return_type": "_Bool", + "scope": "condition", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 31 + }, + "to": { + "activity_id": "972625940114169157", + "activity_name": "clanguml::t20029::ConnectionPool::send(const std::string &)", + "participant_id": "1896406205097618937", + "participant_name": "clanguml::t20029::ConnectionPool" + }, + "type": "message" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + } + ], + "name": "while", + "type": "loop" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + } + ], + "name": "for", + "type": "loop" + } + ], + "start_from": { + "id": 2091374738808319700, + "location": "clanguml::t20029::tmain()" + } + } + ], + "using_namespace": "clanguml::t20029" +} +)###"; + + auto j = generate_sequence_json(diagram, *model); + + REQUIRE(j == nlohmann::json::parse(expected_json)); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index c7b52c8c..4d3769a0 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -142,6 +142,20 @@ std::string generate_sequence_puml( return ss.str(); } +nlohmann::json generate_sequence_json( + std::shared_ptr config, + clanguml::sequence_diagram::model::diagram &model) +{ + using namespace clanguml::sequence_diagram::generators::json; + + std::stringstream ss; + + ss << generator( + dynamic_cast(*config), model); + + return nlohmann::json::parse(ss.str()); +} + std::string generate_class_puml( std::shared_ptr config, clanguml::class_diagram::model::diagram &model) diff --git a/util/generate_test_cases_docs.py b/util/generate_test_cases_docs.py index 4ec33dfd..bb87efc8 100755 --- a/util/generate_test_cases_docs.py +++ b/util/generate_test_cases_docs.py @@ -68,3 +68,12 @@ with open(r'tests/test_cases.yaml') as f: copyfile(f'debug/tests/puml/{diagram_name}.svg', f'docs/test_cases/{diagram_name}.svg') tc.write(f'![{diagram_name}](./{diagram_name}.svg "{test_case["title"]}")\n') + + tc.write("## Generated JSON models\n") + for diagram_name, _ in config_dict['diagrams'].items(): + if os.path.exists(f'debug/tests/puml/{diagram_name}.json'): + with open(f'debug/tests/puml/{diagram_name}.json') as f: + contents = f.read() + tc.write("```json\n") + tc.write(contents) + tc.write("\n```\n") \ No newline at end of file From 44cd7b048483c41839b174887fda27766031d01e Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 19 Mar 2023 19:08:15 +0100 Subject: [PATCH 13/30] Refactored JSON sequence diagram generator --- src/common/model/enums.cc | 2 + src/common/model/enums.h | 1 + .../json/sequence_diagram_generator.cc | 533 ++++++++++-------- .../json/sequence_diagram_generator.h | 22 + .../plantuml/sequence_diagram_generator.cc | 2 +- .../visitor/translation_unit_visitor.cc | 2 +- 6 files changed, 335 insertions(+), 227 deletions(-) diff --git a/src/common/model/enums.cc b/src/common/model/enums.cc index d321102c..39b5bfd5 100644 --- a/src/common/model/enums.cc +++ b/src/common/model/enums.cc @@ -111,6 +111,8 @@ std::string to_string(message_t r) return "end switch"; case message_t::kConditional: return "conditional"; + case message_t::kConditionalElse: + return "conditional else"; case message_t::kConditionalEnd: return "end conditional"; default: diff --git a/src/common/model/enums.h b/src/common/model/enums.h index 633a236f..1fb71ae4 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -61,6 +61,7 @@ enum class message_t { kCase, kSwitchEnd, kConditional, + kConditionalElse, kConditionalEnd, kNone }; diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc index 1313d150..107d1411 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -97,9 +97,6 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const .message_name(render_mode); } } - // - // const std::string from_alias = generate_alias(from.value()); - // const std::string to_alias = generate_alias(to.value()); nlohmann::json msg; @@ -149,232 +146,318 @@ void generator::generate_activity( { // Generate calls from this activity to other activities for (const auto &m : a.messages()) { - if (m.type() == message_t::kCall) { - const auto &to = - m_model.get_participant(m.to()); - if (!to || to.value().skip()) - continue; - - visited.push_back(m.from()); - - LOG_DBG("Generating message {} --> {}", m.from(), m.to()); - - generate_call(m, current_block_statement()); - - if (m_model.sequences().find(m.to()) != m_model.sequences().end()) { - if (std::find(visited.begin(), visited.end(), m.to()) == - visited - .end()) { // break infinite recursion on recursive calls - - LOG_DBG("Creating activity {} --> {} - missing sequence {}", - m.from(), m.to(), m.to()); - - generate_activity(m.to(), m_model.get_activity(m.to()), - current_block_statement(), visited, {}); - } - } - else - LOG_DBG("Skipping activity {} --> {} - missing sequence {}", - m.from(), m.to(), m.to()); - } - else if (m.type() == message_t::kIf) { - nlohmann::json if_block; - if_block["type"] = "alt"; - if_block["name"] = "if"; - if_block["activity_id"] = std::to_string(m.from()); - - current_block_statement()["messages"].push_back( - std::move(if_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["messages"].back())); - - nlohmann::json branch; - branch["type"] = "consequent"; - current_block_statement()["branches"].push_back(std::move(branch)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["branches"].back())); - } - else if (m.type() == message_t::kElseIf || - m.type() == message_t::kElse) { - // remove previous branch from the stack - block_statements_stack_.pop_back(); - - nlohmann::json branch; - branch["type"] = "alternative"; - current_block_statement()["branches"].push_back(std::move(branch)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["branches"].back())); - } - else if (m.type() == message_t::kIfEnd) { - // Remove last if branch from the stack - block_statements_stack_.pop_back(); - - // Remove the if statement block from the stack - block_statements_stack_.pop_back(); - } - else if (m.type() == message_t::kWhile) { - nlohmann::json while_block; - while_block["type"] = "loop"; - while_block["name"] = "while"; - while_block["activity_id"] = std::to_string(m.from()); - - current_block_statement()["messages"].push_back( - std::move(while_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["messages"].back())); - } - else if (m.type() == message_t::kWhileEnd) { - // Remove the while statement block from the stack - block_statements_stack_.pop_back(); - } - else if (m.type() == message_t::kFor) { - nlohmann::json for_block; - for_block["type"] = "loop"; - for_block["name"] = "for"; - for_block["activity_id"] = std::to_string(m.from()); - - current_block_statement()["messages"].push_back( - std::move(for_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["messages"].back())); - } - else if (m.type() == message_t::kForEnd) { - // Remove the while statement block from the stack - block_statements_stack_.pop_back(); - } - else if (m.type() == message_t::kDo) { - nlohmann::json do_block; - do_block["type"] = "loop"; - do_block["name"] = "do"; - do_block["activity_id"] = std::to_string(m.from()); - - current_block_statement()["messages"].push_back( - std::move(do_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["messages"].back())); - } - else if (m.type() == message_t::kDoEnd) { - // Remove the do statement block from the stack - block_statements_stack_.pop_back(); - } - else if (m.type() == message_t::kTry) { - nlohmann::json try_block; - try_block["type"] = "break"; - try_block["name"] = "try"; - try_block["activity_id"] = std::to_string(m.from()); - - current_block_statement()["messages"].push_back( - std::move(try_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["messages"].back())); - - nlohmann::json branch; - branch["type"] = "main"; - current_block_statement()["blocks"].push_back(std::move(branch)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["blocks"].back())); - } - else if (m.type() == message_t::kCatch) { - // remove previous block from the stack - block_statements_stack_.pop_back(); - - nlohmann::json branch; - branch["type"] = "catch"; - current_block_statement()["blocks"].push_back(std::move(branch)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["blocks"].back())); - } - else if (m.type() == message_t::kTryEnd) { - // Remove last if block from the stack - block_statements_stack_.pop_back(); - - // Remove the try statement block from the stack - block_statements_stack_.pop_back(); - } - else if (m.type() == message_t::kSwitch) { - nlohmann::json if_block; - if_block["type"] = "alt"; - if_block["name"] = "switch"; - if_block["activity_id"] = std::to_string(m.from()); - - current_block_statement()["messages"].push_back( - std::move(if_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["messages"].back())); - } - else if (m.type() == message_t::kCase) { - if (current_block_statement()["type"] == "case") - block_statements_stack_.pop_back(); - - nlohmann::json case_block; - case_block["type"] = "case"; - case_block["name"] = m.message_name(); - current_block_statement()["cases"].push_back(std::move(case_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["cases"].back())); - } - else if (m.type() == message_t::kSwitchEnd) { - // Remove last case block from the stack - block_statements_stack_.pop_back(); - - // Remove the switch statement block from the stack - block_statements_stack_.pop_back(); - } - else if (m.type() == message_t::kConditional) { - nlohmann::json if_block; - if_block["type"] = "alt"; - if_block["name"] = "conditional"; - if_block["activity_id"] = std::to_string(m.from()); - - current_block_statement()["messages"].push_back( - std::move(if_block)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["messages"].back())); - - nlohmann::json branch; - branch["type"] = "consequent"; - current_block_statement()["branches"].push_back(std::move(branch)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["branches"].back())); - } - else if (m.type() == message_t::kElse) { - // remove previous branch from the stack - block_statements_stack_.pop_back(); - - nlohmann::json branch; - branch["type"] = "alternative"; - current_block_statement()["branches"].push_back(std::move(branch)); - - block_statements_stack_.push_back( - std::ref(current_block_statement()["branches"].back())); - } - else if (m.type() == message_t::kConditionalEnd) { - // Remove last if branch from the stack - block_statements_stack_.pop_back(); - - // Remove the if statement block from the stack - block_statements_stack_.pop_back(); - } - else { - // Unhandled message_t case - assert(false); + switch (m.type()) { + case message_t::kCall: + process_call_message(m, visited); + break; + case message_t::kIf: + process_if_message(m); + break; + case message_t::kElseIf: + case message_t::kElse: + process_else_if_message(); + break; + case message_t::kIfEnd: + process_end_if_message(); + break; + case message_t::kWhile: + process_while_message(m); + break; + case message_t::kWhileEnd: + process_end_while_message(); + break; + case message_t::kFor: + process_for_message(m); + break; + case message_t::kForEnd: + process_end_for_message(); + break; + case message_t::kDo: + process_do_message(m); + break; + case message_t::kDoEnd: + process_end_do_message(); + break; + case message_t::kTry: + process_try_message(m); + break; + case message_t::kCatch: + process_catch_message(); + break; + case message_t::kTryEnd: + process_end_try_message(); + break; + case message_t::kSwitch: + process_switch_message(m); + break; + case message_t::kCase: + process_case_message(m); + break; + case message_t::kSwitchEnd: + process_end_switch_message(); + break; + case message_t::kConditional: + process_conditional_message(m); + break; + case message_t::kConditionalElse: + process_conditional_else_message(); + break; + case message_t::kConditionalEnd: + process_end_conditional_message(); + break; + case message_t::kNone: + case message_t::kReturn:; // noop } } } +void generator::process_call_message(const model::message &m, + std::vector &visited) const +{ + const auto &to = m_model.get_participant(m.to()); + if (!to || to.value().skip()) + return; + + visited.push_back(m.from()); + + LOG_DBG("Generating message {} --> {}", m.from(), m.to()); + + generate_call(m, current_block_statement()); + + if (m_model.sequences().find(m.to()) != m_model.sequences().end()) { + if (std::find(visited.begin(), visited.end(), m.to()) == + visited.end()) { // break infinite recursion on recursive calls + + LOG_DBG("Creating activity {} --> {} - missing sequence {}", + m.from(), m.to(), m.to()); + + generate_activity(m.to(), m_model.get_activity(m.to()), + current_block_statement(), visited, {}); + } + } + else + LOG_DBG("Skipping activity {} --> {} - missing sequence {}", m.from(), + m.to(), m.to()); +} + +void generator::process_while_message(const message &m) const +{ + nlohmann::json while_block; + while_block["type"] = "loop"; + while_block["name"] = "while"; + while_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back(std::move(while_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); +} + +void generator::process_end_while_message() const +{ + // Remove the while statement block from the stack + block_statements_stack_.pop_back(); +} + +void generator::process_for_message(const message &m) const +{ + nlohmann::json for_block; + for_block["type"] = "loop"; + for_block["name"] = "for"; + for_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back(std::move(for_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); +} + +void generator::process_end_for_message() const +{ + // Remove the while statement block from the stack + block_statements_stack_.pop_back(); +} + +void generator::process_do_message(const message &m) const +{ + nlohmann::json do_block; + do_block["type"] = "loop"; + do_block["name"] = "do"; + do_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back(std::move(do_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); +} + +void generator::process_end_do_message() const +{ + // Remove the do statement block from the stack + block_statements_stack_.pop_back(); +} + +void generator::process_try_message(const message &m) const +{ + nlohmann::json try_block; + try_block["type"] = "break"; + try_block["name"] = "try"; + try_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back(std::move(try_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + + nlohmann::json branch; + branch["type"] = "main"; + current_block_statement()["blocks"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["blocks"].back())); +} + +void generator::process_catch_message() const +{ + // remove previous block from the stack + block_statements_stack_.pop_back(); + + nlohmann::json branch; + branch["type"] = "catch"; + current_block_statement()["blocks"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["blocks"].back())); +} + +void generator::process_end_try_message() const +{ + // Remove last if block from the stack + block_statements_stack_.pop_back(); + + // Remove the try statement block from the stack + block_statements_stack_.pop_back(); +} + +void generator::process_switch_message(const message &m) const +{ + nlohmann::json if_block; + if_block["type"] = "alt"; + if_block["name"] = "switch"; + if_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back(std::move(if_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); +} + +void generator::process_case_message(const message &m) const +{ + if (current_block_statement()["type"] == "case") + block_statements_stack_.pop_back(); + + nlohmann::json case_block; + case_block["type"] = "case"; + case_block["name"] = m.message_name(); + current_block_statement()["cases"].push_back(std::move(case_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["cases"].back())); +} + +void generator::process_end_switch_message() const +{ // Remove last case block from the stack + block_statements_stack_.pop_back(); + + // Remove the switch statement block from the stack + block_statements_stack_.pop_back(); +} + +void generator::process_conditional_message(const message &m) const +{ + nlohmann::json if_block; + if_block["type"] = "alt"; + if_block["name"] = "conditional"; + if_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back(std::move(if_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + + nlohmann::json branch; + branch["type"] = "consequent"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); +} + +void generator::process_conditional_else_message() const +{ + // remove previous branch from the stack + block_statements_stack_.pop_back(); + + nlohmann::json branch; + branch["type"] = "alternative"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); +} + +void generator::process_end_conditional_message() const +{ + // Remove last if branch from the stack + block_statements_stack_.pop_back(); + + // Remove the if statement block from the stack + block_statements_stack_.pop_back(); +} + +void generator::process_end_if_message() const +{ + // Remove last if branch from the stack + block_statements_stack_.pop_back(); + + // Remove the if statement block from the stack + block_statements_stack_.pop_back(); +} + +void generator::process_else_if_message() const +{ + // remove previous branch from the stack + block_statements_stack_.pop_back(); + + nlohmann::json branch; + branch["type"] = "alternative"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); +} + +void generator::process_if_message(const message &m) const +{ + nlohmann::json if_block; + if_block["type"] = "alt"; + if_block["name"] = "if"; + if_block["activity_id"] = std::to_string(m.from()); + + current_block_statement()["messages"].push_back(std::move(if_block)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["messages"].back())); + + nlohmann::json branch; + branch["type"] = "consequent"; + current_block_statement()["branches"].push_back(std::move(branch)); + + block_statements_stack_.push_back( + std::ref(current_block_statement()["branches"].back())); +} + void generator::generate_participant( nlohmann::json &parent, const std::string &name) const { diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.h b/src/sequence_diagram/generators/json/sequence_diagram_generator.h index bb383b0c..6fe7c89d 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.h @@ -76,6 +76,28 @@ private: mutable std::vector> block_statements_stack_; + + void process_call_message(const model::message &m, + std::vector &visited) const; + + void process_if_message(const model::message &m) const; + void process_else_if_message() const; + void process_end_if_message() const; + void process_end_conditional_message() const; + void process_conditional_else_message() const; + void process_conditional_message(const model::message &m) const; + void process_end_switch_message() const; + void process_case_message(const model::message &m) const; + void process_switch_message(const model::message &m) const; + void process_end_try_message() const; + void process_catch_message() const; + void process_try_message(const model::message &m) const; + void process_end_do_message() const; + void process_do_message(const model::message &m) const; + void process_end_for_message() const; + void process_for_message(const model::message &m) const; + void process_end_while_message() const; + void process_while_message(const model::message &m) const; }; } // namespace clanguml::sequence_diagram::generators::json diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index a0a3b5bc..87a20369 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -233,7 +233,7 @@ void generator::generate_activity(const activity &a, std::ostream &ostr, print_debug(m, ostr); ostr << "alt\n"; } - else if (m.type() == message_t::kElse) { + else if (m.type() == message_t::kConditionalElse) { print_debug(m, ostr); ostr << "else\n"; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index b93c1e73..ec417a54 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -821,7 +821,7 @@ bool translation_unit_visitor::TraverseConditionalOperator( stmt->getTrueExpr()); if (current_caller_id != 0) { - model::message m{message_t::kElse, current_caller_id}; + model::message m{message_t::kConditionalElse, current_caller_id}; set_source_location(*stmt, m); diagram().add_message(std::move(m)); } From b412f46fb28103c92a7723f29dbec84aa5cdac4a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 20 Mar 2023 01:33:37 +0100 Subject: [PATCH 14/30] Added initial json generator test cases --- .../json/class_diagram_generator.cc | 3 + .../json/sequence_diagram_generator.cc | 7 - .../json/sequence_diagram_generator.h | 18 +- tests/t00002/test_case.h | 448 +-------- tests/t00003/test_case.h | 16 + tests/t00014/test_case.h | 907 +----------------- tests/t00036/test_case.h | 188 +--- tests/t00056/test_case.h | 521 +--------- tests/t20029/test_case.h | 223 ----- tests/test_cases.h | 128 +++ 10 files changed, 188 insertions(+), 2271 deletions(-) diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index 50be3967..bcac7632 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -113,6 +113,9 @@ generator::generator(diagram_config &config, diagram_model &model) void generator::generate(std::ostream &ostr) const { + json_["elements"] = std::vector{}; + json_["relationships"] = std::vector{}; + generate_top_level_elements(json_); generate_relationships(json_); diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc index 107d1411..5857b468 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -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(m.from()); diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.h b/src/sequence_diagram/generators/json/sequence_diagram_generator.h index 6fe7c89d..5bff18da 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.h @@ -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 generated_participants_; - - mutable nlohmann::json json_; - - mutable std::vector> - block_statements_stack_; - void process_call_message(const model::message &m, std::vector &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 generated_participants_; + + mutable nlohmann::json json_; + + mutable std::vector> + block_statements_stack_; }; } // namespace clanguml::sequence_diagram::generators::json diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h index 95e9e94b..2f1f368e 100644 --- a/tests/t00002/test_case.h +++ b/tests/t00002/test_case.h @@ -75,444 +75,20 @@ TEST_CASE("t00002", "[test-case][class]") save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); - const std::string expected_json = R"##( -{ - "elements": [ - { - "bases": [], - "comment": { - "brief": [ - " This is class A\n" - ], - "formatted": "\\brief This is class A", - "paragraph": [ - " \n" - ], - "raw": "/// \\brief This is class A", - "text": "\n \n" - }, - "display_name": "clanguml::t00002::A", - "id": "987634239855407298", - "is_abstract": true, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [ - { - "access": "public", - "comment": { - "formatted": "Abstract foo_a", - "paragraph": [ - " Abstract foo_a\n" - ], - "raw": "/// Abstract foo_a", - "text": "\n Abstract foo_a\n" - }, - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": true, - "is_static": false, - "is_virtual": true, - "name": "foo_a", - "parameters": [], - "type": "void" - }, - { - "access": "public", - "comment": { - "formatted": "Abstract foo_c", - "paragraph": [ - " Abstract foo_c\n" - ], - "raw": "/// Abstract foo_c", - "text": "\n Abstract foo_c\n" - }, - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": true, - "is_static": false, - "is_virtual": true, - "name": "foo_c", - "parameters": [], - "type": "void" - } - ], - "name": "A", - "namespace": "clanguml::t00002", - "source_location": { - "file": "../../tests/t00002/t00002.cc", - "line": 7 - }, - "template_parameters": [], - "type": "class" - }, - { - "bases": [ - { - "access": "public", - "id": "987634239855407298", - "is_virtual": false, - "name": "clanguml::t00002::A" - } - ], - "comment": { - "brief": [ - " This is class B\n" - ], - "formatted": "\\brief This is class B", - "paragraph": [ - " \n" - ], - "raw": "/// \\brief This is class B", - "text": "\n \n" - }, - "display_name": "clanguml::t00002::B", - "id": "594234458687375950", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [ - { - "access": "public", - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": false, - "is_static": false, - "is_virtual": true, - "name": "foo_a", - "parameters": [], - "type": "void" - } - ], - "name": "B", - "namespace": "clanguml::t00002", - "source_location": { - "file": "../../tests/t00002/t00002.cc", - "line": 16 - }, - "template_parameters": [], - "type": "class" - }, - { - "bases": [ - { - "access": "public", - "id": "987634239855407298", - "is_virtual": false, - "name": "clanguml::t00002::A" - } - ], - "comment": { - "brief": [ - " This is class C - class C has a long comment\n" - ], - "formatted": "@brief This is class C - class C has a long comment\n\nVivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\neuismod libero facilisi aptent elementum felis blandit cursus gravida sociis\nerat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\nad.", - "paragraph": [ - " \n", - " Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad.\n" - ], - "raw": "/// @brief This is class C - class C has a long comment\n///\n/// Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n/// euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n/// erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n/// ad.", - "text": "\n \n\n Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad.\n" - }, - "display_name": "clanguml::t00002::C", - "id": "1142499429598587507", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [ - { - "access": "public", - "comment": { - "formatted": "Do nothing unless override is provided", - "paragraph": [ - " Do nothing unless override is provided\n" - ], - "raw": "/// Do nothing unless override is provided", - "text": "\n Do nothing unless override is provided\n" - }, - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": false, - "is_static": false, - "is_virtual": true, - "name": "foo_c", - "parameters": [], - "type": "void" - } - ], - "name": "C", - "namespace": "clanguml::t00002", - "source_location": { - "file": "../../tests/t00002/t00002.cc", - "line": 27 - }, - "template_parameters": [], - "type": "class" - }, - { - "bases": [ - { - "access": "public", - "id": "594234458687375950", - "is_virtual": false, - "name": "clanguml::t00002::B" - }, - { - "access": "public", - "id": "1142499429598587507", - "is_virtual": false, - "name": "clanguml::t00002::C" - } - ], - "comment": { - "formatted": "This is class D\nwhich is a little like B\nand a little like C", - "paragraph": [ - " This is class D\n which is a little like B\n and a little like C\n" - ], - "raw": "/// This is class D\n/// which is a little like B\n/// and a little like C", - "text": "\n This is class D\n which is a little like B\n and a little like C\n" - }, - "display_name": "clanguml::t00002::D", - "id": "60950494980414724", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "private", - "comment": { - "formatted": "All the A pointers", - "paragraph": [ - " All the A pointers\n" - ], - "raw": "/// All the A pointers", - "text": "\n All the A pointers\n" - }, - "is_static": false, - "name": "as", - "source_location": { - "file": "../../tests/t00002/t00002.cc", - "line": 58 - }, - "type": "std::vector" - } - ], - "methods": [ - { - "access": "public", - "comment": { - "formatted": "\n Forward foo_a\n ", - "paragraph": [ - " Forward foo_a\n" - ], - "raw": "/**\n * Forward foo_a\n */", - "text": "\n Forward foo_a\n" - }, - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": false, - "is_static": false, - "is_virtual": true, - "name": "foo_a", - "parameters": [], - "type": "void" - }, - { - "access": "public", - "comment": { - "formatted": "\n Forward foo_c\n ", - "paragraph": [ - " Forward foo_c\n" - ], - "raw": "/**\n * Forward foo_c\n */", - "text": "\n Forward foo_c\n" - }, - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": false, - "is_static": false, - "is_virtual": true, - "name": "foo_c", - "parameters": [], - "type": "void" - } - ], - "name": "D", - "namespace": "clanguml::t00002", - "source_location": { - "file": "../../tests/t00002/t00002.cc", - "line": 36 - }, - "template_parameters": [], - "type": "class" - }, - { - "bases": [ - { - "access": "public", - "id": "594234458687375950", - "is_virtual": true, - "name": "clanguml::t00002::B" - }, - { - "access": "public", - "id": "1142499429598587507", - "is_virtual": true, - "name": "clanguml::t00002::C" - } - ], - "display_name": "clanguml::t00002::E", - "id": "2237886670308966220", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "private", - "comment": { - "formatted": "All the A pointers", - "paragraph": [ - " All the A pointers\n" - ], - "raw": "/// All the A pointers", - "text": "\n All the A pointers\n" - }, - "is_static": false, - "name": "as", - "source_location": { - "file": "../../tests/t00002/t00002.cc", - "line": 83 - }, - "type": "std::vector" - } - ], - "methods": [ - { - "access": "public", - "comment": { - "formatted": "\n Forward foo_a", - "paragraph": [ - " Forward foo_a\n" - ], - "raw": "///\n /// Forward foo_a\n ///", - "text": "\n Forward foo_a\n" - }, - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": false, - "is_static": false, - "is_virtual": true, - "name": "foo_a", - "parameters": [], - "type": "void" - }, - { - "access": "public", - "comment": { - "formatted": "\n Forward foo_c", - "paragraph": [ - " Forward foo_c\n" - ], - "raw": "///\n /// Forward foo_c\n ///", - "text": "\n Forward foo_c\n" - }, - "is_const": false, - "is_defaulted": false, - "is_implicit": false, - "is_pure_virtual": false, - "is_static": false, - "is_virtual": true, - "name": "foo_c", - "parameters": [], - "type": "void" - } - ], - "name": "E", - "namespace": "clanguml::t00002", - "source_location": { - "file": "../../tests/t00002/t00002.cc", - "line": 61 - }, - "template_parameters": [], - "type": "class" - } - ], - "relationships": [ - { - "access": "public", - "destination": "987634239855407298", - "source": "594234458687375950", - "type": "extension" - }, - { - "access": "public", - "destination": "987634239855407298", - "source": "1142499429598587507", - "type": "extension" - }, - { - "access": "private", - "destination": "987634239855407298", - "label": "as", - "source": "60950494980414724", - "type": "association" - }, - { - "access": "public", - "destination": "594234458687375950", - "source": "60950494980414724", - "type": "extension" - }, - { - "access": "public", - "destination": "1142499429598587507", - "source": "60950494980414724", - "type": "extension" - }, - { - "access": "private", - "destination": "987634239855407298", - "label": "as", - "source": "2237886670308966220", - "type": "association" - }, - { - "access": "public", - "destination": "594234458687375950", - "source": "2237886670308966220", - "type": "extension" - }, - { - "access": "public", - "destination": "1142499429598587507", - "source": "2237886670308966220", - "type": "extension" - } - ] -} -)##"; auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + REQUIRE(json::IsClass(j, "clanguml::t00002::A")); + REQUIRE(json::IsClass(j, "clanguml::t00002::B")); + REQUIRE(json::IsClass(j, "clanguml::t00002::C")); + REQUIRE(json::IsBaseClass(j, "clanguml::t00002::A", "clanguml::t00002::B")); + REQUIRE(json::IsBaseClass(j, "clanguml::t00002::A", "clanguml::t00002::C")); + REQUIRE(json::IsBaseClass(j, "clanguml::t00002::B", "clanguml::t00002::D")); + REQUIRE(json::IsBaseClass(j, "clanguml::t00002::C", "clanguml::t00002::D")); + REQUIRE(json::IsMethod(j, "clanguml::t00002::A", "foo_a")); + REQUIRE(json::IsMethod(j, "clanguml::t00002::C", "foo_c")); + + REQUIRE(json::IsAssociation( + j, "clanguml::t00002::D", "clanguml::t00002::A", "as")); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t00003/test_case.h b/tests/t00003/test_case.h index c499a033..bcb7b229 100644 --- a/tests/t00003/test_case.h +++ b/tests/t00003/test_case.h @@ -66,4 +66,20 @@ TEST_CASE("t00003", "[test-case][class]") REQUIRE_THAT(puml, (IsField("c_", "int"))); save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + + auto j = generate_class_json(diagram, *model); + + REQUIRE(json::IsClass(j, "clanguml::t00003::A")); + REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "A")); + REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "~A")); + REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "basic_method")); + REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "static_method")); + REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "const_method")); + REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "default_int")); + REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "default_string")); + + REQUIRE( + !json::IsDependency(j, "clanguml::t00002::A", "clanguml::t00002::A")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index 17b6f38d..3df7d280 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -116,900 +116,23 @@ TEST_CASE("t00014", "[test-case][class]") save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); - std::string expected_json = R"##( -{ - "elements": [ - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "765890579167335652", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "t", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 22 - }, - "type": "T" - }, - { - "access": "public", - "is_static": false, - "name": "p", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 23 - }, - "type": "P" - } - ], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 21 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "P" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::B", - "id": "934136012292043506", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "value", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 27 - }, - "type": "std::string" - } - ], - "methods": [], - "name": "B", - "namespace": "clanguml::t00014", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 26 - }, - "template_parameters": [], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "2186387853087008570", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "T" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::string" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A>", - "id": "947292733740993297", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "T" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::unique_ptr" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "1700006390494465667", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "long" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "T" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "2017665567517853203", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "double" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "T" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "906557320263235873", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "long" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "U" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "378898020828430636", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "long" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "bool" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "2082013375525130414", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "double" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "bool" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "51978493292659230", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "long" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "float" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "197769253782961588", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "double" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "float" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "895940711566401184", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "bool" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::string" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A>", - "id": "1751732625010742161", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "float" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::unique_ptr" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "887121441210847583", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "int" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::string" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "1119452495635561975", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "std::string" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::string" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "640294848489463071", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "char" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::string" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::A", - "id": "139599686499155694", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00014", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "wchar_t" - }, - { - "is_variadic": false, - "kind": "argument", - "type": "std::string" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00014::R", - "id": "1192822659863756768", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "private", - "is_static": false, - "name": "bapair", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 58 - }, - "type": "PairPairBA" - }, - { - "access": "private", - "is_static": false, - "name": "abool", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 60 - }, - "type": "APtr" - }, - { - "access": "private", - "is_static": false, - "name": "aboolfloat", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 61 - }, - "type": "AAPtr" - }, - { - "access": "private", - "is_static": false, - "name": "afloat", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 62 - }, - "type": "ASharedPtr" - }, - { - "access": "private", - "is_static": false, - "name": "boolstring", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 63 - }, - "type": "A" - }, - { - "access": "private", - "is_static": false, - "name": "floatstring", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 64 - }, - "type": "AStringPtr" - }, - { - "access": "private", - "is_static": false, - "name": "intstring", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 65 - }, - "type": "clanguml::t00014::AIntString" - }, - { - "access": "private", - "is_static": false, - "name": "stringstring", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 66 - }, - "type": "clanguml::t00014::AStringString" - }, - { - "access": "private", - "is_static": false, - "name": "bstringstring", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 67 - }, - "type": "clanguml::t00014::BStringString" - }, - { - "access": "protected", - "is_static": false, - "name": "bs", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 70 - }, - "type": "clanguml::t00014::BVector" - }, - { - "access": "public", - "is_static": false, - "name": "bs2", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 73 - }, - "type": "clanguml::t00014::BVector2" - }, - { - "access": "public", - "is_static": false, - "name": "cb", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 74 - }, - "type": "SimpleCallback" - }, - { - "access": "public", - "is_static": false, - "name": "gcb", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 75 - }, - "type": "GenericCallback" - }, - { - "access": "public", - "is_static": false, - "name": "vcb", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 76 - }, - "type": "clanguml::t00014::VoidCallback" - }, - { - "access": "public", - "is_static": false, - "name": "vps", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 77 - }, - "type": "VectorPtr" - } - ], - "methods": [], - "name": "R", - "namespace": "clanguml::t00014", - "source_location": { - "file": "../../tests/t00014/t00014.cc", - "line": 55 - }, - "template_parameters": [], - "type": "class" - } - ], - "relationships": [ - { - "access": "public", - "destination": "765890579167335652", - "source": "2186387853087008570", - "type": "instantiation" - }, - { - "access": "public", - "destination": "765890579167335652", - "source": "947292733740993297", - "type": "instantiation" - }, - { - "access": "public", - "destination": "765890579167335652", - "source": "1700006390494465667", - "type": "instantiation" - }, - { - "access": "public", - "destination": "765890579167335652", - "source": "2017665567517853203", - "type": "instantiation" - }, - { - "access": "public", - "destination": "1700006390494465667", - "source": "906557320263235873", - "type": "instantiation" - }, - { - "access": "public", - "destination": "1700006390494465667", - "source": "378898020828430636", - "type": "instantiation" - }, - { - "access": "public", - "destination": "2017665567517853203", - "source": "2082013375525130414", - "type": "instantiation" - }, - { - "access": "public", - "destination": "1700006390494465667", - "source": "51978493292659230", - "type": "instantiation" - }, - { - "access": "public", - "destination": "2017665567517853203", - "source": "197769253782961588", - "type": "instantiation" - }, - { - "access": "public", - "destination": "2186387853087008570", - "source": "895940711566401184", - "type": "instantiation" - }, - { - "access": "public", - "destination": "947292733740993297", - "source": "1751732625010742161", - "type": "instantiation" - }, - { - "access": "public", - "destination": "2186387853087008570", - "source": "887121441210847583", - "type": "instantiation" - }, - { - "access": "public", - "destination": "2186387853087008570", - "source": "1119452495635561975", - "type": "instantiation" - }, - { - "access": "public", - "destination": "2186387853087008570", - "source": "640294848489463071", - "type": "instantiation" - }, - { - "access": "public", - "destination": "2186387853087008570", - "source": "139599686499155694", - "type": "instantiation" - }, - { - "access": "public", - "destination": "378898020828430636", - "source": "1192822659863756768", - "type": "dependency" - }, - { - "access": "private", - "destination": "934136012292043506", - "label": "bapair", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "private", - "destination": "378898020828430636", - "label": "bapair", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "public", - "destination": "2082013375525130414", - "source": "1192822659863756768", - "type": "dependency" - }, - { - "access": "private", - "destination": "2082013375525130414", - "label": "abool", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "public", - "destination": "51978493292659230", - "source": "1192822659863756768", - "type": "dependency" - }, - { - "access": "private", - "destination": "2082013375525130414", - "label": "aboolfloat", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "private", - "destination": "51978493292659230", - "label": "aboolfloat", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "public", - "destination": "197769253782961588", - "source": "1192822659863756768", - "type": "dependency" - }, - { - "access": "private", - "destination": "197769253782961588", - "label": "afloat", - "source": "1192822659863756768", - "type": "association" - }, - { - "access": "private", - "destination": "895940711566401184", - "label": "boolstring", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "private", - "destination": "1751732625010742161", - "label": "floatstring", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "private", - "destination": "887121441210847583", - "label": "intstring", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "private", - "destination": "1119452495635561975", - "label": "stringstring", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "private", - "destination": "1119452495635561975", - "label": "bstringstring", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "protected", - "destination": "934136012292043506", - "label": "bs", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "public", - "destination": "934136012292043506", - "label": "bs2", - "source": "1192822659863756768", - "type": "aggregation" - }, - { - "access": "public", - "destination": "640294848489463071", - "source": "1192822659863756768", - "type": "dependency" - }, - { - "access": "public", - "destination": "139599686499155694", - "source": "1192822659863756768", - "type": "dependency" - }, - { - "access": "public", - "destination": "934136012292043506", - "label": "vps", - "source": "1192822659863756768", - "type": "aggregation" - } - ] -} -)##"; auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass( + j, "clanguml::t00014::A>")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + REQUIRE(json::IsClass(j, "clanguml::t00014::B")); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00036/test_case.h b/tests/t00036/test_case.h index b9b43ec9..ccc91c3c 100644 --- a/tests/t00036/test_case.h +++ b/tests/t00036/test_case.h @@ -47,192 +47,12 @@ TEST_CASE("t00036", "[test-case][class]") save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); - const std::string expected_json = R"##( -{ - "elements": [ - { - "display_name": "clanguml::t00036::ns1", - "elements": [ - { - "constants": [ - "blue", - "yellow" - ], - "display_name": "clanguml::t00036::ns1::E", - "id": "2144761953049158478", - "is_nested": false, - "name": "E", - "namespace": "clanguml::t00036::ns1", - "source_location": { - "file": "../../tests/t00036/t00036.cc", - "line": 6 - }, - "type": "enum" - }, - { - "display_name": "clanguml::t00036::ns1::ns11", - "elements": [ - { - "bases": [], - "display_name": "clanguml::t00036::ns1::ns11::A", - "id": "571573305652194946", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "a", - "source_location": { - "file": "../../tests/t00036/t00036.cc", - "line": 11 - }, - "type": "T" - } - ], - "methods": [], - "name": "A", - "namespace": "clanguml::t00036::ns1::ns11", - "source_location": { - "file": "../../tests/t00036/t00036.cc", - "line": 10 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T" - } - ], - "type": "class" - }, - { - "display_name": "clanguml::t00036::ns1::ns11::ns111", - "elements": [ - { - "bases": [], - "display_name": "clanguml::t00036::ns1::ns11::ns111::B", - "id": "1964031933563607376", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "a_int", - "source_location": { - "file": "../../tests/t00036/t00036.cc", - "line": 17 - }, - "type": "A" - } - ], - "methods": [], - "name": "B", - "namespace": "clanguml::t00036::ns1::ns11::ns111", - "source_location": { - "file": "../../tests/t00036/t00036.cc", - "line": 16 - }, - "template_parameters": [], - "type": "class" - } - ], - "name": "ns111", - "type": "namespace" - }, - { - "bases": [], - "display_name": "clanguml::t00036::ns1::ns11::A", - "id": "1832710427462319797", - "is_abstract": false, - "is_nested": false, - "is_struct": false, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "A", - "namespace": "clanguml::t00036::ns1::ns11", - "template_parameters": [ - { - "is_variadic": false, - "kind": "argument", - "type": "int" - } - ], - "type": "class" - } - ], - "name": "ns11", - "type": "namespace" - } - ], - "name": "ns1", - "type": "namespace" - }, - { - "display_name": "clanguml::t00036::ns2", - "elements": [ - { - "display_name": "clanguml::t00036::ns2::ns22", - "elements": [ - { - "bases": [], - "display_name": "clanguml::t00036::ns2::ns22::C", - "id": "2038956882066165590", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "C", - "namespace": "clanguml::t00036::ns2::ns22", - "source_location": { - "file": "../../tests/t00036/t00036.cc", - "line": 28 - }, - "template_parameters": [], - "type": "class" - } - ], - "name": "ns22", - "type": "namespace" - } - ], - "name": "ns2", - "type": "namespace" - } - ], - "relationships": [ - { - "access": "public", - "destination": "1832710427462319797", - "label": "a_int", - "source": "1964031933563607376", - "type": "aggregation" - }, - { - "access": "public", - "destination": "571573305652194946", - "source": "1832710427462319797", - "type": "instantiation" - } - ] -} -)##"; - auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + // REQUIRE(json::IsClass(j, "clanguml::t00036::A")); + // REQUIRE(json::IsClass(j, "clanguml::t00036::A")); + // REQUIRE(json::IsClass(j, "clanguml::t00036::B")); + // REQUIRE(json::IsClass(j, "clanguml::t00036::C")); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index 655f3dff..9cab7b7e 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -115,526 +115,11 @@ TEST_CASE("t00056", "[test-case][class]") save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); - const std::string expected_json = R"##( -{ - "elements": [ - { - "display_name": "clanguml::t00056::greater_than_simple", - "id": "902541696362244204", - "name": "greater_than_simple", - "namespace": "clanguml::t00056", - "parameters": [], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 7 - }, - "statements": [], - "type": "concept" - }, - { - "display_name": "clanguml::t00056::greater_than_with_requires", - "id": "1830716585637735576", - "name": "greater_than_with_requires", - "namespace": "clanguml::t00056", - "parameters": [ - { - "name": "clanguml::t00056::l", - "type": "T" - }, - { - "name": "clanguml::t00056::r", - "type": "P" - } - ], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 10 - }, - "statements": [ - "sizeof (l) > sizeof (r)" - ], - "type": "concept" - }, - { - "display_name": "clanguml::t00056::max_four_bytes", - "id": "385255522691733325", - "name": "max_four_bytes", - "namespace": "clanguml::t00056", - "parameters": [], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 15 - }, - "statements": [], - "type": "concept" - }, - { - "display_name": "clanguml::t00056::iterable", - "id": "392540961352249242", - "name": "iterable", - "namespace": "clanguml::t00056", - "parameters": [ - { - "name": "clanguml::t00056::container", - "type": "T" - } - ], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 19 - }, - "statements": [ - "container.begin()", - "container.end()" - ], - "type": "concept" - }, - { - "display_name": "clanguml::t00056::has_value_type", - "id": "1850394311226276678", - "name": "has_value_type", - "namespace": "clanguml::t00056", - "parameters": [], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 26 - }, - "statements": [ - "typename T::value_type" - ], - "type": "concept" - }, - { - "display_name": "clanguml::t00056::convertible_to_string", - "id": "137304962071054497", - "name": "convertible_to_string", - "namespace": "clanguml::t00056", - "parameters": [ - { - "name": "clanguml::t00056::s", - "type": "T" - } - ], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 29 - }, - "statements": [ - "std::string{s}", - "{std::to_string(s)} noexcept", - "{std::to_string(s)} -> std::same_as" - ], - "type": "concept" - }, - { - "display_name": "clanguml::t00056::iterable_with_value_type", - "id": "1043398062146751019", - "name": "iterable_with_value_type", - "namespace": "clanguml::t00056", - "parameters": [], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 45 - }, - "statements": [], - "type": "concept" - }, - { - "display_name": "clanguml::t00056::iterable_or_small_value_type", - "id": "866345615551223718", - "name": "iterable_or_small_value_type", - "namespace": "clanguml::t00056", - "parameters": [], - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 48 - }, - "statements": [], - "type": "concept" - }, - { - "bases": [], - "display_name": "clanguml::t00056::A", - "id": "1418333499545421661", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "a", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 53 - }, - "type": "T" - } - ], - "methods": [], - "name": "A", - "namespace": "clanguml::t00056", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 52 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00056::B", - "id": "1814355496814977880", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "b", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 60 - }, - "type": "T" - } - ], - "methods": [], - "name": "B", - "namespace": "clanguml::t00056", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 59 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00056::C", - "id": "1512618198241549089", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "c", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 70 - }, - "type": "T" - } - ], - "methods": [], - "name": "C", - "namespace": "clanguml::t00056", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 69 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00056::D", - "id": "1635109601630198093", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [], - "methods": [], - "name": "D", - "namespace": "clanguml::t00056", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 75 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T1" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T2" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T3" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T4" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T5" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00056::E", - "id": "1429225801945621089", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "e1", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 80 - }, - "type": "T1" - }, - { - "access": "public", - "is_static": false, - "name": "e2", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 81 - }, - "type": "T2" - }, - { - "access": "public", - "is_static": false, - "name": "e3", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 82 - }, - "type": "T3" - } - ], - "methods": [], - "name": "E", - "namespace": "clanguml::t00056", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 79 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T1" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T2" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T3" - } - ], - "type": "class" - }, - { - "bases": [], - "display_name": "clanguml::t00056::F", - "id": "856301122972546034", - "is_abstract": false, - "is_nested": false, - "is_struct": true, - "is_template": false, - "is_union": false, - "members": [ - { - "access": "public", - "is_static": false, - "name": "f1", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 88 - }, - "type": "T1" - }, - { - "access": "public", - "is_static": false, - "name": "f2", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 89 - }, - "type": "T2" - }, - { - "access": "public", - "is_static": false, - "name": "f3", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 90 - }, - "type": "T3" - } - ], - "methods": [], - "name": "F", - "namespace": "clanguml::t00056", - "source_location": { - "file": "../../tests/t00056/t00056.cc", - "line": 87 - }, - "template_parameters": [ - { - "is_variadic": false, - "kind": "template_type", - "name": "T1" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T2" - }, - { - "is_variadic": false, - "kind": "template_type", - "name": "T3" - } - ], - "type": "class" - } - ], - "relationships": [ - { - "destination": "385255522691733325", - "label": "T", - "source": "137304962071054497", - "type": "constraint" - }, - { - "destination": "392540961352249242", - "label": "T", - "source": "1043398062146751019", - "type": "constraint" - }, - { - "destination": "1850394311226276678", - "label": "T", - "source": "1043398062146751019", - "type": "constraint" - }, - { - "destination": "1043398062146751019", - "label": "T", - "source": "866345615551223718", - "type": "constraint" - }, - { - "destination": "385255522691733325", - "label": "T", - "source": "866345615551223718", - "type": "constraint" - }, - { - "destination": "385255522691733325", - "label": "T", - "source": "1418333499545421661", - "type": "constraint" - }, - { - "destination": "866345615551223718", - "label": "T", - "source": "1814355496814977880", - "type": "constraint" - }, - { - "destination": "137304962071054497", - "label": "T", - "source": "1512618198241549089", - "type": "constraint" - }, - { - "destination": "392540961352249242", - "label": "T1", - "source": "1635109601630198093", - "type": "constraint" - }, - { - "destination": "392540961352249242", - "label": "T3", - "source": "1635109601630198093", - "type": "constraint" - }, - { - "destination": "385255522691733325", - "label": "T2", - "source": "1635109601630198093", - "type": "constraint" - }, - { - "destination": "385255522691733325", - "label": "T5", - "source": "1635109601630198093", - "type": "constraint" - }, - { - "destination": "1830716585637735576", - "label": "T1,T3", - "source": "1429225801945621089", - "type": "constraint" - }, - { - "destination": "902541696362244204", - "label": "T1,T3", - "source": "856301122972546034", - "type": "constraint" - } - ] -} -)##"; auto j = generate_class_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); + // REQUIRE(json::IsClass(j, "clanguml::t00014::A")); + // REQUIRE(json::IsClass(j, "clanguml::t00014::B")); + // REQUIRE(json::IsClass(j, "clanguml::t00014::C")); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/t20029/test_case.h b/tests/t20029/test_case.h index d6e54ee5..f2c0e311 100644 --- a/tests/t20029/test_case.h +++ b/tests/t20029/test_case.h @@ -58,230 +58,7 @@ TEST_CASE("t20029", "[test-case][sequence]") save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); - const std::string expected_json = R"###( -{ - "diagram_type": "sequence", - "name": "t20029_sequence", - "participants": [ - { - "id": "2091374738808319642", - "name": "clanguml::t20029::tmain()", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 55 - }, - "type": "function" - }, - { - "id": "1673261195873192383", - "name": "clanguml::t20029::Encoder>", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 11 - }, - "type": "class" - }, - { - "id": "658058855590948094", - "name": "clanguml::t20029::Retrier", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 22 - }, - "type": "class" - }, - { - "id": "1896406205097618937", - "name": "clanguml::t20029::ConnectionPool", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 39 - }, - "type": "class" - }, - { - "id": "1362646431260879440", - "name": "clanguml::t20029::encode_b64(std::string &&)", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 9 - }, - "type": "function" - } - ], - "sequences": [ - { - "messages": [ - { - "from": { - "id": "2091374738808319642", - "name": "clanguml::t20029::tmain()" - }, - "name": "connect()", - "return_type": "void", - "scope": "normal", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 59 - }, - "to": { - "activity_id": "940428568182104530", - "activity_name": "clanguml::t20029::ConnectionPool::connect()", - "participant_id": "1896406205097618937", - "participant_name": "clanguml::t20029::ConnectionPool" - }, - "type": "message" - }, - { - "activity_id": "2091374738808319642", - "messages": [ - { - "activity_id": "2091374738808319642", - "branches": [ - { - "messages": [ - { - "from": { - "id": "2091374738808319642", - "name": "clanguml::t20029::tmain()" - }, - "name": "send(std::string &&)", - "return_type": "_Bool", - "scope": "condition", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 62 - }, - "to": { - "activity_id": "2026763864005979273", - "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", - "participant_id": "1673261195873192383", - "participant_name": "clanguml::t20029::Encoder>" - }, - "type": "message" - }, - { - "from": { - "id": "2026763864005979273", - "name": "clanguml::t20029::Encoder>::send(std::string &&)" - }, - "name": "encode(std::string &&)", - "return_type": "std::string", - "scope": "normal", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 15 - }, - "to": { - "activity_id": "1468258269466480773", - "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", - "participant_id": "1673261195873192383", - "participant_name": "clanguml::t20029::Encoder>" - }, - "type": "message" - }, - { - "from": { - "id": "1468258269466480773", - "name": "clanguml::t20029::Encoder>::encode(std::string &&)" - }, - "name": "", - "return_type": "", - "scope": "normal", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 19 - }, - "to": { - "activity_id": "1362646431260879440", - "activity_name": "clanguml::t20029::encode_b64(std::string &&)" - }, - "type": "message" - }, - { - "from": { - "id": "2026763864005979273", - "name": "clanguml::t20029::Encoder>::send(std::string &&)" - }, - "name": "send(std::string &&)", - "return_type": "_Bool", - "scope": "normal", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 15 - }, - "to": { - "activity_id": "30515971485361302", - "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", - "participant_id": "658058855590948094", - "participant_name": "clanguml::t20029::Retrier" - }, - "type": "message" - }, - { - "activity_id": "30515971485361302", - "messages": [ - { - "activity_id": "30515971485361302", - "branches": [ - { - "messages": [ - { - "from": { - "id": "30515971485361302", - "name": "clanguml::t20029::Retrier::send(std::string &&)" - }, - "name": "send(const std::string &)", - "return_type": "_Bool", - "scope": "condition", - "source_location": { - "file": "../../tests/t20029/t20029.cc", - "line": 31 - }, - "to": { - "activity_id": "972625940114169157", - "activity_name": "clanguml::t20029::ConnectionPool::send(const std::string &)", - "participant_id": "1896406205097618937", - "participant_name": "clanguml::t20029::ConnectionPool" - }, - "type": "message" - } - ], - "type": "consequent" - } - ], - "name": "if", - "type": "alt" - } - ], - "name": "while", - "type": "loop" - } - ], - "type": "consequent" - } - ], - "name": "if", - "type": "alt" - } - ], - "name": "for", - "type": "loop" - } - ], - "start_from": { - "id": 2091374738808319700, - "location": "clanguml::t20029::tmain()" - } - } - ], - "using_namespace": "clanguml::t20029" -} -)###"; - auto j = generate_sequence_json(diagram, *model); - REQUIRE(j == nlohmann::json::parse(expected_json)); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); } \ No newline at end of file diff --git a/tests/test_cases.h b/tests/test_cases.h index d520d6d0..e53ef0b7 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -77,6 +77,15 @@ using Catch::Matchers::StdString::CasedString; using Catch::Matchers::StdString::ContainsMatcher; using Catch::Matchers::StdString::RegexMatcher; +struct JsonMatcherBase : Catch::MatcherBase { + JsonMatcherBase( + std::string const &operation, CasedString const &comparator); + std::string describe() const override; + + CasedString m_comparator; + std::string m_operation; +}; + template constexpr bool has_type() noexcept { return (std::is_same_v || ... || false); @@ -589,6 +598,125 @@ ContainsMatcher IsDeprecated(std::string const &str, return ContainsMatcher( CasedString(str + " <> ", caseSensitivity)); } + +namespace json { +namespace detail { +auto get_element(const nlohmann::json &j, const std::string &name) +{ + return std::find_if(j["elements"].begin(), j["elements"].end(), + [&](const auto &it) { return it["display_name"] == name; }); +} + +auto get_relationship(const nlohmann::json &j, const nlohmann::json &from, + const nlohmann::json &to, const std::string &type) +{ + return std::find_if(j["relationships"].begin(), j["relationships"].end(), + [&](const auto &it) { + return (it["source"] == from) && (it["destination"] == to) && + (it["type"] == type); + }); +} + +auto get_relationship(const nlohmann::json &j, const std::string &from, + const std::string &to, const std::string &type) +{ + auto from_it = detail::get_element(j, from); + auto to_it = detail::get_element(j, to); + + if (from_it == j["elements"].end() || to_it == j["elements"].end()) + return j["relationships"].end(); + + return detail::get_relationship( + j, from_it->at("id"), to_it->at("id"), type); +} +} // namespace detail + +bool IsClass(const nlohmann::json &j, const std::string &name) +{ + return detail::get_element(j, name) != j["elements"].end(); +} + +bool IsBaseClass(const nlohmann::json &j, const std::string &base, + const std::string &subclass) +{ + auto sc = detail::get_element(j, subclass); + + if (sc == j["elements"].end()) + return false; + + const nlohmann::json &bases = (*sc)["bases"]; + + return std::find_if(bases.begin(), bases.end(), [&](const auto &it) { + return it["name"] == base; + }) != bases.end(); +} + +bool IsMethod( + const nlohmann::json &j, const std::string &cls, const std::string &name) +{ + auto sc = detail::get_element(j, cls); + + if (sc == j["elements"].end()) + return false; + + const nlohmann::json &methods = (*sc)["methods"]; + + return std::find_if(methods.begin(), methods.end(), [&](const auto &it) { + return it["name"] == name; + }) != methods.end(); +} + +bool IsAssociation(nlohmann::json j, const std::string &from, + const std::string &to, const std::string &label = "") +{ + auto rel = detail::get_relationship(j, from, to, "association"); + + if (rel == j["relationships"].end()) + return false; + + if (!label.empty() && rel->at("label") != label) + return false; + + return true; +} + +bool IsComposition(nlohmann::json j, const std::string &from, + const std::string &to, const std::string &label = "") +{ + auto rel = detail::get_relationship(j, from, to, "composition"); + + if (rel == j["relationships"].end()) + return false; + + if (!label.empty() && rel->at("label") != label) + return false; + + return true; +} + +bool IsAggregation(nlohmann::json j, const std::string &from, + const std::string &to, const std::string &label = "") +{ + auto rel = detail::get_relationship(j, from, to, "aggregation"); + + if (rel == j["relationships"].end()) + return false; + + if (!label.empty() && rel->at("label") != label) + return false; + + return true; +} + +bool IsDependency( + nlohmann::json j, const std::string &from, const std::string &to) +{ + auto rel = detail::get_relationship(j, from, to, "aggregation"); + + return rel != j["relationships"].end(); +} + +} // namespace json } } } From c59fbfa5654ade85e38c2167563a0bd0a14648c6 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 21 Mar 2023 00:37:42 +0100 Subject: [PATCH 15/30] Added JSON test case stubs for all class diagram test cases --- .../json/class_diagram_generator.cc | 9 +- .../generators/json/class_diagram_generator.h | 2 + .../visitor/translation_unit_visitor.cc | 1 + src/common/generators/json/generator.cc | 14 +- tests/t00002/test_case.h | 93 ++++---- tests/t00003/test_case.h | 83 +++---- tests/t00004/test_case.h | 81 ++++--- tests/t00005/test_case.h | 99 ++++++--- tests/t00006/test_case.h | 113 ++++++---- tests/t00007/test_case.h | 42 ++-- tests/t00008/test_case.h | 63 +++--- tests/t00009/test_case.h | 51 +++-- tests/t00010/test_case.h | 39 ++-- tests/t00011/test_case.h | 34 +-- tests/t00012/test_case.h | 38 ++-- tests/t00013/test_case.h | 68 +++--- tests/t00014/test_case.h | 203 ++++++++++-------- tests/t00015/test_case.h | 30 ++- tests/t00016/test_case.h | 46 ++-- tests/t00017/test_case.h | 80 ++++--- tests/t00018/test_case.h | 31 ++- tests/t00019/test_case.h | 54 +++-- tests/t00020/test_case.h | 38 ++-- tests/t00021/test_case.h | 34 +-- tests/t00022/test_case.h | 26 ++- tests/t00023/test_case.h | 26 ++- tests/t00024/test_case.h | 34 +-- tests/t00025/test_case.h | 52 +++-- tests/t00026/test_case.h | 35 +-- tests/t00027/test_case.h | 58 +++-- tests/t00028/test_case.h | 66 +++--- tests/t00029/test_case.h | 50 +++-- tests/t00030/test_case.h | 40 ++-- tests/t00031/test_case.h | 52 +++-- tests/t00032/test_case.h | 48 +++-- tests/t00033/test_case.h | 52 +++-- tests/t00034/test_case.h | 38 ++-- tests/t00035/test_case.h | 38 ++-- tests/t00036/test_case.h | 50 +++-- tests/t00037/test_case.h | 35 +-- tests/t00038/test_case.h | 118 +++++----- tests/t00039/test_case.h | 69 +++--- tests/t00040/test_case.h | 33 +-- tests/t00041/test_case.h | 65 +++--- tests/t00042/test_case.h | 26 ++- tests/t00043/test_case.h | 66 +++--- tests/t00044/test_case.h | 26 ++- tests/t00045/test_case.h | 72 ++++--- tests/t00046/test_case.h | 33 +-- tests/t00047/test_case.h | 33 +-- tests/t00048/test_case.h | 41 ++-- tests/t00049/test_case.h | 53 +++-- tests/t00050/test_case.h | 53 +++-- tests/t00051/test_case.h | 87 ++++---- tests/t00052/test_case.h | 39 ++-- tests/t00053/test_case.h | 51 +++-- tests/t00054/test_case.h | 57 +++-- tests/t00055/test_case.h | 59 ++--- tests/t00056/test_case.h | 157 +++++++------- tests/t00057/test_case.h | 60 +++--- tests/t00058/test_case.h | 69 +++--- tests/t00059/test_case.h | 103 +++++---- tests/t00060/test_case.h | 40 ++-- tests/test_cases.h | 123 +++++++++-- 64 files changed, 2189 insertions(+), 1390 deletions(-) diff --git a/src/class_diagram/generators/json/class_diagram_generator.cc b/src/class_diagram/generators/json/class_diagram_generator.cc index bcac7632..86403cd6 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.cc +++ b/src/class_diagram/generators/json/class_diagram_generator.cc @@ -22,6 +22,7 @@ namespace clanguml::class_diagram::model { using nlohmann::json; + void to_json(nlohmann::json &j, const class_element &c) { j["name"] = c.name(); @@ -113,6 +114,11 @@ generator::generator(diagram_config &config, diagram_model &model) void generator::generate(std::ostream &ostr) const { + if (m_config.using_namespace) + json_["using_namespace"] = m_config.using_namespace().to_string(); + json_["name"] = m_model.name(); + json_["diagram_type"] = "class"; + json_["elements"] = std::vector{}; json_["relationships"] = std::vector{}; @@ -120,9 +126,6 @@ void generator::generate(std::ostream &ostr) const generate_relationships(json_); - json_["name"] = m_model.name(); - json_["diagram_type"] = "class"; - ostr << json_; } diff --git a/src/class_diagram/generators/json/class_diagram_generator.h b/src/class_diagram/generators/json/class_diagram_generator.h index ef29a680..f05dd21f 100644 --- a/src/class_diagram/generators/json/class_diagram_generator.h +++ b/src/class_diagram/generators/json/class_diagram_generator.h @@ -84,6 +84,8 @@ public: void generate_relationships(const package &p, nlohmann::json &parent) const; private: + std::string render_name(std::string name) const; + mutable nlohmann::json json_; }; diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 9c286c6c..781ba0be 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -296,6 +296,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl( const auto id = common::to_id(cls_full_name); c_ptr->set_id(id); + c_ptr->is_template(true); set_ast_local_id(cls->getID(), id); diff --git a/src/common/generators/json/generator.cc b/src/common/generators/json/generator.cc index b02f8710..209acbc4 100644 --- a/src/common/generators/json/generator.cc +++ b/src/common/generators/json/generator.cc @@ -21,6 +21,15 @@ namespace clanguml::common::model { using nlohmann::json; +namespace detail { +std::string render_name(std::string name) +{ + util::replace_all(name, "##", "::"); + + return name; +} +} // namespace detail + void to_json(nlohmann::json &j, const source_location &sl) { j = json{{"file", sl.file_relative()}, {"line", sl.line()}}; @@ -28,9 +37,10 @@ void to_json(nlohmann::json &j, const source_location &sl) void to_json(nlohmann::json &j, const element &c) { - j = json{{"id", std::to_string(c.id())}, {"name", c.name()}, + j = json{{"id", std::to_string(c.id())}, + {"name", detail::render_name(c.name())}, {"namespace", c.get_namespace().to_string()}, {"type", c.type_name()}, - {"display_name", c.full_name(false)}}; + {"display_name", detail::render_name(c.full_name(false))}}; if (const auto &comment = c.comment(); comment) j["comment"] = comment.value(); diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h index 2f1f368e..84a4e86a 100644 --- a/tests/t00002/test_case.h +++ b/tests/t00002/test_case.h @@ -38,57 +38,62 @@ TEST_CASE("t00002", "[test-case][class]") REQUIRE(model->should_include({"clanguml", "t00002"}, "A")); REQUIRE(!model->should_include({"std"}, "vector")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("B"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("C"))); - REQUIRE_THAT(puml, IsBaseClass(_A("B"), _A("D"))); - REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("D"))); - REQUIRE_THAT(puml, (IsMethod("foo_a"))); - REQUIRE_THAT(puml, (IsMethod("foo_c"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsAbstractClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("B"))); + REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("C"))); + REQUIRE_THAT(puml, IsBaseClass(_A("B"), _A("D"))); + REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("D"))); + REQUIRE_THAT(puml, (IsMethod("foo_a"))); + REQUIRE_THAT(puml, (IsMethod("foo_c"))); - REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("A"), "-as")); + REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("A"), "-as")); - REQUIRE_THAT(puml, HasNote(_A("A"), "left", "This is class A")); - REQUIRE_THAT(puml, HasNote(_A("B"), "top", "This is class B")); + REQUIRE_THAT(puml, HasNote(_A("A"), "left", "This is class A")); + REQUIRE_THAT(puml, HasNote(_A("B"), "top", "This is class B")); - REQUIRE_THAT(puml, - HasLink(_A("A"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t00002/t00002.cc#L7", - clanguml::util::get_git_commit()), - "This is class A")); + REQUIRE_THAT(puml, + HasLink(_A("A"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t00002/t00002.cc#L7", + clanguml::util::get_git_commit()), + "This is class A")); - REQUIRE_THAT(puml, - HasLink(_A("B"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t00002/t00002.cc#L16", - clanguml::util::get_git_commit()), - "This is class B")); + REQUIRE_THAT(puml, + HasLink(_A("B"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t00002/t00002.cc#L16", + clanguml::util::get_git_commit()), + "This is class B")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - auto j = generate_class_json(diagram, *model); + using namespace json; - REQUIRE(json::IsClass(j, "clanguml::t00002::A")); - REQUIRE(json::IsClass(j, "clanguml::t00002::B")); - REQUIRE(json::IsClass(j, "clanguml::t00002::C")); - REQUIRE(json::IsBaseClass(j, "clanguml::t00002::A", "clanguml::t00002::B")); - REQUIRE(json::IsBaseClass(j, "clanguml::t00002::A", "clanguml::t00002::C")); - REQUIRE(json::IsBaseClass(j, "clanguml::t00002::B", "clanguml::t00002::D")); - REQUIRE(json::IsBaseClass(j, "clanguml::t00002::C", "clanguml::t00002::D")); - REQUIRE(json::IsMethod(j, "clanguml::t00002::A", "foo_a")); - REQUIRE(json::IsMethod(j, "clanguml::t00002::C", "foo_c")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsBaseClass(j, "A", "B")); + REQUIRE(IsBaseClass(j, "A", "C")); + REQUIRE(IsBaseClass(j, "B", "D")); + REQUIRE(IsBaseClass(j, "C", "D")); + REQUIRE(IsMethod(j, "A", "foo_a")); + REQUIRE(IsMethod(j, "C", "foo_c")); + REQUIRE(IsMember(j, "E", "as", "std::vector")); + REQUIRE(IsAssociation(j, "D", "A", "as")); - REQUIRE(json::IsAssociation( - j, "clanguml::t00002::D", "clanguml::t00002::A", "as")); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00003/test_case.h b/tests/t00003/test_case.h index bcb7b229..19b9615d 100644 --- a/tests/t00003/test_case.h +++ b/tests/t00003/test_case.h @@ -33,53 +33,60 @@ TEST_CASE("t00003", "[test-case][class]") REQUIRE(model->name() == "t00003_class"); REQUIRE(model->should_include(std::string("clanguml::t00003::A"))); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsDependency(_A("A"), _A("A"))); + REQUIRE_THAT(puml, !IsDependency(_A("A"), _A("A"))); - REQUIRE_THAT(puml, (IsMethod("A"))); - REQUIRE_THAT(puml, (IsMethod("~A"))); + REQUIRE_THAT(puml, (IsMethod("A"))); + REQUIRE_THAT(puml, (IsMethod("~A"))); - REQUIRE_THAT(puml, (IsMethod("basic_method"))); - REQUIRE_THAT(puml, (IsMethod("static_method", "int"))); - REQUIRE_THAT(puml, (IsMethod("const_method"))); - REQUIRE_THAT(puml, (IsMethod("default_int", "int", "int i = 12"))); - REQUIRE_THAT(puml, - (IsMethod("default_string", "std::string", - "int i, std::string s = \"abc\""))); + REQUIRE_THAT(puml, (IsMethod("basic_method"))); + REQUIRE_THAT(puml, (IsMethod("static_method", "int"))); + REQUIRE_THAT(puml, (IsMethod("const_method"))); + REQUIRE_THAT( + puml, (IsMethod("default_int", "int", "int i = 12"))); + REQUIRE_THAT(puml, + (IsMethod("default_string", "std::string", + "int i, std::string s = \"abc\""))); - REQUIRE_THAT(puml, (IsMethod("protected_method"))); - REQUIRE_THAT(puml, (IsMethod("private_method"))); - REQUIRE_THAT(puml, (IsField("public_member", "int"))); - REQUIRE_THAT(puml, (IsField("protected_member", "int"))); - REQUIRE_THAT(puml, (IsField("private_member", "int"))); - REQUIRE_THAT( - puml, (IsField("auto_member", "const unsigned long"))); + REQUIRE_THAT(puml, (IsMethod("protected_method"))); + REQUIRE_THAT(puml, (IsMethod("private_method"))); + REQUIRE_THAT(puml, (IsField("public_member", "int"))); + REQUIRE_THAT(puml, (IsField("protected_member", "int"))); + REQUIRE_THAT(puml, (IsField("private_member", "int"))); + REQUIRE_THAT(puml, + (IsField("auto_member", "const unsigned long"))); - REQUIRE_THAT(puml, (IsField("a_", "int"))); - REQUIRE_THAT(puml, (IsField("b_", "int"))); - REQUIRE_THAT(puml, (IsField("c_", "int"))); + REQUIRE_THAT(puml, (IsField("a_", "int"))); + REQUIRE_THAT(puml, (IsField("b_", "int"))); + REQUIRE_THAT(puml, (IsField("c_", "int"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - auto j = generate_class_json(diagram, *model); + { + auto j = generate_class_json(diagram, *model); - REQUIRE(json::IsClass(j, "clanguml::t00003::A")); - REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "A")); - REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "~A")); - REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "basic_method")); - REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "static_method")); - REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "const_method")); - REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "default_int")); - REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "default_string")); + using namespace json; - REQUIRE( - !json::IsDependency(j, "clanguml::t00002::A", "clanguml::t00002::A")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsMethod(j, "A", "A")); + REQUIRE(IsMethod(j, "A", "~A")); + REQUIRE(IsMethod(j, "A", "basic_method")); + REQUIRE(IsMethod(j, "A", "static_method")); + REQUIRE(IsMethod(j, "A", "const_method")); + REQUIRE(IsMethod(j, "A", "default_int")); + REQUIRE(IsMethod(j, "A", "default_string")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + REQUIRE(!IsDependency(j, "A", "A")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00004/test_case.h b/tests/t00004/test_case.h index dedc8496..098b46dc 100644 --- a/tests/t00004/test_case.h +++ b/tests/t00004/test_case.h @@ -35,37 +35,64 @@ TEST_CASE("t00004", "[test-case][class]") REQUIRE(model->should_include("clanguml::t00004::A::AA")); REQUIRE(model->should_include("clanguml::t00004::A:::AAA")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("A::AA"))); - REQUIRE_THAT(puml, IsClass(_A("A::AA::AAA"))); - REQUIRE_THAT(puml, IsEnum(_A("B::AA"))); - REQUIRE_THAT(puml, IsEnum(_A("A::AA::Lights"))); - REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::AA"))); - REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::AAA"))); - REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::Lights"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("A::AA"))); + REQUIRE_THAT(puml, IsClass(_A("A::AA::AAA"))); + REQUIRE_THAT(puml, IsEnum(_A("B::AA"))); + REQUIRE_THAT(puml, IsEnum(_A("A::AA::Lights"))); + REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::AA"))); + REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::AAA"))); + REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::Lights"))); - REQUIRE_THAT(puml, (IsMethod("foo"))); - REQUIRE_THAT(puml, (IsMethod("foo2"))); + REQUIRE_THAT(puml, (IsMethod("foo"))); + REQUIRE_THAT(puml, (IsMethod("foo2"))); - REQUIRE_THAT(puml, IsClassTemplate("C", "T")); - REQUIRE_THAT(puml, IsInnerClass(_A("C"), _A("C::AA"))); - REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::AAA"))); - REQUIRE_THAT(puml, IsInnerClass(_A("C"), _A("C::CC"))); - REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::CCC"))); + REQUIRE_THAT(puml, IsClassTemplate("C", "T")); + REQUIRE_THAT(puml, IsInnerClass(_A("C"), _A("C::AA"))); + REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::AAA"))); + REQUIRE_THAT(puml, IsInnerClass(_A("C"), _A("C::CC"))); + REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::CCC"))); - REQUIRE_THAT(puml, IsInnerClass(_A("C"), _A("C::B"))); - REQUIRE_THAT(puml, IsAggregation(_A("C"), _A("C::B"), "+b_int")); - REQUIRE_THAT(puml, !IsInnerClass(_A("C"), _A("C::B"))); - REQUIRE_THAT(puml, IsInstantiation(_A("C::B"), _A("C::B"))); + REQUIRE_THAT(puml, IsInnerClass(_A("C"), _A("C::B"))); + REQUIRE_THAT( + puml, IsAggregation(_A("C"), _A("C::B"), "+b_int")); + REQUIRE_THAT(puml, !IsInnerClass(_A("C"), _A("C::B"))); + REQUIRE_THAT(puml, IsInstantiation(_A("C::B"), _A("C::B"))); - REQUIRE_THAT(puml, IsClass(_A("detail::D"))); - REQUIRE_THAT(puml, IsClass(_A("detail::D::DD"))); - REQUIRE_THAT(puml, IsEnum(_A("detail::D::AA"))); + REQUIRE_THAT(puml, IsClass(_A("detail::D"))); + REQUIRE_THAT(puml, IsClass(_A("detail::D::DD"))); + REQUIRE_THAT(puml, IsEnum(_A("detail::D::AA"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "A::AA")); + REQUIRE(IsClass(j, "A::AA::AAA")); + REQUIRE(IsEnum(j, "B::AA")); + REQUIRE(IsEnum(j, "A::AA::Lights")); + REQUIRE(IsInnerClass(j, "A", "A::AA")); + REQUIRE(IsInnerClass(j, "A::AA", "A::AA::AAA")); + REQUIRE(IsInnerClass(j, "A::AA", "A::AA::Lights")); + + REQUIRE(IsClassTemplate(j, "C")); + + REQUIRE(IsClass(j, "detail::D")); + REQUIRE(IsClass(j, "detail::D::DD")); + REQUIRE(IsEnum(j, "detail::D::AA")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00005/test_case.h b/tests/t00005/test_case.h index 101e63ed..a38782b0 100644 --- a/tests/t00005/test_case.h +++ b/tests/t00005/test_case.h @@ -32,39 +32,76 @@ TEST_CASE("t00005", "[test-case][class]") REQUIRE(model->should_include("clanguml::t00005::C")); REQUIRE(model->should_include("clanguml::t00005::D")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsClass(_A("K"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(puml, IsClass(_A("H"))); + REQUIRE_THAT(puml, IsClass(_A("I"))); + REQUIRE_THAT(puml, IsClass(_A("J"))); + REQUIRE_THAT(puml, IsClass(_A("K"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, (IsField("some_int", "int"))); - REQUIRE_THAT(puml, (IsField("some_int_pointer", "int *"))); - REQUIRE_THAT(puml, (IsField("some_int_pointer_pointer", "int **"))); + REQUIRE_THAT(puml, (IsField("some_int", "int"))); + REQUIRE_THAT(puml, (IsField("some_int_pointer", "int *"))); + REQUIRE_THAT( + puml, (IsField("some_int_pointer_pointer", "int **"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "+e")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "+f")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("H"), "+h")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "+e")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "+f")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("H"), "+h")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "D")); + REQUIRE(IsClass(j, "E")); + REQUIRE(IsClass(j, "F")); + REQUIRE(IsClass(j, "G")); + REQUIRE(IsClass(j, "H")); + REQUIRE(IsClass(j, "I")); + REQUIRE(IsClass(j, "J")); + REQUIRE(IsClass(j, "K")); + REQUIRE(IsClass(j, "R")); + + REQUIRE(IsAggregation(j, "R", "A", "a")); + REQUIRE(IsAssociation(j, "R", "B", "b")); + REQUIRE(IsAssociation(j, "R", "C", "c")); + REQUIRE(IsAssociation(j, "R", "D", "d")); + REQUIRE(IsAssociation(j, "R", "E", "e")); + REQUIRE(IsAggregation(j, "R", "F", "f")); + REQUIRE(IsAssociation(j, "R", "G", "g")); + REQUIRE(IsAssociation(j, "R", "H", "h")); + REQUIRE(IsAssociation(j, "R", "I", "i")); + REQUIRE(IsAssociation(j, "R", "J", "j")); + REQUIRE(IsAssociation(j, "R", "K", "k")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00006/test_case.h b/tests/t00006/test_case.h index ead4a773..f0219f5a 100644 --- a/tests/t00006/test_case.h +++ b/tests/t00006/test_case.h @@ -34,47 +34,82 @@ TEST_CASE("t00006", "[test-case][class]") REQUIRE(model->should_include("clanguml::t00006::D")); REQUIRE(model->should_include("clanguml::t00006::E")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsClass(_A("K"))); - REQUIRE_THAT(puml, IsClass(_A("L"))); - REQUIRE_THAT(puml, IsClass(_A("M"))); - REQUIRE_THAT(puml, IsClass(_A("N"))); - REQUIRE_THAT(puml, IsClass(_A("NN"))); - REQUIRE_THAT(puml, IsClass(_A("NNN"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(puml, IsClass(_A("H"))); + REQUIRE_THAT(puml, IsClass(_A("I"))); + REQUIRE_THAT(puml, IsClass(_A("J"))); + REQUIRE_THAT(puml, IsClass(_A("K"))); + REQUIRE_THAT(puml, IsClass(_A("L"))); + REQUIRE_THAT(puml, IsClass(_A("M"))); + REQUIRE_THAT(puml, IsClass(_A("N"))); + REQUIRE_THAT(puml, IsClass(_A("NN"))); + REQUIRE_THAT(puml, IsClass(_A("NNN"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("custom_container"), _A("custom_container"))); + REQUIRE_THAT(puml, + IsInstantiation( + _A("custom_container"), _A("custom_container"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+c")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("custom_container"), "+e")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "+f")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("H"), "+h")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("J"), "+j")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("L"), "+lm")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("M"), "+lm")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("N"), "+ns")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NN"), "+ns")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NNN"), "+ns")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+c")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("custom_container"), "+e")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "+f")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("H"), "+h")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("J"), "+j")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("L"), "+lm")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("M"), "+lm")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("N"), "+ns")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NN"), "+ns")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NNN"), "+ns")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "D")); + REQUIRE(IsClass(j, "E")); + REQUIRE(IsClass(j, "F")); + REQUIRE(IsClass(j, "G")); + REQUIRE(IsClass(j, "H")); + REQUIRE(IsClass(j, "I")); + REQUIRE(IsClass(j, "J")); + REQUIRE(IsClass(j, "K")); + REQUIRE(IsClass(j, "L")); + REQUIRE(IsClass(j, "M")); + REQUIRE(IsClass(j, "N")); + REQUIRE(IsClass(j, "NN")); + REQUIRE(IsClass(j, "NNN")); + + REQUIRE(IsAggregation( + j, "R", "custom_container", "e")); + REQUIRE(IsInstantiation( + j, "custom_container", "custom_container")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00007/test_case.h b/tests/t00007/test_case.h index 54a71c2a..ce80ef52 100644 --- a/tests/t00007/test_case.h +++ b/tests/t00007/test_case.h @@ -28,19 +28,37 @@ TEST_CASE("t00007", "[test-case][class]") REQUIRE(model->name() == "t00007_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "R")); + REQUIRE(IsAggregation(j, "R", "A", "a")); + REQUIRE(IsAssociation(j, "R", "B", "b")); + REQUIRE(IsAssociation(j, "R", "C", "c")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00008/test_case.h b/tests/t00008/test_case.h index aad94ba6..8687106e 100644 --- a/tests/t00008/test_case.h +++ b/tests/t00008/test_case.h @@ -28,32 +28,47 @@ TEST_CASE("t00008", "[test-case][class]") REQUIRE(model->name() == "t00008_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // TODO: add option to resolve using declared types - // REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int), int - // N")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // TODO: add option to resolve using declared types + // REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int), + // int N")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3")); + REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>")); - REQUIRE_THAT(puml, (IsField("value", "T"))); - REQUIRE_THAT(puml, (IsField("pointer", "T *"))); - REQUIRE_THAT(puml, (IsField("reference", "T &"))); - REQUIRE_THAT(puml, (IsField("values", "std::vector

"))); - REQUIRE_THAT(puml, (IsField("ints", "std::array"))); - // TODO: add option to resolve using declared types - // REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator"))); - REQUIRE_THAT(puml, (IsField("comparator", "CMP"))); + REQUIRE_THAT(puml, (IsField("value", "T"))); + REQUIRE_THAT(puml, (IsField("pointer", "T *"))); + REQUIRE_THAT(puml, (IsField("reference", "T &"))); + REQUIRE_THAT(puml, (IsField("values", "std::vector

"))); + REQUIRE_THAT(puml, (IsField("ints", "std::array"))); + // TODO: add option to resolve using declared types + // REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator"))); + REQUIRE_THAT(puml, (IsField("comparator", "CMP"))); - REQUIRE_THAT(puml, !IsClass(_A("E::nested_template"))); - REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "ET")); - REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "char")); - REQUIRE_THAT(puml, - IsInstantiation( - _A("E::nested_template"), _A("E::nested_template"))); + REQUIRE_THAT(puml, !IsClass(_A("E::nested_template"))); + REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "ET")); + REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "char")); + REQUIRE_THAT(puml, + IsInstantiation( + _A("E::nested_template"), _A("E::nested_template"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + REQUIRE(IsClassTemplate( + j, "A")); + REQUIRE(IsClassTemplate(j, "E::nested_template")); + REQUIRE(IsClass(j, "E::nested_template")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00009/test_case.h b/tests/t00009/test_case.h index d522749e..99e00aa2 100644 --- a/tests/t00009/test_case.h +++ b/tests/t00009/test_case.h @@ -28,28 +28,41 @@ TEST_CASE("t00009", "[test-case][class]") REQUIRE(model->name() == "t00009_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T")); + REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, (IsField("value", "T"))); - REQUIRE_THAT(puml, (IsField("aint", "A"))); - REQUIRE_THAT(puml, (IsField("astring", "A *"))); - REQUIRE_THAT( - puml, (IsField("avector", "A> &"))); + REQUIRE_THAT(puml, (IsField("value", "T"))); + REQUIRE_THAT(puml, (IsField("aint", "A"))); + REQUIRE_THAT(puml, (IsField("astring", "A *"))); + REQUIRE_THAT(puml, + (IsField("avector", "A> &"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+aint")); - REQUIRE_THAT( - puml, IsAssociation(_A("B"), _A("A"), "+astring")); - REQUIRE_THAT(puml, - IsAssociation(_A("B"), _A("A>"), "+avector")); + REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+aint")); + REQUIRE_THAT( + puml, IsAssociation(_A("B"), _A("A"), "+astring")); + REQUIRE_THAT(puml, + IsAssociation( + _A("B"), _A("A>"), "+avector")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + REQUIRE(IsClass(j, "A")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00010/test_case.h b/tests/t00010/test_case.h index c64778a5..4a30f573 100644 --- a/tests/t00010/test_case.h +++ b/tests/t00010/test_case.h @@ -28,23 +28,34 @@ TEST_CASE("t00010", "[test-case][class]") REQUIRE(model->name() == "t00010_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); + REQUIRE_THAT(puml, IsClassTemplate("B", "T")); - REQUIRE_THAT(puml, (IsField("astring", "A"))); - REQUIRE_THAT(puml, (IsField("aintstring", "B"))); + REQUIRE_THAT(puml, (IsField("astring", "A"))); + REQUIRE_THAT(puml, (IsField("aintstring", "B"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("B"), _A("B"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("B"), _A("B"))); - REQUIRE_THAT( - puml, IsAggregation(_A("B"), _A("A"), "+astring")); - REQUIRE_THAT(puml, IsAggregation(_A("C"), _A("B"), "+aintstring")); + REQUIRE_THAT(puml, + IsAggregation(_A("B"), _A("A"), "+astring")); + REQUIRE_THAT(puml, IsAggregation(_A("C"), _A("B"), "+aintstring")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00011/test_case.h b/tests/t00011/test_case.h index 9a717a8e..5dea69df 100644 --- a/tests/t00011/test_case.h +++ b/tests/t00011/test_case.h @@ -28,19 +28,29 @@ TEST_CASE("t00011", "[test-case][class]") REQUIRE(model->name() == "t00011_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsClass(_A("external::C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, !IsClass(_A("external::C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsAssociation(_A("B"), _A("A"))); - REQUIRE_THAT(puml, IsFriend(_A("A"), _A("B"))); - // REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D"))); + REQUIRE_THAT(puml, IsAssociation(_A("B"), _A("A"))); + REQUIRE_THAT(puml, IsFriend(_A("A"), _A("B"))); + // REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00012/test_case.h b/tests/t00012/test_case.h index 9b2daeeb..432a0fa5 100644 --- a/tests/t00012/test_case.h +++ b/tests/t00012/test_case.h @@ -28,20 +28,32 @@ TEST_CASE("t00012", "[test-case][class]") REQUIRE(model->name() == "t00012_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("B", "int... Is")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,Ts...")); + REQUIRE_THAT(puml, IsClassTemplate("B", "int... Is")); - REQUIRE_THAT(puml, IsInstantiation(_A("B"), _A("B<3,2,1>"))); - REQUIRE_THAT(puml, IsInstantiation(_A("B"), _A("B<1,1,1,1>"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("C"), - _A("C>>>,3,3,3>"))); + REQUIRE_THAT(puml, IsInstantiation(_A("B"), _A("B<3,2,1>"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("B"), _A("B<1,1,1,1>"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("C"), + _A("C>>>,3,3," + "3>"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00013/test_case.h b/tests/t00013/test_case.h index 50cedf0d..97ca85e3 100644 --- a/tests/t00013/test_case.h +++ b/tests/t00013/test_case.h @@ -31,36 +31,48 @@ TEST_CASE("t00013", "[test-case][class]") REQUIRE(model->should_include("clanguml::t00013::B")); REQUIRE(model->should_include("ABCD::F")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClassTemplate("E", "T")); - REQUIRE_THAT(puml, IsClassTemplate("G", "T,Args...")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClassTemplate("E", "T")); + REQUIRE_THAT(puml, IsClassTemplate("G", "T,Args...")); - REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("R"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("C"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("D"))); - REQUIRE_THAT(puml, IsDependency(_A("D"), _A("R"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E"))); - REQUIRE_THAT(puml, IsInstantiation(_A("E"), _A("E"))); - REQUIRE_THAT(puml, IsInstantiation(_A("E"), _A("E"))); - REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("E"), "-estring")); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F"))); - REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F"), _A("ABCD::F"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F"))); + REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("R"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("C"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("D"))); + REQUIRE_THAT(puml, IsDependency(_A("D"), _A("R"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E"))); + REQUIRE_THAT(puml, IsInstantiation(_A("E"), _A("E"))); + REQUIRE_THAT(puml, IsInstantiation(_A("E"), _A("E"))); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("E"), "-estring")); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("ABCD::F"), _A("ABCD::F"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("G"), _A("G"))); + REQUIRE_THAT(puml, + IsInstantiation( + _A("G"), _A("G"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index 3df7d280..f336750d 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -29,110 +29,127 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE(model->name() == "t00014_class"); REQUIRE(model->should_include("clanguml::t00014::B")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::unique_ptr")); - REQUIRE_THAT(puml, IsClassTemplate("A", "double,T")); - // TODO: Figure out how to handle the same templates with different template - // parameter names - // REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U")); - REQUIRE_THAT(puml, IsClassTemplate("A", "long,T")); - REQUIRE_THAT(puml, IsClassTemplate("A", "long,bool")); - REQUIRE_THAT(puml, IsClassTemplate("A", "double,bool")); - REQUIRE_THAT(puml, IsClassTemplate("A", "long,float")); - REQUIRE_THAT(puml, IsClassTemplate("A", "double,float")); - REQUIRE_THAT(puml, IsClassTemplate("A", "bool,std::string")); - REQUIRE_THAT(puml, IsClassTemplate("A", "std::string,std::string")); - REQUIRE_THAT(puml, IsClassTemplate("A", "char,std::string")); - REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string")); + REQUIRE_THAT( + puml, IsClassTemplate("A", "T,std::unique_ptr")); + REQUIRE_THAT(puml, IsClassTemplate("A", "double,T")); + // TODO: Figure out how to handle the same templates with different + // template + // parameter names + // REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U")); + REQUIRE_THAT(puml, IsClassTemplate("A", "long,T")); + REQUIRE_THAT(puml, IsClassTemplate("A", "long,bool")); + REQUIRE_THAT(puml, IsClassTemplate("A", "double,bool")); + REQUIRE_THAT(puml, IsClassTemplate("A", "long,float")); + REQUIRE_THAT(puml, IsClassTemplate("A", "double,float")); + REQUIRE_THAT(puml, IsClassTemplate("A", "bool,std::string")); + REQUIRE_THAT(puml, IsClassTemplate("A", "std::string,std::string")); + REQUIRE_THAT(puml, IsClassTemplate("A", "char,std::string")); + REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsField("bapair", "PairPairBA")); - REQUIRE_THAT(puml, IsField("abool", "APtr")); - REQUIRE_THAT(puml, IsField("aboolfloat", "AAPtr")); - REQUIRE_THAT(puml, IsField("afloat", "ASharedPtr")); - REQUIRE_THAT(puml, IsField("boolstring", "A")); - REQUIRE_THAT(puml, IsField("floatstring", "AStringPtr")); - REQUIRE_THAT(puml, IsField("intstring", "AIntString")); - REQUIRE_THAT(puml, IsField("stringstring", "AStringString")); - REQUIRE_THAT(puml, IsField("bstringstring", "BStringString")); + REQUIRE_THAT(puml, IsField("bapair", "PairPairBA")); + REQUIRE_THAT(puml, IsField("abool", "APtr")); + REQUIRE_THAT(puml, IsField("aboolfloat", "AAPtr")); + REQUIRE_THAT(puml, IsField("afloat", "ASharedPtr")); + REQUIRE_THAT( + puml, IsField("boolstring", "A")); + REQUIRE_THAT( + puml, IsField("floatstring", "AStringPtr")); + REQUIRE_THAT(puml, IsField("intstring", "AIntString")); + REQUIRE_THAT(puml, IsField("stringstring", "AStringString")); + REQUIRE_THAT(puml, IsField("bstringstring", "BStringString")); - REQUIRE_THAT(puml, IsField("bs", "BVector")); + REQUIRE_THAT(puml, IsField("bs", "BVector")); - REQUIRE_THAT(puml, IsField("cb", "SimpleCallback")); - REQUIRE_THAT( - puml, IsField("gcb", "GenericCallback")); - REQUIRE_THAT(puml, IsField("vcb", "VoidCallback")); + REQUIRE_THAT( + puml, IsField("cb", "SimpleCallback")); + REQUIRE_THAT( + puml, IsField("gcb", "GenericCallback")); + REQUIRE_THAT(puml, IsField("vcb", "VoidCallback")); - REQUIRE_THAT( - puml, !IsClassTemplate("std::std::function", "void(T...,int),int)")); + REQUIRE_THAT(puml, + !IsClassTemplate("std::std::function", "void(T...,int),int)")); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - // REQUIRE_THAT(puml, !IsInstantiation(_A("A"), - // _A("A"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + // REQUIRE_THAT(puml, !IsInstantiation(_A("A"), + // _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, + IsInstantiation( + _A("A"), _A("A"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("A>"), - _A("A>"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("A"), _A("A>"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("A>"), + _A("A>"))); + REQUIRE_THAT(puml, + IsInstantiation( + _A("A"), _A("A>"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vps")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair")); - REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "-bapair")); - REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); - REQUIRE_THAT( - puml, IsAssociation(_A("R"), _A("A"), "-afloat")); - REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("A"), "-boolstring")); - REQUIRE_THAT(puml, - IsAggregation(_A("R"), _A("A>"), - "-floatstring")); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vps")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("A"), "-bapair")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT( + puml, IsAssociation(_A("R"), _A("A"), "-afloat")); + REQUIRE_THAT(puml, + IsAggregation(_A("R"), _A("A"), "-boolstring")); + REQUIRE_THAT(puml, + IsAggregation(_A("R"), _A("A>"), + "-floatstring")); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - auto j = generate_class_json(diagram, *model); + using namespace json; - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass( - j, "clanguml::t00014::A>")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - REQUIRE(json::IsClass(j, "clanguml::t00014::B")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A>")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "A")); + REQUIRE(json::IsClass(j, "B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00015/test_case.h b/tests/t00015/test_case.h index 12ed0c5e..6cc1a493 100644 --- a/tests/t00015/test_case.h +++ b/tests/t00015/test_case.h @@ -29,16 +29,26 @@ TEST_CASE("t00015", "[test-case][class]") REQUIRE(model->name() == "t00015_class"); REQUIRE(model->should_include("clanguml::t00015::ns1::ns2::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("ns1::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2_v0_9_0::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::Anon"))); - REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon"))); - REQUIRE_THAT(puml, IsClass(_A("ns3::B"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("ns1::A"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::ns2_v0_9_0::A"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::Anon"))); + REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon"))); + REQUIRE_THAT(puml, IsClass(_A("ns3::B"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00016/test_case.h b/tests/t00016/test_case.h index f2519687..44a20380 100644 --- a/tests/t00016/test_case.h +++ b/tests/t00016/test_case.h @@ -29,25 +29,35 @@ TEST_CASE("t00016", "[test-case][class]") REQUIRE(model->name() == "t00016_class"); REQUIRE(model->should_include("clanguml::t00016::is_numeric")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "int")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "bool")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "char")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "float")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "")); + REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "int")); + REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "bool")); + REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "char")); + REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "float")); - REQUIRE_THAT( - puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00017/test_case.h b/tests/t00017/test_case.h index f5fae0ea..b76ca620 100644 --- a/tests/t00017/test_case.h +++ b/tests/t00017/test_case.h @@ -28,44 +28,54 @@ TEST_CASE("t00017", "[test-case][class]") REQUIRE(model->name() == "t00017_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsClass(_A("K"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(puml, IsClass(_A("H"))); + REQUIRE_THAT(puml, IsClass(_A("I"))); + REQUIRE_THAT(puml, IsClass(_A("J"))); + REQUIRE_THAT(puml, IsClass(_A("K"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, (IsField("some_int", "int"))); - REQUIRE_THAT(puml, (IsField("some_int_pointer", "int *"))); - REQUIRE_THAT( - puml, (IsField("some_int_pointer_pointer", "int **"))); + REQUIRE_THAT(puml, (IsField("some_int", "int"))); + REQUIRE_THAT(puml, (IsField("some_int_pointer", "int *"))); + REQUIRE_THAT( + puml, (IsField("some_int_pointer_pointer", "int **"))); - // Relationship members should not be rendered as part of this testcase - REQUIRE_THAT(puml, !(IsField("a", _A("A")))); - REQUIRE_THAT(puml, !(IsField("b", _A("B")))); + // Relationship members should not be rendered as part of this testcase + REQUIRE_THAT(puml, !(IsField("a", _A("A")))); + REQUIRE_THAT(puml, !(IsField("b", _A("B")))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "-a")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "-b")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "-c")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "-d")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "-e")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "-f")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "-g")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("H"), "-h")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "-i")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "-k")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "-a")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "-b")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "-c")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "-d")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "-e")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "-f")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "-g")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("H"), "-h")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "-i")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "-k")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00018/test_case.h b/tests/t00018/test_case.h index cea7544b..1c67633b 100644 --- a/tests/t00018/test_case.h +++ b/tests/t00018/test_case.h @@ -28,19 +28,28 @@ TEST_CASE("t00018", "[test-case][class]") REQUIRE(model->name() == "t00018_class"); REQUIRE(model->should_include("clanguml::t00018::widget")); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("widget"))); + REQUIRE_THAT(puml, IsClass(_A("impl::widget"))); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("widget"))); - REQUIRE_THAT(puml, IsClass(_A("impl::widget"))); + REQUIRE_THAT( + puml, IsAggregation(_A("widget"), _A("impl::widget"), "-pImpl")); + REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget"))); + REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget"))); - REQUIRE_THAT( - puml, IsAggregation(_A("widget"), _A("impl::widget"), "-pImpl")); - REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget"))); - REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00019/test_case.h b/tests/t00019/test_case.h index 6165fd16..3874dd5d 100644 --- a/tests/t00019/test_case.h +++ b/tests/t00019/test_case.h @@ -28,31 +28,43 @@ TEST_CASE("t00019", "[test-case][class]") REQUIRE(model->name() == "t00019_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Base"))); - REQUIRE_THAT(puml, IsClassTemplate("Layer1", "LowerLayer")); - REQUIRE_THAT(puml, IsClassTemplate("Layer2", "LowerLayer")); - REQUIRE_THAT(puml, IsClassTemplate("Layer3", "LowerLayer")); - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Layer3"))); - REQUIRE_THAT( - puml, IsBaseClass(_A("Layer3"), _A("Layer2>"))); - REQUIRE_THAT(puml, - IsBaseClass( - _A("Layer2>"), _A("Layer1>>"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("Base"))); + REQUIRE_THAT(puml, IsClassTemplate("Layer1", "LowerLayer")); + REQUIRE_THAT(puml, IsClassTemplate("Layer2", "LowerLayer")); + REQUIRE_THAT(puml, IsClassTemplate("Layer3", "LowerLayer")); + REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Layer3"))); + REQUIRE_THAT( + puml, IsBaseClass(_A("Layer3"), _A("Layer2>"))); + REQUIRE_THAT(puml, + IsBaseClass(_A("Layer2>"), + _A("Layer1>>"))); - REQUIRE_THAT(puml, - IsAggregation(_A("A"), _A("Layer1>>"), "+layers")); + REQUIRE_THAT(puml, + IsAggregation( + _A("A"), _A("Layer1>>"), "+layers")); - REQUIRE_THAT( - puml, !IsAggregation(_A("A"), _A("Layer2>"), "+layers")); + REQUIRE_THAT(puml, + !IsAggregation(_A("A"), _A("Layer2>"), "+layers")); - REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Layer3"), "+layers")); + REQUIRE_THAT( + puml, !IsAggregation(_A("A"), _A("Layer3"), "+layers")); - REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Base"), "+layers")); + REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Base"), "+layers")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00020/test_case.h b/tests/t00020/test_case.h index 17000f1e..570d7fc7 100644 --- a/tests/t00020/test_case.h +++ b/tests/t00020/test_case.h @@ -29,20 +29,30 @@ TEST_CASE("t00020", "[test-case][class]") REQUIRE(model->name() == "t00020_class"); REQUIRE(model->should_include("clanguml::t00020::ProductA")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("ProductA"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("ProductB"))); - REQUIRE_THAT(puml, IsClass(_A("ProductA1"))); - REQUIRE_THAT(puml, IsClass(_A("ProductA2"))); - REQUIRE_THAT(puml, IsClass(_A("ProductB1"))); - REQUIRE_THAT(puml, IsClass(_A("ProductB2"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("AbstractFactory"))); - REQUIRE_THAT(puml, IsClass(_A("Factory1"))); - REQUIRE_THAT(puml, IsClass(_A("Factory2"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsAbstractClass(_A("ProductA"))); + REQUIRE_THAT(puml, IsAbstractClass(_A("ProductB"))); + REQUIRE_THAT(puml, IsClass(_A("ProductA1"))); + REQUIRE_THAT(puml, IsClass(_A("ProductA2"))); + REQUIRE_THAT(puml, IsClass(_A("ProductB1"))); + REQUIRE_THAT(puml, IsClass(_A("ProductB2"))); + REQUIRE_THAT(puml, IsAbstractClass(_A("AbstractFactory"))); + REQUIRE_THAT(puml, IsClass(_A("Factory1"))); + REQUIRE_THAT(puml, IsClass(_A("Factory2"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00021/test_case.h b/tests/t00021/test_case.h index 87eb192a..6df1349e 100644 --- a/tests/t00021/test_case.h +++ b/tests/t00021/test_case.h @@ -29,18 +29,28 @@ TEST_CASE("t00021", "[test-case][class]") REQUIRE(model->name() == "t00021_class"); REQUIRE(model->should_include("clanguml::t00021::Visitor")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Item"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("Visitor"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("Visitor1"))); - REQUIRE_THAT(puml, IsClass(_A("Visitor2"))); - REQUIRE_THAT(puml, IsClass(_A("Visitor3"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsAbstractClass(_A("Item"))); + REQUIRE_THAT(puml, IsAbstractClass(_A("Visitor"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("Visitor1"))); + REQUIRE_THAT(puml, IsClass(_A("Visitor2"))); + REQUIRE_THAT(puml, IsClass(_A("Visitor3"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00022/test_case.h b/tests/t00022/test_case.h index 6078122e..15a2fbe1 100644 --- a/tests/t00022/test_case.h +++ b/tests/t00022/test_case.h @@ -29,14 +29,24 @@ TEST_CASE("t00022", "[test-case][class]") REQUIRE(model->name() == "t00022_class"); REQUIRE(model->should_include("clanguml::t00022::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("A1"))); - REQUIRE_THAT(puml, IsClass(_A("A2"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsAbstractClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("A1"))); + REQUIRE_THAT(puml, IsClass(_A("A2"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00023/test_case.h b/tests/t00023/test_case.h index ff92588a..1bb05f03 100644 --- a/tests/t00023/test_case.h +++ b/tests/t00023/test_case.h @@ -29,14 +29,24 @@ TEST_CASE("t00023", "[test-case][class]") REQUIRE(model->name() == "t00023_class"); REQUIRE(model->should_include("clanguml::t00023::Visitor")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Strategy"))); - REQUIRE_THAT(puml, IsClass(_A("StrategyA"))); - REQUIRE_THAT(puml, IsClass(_A("StrategyB"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsAbstractClass(_A("Strategy"))); + REQUIRE_THAT(puml, IsClass(_A("StrategyA"))); + REQUIRE_THAT(puml, IsClass(_A("StrategyB"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00024/test_case.h b/tests/t00024/test_case.h index ea7f5aa8..ca123ce0 100644 --- a/tests/t00024/test_case.h +++ b/tests/t00024/test_case.h @@ -29,18 +29,28 @@ TEST_CASE("t00024", "[test-case][class]") REQUIRE(model->name() == "t00024_class"); REQUIRE(model->should_include("clanguml::t00024::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Target"))); - REQUIRE_THAT(puml, IsClass(_A("Target1"))); - REQUIRE_THAT(puml, IsClass(_A("Target2"))); - REQUIRE_THAT(puml, IsClass(_A("Proxy"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target1"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Proxy"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsAbstractClass(_A("Target"))); + REQUIRE_THAT(puml, IsClass(_A("Target1"))); + REQUIRE_THAT(puml, IsClass(_A("Target2"))); + REQUIRE_THAT(puml, IsClass(_A("Proxy"))); + REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target1"))); + REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2"))); + REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Proxy"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00025/test_case.h b/tests/t00025/test_case.h index b23ac6e2..8d915bd6 100644 --- a/tests/t00025/test_case.h +++ b/tests/t00025/test_case.h @@ -29,26 +29,38 @@ TEST_CASE("t00025", "[test-case][class]") REQUIRE(model->name() == "t00025_class"); REQUIRE(model->should_include("clanguml::t00025::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Target1"))); - REQUIRE_THAT(puml, IsClass(_A("Target2"))); - REQUIRE_THAT(puml, IsClassTemplate("Proxy", "T")); - REQUIRE_THAT(puml, IsInstantiation(_A("Proxy"), _A("Proxy"))); - REQUIRE_THAT(puml, IsInstantiation(_A("Proxy"), _A("Proxy"))); - REQUIRE_THAT(puml, - IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy1")); - REQUIRE_THAT(puml, - IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy2")); - REQUIRE_THAT( - puml, !IsAggregation(_A("ProxyHolder"), _A("Target1"), "+proxy1")); - REQUIRE_THAT( - puml, !IsAggregation(_A("ProxyHolder"), _A("Target2"), "+proxy2")); - REQUIRE_THAT(puml, IsDependency(_A("Proxy"), _A("Target1"))); - REQUIRE_THAT(puml, IsDependency(_A("Proxy"), _A("Target2"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("Target1"))); + REQUIRE_THAT(puml, IsClass(_A("Target2"))); + REQUIRE_THAT(puml, IsClassTemplate("Proxy", "T")); + REQUIRE_THAT( + puml, IsInstantiation(_A("Proxy"), _A("Proxy"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("Proxy"), _A("Proxy"))); + REQUIRE_THAT(puml, + IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy1")); + REQUIRE_THAT(puml, + IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy2")); + REQUIRE_THAT( + puml, !IsAggregation(_A("ProxyHolder"), _A("Target1"), "+proxy1")); + REQUIRE_THAT( + puml, !IsAggregation(_A("ProxyHolder"), _A("Target2"), "+proxy2")); + REQUIRE_THAT(puml, IsDependency(_A("Proxy"), _A("Target1"))); + REQUIRE_THAT(puml, IsDependency(_A("Proxy"), _A("Target2"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00026/test_case.h b/tests/t00026/test_case.h index aabb247e..5ce6fde7 100644 --- a/tests/t00026/test_case.h +++ b/tests/t00026/test_case.h @@ -29,18 +29,29 @@ TEST_CASE("t00026", "[test-case][class]") REQUIRE(model->name() == "t00026_class"); REQUIRE(model->should_include("clanguml::t00026::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("Memento", "T")); - REQUIRE_THAT(puml, IsClassTemplate("Originator", "T")); - REQUIRE_THAT(puml, IsClassTemplate("Caretaker", "T")); - REQUIRE_THAT(puml, - IsInstantiation(_A("Originator"), _A("Originator"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("Caretaker"), _A("Caretaker"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClassTemplate("Memento", "T")); + REQUIRE_THAT(puml, IsClassTemplate("Originator", "T")); + REQUIRE_THAT(puml, IsClassTemplate("Caretaker", "T")); + REQUIRE_THAT(puml, + IsInstantiation( + _A("Originator"), _A("Originator"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("Caretaker"), _A("Caretaker"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00027/test_case.h b/tests/t00027/test_case.h index ea3e5b7a..0c36648c 100644 --- a/tests/t00027/test_case.h +++ b/tests/t00027/test_case.h @@ -29,30 +29,42 @@ TEST_CASE("t00027", "[test-case][class]") REQUIRE(model->name() == "t00027_class"); REQUIRE(model->should_include("clanguml::t00027::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Shape"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator"))); - REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>...")); - REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>...")); - REQUIRE_THAT(puml, IsInstantiation(_A("Line...>"), _A("Line"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("Line...>"), _A("Line"))); - REQUIRE_THAT(puml, IsInstantiation(_A("Text...>"), _A("Text"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("Text...>"), _A("Text"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsAbstractClass(_A("Shape"))); + REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator"))); + REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>...")); + REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>...")); + REQUIRE_THAT( + puml, IsInstantiation(_A("Line...>"), _A("Line"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("Line...>"), _A("Line"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("Text...>"), _A("Text"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("Text...>"), _A("Text"))); - REQUIRE_THAT( - puml, IsAggregation(_A("Window"), _A("Line"), "+border")); - REQUIRE_THAT( - puml, IsAggregation(_A("Window"), _A("Line"), "+divider")); - REQUIRE_THAT( - puml, IsAggregation(_A("Window"), _A("Text"), "+title")); - REQUIRE_THAT( - puml, IsAggregation(_A("Window"), _A("Text"), "+description")); + REQUIRE_THAT(puml, + IsAggregation(_A("Window"), _A("Line"), "+border")); + REQUIRE_THAT( + puml, IsAggregation(_A("Window"), _A("Line"), "+divider")); + REQUIRE_THAT(puml, + IsAggregation(_A("Window"), _A("Text"), "+title")); + REQUIRE_THAT(puml, + IsAggregation(_A("Window"), _A("Text"), "+description")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00028/test_case.h b/tests/t00028/test_case.h index b5d85b9e..0434921d 100644 --- a/tests/t00028/test_case.h +++ b/tests/t00028/test_case.h @@ -29,37 +29,49 @@ TEST_CASE("t00028", "[test-case][class]") REQUIRE(model->name() == "t00028_class"); REQUIRE(model->should_include("clanguml::t00028::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClassTemplate("E", "T")); - REQUIRE_THAT(puml, IsEnum(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, HasNote(_A("A"), "top", "A class note.")); - REQUIRE_THAT(puml, HasNote(_A("B"), "left", "B class note.")); - REQUIRE_THAT(puml, HasNote(_A("C"), "bottom", "C class note.")); - const auto d_note = R"( + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClassTemplate("E", "T")); + REQUIRE_THAT(puml, IsEnum(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, HasNote(_A("A"), "top", "A class note.")); + REQUIRE_THAT(puml, HasNote(_A("B"), "left", "B class note.")); + REQUIRE_THAT(puml, HasNote(_A("C"), "bottom", "C class note.")); + const auto d_note = R"( D class note.)"; - REQUIRE_THAT(puml, HasNote(_A("D"), "left", d_note)); - REQUIRE_THAT(puml, HasNote(_A("E"), "left", "E template class note.")); - REQUIRE_THAT(puml, HasNote(_A("F"), "bottom", "F enum note.")); - REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note.")); - REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note.")); - REQUIRE_THAT(puml, - HasMemberNote(_A("R"), "aaa", "left", "R contains an instance of A.")); - REQUIRE_THAT( - puml, !HasMemberNote(_A("R"), "bbb", "right", "R class note.")); - REQUIRE_THAT( - puml, HasMemberNote(_A("R"), "ccc", "left", "Reference to C.")); + REQUIRE_THAT(puml, HasNote(_A("D"), "left", d_note)); + REQUIRE_THAT( + puml, HasNote(_A("E"), "left", "E template class note.")); + REQUIRE_THAT(puml, HasNote(_A("F"), "bottom", "F enum note.")); + REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note.")); + REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note.")); + REQUIRE_THAT(puml, + HasMemberNote( + _A("R"), "aaa", "left", "R contains an instance of A.")); + REQUIRE_THAT( + puml, !HasMemberNote(_A("R"), "bbb", "right", "R class note.")); + REQUIRE_THAT( + puml, HasMemberNote(_A("R"), "ccc", "left", "Reference to C.")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00029/test_case.h b/tests/t00029/test_case.h index a44b9f09..3648bad4 100644 --- a/tests/t00029/test_case.h +++ b/tests/t00029/test_case.h @@ -29,29 +29,39 @@ TEST_CASE("t00029", "[test-case][class]") REQUIRE(model->name() == "t00029_class"); REQUIRE(model->should_include("clanguml::t00029::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClassTemplate("C", "T")); - REQUIRE_THAT(puml, !IsClassTemplate("D", "T")); - REQUIRE_THAT(puml, IsEnum(_A("E"))); - REQUIRE_THAT(puml, !IsEnum(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G1"))); - REQUIRE_THAT(puml, IsClass(_A("G2"))); - REQUIRE_THAT(puml, IsClass(_A("G3"))); - REQUIRE_THAT(puml, IsClass(_A("G4"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, !IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClassTemplate("C", "T")); + REQUIRE_THAT(puml, !IsClassTemplate("D", "T")); + REQUIRE_THAT(puml, IsEnum(_A("E"))); + REQUIRE_THAT(puml, !IsEnum(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("G1"))); + REQUIRE_THAT(puml, IsClass(_A("G2"))); + REQUIRE_THAT(puml, IsClass(_A("G3"))); + REQUIRE_THAT(puml, IsClass(_A("G4"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("G1"), "+g1")); - REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G2"), "+g2")); - REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G4"), "+g4")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("G1"), "+g1")); + REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G2"), "+g2")); + REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G4"), "+g4")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00030/test_case.h b/tests/t00030/test_case.h index 6d79326b..64b1525f 100644 --- a/tests/t00030/test_case.h +++ b/tests/t00030/test_case.h @@ -29,22 +29,34 @@ TEST_CASE("t00030", "[test-case][class]") REQUIRE(model->name() == "t00030_class"); REQUIRE(model->should_include("clanguml::t00030::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "+aaa")); - REQUIRE_THAT(puml, IsComposition(_A("R"), _A("B"), "+bbb", "0..1", "1..*")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+ccc", "0..1", "1..5")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("E"), "+eee", "", "1")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "+aaa")); + REQUIRE_THAT( + puml, IsComposition(_A("R"), _A("B"), "+bbb", "0..1", "1..*")); + REQUIRE_THAT( + puml, IsAggregation(_A("R"), _A("C"), "+ccc", "0..1", "1..5")); + REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1")); + REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("E"), "+eee", "", "1")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00031/test_case.h b/tests/t00031/test_case.h index 80aae040..5ec06b4b 100644 --- a/tests/t00031/test_case.h +++ b/tests/t00031/test_case.h @@ -29,29 +29,39 @@ TEST_CASE("t00031", "[test-case][class]") REQUIRE(model->name() == "t00031_class"); REQUIRE(model->should_include("clanguml::t00031::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsEnum(_A("B"))); - REQUIRE_THAT(puml, IsClassTemplate("C", "T")); - REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsEnum(_A("B"))); + REQUIRE_THAT(puml, IsClassTemplate("C", "T")); + REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, - IsAssociationWithStyle( - _A("R"), _A("A"), "+aaa", "#red,dashed,thickness=2")); - REQUIRE_THAT(puml, - IsCompositionWithStyle( - _A("R"), _A("B"), "+bbb", "#green,dashed,thickness=4")); - REQUIRE_THAT(puml, - IsAggregationWithStyle( - _A("R"), _A("C"), "+ccc", "#blue,dotted,thickness=8")); - REQUIRE_THAT(puml, - IsAssociationWithStyle( - _A("R"), _A("D"), "+ddd", "#blue,plain,thickness=16")); + REQUIRE_THAT(puml, + IsAssociationWithStyle( + _A("R"), _A("A"), "+aaa", "#red,dashed,thickness=2")); + REQUIRE_THAT(puml, + IsCompositionWithStyle( + _A("R"), _A("B"), "+bbb", "#green,dashed,thickness=4")); + REQUIRE_THAT(puml, + IsAggregationWithStyle( + _A("R"), _A("C"), "+ccc", "#blue,dotted,thickness=8")); + REQUIRE_THAT(puml, + IsAssociationWithStyle( + _A("R"), _A("D"), "+ddd", "#blue,plain,thickness=16")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00032/test_case.h b/tests/t00032/test_case.h index 1707d78b..882b3442 100644 --- a/tests/t00032/test_case.h +++ b/tests/t00032/test_case.h @@ -28,28 +28,40 @@ TEST_CASE("t00032", "[test-case][class]") REQUIRE(model->name() == "t00032_class"); REQUIRE(model->should_include("clanguml::t00032::A")); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("Base"))); + REQUIRE_THAT(puml, IsClass(_A("TBase"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsClass(_A("Base"))); - REQUIRE_THAT(puml, IsClass(_A("TBase"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsClassTemplate("Overload", "T,L,Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("Overload", "T,L,Ts...")); + REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Overload"))); + REQUIRE_THAT( + puml, IsBaseClass(_A("TBase"), _A("Overload"))); + REQUIRE_THAT( + puml, IsBaseClass(_A("A"), _A("Overload"))); + REQUIRE_THAT( + puml, IsBaseClass(_A("B"), _A("Overload"))); + REQUIRE_THAT( + puml, IsBaseClass(_A("C"), _A("Overload"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Overload"))); - REQUIRE_THAT( - puml, IsBaseClass(_A("TBase"), _A("Overload"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("Overload"))); - REQUIRE_THAT(puml, IsBaseClass(_A("B"), _A("Overload"))); - REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("Overload"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00033/test_case.h b/tests/t00033/test_case.h index 71d55275..eb36b8b8 100644 --- a/tests/t00033/test_case.h +++ b/tests/t00033/test_case.h @@ -29,30 +29,40 @@ TEST_CASE("t00033", "[test-case][class]") REQUIRE(model->name() == "t00033_class"); REQUIRE(model->should_include("clanguml::t00033::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); - REQUIRE_THAT(puml, IsClassTemplate("C", "T")); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsClassTemplate("A", "T")); + REQUIRE_THAT(puml, IsClassTemplate("B", "T")); + REQUIRE_THAT(puml, IsClassTemplate("C", "T")); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, - IsDependency( - _A("A>>>"), _A("B>>"))); - REQUIRE_THAT( - puml, IsDependency(_A("B>>"), _A("C"))); - REQUIRE_THAT(puml, IsDependency(_A("C"), _A("D"))); + REQUIRE_THAT(puml, + IsDependency(_A("A>>>"), + _A("B>>"))); + REQUIRE_THAT( + puml, IsDependency(_A("B>>"), _A("C"))); + REQUIRE_THAT(puml, IsDependency(_A("C"), _A("D"))); - REQUIRE_THAT(puml, IsInstantiation(_A("C"), _A("C"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("B"), _A("B>>"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A>>>"))); + REQUIRE_THAT(puml, IsInstantiation(_A("C"), _A("C"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("B"), _A("B>>"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("A"), _A("A>>>"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00034/test_case.h b/tests/t00034/test_case.h index 7c27c778..496aeaf4 100644 --- a/tests/t00034/test_case.h +++ b/tests/t00034/test_case.h @@ -29,22 +29,32 @@ TEST_CASE("t00034", "[test-case][class]") REQUIRE(model->name() == "t00034_class"); REQUIRE(model->should_include("clanguml::t00034::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("lift_void", "T")); - REQUIRE_THAT(puml, IsClassTemplate("drop_void", "T")); - REQUIRE_THAT(puml, IsClass(_A("Void"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsClassTemplate("lift_void", "T")); + REQUIRE_THAT(puml, IsClassTemplate("drop_void", "T")); + REQUIRE_THAT(puml, IsClass(_A("Void"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("lift_void"), _A("lift_void"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("drop_void"), _A("drop_void"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("lift_void"), _A("lift_void"))); + REQUIRE_THAT( + puml, IsInstantiation(_A("drop_void"), _A("drop_void"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00035/test_case.h b/tests/t00035/test_case.h index 19a10903..945dbb09 100644 --- a/tests/t00035/test_case.h +++ b/tests/t00035/test_case.h @@ -29,22 +29,32 @@ TEST_CASE("t00035", "[test-case][class]") REQUIRE(model->name() == "t00035_class"); REQUIRE(model->should_include("clanguml::t00035::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Top"))); - REQUIRE_THAT(puml, IsClass(_A("Bottom"))); - REQUIRE_THAT(puml, IsClass(_A("Center"))); - REQUIRE_THAT(puml, IsClass(_A("Left"))); - REQUIRE_THAT(puml, IsClass(_A("Right"))); + REQUIRE_THAT(puml, IsClass(_A("Top"))); + REQUIRE_THAT(puml, IsClass(_A("Bottom"))); + REQUIRE_THAT(puml, IsClass(_A("Center"))); + REQUIRE_THAT(puml, IsClass(_A("Left"))); + REQUIRE_THAT(puml, IsClass(_A("Right"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "up", _A("Top"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "left", _A("Left"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "down", _A("Bottom"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "up", _A("Top"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "left", _A("Left"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "down", _A("Bottom"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00036/test_case.h b/tests/t00036/test_case.h index ccc91c3c..4f04dda3 100644 --- a/tests/t00036/test_case.h +++ b/tests/t00036/test_case.h @@ -28,31 +28,41 @@ TEST_CASE("t00036", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00036_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T")); + REQUIRE_THAT(puml, IsClassTemplate("A", "int")); + REQUIRE_THAT(puml, IsEnum(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsPackage("ns111")); + REQUIRE_THAT(puml, IsPackage("ns22")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClassTemplate("A", "int")); - REQUIRE_THAT(puml, IsEnum(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsPackage("ns111")); - REQUIRE_THAT(puml, IsPackage("ns22")); + REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+a_int")); - REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+a_int")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; - auto j = generate_class_json(diagram, *model); + REQUIRE(IsClass(j, "ns1::ns11::A")); + REQUIRE(IsClass(j, "ns1::ns11::A")); + REQUIRE(IsClass(j, "ns1::ns11::ns111::B")); + REQUIRE(IsClass(j, "ns2::ns22::C")); + REQUIRE(IsEnum(j, "ns1::E")); + REQUIRE(IsPackage(j, "ns1")); + REQUIRE(IsPackage(j, "ns1::ns11")); + REQUIRE(IsPackage(j, "ns1::ns11::ns111")); + REQUIRE(IsPackage(j, "ns2")); - // REQUIRE(json::IsClass(j, "clanguml::t00036::A")); - // REQUIRE(json::IsClass(j, "clanguml::t00036::A")); - // REQUIRE(json::IsClass(j, "clanguml::t00036::B")); - // REQUIRE(json::IsClass(j, "clanguml::t00036::C")); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00037/test_case.h b/tests/t00037/test_case.h index 786930c2..efec5642 100644 --- a/tests/t00037/test_case.h +++ b/tests/t00037/test_case.h @@ -29,19 +29,30 @@ TEST_CASE("t00037", "[test-case][class]") REQUIRE(model->name() == "t00037_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("ST"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("ST::(units)"))); - REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)"))); - REQUIRE_THAT( - puml, IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions")); - REQUIRE_THAT(puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); + REQUIRE_THAT(puml, IsClass(_A("ST"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("ST::(units)"))); + REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)"))); + REQUIRE_THAT(puml, + IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions")); + REQUIRE_THAT( + puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00038/test_case.h b/tests/t00038/test_case.h index 6e34c61b..c959ec60 100644 --- a/tests/t00038/test_case.h +++ b/tests/t00038/test_case.h @@ -29,67 +29,81 @@ TEST_CASE("t00038", "[test-case][class]") REQUIRE(model->name() == "t00038_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("thirdparty::ns1::E"))); - REQUIRE_THAT(puml, IsClass(_A("key_t"))); - REQUIRE_THAT(puml, IsClassTemplate("map", "T")); - REQUIRE_THAT(puml, - IsClassTemplate("map", - "std::integral_constant")); - REQUIRE_THAT(puml, - IsClassTemplate("map", - "std::vector>")); - REQUIRE_THAT(puml, - IsClassTemplate("map", - "std::map>>")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("thirdparty::ns1::E"))); + REQUIRE_THAT(puml, IsClass(_A("key_t"))); + REQUIRE_THAT(puml, IsClassTemplate("map", "T")); + REQUIRE_THAT(puml, + IsClassTemplate("map", + "std::integral_constant")); + REQUIRE_THAT(puml, + IsClassTemplate("map", + "std::vector>")); + REQUIRE_THAT(puml, + IsClassTemplate("map", + "std::map>>")); - REQUIRE_THAT(puml, IsEnum(_A("property_t"))); + REQUIRE_THAT(puml, IsEnum(_A("property_t"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("map"), - _A("map>>>"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("map"), + _A("map>>>"))); - REQUIRE_THAT(puml, - IsDependency(_A("map>"), - _A("property_t"))); + REQUIRE_THAT(puml, + IsDependency(_A("map>"), + _A("property_t"))); - REQUIRE_THAT(puml, - IsDependency(_A("map<" - "std::vector>>"), - _A("property_t"))); + REQUIRE_THAT(puml, + IsDependency(_A("map<" + "std::vector>>"), + _A("property_t"))); - REQUIRE_THAT(puml, - IsDependency(_A("map>>>"), - _A("property_t"))); + REQUIRE_THAT(puml, + IsDependency( + _A("map>>>"), + _A("property_t"))); - REQUIRE_THAT(puml, - IsDependency(_A("map>>>"), - _A("key_t"))); + REQUIRE_THAT(puml, + IsDependency( + _A("map>>>"), + _A("key_t"))); - REQUIRE_THAT(puml, - IsDependency(_A("map>"), - _A("thirdparty::ns1::color_t"))); + REQUIRE_THAT(puml, + IsDependency( + _A("map>"), + _A("thirdparty::ns1::color_t"))); - REQUIRE_THAT(puml, - IsBaseClass(_A("thirdparty::ns1::E"), - _A("map>"))); + REQUIRE_THAT(puml, + IsBaseClass(_A("thirdparty::ns1::E"), + _A("map>"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00039/test_case.h b/tests/t00039/test_case.h index 970dc920..824a37f8 100644 --- a/tests/t00039/test_case.h +++ b/tests/t00039/test_case.h @@ -24,44 +24,53 @@ TEST_CASE("t00039", "[test-case][class]") REQUIRE(diagram->name == "t00039_class"); REQUIRE(diagram->generate_packages() == false); - auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00039_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("AA"))); - REQUIRE_THAT(puml, IsClass(_A("AAA"))); - REQUIRE_THAT(puml, IsClass(_A("ns2::AAAA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("AAA"), _A("ns2::AAAA"))); - REQUIRE_THAT(puml, !IsClass(_A("detail::AA"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("AA"))); + REQUIRE_THAT(puml, IsClass(_A("AAA"))); + REQUIRE_THAT(puml, IsClass(_A("ns2::AAAA"))); + REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA"))); + REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA"))); + REQUIRE_THAT(puml, IsBaseClass(_A("AAA"), _A("ns2::AAAA"))); + REQUIRE_THAT(puml, !IsClass(_A("detail::AA"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsClass(_A("ns1::BB"))); + REQUIRE_THAT(puml, !IsClass(_A("B"))); + REQUIRE_THAT(puml, !IsClass(_A("ns1::BB"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CD"))); - REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CD"))); - REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("DE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("DE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CDE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CDE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("CDE"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CD"))); + REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CD"))); + REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("DE"))); + REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("DE"))); + REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CDE"))); + REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CDE"))); + REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("CDE"))); - REQUIRE_THAT(puml, IsClassTemplate("ns3::F", "T")); - REQUIRE_THAT(puml, IsClassTemplate("ns3::FF", "T,M")); - REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M")); - REQUIRE_THAT(puml, IsClassTemplate("ns3::FFF", "T,M,N")); + REQUIRE_THAT(puml, IsClassTemplate("ns3::F", "T")); + REQUIRE_THAT(puml, IsClassTemplate("ns3::FF", "T,M")); + REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M")); + REQUIRE_THAT(puml, IsClassTemplate("ns3::FFF", "T,M,N")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00040/test_case.h b/tests/t00040/test_case.h index 122bbfbb..5e7f94c8 100644 --- a/tests/t00040/test_case.h +++ b/tests/t00040/test_case.h @@ -28,22 +28,31 @@ TEST_CASE("t00040", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00040_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("AA"))); + REQUIRE_THAT(puml, IsClass(_A("AAA"))); + REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA"))); + REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("AA"))); - REQUIRE_THAT(puml, IsClass(_A("AAA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA"))); + REQUIRE_THAT(puml, !IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); + REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("A"))); - REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("A"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00041/test_case.h b/tests/t00041/test_case.h index d474e870..27caf88a 100644 --- a/tests/t00041/test_case.h +++ b/tests/t00041/test_case.h @@ -28,41 +28,50 @@ TEST_CASE("t00041", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00041_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, !IsClass(_A("A"))); + REQUIRE_THAT(puml, !IsClass(_A("AA"))); + REQUIRE_THAT(puml, !IsClass(_A("AAA"))); - REQUIRE_THAT(puml, !IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsClass(_A("AA"))); - REQUIRE_THAT(puml, !IsClass(_A("AAA"))); + REQUIRE_THAT(puml, !IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsClass(_A("RR"))); + REQUIRE_THAT(puml, IsClass(_A("RRR"))); + REQUIRE_THAT(puml, !IsClass(_A("detail::G"))); + REQUIRE_THAT(puml, !IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsClass(_A("RR"))); - REQUIRE_THAT(puml, IsClass(_A("RRR"))); - REQUIRE_THAT(puml, !IsClass(_A("detail::G"))); - REQUIRE_THAT(puml, !IsClass(_A("H"))); + REQUIRE_THAT(puml, IsBaseClass(_A("R"), _A("RR"))); + REQUIRE_THAT(puml, IsBaseClass(_A("RR"), _A("RRR"))); - REQUIRE_THAT(puml, IsBaseClass(_A("R"), _A("RR"))); - REQUIRE_THAT(puml, IsBaseClass(_A("RR"), _A("RRR"))); + REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("RR"), "+rr")); + REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("E"), "+e")); + REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("F"), "+f")); + REQUIRE_THAT(puml, !IsDependency(_A("RR"), _A("H"))); - REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("RR"), "+rr")); - REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("E"), "+e")); - REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("F"), "+f")); - REQUIRE_THAT(puml, !IsDependency(_A("RR"), _A("H"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::N"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::NN"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::NM"))); + REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN"))); + REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::N"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::NN"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::NM"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00042/test_case.h b/tests/t00042/test_case.h index 6084ec70..c490c158 100644 --- a/tests/t00042/test_case.h +++ b/tests/t00042/test_case.h @@ -29,15 +29,25 @@ TEST_CASE("t00042", "[test-case][class]") REQUIRE(model->name() == "t00042_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T,K")); - REQUIRE_THAT(puml, !IsClassTemplate("C", "T")); + REQUIRE_THAT(puml, IsClassTemplate("A", "T")); + REQUIRE_THAT(puml, IsClassTemplate("B", "T,K")); + REQUIRE_THAT(puml, !IsClassTemplate("C", "T")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00043/test_case.h b/tests/t00043/test_case.h index d9618427..6a93e301 100644 --- a/tests/t00043/test_case.h +++ b/tests/t00043/test_case.h @@ -29,38 +29,48 @@ TEST_CASE("t00043", "[test-case][class]") REQUIRE(model->name() == "t00043_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check dependants filter - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("BB"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, !IsClass(_A("F"))); + // Check dependants filter + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("BB"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, !IsClass(_A("F"))); - REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("BB"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("D"), _A("C"))); - REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D"))); + REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A"))); + REQUIRE_THAT(puml, IsDependency(_A("BB"), _A("A"))); + REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B"))); + REQUIRE_THAT(puml, IsDependency(_A("D"), _A("C"))); + REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D"))); - // Check dependencies filter - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("GG"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, !IsClass(_A("HH"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); + // Check dependencies filter + REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(puml, IsClass(_A("GG"))); + REQUIRE_THAT(puml, IsClass(_A("H"))); + REQUIRE_THAT(puml, !IsClass(_A("HH"))); + REQUIRE_THAT(puml, IsClass(_A("I"))); + REQUIRE_THAT(puml, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsDependency(_A("H"), _A("G"))); - REQUIRE_THAT(puml, IsDependency(_A("H"), _A("GG"))); - REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H"))); - REQUIRE_THAT(puml, IsDependency(_A("J"), _A("I"))); + REQUIRE_THAT(puml, IsDependency(_A("H"), _A("G"))); + REQUIRE_THAT(puml, IsDependency(_A("H"), _A("GG"))); + REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H"))); + REQUIRE_THAT(puml, IsDependency(_A("J"), _A("I"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00044/test_case.h b/tests/t00044/test_case.h index e71fc749..e9f40a1f 100644 --- a/tests/t00044/test_case.h +++ b/tests/t00044/test_case.h @@ -28,16 +28,26 @@ TEST_CASE("t00044", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00044_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // TODO: + // Check dependants filter + // REQUIRE_THAT(puml, IsClassTemplate("signal_handler", + // "Ret,Args...,A")); - // TODO: - // Check dependants filter - // REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "Ret,Args...,A")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00045/test_case.h b/tests/t00045/test_case.h index 1099a5b8..cf4487fc 100644 --- a/tests/t00045/test_case.h +++ b/tests/t00045/test_case.h @@ -29,40 +29,52 @@ TEST_CASE("t00045", "[test-case][class]") REQUIRE(model->name() == "t00045_class"); REQUIRE(model->should_include("clanguml::t00045::ns1::ns2::A")); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::B"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::C"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::D"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::E"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::R"))); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::A"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::A"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::B"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::C"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::D"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::E"))); + REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::R"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::B"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::A"), _A("ns1::ns2::C"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::D"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("ns1::ns2::E"))); + REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::B"))); + REQUIRE_THAT(puml, IsBaseClass(_A("ns1::A"), _A("ns1::ns2::C"))); + REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::D"))); + REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("ns1::ns2::E"))); - REQUIRE_THAT( - puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+a")); - REQUIRE_THAT( - puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a")); - REQUIRE_THAT(puml, - IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+ns1_ns2_a")); - REQUIRE_THAT(puml, IsAssociation(_A("ns1::ns2::R"), _A("A"), "+root_a")); + REQUIRE_THAT( + puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+a")); + REQUIRE_THAT( + puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a")); + REQUIRE_THAT(puml, + IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+ns1_ns2_a")); + REQUIRE_THAT( + puml, IsAssociation(_A("ns1::ns2::R"), _A("A"), "+root_a")); - REQUIRE_THAT(puml, IsDependency(_A("ns1::ns2::R"), _A("AA"))); + REQUIRE_THAT(puml, IsDependency(_A("ns1::ns2::R"), _A("AA"))); - REQUIRE_THAT(puml, IsFriend(_A("ns1::ns2::R"), _A("AAA"))); - REQUIRE_THAT( - puml, !IsFriend(_A("ns1::ns2::R"), _A("ns1::ns2::AAA"))); - // TODO: - // REQUIRE_THAT(puml, IsFriend(_A("ns1::ns2::R"), _A("AAAA"))); + REQUIRE_THAT(puml, IsFriend(_A("ns1::ns2::R"), _A("AAA"))); + REQUIRE_THAT( + puml, !IsFriend(_A("ns1::ns2::R"), _A("ns1::ns2::AAA"))); + // TODO: + // REQUIRE_THAT(puml, IsFriend(_A("ns1::ns2::R"), + // _A("AAAA"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00046/test_case.h b/tests/t00046/test_case.h index a5d67acf..a85e2241 100644 --- a/tests/t00046/test_case.h +++ b/tests/t00046/test_case.h @@ -28,20 +28,29 @@ TEST_CASE("t00046", "[test-case][class]") REQUIRE(model->name() == "t00046_class"); REQUIRE(model->should_include("ns1::ns2::A")); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsField("i", "std::vector")); - REQUIRE_THAT(puml, IsField("i", "std::vector")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t00047/test_case.h b/tests/t00047/test_case.h index 374243d7..52542829 100644 --- a/tests/t00047/test_case.h +++ b/tests/t00047/test_case.h @@ -27,20 +27,29 @@ TEST_CASE("t00047", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00047_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if class templates exist + REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Ts...")); + REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Else")); + REQUIRE_THAT(puml, + IsClassTemplate("conditional_t", "std::true_type,Result,Tail...")); + REQUIRE_THAT(puml, + IsClassTemplate("conditional_t", "std::false_type,Result,Tail...")); - // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Else")); - REQUIRE_THAT(puml, - IsClassTemplate("conditional_t", "std::true_type,Result,Tail...")); - REQUIRE_THAT(puml, - IsClassTemplate("conditional_t", "std::false_type,Result,Tail...")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00048/test_case.h b/tests/t00048/test_case.h index 9bf75981..04123d4d 100644 --- a/tests/t00048/test_case.h +++ b/tests/t00048/test_case.h @@ -27,26 +27,35 @@ TEST_CASE("t00048", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00048_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all classes exist + REQUIRE_THAT(puml, IsAbstractClass(_A("Base"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); - // Check if all classes exist - REQUIRE_THAT(puml, IsAbstractClass(_A("Base"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); + // Check if class templates exist + REQUIRE_THAT(puml, IsAbstractClassTemplate("BaseTemplate", "T")); + REQUIRE_THAT(puml, IsClassTemplate("ATemplate", "T")); + REQUIRE_THAT(puml, IsClassTemplate("BTemplate", "T")); - // Check if class templates exist - REQUIRE_THAT(puml, IsAbstractClassTemplate("BaseTemplate", "T")); - REQUIRE_THAT(puml, IsClassTemplate("ATemplate", "T")); - REQUIRE_THAT(puml, IsClassTemplate("BTemplate", "T")); + // Check if all inheritance relationships exist + REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A"))); + REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B"))); - // Check if all inheritance relationships exist - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00049/test_case.h b/tests/t00049/test_case.h index f17aa8d5..29a829a8 100644 --- a/tests/t00049/test_case.h +++ b/tests/t00049/test_case.h @@ -27,34 +27,43 @@ TEST_CASE("t00049", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00049_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("R"))); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("R"))); + // Check if class templates exist + REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); + // Check if all methods exist + REQUIRE_THAT(puml, (IsMethod("get_int_map", "A"))); + REQUIRE_THAT(puml, + (IsMethod("set_int_map", "void", "A && int_map"))); - // Check if all methods exist - REQUIRE_THAT(puml, (IsMethod("get_int_map", "A"))); - REQUIRE_THAT(puml, - (IsMethod("set_int_map", "void", "A && int_map"))); + // Check if all fields exist + REQUIRE_THAT(puml, (IsField("a_string", "A"))); + REQUIRE_THAT( + puml, (IsField("a_vector_string", "A"))); + REQUIRE_THAT(puml, (IsField("a_int_map", "A"))); - // Check if all fields exist - REQUIRE_THAT(puml, (IsField("a_string", "A"))); - REQUIRE_THAT( - puml, (IsField("a_vector_string", "A"))); - REQUIRE_THAT(puml, (IsField("a_int_map", "A"))); + // Check if all relationships exist + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - // Check if all relationships exist - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00050/test_case.h b/tests/t00050/test_case.h index 442682e0..1088ef7f 100644 --- a/tests/t00050/test_case.h +++ b/tests/t00050/test_case.h @@ -27,31 +27,40 @@ TEST_CASE("t00050", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00050_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("utils::D"))); + REQUIRE_THAT(puml, IsEnum(_A("E"))); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("utils::D"))); - REQUIRE_THAT(puml, IsEnum(_A("E"))); + REQUIRE_THAT(puml, HasNote(_A("A"), "left")); + REQUIRE_THAT(puml, HasNote(_A("A"), "right")); + REQUIRE_THAT(puml, HasNote(_A("B"), "top")); + REQUIRE_THAT(puml, HasNote(_A("C"), "top")); + REQUIRE_THAT(puml, HasNote(_A("utils::D"), "top")); + REQUIRE_THAT(puml, !HasNote(_A("E"), "bottom")); + REQUIRE_THAT(puml, !HasNote(_A("NoComment"), "top")); + REQUIRE_THAT(puml, HasNote(_A("F"), "top")); + REQUIRE_THAT(puml, HasNote(_A("G"), "top")); + REQUIRE_THAT(puml, HasNote(_A("G"), "bottom")); + REQUIRE_THAT(puml, HasNote(_A("G"), "right")); - REQUIRE_THAT(puml, HasNote(_A("A"), "left")); - REQUIRE_THAT(puml, HasNote(_A("A"), "right")); - REQUIRE_THAT(puml, HasNote(_A("B"), "top")); - REQUIRE_THAT(puml, HasNote(_A("C"), "top")); - REQUIRE_THAT(puml, HasNote(_A("utils::D"), "top")); - REQUIRE_THAT(puml, !HasNote(_A("E"), "bottom")); - REQUIRE_THAT(puml, !HasNote(_A("NoComment"), "top")); - REQUIRE_THAT(puml, HasNote(_A("F"), "top")); - REQUIRE_THAT(puml, HasNote(_A("G"), "top")); - REQUIRE_THAT(puml, HasNote(_A("G"), "bottom")); - REQUIRE_THAT(puml, HasNote(_A("G"), "right")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00051/test_case.h b/tests/t00051/test_case.h index 8bffaba7..da79c3e0 100644 --- a/tests/t00051/test_case.h +++ b/tests/t00051/test_case.h @@ -28,49 +28,62 @@ TEST_CASE("t00051", "[test-case][class]") REQUIRE(model->name() == "t00051_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread1"))); - REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread2"))); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread1"))); + REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread2"))); - REQUIRE_THAT(puml, - (IsMethod("custom_thread1", "void", - "Function && f, Args &&... args"))); - REQUIRE_THAT(puml, - (IsMethod("thread", "void", - "(lambda at ../../tests/t00051/t00051.cc:59:27) && "))); - REQUIRE_THAT(puml, - (IsMethod("start_thread3", - "B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " - "../../tests/t00051/t00051.cc:43:27)>"))); - REQUIRE_THAT(puml, - (IsMethod( - "get_function", "(lambda at ../../tests/t00051/t00051.cc:48:16)"))); + REQUIRE_THAT(puml, + (IsMethod("custom_thread1", "void", + "Function && f, Args &&... args"))); + REQUIRE_THAT(puml, + (IsMethod("thread", "void", + "(lambda at ../../tests/t00051/t00051.cc:59:27) && "))); + REQUIRE_THAT(puml, + (IsMethod("start_thread3", + "B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " + "../../tests/t00051/t00051.cc:43:27)>"))); + REQUIRE_THAT(puml, + (IsMethod("get_function", + "(lambda at ../../tests/t00051/t00051.cc:48:16)"))); - REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F")); - REQUIRE_THAT(puml, (IsMethod("f", "void"))); - REQUIRE_THAT(puml, (IsMethod("ff", "void"))); + REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F")); + REQUIRE_THAT(puml, (IsMethod("f", "void"))); + REQUIRE_THAT(puml, (IsMethod("ff", "void"))); - REQUIRE_THAT(puml, - IsClassTemplate("B", - "(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " - "../../tests/t00051/t00051.cc:43:27)")); + REQUIRE_THAT(puml, + IsClassTemplate("B", + "(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " + "../../tests/t00051/t00051.cc:43:27)")); - REQUIRE_THAT(puml, - IsInstantiation(_A("B"), - _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " - "../../tests/t00051/t00051.cc:43:27)>"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("B"), + _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda " + "at " + "../../tests/t00051/t00051.cc:43:27)>"))); - REQUIRE_THAT(puml, - IsDependency(_A("A"), - _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " - "../../tests/t00051/t00051.cc:43:27)>"))); + REQUIRE_THAT(puml, + IsDependency(_A("A"), + _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda " + "at " + "../../tests/t00051/t00051.cc:43:27)>"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00052/test_case.h b/tests/t00052/test_case.h index e7636176..1aad88a9 100644 --- a/tests/t00052/test_case.h +++ b/tests/t00052/test_case.h @@ -28,23 +28,34 @@ TEST_CASE("t00052", "[test-case][class]") REQUIRE(model->name() == "t00052_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("A"))); - // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); + // Check if class templates exist + REQUIRE_THAT(puml, IsClassTemplate("B", "T")); - // Check if all methods exist - REQUIRE_THAT(puml, (IsMethod("a", "T", "T p"))); - REQUIRE_THAT(puml, (IsMethod("aa", "void", "F && f, Q q"))); - REQUIRE_THAT(puml, (IsMethod("b", "T", "T t"))); - REQUIRE_THAT(puml, (IsMethod("bb", "T", "F && f, T t"))); + // Check if all methods exist + REQUIRE_THAT(puml, (IsMethod("a", "T", "T p"))); + REQUIRE_THAT( + puml, (IsMethod("aa", "void", "F && f, Q q"))); + REQUIRE_THAT(puml, (IsMethod("b", "T", "T t"))); + REQUIRE_THAT(puml, (IsMethod("bb", "T", "F && f, T t"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00053/test_case.h b/tests/t00053/test_case.h index f51ae4a4..bc9c6176 100644 --- a/tests/t00053/test_case.h +++ b/tests/t00053/test_case.h @@ -28,28 +28,39 @@ TEST_CASE("t00053", "[test-case][class]") REQUIRE(model->name() == "t00053_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("a"))); - REQUIRE_THAT(puml, IsClass(_A("b"))); - REQUIRE_THAT(puml, IsClass(_A("c"))); - REQUIRE_THAT(puml, IsClass(_A("d"))); - REQUIRE_THAT(puml, IsClass(_A("e"))); - REQUIRE_THAT(puml, IsClass(_A("f"))); - REQUIRE_THAT(puml, IsClass(_A("g"))); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("a"))); + REQUIRE_THAT(puml, IsClass(_A("b"))); + REQUIRE_THAT(puml, IsClass(_A("c"))); + REQUIRE_THAT(puml, IsClass(_A("d"))); + REQUIRE_THAT(puml, IsClass(_A("e"))); + REQUIRE_THAT(puml, IsClass(_A("f"))); + REQUIRE_THAT(puml, IsClass(_A("g"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("G"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00054/test_case.h b/tests/t00054/test_case.h index 9fea467f..6a19036b 100644 --- a/tests/t00054/test_case.h +++ b/tests/t00054/test_case.h @@ -28,32 +28,43 @@ TEST_CASE("t00054", "[test-case][class]") REQUIRE(model->name() == "t00054_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("a"))); - REQUIRE_THAT(puml, IsClass(_A("b"))); - REQUIRE_THAT(puml, IsClass(_A("c"))); - REQUIRE_THAT(puml, IsClass(_A("d"))); - REQUIRE_THAT(puml, IsClass(_A("e"))); - REQUIRE_THAT(puml, IsClass(_A("f"))); - REQUIRE_THAT(puml, IsClass(_A("g"))); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("a"))); + REQUIRE_THAT(puml, IsClass(_A("b"))); + REQUIRE_THAT(puml, IsClass(_A("c"))); + REQUIRE_THAT(puml, IsClass(_A("d"))); + REQUIRE_THAT(puml, IsClass(_A("e"))); + REQUIRE_THAT(puml, IsClass(_A("f"))); + REQUIRE_THAT(puml, IsClass(_A("g"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsEnum(_A("i"))); - REQUIRE_THAT(puml, IsEnum(_A("h"))); - REQUIRE_THAT(puml, IsEnum(_A("j"))); + REQUIRE_THAT(puml, IsEnum(_A("i"))); + REQUIRE_THAT(puml, IsEnum(_A("h"))); + REQUIRE_THAT(puml, IsEnum(_A("j"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00055/test_case.h b/tests/t00055/test_case.h index e1dcb33d..0d93b424 100644 --- a/tests/t00055/test_case.h +++ b/tests/t00055/test_case.h @@ -28,33 +28,44 @@ TEST_CASE("t00055", "[test-case][class]") REQUIRE(model->name() == "t00055_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, IsClass(_A("E"))); + REQUIRE_THAT(puml, IsClass(_A("F"))); + REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(puml, IsClass(_A("H"))); + REQUIRE_THAT(puml, IsClass(_A("I"))); + REQUIRE_THAT(puml, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("A"), "right", _A("C"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "right", _A("E"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("E"), "right", _A("G"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("G"), "right", _A("I"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("A"), "right", _A("C"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "right", _A("E"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("E"), "right", _A("G"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("G"), "right", _A("I"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("B"), "down", _A("D"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("D"), "down", _A("F"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("F"), "down", _A("H"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("H"), "down", _A("J"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("B"), "down", _A("D"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("D"), "down", _A("F"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("F"), "down", _A("H"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("H"), "down", _A("J"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index 9cab7b7e..aa4b4798 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -27,99 +27,102 @@ TEST_CASE("t00056", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00056_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all classes exist + REQUIRE_THAT(puml, IsConcept(_A("greater_than_simple"))); + REQUIRE_THAT(puml, IsConcept(_A("greater_than_with_requires"))); + REQUIRE_THAT(puml, IsConcept(_A("max_four_bytes"))); + REQUIRE_THAT(puml, IsConcept(_A("iterable"))); + REQUIRE_THAT(puml, IsConcept(_A("has_value_type"))); + REQUIRE_THAT(puml, IsConcept(_A("convertible_to_string"))); + REQUIRE_THAT(puml, IsConcept(_A("iterable_with_value_type"))); + REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type"))); - // Check if all classes exist - REQUIRE_THAT(puml, IsConcept(_A("greater_than_simple"))); - REQUIRE_THAT(puml, IsConcept(_A("greater_than_with_requires"))); - REQUIRE_THAT(puml, IsConcept(_A("max_four_bytes"))); - REQUIRE_THAT(puml, IsConcept(_A("iterable"))); - REQUIRE_THAT(puml, IsConcept(_A("has_value_type"))); - REQUIRE_THAT(puml, IsConcept(_A("convertible_to_string"))); - REQUIRE_THAT(puml, IsConcept(_A("iterable_with_value_type"))); - REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type"))); + REQUIRE_THAT(puml, + IsConceptRequirement(_A("greater_than_with_requires"), + "sizeof (l) > sizeof (r)")); - REQUIRE_THAT(puml, - IsConceptRequirement( - _A("greater_than_with_requires"), "sizeof (l) > sizeof (r)")); - - REQUIRE_THAT( - puml, IsConceptRequirement(_A("iterable"), "container.begin()")); - REQUIRE_THAT( - puml, IsConceptRequirement(_A("iterable"), "container.end()")); + REQUIRE_THAT( + puml, IsConceptRequirement(_A("iterable"), "container.begin()")); + REQUIRE_THAT( + puml, IsConceptRequirement(_A("iterable"), "container.end()")); #ifdef _MSC_VER - REQUIRE_THAT(puml, - IsConceptRequirement( - _A("convertible_to_string"), "std::string({s})")); + REQUIRE_THAT(puml, + IsConceptRequirement( + _A("convertible_to_string"), "std::string({s})")); #else - REQUIRE_THAT(puml, - IsConceptRequirement(_A("convertible_to_string"), "std::string{s}")); + REQUIRE_THAT(puml, + IsConceptRequirement( + _A("convertible_to_string"), "std::string{s}")); #endif - REQUIRE_THAT(puml, - IsConceptRequirement( - _A("convertible_to_string"), "{std::to_string(s)} noexcept")); - REQUIRE_THAT(puml, - IsConceptRequirement(_A("convertible_to_string"), - "{std::to_string(s)} -> std::same_as")); + REQUIRE_THAT(puml, + IsConceptRequirement(_A("convertible_to_string"), + "{std::to_string(s)} noexcept")); + REQUIRE_THAT(puml, + IsConceptRequirement(_A("convertible_to_string"), + "{std::to_string(s)} -> std::same_as")); - // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("A", "max_four_bytes T")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); - REQUIRE_THAT(puml, IsClassTemplate("C", "convertible_to_string T")); - REQUIRE_THAT( - puml, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5")); - REQUIRE_THAT(puml, IsClassTemplate("E", "T1,T2,T3")); - REQUIRE_THAT(puml, IsClassTemplate("F", "T1,T2,T3")); + // Check if class templates exist + REQUIRE_THAT(puml, IsClassTemplate("A", "max_four_bytes T")); + REQUIRE_THAT(puml, IsClassTemplate("B", "T")); + REQUIRE_THAT(puml, IsClassTemplate("C", "convertible_to_string T")); + REQUIRE_THAT( + puml, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5")); + REQUIRE_THAT(puml, IsClassTemplate("E", "T1,T2,T3")); + REQUIRE_THAT(puml, IsClassTemplate("F", "T1,T2,T3")); - // Check if all relationships exist - REQUIRE_THAT(puml, - IsConstraint(_A("A"), _A("max_four_bytes"), "T")); + // Check if all relationships exist + REQUIRE_THAT(puml, + IsConstraint( + _A("A"), _A("max_four_bytes"), "T")); - REQUIRE_THAT(puml, - IsConstraint(_A("D"), - _A("max_four_bytes"), "T2")); - REQUIRE_THAT(puml, - IsConstraint(_A("D"), - _A("max_four_bytes"), "T5")); - REQUIRE_THAT(puml, - IsConstraint(_A("D"), - _A("iterable"), "T1")); - REQUIRE_THAT(puml, - IsConstraint(_A("D"), - _A("iterable"), "T3")); + REQUIRE_THAT(puml, + IsConstraint(_A("D"), + _A("max_four_bytes"), "T2")); + REQUIRE_THAT(puml, + IsConstraint(_A("D"), + _A("max_four_bytes"), "T5")); + REQUIRE_THAT(puml, + IsConstraint(_A("D"), + _A("iterable"), "T1")); + REQUIRE_THAT(puml, + IsConstraint(_A("D"), + _A("iterable"), "T3")); - REQUIRE_THAT(puml, - IsConstraint( - _A("iterable_with_value_type"), _A("has_value_type"), "T")); + REQUIRE_THAT(puml, + IsConstraint(_A("iterable_with_value_type"), + _A("has_value_type"), "T")); - REQUIRE_THAT(puml, - IsConstraint(_A("iterable_or_small_value_type"), - _A("max_four_bytes"), "T")); - REQUIRE_THAT(puml, - IsConstraint(_A("iterable_or_small_value_type"), - _A("iterable_with_value_type"), "T")); + REQUIRE_THAT(puml, + IsConstraint(_A("iterable_or_small_value_type"), + _A("max_four_bytes"), "T")); + REQUIRE_THAT(puml, + IsConstraint(_A("iterable_or_small_value_type"), + _A("iterable_with_value_type"), "T")); - REQUIRE_THAT(puml, - IsConstraint( - _A("E"), _A("greater_than_with_requires"), "T1,T3")); + REQUIRE_THAT(puml, + IsConstraint(_A("E"), + _A("greater_than_with_requires"), "T1,T3")); - REQUIRE_THAT(puml, - IsConstraint( - _A("F"), _A("greater_than_simple"), "T1,T3")); + REQUIRE_THAT(puml, + IsConstraint( + _A("F"), _A("greater_than_simple"), "T1,T3")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_class_json(diagram, *model); - auto j = generate_class_json(diagram, *model); + using namespace json; - // REQUIRE(json::IsClass(j, "clanguml::t00014::A")); - // REQUIRE(json::IsClass(j, "clanguml::t00014::B")); - // REQUIRE(json::IsClass(j, "clanguml::t00014::C")); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00057/test_case.h b/tests/t00057/test_case.h index 02b89d93..a378eec3 100644 --- a/tests/t00057/test_case.h +++ b/tests/t00057/test_case.h @@ -27,34 +27,44 @@ TEST_CASE("t00057", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00057_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("t00057_A"))); + REQUIRE_THAT(puml, IsClass(_A("t00057_B"))); + REQUIRE_THAT(puml, IsClass(_A("t00057_C"))); + REQUIRE_THAT(puml, IsUnion(_A("t00057_D"))); + REQUIRE_THAT(puml, IsClass(_A("t00057_E"))); + REQUIRE_THAT(puml, IsClass(_A("t00057_F"))); + REQUIRE_THAT(puml, IsClass(_A("t00057_R"))); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("t00057_A"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_B"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_C"))); - REQUIRE_THAT(puml, IsUnion(_A("t00057_D"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_E"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_F"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_R"))); + // Check if all relationships exist + REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_A"), "+a")); + REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_B"), "+b")); + REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_C"), "+c")); + REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_D"), "+d")); + REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_E"), "+e")); + REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_F"), "+f")); + REQUIRE_THAT(puml, + IsAggregation( + _A("t00057_E"), _A("t00057_E::(coordinates)"), "+coordinates")); + REQUIRE_THAT(puml, + IsAggregation(_A("t00057_E"), _A("t00057_E::(height)"), "+height")); - // Check if all relationships exist - REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_A"), "+a")); - REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_B"), "+b")); - REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_C"), "+c")); - REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_D"), "+d")); - REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_E"), "+e")); - REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_F"), "+f")); - REQUIRE_THAT(puml, - IsAggregation( - _A("t00057_E"), _A("t00057_E::(coordinates)"), "+coordinates")); - REQUIRE_THAT(puml, - IsAggregation(_A("t00057_E"), _A("t00057_E::(height)"), "+height")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00058/test_case.h b/tests/t00058/test_case.h index bcfea0f3..6221ee30 100644 --- a/tests/t00058/test_case.h +++ b/tests/t00058/test_case.h @@ -28,42 +28,53 @@ TEST_CASE("t00058", "[test-case][class]") REQUIRE(model->name() == "t00058_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "int,int,double,std::string")); - REQUIRE_THAT( - puml, IsClassTemplate("B", "int,std::string,int,double,A")); + REQUIRE_THAT(puml, IsClassTemplate("A", "int,int,double,std::string")); + REQUIRE_THAT(puml, + IsClassTemplate("B", "int,std::string,int,double,A")); - REQUIRE_THAT(puml, IsConcept(_A("same_as_first_type"))); + REQUIRE_THAT(puml, IsConcept(_A("same_as_first_type"))); - REQUIRE_THAT(puml, - IsConstraint(_A("A"), _A("same_as_first_type"), - "T,Args...")); + REQUIRE_THAT(puml, + IsConstraint(_A("A"), + _A("same_as_first_type"), "T,Args...")); - REQUIRE_THAT(puml, - IsConstraint(_A("B"), _A("same_as_first_type"), - "T,Args...")); + REQUIRE_THAT(puml, + IsConstraint(_A("B"), + _A("same_as_first_type"), "T,Args...")); - REQUIRE_THAT(puml, - IsAggregation(_A("R"), _A("A"), "+aa")); - REQUIRE_THAT(puml, - IsAggregation( - _A("R"), _A("B>"), "+bb")); + REQUIRE_THAT(puml, + IsAggregation(_A("R"), _A("A"), "+aa")); + REQUIRE_THAT(puml, + IsAggregation(_A("R"), + _A("B>"), "+bb")); - REQUIRE_THAT(puml, - IsInstantiation( - _A("A"), _A("A"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("B"), - _A("B>"))); + REQUIRE_THAT(puml, + IsInstantiation( + _A("A"), _A("A"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("B"), + _A("B>"))); - REQUIRE_THAT(puml, - IsDependency( - _A("same_as_first_type"), _A("first_type"))); + REQUIRE_THAT(puml, + IsDependency(_A("same_as_first_type"), + _A("first_type"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00059/test_case.h b/tests/t00059/test_case.h index 56426b3f..e92d6a7f 100644 --- a/tests/t00059/test_case.h +++ b/tests/t00059/test_case.h @@ -28,60 +28,73 @@ TEST_CASE("t00059", "[test-case][class]") REQUIRE(model->name() == "t00059_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsConcept(_A("fruit_c"))); - REQUIRE_THAT(puml, IsConcept(_A("apple_c"))); - REQUIRE_THAT(puml, IsConcept(_A("orange_c"))); + REQUIRE_THAT(puml, IsConcept(_A("fruit_c"))); + REQUIRE_THAT(puml, IsConcept(_A("apple_c"))); + REQUIRE_THAT(puml, IsConcept(_A("orange_c"))); - REQUIRE_THAT(puml, IsConstraint(_A("apple_c"), _A("fruit_c"), "T")); - REQUIRE_THAT(puml, IsConstraint(_A("orange_c"), _A("fruit_c"), "T")); + REQUIRE_THAT( + puml, IsConstraint(_A("apple_c"), _A("fruit_c"), "T")); + REQUIRE_THAT( + puml, IsConstraint(_A("orange_c"), _A("fruit_c"), "T")); - REQUIRE_THAT( - puml, IsConceptRequirement(_A("apple_c"), "t.get_sweetness()")); - REQUIRE_THAT( - puml, IsConceptRequirement(_A("apple_c"), "t.get_bitterness()")); + REQUIRE_THAT( + puml, IsConceptRequirement(_A("apple_c"), "t.get_sweetness()")); + REQUIRE_THAT( + puml, IsConceptRequirement(_A("apple_c"), "t.get_bitterness()")); - REQUIRE_THAT(puml, IsClass(_A("gala_apple"))); - REQUIRE_THAT(puml, IsClass(_A("empire_apple"))); - REQUIRE_THAT(puml, IsClass(_A("valencia_orange"))); - REQUIRE_THAT(puml, IsClass(_A("lima_orange"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(puml, IsClass(_A("gala_apple"))); + REQUIRE_THAT(puml, IsClass(_A("empire_apple"))); + REQUIRE_THAT(puml, IsClass(_A("valencia_orange"))); + REQUIRE_THAT(puml, IsClass(_A("lima_orange"))); + REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT( - puml, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO")); + REQUIRE_THAT( + puml, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO")); - REQUIRE_THAT(puml, - IsDependency( - _A("fruit_factory"), _A("gala_apple"))); - REQUIRE_THAT(puml, - IsDependency(_A("fruit_factory"), - _A("valencia_orange"))); + REQUIRE_THAT(puml, + IsDependency(_A("fruit_factory"), + _A("gala_apple"))); + REQUIRE_THAT(puml, + IsDependency(_A("fruit_factory"), + _A("valencia_orange"))); - REQUIRE_THAT(puml, - IsDependency( - _A("fruit_factory"), _A("empire_apple"))); - REQUIRE_THAT(puml, - IsDependency( - _A("fruit_factory"), _A("lima_orange"))); + REQUIRE_THAT(puml, + IsDependency(_A("fruit_factory"), + _A("empire_apple"))); + REQUIRE_THAT(puml, + IsDependency(_A("fruit_factory"), + _A("lima_orange"))); - REQUIRE_THAT(puml, - IsAggregation(_A("R"), _A("fruit_factory"), - "+factory_1")); - REQUIRE_THAT(puml, - IsAggregation(_A("R"), _A("fruit_factory"), - "+factory_2")); + REQUIRE_THAT(puml, + IsAggregation(_A("R"), + _A("fruit_factory"), "+factory_1")); + REQUIRE_THAT(puml, + IsAggregation(_A("R"), + _A("fruit_factory"), "+factory_2")); - REQUIRE_THAT(puml, - IsInstantiation(_A("fruit_factory"), - _A("fruit_factory"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("fruit_factory"), - _A("fruit_factory"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("fruit_factory"), + _A("fruit_factory"))); + REQUIRE_THAT(puml, + IsInstantiation(_A("fruit_factory"), + _A("fruit_factory"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t00060/test_case.h b/tests/t00060/test_case.h index c5a94071..6708787a 100644 --- a/tests/t00060/test_case.h +++ b/tests/t00060/test_case.h @@ -27,24 +27,34 @@ TEST_CASE("t00060", "[test-case][class]") auto model = generate_class_diagram(*db, diagram); REQUIRE(model->name() == "t00060_class"); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all classes exist + REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(puml, IsClass(_A("C"))); + REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(puml, !IsClass(_A("E"))); + REQUIRE_THAT(puml, !IsClass(_A("F"))); - // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, !IsClass(_A("E"))); - REQUIRE_THAT(puml, !IsClass(_A("F"))); + // Check if class templates exist + REQUIRE_THAT(puml, IsClassTemplate("G", "T")); + REQUIRE_THAT(puml, IsClassTemplate("H", "T,P")); - // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("G", "T")); - REQUIRE_THAT(puml, IsClassTemplate("H", "T,P")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/test_cases.h b/tests/test_cases.h index e53ef0b7..663b6acb 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -209,6 +209,17 @@ ContainsMatcher HasExitpoint(std::string const &to, CasedString(fmt::format("[<-- {}", to), caseSensitivity)); } +std::string _NS(std::string_view s) +{ + return fmt::format( + "clanguml::{}::{}", Catch::getResultCapture().getCurrentTestName(), s); +} + +class NamespaceWrapper { + +private: +}; + struct AliasMatcher { AliasMatcher(const std::string &puml_) : puml{split(puml_, "\n")} @@ -601,10 +612,21 @@ ContainsMatcher IsDeprecated(std::string const &str, namespace json { namespace detail { -auto get_element(const nlohmann::json &j, const std::string &name) +std::optional get_element( + const nlohmann::json &j, const std::string &name) { - return std::find_if(j["elements"].begin(), j["elements"].end(), - [&](const auto &it) { return it["display_name"] == name; }); + for (const nlohmann::json &e : j["elements"]) { + if (e["display_name"] == name) + return {e}; + + if (e["type"] == "namespace") { + auto maybe_e = get_element(e, name); + if (maybe_e) + return maybe_e; + } + } + + return {}; } auto get_relationship(const nlohmann::json &j, const nlohmann::json &from, @@ -620,43 +642,73 @@ auto get_relationship(const nlohmann::json &j, const nlohmann::json &from, auto get_relationship(const nlohmann::json &j, const std::string &from, const std::string &to, const std::string &type) { - auto from_it = detail::get_element(j, from); - auto to_it = detail::get_element(j, to); + auto source = detail::get_element(j, from); + auto destination = detail::get_element(j, to); - if (from_it == j["elements"].end() || to_it == j["elements"].end()) + if (!(source && destination)) return j["relationships"].end(); return detail::get_relationship( - j, from_it->at("id"), to_it->at("id"), type); + j, source->at("id"), destination->at("id"), type); +} + +std::string expand_name(const nlohmann::json &j, const std::string &name) +{ + if (!j.contains("using_namespace")) + return name; + + if (name.find("::") == 0) + return name; + + return fmt::format("{}::{}", j["using_namespace"].get(), name); } } // namespace detail bool IsClass(const nlohmann::json &j, const std::string &name) { - return detail::get_element(j, name) != j["elements"].end(); + auto e = detail::get_element(j, detail::expand_name(j, name)); + return e && e->at("type") == "class"; +} + +bool IsClassTemplate(const nlohmann::json &j, const std::string &name) +{ + auto e = detail::get_element(j, detail::expand_name(j, name)); + return e && e->at("type") == "class" && e->at("is_template") == true; +} + +bool IsEnum(const nlohmann::json &j, const std::string &name) +{ + auto e = detail::get_element(j, detail::expand_name(j, name)); + return e && e->at("type") == "enum"; +} + +bool IsPackage(const nlohmann::json &j, const std::string &name) +{ + auto e = detail::get_element(j, detail::expand_name(j, name)); + return e && e->at("type") == "namespace"; } bool IsBaseClass(const nlohmann::json &j, const std::string &base, const std::string &subclass) { - auto sc = detail::get_element(j, subclass); + auto sc = detail::get_element(j, detail::expand_name(j, subclass)); - if (sc == j["elements"].end()) + if (!sc) return false; const nlohmann::json &bases = (*sc)["bases"]; return std::find_if(bases.begin(), bases.end(), [&](const auto &it) { - return it["name"] == base; + return it["name"] == detail::expand_name(j, base); }) != bases.end(); } bool IsMethod( const nlohmann::json &j, const std::string &cls, const std::string &name) { - auto sc = detail::get_element(j, cls); + auto sc = detail::get_element(j, detail::expand_name(j, cls)); - if (sc == j["elements"].end()) + if (!sc) return false; const nlohmann::json &methods = (*sc)["methods"]; @@ -666,10 +718,26 @@ bool IsMethod( }) != methods.end(); } +bool IsMember(const nlohmann::json &j, const std::string &cls, + const std::string &name, const std::string &type) +{ + auto sc = detail::get_element(j, detail::expand_name(j, cls)); + + if (!sc) + return false; + + const nlohmann::json &members = (*sc)["members"]; + + return std::find_if(members.begin(), members.end(), [&](const auto &it) { + return it["name"] == name && it["type"] == type; + }) != members.end(); +} + bool IsAssociation(nlohmann::json j, const std::string &from, const std::string &to, const std::string &label = "") { - auto rel = detail::get_relationship(j, from, to, "association"); + auto rel = detail::get_relationship(j, detail::expand_name(j, from), + detail::expand_name(j, to), "association"); if (rel == j["relationships"].end()) return false; @@ -683,7 +751,8 @@ bool IsAssociation(nlohmann::json j, const std::string &from, bool IsComposition(nlohmann::json j, const std::string &from, const std::string &to, const std::string &label = "") { - auto rel = detail::get_relationship(j, from, to, "composition"); + auto rel = detail::get_relationship(j, detail::expand_name(j, from), + detail::expand_name(j, to), "composition"); if (rel == j["relationships"].end()) return false; @@ -697,7 +766,8 @@ bool IsComposition(nlohmann::json j, const std::string &from, bool IsAggregation(nlohmann::json j, const std::string &from, const std::string &to, const std::string &label = "") { - auto rel = detail::get_relationship(j, from, to, "aggregation"); + auto rel = detail::get_relationship(j, detail::expand_name(j, from), + detail::expand_name(j, to), "aggregation"); if (rel == j["relationships"].end()) return false; @@ -711,7 +781,26 @@ bool IsAggregation(nlohmann::json j, const std::string &from, bool IsDependency( nlohmann::json j, const std::string &from, const std::string &to) { - auto rel = detail::get_relationship(j, from, to, "aggregation"); + auto rel = detail::get_relationship(j, detail::expand_name(j, from), + detail::expand_name(j, to), "aggregation"); + + return rel != j["relationships"].end(); +} + +bool IsInstantiation( + nlohmann::json j, const std::string &from, const std::string &to) +{ + auto rel = detail::get_relationship(j, detail::expand_name(j, to), + detail::expand_name(j, from), "instantiation"); + + return rel != j["relationships"].end(); +} + +bool IsInnerClass( + nlohmann::json j, const std::string &from, const std::string &to) +{ + auto rel = detail::get_relationship(j, detail::expand_name(j, to), + detail::expand_name(j, from), "containment"); return rel != j["relationships"].end(); } From 491fb2b44371709f645251d5a4e9aed23fda1246 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 22 Mar 2023 01:00:04 +0100 Subject: [PATCH 16/30] Added test cases for JSON class generators --- src/common/generators/json/generator.cc | 1 + tests/t00002/test_case.h | 2 +- tests/t00009/test_case.h | 10 +++- tests/t00010/test_case.h | 8 +++ tests/t00011/test_case.h | 5 ++ tests/t00012/test_case.h | 8 +++ tests/t00013/test_case.h | 13 +++++ tests/t00015/test_case.h | 6 ++ tests/t00016/test_case.h | 6 ++ tests/t00017/test_case.h | 13 +++++ tests/t00018/test_case.h | 4 ++ tests/t00019/test_case.h | 5 ++ tests/t00020/test_case.h | 6 ++ tests/t00021/test_case.h | 4 ++ tests/t00022/test_case.h | 4 ++ tests/t00023/test_case.h | 4 ++ tests/t00024/test_case.h | 7 +++ tests/t00025/test_case.h | 6 ++ tests/t00026/test_case.h | 4 ++ tests/t00027/test_case.h | 11 ++++ tests/t00029/test_case.h | 2 + tests/t00030/test_case.h | 2 + tests/t00031/test_case.h | 3 + tests/t00032/test_case.h | 4 ++ tests/t00033/test_case.h | 8 +++ tests/t00034/test_case.h | 3 + tests/t00035/test_case.h | 6 ++ tests/t00037/test_case.h | 6 ++ tests/t00038/test_case.h | 4 ++ tests/t00039/test_case.h | 13 +++++ tests/t00040/test_case.h | 4 ++ tests/t00041/test_case.h | 10 ++++ tests/t00042/test_case.h | 3 + tests/t00043/test_case.h | 14 +++++ tests/t00045/test_case.h | 11 ++++ tests/t00046/test_case.h | 5 ++ tests/t00047/test_case.h | 5 ++ tests/t00048/test_case.h | 7 +++ tests/t00049/test_case.h | 4 ++ tests/t00050/test_case.h | 6 ++ tests/t00051/test_case.h | 4 ++ tests/t00052/test_case.h | 3 + tests/t00053/test_case.h | 16 ++++++ tests/t00054/test_case.h | 20 +++++++ tests/t00055/test_case.h | 11 ++++ tests/t00056/test_case.h | 9 +++ tests/t00057/test_case.h | 7 +++ tests/t00058/test_case.h | 4 ++ tests/t00059/test_case.h | 4 ++ tests/t00060/test_case.h | 7 +++ tests/test_cases.h | 74 ++++++++++++++++--------- 51 files changed, 377 insertions(+), 29 deletions(-) diff --git a/src/common/generators/json/generator.cc b/src/common/generators/json/generator.cc index 209acbc4..a36ace46 100644 --- a/src/common/generators/json/generator.cc +++ b/src/common/generators/json/generator.cc @@ -61,6 +61,7 @@ void to_json(nlohmann::json &j, const template_parameter &c) if (c.default_value()) j["default"] = c.default_value().value(); j["is_variadic"] = c.is_variadic(); + j["template_parameters"] = c.template_params(); } void to_json(nlohmann::json &j, const relationship &c) diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h index 84a4e86a..a4f5e69f 100644 --- a/tests/t00002/test_case.h +++ b/tests/t00002/test_case.h @@ -91,7 +91,7 @@ TEST_CASE("t00002", "[test-case][class]") REQUIRE(IsBaseClass(j, "C", "D")); REQUIRE(IsMethod(j, "A", "foo_a")); REQUIRE(IsMethod(j, "C", "foo_c")); - REQUIRE(IsMember(j, "E", "as", "std::vector")); + REQUIRE(IsField(j, "E", "as", "std::vector")); REQUIRE(IsAssociation(j, "D", "A", "as")); save_json(config.output_directory() + "/" + diagram->name + ".json", j); diff --git a/tests/t00009/test_case.h b/tests/t00009/test_case.h index 99e00aa2..cbcae450 100644 --- a/tests/t00009/test_case.h +++ b/tests/t00009/test_case.h @@ -61,7 +61,15 @@ TEST_CASE("t00009", "[test-case][class]") using namespace json; - REQUIRE(IsClass(j, "A")); + REQUIRE(IsClassTemplate(j, "A")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "A>")); + + REQUIRE(IsField(j, "A", "value", "T")); + REQUIRE(IsField(j, "B", "aint", "A")); + REQUIRE(IsField(j, "B", "astring", "A *")); + REQUIRE(IsField(j, "B", "avector", "A> &")); save_json(config.output_directory() + "/" + diagram->name + ".json", j); } diff --git a/tests/t00010/test_case.h b/tests/t00010/test_case.h index 4a30f573..b527ab49 100644 --- a/tests/t00010/test_case.h +++ b/tests/t00010/test_case.h @@ -56,6 +56,14 @@ TEST_CASE("t00010", "[test-case][class]") using namespace json; + REQUIRE(IsClassTemplate(j, "A")); + REQUIRE(IsClassTemplate(j, "B")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + + REQUIRE(IsField(j, "C", "aintstring", "B")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00011/test_case.h b/tests/t00011/test_case.h index 5dea69df..99eabbdb 100644 --- a/tests/t00011/test_case.h +++ b/tests/t00011/test_case.h @@ -51,6 +51,11 @@ TEST_CASE("t00011", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClassTemplate(j, "D")); + REQUIRE(IsFriend(j, "A", "B")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00012/test_case.h b/tests/t00012/test_case.h index 432a0fa5..0d3d4d59 100644 --- a/tests/t00012/test_case.h +++ b/tests/t00012/test_case.h @@ -54,6 +54,14 @@ TEST_CASE("t00012", "[test-case][class]") using namespace json; + REQUIRE(IsClassTemplate(j, "A")); + REQUIRE(IsClassTemplate(j, "B")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, + "C>>>" + ",3,3,3>")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00013/test_case.h b/tests/t00013/test_case.h index 97ca85e3..40f8b2dc 100644 --- a/tests/t00013/test_case.h +++ b/tests/t00013/test_case.h @@ -73,6 +73,19 @@ TEST_CASE("t00013", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "D")); + REQUIRE(IsInstantiation(j, "E", "E")); + REQUIRE(IsDependency(j, "R", "A")); + REQUIRE(IsDependency(j, "R", "B")); + REQUIRE(IsDependency(j, "R", "C")); + REQUIRE(IsDependency(j, "R", "D")); + REQUIRE(IsDependency(j, "D", "R")); + REQUIRE(IsDependency(j, "R", "E")); + REQUIRE(IsInstantiation(j, "G", "G")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00015/test_case.h b/tests/t00015/test_case.h index 6cc1a493..f66322b5 100644 --- a/tests/t00015/test_case.h +++ b/tests/t00015/test_case.h @@ -49,6 +49,12 @@ TEST_CASE("t00015", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "ns1::A")); + REQUIRE(IsClass(j, "ns1::ns2_v0_9_0::A")); + REQUIRE(IsClass(j, "ns1::Anon")); + REQUIRE(IsClass(j, "ns3::ns1::ns2::Anon")); + REQUIRE(IsClass(j, "ns3::B")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00016/test_case.h b/tests/t00016/test_case.h index 44a20380..f4b4d806 100644 --- a/tests/t00016/test_case.h +++ b/tests/t00016/test_case.h @@ -58,6 +58,12 @@ TEST_CASE("t00016", "[test-case][class]") using namespace json; + REQUIRE(IsClassTemplate(j, "is_numeric<>")); + REQUIRE(IsClass(j, "is_numeric")); + REQUIRE(IsClass(j, "is_numeric")); + REQUIRE(IsClass(j, "is_numeric")); + REQUIRE(IsClass(j, "is_numeric")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00017/test_case.h b/tests/t00017/test_case.h index b76ca620..41db6e1e 100644 --- a/tests/t00017/test_case.h +++ b/tests/t00017/test_case.h @@ -76,6 +76,19 @@ TEST_CASE("t00017", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "D")); + REQUIRE(IsClass(j, "E")); + REQUIRE(IsClass(j, "F")); + REQUIRE(IsClass(j, "G")); + REQUIRE(IsClass(j, "H")); + REQUIRE(IsClass(j, "I")); + REQUIRE(IsClass(j, "J")); + REQUIRE(IsClass(j, "K")); + REQUIRE(IsClass(j, "R")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00018/test_case.h b/tests/t00018/test_case.h index 1c67633b..37c7bdaa 100644 --- a/tests/t00018/test_case.h +++ b/tests/t00018/test_case.h @@ -50,6 +50,10 @@ TEST_CASE("t00018", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "widget")); + REQUIRE(IsClass(j, "impl::widget")); + REQUIRE(IsDependency(j, "impl::widget", "widget")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00019/test_case.h b/tests/t00019/test_case.h index 3874dd5d..db7bdcca 100644 --- a/tests/t00019/test_case.h +++ b/tests/t00019/test_case.h @@ -65,6 +65,11 @@ TEST_CASE("t00019", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "Base")); + REQUIRE(IsClassTemplate(j, "Layer1")); + REQUIRE(IsClassTemplate(j, "Layer2")); + REQUIRE(IsClassTemplate(j, "Layer3")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00020/test_case.h b/tests/t00020/test_case.h index 570d7fc7..299658d7 100644 --- a/tests/t00020/test_case.h +++ b/tests/t00020/test_case.h @@ -53,6 +53,12 @@ TEST_CASE("t00020", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "ProductA1")); + REQUIRE(IsClass(j, "ProductA2")); + REQUIRE(IsClass(j, "ProductB1")); + REQUIRE(IsClass(j, "ProductB2")); + REQUIRE(IsAbstractClass(j, "AbstractFactory")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00021/test_case.h b/tests/t00021/test_case.h index 6df1349e..76ed85f7 100644 --- a/tests/t00021/test_case.h +++ b/tests/t00021/test_case.h @@ -51,6 +51,10 @@ TEST_CASE("t00021", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "Visitor1")); + REQUIRE(IsClass(j, "Visitor2")); + REQUIRE(IsAbstractClass(j, "Item")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00022/test_case.h b/tests/t00022/test_case.h index 15a2fbe1..8602735a 100644 --- a/tests/t00022/test_case.h +++ b/tests/t00022/test_case.h @@ -47,6 +47,10 @@ TEST_CASE("t00022", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A1")); + REQUIRE(IsClass(j, "A2")); + REQUIRE(IsAbstractClass(j, "A")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00023/test_case.h b/tests/t00023/test_case.h index 1bb05f03..0d926df9 100644 --- a/tests/t00023/test_case.h +++ b/tests/t00023/test_case.h @@ -47,6 +47,10 @@ TEST_CASE("t00023", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "StrategyA")); + REQUIRE(IsClass(j, "StrategyB")); + REQUIRE(IsAbstractClass(j, "Strategy")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00024/test_case.h b/tests/t00024/test_case.h index ca123ce0..c0e924a4 100644 --- a/tests/t00024/test_case.h +++ b/tests/t00024/test_case.h @@ -51,6 +51,13 @@ TEST_CASE("t00024", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "Target1")); + REQUIRE(IsClass(j, "Target2")); + REQUIRE(IsAbstractClass(j, "Target")); + REQUIRE(IsBaseClass(j, "Target", "Target1")); + REQUIRE(IsBaseClass(j, "Target", "Target2")); + REQUIRE(IsBaseClass(j, "Target", "Proxy")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00025/test_case.h b/tests/t00025/test_case.h index 8d915bd6..bd15af94 100644 --- a/tests/t00025/test_case.h +++ b/tests/t00025/test_case.h @@ -61,6 +61,12 @@ TEST_CASE("t00025", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "Target1")); + REQUIRE(IsClass(j, "Target2")); + REQUIRE(IsClassTemplate(j, "Proxy")); + REQUIRE(IsDependency(j, "Proxy", "Target1")); + REQUIRE(IsDependency(j, "Proxy", "Target2")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00026/test_case.h b/tests/t00026/test_case.h index 5ce6fde7..014d2ef8 100644 --- a/tests/t00026/test_case.h +++ b/tests/t00026/test_case.h @@ -52,6 +52,10 @@ TEST_CASE("t00026", "[test-case][class]") using namespace json; + REQUIRE(IsClassTemplate(j, "Memento")); + REQUIRE(IsClassTemplate(j, "Originator")); + REQUIRE(IsInstantiation(j, "Originator", "Originator")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00027/test_case.h b/tests/t00027/test_case.h index 0c36648c..2b20e682 100644 --- a/tests/t00027/test_case.h +++ b/tests/t00027/test_case.h @@ -65,6 +65,17 @@ TEST_CASE("t00027", "[test-case][class]") using namespace json; + REQUIRE(IsAbstractClass(j, "Shape")); + REQUIRE(IsAbstractClass(j, "ShapeDecorator")); + + REQUIRE(IsClassTemplate(j, "Line...>")); + REQUIRE(IsInstantiation( + j, "Line...>", "Line")); + REQUIRE(IsInstantiation(j, "Line...>", + "Line")); + REQUIRE(IsAggregation( + j, "Window", "Text", "description")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00029/test_case.h b/tests/t00029/test_case.h index 3648bad4..ac067148 100644 --- a/tests/t00029/test_case.h +++ b/tests/t00029/test_case.h @@ -62,6 +62,8 @@ TEST_CASE("t00029", "[test-case][class]") using namespace json; + REQUIRE(IsAggregation(j, "R", "G1", "g1")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00030/test_case.h b/tests/t00030/test_case.h index 64b1525f..f3dc105f 100644 --- a/tests/t00030/test_case.h +++ b/tests/t00030/test_case.h @@ -57,6 +57,8 @@ TEST_CASE("t00030", "[test-case][class]") using namespace json; + REQUIRE(IsAggregation(j, "R", "C", "ccc")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00031/test_case.h b/tests/t00031/test_case.h index 5ec06b4b..c8b26bf1 100644 --- a/tests/t00031/test_case.h +++ b/tests/t00031/test_case.h @@ -62,6 +62,9 @@ TEST_CASE("t00031", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClassTemplate(j, "C")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00032/test_case.h b/tests/t00032/test_case.h index 882b3442..ba36785b 100644 --- a/tests/t00032/test_case.h +++ b/tests/t00032/test_case.h @@ -62,6 +62,10 @@ TEST_CASE("t00032", "[test-case][class]") using namespace json; + REQUIRE(IsBaseClass(j, "A", + "Overload")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00033/test_case.h b/tests/t00033/test_case.h index eb36b8b8..350c366e 100644 --- a/tests/t00033/test_case.h +++ b/tests/t00033/test_case.h @@ -63,6 +63,14 @@ TEST_CASE("t00033", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, + "A>>>")); + REQUIRE(IsDependency(j, + "A>>>", + "B>>")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00034/test_case.h b/tests/t00034/test_case.h index 496aeaf4..2b56baa1 100644 --- a/tests/t00034/test_case.h +++ b/tests/t00034/test_case.h @@ -55,6 +55,9 @@ TEST_CASE("t00034", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClassTemplate(j, "lift_void")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00035/test_case.h b/tests/t00035/test_case.h index 945dbb09..5b8e1021 100644 --- a/tests/t00035/test_case.h +++ b/tests/t00035/test_case.h @@ -55,6 +55,12 @@ TEST_CASE("t00035", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "Top")); + REQUIRE(IsClass(j, "Bottom")); + REQUIRE(IsClass(j, "Center")); + REQUIRE(IsClass(j, "Left")); + REQUIRE(IsClass(j, "Right")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00037/test_case.h b/tests/t00037/test_case.h index efec5642..e3b20bd8 100644 --- a/tests/t00037/test_case.h +++ b/tests/t00037/test_case.h @@ -53,6 +53,12 @@ TEST_CASE("t00037", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "ST")); + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "ST::(units)")); + REQUIRE(IsClass(j, "ST::(dimensions)")); + REQUIRE(IsAggregation(j, "ST", "ST::(dimensions)", "dimensions")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00038/test_case.h b/tests/t00038/test_case.h index c959ec60..b253ef73 100644 --- a/tests/t00038/test_case.h +++ b/tests/t00038/test_case.h @@ -104,6 +104,10 @@ TEST_CASE("t00038", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00039/test_case.h b/tests/t00039/test_case.h index 824a37f8..e3871e20 100644 --- a/tests/t00039/test_case.h +++ b/tests/t00039/test_case.h @@ -71,6 +71,19 @@ TEST_CASE("t00039", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "AA")); + REQUIRE(IsClass(j, "AAA")); + REQUIRE(IsBaseClass(j, "C", "CD")); + REQUIRE(IsBaseClass(j, "D", "CD")); + REQUIRE(IsBaseClass(j, "E", "DE")); + REQUIRE(IsBaseClass(j, "D", "DE")); + REQUIRE(IsBaseClass(j, "C", "CDE")); + REQUIRE(IsBaseClass(j, "D", "CDE")); + REQUIRE(IsBaseClass(j, "E", "CDE")); + + REQUIRE(IsClassTemplate(j, "ns3::F")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00040/test_case.h b/tests/t00040/test_case.h index 5e7f94c8..7d58e4b6 100644 --- a/tests/t00040/test_case.h +++ b/tests/t00040/test_case.h @@ -53,6 +53,10 @@ TEST_CASE("t00040", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "AA")); + REQUIRE(IsClass(j, "AAA")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00041/test_case.h b/tests/t00041/test_case.h index 27caf88a..88c1e483 100644 --- a/tests/t00041/test_case.h +++ b/tests/t00041/test_case.h @@ -72,6 +72,16 @@ TEST_CASE("t00041", "[test-case][class]") using namespace json; + REQUIRE(!IsClass(j, "A")); + REQUIRE(!IsClass(j, "AA")); + REQUIRE(!IsClass(j, "AAA")); + REQUIRE(IsClass(j, "D")); + REQUIRE(IsClass(j, "E")); + REQUIRE(IsClass(j, "F")); + REQUIRE(IsClass(j, "R")); + + REQUIRE(IsAssociation(j, "D", "RR", "rr")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00042/test_case.h b/tests/t00042/test_case.h index c490c158..3b662d5c 100644 --- a/tests/t00042/test_case.h +++ b/tests/t00042/test_case.h @@ -48,6 +48,9 @@ TEST_CASE("t00042", "[test-case][class]") using namespace json; + REQUIRE(IsClassTemplate(j, "A")); + REQUIRE(IsClassTemplate(j, "B")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00043/test_case.h b/tests/t00043/test_case.h index 6a93e301..58f1ca9f 100644 --- a/tests/t00043/test_case.h +++ b/tests/t00043/test_case.h @@ -71,6 +71,20 @@ TEST_CASE("t00043", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "dependants::A")); + REQUIRE(IsClass(j, "dependants::B")); + REQUIRE(IsClass(j, "dependants::C")); + REQUIRE(IsClass(j, "dependants::D")); + REQUIRE(IsClass(j, "dependants::BB")); + REQUIRE(IsClass(j, "dependants::E")); + REQUIRE(IsDependency(j, "dependants::B", "dependants::A")); + + REQUIRE(IsClass(j, "dependencies::G")); + REQUIRE(IsClass(j, "dependencies::GG")); + REQUIRE(IsClass(j, "dependencies::H")); + REQUIRE(IsDependency(j, "dependencies::J", "dependencies::I")); + REQUIRE(IsDependency(j, "dependencies::H", "dependencies::G")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00045/test_case.h b/tests/t00045/test_case.h index cf4487fc..249ce321 100644 --- a/tests/t00045/test_case.h +++ b/tests/t00045/test_case.h @@ -75,6 +75,17 @@ TEST_CASE("t00045", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "ns1::A")); + REQUIRE(IsClass(j, "ns1::ns2::A")); + REQUIRE(IsClass(j, "ns1::ns2::B")); + REQUIRE(IsClass(j, "ns1::ns2::C")); + REQUIRE(IsClass(j, "ns1::ns2::D")); + REQUIRE(IsClass(j, "ns1::ns2::E")); + REQUIRE(IsClass(j, "ns1::ns2::R")); + + REQUIRE(IsBaseClass(j, "ns1::ns2::A", "ns1::ns2::B")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00046/test_case.h b/tests/t00046/test_case.h index a85e2241..3ab43551 100644 --- a/tests/t00046/test_case.h +++ b/tests/t00046/test_case.h @@ -51,6 +51,11 @@ TEST_CASE("t00046", "[test-case][class]") using namespace json; + REQUIRE(get_element(j, "A").value()["type"] == "class"); + REQUIRE(get_element(j, "AA").value()["type"] == "class"); + REQUIRE(get_element(j, "ns1::A").value()["type"] == "class"); + REQUIRE(get_element(j, "ns1::ns2::D").value()["type"] == "class"); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t00047/test_case.h b/tests/t00047/test_case.h index 52542829..ae1e89f0 100644 --- a/tests/t00047/test_case.h +++ b/tests/t00047/test_case.h @@ -50,6 +50,11 @@ TEST_CASE("t00047", "[test-case][class]") using namespace json; + REQUIRE(IsClassTemplate(j, "conditional_t")); + REQUIRE(IsClass(j, "conditional_t")); + REQUIRE(IsClass(j, "conditional_t")); + REQUIRE(IsClass(j, "conditional_t")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00048/test_case.h b/tests/t00048/test_case.h index 04123d4d..6a3d2492 100644 --- a/tests/t00048/test_case.h +++ b/tests/t00048/test_case.h @@ -56,6 +56,13 @@ TEST_CASE("t00048", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "ATemplate")); + REQUIRE(IsClass(j, "BTemplate")); + REQUIRE(IsBaseClass(j, "Base", "A")); + REQUIRE(IsBaseClass(j, "Base", "B")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00049/test_case.h b/tests/t00049/test_case.h index 29a829a8..fc7c5a41 100644 --- a/tests/t00049/test_case.h +++ b/tests/t00049/test_case.h @@ -64,6 +64,10 @@ TEST_CASE("t00049", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "R")); + REQUIRE(IsClassTemplate(j, "A")); + REQUIRE(IsInstantiation(j, "A", "A")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00050/test_case.h b/tests/t00050/test_case.h index 1088ef7f..d68c0fb6 100644 --- a/tests/t00050/test_case.h +++ b/tests/t00050/test_case.h @@ -61,6 +61,12 @@ TEST_CASE("t00050", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "utils::D")); + REQUIRE(IsEnum(j, "E")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00051/test_case.h b/tests/t00051/test_case.h index da79c3e0..6fb6d73a 100644 --- a/tests/t00051/test_case.h +++ b/tests/t00051/test_case.h @@ -84,6 +84,10 @@ TEST_CASE("t00051", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsInnerClass(j, "A", "A::custom_thread1")); + REQUIRE(IsInnerClass(j, "A", "A::custom_thread2")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00052/test_case.h b/tests/t00052/test_case.h index 1aad88a9..b15b080a 100644 --- a/tests/t00052/test_case.h +++ b/tests/t00052/test_case.h @@ -56,6 +56,9 @@ TEST_CASE("t00052", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClassTemplate(j, "B")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00053/test_case.h b/tests/t00053/test_case.h index bc9c6176..71edfe48 100644 --- a/tests/t00053/test_case.h +++ b/tests/t00053/test_case.h @@ -61,6 +61,22 @@ TEST_CASE("t00053", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "a")); + REQUIRE(IsClass(j, "b")); + REQUIRE(IsClass(j, "c")); + REQUIRE(IsClass(j, "d")); + REQUIRE(IsClass(j, "e")); + REQUIRE(IsClass(j, "f")); + REQUIRE(IsClass(j, "g")); + + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "D")); + REQUIRE(IsClass(j, "E")); + REQUIRE(IsClass(j, "F")); + REQUIRE(IsClass(j, "G")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00054/test_case.h b/tests/t00054/test_case.h index 6a19036b..b7cdecd9 100644 --- a/tests/t00054/test_case.h +++ b/tests/t00054/test_case.h @@ -65,6 +65,26 @@ TEST_CASE("t00054", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "a")); + REQUIRE(IsClass(j, "b")); + REQUIRE(IsClass(j, "detail::c")); + REQUIRE(IsClass(j, "detail::d")); + REQUIRE(IsClass(j, "detail::e")); + REQUIRE(IsClass(j, "f")); + REQUIRE(IsClass(j, "g")); + + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "detail2::C")); + REQUIRE(IsClass(j, "detail2::detail3::D")); + REQUIRE(IsClass(j, "detail2::detail3::E")); + REQUIRE(IsClass(j, "detail2::F")); + REQUIRE(IsClass(j, "G")); + + REQUIRE(IsEnum(j, "detail4::i")); + REQUIRE(IsEnum(j, "detail4::h")); + REQUIRE(IsEnum(j, "detail4::j")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00055/test_case.h b/tests/t00055/test_case.h index 0d93b424..44247877 100644 --- a/tests/t00055/test_case.h +++ b/tests/t00055/test_case.h @@ -66,6 +66,17 @@ TEST_CASE("t00055", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "D")); + REQUIRE(IsClass(j, "E")); + REQUIRE(IsClass(j, "F")); + REQUIRE(IsClass(j, "G")); + REQUIRE(IsClass(j, "H")); + REQUIRE(IsClass(j, "I")); + REQUIRE(IsClass(j, "J")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index aa4b4798..5e6ddd6d 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -123,6 +123,15 @@ TEST_CASE("t00056", "[test-case][class]") using namespace json; + REQUIRE(IsConcept(j, "greater_than_simple")); + REQUIRE(IsConcept(j, "greater_than_with_requires")); + REQUIRE(IsConcept(j, "max_four_bytes")); + REQUIRE(IsConcept(j, "iterable")); + REQUIRE(IsConcept(j, "has_value_type")); + REQUIRE(IsConcept(j, "convertible_to_string")); + REQUIRE(IsConcept(j, "iterable_with_value_type")); + REQUIRE(IsConcept(j, "iterable_or_small_value_type")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00057/test_case.h b/tests/t00057/test_case.h index a378eec3..9f01a0f7 100644 --- a/tests/t00057/test_case.h +++ b/tests/t00057/test_case.h @@ -65,6 +65,13 @@ TEST_CASE("t00057", "[test-case][class]") using namespace json; + REQUIRE(get_element(j, "t00057_A").value()["type"] == "class"); + REQUIRE(get_element(j, "t00057_B").value()["type"] == "class"); + REQUIRE(get_element(j, "t00057_C").value()["type"] == "class"); + REQUIRE(get_element(j, "t00057_D").value()["type"] == "class"); + REQUIRE(get_element(j, "t00057_E").value()["type"] == "class"); + REQUIRE(get_element(j, "t00057_R").value()["type"] == "class"); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00058/test_case.h b/tests/t00058/test_case.h index 6221ee30..198f9aba 100644 --- a/tests/t00058/test_case.h +++ b/tests/t00058/test_case.h @@ -75,6 +75,10 @@ TEST_CASE("t00058", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass( + j, "B>")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00059/test_case.h b/tests/t00059/test_case.h index e92d6a7f..0ec40ec7 100644 --- a/tests/t00059/test_case.h +++ b/tests/t00059/test_case.h @@ -95,6 +95,10 @@ TEST_CASE("t00059", "[test-case][class]") using namespace json; + REQUIRE(IsConcept(j, "fruit_c")); + REQUIRE(IsConcept(j, "apple_c")); + REQUIRE(IsConcept(j, "orange_c")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t00060/test_case.h b/tests/t00060/test_case.h index 6708787a..5af2f9e9 100644 --- a/tests/t00060/test_case.h +++ b/tests/t00060/test_case.h @@ -55,6 +55,13 @@ TEST_CASE("t00060", "[test-case][class]") using namespace json; + REQUIRE(IsClass(j, "A")); + REQUIRE(IsClass(j, "B")); + REQUIRE(IsClass(j, "C")); + REQUIRE(IsClass(j, "D")); + REQUIRE(!IsClass(j, "E")); + REQUIRE(!IsClass(j, "F")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/test_cases.h b/tests/test_cases.h index 663b6acb..7ec35cda 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -611,10 +611,12 @@ ContainsMatcher IsDeprecated(std::string const &str, } namespace json { -namespace detail { std::optional get_element( const nlohmann::json &j, const std::string &name) { + if (!j.contains("elements")) + return {}; + for (const nlohmann::json &e : j["elements"]) { if (e["display_name"] == name) return {e}; @@ -642,14 +644,13 @@ auto get_relationship(const nlohmann::json &j, const nlohmann::json &from, auto get_relationship(const nlohmann::json &j, const std::string &from, const std::string &to, const std::string &type) { - auto source = detail::get_element(j, from); - auto destination = detail::get_element(j, to); + auto source = get_element(j, from); + auto destination = get_element(j, to); if (!(source && destination)) return j["relationships"].end(); - return detail::get_relationship( - j, source->at("id"), destination->at("id"), type); + return get_relationship(j, source->at("id"), destination->at("id"), type); } std::string expand_name(const nlohmann::json &j, const std::string &name) @@ -662,36 +663,47 @@ std::string expand_name(const nlohmann::json &j, const std::string &name) return fmt::format("{}::{}", j["using_namespace"].get(), name); } -} // namespace detail bool IsClass(const nlohmann::json &j, const std::string &name) { - auto e = detail::get_element(j, detail::expand_name(j, name)); + auto e = get_element(j, expand_name(j, name)); return e && e->at("type") == "class"; } +bool IsAbstractClass(const nlohmann::json &j, const std::string &name) +{ + auto e = get_element(j, expand_name(j, name)); + return e && (e->at("type") == "class") && (e->at("is_abstract") == true); +} + bool IsClassTemplate(const nlohmann::json &j, const std::string &name) { - auto e = detail::get_element(j, detail::expand_name(j, name)); + auto e = get_element(j, expand_name(j, name)); return e && e->at("type") == "class" && e->at("is_template") == true; } +bool IsConcept(const nlohmann::json &j, const std::string &name) +{ + auto e = get_element(j, expand_name(j, name)); + return e && e->at("type") == "concept"; +} + bool IsEnum(const nlohmann::json &j, const std::string &name) { - auto e = detail::get_element(j, detail::expand_name(j, name)); + auto e = get_element(j, expand_name(j, name)); return e && e->at("type") == "enum"; } bool IsPackage(const nlohmann::json &j, const std::string &name) { - auto e = detail::get_element(j, detail::expand_name(j, name)); + auto e = get_element(j, expand_name(j, name)); return e && e->at("type") == "namespace"; } bool IsBaseClass(const nlohmann::json &j, const std::string &base, const std::string &subclass) { - auto sc = detail::get_element(j, detail::expand_name(j, subclass)); + auto sc = get_element(j, expand_name(j, subclass)); if (!sc) return false; @@ -699,14 +711,14 @@ bool IsBaseClass(const nlohmann::json &j, const std::string &base, const nlohmann::json &bases = (*sc)["bases"]; return std::find_if(bases.begin(), bases.end(), [&](const auto &it) { - return it["name"] == detail::expand_name(j, base); + return it["name"] == expand_name(j, base); }) != bases.end(); } bool IsMethod( const nlohmann::json &j, const std::string &cls, const std::string &name) { - auto sc = detail::get_element(j, detail::expand_name(j, cls)); + auto sc = get_element(j, expand_name(j, cls)); if (!sc) return false; @@ -718,10 +730,10 @@ bool IsMethod( }) != methods.end(); } -bool IsMember(const nlohmann::json &j, const std::string &cls, +bool IsField(const nlohmann::json &j, const std::string &cls, const std::string &name, const std::string &type) { - auto sc = detail::get_element(j, detail::expand_name(j, cls)); + auto sc = get_element(j, expand_name(j, cls)); if (!sc) return false; @@ -736,8 +748,8 @@ bool IsMember(const nlohmann::json &j, const std::string &cls, bool IsAssociation(nlohmann::json j, const std::string &from, const std::string &to, const std::string &label = "") { - auto rel = detail::get_relationship(j, detail::expand_name(j, from), - detail::expand_name(j, to), "association"); + auto rel = get_relationship( + j, expand_name(j, from), expand_name(j, to), "association"); if (rel == j["relationships"].end()) return false; @@ -751,8 +763,8 @@ bool IsAssociation(nlohmann::json j, const std::string &from, bool IsComposition(nlohmann::json j, const std::string &from, const std::string &to, const std::string &label = "") { - auto rel = detail::get_relationship(j, detail::expand_name(j, from), - detail::expand_name(j, to), "composition"); + auto rel = get_relationship( + j, expand_name(j, from), expand_name(j, to), "composition"); if (rel == j["relationships"].end()) return false; @@ -766,8 +778,8 @@ bool IsComposition(nlohmann::json j, const std::string &from, bool IsAggregation(nlohmann::json j, const std::string &from, const std::string &to, const std::string &label = "") { - auto rel = detail::get_relationship(j, detail::expand_name(j, from), - detail::expand_name(j, to), "aggregation"); + auto rel = get_relationship( + j, expand_name(j, from), expand_name(j, to), "aggregation"); if (rel == j["relationships"].end()) return false; @@ -781,8 +793,8 @@ bool IsAggregation(nlohmann::json j, const std::string &from, bool IsDependency( nlohmann::json j, const std::string &from, const std::string &to) { - auto rel = detail::get_relationship(j, detail::expand_name(j, from), - detail::expand_name(j, to), "aggregation"); + auto rel = get_relationship( + j, expand_name(j, from), expand_name(j, to), "dependency"); return rel != j["relationships"].end(); } @@ -790,8 +802,16 @@ bool IsDependency( bool IsInstantiation( nlohmann::json j, const std::string &from, const std::string &to) { - auto rel = detail::get_relationship(j, detail::expand_name(j, to), - detail::expand_name(j, from), "instantiation"); + auto rel = get_relationship( + j, expand_name(j, to), expand_name(j, from), "instantiation"); + + return rel != j["relationships"].end(); +} + +bool IsFriend(nlohmann::json j, const std::string &from, const std::string &to) +{ + auto rel = get_relationship( + j, expand_name(j, from), expand_name(j, to), "friendship"); return rel != j["relationships"].end(); } @@ -799,8 +819,8 @@ bool IsInstantiation( bool IsInnerClass( nlohmann::json j, const std::string &from, const std::string &to) { - auto rel = detail::get_relationship(j, detail::expand_name(j, to), - detail::expand_name(j, from), "containment"); + auto rel = get_relationship( + j, expand_name(j, to), expand_name(j, from), "containment"); return rel != j["relationships"].end(); } From 49a40723a7c7751ef0ff97d810df67aabe478826 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Thu, 23 Mar 2023 00:25:33 +0100 Subject: [PATCH 17/30] Added sequence diagram JSON test matchers --- .../json/sequence_diagram_generator.cc | 53 +++++++++-- .../plantuml/sequence_diagram_generator.cc | 6 +- src/sequence_diagram/model/participant.cc | 2 +- tests/t20001/test_case.h | 53 ++++++----- tests/t20002/test_case.h | 38 +++++--- tests/t20003/test_case.h | 32 ++++--- tests/t20004/test_case.h | 73 ++++++++------ tests/t20005/test_case.h | 32 ++++--- tests/t20006/test_case.h | 83 ++++++++-------- tests/t20007/test_case.h | 41 ++++---- tests/t20008/test_case.h | 52 +++++----- tests/t20009/test_case.h | 41 ++++---- tests/t20010/test_case.h | 40 ++++---- tests/t20011/test_case.h | 44 ++++++--- tests/t20012/test_case.h | 94 ++++++++++--------- tests/t20013/test_case.h | 40 ++++---- tests/t20014/test_case.h | 37 ++++---- tests/t20015/test_case.h | 42 +++++---- tests/t20016/test_case.h | 32 ++++--- tests/t20017/test_case.h | 49 +++++----- tests/t20018/test_case.h | 54 ++++++----- tests/t20019/test_case.h | 31 +++--- tests/t20020/test_case.h | 48 +++++----- tests/t20021/test_case.h | 61 ++++++------ tests/t20022/test_case.h | 28 +++--- tests/t20023/test_case.h | 34 ++++--- tests/t20024/test_case.h | 42 +++++---- tests/t20025/test_case.h | 34 ++++--- tests/t20026/test_case.h | 26 ++--- tests/t20027/test_case.h | 30 +++--- tests/t20028/test_case.h | 34 ++++--- tests/t20029/test_case.h | 57 ++++++----- tests/test_cases.h | 90 ++++++++++++++++++ 33 files changed, 883 insertions(+), 570 deletions(-) diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc index 5857b468..7bd8ef3d 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -95,14 +95,42 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const msg["name"] = message; msg["type"] = "message"; - msg["from"]["name"] = from.value().full_name(false); - msg["from"]["id"] = std::to_string(from.value().id()); + msg["from"]["activity_name"] = from.value().full_name(false); + msg["from"]["activity_id"] = std::to_string(from.value().id()); msg["to"]["activity_id"] = std::to_string(to.value().id()); msg["to"]["activity_name"] = to.value().full_name(false); + if (from.value().type_name() == "method") { + const auto &class_participant = + m_model.get_participant(from.value().id()).value(); + + msg["from"]["participant_id"] = + std::to_string(class_participant.class_id()); + msg["from"]["participant_name"] = + m_model.get_participant(class_participant.class_id()) + .value() + .full_name(false); + } + else if (from.value().type_name() == "function" || + from.value().type_name() == "function_template") { + if (m_config.combine_free_functions_into_file_participants()) { + const auto &file_participant = + m_model.get_participant(from.value().id()) + .value(); + msg["from"]["participant_id"] = + std::to_string(common::to_id(file_participant.file())); + msg["from"]["participant_name"] = file_participant.file_relative(); + } + else { + msg["from"]["participant_id"] = std::to_string(from.value().id()); + msg["from"]["participant_name"] = from.value().full_name(false); + } + } + if (to.value().type_name() == "method") { const auto &class_participant = m_model.get_participant(to.value().id()).value(); + msg["to"]["participant_id"] = std::to_string(class_participant.class_id()); msg["to"]["participant_name"] = @@ -110,13 +138,20 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const .value() .full_name(false); } - else if (to.value().type_name() == "function" && - m_config.combine_free_functions_into_file_participants()) { - const auto &file_participant = - m_model.get_participant(to.value().id()).value(); - msg["to"]["participant_id"] = - std::to_string(common::to_id(file_participant.file())); - msg["to"]["participant_name"] = file_participant.file_relative(); + else if (to.value().type_name() == "function" || + to.value().type_name() == "function_template") { + if (m_config.combine_free_functions_into_file_participants()) { + const auto &file_participant = + m_model.get_participant(to.value().id()) + .value(); + msg["to"]["participant_id"] = + std::to_string(common::to_id(file_participant.file())); + msg["to"]["participant_name"] = file_participant.file_relative(); + } + else { + msg["to"]["participant_id"] = std::to_string(to.value().id()); + msg["to"]["participant_name"] = to.value().full_name(false); + } } msg["source_location"] = diff --git a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc index 87a20369..c2d226b6 100644 --- a/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/plantuml/sequence_diagram_generator.cc @@ -69,8 +69,10 @@ void generator::generate_call(const message &m, std::ostream &ostr) const render_mode = model::function::message_render_mode::no_arguments; if (to.value().type_name() == "method") { - message = dynamic_cast(to.value()) - .message_name(render_mode); + const auto &f = dynamic_cast(to.value()); + const std::string_view style = f.is_static() ? "__" : ""; + message = + fmt::format("{}{}{}", style, f.message_name(render_mode), style); } else if (m_config.combine_free_functions_into_file_participants()) { if (to.value().type_name() == "function") { diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index 5de94d30..1db4ac6d 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -185,7 +185,7 @@ std::string method::message_name(message_render_mode mode) const { constexpr auto kAbbreviatedMethodArgumentsLength{15}; - const std::string style = is_static() ? "__" : ""; + const std::string style = ""; if (mode == message_render_mode::no_arguments) { return fmt::format("{}{}(){}{}", style, method_name(), diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index 19d1694d..fbf91e1f 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -31,36 +31,43 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE(model->should_include("clanguml::t20001::A")); REQUIRE(!model->should_include("clanguml::t20001::detail::C")); REQUIRE(!model->should_include("std::vector")); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "add3(int,int,int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)")); + REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "add3(int,int,int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__")); + REQUIRE_THAT(puml, HasComment("t20001 test diagram of type sequence")); - REQUIRE_THAT(puml, HasComment("t20001 test diagram of type sequence")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + { + auto j = generate_sequence_json(diagram, *model); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + using namespace json; - auto j = generate_sequence_json(diagram, *model); + REQUIRE(IsFunctionParticipant(j, "tmain()")); + REQUIRE(IsClassParticipant(j, "A")); + REQUIRE(IsClassParticipant(j, "B")); - REQUIRE(j["participants"][0]["name"] == "clanguml::t20001::tmain()"); - REQUIRE(j["participants"][1]["name"] == "clanguml::t20001::A"); - REQUIRE(j["participants"][2]["name"] == "clanguml::t20001::B"); + std::vector messages = { + FindMessage(j, "tmain()", "A", "add(int,int)"), + FindMessage(j, "tmain()", "B", "wrap_add3(int,int,int)"), + FindMessage(j, "B", "A", "add3(int,int,int)"), + FindMessage(j, "A", "A", "add(int,int)"), + FindMessage(j, "A", "A", "log_result(int)"), + FindMessage(j, "B", "A", "log_result(int)")}; - auto &messages = j["sequences"][0]["messages"]; - REQUIRE(messages[0]["name"] == "add(int,int)"); - REQUIRE(messages[1]["name"] == "wrap_add3(int,int,int)"); - REQUIRE(messages[2]["name"] == "add3(int,int,int)"); - REQUIRE(messages[3]["name"] == "add(int,int)"); - REQUIRE(messages[4]["name"] == "__log_result(int)__"); - REQUIRE(messages[5]["name"] == "__log_result(int)__"); + REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t20002/test_case.h b/tests/t20002/test_case.h index 1008c217..092e514e 100644 --- a/tests/t20002/test_case.h +++ b/tests/t20002/test_case.h @@ -28,21 +28,37 @@ TEST_CASE("t20002", "[test-case][sequence]") REQUIRE(model->name() == "t20002_sequence"); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "")); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "")); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "")); + REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "")); + REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "")); + REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - auto j = generate_sequence_json(diagram, *model); + { + auto j = generate_sequence_json(diagram, *model); - // REQUIRE(j == nlohmann::json::parse(expected_json)); + using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + REQUIRE(IsFunctionParticipant(j, "m1()")); + REQUIRE(IsFunctionParticipant(j, "m2()")); + REQUIRE(IsFunctionParticipant(j, "m3()")); + REQUIRE(IsFunctionParticipant(j, "m4()")); + + std::vector messages = {FindMessage(j, "m1()", "m2()", ""), + FindMessage(j, "m2()", "m3()", ""), + FindMessage(j, "m3()", "m4()", "")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t20003/test_case.h b/tests/t20003/test_case.h index cbd0b78e..76fe7b52 100644 --- a/tests/t20003/test_case.h +++ b/tests/t20003/test_case.h @@ -27,22 +27,32 @@ TEST_CASE("t20003", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20003_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, HasCall(_A("m1(T)"), _A("m2(T)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m2(T)"), _A("m3(T)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m3(T)"), _A("m4(T)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m1(T)"), _A("m2(T)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m2(T)"), _A("m3(T)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m3(T)"), _A("m4(T)"), "")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); + std::vector messages = {FindMessage(j, "m1(T)", "m2(T)", ""), + FindMessage(j, "m2(T)", "m3(T)", ""), + FindMessage(j, "m3(T)", "m4(T)", "")}; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index 14ff035a..10a09a65 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -27,40 +27,59 @@ TEST_CASE("t20004", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20004_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(float)"), "")); + REQUIRE_THAT( + puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); + REQUIRE_THAT( + puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(float)"), "")); - REQUIRE_THAT( - puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); - REQUIRE_THAT( - puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); + REQUIRE_THAT(puml, + HasCall(_A("main()"), _A("m1(unsigned long)"), "")); + REQUIRE_THAT(puml, + HasCall(_A("m1(unsigned long)"), + _A("m4(unsigned long)"), "")); - REQUIRE_THAT(puml, - HasCall(_A("main()"), _A("m1(unsigned long)"), "")); - REQUIRE_THAT(puml, - HasCall(_A("m1(unsigned long)"), - _A("m4(unsigned long)"), "")); + REQUIRE_THAT(puml, + HasCall(_A("main()"), _A("m1(std::string)"), "")); + REQUIRE_THAT(puml, + HasCall(_A("m1(std::string)"), + _A("m2(std::string)"), "")); - REQUIRE_THAT( - puml, HasCall(_A("main()"), _A("m1(std::string)"), "")); - REQUIRE_THAT(puml, - HasCall(_A("m1(std::string)"), - _A("m2(std::string)"), "")); + REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(int)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m1(int)"), _A("m2(int)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m2(int)"), _A("m3(int)"), "")); + REQUIRE_THAT(puml, HasCall(_A("m3(int)"), _A("m4(int)"), "")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(int)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m1(int)"), _A("m2(int)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m2(int)"), _A("m3(int)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m3(int)"), _A("m4(int)"), "")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); + std::vector messages = { + FindMessage(j, "main()", "m1(float)", ""), + FindMessage(j, "main()", "m1(unsigned long)", ""), + FindMessage(j, "m1(unsigned long)", + "m4(unsigned long)", ""), + FindMessage(j, "main()", "m1(std::string)", ""), + FindMessage(j, "m1(std::string)", + "m2(std::string)", ""), + FindMessage(j, "main()", "m1(int)", ""), + FindMessage(j, "m1(int)", "m2(int)", ""), + FindMessage(j, "m2(int)", "m3(int)", ""), + FindMessage(j, "m3(int)", "m4(int)", "")}; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h index 3517260b..5be8dd0e 100644 --- a/tests/t20005/test_case.h +++ b/tests/t20005/test_case.h @@ -28,22 +28,28 @@ TEST_CASE("t20005", "[test-case][sequence]") REQUIRE(model->name() == "t20005_sequence"); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist - REQUIRE_THAT(puml, HasEntrypoint(_A("C"), "c(T)")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b(T)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(T)")); - REQUIRE_THAT(puml, HasExitpoint(_A("C"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + // Check if all calls exist + REQUIRE_THAT(puml, HasEntrypoint(_A("C"), "c(T)")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b(T)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(T)")); + REQUIRE_THAT(puml, HasExitpoint(_A("C"))); - auto j = generate_sequence_json(diagram, *model); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - // REQUIRE(j == nlohmann::json::parse(expected_json)); + { + auto j = generate_sequence_json(diagram, *model); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index 534af040..025ab90e 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -27,53 +27,62 @@ TEST_CASE("t20006", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20006_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(puml, + HasCall( + _A("B"), _A("A"), "a2(std::string)")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); - REQUIRE_THAT(puml, - HasCall(_A("B"), _A("A"), "a2(std::string)")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("BB"), "bb1(int,int)")); + REQUIRE_THAT( + puml, HasCall(_A("BB"), _A("AA"), "aa1(int)")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("BB"), "bb1(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa1(int)")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("BB"), "bb2(int,int)")); + REQUIRE_THAT( + puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("BB"), "bb2(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("BB"), + "bb1(int,std::string)")); + REQUIRE_THAT(puml, + HasCall(_A("BB"), _A("AA"), "aa2(int)")); - REQUIRE_THAT(puml, - HasCall( - _A("tmain()"), _A("BB"), "bb1(int,std::string)")); - REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("BB"), + "bb2(int,std::string)")); + REQUIRE_THAT(puml, + HasCall(_A("BB"), _A("AA"), "aa1(int)")); - REQUIRE_THAT(puml, - HasCall( - _A("tmain()"), _A("BB"), "bb2(int,std::string)")); - REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("AA"), "aa1(int)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("BB"), "bb1(int,float)")); + REQUIRE_THAT(puml, + HasCall( + _A("BB"), _A("BB"), "bb2(int,float)")); + REQUIRE_THAT( + puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("BB"), "bb1(int,float)")); - REQUIRE_THAT(puml, - HasCall(_A("BB"), _A("BB"), "bb2(int,float)")); - REQUIRE_THAT(puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20007/test_case.h b/tests/t20007/test_case.h index 8a3d9fc3..8aab5141 100644 --- a/tests/t20007/test_case.h +++ b/tests/t20007/test_case.h @@ -27,28 +27,33 @@ TEST_CASE("t20007", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20007_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("Adder"), "add(int &&,int &&)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("Adder"), + "add(int &&,float &&,double &&)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), + _A("Adder"), + "add(std::string &&,std::string &&,std::string &&)")); - // Check if all calls exist - REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("Adder"), "add(int &&,int &&)")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("Adder"), - "add(int &&,float &&,double &&)")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("Adder"), - "add(std::string &&,std::string &&,std::string &&)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20008/test_case.h b/tests/t20008/test_case.h index 2ee3fc37..3947bb8d 100644 --- a/tests/t20008/test_case.h +++ b/tests/t20008/test_case.h @@ -27,35 +27,41 @@ TEST_CASE("t20008", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20008_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + // REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), + // "a2(int)")); REQUIRE_THAT(puml, !HasCall(_A("B"), + // _A("A"), "a3(int)")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - // REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a2(int)")); - // REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), "a3(int)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("B"), "b(const char *)")); + REQUIRE_THAT(puml, + HasCall(_A("B"), _A("A"), + "a2(const char *)")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("B"), "b(const char *)")); - REQUIRE_THAT(puml, - HasCall( - _A("B"), _A("A"), "a2(const char *)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(puml, + HasCall( + _A("B"), _A("A"), "a3(std::string)")); - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); - REQUIRE_THAT(puml, - HasCall(_A("B"), _A("A"), "a3(std::string)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20009/test_case.h b/tests/t20009/test_case.h index cc284870..6a9ee4b8 100644 --- a/tests/t20009/test_case.h +++ b/tests/t20009/test_case.h @@ -27,29 +27,34 @@ TEST_CASE("t20009", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20009_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(puml, + HasCall( + _A("B"), _A("A"), "a(std::string)")); - // Check if all calls exist - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); - REQUIRE_THAT(puml, - HasCall(_A("B"), _A("A"), "a(std::string)")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(int)")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(float)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(float)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(float)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(float)")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20010/test_case.h b/tests/t20010/test_case.h index 6e01b636..96c6d6e7 100644 --- a/tests/t20010/test_case.h +++ b/tests/t20010/test_case.h @@ -27,31 +27,35 @@ TEST_CASE("t20010", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20010_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b3()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b3()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b4()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a4()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b4()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a4()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20011/test_case.h b/tests/t20011/test_case.h index dd4f623e..917fd6f1 100644 --- a/tests/t20011/test_case.h +++ b/tests/t20011/test_case.h @@ -27,27 +27,41 @@ TEST_CASE("t20011", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20011_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a(int)")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a(int)")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d(int)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b(int)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); + REQUIRE(IsFunctionParticipant(j, "tmain()")); + REQUIRE(IsClassParticipant(j, "A")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + std::vector messages = {FindMessage(j, "tmain()", "A", "a(int)"), + FindMessage(j, "A", "A", "a(int)"), + FindMessage(j, "tmain()", "A", "b(int)"), + FindMessage(j, "A", "A", "c(int)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index f76ba804..a310ee52 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -27,60 +27,64 @@ TEST_CASE("t20012", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20012_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + "operator()()")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + _A("A"), "a()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aa()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aaa()")); - // Check if all calls exist - REQUIRE_THAT(puml, - HasCall(_A("tmain()"), - _A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), - "operator()()")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), - _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aa()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aaa()")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + _A("B"), "b()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bb()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bbb()")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), - _A("B"), "b()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bb()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bbb()")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"), + _A("C"), "c()")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "cc()")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), + "operator()()")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"), - _A("C"), "c()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "cc()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"), - _A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"), - "operator()()")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), + _A("R"), "r()")); + REQUIRE_THAT(puml, + HasCall(_A("R"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"), + "operator()()")); + REQUIRE_THAT(puml, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"), + _A("C"), "c()")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()"), - _A("R"), "r()")); - REQUIRE_THAT(puml, - HasCall(_A("R"), - _A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"), - "operator()()")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"), - _A("C"), "c()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20013/test_case.h b/tests/t20013/test_case.h index 5b92f91a..10bab9f9 100644 --- a/tests/t20013/test_case.h +++ b/tests/t20013/test_case.h @@ -27,29 +27,35 @@ TEST_CASE("t20013", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20013_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT( + puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT( + puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(double)")); - REQUIRE_THAT(puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(double)")); + REQUIRE_THAT(puml, + HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)")); - REQUIRE_THAT( - puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20014/test_case.h b/tests/t20014/test_case.h index 85c13ba8..a7d615c2 100644 --- a/tests/t20014/test_case.h +++ b/tests/t20014/test_case.h @@ -27,28 +27,33 @@ TEST_CASE("t20014", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20014_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int,int)")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(int,int)")); + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("C"), "c1(int,int)")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b1(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b1(int,int)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20015/test_case.h b/tests/t20015/test_case.h index 1bc01504..4bf33db1 100644 --- a/tests/t20015/test_case.h +++ b/tests/t20015/test_case.h @@ -27,30 +27,34 @@ TEST_CASE("t20015", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20015_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall(_A("tmain()"), _A("B"), + "setup_a(std::shared_ptr &)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_x(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_y(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_z(int)")); - // Check if all calls exist - REQUIRE_THAT(puml, - HasCall( - _A("tmain()"), _A("B"), "setup_a(std::shared_ptr &)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_x(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_y(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_z(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_x(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_y(int)")); + REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_z(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_x(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_y(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_z(int)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20016/test_case.h b/tests/t20016/test_case.h index 03967382..ce77d5f7 100644 --- a/tests/t20016/test_case.h +++ b/tests/t20016/test_case.h @@ -27,25 +27,29 @@ TEST_CASE("t20016", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20016_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(long)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(long)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(long)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(const long &)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(long)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(const long &)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20017/test_case.h b/tests/t20017/test_case.h index 101741ed..8496d5d5 100644 --- a/tests/t20017/test_case.h +++ b/tests/t20017/test_case.h @@ -27,32 +27,37 @@ TEST_CASE("t20017", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20017_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasEntrypoint(_A("t20017.cc"), "tmain()")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)")); + REQUIRE_THAT(puml, + HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)")); + REQUIRE_THAT(puml, + HasCall( + _A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); + REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc"))); - // Check if all calls exist - REQUIRE_THAT(puml, HasEntrypoint(_A("t20017.cc"), "tmain()")); - REQUIRE_THAT(puml, - HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)")); - REQUIRE_THAT(puml, - HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)")); - REQUIRE_THAT(puml, - HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)")); - REQUIRE_THAT(puml, - HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)")); - REQUIRE_THAT(puml, - HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); - REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20018/test_case.h b/tests/t20018/test_case.h index 82771236..dea3b7b4 100644 --- a/tests/t20018/test_case.h +++ b/tests/t20018/test_case.h @@ -28,34 +28,40 @@ TEST_CASE("t20018", "[test-case][sequence]") REQUIRE(model->name() == "t20018_sequence"); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist - REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("Answer,120>"), "__print()__")); - REQUIRE_THAT(puml, - HasCall(_A("Answer,120>"), _A("Factorial<5>"), - "__print(int)__")); - REQUIRE_THAT(puml, - HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__")); - REQUIRE_THAT(puml, - HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print(int)__")); - REQUIRE_THAT(puml, - HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print(int)__")); - REQUIRE_THAT(puml, - HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print(int)__")); - REQUIRE_THAT(puml, - HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print(int)__")); + // Check if all calls exist + REQUIRE_THAT(puml, + HasCall( + _A("tmain()"), _A("Answer,120>"), "__print()__")); + REQUIRE_THAT(puml, + HasCall(_A("Answer,120>"), _A("Factorial<5>"), + "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print(int)__")); + REQUIRE_THAT(puml, + HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print(int)__")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - auto j = generate_sequence_json(diagram, *model); + { + auto j = generate_sequence_json(diagram, *model); - // REQUIRE(j == nlohmann::json::parse(expected_json)); + using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20019/test_case.h b/tests/t20019/test_case.h index 7276929f..ca664115 100644 --- a/tests/t20019/test_case.h +++ b/tests/t20019/test_case.h @@ -28,23 +28,28 @@ TEST_CASE("t20019", "[test-case][sequence]") REQUIRE(model->name() == "t20019_sequence"); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); - REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D1"), "impl()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); - REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D2"), "impl()")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D1"), "impl()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D2"), "impl()")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - auto j = generate_sequence_json(diagram, *model); + { + auto j = generate_sequence_json(diagram, *model); - // REQUIRE(j == nlohmann::json::parse(expected_json)); + using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20020/test_case.h b/tests/t20020/test_case.h index 0c995955..1b59a799 100644 --- a/tests/t20020/test_case.h +++ b/tests/t20020/test_case.h @@ -27,34 +27,38 @@ TEST_CASE("t20020", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20020_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT( + puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT( + puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "log()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "log()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1()")); + REQUIRE_THAT(puml, HasCallInControlCondition(_A("C"), _A("C"), "c2()")); + REQUIRE_THAT( + puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1()")); - REQUIRE_THAT(puml, HasCallInControlCondition(_A("C"), _A("C"), "c2()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20021/test_case.h b/tests/t20021/test_case.h index 5e68aea7..2df05841 100644 --- a/tests/t20021/test_case.h +++ b/tests/t20021/test_case.h @@ -27,41 +27,46 @@ TEST_CASE("t20021", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20021_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT( + puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()")); + REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); - REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "b1()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT( + puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c1()")); + REQUIRE_THAT( + puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c2()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c1()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c2()")); + // TODO: Why is this not working? + // REQUIRE_THAT( + // puml, HasCallInControlCondition(_A("tmain()"), _A("C"), + // "c3()")); + REQUIRE_THAT( + puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c4()")); + REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "c5()")); + REQUIRE_THAT(puml, + HasCallInControlCondition(_A("tmain()"), _A("C"), "contents()")); - // TODO: Why is this not working? - // REQUIRE_THAT( - // puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c4()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "c5()")); - REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "contents()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20022/test_case.h b/tests/t20022/test_case.h index 56c81b26..e4fda9e7 100644 --- a/tests/t20022/test_case.h +++ b/tests/t20022/test_case.h @@ -27,22 +27,26 @@ TEST_CASE("t20022", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20022_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("B"), "b()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("B"), "b()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20023/test_case.h b/tests/t20023/test_case.h index 9a66753a..34ea65bc 100644 --- a/tests/t20023/test_case.h +++ b/tests/t20023/test_case.h @@ -27,25 +27,29 @@ TEST_CASE("t20023", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20023_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a4()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a4()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20024/test_case.h b/tests/t20024/test_case.h index e049cd0b..34cd2179 100644 --- a/tests/t20024/test_case.h +++ b/tests/t20024/test_case.h @@ -27,30 +27,34 @@ TEST_CASE("t20024", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20024_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "select(enum_a)")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a0()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "select(enum_a)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a0()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "select(colors)")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "red()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "orange()")); + REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "green()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "select(colors)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "red()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "orange()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "green()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20025/test_case.h b/tests/t20025/test_case.h index b62945cb..5305628f 100644 --- a/tests/t20025/test_case.h +++ b/tests/t20025/test_case.h @@ -27,25 +27,29 @@ TEST_CASE("t20025", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20025_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a1()")); + // REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("add(int,int)"), "")); + REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("add2(int,int)"), "")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a1()")); - // REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("add(int,int)"), "")); - REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("add2(int,int)"), "")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20026/test_case.h b/tests/t20026/test_case.h index 1fa56093..2542b16d 100644 --- a/tests/t20026/test_case.h +++ b/tests/t20026/test_case.h @@ -27,21 +27,25 @@ TEST_CASE("t20026", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20026_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20027/test_case.h b/tests/t20027/test_case.h index 410f86af..5246bbb1 100644 --- a/tests/t20027/test_case.h +++ b/tests/t20027/test_case.h @@ -27,23 +27,27 @@ TEST_CASE("t20027", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20027_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aa()")); + REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aaa()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aa()")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aaa()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20028/test_case.h b/tests/t20028/test_case.h index da0c0e7e..be2c23de 100644 --- a/tests/t20028/test_case.h +++ b/tests/t20028/test_case.h @@ -27,25 +27,29 @@ TEST_CASE("t20028", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20028_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "c()")); + REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "d()")); + REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "e()")); - // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "c()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "d()")); - REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "e()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - // REQUIRE(j == nlohmann::json::parse(expected_json)); - - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/t20029/test_case.h b/tests/t20029/test_case.h index f2c0e311..78488db0 100644 --- a/tests/t20029/test_case.h +++ b/tests/t20029/test_case.h @@ -27,38 +27,47 @@ TEST_CASE("t20029", "[test-case][sequence]") auto model = generate_sequence_diagram(*db, diagram); REQUIRE(model->name() == "t20029_sequence"); + { + auto puml = generate_sequence_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + // Check if all calls exist + REQUIRE_THAT( + puml, HasCall(_A("tmain()"), _A("ConnectionPool"), "connect()")); + REQUIRE_THAT(puml, + HasCallInControlCondition(_A("tmain()"), + _A("Encoder>"), + "send(std::string &&)")); - // Check if all calls exist - REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("ConnectionPool"), "connect()")); - REQUIRE_THAT(puml, - HasCallInControlCondition(_A("tmain()"), - _A("Encoder>"), "send(std::string &&)")); + REQUIRE_THAT(puml, + HasCall(_A("Encoder>"), + _A("Encoder>"), + "encode(std::string &&)")); - REQUIRE_THAT(puml, - HasCall(_A("Encoder>"), - _A("Encoder>"), "encode(std::string &&)")); + REQUIRE_THAT(puml, + HasCall(_A("Encoder>"), + _A("encode_b64(std::string &&)"), "")); - REQUIRE_THAT(puml, - HasCall(_A("Encoder>"), - _A("encode_b64(std::string &&)"), "")); + REQUIRE_THAT(puml, + HasCallInControlCondition(_A("Retrier"), + _A("ConnectionPool"), "send(const std::string &)")); - REQUIRE_THAT(puml, - HasCallInControlCondition(_A("Retrier"), - _A("ConnectionPool"), "send(const std::string &)")); + REQUIRE_THAT(puml, + !HasCall( + _A("ConnectionPool"), _A("ConnectionPool"), "connect_impl()")); - REQUIRE_THAT(puml, - !HasCall(_A("ConnectionPool"), _A("ConnectionPool"), "connect_impl()")); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_sequence_json(diagram, *model); - auto j = generate_sequence_json(diagram, *model); + using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/test_cases.h b/tests/test_cases.h index 7ec35cda..621774db 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -631,6 +631,20 @@ std::optional get_element( return {}; } +std::optional get_participant( + const nlohmann::json &j, const std::string &name) +{ + if (!j.contains("participants")) + return {}; + + for (const nlohmann::json &e : j["participants"]) { + if (e["name"] == name) + return {e}; + } + + return {}; +} + auto get_relationship(const nlohmann::json &j, const nlohmann::json &from, const nlohmann::json &to, const std::string &type) { @@ -825,6 +839,82 @@ bool IsInnerClass( return rel != j["relationships"].end(); } +bool IsParticipant( + const nlohmann::json &j, const std::string &name, const std::string &type) +{ + auto p = get_participant(j, expand_name(j, name)); + + return p && (p->at("type") == type); +} + +bool IsFunctionParticipant(const nlohmann::json &j, const std::string &name) +{ + return IsParticipant(j, name, "function"); +} + +bool IsClassParticipant(const nlohmann::json &j, const std::string &name) +{ + return IsParticipant(j, name, "class"); +} + +bool IsFileParticipant(const nlohmann::json &j, const std::string &name) +{ + return IsParticipant(j, name, "file"); +} + +namespace detail { +int find_message_nested(const nlohmann::json &j, const std::string &from, + const std::string &to, const std::string &msg, const nlohmann::json &from_p, + const nlohmann::json &to_p, int &count) +{ + const auto &messages = j["messages"]; + + int res{-1}; + + for (const auto &m : messages) { + if (m.contains("branches")) { + for (const auto &b : m["branches"]) { + auto nested_res = + find_message_nested(b, from, to, msg, from_p, to_p, count); + + if (nested_res >= 0) + return nested_res; + } + } + else { + if ((m["from"]["participant_id"] == from_p["id"]) && + (m["to"]["participant_id"] == to_p["id"]) && (m["name"] == msg)) + return count; + + count++; + } + } + + return res; +} +} // namespace detail + +int FindMessage(const nlohmann::json &j, const std::string &from, + const std::string &to, const std::string &msg) +{ + auto from_p = get_participant(j, expand_name(j, from)); + auto to_p = get_participant(j, expand_name(j, to)); + + // TODO: support diagrams with multiple sequences... + const auto &sequence_0 = j["sequences"][0]; + + int count{0}; + + auto res = detail::find_message_nested( + sequence_0, from, to, msg, *from_p, *to_p, count); + + if (res >= 0) + return res; + + throw std::runtime_error( + fmt::format("No such message {} {} {}", from, to, msg)); +} + } // namespace json } } From 43b81f97ce03d13c2cdd58a49a6dc90c93797af2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 01:25:27 +0100 Subject: [PATCH 18/30] Added JSON test cases for all sequence diagram test cases --- .../json/sequence_diagram_generator.cc | 90 +++++++++++++------ .../json/sequence_diagram_generator.h | 2 + tests/t20005/test_case.h | 5 ++ tests/t20006/test_case.h | 11 +++ tests/t20007/test_case.h | 10 +++ tests/t20008/test_case.h | 12 +++ tests/t20009/test_case.h | 11 +++ tests/t20010/test_case.h | 12 +++ tests/t20012/test_case.h | 32 +++++++ tests/t20013/test_case.h | 10 +++ tests/t20014/test_case.h | 11 +++ tests/t20015/test_case.h | 5 ++ tests/t20016/test_case.h | 8 ++ tests/t20017/test_case.h | 14 +++ tests/t20018/test_case.h | 13 +++ tests/t20019/test_case.h | 8 ++ tests/t20020/test_case.h | 14 +++ tests/t20021/test_case.h | 17 ++++ tests/t20022/test_case.h | 5 ++ tests/t20023/test_case.h | 6 ++ tests/t20024/test_case.h | 7 ++ tests/t20025/test_case.h | 6 ++ tests/t20026/test_case.h | 4 + tests/t20027/test_case.h | 4 + tests/t20028/test_case.h | 7 ++ tests/t20029/test_case.h | 14 +++ tests/test_cases.h | 39 +++++++- 27 files changed, 345 insertions(+), 32 deletions(-) diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc index 7bd8ef3d..9cf9b287 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -18,12 +18,23 @@ #include "sequence_diagram_generator.h" +namespace clanguml::sequence_diagram::generators::json { + +std::string render_name(std::string name) +{ + util::replace_all(name, "##", "::"); + + return name; +} + +} // namespace clanguml::sequence_diagram::generators::json + namespace clanguml::sequence_diagram::model { -using nlohmann::json; +// using nlohmann::json; void to_json(nlohmann::json &j, const participant &c) { - j["name"] = c.full_name(false); + j["name"] = generators::json::render_name(c.full_name(false)); j["id"] = std::to_string(c.id()); j["type"] = c.type_name(); if (!c.file().empty()) @@ -95,7 +106,8 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const msg["name"] = message; msg["type"] = "message"; - msg["from"]["activity_name"] = from.value().full_name(false); + msg["from"]["activity_name"] = + generators::json::render_name(from.value().full_name(false)); msg["from"]["activity_id"] = std::to_string(from.value().id()); msg["to"]["activity_id"] = std::to_string(to.value().id()); msg["to"]["activity_name"] = to.value().full_name(false); @@ -106,10 +118,10 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const msg["from"]["participant_id"] = std::to_string(class_participant.class_id()); - msg["from"]["participant_name"] = + msg["from"]["participant_name"] = generators::json::render_name( m_model.get_participant(class_participant.class_id()) .value() - .full_name(false); + .full_name(false)); } else if (from.value().type_name() == "function" || from.value().type_name() == "function_template") { @@ -118,14 +130,22 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const m_model.get_participant(from.value().id()) .value(); msg["from"]["participant_id"] = - std::to_string(common::to_id(file_participant.file())); - msg["from"]["participant_name"] = file_participant.file_relative(); + std::to_string(common::to_id(file_participant.file_relative())); + msg["from"]["participant_name"] = util::path_to_url( + std::filesystem::relative(file_participant.file(), + std::filesystem::canonical(m_config.relative_to()) + .string())); } else { msg["from"]["participant_id"] = std::to_string(from.value().id()); msg["from"]["participant_name"] = from.value().full_name(false); } } + else if (from.value().type_name() == "lambda") { + msg["from"]["participant_id"] = std::to_string(from.value().id()); + msg["from"]["participant_name"] = + generators::json::render_name(from.value().full_name(false)); + } if (to.value().type_name() == "method") { const auto &class_participant = @@ -145,14 +165,22 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const m_model.get_participant(to.value().id()) .value(); msg["to"]["participant_id"] = - std::to_string(common::to_id(file_participant.file())); - msg["to"]["participant_name"] = file_participant.file_relative(); + std::to_string(common::to_id(file_participant.file_relative())); + msg["to"]["participant_name"] = util::path_to_url( + std::filesystem::relative(file_participant.file(), + std::filesystem::canonical(m_config.relative_to()) + .string())); } else { msg["to"]["participant_id"] = std::to_string(to.value().id()); msg["to"]["participant_name"] = to.value().full_name(false); } } + else if (to.value().type_name() == "lambda") { + msg["to"]["participant_id"] = std::to_string(to.value().id()); + msg["to"]["participant_name"] = + generators::json::render_name(to.value().full_name(false)); + } msg["source_location"] = dynamic_cast(m); @@ -339,10 +367,10 @@ void generator::process_try_message(const message &m) const nlohmann::json branch; branch["type"] = "main"; - current_block_statement()["blocks"].push_back(std::move(branch)); + current_block_statement()["branches"].push_back(std::move(branch)); block_statements_stack_.push_back( - std::ref(current_block_statement()["blocks"].back())); + std::ref(current_block_statement()["branches"].back())); } void generator::process_catch_message() const @@ -352,10 +380,10 @@ void generator::process_catch_message() const nlohmann::json branch; branch["type"] = "catch"; - current_block_statement()["blocks"].push_back(std::move(branch)); + current_block_statement()["branches"].push_back(std::move(branch)); block_statements_stack_.push_back( - std::ref(current_block_statement()["blocks"].back())); + std::ref(current_block_statement()["branches"].back())); } void generator::process_end_try_message() const @@ -388,10 +416,10 @@ void generator::process_case_message(const message &m) const nlohmann::json case_block; case_block["type"] = "case"; case_block["name"] = m.message_name(); - current_block_statement()["cases"].push_back(std::move(case_block)); + current_block_statement()["branches"].push_back(std::move(case_block)); block_statements_stack_.push_back( - std::ref(current_block_statement()["cases"].back())); + std::ref(current_block_statement()["branches"].back())); } void generator::process_end_switch_message() const @@ -526,20 +554,17 @@ common::id_t generator::generate_participant( m_model.get_participant(participant_id).value(); if (participant.type_name() == "method") { - const auto class_id = - m_model.get_participant(participant_id) - .value() - .class_id(); + participant_id = m_model.get_participant(participant_id) + .value() + .class_id(); - if (is_participant_generated(class_id)) + if (is_participant_generated(participant_id)) return participant_id; const auto &class_participant = - m_model.get_participant(class_id).value(); + m_model.get_participant(participant_id).value(); parent["participants"].push_back(class_participant); - - generated_participants_.emplace(class_id); } else if ((participant.type_name() == "function" || participant.type_name() == "function_template") && @@ -549,17 +574,26 @@ common::id_t generator::generate_participant( const auto &function_participant = m_model.get_participant(participant_id).value(); - parent["participants"].push_back(function_participant); + nlohmann::json j = function_participant; + j["name"] = util::path_to_url( + std::filesystem::relative(function_participant.file(), + std::filesystem::canonical(m_config.relative_to()).string())); - generated_participants_.emplace( - common::to_id(function_participant.file())); + participant_id = common::to_id(function_participant.file_relative()); + + if (is_participant_generated(participant_id)) + return participant_id; + + j["id"] = std::to_string(participant_id); + + parent["participants"].push_back(j); } else { parent["participants"].push_back(participant); - - generated_participants_.emplace(participant_id); } + generated_participants_.emplace(participant_id); + return participant_id; } diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.h b/src/sequence_diagram/generators/json/sequence_diagram_generator.h index 5bff18da..84e3a28a 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.h @@ -32,6 +32,8 @@ namespace clanguml::sequence_diagram::generators::json { +std::string render_name(std::string name); + using diagram_config = clanguml::config::sequence_diagram; using diagram_model = clanguml::sequence_diagram::model::diagram; diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h index 5be8dd0e..79172e7c 100644 --- a/tests/t20005/test_case.h +++ b/tests/t20005/test_case.h @@ -50,6 +50,11 @@ TEST_CASE("t20005", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "C", "B", "b(T)"), + FindMessage(j, "B", "A", "a(T)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index 025ab90e..c24b3e30 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -83,6 +83,17 @@ TEST_CASE("t20006", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "B", "b(int)"), + FindMessage(j, "B", "A", "a1(int)"), + FindMessage(j, "tmain()", "B", "b(std::string)"), + FindMessage(j, "tmain()", "BB", "bb1(int,int)"), + FindMessage(j, "BB", "AA", "aa1(int)"), + FindMessage( + j, "tmain()", "BB", "bb1(int,std::string)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20007/test_case.h b/tests/t20007/test_case.h index 8aab5141..85b679c3 100644 --- a/tests/t20007/test_case.h +++ b/tests/t20007/test_case.h @@ -54,6 +54,16 @@ TEST_CASE("t20007", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "Adder", "add(int &&,int &&)"), + FindMessage(j, "tmain()", "Adder", + "add(int &&,float &&,double &&)"), + FindMessage(j, "tmain()", + "Adder", + "add(std::string &&,std::string &&,std::string &&)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20008/test_case.h b/tests/t20008/test_case.h index 3947bb8d..5bff7031 100644 --- a/tests/t20008/test_case.h +++ b/tests/t20008/test_case.h @@ -62,6 +62,18 @@ TEST_CASE("t20008", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "B", "b(int)"), + FindMessage(j, "B", "A", "a1(int)"), + FindMessage(j, "tmain()", "B", "b(const char *)"), + FindMessage( + j, "B", "A", "a2(const char *)"), + FindMessage(j, "tmain()", "B", "b(std::string)"), + FindMessage( + j, "B", "A", "a3(std::string)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20009/test_case.h b/tests/t20009/test_case.h index 6a9ee4b8..1daf7379 100644 --- a/tests/t20009/test_case.h +++ b/tests/t20009/test_case.h @@ -55,6 +55,17 @@ TEST_CASE("t20009", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "B", "b(std::string)"), + FindMessage( + j, "B", "A", "a(std::string)"), + FindMessage(j, "tmain()", "B", "b(int)"), + FindMessage(j, "B", "A", "a(int)"), + FindMessage(j, "tmain()", "B", "b(float)"), + FindMessage(j, "B", "A", "a(float)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20010/test_case.h b/tests/t20010/test_case.h index 96c6d6e7..4be8a01c 100644 --- a/tests/t20010/test_case.h +++ b/tests/t20010/test_case.h @@ -56,6 +56,18 @@ TEST_CASE("t20010", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "B", "b1()"), + FindMessage(j, "B", "A", "a1()"), + FindMessage(j, "tmain()", "B", "b2()"), + FindMessage(j, "B", "A", "a2()"), + FindMessage(j, "tmain()", "B", "b3()"), + FindMessage(j, "B", "A", "a3()"), + FindMessage(j, "tmain()", "B", "b4()"), + FindMessage(j, "B", "A", "a4()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index a310ee52..374d9a6d 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -85,6 +85,38 @@ TEST_CASE("t20012", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", + "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", + "operator()()"), + FindMessage(j, + "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", "A", + "a()"), + FindMessage(j, "A", "A", "aa()"), FindMessage(j, "A", "A", "aaa()"), + FindMessage(j, + "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", "B", + "b()"), + FindMessage(j, "B", "B", "bb()"), FindMessage(j, "B", "B", "bbb()"), + FindMessage(j, + "tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)", "C", + "c()"), + FindMessage(j, "C", "C", "cc()"), FindMessage(j, "C", "C", "ccc()"), + FindMessage(j, + "tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)", + "tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", + "operator()()"), + FindMessage(j, "tmain()", + "R", "r()"), + FindMessage(j, "R", + "tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)", + "operator()()"), + FindMessage(j, + "tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)", "C", + "c()"), + FindMessage(j, "tmain()", "D", "add5(int)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20013/test_case.h b/tests/t20013/test_case.h index 10bab9f9..dc005e7a 100644 --- a/tests/t20013/test_case.h +++ b/tests/t20013/test_case.h @@ -56,6 +56,16 @@ TEST_CASE("t20013", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain(int,char **)", "B", "b(int)"), + FindMessage(j, "B", "A", "a1(int)"), + FindMessage(j, "tmain(int,char **)", "B", "b(double)"), + FindMessage(j, "B", "A", "a2(double)"), + FindMessage(j, "tmain(int,char **)", "B", "b(const char *)"), + FindMessage(j, "B", "A", "a3(const char *)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20014/test_case.h b/tests/t20014/test_case.h index a7d615c2..91f6d7de 100644 --- a/tests/t20014/test_case.h +++ b/tests/t20014/test_case.h @@ -54,6 +54,17 @@ TEST_CASE("t20014", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "B", "b1(int,int)"), + FindMessage(j, "B", "A", "a1(int,int)"), + FindMessage(j, "tmain()", "B", "b2(int,int)"), + FindMessage(j, "B", "A", "a2(int,int)"), + FindMessage( + j, "tmain()", "C", "c1(int,int)"), + FindMessage(j, "C", "B", "b1(int,int)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20015/test_case.h b/tests/t20015/test_case.h index 4bf33db1..29116c7a 100644 --- a/tests/t20015/test_case.h +++ b/tests/t20015/test_case.h @@ -55,6 +55,11 @@ TEST_CASE("t20015", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage( + j, "tmain()", "B", "setup_a(std::shared_ptr &)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20016/test_case.h b/tests/t20016/test_case.h index ce77d5f7..4bc099f3 100644 --- a/tests/t20016/test_case.h +++ b/tests/t20016/test_case.h @@ -50,6 +50,14 @@ TEST_CASE("t20016", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "B", "b1(long)"), + FindMessage(j, "B", "A", "a1(int)"), + FindMessage(j, "tmain()", "B", "b2(long)"), + FindMessage(j, "B", "A", "a2(const long &)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20017/test_case.h b/tests/t20017/test_case.h index 8496d5d5..fe94fd45 100644 --- a/tests/t20017/test_case.h +++ b/tests/t20017/test_case.h @@ -58,6 +58,20 @@ TEST_CASE("t20017", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, File("t20017.cc"), File("include/t20017_a.h"), + "a3(int,int)"), + FindMessage(j, File("t20017.cc"), File("include/t20017_b.h"), + "b1(int,int)"), + FindMessage(j, File("t20017.cc"), File("include/t20017_a.h"), + "a2(int,int)"), + FindMessage(j, File("t20017.cc"), File("include/t20017_a.h"), + "a1(int,int)"), + FindMessage(j, File("t20017.cc"), File("include/t20017_b.h"), + "b2(int,int)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20018/test_case.h b/tests/t20018/test_case.h index dea3b7b4..fb11d96d 100644 --- a/tests/t20018/test_case.h +++ b/tests/t20018/test_case.h @@ -62,6 +62,19 @@ TEST_CASE("t20018", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", + "Answer,120>", "print()"), + FindMessage(j, "Answer,120>", + "Factorial<5>", "print(int)"), + FindMessage(j, "Factorial<5>", "Factorial<4>", "print(int)"), + FindMessage(j, "Factorial<4>", "Factorial<3>", "print(int)"), + FindMessage(j, "Factorial<3>", "Factorial<2>", "print(int)"), + FindMessage(j, "Factorial<2>", "Factorial<1>", "print(int)"), + FindMessage(j, "Factorial<1>", "Factorial<0>", "print(int)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20019/test_case.h b/tests/t20019/test_case.h index ca664115..e9394fc0 100644 --- a/tests/t20019/test_case.h +++ b/tests/t20019/test_case.h @@ -50,6 +50,14 @@ TEST_CASE("t20019", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "Base", "name()"), + FindMessage(j, "Base", "D1", "impl()"), + FindMessage(j, "tmain()", "Base", "name()"), + FindMessage(j, "Base", "D2", "impl()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20020/test_case.h b/tests/t20020/test_case.h index 1b59a799..32d66d95 100644 --- a/tests/t20020/test_case.h +++ b/tests/t20020/test_case.h @@ -59,6 +59,20 @@ TEST_CASE("t20020", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "tmain()", "A", "a1()"), + FindMessage(j, "tmain()", "A", "a2()"), + FindMessage(j, "tmain()", "C", "c3(int)"), + FindMessage(j, "tmain()", "B", "b1()"), + FindMessage(j, "tmain()", "A", "a3()"), + FindMessage(j, "tmain()", "B", "b2()"), + FindMessage(j, "tmain()", "A", "a4()"), + FindMessage(j, "tmain()", "B", "log()"), + FindMessage(j, "tmain()", "C", "c1()"), + FindMessage(j, "C", "C", "c2()"), FindMessage(j, "C", "C", "log()"), + FindMessage(j, "tmain()", "D", "d1(int,int)")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20021/test_case.h b/tests/t20021/test_case.h index 2df05841..789426c7 100644 --- a/tests/t20021/test_case.h +++ b/tests/t20021/test_case.h @@ -67,6 +67,23 @@ TEST_CASE("t20021", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "C", "c4()"), + FindMessage(j, "C", "C", "c5()"), + FindMessage(j, "tmain()", "A", "a3()"), + FindMessage(j, "tmain()", "A", "a2()"), + FindMessage(j, "tmain()", "C", "c1()"), + FindMessage(j, "tmain()", "C", "c2()"), + FindMessage(j, "tmain()", "A", "a1()"), + FindMessage(j, "tmain()", "C", "c3()"), + FindMessage(j, "tmain()", "B", "b2()"), + FindMessage(j, "tmain()", "C", "contents()") + // TODO: Repeated messge gets wrong index + // FindMessage(j, "tmain()", "B", "b2()") + }; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20022/test_case.h b/tests/t20022/test_case.h index e4fda9e7..2c462ae2 100644 --- a/tests/t20022/test_case.h +++ b/tests/t20022/test_case.h @@ -47,6 +47,11 @@ TEST_CASE("t20022", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "tmain()", "A", "a()"), + FindMessage(j, "A", "B", "b()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20023/test_case.h b/tests/t20023/test_case.h index 34ea65bc..d1b23027 100644 --- a/tests/t20023/test_case.h +++ b/tests/t20023/test_case.h @@ -50,6 +50,12 @@ TEST_CASE("t20023", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "tmain()", "A", "a()"), + FindMessage(j, "A", "A", "a1()"), FindMessage(j, "A", "A", "a2()"), + FindMessage(j, "A", "A", "a3()"), FindMessage(j, "A", "A", "a4()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20024/test_case.h b/tests/t20024/test_case.h index 34cd2179..84551392 100644 --- a/tests/t20024/test_case.h +++ b/tests/t20024/test_case.h @@ -55,6 +55,13 @@ TEST_CASE("t20024", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "A", "select(enum_a)"), + FindMessage(j, "A", "A", "a0()"), FindMessage(j, "A", "A", "a1()"), + FindMessage(j, "A", "A", "a2()"), FindMessage(j, "A", "A", "a3()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20025/test_case.h b/tests/t20025/test_case.h index 5305628f..a309e768 100644 --- a/tests/t20025/test_case.h +++ b/tests/t20025/test_case.h @@ -50,6 +50,12 @@ TEST_CASE("t20025", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "tmain()", "A", "a()"), + // FindMessage(j, "tmain()", "A", "a2()"), + FindMessage(j, "tmain()", "add(int,int)", "")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20026/test_case.h b/tests/t20026/test_case.h index 2542b16d..93949707 100644 --- a/tests/t20026/test_case.h +++ b/tests/t20026/test_case.h @@ -46,6 +46,10 @@ TEST_CASE("t20026", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "tmain()", "A", "a()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20027/test_case.h b/tests/t20027/test_case.h index 5246bbb1..fca26ac9 100644 --- a/tests/t20027/test_case.h +++ b/tests/t20027/test_case.h @@ -48,6 +48,10 @@ TEST_CASE("t20027", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "tmain()", "A", "a()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20028/test_case.h b/tests/t20028/test_case.h index be2c23de..f039da7e 100644 --- a/tests/t20028/test_case.h +++ b/tests/t20028/test_case.h @@ -50,6 +50,13 @@ TEST_CASE("t20028", "[test-case][sequence]") using namespace json; + std::vector messages = {FindMessage(j, "tmain()", "A", "a()"), + FindMessage(j, "tmain()", "A", "b()"), + FindMessage(j, "tmain()", "A", "c()"), + FindMessage(j, "tmain()", "A", "d()")}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/t20029/test_case.h b/tests/t20029/test_case.h index 78488db0..7a0c6ac7 100644 --- a/tests/t20029/test_case.h +++ b/tests/t20029/test_case.h @@ -68,6 +68,20 @@ TEST_CASE("t20029", "[test-case][sequence]") using namespace json; + std::vector messages = { + FindMessage(j, "tmain()", "ConnectionPool", "connect()"), + FindMessage(j, "tmain()", + "Encoder>", + "send(std::string &&)")/*, + FindMessage(j, + "Encoder>", + "encode_b64(std::string &&)", "encode_b64(std::string &&)"), + FindMessage(j, "Retrier", + "ConnectionPool", "send(const std::string &)")*/}; + + REQUIRE(std::is_sorted(messages.begin(), messages.end())); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } \ No newline at end of file diff --git a/tests/test_cases.h b/tests/test_cases.h index 621774db..4503c79c 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -881,6 +881,13 @@ int find_message_nested(const nlohmann::json &j, const std::string &from, return nested_res; } } + else if (m.contains("messages")) { + auto nested_res = + find_message_nested(m, from, to, msg, from_p, to_p, count); + + if (nested_res >= 0) + return nested_res; + } else { if ((m["from"]["participant_id"] == from_p["id"]) && (m["to"]["participant_id"] == to_p["id"]) && (m["name"] == msg)) @@ -892,13 +899,13 @@ int find_message_nested(const nlohmann::json &j, const std::string &from, return res; } -} // namespace detail -int FindMessage(const nlohmann::json &j, const std::string &from, +int find_message_impl(const nlohmann::json &j, const std::string &from, const std::string &to, const std::string &msg) { - auto from_p = get_participant(j, expand_name(j, from)); - auto to_p = get_participant(j, expand_name(j, to)); + + auto from_p = get_participant(j, from); + auto to_p = get_participant(j, to); // TODO: support diagrams with multiple sequences... const auto &sequence_0 = j["sequences"][0]; @@ -915,6 +922,30 @@ int FindMessage(const nlohmann::json &j, const std::string &from, fmt::format("No such message {} {} {}", from, to, msg)); } +} // namespace detail + +struct File { + explicit File(const std::string &f) + : file{f} + { + } + + const std::string file; +}; + +int FindMessage(const nlohmann::json &j, const File &from, const File &to, + const std::string &msg) +{ + return detail::find_message_impl(j, from.file, to.file, msg); +} + +int FindMessage(const nlohmann::json &j, const std::string &from, + const std::string &to, const std::string &msg) +{ + return detail::find_message_impl( + j, expand_name(j, from), expand_name(j, to), msg); +} + } // namespace json } } From c1bce60656fd89fd7082d9e3ecc09d82f91ed28b Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 12:20:35 +0100 Subject: [PATCH 19/30] Added JSON package diagram generator --- src/common/generators/generators.cc | 76 ++++++++++--- src/common/generators/generators.h | 3 +- .../json/package_diagram_generator.cc | 104 ++++++++++++++++++ .../json/package_diagram_generator.h | 67 +++++++++++ tests/t30001/test_case.h | 63 ++++++----- tests/test_cases.cc | 16 +++ 6 files changed, 285 insertions(+), 44 deletions(-) create mode 100644 src/package_diagram/generators/json/package_diagram_generator.cc create mode 100644 src/package_diagram/generators/json/package_diagram_generator.h diff --git a/src/common/generators/generators.cc b/src/common/generators/generators.cc index 02823113..a200e993 100644 --- a/src/common/generators/generators.cc +++ b/src/common/generators/generators.cc @@ -118,17 +118,39 @@ void generate_diagram(const std::string &od, const std::string &name, dynamic_cast(*diagram), translation_units, verbose); - auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; + for (const auto generator_type : generators) { + if (generator_type == generator_type_t::plantuml) { + auto path = + std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::sequence_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), - *model); + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::sequence_diagram::generators::plantuml:: + generator( + dynamic_cast( + *diagram), + *model); - ofs.close(); + ofs.close(); - LOG_INFO("Written {} diagram to {}", name, path.string()); + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (generator_type == generator_type_t::json) { + auto path = + std::filesystem::path{od} / fmt::format("{}.json", name); + std::ofstream ofs; + + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::sequence_diagram::generators::json::generator( + dynamic_cast( + *diagram), + *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + } } else if (diagram->type() == diagram_t::kPackage) { using diagram_config = package_diagram; @@ -141,16 +163,36 @@ void generate_diagram(const std::string &od, const std::string &name, dynamic_cast(*diagram), translation_units, verbose); - auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); + for (const auto generator_type : generators) { + if (generator_type == generator_type_t::plantuml) { + auto path = + std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::package_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); + ofs << clanguml::package_diagram::generators::plantuml:: + generator( + dynamic_cast(*diagram), *model); - ofs.close(); + ofs.close(); - LOG_INFO("Written {} diagram to {}", name, path.string()); + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (generator_type == generator_type_t::json) { + auto path = + std::filesystem::path{od} / fmt::format("{}.json", name); + std::ofstream ofs; + + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::package_diagram::generators::json::generator( + dynamic_cast(*diagram), + *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + } } else if (diagram->type() == diagram_t::kInclude) { using diagram_config = include_diagram; @@ -188,8 +230,8 @@ void generate_diagrams(const std::vector &diagram_names, std::vector> futs; for (const auto &[name, diagram] : config.diagrams) { - // If there are any specific diagram names provided on the command line, - // and this diagram is not in that list - skip it + // If there are any specific diagram names provided on the command + // line, and this diagram is not in that list - skip it if (!diagram_names.empty() && !util::contains(diagram_names, name)) continue; diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h index 67d924ad..5d8ea709 100644 --- a/src/common/generators/generators.h +++ b/src/common/generators/generators.h @@ -24,6 +24,7 @@ #include "common/model/diagram_filter.h" #include "config/config.h" #include "include_diagram/generators/plantuml/include_diagram_generator.h" +#include "package_diagram/generators/json/package_diagram_generator.h" #include "package_diagram/generators/plantuml/package_diagram_generator.h" #include "sequence_diagram/generators/json/sequence_diagram_generator.h" #include "sequence_diagram/generators/plantuml/sequence_diagram_generator.h" @@ -144,7 +145,7 @@ std::unique_ptr generate( DiagramConfig &config, const std::vector &translation_units, bool /*verbose*/ = false) { - LOG_INFO("Generating diagram {}.puml", name); + LOG_INFO("Generating diagram {}", name); auto diagram = std::make_unique(); diagram->set_name(name); diff --git a/src/package_diagram/generators/json/package_diagram_generator.cc b/src/package_diagram/generators/json/package_diagram_generator.cc new file mode 100644 index 00000000..b1c62a51 --- /dev/null +++ b/src/package_diagram/generators/json/package_diagram_generator.cc @@ -0,0 +1,104 @@ +/** + * src/package_diagram/generators/json/package_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "package_diagram_generator.h" + +#include "util/error.h" + +namespace clanguml::package_diagram::generators::json { + +generator::generator(diagram_config &config, diagram_model &model) + : common_generator{config, model} +{ +} + +void generator::generate_relationships( + const package &p, nlohmann::json &parent) const +{ + LOG_DBG("Generating relationships for package {}", p.full_name(true)); + + // Generate this packages relationship + if (m_model.should_include(relationship_t::kDependency)) { + for (const auto &r : p.relationships()) { + nlohmann::json rel = r; + rel["source"] = std::to_string(p.id()); + parent["relationships"].push_back(std::move(rel)); + } + } + + // Process it's subpackages relationships + for (const auto &subpackage : p) { + generate_relationships( + dynamic_cast(*subpackage), parent); + } +} + +void generator::generate(const package &p, nlohmann::json &parent) const +{ + LOG_DBG("Generating package {}", p.name()); + + nlohmann::json j; + j["id"] = p.id(); + j["name"] = p.name(); + j["type"] = "namespace"; + j["display_name"] = p.full_name(false); + j["is_deprecated"] = p.is_deprecated(); + if (!p.file().empty()) + j["source_location"] = + dynamic_cast(p); + if (const auto &comment = p.comment(); comment) + j["comment"] = comment.value(); + + for (const auto &subpackage : p) { + auto &pkg = dynamic_cast(*subpackage); + if (m_model.should_include(pkg)) { + generate(pkg, j); + } + } + + parent["elements"].push_back(std::move(j)); +} + +void generator::generate(std::ostream &ostr) const +{ + if (m_config.using_namespace) + json_["using_namespace"] = m_config.using_namespace().to_string(); + + json_["name"] = m_model.name(); + json_["diagram_type"] = "package"; + + json_["elements"] = std::vector{}; + json_["relationships"] = std::vector{}; + + for (const auto &p : m_model) { + auto &pkg = dynamic_cast(*p); + if (m_model.should_include(pkg)) { + generate(pkg, json_); + } + } + + // Process package relationships + for (const auto &p : m_model) { + if (m_model.should_include(dynamic_cast(*p))) + generate_relationships(dynamic_cast(*p), json_); + } + + ostr << json_; +} + +} // namespace clanguml::package_diagram::generators::json diff --git a/src/package_diagram/generators/json/package_diagram_generator.h b/src/package_diagram/generators/json/package_diagram_generator.h new file mode 100644 index 00000000..7c084166 --- /dev/null +++ b/src/package_diagram/generators/json/package_diagram_generator.h @@ -0,0 +1,67 @@ +/** + * src/package_diagram/generators/json/package_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "common/generators/json/generator.h" +#include "common/generators/nested_element_stack.h" +#include "common/model/package.h" +#include "common/model/relationship.h" +#include "config/config.h" +#include "package_diagram/model/diagram.h" +#include "package_diagram/visitor/translation_unit_visitor.h" +#include "util/util.h" + +#include +#include +#include +#include + +namespace clanguml { +namespace package_diagram { +namespace generators { +namespace json { + +using diagram_config = clanguml::config::package_diagram; +using diagram_model = clanguml::package_diagram::model::diagram; + +template +using common_generator = clanguml::common::generators::json::generator; + +using clanguml::common::model::access_t; +using clanguml::common::model::package; +using clanguml::common::model::relationship_t; +using namespace clanguml::util; + +class generator : public common_generator { +public: + generator(diagram_config &config, diagram_model &model); + + void generate_relationships(const package &p, nlohmann::json &parent) const; + + void generate(const package &e, nlohmann::json &parent) const; + + void generate(std::ostream &ostr) const override; + +private: + mutable nlohmann::json json_; +}; + +} // namespace json +} // namespace generators +} // namespace package_diagram +} // namespace clanguml diff --git a/tests/t30001/test_case.h b/tests/t30001/test_case.h index 9fc5ca7d..25fa9c2e 100644 --- a/tests/t30001/test_case.h +++ b/tests/t30001/test_case.h @@ -32,37 +32,48 @@ TEST_CASE("t30001", "[test-case][package]") REQUIRE(!model->should_include("clanguml::t30001::detail::C")); REQUIRE(!model->should_include("std::vector")); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("AAA")); - REQUIRE_THAT(puml, IsPackage("AAA")); + REQUIRE_THAT(puml, IsPackage("A")); + REQUIRE_THAT(puml, IsPackage("AAA")); + REQUIRE_THAT(puml, IsPackage("AAA")); - // TODO: Fix _A() to handle fully qualified names, right - // now it only finds the first element with unqualified - // name match - REQUIRE_THAT( - puml, HasNote(_A("AA"), "top", "This is namespace AA in namespace A")); + // TODO: Fix _A() to handle fully qualified names, right + // now it only finds the first element with unqualified + // name match + REQUIRE_THAT(puml, + HasNote(_A("AA"), "top", "This is namespace AA in namespace A")); - REQUIRE_THAT(puml, - HasLink(_A("AAA"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t30001/t30001.cc#L6", - clanguml::util::get_git_commit()), - "AAA")); + REQUIRE_THAT(puml, + HasLink(_A("AAA"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t30001/t30001.cc#L6", + clanguml::util::get_git_commit()), + "AAA")); - REQUIRE_THAT(puml, - HasLink(_A("BBB"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t30001/t30001.cc#L8", - clanguml::util::get_git_commit()), - "BBB")); + REQUIRE_THAT(puml, + HasLink(_A("BBB"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t30001/t30001.cc#L8", + clanguml::util::get_git_commit()), + "BBB")); - REQUIRE_THAT(puml, HasComment("t30001 test diagram of type package")); + REQUIRE_THAT(puml, HasComment("t30001 test diagram of type package")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 4d3769a0..265a8608 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -200,6 +200,22 @@ std::string generate_package_puml( return ss.str(); } +nlohmann::json generate_package_json( + std::shared_ptr config, + clanguml::package_diagram::model::diagram &model) +{ + using namespace clanguml::package_diagram::generators::json; + + std::stringstream ss; + + assert(config.get() != nullptr); + + ss << generator( + dynamic_cast(*config), model); + + return nlohmann::json::parse(ss.str()); +} + std::string generate_include_puml( std::shared_ptr config, clanguml::include_diagram::model::diagram &model) From aa2d3099de6b6afda56d2343e7f7f1098d71bdf6 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 13:39:53 +0100 Subject: [PATCH 20/30] Added JSON package diagram generator test cases --- .../json/package_diagram_generator.cc | 2 +- tests/t30001/test_case.h | 11 ++ tests/t30002/test_case.h | 126 ++++++++++++------ tests/t30003/t30003.cc | 16 +-- tests/t30003/test_case.h | 44 ++++-- tests/t30004/test_case.h | 38 ++++-- tests/t30005/test_case.h | 44 ++++-- tests/t30006/test_case.h | 38 ++++-- tests/t30007/test_case.h | 43 ++++-- tests/t30008/test_case.h | 61 ++++++--- tests/t30009/test_case.h | 46 +++++-- tests/test_cases.h | 6 + 12 files changed, 345 insertions(+), 130 deletions(-) diff --git a/src/package_diagram/generators/json/package_diagram_generator.cc b/src/package_diagram/generators/json/package_diagram_generator.cc index b1c62a51..e5d7b154 100644 --- a/src/package_diagram/generators/json/package_diagram_generator.cc +++ b/src/package_diagram/generators/json/package_diagram_generator.cc @@ -53,7 +53,7 @@ void generator::generate(const package &p, nlohmann::json &parent) const LOG_DBG("Generating package {}", p.name()); nlohmann::json j; - j["id"] = p.id(); + j["id"] = std::to_string(p.id()); j["name"] = p.name(); j["type"] = "namespace"; j["display_name"] = p.full_name(false); diff --git a/tests/t30001/test_case.h b/tests/t30001/test_case.h index 25fa9c2e..c5e64c1b 100644 --- a/tests/t30001/test_case.h +++ b/tests/t30001/test_case.h @@ -74,6 +74,17 @@ TEST_CASE("t30001", "[test-case][package]") using namespace json; + REQUIRE(IsPackage(j, "A")); + REQUIRE(IsPackage(j, "A::AA")); + REQUIRE(IsPackage(j, "A::AA::AAA")); + REQUIRE(IsPackage(j, "A::AA::BBB")); + REQUIRE(IsPackage(j, "A::BB")); + REQUIRE(IsPackage(j, "B")); + REQUIRE(IsPackage(j, "B::AA")); + REQUIRE(IsPackage(j, "B::AA::AAA")); + REQUIRE(IsPackage(j, "B::AA::BBB")); + REQUIRE(IsPackage(j, "B::BB")); + save_json(config.output_directory() + "/" + diagram->name + ".json", j); } } diff --git a/tests/t30002/test_case.h b/tests/t30002/test_case.h index e4ef8c77..ef88d9bf 100644 --- a/tests/t30002/test_case.h +++ b/tests/t30002/test_case.h @@ -28,46 +28,96 @@ TEST_CASE("t30002", "[test-case][package]") REQUIRE(model->name() == "t30002_package"); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A1")); - REQUIRE_THAT(puml, IsPackage("A2")); - REQUIRE_THAT(puml, IsPackage("A3")); - REQUIRE_THAT(puml, IsPackage("A4")); - REQUIRE_THAT(puml, IsPackage("A5")); - REQUIRE_THAT(puml, IsPackage("A6")); - REQUIRE_THAT(puml, IsPackage("A7")); - REQUIRE_THAT(puml, IsPackage("A8")); - REQUIRE_THAT(puml, IsPackage("A9")); - REQUIRE_THAT(puml, IsPackage("A11")); - REQUIRE_THAT(puml, IsPackage("A12")); - REQUIRE_THAT(puml, IsPackage("A13")); - REQUIRE_THAT(puml, IsPackage("A14")); - REQUIRE_THAT(puml, IsPackage("A15")); - REQUIRE_THAT(puml, IsPackage("A16")); - REQUIRE_THAT(puml, IsPackage("A17")); + REQUIRE_THAT(puml, IsPackage("A1")); + REQUIRE_THAT(puml, IsPackage("A2")); + REQUIRE_THAT(puml, IsPackage("A3")); + REQUIRE_THAT(puml, IsPackage("A4")); + REQUIRE_THAT(puml, IsPackage("A5")); + REQUIRE_THAT(puml, IsPackage("A6")); + REQUIRE_THAT(puml, IsPackage("A7")); + REQUIRE_THAT(puml, IsPackage("A8")); + REQUIRE_THAT(puml, IsPackage("A9")); + REQUIRE_THAT(puml, IsPackage("A11")); + REQUIRE_THAT(puml, IsPackage("A12")); + REQUIRE_THAT(puml, IsPackage("A13")); + REQUIRE_THAT(puml, IsPackage("A14")); + REQUIRE_THAT(puml, IsPackage("A15")); + REQUIRE_THAT(puml, IsPackage("A16")); + REQUIRE_THAT(puml, IsPackage("A17")); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A1"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A2"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A3"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A4"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A5"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A6"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A7"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A8"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A9"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A10"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A11"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A12"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A13"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A14"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A15"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A16"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A17"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A1"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A2"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A3"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A4"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A5"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A6"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A7"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A8"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A9"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A10"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A11"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A12"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A13"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A14"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A15"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A16"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A17"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "A::AA")); + REQUIRE(IsPackage(j, "A::AA::A1")); + REQUIRE(IsPackage(j, "A::AA::A2")); + REQUIRE(IsPackage(j, "A::AA::A3")); + REQUIRE(IsPackage(j, "A::AA::A4")); + REQUIRE(IsPackage(j, "A::AA::A5")); + REQUIRE(IsPackage(j, "A::AA::A6")); + REQUIRE(IsPackage(j, "A::AA::A7")); + REQUIRE(IsPackage(j, "A::AA::A8")); + REQUIRE(IsPackage(j, "A::AA::A9")); + REQUIRE(IsPackage(j, "A::AA::A10")); + REQUIRE(IsPackage(j, "A::AA::A11")); + REQUIRE(IsPackage(j, "A::AA::A12")); + REQUIRE(IsPackage(j, "A::AA::A13")); + REQUIRE(IsPackage(j, "A::AA::A14")); + REQUIRE(IsPackage(j, "A::AA::A15")); + REQUIRE(IsPackage(j, "A::AA::A16")); + REQUIRE(IsPackage(j, "A::AA::A17")); + + REQUIRE(IsPackage(j, "B::BB::BBB")); + + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A1")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A2")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A3")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A4")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A5")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A6")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A7")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A8")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A9")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A10")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A11")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A12")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A13")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A14")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A15")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A16")); + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A17")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t30003/t30003.cc b/tests/t30003/t30003.cc index 134e675d..f5691f9d 100644 --- a/tests/t30003/t30003.cc +++ b/tests/t30003/t30003.cc @@ -4,24 +4,24 @@ namespace t30003 { namespace ns1 { namespace ns2_v1_0_0 { class A { }; -} +} // namespace ns2_v1_0_0 namespace [[deprecated]] ns2_v0_9_0 { class A { }; -} +} // namespace ns2_v0_9_0 namespace { class Anon final { }; -} -} +} // namespace +} // namespace ns1 namespace [[deprecated]] ns3 { namespace ns1::ns2 { class Anon : public t30003::ns1::ns2_v1_0_0::A { }; -} +} // namespace ns1::ns2 class B : public ns1::ns2::Anon { }; -} -} -} \ No newline at end of file +} // namespace ns3 +} // namespace t30003 +} // namespace clanguml \ No newline at end of file diff --git a/tests/t30003/test_case.h b/tests/t30003/test_case.h index c9026838..c9b9e200 100644 --- a/tests/t30003/test_case.h +++ b/tests/t30003/test_case.h @@ -27,21 +27,41 @@ TEST_CASE("t30003", "[test-case][package]") auto model = generate_package_diagram(*db, diagram); REQUIRE(model->name() == "t30003_package"); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, IsPackage("ns1")); + REQUIRE_THAT(puml, IsPackage("ns2")); + REQUIRE_THAT(puml, IsPackage("ns3")); + REQUIRE_THAT(puml, IsPackage("ns2_v1_0_0")); + REQUIRE_THAT(puml, IsPackage("ns2_v0_9_0")); - REQUIRE_THAT(puml, IsPackage("ns1")); - REQUIRE_THAT(puml, IsPackage("ns2")); - REQUIRE_THAT(puml, IsPackage("ns3")); - REQUIRE_THAT(puml, IsPackage("ns2_v1_0_0")); - REQUIRE_THAT(puml, IsPackage("ns2_v0_9_0")); + REQUIRE_THAT(puml, IsDeprecated(_A("ns2_v0_9_0"))); + REQUIRE_THAT(puml, IsDeprecated(_A("ns3"))); - REQUIRE_THAT(puml, IsDeprecated(_A("ns2_v0_9_0"))); - REQUIRE_THAT(puml, IsDeprecated(_A("ns3"))); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "ns1")); + REQUIRE(IsPackage(j, "ns1::ns2_v1_0_0")); + REQUIRE(IsPackage(j, "ns1::ns2_v0_9_0")); + REQUIRE(IsPackage(j, "ns3")); + REQUIRE(IsPackage(j, "ns3::ns1")); + REQUIRE(IsPackage(j, "ns3::ns1::ns2")); + + REQUIRE(IsDeprecated(j, "ns1::ns2_v0_9_0")); + REQUIRE(IsDeprecated(j, "ns3")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t30004/test_case.h b/tests/t30004/test_case.h index 6c471d87..ef97bd49 100644 --- a/tests/t30004/test_case.h +++ b/tests/t30004/test_case.h @@ -28,17 +28,35 @@ TEST_CASE("t30004", "[test-case][package]") REQUIRE(model->name() == "t30004_package"); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("AAA")); - REQUIRE_THAT(puml, IsPackage("BBB")); - REQUIRE_THAT(puml, IsPackage("CCC")); - REQUIRE_THAT(puml, !IsPackage("DDD")); - REQUIRE_THAT(puml, IsPackage("EEE")); + REQUIRE_THAT(puml, IsPackage("AAA")); + REQUIRE_THAT(puml, IsPackage("BBB")); + REQUIRE_THAT(puml, IsPackage("CCC")); + REQUIRE_THAT(puml, !IsPackage("DDD")); + REQUIRE_THAT(puml, IsPackage("EEE")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "A")); + REQUIRE(IsPackage(j, "A::AAA")); + REQUIRE(IsPackage(j, "A::BBB")); + REQUIRE(IsPackage(j, "A::CCC")); + REQUIRE(!IsPackage(j, "A::DDD")); + REQUIRE(IsPackage(j, "A::EEE")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t30005/test_case.h b/tests/t30005/test_case.h index 3afa00ee..18665830 100644 --- a/tests/t30005/test_case.h +++ b/tests/t30005/test_case.h @@ -28,18 +28,42 @@ TEST_CASE("t30005", "[test-case][package]") REQUIRE(model->name() == "t30005_package"); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("AAA")); - REQUIRE_THAT(puml, IsPackage("BBB")); - REQUIRE_THAT(puml, IsPackage("CCC")); + REQUIRE_THAT(puml, IsPackage("AAA")); + REQUIRE_THAT(puml, IsPackage("BBB")); + REQUIRE_THAT(puml, IsPackage("CCC")); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("AAA"))); - REQUIRE_THAT(puml, IsDependency(_A("CCC"), _A("AAA"))); + REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("AAA"))); + REQUIRE_THAT(puml, IsDependency(_A("CCC"), _A("AAA"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "A")); + REQUIRE(IsPackage(j, "A::AA")); + REQUIRE(IsPackage(j, "A::AA::AAA")); + REQUIRE(IsPackage(j, "B")); + REQUIRE(IsPackage(j, "B::BB")); + REQUIRE(IsPackage(j, "B::BB::BBB")); + REQUIRE(IsPackage(j, "C")); + REQUIRE(IsPackage(j, "C::CC")); + REQUIRE(IsPackage(j, "C::CC::CCC")); + + REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::AAA")); + REQUIRE(IsDependency(j, "C::CC::CCC", "A::AA::AAA")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t30006/test_case.h b/tests/t30006/test_case.h index 9d7808ef..b238f55e 100644 --- a/tests/t30006/test_case.h +++ b/tests/t30006/test_case.h @@ -28,18 +28,36 @@ TEST_CASE("t30006", "[test-case][package]") REQUIRE(model->name() == "t30006_package"); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); + REQUIRE_THAT(puml, IsPackage("A")); + REQUIRE_THAT(puml, IsPackage("B")); + REQUIRE_THAT(puml, IsPackage("C")); - REQUIRE_THAT(puml, IsDependency(_A("A"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("A"), _A("C"))); + REQUIRE_THAT(puml, IsDependency(_A("A"), _A("B"))); + REQUIRE_THAT(puml, IsDependency(_A("A"), _A("C"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "A")); + REQUIRE(IsPackage(j, "B")); + REQUIRE(IsPackage(j, "C")); + + REQUIRE(IsDependency(j, "A", "B")); + REQUIRE(IsDependency(j, "A", "C")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t30007/test_case.h b/tests/t30007/test_case.h index 1fbb7399..6262c0c5 100644 --- a/tests/t30007/test_case.h +++ b/tests/t30007/test_case.h @@ -28,21 +28,40 @@ TEST_CASE("t30007", "[test-case][package]") REQUIRE(model->name() == "t30007_package"); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); + REQUIRE_THAT(puml, IsPackage("A")); + REQUIRE_THAT(puml, IsPackage("B")); + REQUIRE_THAT(puml, IsPackage("C")); - REQUIRE_THAT(puml, IsDependency(_A("AA"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("AA"), _A("C"))); + REQUIRE_THAT(puml, IsDependency(_A("AA"), _A("B"))); + REQUIRE_THAT(puml, IsDependency(_A("AA"), _A("C"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "up", _A("AA"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "left", _A("B"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "up", _A("AA"))); + REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "left", _A("B"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "A")); + REQUIRE(IsPackage(j, "A::AA")); + REQUIRE(IsPackage(j, "B")); + REQUIRE(IsPackage(j, "C")); + + REQUIRE(IsDependency(j, "A::AA", "B")); + REQUIRE(IsDependency(j, "A::AA", "C")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t30008/test_case.h b/tests/t30008/test_case.h index c14d183f..a6bd9b7b 100644 --- a/tests/t30008/test_case.h +++ b/tests/t30008/test_case.h @@ -28,27 +28,54 @@ TEST_CASE("t30008", "[test-case][package]") REQUIRE(model->name() == "t30008_package"); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); - REQUIRE_THAT(puml, !IsPackage("X")); + REQUIRE_THAT(puml, IsPackage("A")); + REQUIRE_THAT(puml, IsPackage("B")); + REQUIRE_THAT(puml, IsPackage("C")); + REQUIRE_THAT(puml, !IsPackage("X")); - REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B"))); + REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A"))); + REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B"))); - REQUIRE_THAT(puml, IsPackage("D")); - REQUIRE_THAT(puml, IsPackage("E")); - REQUIRE_THAT(puml, IsPackage("F")); - REQUIRE_THAT(puml, !IsPackage("Y")); + REQUIRE_THAT(puml, IsPackage("D")); + REQUIRE_THAT(puml, IsPackage("E")); + REQUIRE_THAT(puml, IsPackage("F")); + REQUIRE_THAT(puml, !IsPackage("Y")); - REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D"))); - REQUIRE_THAT(puml, IsDependency(_A("F"), _A("E"))); + REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D"))); + REQUIRE_THAT(puml, IsDependency(_A("F"), _A("E"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "dependants::A")); + REQUIRE(IsPackage(j, "dependants::B")); + REQUIRE(IsPackage(j, "dependants::C")); + REQUIRE(!IsPackage(j, "dependants::X")); + + REQUIRE(IsDependency(j, "dependants::B", "dependants::A")); + REQUIRE(IsDependency(j, "dependants::C", "dependants::B")); + + REQUIRE(IsPackage(j, "dependencies::D")); + REQUIRE(IsPackage(j, "dependencies::E")); + REQUIRE(IsPackage(j, "dependencies::F")); + REQUIRE(!IsPackage(j, "dependencies::Y")); + + REQUIRE(IsDependency(j, "dependencies::E", "dependencies::D")); + REQUIRE(IsDependency(j, "dependencies::F", "dependencies::E")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t30009/test_case.h b/tests/t30009/test_case.h index 90343059..8ee85cfb 100644 --- a/tests/t30009/test_case.h +++ b/tests/t30009/test_case.h @@ -28,19 +28,41 @@ TEST_CASE("t30009", "[test-case][package]") REQUIRE(model->name() == "t30009_package"); - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_package_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - // Check if all packages exist - REQUIRE_THAT(puml, IsPackage("One")); - REQUIRE_THAT(puml, IsPackage("Two")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); - REQUIRE_THAT(puml, IsPackage("D")); + // Check if all packages exist + REQUIRE_THAT(puml, IsPackage("One")); + REQUIRE_THAT(puml, IsPackage("Two")); + REQUIRE_THAT(puml, IsPackage("A")); + REQUIRE_THAT(puml, IsPackage("B")); + REQUIRE_THAT(puml, IsPackage("C")); + REQUIRE_THAT(puml, IsPackage("D")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_package_json(diagram, *model); + + using namespace json; + + REQUIRE(IsPackage(j, "One")); + REQUIRE(IsPackage(j, "Two")); + REQUIRE(IsPackage(j, "One::A")); + REQUIRE(IsPackage(j, "One::B")); + REQUIRE(IsPackage(j, "One::C")); + REQUIRE(IsPackage(j, "One::D")); + REQUIRE(IsPackage(j, "Two::A")); + REQUIRE(IsPackage(j, "Two::B")); + REQUIRE(IsPackage(j, "Two::C")); + REQUIRE(IsPackage(j, "Two::D")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } \ No newline at end of file diff --git a/tests/test_cases.h b/tests/test_cases.h index 4503c79c..3f60fc4b 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -714,6 +714,12 @@ bool IsPackage(const nlohmann::json &j, const std::string &name) return e && e->at("type") == "namespace"; } +bool IsDeprecated(const nlohmann::json &j, const std::string &name) +{ + auto e = get_element(j, expand_name(j, name)); + return e && e->at("is_deprecated") == true; +} + bool IsBaseClass(const nlohmann::json &j, const std::string &base, const std::string &subclass) { From 344549ac0378a6f700d1d20563f3b0c359d7666d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 18:18:19 +0100 Subject: [PATCH 21/30] Added include diagram JSON model generator --- src/common/generators/generators.cc | 34 ++++-- src/common/generators/generators.h | 1 + src/common/model/source_file.cc | 18 +++ src/common/model/source_file.h | 2 + .../json/include_diagram_generator.cc | 107 ++++++++++++++++ .../json/include_diagram_generator.h | 69 +++++++++++ .../json/package_diagram_generator.cc | 2 +- tests/t40001/test_case.h | 59 ++++++--- tests/t40002/test_case.h | 115 +++++++++++------- tests/t40003/test_case.h | 54 ++++++-- tests/test_cases.cc | 16 +++ tests/test_cases.h | 52 ++++++-- 12 files changed, 438 insertions(+), 91 deletions(-) create mode 100644 src/include_diagram/generators/json/include_diagram_generator.cc create mode 100644 src/include_diagram/generators/json/include_diagram_generator.h diff --git a/src/common/generators/generators.cc b/src/common/generators/generators.cc index a200e993..b7b9dd1d 100644 --- a/src/common/generators/generators.cc +++ b/src/common/generators/generators.cc @@ -205,16 +205,36 @@ void generate_diagram(const std::string &od, const std::string &name, dynamic_cast(*diagram), translation_units, verbose); - auto path = std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); + for (const auto generator_type : generators) { + if (generator_type == generator_type_t::plantuml) { + auto path = + std::filesystem::path{od} / fmt::format("{}.puml", name); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::include_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); + ofs << clanguml::include_diagram::generators::plantuml:: + generator( + dynamic_cast(*diagram), *model); - ofs.close(); + ofs.close(); - LOG_INFO("Written {} diagram to {}", name, path.string()); + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + else if (generator_type == generator_type_t::json) { + auto path = + std::filesystem::path{od} / fmt::format("{}.json", name); + std::ofstream ofs; + + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << clanguml::include_diagram::generators::json::generator( + dynamic_cast(*diagram), + *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); + } + } } } diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h index 5d8ea709..e5e03803 100644 --- a/src/common/generators/generators.h +++ b/src/common/generators/generators.h @@ -23,6 +23,7 @@ #include "common/generators/generators.h" #include "common/model/diagram_filter.h" #include "config/config.h" +#include "include_diagram/generators/json/include_diagram_generator.h" #include "include_diagram/generators/plantuml/include_diagram_generator.h" #include "package_diagram/generators/json/package_diagram_generator.h" #include "package_diagram/generators/plantuml/package_diagram_generator.h" diff --git a/src/common/model/source_file.cc b/src/common/model/source_file.cc index 49269d92..b5161c97 100644 --- a/src/common/model/source_file.cc +++ b/src/common/model/source_file.cc @@ -17,3 +17,21 @@ */ #include "source_file.h" + +namespace clanguml::common::model { + +std::string to_string(source_file_t sf) +{ + switch (sf) { + case source_file_t::kDirectory: + return "directory"; + case source_file_t::kHeader: + return "header"; + case source_file_t::kImplementation: + return "implementation"; + default: + assert(false); + } +} + +} // namespace clanguml::common::model diff --git a/src/common/model/source_file.h b/src/common/model/source_file.h index fbc00778..8c860504 100644 --- a/src/common/model/source_file.h +++ b/src/common/model/source_file.h @@ -36,6 +36,8 @@ namespace clanguml::common::model { enum class source_file_t { kDirectory, kHeader, kImplementation }; +std::string to_string(source_file_t sf); + struct fs_path_sep { #ifdef _WIN32 static constexpr std::string_view value = "\\"; diff --git a/src/include_diagram/generators/json/include_diagram_generator.cc b/src/include_diagram/generators/json/include_diagram_generator.cc new file mode 100644 index 00000000..ce26063b --- /dev/null +++ b/src/include_diagram/generators/json/include_diagram_generator.cc @@ -0,0 +1,107 @@ +/** + * src/include_diagram/generators/json/include_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "include_diagram_generator.h" + +#include "util/error.h" + +namespace clanguml::include_diagram::generators::json { + +generator::generator(diagram_config &config, diagram_model &model) + : common_generator{config, model} +{ +} + +void generator::generate_relationships( + const source_file &f, nlohmann::json &parent) const +{ + LOG_DBG("Generating relationships for file {}", f.full_name(true)); + + namespace json_common = clanguml::common::generators::json; + + if (f.type() == common::model::source_file_t::kDirectory) { + util::for_each(f, [this, &parent](const auto &file) { + generate_relationships( + dynamic_cast(*file), parent); + }); + } + else { + util::for_each_if( + f.relationships(), + [this](const auto &r) { return m_model.should_include(r.type()); }, + [&f, this](const auto &r) { + nlohmann::json rel = r; + rel["source"] = std::to_string(f.id()); + json_["relationships"].push_back(std::move(rel)); + }); + } +} + +void generator::generate(const source_file &f, nlohmann::json &parent) const +{ + nlohmann::json j; + j["id"] = std::to_string(f.id()); + j["name"] = f.name(); + j["display_name"] = f.full_name(false); + + if (f.type() == common::model::source_file_t::kDirectory) { + LOG_DBG("Generating directory {}", f.name()); + + j["type"] = "folder"; + + util::for_each(f, [this, &j](const auto &file) { + generate(dynamic_cast(*file), j); + }); + + parent["elements"].push_back(std::move(j)); + } + else { + if (m_model.should_include(f)) { + LOG_DBG("Generating file {}", f.name()); + + j["type"] = "file"; + j["file_kind"] = to_string(f.type()); + + parent["elements"].push_back(std::move(j)); + } + } +} + +void generator::generate(std::ostream &ostr) const +{ + json_["name"] = m_model.name(); + json_["diagram_type"] = "include"; + + json_["elements"] = std::vector{}; + json_["relationships"] = std::vector{}; + + // Generate files and folders + util::for_each_if( + m_model, [](const auto & /*f*/) { return true; }, + [this, &ostr](const auto &f) { + generate(dynamic_cast(*f), json_); + }); + + // Process file include relationships + util::for_each(m_model, [this](const auto &f) { + generate_relationships(dynamic_cast(*f), json_); + }); + + ostr << json_; +} +} // namespace clanguml::include_diagram::generators::json diff --git a/src/include_diagram/generators/json/include_diagram_generator.h b/src/include_diagram/generators/json/include_diagram_generator.h new file mode 100644 index 00000000..b7865e8b --- /dev/null +++ b/src/include_diagram/generators/json/include_diagram_generator.h @@ -0,0 +1,69 @@ +/** + * src/include_diagram/generators/json/include_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "common/generators/json/generator.h" +#include "common/model/package.h" +#include "common/model/relationship.h" +#include "common/model/source_file.h" +#include "config/config.h" +#include "include_diagram/model/diagram.h" +#include "include_diagram/visitor/translation_unit_visitor.h" +#include "util/util.h" + +#include +#include +#include +#include + +namespace clanguml { +namespace include_diagram { +namespace generators { +namespace json { + +using diagram_config = clanguml::config::include_diagram; +using diagram_model = clanguml::include_diagram::model::diagram; + +template +using common_generator = clanguml::common::generators::json::generator; + +using clanguml::common::model::access_t; +using clanguml::common::model::package; +using clanguml::common::model::relationship_t; +using clanguml::common::model::source_file; +using namespace clanguml::util; + +class generator : public common_generator { +public: + generator(diagram_config &config, diagram_model &model); + + void generate_relationships( + const source_file &p, nlohmann::json &parent) const; + + void generate(const source_file &e, nlohmann::json &parent) const; + + void generate(std::ostream &ostr) const override; + +private: + mutable nlohmann::json json_; +}; + +} // namespace json +} // namespace generators +} // namespace include_diagram +} // namespace clanguml diff --git a/src/package_diagram/generators/json/package_diagram_generator.cc b/src/package_diagram/generators/json/package_diagram_generator.cc index e5d7b154..05c12f0c 100644 --- a/src/package_diagram/generators/json/package_diagram_generator.cc +++ b/src/package_diagram/generators/json/package_diagram_generator.cc @@ -37,7 +37,7 @@ void generator::generate_relationships( for (const auto &r : p.relationships()) { nlohmann::json rel = r; rel["source"] = std::to_string(p.id()); - parent["relationships"].push_back(std::move(rel)); + json_["relationships"].push_back(std::move(rel)); } } diff --git a/tests/t40001/test_case.h b/tests/t40001/test_case.h index 2ed7621f..70b5ec90 100644 --- a/tests/t40001/test_case.h +++ b/tests/t40001/test_case.h @@ -28,27 +28,56 @@ TEST_CASE("t40001", "[test-case][include]") REQUIRE(model->name() == "t40001_include"); - auto puml = generate_include_puml(diagram, *model); + { + auto puml = generate_include_puml(diagram, *model); - AliasMatcher _A(puml); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsFolder("lib1")); - REQUIRE_THAT(puml, IsFile("lib1.h")); - REQUIRE_THAT(puml, IsFile("t40001.cc")); - REQUIRE_THAT(puml, IsFile("t40001_include1.h")); + REQUIRE_THAT(puml, IsFolder("lib1")); + REQUIRE_THAT(puml, IsFile("lib1.h")); + REQUIRE_THAT(puml, IsFile("t40001.cc")); + REQUIRE_THAT(puml, IsFile("t40001_include1.h")); - REQUIRE_THAT(puml, IsFile("string")); - REQUIRE_THAT(puml, IsFile("yaml-cpp/yaml.h")); + REQUIRE_THAT(puml, IsFile("string")); + REQUIRE_THAT(puml, IsFile("yaml-cpp/yaml.h")); - REQUIRE_THAT(puml, IsAssociation(_A("t40001.cc"), _A("t40001_include1.h"))); - REQUIRE_THAT(puml, IsAssociation(_A("t40001_include1.h"), _A("lib1.h"))); + REQUIRE_THAT( + puml, IsAssociation(_A("t40001.cc"), _A("t40001_include1.h"))); + REQUIRE_THAT( + puml, IsAssociation(_A("t40001_include1.h"), _A("lib1.h"))); - REQUIRE_THAT(puml, IsDependency(_A("t40001_include1.h"), _A("string"))); + REQUIRE_THAT(puml, IsDependency(_A("t40001_include1.h"), _A("string"))); - REQUIRE_THAT(puml, HasComment("t40001 test diagram of type include")); + REQUIRE_THAT(puml, HasComment("t40001 test diagram of type include")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_include_json(diagram, *model); + + using namespace json; + + REQUIRE(IsFolder(j, "include")); + REQUIRE(IsFolder(j, "include/lib1")); + REQUIRE(IsFolder(j, "src")); + + REQUIRE(IsFile(j, "include/lib1/lib1.h")); + REQUIRE(IsFile(j, "include/t40001_include1.h")); + REQUIRE(IsFile(j, "src/t40001.cc")); + REQUIRE(IsFile(j, "yaml-cpp/yaml.h")); + + REQUIRE(IsFile(j, "string")); + + REQUIRE(IsAssociation(j, "src/t40001.cc", "include/t40001_include1.h")); + REQUIRE(IsAssociation( + j, "include/t40001_include1.h", "include/lib1/lib1.h")); + REQUIRE(IsDependency(j, "include/t40001_include1.h", "string")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t40002/test_case.h b/tests/t40002/test_case.h index 0f6451b4..67bb22b2 100644 --- a/tests/t40002/test_case.h +++ b/tests/t40002/test_case.h @@ -28,56 +28,87 @@ TEST_CASE("t40002", "[test-case][include]") REQUIRE(model->name() == "t40002_include"); - auto puml = generate_include_puml(diagram, *model); + { + auto puml = generate_include_puml(diagram, *model); - AliasMatcher _A(puml); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsFolder("lib1")); - REQUIRE_THAT(puml, IsFolder("lib2")); - REQUIRE_THAT(puml, IsFile("lib1.h")); - REQUIRE_THAT(puml, IsFile("lib2.h")); - REQUIRE_THAT(puml, !IsFile("lib2_detail.h")); - REQUIRE_THAT(puml, IsFile("t40002.cc")); - REQUIRE_THAT(puml, IsFile("lib1.cc")); - REQUIRE_THAT(puml, IsFile("lib2.cc")); + REQUIRE_THAT(puml, IsFolder("lib1")); + REQUIRE_THAT(puml, IsFolder("lib2")); + REQUIRE_THAT(puml, IsFile("lib1.h")); + REQUIRE_THAT(puml, IsFile("lib2.h")); + REQUIRE_THAT(puml, !IsFile("lib2_detail.h")); + REQUIRE_THAT(puml, IsFile("t40002.cc")); + REQUIRE_THAT(puml, IsFile("lib1.cc")); + REQUIRE_THAT(puml, IsFile("lib2.cc")); - REQUIRE_THAT(puml, !IsFile("string")); + REQUIRE_THAT(puml, !IsFile("string")); - REQUIRE_THAT(puml, IsAssociation(_A("t40002.cc"), _A("lib1.h"))); - REQUIRE_THAT(puml, IsAssociation(_A("lib1.h"), _A("lib2.h"))); - REQUIRE_THAT(puml, IsAssociation(_A("lib1.cc"), _A("lib1.h"))); - REQUIRE_THAT(puml, IsAssociation(_A("lib2.cc"), _A("lib2.h"))); + REQUIRE_THAT(puml, IsAssociation(_A("t40002.cc"), _A("lib1.h"))); + REQUIRE_THAT(puml, IsAssociation(_A("lib1.h"), _A("lib2.h"))); + REQUIRE_THAT(puml, IsAssociation(_A("lib1.cc"), _A("lib1.h"))); + REQUIRE_THAT(puml, IsAssociation(_A("lib2.cc"), _A("lib2.h"))); - REQUIRE_THAT(puml, - HasLink(_A("t40002.cc"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t40002/src/t40002.cc#L0", - clanguml::util::get_git_commit()), - "t40002.cc")); + REQUIRE_THAT(puml, + HasLink(_A("t40002.cc"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/src/t40002.cc#L0", + clanguml::util::get_git_commit()), + "t40002.cc")); - REQUIRE_THAT(puml, - HasLink(_A("lib1.cc"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t40002/src/lib1/lib1.cc#L0", - clanguml::util::get_git_commit()), - "lib1.cc")); + REQUIRE_THAT(puml, + HasLink(_A("lib1.cc"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/src/lib1/lib1.cc#L0", + clanguml::util::get_git_commit()), + "lib1.cc")); - REQUIRE_THAT(puml, - HasLink(_A("lib1.h"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t40002/include/lib1/lib1.h#L0", - clanguml::util::get_git_commit()), - "lib1.h")); + REQUIRE_THAT(puml, + HasLink(_A("lib1.h"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/include/lib1/lib1.h#L0", + clanguml::util::get_git_commit()), + "lib1.h")); - REQUIRE_THAT(puml, - HasLink(_A("lib2.h"), - fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" - "t40002/include/lib2/lib2.h#L0", - clanguml::util::get_git_commit()), - "lib2.h")); + REQUIRE_THAT(puml, + HasLink(_A("lib2.h"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/include/lib2/lib2.h#L0", + clanguml::util::get_git_commit()), + "lib2.h")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_include_json(diagram, *model); + + using namespace json; + + REQUIRE(IsFolder(j, "include")); + REQUIRE(IsFolder(j, "include/lib1")); + REQUIRE(IsFolder(j, "include/lib2")); + REQUIRE(IsFolder(j, "src")); + REQUIRE(IsFolder(j, "src/lib1")); + REQUIRE(IsFolder(j, "src/lib2")); + REQUIRE(IsFile(j, "include/lib1/lib1.h")); + REQUIRE(IsFile(j, "include/lib2/lib2.h")); + REQUIRE(!IsFile(j, "include/lib2/lib2_detail.h")); + REQUIRE(IsFile(j, "src/lib1/lib1.cc")); + REQUIRE(IsFile(j, "src/lib2/lib2.cc")); + REQUIRE(IsFile(j, "src/t40002.cc")); + + REQUIRE(!IsFile(j, "string")); + + REQUIRE(IsAssociation(j, "src/t40002.cc", "include/lib1/lib1.h")); + REQUIRE(IsAssociation(j, "include/lib1/lib1.h", "include/lib2/lib2.h")); + REQUIRE(IsAssociation(j, "src/lib1/lib1.cc", "include/lib1/lib1.h")); + REQUIRE(IsAssociation(j, "src/lib2/lib2.cc", "include/lib2/lib2.h")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/t40003/test_case.h b/tests/t40003/test_case.h index e45cbea9..966c7fdc 100644 --- a/tests/t40003/test_case.h +++ b/tests/t40003/test_case.h @@ -28,23 +28,51 @@ TEST_CASE("t40003", "[test-case][include]") REQUIRE(model->name() == "t40003_include"); - auto puml = generate_include_puml(diagram, *model); + { + auto puml = generate_include_puml(diagram, *model); - AliasMatcher _A(puml); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsFolder("dependants")); - REQUIRE_THAT(puml, IsFolder("dependencies")); + REQUIRE_THAT(puml, IsFolder("dependants")); + REQUIRE_THAT(puml, IsFolder("dependencies")); - REQUIRE_THAT(puml, IsFile("t1.h")); - REQUIRE_THAT(puml, IsFile("t2.h")); - REQUIRE_THAT(puml, IsFile("t3.h")); + REQUIRE_THAT(puml, IsFile("t1.h")); + REQUIRE_THAT(puml, IsFile("t2.h")); + REQUIRE_THAT(puml, IsFile("t3.h")); - REQUIRE_THAT(puml, !IsFile("t4.h")); - REQUIRE_THAT(puml, IsFile("t5.h")); - REQUIRE_THAT(puml, !IsFile("t6.h")); + REQUIRE_THAT(puml, !IsFile("t4.h")); + REQUIRE_THAT(puml, IsFile("t5.h")); + REQUIRE_THAT(puml, !IsFile("t6.h")); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml( + config.output_directory() + "/" + diagram->name + ".puml", puml); + } + + { + auto j = generate_include_json(diagram, *model); + + using namespace json; + + REQUIRE(IsFolder(j, "include/dependants")); + REQUIRE(IsFolder(j, "include/dependencies")); + REQUIRE(IsFolder(j, "src/dependants")); + REQUIRE(IsFolder(j, "src/dependencies")); + + REQUIRE(IsFile(j, "include/dependants/t1.h")); + REQUIRE(IsFile(j, "include/dependants/t2.h")); + REQUIRE(IsFile(j, "include/dependants/t3.h")); + REQUIRE(!IsFile(j, "include/dependants/t4.h")); + REQUIRE(IsFile(j, "src/dependants/t1.cc")); + + REQUIRE(IsFile(j, "include/dependencies/t1.h")); + REQUIRE(IsFile(j, "include/dependencies/t2.h")); + REQUIRE(IsFile(j, "include/dependencies/t3.h")); + REQUIRE(!IsFile(j, "include/dependencies/t4.h")); + REQUIRE(IsFile(j, "src/dependencies/t2.cc")); + + save_json(config.output_directory() + "/" + diagram->name + ".json", j); + } } diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 265a8608..38909c61 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -232,6 +232,22 @@ std::string generate_include_puml( return ss.str(); } +nlohmann::json generate_include_json( + std::shared_ptr config, + clanguml::include_diagram::model::diagram &model) +{ + using namespace clanguml::include_diagram::generators::json; + + std::stringstream ss; + + assert(config.get() != nullptr); + + ss << generator( + dynamic_cast(*config), model); + + return nlohmann::json::parse(ss.str()); +} + void save_puml(const std::string &path, const std::string &puml) { std::filesystem::path p{path}; diff --git a/tests/test_cases.h b/tests/test_cases.h index 3f60fc4b..944911b0 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -611,6 +611,15 @@ ContainsMatcher IsDeprecated(std::string const &str, } namespace json { +struct File { + explicit File(const std::string &f) + : file{f} + { + } + + const std::string file; +}; + std::optional get_element( const nlohmann::json &j, const std::string &name) { @@ -621,7 +630,7 @@ std::optional get_element( if (e["display_name"] == name) return {e}; - if (e["type"] == "namespace") { + if (e["type"] == "namespace" || e["type"] == "folder") { auto maybe_e = get_element(e, name); if (maybe_e) return maybe_e; @@ -714,6 +723,18 @@ bool IsPackage(const nlohmann::json &j, const std::string &name) return e && e->at("type") == "namespace"; } +bool IsFolder(const nlohmann::json &j, const std::string &name) +{ + auto e = get_element(j, name); + return e && e->at("type") == "folder"; +} + +bool IsFile(const nlohmann::json &j, const std::string &name) +{ + auto e = get_element(j, name); + return e && e->at("type") == "file"; +} + bool IsDeprecated(const nlohmann::json &j, const std::string &name) { auto e = get_element(j, expand_name(j, name)); @@ -810,13 +831,27 @@ bool IsAggregation(nlohmann::json j, const std::string &from, return true; } +namespace detail { +bool is_dependency_impl( + nlohmann::json j, const std::string &from, const std::string &to) +{ + auto rel = get_relationship(j, from, to, "dependency"); + + return rel != j["relationships"].end(); +} + +} // namespace detail + bool IsDependency( nlohmann::json j, const std::string &from, const std::string &to) { - auto rel = get_relationship( - j, expand_name(j, from), expand_name(j, to), "dependency"); + return detail::is_dependency_impl( + j, expand_name(j, from), expand_name(j, to)); +} - return rel != j["relationships"].end(); +bool IsDependency(nlohmann::json j, const File &from, const File &to) +{ + return detail::is_dependency_impl(j, from.file, to.file); } bool IsInstantiation( @@ -930,15 +965,6 @@ int find_message_impl(const nlohmann::json &j, const std::string &from, } // namespace detail -struct File { - explicit File(const std::string &f) - : file{f} - { - } - - const std::string file; -}; - int FindMessage(const nlohmann::json &j, const File &from, const File &to, const std::string &msg) { From 3a772a9102657843d3f7779e857c04af301fd742 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 18:18:31 +0100 Subject: [PATCH 22/30] Updated test cases documentation --- docs/test_cases/t00002.md | 439 +++++++++++++ docs/test_cases/t00002_class.svg | 36 +- docs/test_cases/t00003.md | 375 +++++++++++ docs/test_cases/t00003_class.svg | 46 +- docs/test_cases/t00004.md | 468 ++++++++++++++ docs/test_cases/t00004_class.svg | 76 +-- docs/test_cases/t00005.md | 480 ++++++++++++++ docs/test_cases/t00005_class.svg | 110 ++-- docs/test_cases/t00006.md | 668 ++++++++++++++++++++ docs/test_cases/t00006_class.svg | 132 ++-- docs/test_cases/t00007.md | 144 +++++ docs/test_cases/t00007_class.svg | 30 +- docs/test_cases/t00008.md | 422 +++++++++++++ docs/test_cases/t00008_class.svg | 68 +- docs/test_cases/t00009.md | 216 +++++++ docs/test_cases/t00009_class.svg | 32 +- docs/test_cases/t00010.md | 213 +++++++ docs/test_cases/t00010_class.svg | 34 +- docs/test_cases/t00011.md | 141 +++++ docs/test_cases/t00011_class.svg | 22 +- docs/test_cases/t00012.md | 507 +++++++++++++++ docs/test_cases/t00012_class.svg | 66 +- docs/test_cases/t00013.md | 709 +++++++++++++++++++++ docs/test_cases/t00013_class.svg | 82 +-- docs/test_cases/t00014.md | 941 ++++++++++++++++++++++++++++ docs/test_cases/t00014_class.svg | 116 ++-- docs/test_cases/t00015.md | 151 +++++ docs/test_cases/t00015_class.svg | 22 +- docs/test_cases/t00016.md | 210 +++++++ docs/test_cases/t00016_class.svg | 26 +- docs/test_cases/t00017.md | 538 ++++++++++++++++ docs/test_cases/t00017_class.svg | 66 +- docs/test_cases/t00018.md | 273 ++++++++ docs/test_cases/t00018_class.svg | 18 +- docs/test_cases/t00019.md | 479 ++++++++++++++ docs/test_cases/t00019_class.svg | 40 +- docs/test_cases/t00020.md | 513 +++++++++++++++ docs/test_cases/t00020_class.svg | 38 +- docs/test_cases/t00021.md | 501 +++++++++++++++ docs/test_cases/t00021_class.svg | 30 +- docs/test_cases/t00022.md | 185 ++++++ docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023.md | 269 ++++++++ docs/test_cases/t00023_class.svg | 26 +- docs/test_cases/t00024.md | 284 +++++++++ docs/test_cases/t00024_class.svg | 22 +- docs/test_cases/t00025.md | 307 +++++++++ docs/test_cases/t00025_class.svg | 34 +- docs/test_cases/t00026.md | 403 ++++++++++++ docs/test_cases/t00026_class.svg | 42 +- docs/test_cases/t00027.md | 587 +++++++++++++++++ docs/test_cases/t00027_class.svg | 58 +- docs/test_cases/t00028.md | 383 +++++++++++ docs/test_cases/t00028_class.svg | 82 +-- docs/test_cases/t00029.md | 236 +++++++ docs/test_cases/t00029_class.svg | 50 +- docs/test_cases/t00030.md | 244 ++++++++ docs/test_cases/t00030_class.svg | 46 +- docs/test_cases/t00031.md | 253 ++++++++ docs/test_cases/t00031_class.svg | 50 +- docs/test_cases/t00032.md | 378 +++++++++++ docs/test_cases/t00032_class.svg | 40 +- docs/test_cases/t00033.md | 335 ++++++++++ docs/test_cases/t00033_class.svg | 48 +- docs/test_cases/t00034.md | 255 ++++++++ docs/test_cases/t00034_class.svg | 38 +- docs/test_cases/t00035.md | 111 ++++ docs/test_cases/t00035_class.svg | 22 +- docs/test_cases/t00036.md | 188 ++++++ docs/test_cases/t00036_class.svg | 38 +- docs/test_cases/t00037.md | 220 +++++++ docs/test_cases/t00037_class.svg | 54 +- docs/test_cases/t00038.md | 477 ++++++++++++++ docs/test_cases/t00038_class.svg | 54 +- docs/test_cases/t00039.md | 571 +++++++++++++++++ docs/test_cases/t00039_class.svg | 78 +-- docs/test_cases/t00040.md | 222 +++++++ docs/test_cases/t00040_class.svg | 26 +- docs/test_cases/t00041.md | 331 ++++++++++ docs/test_cases/t00041_class.svg | 54 +- docs/test_cases/t00042.md | 230 +++++++ docs/test_cases/t00042_class.svg | 32 +- docs/test_cases/t00043.md | 484 ++++++++++++++ docs/test_cases/t00043_class.svg | 50 +- docs/test_cases/t00044.md | 157 +++++ docs/test_cases/t00044_class.svg | 18 +- docs/test_cases/t00045.md | 421 +++++++++++++ docs/test_cases/t00045_class.svg | 70 +-- docs/test_cases/t00046.md | 365 +++++++++++ docs/test_cases/t00046_class.svg | 64 +- docs/test_cases/t00047.md | 162 +++++ docs/test_cases/t00047_class.svg | 18 +- docs/test_cases/t00048.md | 349 +++++++++++ docs/test_cases/t00048_class.svg | 50 +- docs/test_cases/t00049.md | 258 ++++++++ docs/test_cases/t00049_class.svg | 32 +- docs/test_cases/t00050.md | 306 +++++++++ docs/test_cases/t00050_class.svg | 70 +-- docs/test_cases/t00051.md | 371 +++++++++++ docs/test_cases/t00051_class.svg | 30 +- docs/test_cases/t00052.md | 312 +++++++++ docs/test_cases/t00052_class.svg | 34 +- docs/test_cases/t00053.md | 336 ++++++++++ docs/test_cases/t00053_class.svg | 70 +-- docs/test_cases/t00054.md | 364 +++++++++++ docs/test_cases/t00054_class.svg | 78 +-- docs/test_cases/t00055.md | 211 +++++++ docs/test_cases/t00055_class.svg | 42 +- docs/test_cases/t00056.md | 535 ++++++++++++++++ docs/test_cases/t00056_class.svg | 94 +-- docs/test_cases/t00057.md | 446 +++++++++++++ docs/test_cases/t00057_class.svg | 114 ++-- docs/test_cases/t00058.md | 383 +++++++++++ docs/test_cases/t00058_class.svg | 48 +- docs/test_cases/t00059.md | 484 ++++++++++++++ docs/test_cases/t00059_class.svg | 50 +- docs/test_cases/t00060.md | 255 ++++++++ docs/test_cases/t00060_class.svg | 38 +- docs/test_cases/t20001.md | 179 ++++++ docs/test_cases/t20001_sequence.svg | 62 +- docs/test_cases/t20002.md | 122 ++++ docs/test_cases/t20002_sequence.svg | 48 +- docs/test_cases/t20003.md | 122 ++++ docs/test_cases/t20003_sequence.svg | 48 +- docs/test_cases/t20004.md | 308 +++++++++ docs/test_cases/t20004_sequence.svg | 120 ++-- docs/test_cases/t20005.md | 91 +++ docs/test_cases/t20005_sequence.svg | 36 +- docs/test_cases/t20006.md | 431 +++++++++++++ docs/test_cases/t20006_sequence.svg | 150 ++--- docs/test_cases/t20007.md | 122 ++++ docs/test_cases/t20007_sequence.svg | 48 +- docs/test_cases/t20008.md | 215 +++++++ docs/test_cases/t20008_sequence.svg | 84 +-- docs/test_cases/t20009.md | 215 +++++++ docs/test_cases/t20009_sequence.svg | 84 +-- docs/test_cases/t20010.md | 223 +++++++ docs/test_cases/t20010_sequence.svg | 72 +-- docs/test_cases/t20011.md | 216 +++++++ docs/test_cases/t20011_sequence.svg | 72 +-- docs/test_cases/t20012.md | 453 +++++++++++++ docs/test_cases/t20012_sequence.svg | 204 +++--- docs/test_cases/t20013.md | 179 ++++++ docs/test_cases/t20013_sequence.svg | 60 +- docs/test_cases/t20014.md | 188 ++++++ docs/test_cases/t20014_sequence.svg | 72 +-- docs/test_cases/t20015.md | 60 ++ docs/test_cases/t20015_sequence.svg | 24 +- docs/test_cases/t20016.md | 135 ++++ docs/test_cases/t20016_sequence.svg | 48 +- docs/test_cases/t20017.md | 157 +++++ docs/test_cases/t20017_sequence.svg | 48 +- docs/test_cases/t20018.md | 246 ++++++++ docs/test_cases/t20018_sequence.svg | 96 +-- docs/test_cases/t20019.md | 197 ++++++ docs/test_cases/t20019_sequence.svg | 84 +-- docs/test_cases/t20020.md | 399 ++++++++++++ docs/test_cases/t20020_sequence.svg | 118 ++-- docs/test_cases/t20021.md | 333 ++++++++++ docs/test_cases/t20021_sequence.svg | 106 ++-- docs/test_cases/t20022.md | 91 +++ docs/test_cases/t20022_sequence.svg | 36 +- docs/test_cases/t20023.md | 175 ++++++ docs/test_cases/t20023_sequence.svg | 50 +- docs/test_cases/t20024.md | 329 ++++++++++ docs/test_cases/t20024_sequence.svg | 88 +-- docs/test_cases/t20025.md | 113 ++++ docs/test_cases/t20025_sequence.svg | 42 +- docs/test_cases/t20026.md | 60 ++ docs/test_cases/t20026_sequence.svg | 24 +- docs/test_cases/t20027.md | 60 ++ docs/test_cases/t20027_sequence.svg | 24 +- docs/test_cases/t20028.md | 143 +++++ docs/test_cases/t20028_sequence.svg | 44 +- docs/test_cases/t20029.md | 235 +++++++ docs/test_cases/t20029_sequence.svg | 80 +-- docs/test_cases/t30001.md | 137 ++++ docs/test_cases/t30001_package.svg | 48 +- docs/test_cases/t30002.md | 364 +++++++++++ docs/test_cases/t30002_package.svg | 90 +-- docs/test_cases/t30003.md | 112 +++- docs/test_cases/t30003_package.svg | 26 +- docs/test_cases/t30004.md | 88 +++ docs/test_cases/t30004_package.svg | 30 +- docs/test_cases/t30005.md | 135 ++++ docs/test_cases/t30005_package.svg | 38 +- docs/test_cases/t30006.md | 61 ++ docs/test_cases/t30006_package.svg | 16 +- docs/test_cases/t30007.md | 74 +++ docs/test_cases/t30007_package.svg | 20 +- docs/test_cases/t30008.md | 152 +++++ docs/test_cases/t30008_package.svg | 34 +- docs/test_cases/t30009.md | 125 ++++ docs/test_cases/t30009_package.svg | 42 +- docs/test_cases/t40001.md | 113 ++++ docs/test_cases/t40001_include.svg | 30 +- docs/test_cases/t40002.md | 124 ++++ docs/test_cases/t40002_include.svg | 34 +- docs/test_cases/t40003.md | 176 ++++++ docs/test_cases/t40003_include.svg | 50 +- docs/test_cases/t90000.md | 1 + 201 files changed, 31256 insertions(+), 2757 deletions(-) diff --git a/docs/test_cases/t00002.md b/docs/test_cases/t00002.md index 9f8d5e49..7172d59a 100644 --- a/docs/test_cases/t00002.md +++ b/docs/test_cases/t00002.md @@ -116,3 +116,442 @@ private: ``` ## Generated UML diagrams ![t00002_class](./t00002_class.svg "Basic class inheritance") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "comment": { + "brief": [ + " This is class A\n" + ], + "formatted": "\\brief This is class A", + "paragraph": [ + " \n" + ], + "raw": "/// \\brief This is class A", + "text": "\n \n" + }, + "display_name": "clanguml::t00002::A", + "id": "987634239855407298", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "Abstract foo_a", + "paragraph": [ + " Abstract foo_a\n" + ], + "raw": "/// Abstract foo_a", + "text": "\n Abstract foo_a\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "comment": { + "formatted": "Abstract foo_c", + "paragraph": [ + " Abstract foo_c\n" + ], + "raw": "/// Abstract foo_c", + "text": "\n Abstract foo_c\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00002", + "source_location": { + "file": "../../tests/t00002/t00002.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "987634239855407298", + "is_virtual": false, + "name": "clanguml::t00002::A" + } + ], + "comment": { + "brief": [ + " This is class B\n" + ], + "formatted": "\\brief This is class B", + "paragraph": [ + " \n" + ], + "raw": "/// \\brief This is class B", + "text": "\n \n" + }, + "display_name": "clanguml::t00002::B", + "id": "594234458687375950", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00002", + "source_location": { + "file": "../../tests/t00002/t00002.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "987634239855407298", + "is_virtual": false, + "name": "clanguml::t00002::A" + } + ], + "comment": { + "brief": [ + " This is class C - class C has a long comment\n" + ], + "formatted": "@brief This is class C - class C has a long comment\n\nVivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\neuismod libero facilisi aptent elementum felis blandit cursus gravida sociis\nerat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\nad.", + "paragraph": [ + " \n", + " Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad.\n" + ], + "raw": "/// @brief This is class C - class C has a long comment\n///\n/// Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n/// euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n/// erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n/// ad.", + "text": "\n \n\n Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad.\n" + }, + "display_name": "clanguml::t00002::C", + "id": "1142499429598587507", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "Do nothing unless override is provided", + "paragraph": [ + " Do nothing unless override is provided\n" + ], + "raw": "/// Do nothing unless override is provided", + "text": "\n Do nothing unless override is provided\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "C", + "namespace": "clanguml::t00002", + "source_location": { + "file": "../../tests/t00002/t00002.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "594234458687375950", + "is_virtual": false, + "name": "clanguml::t00002::B" + }, + { + "access": "public", + "id": "1142499429598587507", + "is_virtual": false, + "name": "clanguml::t00002::C" + } + ], + "comment": { + "formatted": "This is class D\nwhich is a little like B\nand a little like C", + "paragraph": [ + " This is class D\n which is a little like B\n and a little like C\n" + ], + "raw": "/// This is class D\n/// which is a little like B\n/// and a little like C", + "text": "\n This is class D\n which is a little like B\n and a little like C\n" + }, + "display_name": "clanguml::t00002::D", + "id": "60950494980414724", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "comment": { + "formatted": "All the A pointers", + "paragraph": [ + " All the A pointers\n" + ], + "raw": "/// All the A pointers", + "text": "\n All the A pointers\n" + }, + "is_static": false, + "name": "as", + "source_location": { + "file": "../../tests/t00002/t00002.cc", + "line": 58 + }, + "type": "std::vector" + } + ], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_a\n ", + "paragraph": [ + " Forward foo_a\n" + ], + "raw": "/**\n * Forward foo_a\n */", + "text": "\n Forward foo_a\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_c\n ", + "paragraph": [ + " Forward foo_c\n" + ], + "raw": "/**\n * Forward foo_c\n */", + "text": "\n Forward foo_c\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "D", + "namespace": "clanguml::t00002", + "source_location": { + "file": "../../tests/t00002/t00002.cc", + "line": 36 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "594234458687375950", + "is_virtual": true, + "name": "clanguml::t00002::B" + }, + { + "access": "public", + "id": "1142499429598587507", + "is_virtual": true, + "name": "clanguml::t00002::C" + } + ], + "display_name": "clanguml::t00002::E", + "id": "2237886670308966220", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "comment": { + "formatted": "All the A pointers", + "paragraph": [ + " All the A pointers\n" + ], + "raw": "/// All the A pointers", + "text": "\n All the A pointers\n" + }, + "is_static": false, + "name": "as", + "source_location": { + "file": "../../tests/t00002/t00002.cc", + "line": 83 + }, + "type": "std::vector" + } + ], + "methods": [ + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_a", + "paragraph": [ + " Forward foo_a\n" + ], + "raw": "///\n /// Forward foo_a\n ///", + "text": "\n Forward foo_a\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_a", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "comment": { + "formatted": "\n Forward foo_c", + "paragraph": [ + " Forward foo_c\n" + ], + "raw": "///\n /// Forward foo_c\n ///", + "text": "\n Forward foo_c\n" + }, + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo_c", + "parameters": [], + "type": "void" + } + ], + "name": "E", + "namespace": "clanguml::t00002", + "source_location": { + "file": "../../tests/t00002/t00002.cc", + "line": 61 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00002_class", + "relationships": [ + { + "access": "public", + "destination": "987634239855407298", + "source": "594234458687375950", + "type": "extension" + }, + { + "access": "public", + "destination": "987634239855407298", + "source": "1142499429598587507", + "type": "extension" + }, + { + "access": "private", + "destination": "987634239855407298", + "label": "as", + "source": "60950494980414724", + "type": "association" + }, + { + "access": "public", + "destination": "594234458687375950", + "source": "60950494980414724", + "type": "extension" + }, + { + "access": "public", + "destination": "1142499429598587507", + "source": "60950494980414724", + "type": "extension" + }, + { + "access": "private", + "destination": "987634239855407298", + "label": "as", + "source": "2237886670308966220", + "type": "association" + }, + { + "access": "public", + "destination": "594234458687375950", + "source": "2237886670308966220", + "type": "extension" + }, + { + "access": "public", + "destination": "1142499429598587507", + "source": "2237886670308966220", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00002" +} +``` diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 9633ace5..515dd8b0 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ foo_c() = 0 : void - - + + B @@ -31,8 +31,8 @@ foo_a() : void - - + + C @@ -41,18 +41,18 @@ foo_c() : void - - + + D - + - + as : std::vector<A *> @@ -60,18 +60,18 @@ foo_a() : void foo_c() : void - - + + E - + - + as : std::vector<A *> @@ -79,13 +79,13 @@ foo_a() : void foo_c() : void - + This is class A - + This is class B - + This is class D diff --git a/docs/test_cases/t00003.md b/docs/test_cases/t00003.md index 0ef4a4d2..c7659a8b 100644 --- a/docs/test_cases/t00003.md +++ b/docs/test_cases/t00003.md @@ -79,3 +79,378 @@ int A::static_int = 1; ``` ## Generated UML diagrams ![t00003_class](./t00003_class.svg "Class field and methods") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00003::A", + "id": "1371951663534295727", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "public_member", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 34 + }, + "type": "int" + }, + { + "access": "protected", + "is_static": false, + "name": "protected_member", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 42 + }, + "type": "int" + }, + { + "access": "protected", + "is_static": false, + "name": "compare", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 44 + }, + "type": "std::function" + }, + { + "access": "private", + "is_static": false, + "name": "private_member", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 51 + }, + "type": "int" + }, + { + "access": "private", + "is_static": false, + "name": "a_", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 52 + }, + "type": "int" + }, + { + "access": "private", + "is_static": false, + "name": "b_", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 52 + }, + "type": "int" + }, + { + "access": "private", + "is_static": false, + "name": "c_", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 52 + }, + "type": "int" + }, + { + "access": "public", + "is_static": true, + "name": "static_int", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 35 + }, + "type": "int" + }, + { + "access": "public", + "is_static": true, + "name": "static_const_int", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 36 + }, + "type": "const int" + }, + { + "access": "public", + "is_static": true, + "name": "auto_member", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 37 + }, + "type": "const unsigned long" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "A", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "A", + "parameters": [ + { + "name": "i", + "type": "int" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "A", + "parameters": [ + { + "name": "", + "type": "clanguml::t00003::A &&" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "A", + "parameters": [ + { + "name": "", + "type": "const clanguml::t00003::A &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~A", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "basic_method", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": true, + "is_virtual": false, + "name": "static_method", + "parameters": [], + "type": "int" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "const_method", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "auto_method", + "parameters": [], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "double_int", + "parameters": [ + { + "name": "i", + "type": "const int" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "sum", + "parameters": [ + { + "name": "a", + "type": "const double" + }, + { + "name": "b", + "type": "const double" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "default_int", + "parameters": [ + { + "default_value": "12", + "name": "i", + "type": "int" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "default_string", + "parameters": [ + { + "name": "i", + "type": "int" + }, + { + "default_value": "\"abc\"", + "name": "s", + "type": "std::string" + } + ], + "type": "std::string" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": true, + "is_virtual": false, + "name": "create_from_int", + "parameters": [ + { + "name": "i", + "type": "int" + } + ], + "type": "clanguml::t00003::A" + }, + { + "access": "protected", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "protected_method", + "parameters": [], + "type": "void" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "private_method", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00003", + "source_location": { + "file": "../../tests/t00003/t00003.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00003_class", + "relationships": [], + "using_namespace": "clanguml::t00003" +} +``` diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index c8d275c1..af586036 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - + + A - + - + public_member : int - + - + protected_member : int - + - + private_member : int - + - + a_ : int - + - + b_ : int - + - + c_ : int - + - + static_int : int - + - + static_const_int : const int - + - + auto_member : const unsigned long @@ -112,11 +112,11 @@ protected_method() : void private_method() : void - + - + compare : std::function<bool (const int)> diff --git a/docs/test_cases/t00004.md b/docs/test_cases/t00004.md index a20b9847..384d70cc 100644 --- a/docs/test_cases/t00004.md +++ b/docs/test_cases/t00004.md @@ -76,3 +76,471 @@ public: ``` ## Generated UML diagrams ![t00004_class](./t00004_class.svg "Nested classes and enums") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00004::B", + "id": "1232624428734051711", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "constants": [ + "AA_1", + "AA_2", + "AA_3" + ], + "display_name": "clanguml::t00004::B::AA", + "id": "1630205507215126623", + "is_nested": true, + "name": "B::AA", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 6 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00004::A", + "id": "1552274940876611774", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo2", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00004::A::AA", + "id": "1742499843727859552", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A::AA", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "constants": [ + "Green", + "Yellow", + "Red" + ], + "display_name": "clanguml::t00004::A::AA::Lights", + "id": "590936874508841244", + "is_nested": true, + "name": "A::AA::Lights", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 15 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00004::A::AA::AAA", + "id": "1430186633004282131", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A::AA::AAA", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00004::C::B", + "id": "287819369330075965", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C::B", + "namespace": "clanguml::t00004", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00004::C", + "id": "2278328177727440136", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 25 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "b_int", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 37 + }, + "type": "B" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 23 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00004::C::AA", + "id": "623940132897927654", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C::AA", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00004::C::AA::AAA", + "id": "1597801087286500866", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C::AA::AAA", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + }, + { + "constants": [ + "CCC_1", + "CCC_2" + ], + "display_name": "clanguml::t00004::C::AA::CCC", + "id": "81819202639599734", + "is_nested": true, + "name": "C::AA::CCC", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 30 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00004::C::B", + "id": "1381298335849583950", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 34 + }, + "type": "V" + } + ], + "methods": [], + "name": "C::B", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 33 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "V", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "constants": [ + "CC_1", + "CC_2" + ], + "display_name": "clanguml::t00004::C::CC", + "id": "2037378936100378699", + "is_nested": true, + "name": "C::CC", + "namespace": "clanguml::t00004", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 39 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00004::detail::D", + "id": "612133170877135796", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00004::detail", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 43 + }, + "template_parameters": [], + "type": "class" + }, + { + "constants": [ + "AA_1", + "AA_2", + "AA_3" + ], + "display_name": "clanguml::t00004::detail::D::AA", + "id": "1572080057917630922", + "is_nested": true, + "name": "D::AA", + "namespace": "clanguml::t00004::detail", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 45 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00004::detail::D::DD", + "id": "600916232677555492", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D::DD", + "namespace": "clanguml::t00004::detail", + "source_location": { + "file": "../../tests/t00004/t00004.cc", + "line": 47 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00004_class", + "relationships": [ + { + "access": "public", + "destination": "1232624428734051711", + "source": "1630205507215126623", + "type": "containment" + }, + { + "access": "public", + "destination": "1552274940876611774", + "source": "1742499843727859552", + "type": "containment" + }, + { + "access": "public", + "destination": "1742499843727859552", + "source": "590936874508841244", + "type": "containment" + }, + { + "access": "public", + "destination": "1742499843727859552", + "source": "1430186633004282131", + "type": "containment" + }, + { + "access": "public", + "destination": "1381298335849583950", + "source": "287819369330075965", + "type": "instantiation" + }, + { + "access": "public", + "destination": "287819369330075965", + "label": "b_int", + "source": "2278328177727440136", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2278328177727440136", + "source": "623940132897927654", + "type": "containment" + }, + { + "access": "public", + "destination": "623940132897927654", + "source": "1597801087286500866", + "type": "containment" + }, + { + "access": "public", + "destination": "623940132897927654", + "source": "81819202639599734", + "type": "containment" + }, + { + "access": "public", + "destination": "2278328177727440136", + "source": "1381298335849583950", + "type": "containment" + }, + { + "access": "public", + "destination": "2278328177727440136", + "source": "2037378936100378699", + "type": "containment" + }, + { + "access": "public", + "destination": "612133170877135796", + "source": "1572080057917630922", + "type": "containment" + }, + { + "access": "public", + "destination": "612133170877135796", + "source": "600916232677555492", + "type": "containment" + } + ], + "using_namespace": "clanguml::t00004" +} +``` diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 5056564a..40b69332 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + B - - + + B::AA @@ -28,8 +28,8 @@ AA_3 - - + + A @@ -40,16 +40,16 @@ foo2() const : void - - + + A::AA - - + + A::AA::Lights @@ -59,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005.md b/docs/test_cases/t00005.md index 7e566ae1..c06bf9bc 100644 --- a/docs/test_cases/t00005.md +++ b/docs/test_cases/t00005.md @@ -66,3 +66,483 @@ public: ``` ## Generated UML diagrams ![t00005_class](./t00005_class.svg "Basic class field relationships") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00005::A", + "id": "96355893895780319", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 3 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::B", + "id": "1909425857334087541", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::C", + "id": "968176384460064907", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::D", + "id": "1735599590836186693", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::E", + "id": "887960136921844658", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::F", + "id": "772719357856231772", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::G", + "id": "979147885884736437", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::H", + "id": "1440673301054236675", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "H", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::I", + "id": "109681731550086430", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "I", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::J", + "id": "338330011969650325", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "J", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 21 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::K", + "id": "2179119389830432509", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "K", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00005::R", + "id": "630692407373144211", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "some_int", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 27 + }, + "type": "int" + }, + { + "access": "public", + "is_static": false, + "name": "some_int_pointer", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 28 + }, + "type": "int *" + }, + { + "access": "public", + "is_static": false, + "name": "some_int_pointer_pointer", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 29 + }, + "type": "int **" + }, + { + "access": "public", + "is_static": false, + "name": "some_int_reference", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 30 + }, + "type": "int &" + }, + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 31 + }, + "type": "clanguml::t00005::A" + }, + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 32 + }, + "type": "clanguml::t00005::B *" + }, + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 33 + }, + "type": "clanguml::t00005::C &" + }, + { + "access": "public", + "is_static": false, + "name": "d", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 34 + }, + "type": "const clanguml::t00005::D *" + }, + { + "access": "public", + "is_static": false, + "name": "e", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 35 + }, + "type": "const clanguml::t00005::E &" + }, + { + "access": "public", + "is_static": false, + "name": "f", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 36 + }, + "type": "clanguml::t00005::F &&" + }, + { + "access": "public", + "is_static": false, + "name": "g", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 37 + }, + "type": "clanguml::t00005::G **" + }, + { + "access": "public", + "is_static": false, + "name": "h", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 38 + }, + "type": "clanguml::t00005::H ***" + }, + { + "access": "public", + "is_static": false, + "name": "i", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 39 + }, + "type": "clanguml::t00005::I *&" + }, + { + "access": "public", + "is_static": false, + "name": "j", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 40 + }, + "type": "volatile clanguml::t00005::J *" + }, + { + "access": "public", + "is_static": false, + "name": "k", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 41 + }, + "type": "clanguml::t00005::K *" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00005", + "source_location": { + "file": "../../tests/t00005/t00005.cc", + "line": 25 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00005_class", + "relationships": [ + { + "access": "public", + "destination": "96355893895780319", + "label": "a", + "source": "630692407373144211", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1909425857334087541", + "label": "b", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "968176384460064907", + "label": "c", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "1735599590836186693", + "label": "d", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "887960136921844658", + "label": "e", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "772719357856231772", + "label": "f", + "source": "630692407373144211", + "type": "aggregation" + }, + { + "access": "public", + "destination": "979147885884736437", + "label": "g", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "1440673301054236675", + "label": "h", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "109681731550086430", + "label": "i", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "338330011969650325", + "label": "j", + "source": "630692407373144211", + "type": "association" + }, + { + "access": "public", + "destination": "2179119389830432509", + "label": "k", + "source": "630692407373144211", + "type": "association" + } + ], + "using_namespace": "clanguml::t00005" +} +``` diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 0fa870af..a682e90a 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,204 +9,204 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & - + - + a : A - + - + b : B * - + - + c : C & - + - + d : const D * - + - + e : const E & - + - + f : F && - + - + g : G ** - + - + h : H *** - + - + i : I *& - + - + j : volatile J * - + - + k : K * diff --git a/docs/test_cases/t00006.md b/docs/test_cases/t00006.md index 7711000b..6899b131 100644 --- a/docs/test_cases/t00006.md +++ b/docs/test_cases/t00006.md @@ -90,3 +90,671 @@ public: ``` ## Generated UML diagrams ![t00006_class](./t00006_class.svg "Class field relationships inferred from templates") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00006::A", + "id": "989095304444672400", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::B", + "id": "648285260245005311", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::C", + "id": "323304333007297774", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::D", + "id": "1006912399043633492", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::E", + "id": "1092550394020578978", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::F", + "id": "965398761810782236", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::G", + "id": "1764732000887030464", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::H", + "id": "1669285599837552146", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "H", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 21 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::I", + "id": "2234750598599000377", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "I", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::J", + "id": "1335933649375465369", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "J", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 25 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::K", + "id": "1603190364864080123", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "K", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::L", + "id": "305487238408320046", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "L", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 29 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::M", + "id": "1664744512423723275", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "M", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 31 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::N", + "id": "950210019792152600", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "N", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 33 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::NN", + "id": "1662349735899726224", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "NN", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 35 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::NNN", + "id": "1963145075481599858", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "NNN", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 37 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::custom_container", + "id": "916380191954937631", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "data", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 41 + }, + "type": "std::vector" + } + ], + "methods": [], + "name": "custom_container", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 39 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::custom_container", + "id": "50153113082434858", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "custom_container", + "namespace": "clanguml::t00006", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00006::E" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00006::R", + "id": "303025561016882526", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 46 + }, + "type": "std::vector" + }, + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 47 + }, + "type": "std::vector" + }, + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 49 + }, + "type": "std::map" + }, + { + "access": "public", + "is_static": false, + "name": "d", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 50 + }, + "type": "std::map" + }, + { + "access": "public", + "is_static": false, + "name": "e", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 52 + }, + "type": "custom_container" + }, + { + "access": "public", + "is_static": false, + "name": "f", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 54 + }, + "type": "std::vector>" + }, + { + "access": "public", + "is_static": false, + "name": "g", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 55 + }, + "type": "std::map>" + }, + { + "access": "public", + "is_static": false, + "name": "h", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 57 + }, + "type": "std::array" + }, + { + "access": "public", + "is_static": false, + "name": "i", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 58 + }, + "type": "std::array" + }, + { + "access": "public", + "is_static": false, + "name": "j", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 60 + }, + "type": "clanguml::t00006::J[10]" + }, + { + "access": "public", + "is_static": false, + "name": "k", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 61 + }, + "type": "clanguml::t00006::K *[20]" + }, + { + "access": "public", + "is_static": false, + "name": "lm", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 63 + }, + "type": "std::vector>" + }, + { + "access": "public", + "is_static": false, + "name": "ns", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 65 + }, + "type": "std::tuple" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00006", + "source_location": { + "file": "../../tests/t00006/t00006.cc", + "line": 44 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00006_class", + "relationships": [ + { + "access": "public", + "destination": "1092550394020578978", + "source": "50153113082434858", + "type": "dependency" + }, + { + "access": "public", + "destination": "916380191954937631", + "source": "50153113082434858", + "type": "instantiation" + }, + { + "access": "public", + "destination": "989095304444672400", + "label": "a", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "648285260245005311", + "label": "b", + "source": "303025561016882526", + "type": "association" + }, + { + "access": "public", + "destination": "323304333007297774", + "label": "c", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1006912399043633492", + "label": "d", + "source": "303025561016882526", + "type": "association" + }, + { + "access": "public", + "destination": "50153113082434858", + "label": "e", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "965398761810782236", + "label": "f", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1764732000887030464", + "label": "g", + "source": "303025561016882526", + "type": "association" + }, + { + "access": "public", + "destination": "1669285599837552146", + "label": "h", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2234750598599000377", + "label": "i", + "source": "303025561016882526", + "type": "association" + }, + { + "access": "public", + "destination": "1335933649375465369", + "label": "j", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1603190364864080123", + "label": "k", + "source": "303025561016882526", + "type": "association" + }, + { + "access": "public", + "destination": "305487238408320046", + "label": "lm", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1664744512423723275", + "label": "lm", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "950210019792152600", + "label": "ns", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1662349735899726224", + "label": "ns", + "source": "303025561016882526", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1963145075481599858", + "label": "ns", + "source": "303025561016882526", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00006" +} +``` diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 65171aaa..664ab90c 100644 --- a/docs/test_cases/t00006_class.svg +++ b/docs/test_cases/t00006_class.svg @@ -1,6 +1,6 @@ - + @@ -9,136 +9,136 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + L - - + + M - - + + N - - + + NN - - + + NNN - - + + custom_container @@ -146,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ E - - + + R - + - + a : std::vector<A> - + - + b : std::vector<B *> - + - + c : std::map<int,C> - + - + d : std::map<int,D *> - + - + e : custom_container<E> - + - + f : std::vector<std::vector<F>> - + - + g : std::map<int,std::vector<G *>> - + - + h : std::array<H,10> - + - + i : std::array<I *,5> - + - + j : J[10] - + - + k : K *[20] - + - + lm : std::vector<std::pair<L,M>> - + - + ns : std::tuple<N,NN,NNN> diff --git a/docs/test_cases/t00007.md b/docs/test_cases/t00007.md index 2864b1c6..5bbb83a5 100644 --- a/docs/test_cases/t00007.md +++ b/docs/test_cases/t00007.md @@ -40,3 +40,147 @@ public: ``` ## Generated UML diagrams ![t00007_class](./t00007_class.svg "Smart pointers") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00007::A", + "id": "98876622534017019", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00007", + "source_location": { + "file": "../../tests/t00007/t00007.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00007::B", + "id": "696381312773707784", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00007", + "source_location": { + "file": "../../tests/t00007/t00007.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00007::C", + "id": "972031178679364068", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00007", + "source_location": { + "file": "../../tests/t00007/t00007.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00007::R", + "id": "66905874721300157", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00007/t00007.cc", + "line": 13 + }, + "type": "std::unique_ptr" + }, + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00007/t00007.cc", + "line": 14 + }, + "type": "std::shared_ptr" + }, + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00007/t00007.cc", + "line": 15 + }, + "type": "std::weak_ptr" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00007", + "source_location": { + "file": "../../tests/t00007/t00007.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00007_class", + "relationships": [ + { + "access": "public", + "destination": "98876622534017019", + "label": "a", + "source": "66905874721300157", + "type": "aggregation" + }, + { + "access": "public", + "destination": "696381312773707784", + "label": "b", + "source": "66905874721300157", + "type": "association" + }, + { + "access": "public", + "destination": "972031178679364068", + "label": "c", + "source": "66905874721300157", + "type": "association" + } + ], + "using_namespace": "clanguml::t00007" +} +``` diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index 19d91b9b..bc7b3aca 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> diff --git a/docs/test_cases/t00008.md b/docs/test_cases/t00008.md index 078627e1..27f8892f 100644 --- a/docs/test_cases/t00008.md +++ b/docs/test_cases/t00008.md @@ -73,3 +73,425 @@ template <> struct E::nested_template { ``` ## Generated UML diagrams ![t00008_class](./t00008_class.svg "Template and template template relationships") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00008::A", + "id": "1657660300852090121", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "value", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 11 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "pointer", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 12 + }, + "type": "T *" + }, + { + "access": "public", + "is_static": false, + "name": "reference", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 13 + }, + "type": "T &" + }, + { + "access": "public", + "is_static": false, + "name": "values", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 14 + }, + "type": "std::vector

" + }, + { + "access": "public", + "is_static": false, + "name": "ints", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 15 + }, + "type": "std::array" + }, + { + "access": "public", + "is_static": false, + "name": "comparator", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 17 + }, + "type": "clanguml::t00008::CMP" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 9 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "default": "T", + "is_variadic": false, + "kind": "template_type", + "name": "P", + "template_parameters": [] + }, + { + "default": "nullptr", + "is_variadic": false, + "kind": "non_type_template", + "template_parameters": [], + "type": "clanguml::t00008::CMP" + }, + { + "default": "3", + "is_variadic": false, + "kind": "non_type_template", + "name": "N", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00008::Vector", + "id": "1677407014842680311", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "values", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 21 + }, + "type": "std::vector" + } + ], + "methods": [], + "name": "Vector", + "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 20 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00008::B>", + "id": "1968575752686868237", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "template_template", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 25 + }, + "type": "C" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 24 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_template_type", + "name": "C<>", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00008::B", + "id": "1449136415707203971", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00008", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "clanguml::t00008::Vector", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00008::D", + "id": "1562396858816419857", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "ints", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 29 + }, + "type": "B" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "add", + "parameters": [ + { + "name": "i", + "type": "int" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "D", + "parameters": [ + { + "name": "", + "type": "std::tuple *" + } + ], + "type": "void" + } + ], + "name": "D", + "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00008::E", + "id": "1787658457052431115", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 36 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00008::E::nested_template", + "id": "1549419203490064906", + "is_abstract": false, + "is_nested": true, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": true, + "is_virtual": false, + "name": "get", + "parameters": [ + { + "name": "d", + "type": "ET *" + } + ], + "type": "clanguml::t00008::E::nested_template::DT *" + } + ], + "name": "E::nested_template", + "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 37 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "ET", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00008::E::nested_template", + "id": "33637089897037832", + "is_abstract": false, + "is_nested": true, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E::nested_template", + "namespace": "clanguml::t00008", + "source_location": { + "file": "../../tests/t00008/t00008.cc", + "line": 44 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "char" + } + ], + "type": "class" + } + ], + "name": "t00008_class", + "relationships": [ + { + "access": "public", + "destination": "1968575752686868237", + "source": "1449136415707203971", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1449136415707203971", + "label": "ints", + "source": "1562396858816419857", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1787658457052431115", + "source": "1549419203490064906", + "type": "containment" + }, + { + "access": "public", + "destination": "1787658457052431115", + "source": "33637089897037832", + "type": "containment" + }, + { + "access": "public", + "destination": "1549419203490064906", + "source": "33637089897037832", + "type": "instantiation" + } + ], + "using_namespace": "clanguml::t00008" +} +``` diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index 3056b44d..a185794a 100644 --- a/docs/test_cases/t00008_class.svg +++ b/docs/test_cases/t00008_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,51 +18,51 @@ T,P=T,CMP=nullptr,int N=3 - + - + value : T - + - + pointer : T * - + - + reference : T & - + - + values : std::vector<P> - + - + ints : std::array<int,N> - + - + comparator : CMP - - + + Vector @@ -70,16 +70,16 @@ T - + - + values : std::vector<T> - - + + B @@ -87,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> @@ -122,16 +122,16 @@ add(int i) : void D<Items...>(std::tuple<Items...> * ) : void - - + + E - - + + E::nested_template @@ -142,8 +142,8 @@ get(ET * d) : E::nested_template::DT * - - + + E::nested_template diff --git a/docs/test_cases/t00009.md b/docs/test_cases/t00009.md index 6b372686..559635b3 100644 --- a/docs/test_cases/t00009.md +++ b/docs/test_cases/t00009.md @@ -41,3 +41,219 @@ public: ``` ## Generated UML diagrams ![t00009_class](./t00009_class.svg "Template instantiation") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00009::A", + "id": "412228989111660105", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "value", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 9 + }, + "type": "T" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00009", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 7 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00009::A", + "id": "1894387438043499", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00009", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00009::A", + "id": "1340793233843139195", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00009", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00009::A>", + "id": "1370808797762248850", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00009", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "std::vector" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00009::B", + "id": "176239714450247310", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "aint", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 14 + }, + "type": "A" + }, + { + "access": "public", + "is_static": false, + "name": "astring", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 15 + }, + "type": "A *" + }, + { + "access": "public", + "is_static": false, + "name": "avector", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 16 + }, + "type": "A> &" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00009", + "source_location": { + "file": "../../tests/t00009/t00009.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00009_class", + "relationships": [ + { + "access": "public", + "destination": "412228989111660105", + "source": "1894387438043499", + "type": "instantiation" + }, + { + "access": "public", + "destination": "412228989111660105", + "source": "1340793233843139195", + "type": "instantiation" + }, + { + "access": "public", + "destination": "412228989111660105", + "source": "1370808797762248850", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1894387438043499", + "label": "aint", + "source": "176239714450247310", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1340793233843139195", + "label": "astring", + "source": "176239714450247310", + "type": "association" + }, + { + "access": "public", + "destination": "1370808797762248850", + "label": "avector", + "source": "176239714450247310", + "type": "association" + } + ], + "using_namespace": "clanguml::t00009" +} +``` diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 21629ef9..58f0d7a1 100644 --- a/docs/test_cases/t00009_class.svg +++ b/docs/test_cases/t00009_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ std::vector<std::string> - - + + B - + - + aint : A<int> - + - + astring : A<std::string> * - + - + avector : A<std::vector<std::string>> & diff --git a/docs/test_cases/t00010.md b/docs/test_cases/t00010.md index 1f8d9377..259e2445 100644 --- a/docs/test_cases/t00010.md +++ b/docs/test_cases/t00010.md @@ -45,3 +45,216 @@ public: ``` ## Generated UML diagrams ![t00010_class](./t00010_class.svg "Basic template instantiation") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00010::A", + "id": "2222216618904514099", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "first", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 9 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "second", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 10 + }, + "type": "P" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00010", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 7 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "P", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00010::A", + "id": "1861520693741915300", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00010", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "T" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00010::B", + "id": "2303611426082708583", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "astring", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 15 + }, + "type": "A" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00010", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 13 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00010::B", + "id": "1498376939480949099", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00010", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00010::C", + "id": "1880966578968892571", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "aintstring", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 20 + }, + "type": "B" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00010", + "source_location": { + "file": "../../tests/t00010/t00010.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00010_class", + "relationships": [ + { + "access": "public", + "destination": "2222216618904514099", + "source": "1861520693741915300", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1861520693741915300", + "label": "astring", + "source": "2303611426082708583", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2303611426082708583", + "source": "1498376939480949099", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1498376939480949099", + "label": "aintstring", + "source": "1880966578968892571", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00010" +} +``` diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index df030bc2..47e73499 100644 --- a/docs/test_cases/t00010_class.svg +++ b/docs/test_cases/t00010_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011.md b/docs/test_cases/t00011.md index 0c792259..d2da0251 100644 --- a/docs/test_cases/t00011.md +++ b/docs/test_cases/t00011.md @@ -54,3 +54,144 @@ public: ``` ## Generated UML diagrams ![t00011_class](./t00011_class.svg "Friend relationships") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00011::D", + "id": "1150639902748052276", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "value", + "source_location": { + "file": "../../tests/t00011/t00011.cc", + "line": 11 + }, + "type": "T" + } + ], + "methods": [], + "name": "D", + "namespace": "clanguml::t00011", + "source_location": { + "file": "../../tests/t00011/t00011.cc", + "line": 10 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00011::A", + "id": "1420516952857803719", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00011", + "source_location": { + "file": "../../tests/t00011/t00011.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00011::B", + "id": "1687427603952049829", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "m_a", + "source_location": { + "file": "../../tests/t00011/t00011.cc", + "line": 29 + }, + "type": "clanguml::t00011::A *" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00011", + "source_location": { + "file": "../../tests/t00011/t00011.cc", + "line": 26 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00011_class", + "relationships": [ + { + "access": "public", + "destination": "1687427603952049829", + "label": "<>", + "source": "1420516952857803719", + "type": "friendship" + }, + { + "access": "public", + "destination": "1420516952857803719", + "label": "m_a", + "source": "1687427603952049829", + "type": "association" + } + ], + "using_namespace": "clanguml::t00011" +} +``` diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 69e902f1..d059675c 100644 --- a/docs/test_cases/t00011_class.svg +++ b/docs/test_cases/t00011_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + D @@ -18,16 +18,16 @@ T - + - + value : T - - + + A @@ -36,18 +36,18 @@ foo() : void - - + + B - + - + m_a : A * diff --git a/docs/test_cases/t00012.md b/docs/test_cases/t00012.md index 36ba1629..ec28a58c 100644 --- a/docs/test_cases/t00012.md +++ b/docs/test_cases/t00012.md @@ -61,3 +61,510 @@ class R { ``` ## Generated UML diagrams ![t00012_class](./t00012_class.svg "Advanced template instantiations") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00012::A", + "id": "1773299890023132282", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "value", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 12 + }, + "type": "T" + }, + { + "access": "private", + "is_static": false, + "name": "values", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 13 + }, + "type": "std::variant" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 11 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Ts...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::B", + "id": "2061171077567279746", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "ints", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 17 + }, + "type": "std::array" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 16 + }, + "template_parameters": [ + { + "is_variadic": true, + "kind": "non_type_template", + "name": "Is", + "template_parameters": [], + "type": "int..." + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::C", + "id": "627809578407650629", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "ints", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 21 + }, + "type": "std::array" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 20 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "non_type_template", + "name": "Is", + "template_parameters": [], + "type": "int..." + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::A", + "id": "286972398942005457", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00012", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "float" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::A", + "id": "299466181098300963", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00012", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "bool" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::B<3,2,1>", + "id": "489063277971613593", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00012", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "3" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "2" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "1" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::B<1,1,1,1>", + "id": "14232362483200599", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00012", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "1" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "1" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "1" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "1" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::C>>>,3,3,3>", + "id": "1478239414632239754", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00012", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "std::vector" + } + ], + "type": "std::vector" + } + ], + "type": "std::vector" + } + ], + "type": "std::map" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "3" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "3" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "3" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00012::R", + "id": "559263385732885469", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "a1", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 25 + }, + "type": "A" + }, + { + "access": "private", + "is_static": false, + "name": "a2", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 26 + }, + "type": "A" + }, + { + "access": "private", + "is_static": false, + "name": "b1", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 28 + }, + "type": "B<3,2,1>" + }, + { + "access": "private", + "is_static": false, + "name": "b2", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 29 + }, + "type": "B<1,1,1,1>" + }, + { + "access": "private", + "is_static": false, + "name": "c1", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 33 + }, + "type": "C>>>,3,3,3>" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00012", + "source_location": { + "file": "../../tests/t00012/t00012.cc", + "line": 24 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00012_class", + "relationships": [ + { + "access": "public", + "destination": "1773299890023132282", + "source": "286972398942005457", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1773299890023132282", + "source": "299466181098300963", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2061171077567279746", + "source": "489063277971613593", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2061171077567279746", + "source": "14232362483200599", + "type": "instantiation" + }, + { + "access": "public", + "destination": "627809578407650629", + "source": "1478239414632239754", + "type": "instantiation" + }, + { + "access": "private", + "destination": "286972398942005457", + "label": "a1", + "source": "559263385732885469", + "type": "aggregation" + }, + { + "access": "private", + "destination": "299466181098300963", + "label": "a2", + "source": "559263385732885469", + "type": "aggregation" + }, + { + "access": "private", + "destination": "489063277971613593", + "label": "b1", + "source": "559263385732885469", + "type": "aggregation" + }, + { + "access": "private", + "destination": "14232362483200599", + "label": "b2", + "source": "559263385732885469", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1478239414632239754", + "label": "c1", + "source": "559263385732885469", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00012" +} +``` diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index 415f4e3c..64719ffb 100644 --- a/docs/test_cases/t00012_class.svg +++ b/docs/test_cases/t00012_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,23 +18,23 @@ T,Ts... - + - + value : T - + - + values : std::variant<Ts...> - - + + B @@ -43,15 +43,15 @@ - + - + ints : std::array<int,sizeof...(Is)> - - + + C @@ -60,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3 - - + + R - + - + a1 : A<int,std::string,float> - + - + a2 : A<int,std::string,bool> - + - + b1 : B<3,2,1> - + - + b2 : B<1,1,1,1> - + - + c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> - + Long template annotation diff --git a/docs/test_cases/t00013.md b/docs/test_cases/t00013.md index 9e7cf9fb..a60e8de4 100644 --- a/docs/test_cases/t00013.md +++ b/docs/test_cases/t00013.md @@ -89,3 +89,712 @@ private: ``` ## Generated UML diagrams ![t00013_class](./t00013_class.svg "Template instantiation relationships") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "ABCD::F", + "id": "952770730316239752", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "f", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 8 + }, + "type": "T" + } + ], + "methods": [], + "name": "F", + "namespace": "ABCD", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 7 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "ABCD::F", + "id": "2304215469403389354", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "ABCD", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::A", + "id": "519995486237427479", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 15 + }, + "type": "int" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::B", + "id": "1177487653597650440", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 19 + }, + "type": "int" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::C", + "id": "1028245818073128358", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 23 + }, + "type": "int" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::D", + "id": "409373870621931875", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "d", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 29 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "print", + "parameters": [ + { + "name": "r", + "type": "clanguml::t00013::R *" + } + ], + "type": "void" + } + ], + "name": "D", + "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::E", + "id": "864055993755439230", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "e", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 34 + }, + "type": "T" + } + ], + "methods": [], + "name": "E", + "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 33 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::G", + "id": "205927019127027617", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "g", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 38 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "args", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 39 + }, + "type": "std::tuple" + } + ], + "methods": [], + "name": "G", + "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 37 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Args...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::E", + "id": "1977486318799565722", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00013", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::G", + "id": "1526733274613822014", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00013", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "float" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::E", + "id": "531523220915557686", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00013", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00013::R", + "id": "2198686676355573844", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "gintstring", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 60 + }, + "type": "G" + }, + { + "access": "private", + "is_static": false, + "name": "estring", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 63 + }, + "type": "E" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_a", + "parameters": [ + { + "name": "a", + "type": "clanguml::t00013::A *" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_b", + "parameters": [ + { + "name": "b", + "type": "clanguml::t00013::B &" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_const_b", + "parameters": [ + { + "name": "b", + "type": "const clanguml::t00013::B &" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_c", + "parameters": [ + { + "name": "c", + "type": "clanguml::t00013::C" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_d", + "parameters": [ + { + "name": "d", + "type": "clanguml::t00013::D &&" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_d2", + "parameters": [ + { + "name": "d", + "type": "clanguml::t00013::D &&" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_int_e", + "parameters": [ + { + "name": "e", + "type": "const clanguml::t00013::E &" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_int_e2", + "parameters": [ + { + "name": "e", + "type": "clanguml::t00013::E &" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_int_f", + "parameters": [ + { + "name": "f", + "type": "const ABCD::F &" + } + ], + "type": "int" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_e", + "parameters": [ + { + "name": "e", + "type": "E" + } + ], + "type": "T" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_f", + "parameters": [ + { + "name": "f", + "type": "const F &" + } + ], + "type": "T" + } + ], + "name": "R", + "namespace": "clanguml::t00013", + "source_location": { + "file": "../../tests/t00013/t00013.cc", + "line": 43 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00013_class", + "relationships": [ + { + "access": "public", + "destination": "952770730316239752", + "source": "2304215469403389354", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2198686676355573844", + "source": "409373870621931875", + "type": "dependency" + }, + { + "access": "public", + "destination": "864055993755439230", + "source": "1977486318799565722", + "type": "instantiation" + }, + { + "access": "public", + "destination": "205927019127027617", + "source": "1526733274613822014", + "type": "instantiation" + }, + { + "access": "public", + "destination": "864055993755439230", + "source": "531523220915557686", + "type": "instantiation" + }, + { + "access": "public", + "destination": "519995486237427479", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "1177487653597650440", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "1028245818073128358", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "409373870621931875", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "1977486318799565722", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "2304215469403389354", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "864055993755439230", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "952770730316239752", + "source": "2198686676355573844", + "type": "dependency" + }, + { + "access": "public", + "destination": "1526733274613822014", + "label": "gintstring", + "source": "2198686676355573844", + "type": "aggregation" + }, + { + "access": "private", + "destination": "531523220915557686", + "label": "estring", + "source": "2198686676355573844", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00013" +} +``` diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index 10405d04..b9c163dd 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ABCD::F @@ -18,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014.md b/docs/test_cases/t00014.md index 7280649a..d9b1201d 100644 --- a/docs/test_cases/t00014.md +++ b/docs/test_cases/t00014.md @@ -104,3 +104,944 @@ public: ``` ## Generated UML diagrams ![t00014_class](./t00014_class.svg "Alias template instantiation") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "765890579167335652", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 22 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "p", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 23 + }, + "type": "P" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 21 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "P", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::B", + "id": "934136012292043506", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "value", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 27 + }, + "type": "std::string" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 26 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "2186387853087008570", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "T" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A>", + "id": "947292733740993297", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "T" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "std::unique_ptr" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "1700006390494465667", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "long" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "T" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "2017665567517853203", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "double" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "T" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "906557320263235873", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "long" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "U" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "378898020828430636", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "long" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "bool" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "2082013375525130414", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "double" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "bool" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "51978493292659230", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "long" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "float" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "197769253782961588", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "double" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "float" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "895940711566401184", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "bool" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A>", + "id": "1751732625010742161", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "float" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "std::unique_ptr" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "887121441210847583", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "1119452495635561975", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "640294848489463071", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "char" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::A", + "id": "139599686499155694", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00014", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "wchar_t" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00014::R", + "id": "1192822659863756768", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "bapair", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 58 + }, + "type": "PairPairBA" + }, + { + "access": "private", + "is_static": false, + "name": "abool", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 60 + }, + "type": "APtr" + }, + { + "access": "private", + "is_static": false, + "name": "aboolfloat", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 61 + }, + "type": "AAPtr" + }, + { + "access": "private", + "is_static": false, + "name": "afloat", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 62 + }, + "type": "ASharedPtr" + }, + { + "access": "private", + "is_static": false, + "name": "boolstring", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 63 + }, + "type": "A" + }, + { + "access": "private", + "is_static": false, + "name": "floatstring", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 64 + }, + "type": "AStringPtr" + }, + { + "access": "private", + "is_static": false, + "name": "intstring", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 65 + }, + "type": "clanguml::t00014::AIntString" + }, + { + "access": "private", + "is_static": false, + "name": "stringstring", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 66 + }, + "type": "clanguml::t00014::AStringString" + }, + { + "access": "private", + "is_static": false, + "name": "bstringstring", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 67 + }, + "type": "clanguml::t00014::BStringString" + }, + { + "access": "protected", + "is_static": false, + "name": "bs", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 70 + }, + "type": "clanguml::t00014::BVector" + }, + { + "access": "public", + "is_static": false, + "name": "bs2", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 73 + }, + "type": "clanguml::t00014::BVector2" + }, + { + "access": "public", + "is_static": false, + "name": "cb", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 74 + }, + "type": "SimpleCallback" + }, + { + "access": "public", + "is_static": false, + "name": "gcb", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 75 + }, + "type": "GenericCallback" + }, + { + "access": "public", + "is_static": false, + "name": "vcb", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 76 + }, + "type": "clanguml::t00014::VoidCallback" + }, + { + "access": "public", + "is_static": false, + "name": "vps", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 77 + }, + "type": "VectorPtr" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00014", + "source_location": { + "file": "../../tests/t00014/t00014.cc", + "line": 55 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00014_class", + "relationships": [ + { + "access": "public", + "destination": "765890579167335652", + "source": "2186387853087008570", + "type": "instantiation" + }, + { + "access": "public", + "destination": "765890579167335652", + "source": "947292733740993297", + "type": "instantiation" + }, + { + "access": "public", + "destination": "765890579167335652", + "source": "1700006390494465667", + "type": "instantiation" + }, + { + "access": "public", + "destination": "765890579167335652", + "source": "2017665567517853203", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1700006390494465667", + "source": "906557320263235873", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1700006390494465667", + "source": "378898020828430636", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2017665567517853203", + "source": "2082013375525130414", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1700006390494465667", + "source": "51978493292659230", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2017665567517853203", + "source": "197769253782961588", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "895940711566401184", + "type": "instantiation" + }, + { + "access": "public", + "destination": "947292733740993297", + "source": "1751732625010742161", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "887121441210847583", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "1119452495635561975", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "640294848489463071", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2186387853087008570", + "source": "139599686499155694", + "type": "instantiation" + }, + { + "access": "public", + "destination": "378898020828430636", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "934136012292043506", + "label": "bapair", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "378898020828430636", + "label": "bapair", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2082013375525130414", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "2082013375525130414", + "label": "abool", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "51978493292659230", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "2082013375525130414", + "label": "aboolfloat", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "51978493292659230", + "label": "aboolfloat", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "197769253782961588", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "private", + "destination": "197769253782961588", + "label": "afloat", + "source": "1192822659863756768", + "type": "association" + }, + { + "access": "private", + "destination": "895940711566401184", + "label": "boolstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1751732625010742161", + "label": "floatstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "887121441210847583", + "label": "intstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1119452495635561975", + "label": "stringstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1119452495635561975", + "label": "bstringstring", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "protected", + "destination": "934136012292043506", + "label": "bs", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "934136012292043506", + "label": "bs2", + "source": "1192822659863756768", + "type": "aggregation" + }, + { + "access": "public", + "destination": "640294848489463071", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "public", + "destination": "139599686499155694", + "source": "1192822659863756768", + "type": "dependency" + }, + { + "access": "public", + "destination": "934136012292043506", + "label": "vps", + "source": "1192822659863756768", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00014" +} +``` diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 0e8c833e..1d599019 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + intstring : AIntString - + - + stringstring : AStringString - + - + bstringstring : BStringString - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015.md b/docs/test_cases/t00015.md index 96fafa5b..e889e22b 100644 --- a/docs/test_cases/t00015.md +++ b/docs/test_cases/t00015.md @@ -49,3 +49,154 @@ class B : public ns1::ns2::Anon { }; ``` ## Generated UML diagrams ![t00015_class](./t00015_class.svg "Namespace fun") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00015::ns1::A", + "id": "1410694888805149453", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00015::ns1", + "source_location": { + "file": "../../tests/t00015/t00015.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00015::ns1::ns2_v0_9_0::A", + "id": "485552648049088863", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00015::ns1::ns2_v0_9_0", + "source_location": { + "file": "../../tests/t00015/t00015.cc", + "line": 10 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1410694888805149453", + "is_virtual": false, + "name": "clanguml::t00015::ns1::A" + } + ], + "display_name": "clanguml::t00015::ns1::Anon", + "id": "1060731132374575329", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Anon", + "namespace": "clanguml::t00015::ns1", + "source_location": { + "file": "../../tests/t00015/t00015.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1410694888805149453", + "is_virtual": false, + "name": "t00015::ns1::A" + } + ], + "display_name": "clanguml::t00015::ns3::ns1::ns2::Anon", + "id": "1797521288354158629", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Anon", + "namespace": "clanguml::t00015::ns3::ns1::ns2", + "source_location": { + "file": "../../tests/t00015/t00015.cc", + "line": 21 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1797521288354158629", + "is_virtual": false, + "name": "ns1::ns2::Anon" + } + ], + "display_name": "clanguml::t00015::ns3::B", + "id": "870882387819356092", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00015::ns3", + "source_location": { + "file": "../../tests/t00015/t00015.cc", + "line": 24 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00015_class", + "relationships": [ + { + "access": "public", + "destination": "1410694888805149453", + "source": "1060731132374575329", + "type": "extension" + }, + { + "access": "public", + "destination": "1410694888805149453", + "source": "1797521288354158629", + "type": "extension" + }, + { + "access": "public", + "destination": "1797521288354158629", + "source": "870882387819356092", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00015" +} +``` diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index aceec1bf..b62eecb8 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + ns1::A - - + + ns1::ns2_v0_9_0::A - - + + ns1::Anon - - + + ns3::ns1::ns2::Anon - - + + ns3::B diff --git a/docs/test_cases/t00016.md b/docs/test_cases/t00016.md index 74dfed28..39c12c24 100644 --- a/docs/test_cases/t00016.md +++ b/docs/test_cases/t00016.md @@ -50,3 +50,213 @@ template <> struct is_numeric { ``` ## Generated UML diagrams ![t00016_class](./t00016_class.svg "Unnamed enums and empty templates") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00016::is_numeric<>", + "id": "214045147845616983", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "value", + "type": "enum" + } + ], + "methods": [], + "name": "is_numeric", + "namespace": "clanguml::t00016", + "source_location": { + "file": "../../tests/t00016/t00016.cc", + "line": 4 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00016::is_numeric", + "id": "95618295648274199", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "is_numeric", + "namespace": "clanguml::t00016", + "source_location": { + "file": "../../tests/t00016/t00016.cc", + "line": 8 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "float" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00016::is_numeric", + "id": "979129381790761728", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "is_numeric", + "namespace": "clanguml::t00016", + "source_location": { + "file": "../../tests/t00016/t00016.cc", + "line": 12 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "char" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00016::is_numeric", + "id": "2090787690027341836", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "is_numeric", + "namespace": "clanguml::t00016", + "source_location": { + "file": "../../tests/t00016/t00016.cc", + "line": 16 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "unsigned int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00016::is_numeric", + "id": "500603075237446075", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "is_numeric", + "namespace": "clanguml::t00016", + "source_location": { + "file": "../../tests/t00016/t00016.cc", + "line": 20 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00016::is_numeric", + "id": "2111316837513419920", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "is_numeric", + "namespace": "clanguml::t00016", + "source_location": { + "file": "../../tests/t00016/t00016.cc", + "line": 24 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "bool" + } + ], + "type": "class" + } + ], + "name": "t00016_class", + "relationships": [ + { + "access": "public", + "destination": "214045147845616983", + "source": "95618295648274199", + "type": "instantiation" + }, + { + "access": "public", + "destination": "214045147845616983", + "source": "979129381790761728", + "type": "instantiation" + }, + { + "access": "public", + "destination": "214045147845616983", + "source": "2090787690027341836", + "type": "instantiation" + }, + { + "access": "public", + "destination": "214045147845616983", + "source": "500603075237446075", + "type": "instantiation" + }, + { + "access": "public", + "destination": "214045147845616983", + "source": "2111316837513419920", + "type": "instantiation" + } + ], + "using_namespace": "clanguml::t00016" +} +``` diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg index 1e3195b3..3b9f2aa4 100644 --- a/docs/test_cases/t00016_class.svg +++ b/docs/test_cases/t00016_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + is_numeric<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ - - + + is_numeric @@ -39,8 +39,8 @@ - - + + is_numeric @@ -49,8 +49,8 @@ - - + + is_numeric @@ -59,8 +59,8 @@ - - + + is_numeric diff --git a/docs/test_cases/t00017.md b/docs/test_cases/t00017.md index b5dc2913..338ff12e 100644 --- a/docs/test_cases/t00017.md +++ b/docs/test_cases/t00017.md @@ -78,3 +78,541 @@ private: ``` ## Generated UML diagrams ![t00017_class](./t00017_class.svg "Test include relations also as members flag") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00017::A", + "id": "121332093434690887", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::B", + "id": "1424864837456200487", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::C", + "id": "2151170391844743478", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::D", + "id": "1378112127131766972", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::E", + "id": "1535300935831802489", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::F", + "id": "1803800465279710134", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::G", + "id": "1135797791892670246", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::H", + "id": "1243547836571712317", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "H", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::I", + "id": "387733199705628658", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "I", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 21 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::J", + "id": "747991828672433537", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "J", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::K", + "id": "1783571342994833467", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "K", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 25 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00017::R", + "id": "287495916564113342", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "some_int", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 38 + }, + "type": "int" + }, + { + "access": "private", + "is_static": false, + "name": "some_int_pointer", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 39 + }, + "type": "int *" + }, + { + "access": "private", + "is_static": false, + "name": "some_int_pointer_pointer", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 40 + }, + "type": "int **" + }, + { + "access": "private", + "is_static": false, + "name": "some_int_reference", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 41 + }, + "type": "int &" + }, + { + "access": "private", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 42 + }, + "type": "clanguml::t00017::A" + }, + { + "access": "private", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 43 + }, + "type": "clanguml::t00017::B *" + }, + { + "access": "private", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 44 + }, + "type": "clanguml::t00017::C &" + }, + { + "access": "private", + "is_static": false, + "name": "d", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 45 + }, + "type": "const clanguml::t00017::D *" + }, + { + "access": "private", + "is_static": false, + "name": "e", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 46 + }, + "type": "const clanguml::t00017::E &" + }, + { + "access": "private", + "is_static": false, + "name": "f", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 47 + }, + "type": "clanguml::t00017::F &&" + }, + { + "access": "private", + "is_static": false, + "name": "g", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 48 + }, + "type": "clanguml::t00017::G **" + }, + { + "access": "private", + "is_static": false, + "name": "h", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 49 + }, + "type": "clanguml::t00017::H ***" + }, + { + "access": "private", + "is_static": false, + "name": "i", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 50 + }, + "type": "clanguml::t00017::I *&" + }, + { + "access": "private", + "is_static": false, + "name": "j", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 51 + }, + "type": "volatile clanguml::t00017::J *" + }, + { + "access": "private", + "is_static": false, + "name": "k", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 52 + }, + "type": "clanguml::t00017::K *" + } + ], + "methods": [ + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "R", + "parameters": [ + { + "name": "some_int", + "type": "int &" + }, + { + "name": "cc", + "type": "clanguml::t00017::C &" + }, + { + "name": "ee", + "type": "const clanguml::t00017::E &" + }, + { + "name": "ff", + "type": "clanguml::t00017::F &&" + }, + { + "name": "ii", + "type": "clanguml::t00017::I *&" + } + ], + "type": "void" + } + ], + "name": "R", + "namespace": "clanguml::t00017", + "source_location": { + "file": "../../tests/t00017/t00017.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00017_class", + "relationships": [ + { + "access": "public", + "destination": "2151170391844743478", + "source": "287495916564113342", + "type": "dependency" + }, + { + "access": "public", + "destination": "1535300935831802489", + "source": "287495916564113342", + "type": "dependency" + }, + { + "access": "public", + "destination": "1803800465279710134", + "source": "287495916564113342", + "type": "dependency" + }, + { + "access": "public", + "destination": "387733199705628658", + "source": "287495916564113342", + "type": "dependency" + }, + { + "access": "private", + "destination": "121332093434690887", + "label": "a", + "source": "287495916564113342", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1424864837456200487", + "label": "b", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "2151170391844743478", + "label": "c", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "1378112127131766972", + "label": "d", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "1535300935831802489", + "label": "e", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "1803800465279710134", + "label": "f", + "source": "287495916564113342", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1135797791892670246", + "label": "g", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "1243547836571712317", + "label": "h", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "387733199705628658", + "label": "i", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "747991828672433537", + "label": "j", + "source": "287495916564113342", + "type": "association" + }, + { + "access": "private", + "destination": "1783571342994833467", + "label": "k", + "source": "287495916564113342", + "type": "association" + } + ], + "using_namespace": "clanguml::t00017" +} +``` diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 3aa8f097..1e558c9c 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,127 +9,127 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00018.md b/docs/test_cases/t00018.md index b8880439..a10f4112 100644 --- a/docs/test_cases/t00018.md +++ b/docs/test_cases/t00018.md @@ -135,3 +135,276 @@ void widget::draw(const clanguml::t00018::widget &w) ``` ## Generated UML diagrams ![t00018_class](./t00018_class.svg "Pimpl pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00018::impl::widget", + "id": "130502639682787993", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "n", + "source_location": { + "file": "../../tests/t00018/t00018_impl.h", + "line": 10 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "draw", + "parameters": [ + { + "name": "w", + "type": "const clanguml::t00018::widget &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "draw", + "parameters": [ + { + "name": "w", + "type": "const clanguml::t00018::widget &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "widget", + "parameters": [ + { + "name": "n", + "type": "int" + } + ], + "type": "void" + } + ], + "name": "widget", + "namespace": "clanguml::t00018::impl", + "source_location": { + "file": "../../tests/t00018/t00018_impl.h", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00018::widget", + "id": "1005661284373854088", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "pImpl", + "source_location": { + "file": "../../tests/t00018/t00018.h", + "line": 18 + }, + "type": "std::unique_ptr" + } + ], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "draw", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "draw", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "shown", + "parameters": [], + "type": "bool" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "widget", + "parameters": [ + { + "name": "", + "type": "int" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "~widget", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "widget", + "parameters": [ + { + "name": "", + "type": "clanguml::t00018::widget &&" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "widget", + "parameters": [ + { + "name": "", + "type": "const clanguml::t00018::widget &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "operator=", + "parameters": [ + { + "name": "", + "type": "clanguml::t00018::widget &&" + } + ], + "type": "clanguml::t00018::widget &" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "operator=", + "parameters": [ + { + "name": "", + "type": "const clanguml::t00018::widget &" + } + ], + "type": "clanguml::t00018::widget &" + } + ], + "name": "widget", + "namespace": "clanguml::t00018", + "source_location": { + "file": "../../tests/t00018/t00018.h", + "line": 17 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00018_class", + "relationships": [ + { + "access": "public", + "destination": "1005661284373854088", + "source": "130502639682787993", + "type": "dependency" + }, + { + "access": "private", + "destination": "130502639682787993", + "label": "pImpl", + "source": "1005661284373854088", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00018" +} +``` diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index c2f5fa62..807dc8c1 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,18 +9,18 @@ - - + + impl::widget - + - + n : int @@ -30,18 +30,18 @@ draw(const widget & w) : void widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> diff --git a/docs/test_cases/t00019.md b/docs/test_cases/t00019.md index 846f5c6b..9491757b 100644 --- a/docs/test_cases/t00019.md +++ b/docs/test_cases/t00019.md @@ -152,3 +152,482 @@ class Base { ``` ## Generated UML diagrams ![t00019_class](./t00019_class.svg "Layercake pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00019::Base", + "id": "261668487476634123", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "private", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "Base", + "parameters": [], + "type": "void" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~Base", + "parameters": [], + "type": "void" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m1", + "parameters": [], + "type": "int" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m2", + "parameters": [], + "type": "std::string" + } + ], + "name": "Base", + "namespace": "clanguml::t00019", + "source_location": { + "file": "../../tests/t00019/t00019_base.h", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00019::Layer1", + "id": "902631298537519271", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m1", + "parameters": [], + "type": "int" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m2", + "parameters": [], + "type": "std::string" + } + ], + "name": "Layer1", + "namespace": "clanguml::t00019", + "source_location": { + "file": "../../tests/t00019/t00019_layer1.h", + "line": 9 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "LowerLayer", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00019::Layer2", + "id": "1115150925302580647", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "private", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "all_calls_count", + "parameters": [], + "type": "int" + } + ], + "name": "Layer2", + "namespace": "clanguml::t00019", + "source_location": { + "file": "../../tests/t00019/t00019_layer2.h", + "line": 6 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "LowerLayer", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00019::Layer3", + "id": "1853410560073854945", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "m_m1_calls", + "source_location": { + "file": "../../tests/t00019/t00019_layer3.h", + "line": 29 + }, + "type": "int" + }, + { + "access": "private", + "is_static": false, + "name": "m_m2_calls", + "source_location": { + "file": "../../tests/t00019/t00019_layer3.h", + "line": 30 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m1", + "parameters": [], + "type": "int" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m2", + "parameters": [], + "type": "std::string" + }, + { + "access": "private", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m1_calls", + "parameters": [], + "type": "int" + }, + { + "access": "private", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m2_calls", + "parameters": [], + "type": "int" + } + ], + "name": "Layer3", + "namespace": "clanguml::t00019", + "source_location": { + "file": "../../tests/t00019/t00019_layer3.h", + "line": 8 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "LowerLayer", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "261668487476634123", + "is_virtual": false, + "name": "clanguml::t00019::Base" + } + ], + "display_name": "clanguml::t00019::Layer3", + "id": "972890420743280319", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Layer3", + "namespace": "clanguml::t00019", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00019::Base" + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "972890420743280319", + "is_virtual": false, + "name": "clanguml::t00019::Layer3" + } + ], + "display_name": "clanguml::t00019::Layer2>", + "id": "129784999866998870", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Layer2", + "namespace": "clanguml::t00019", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00019::Base" + } + ], + "type": "clanguml::t00019::Layer3" + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "129784999866998870", + "is_virtual": false, + "name": "clanguml::t00019::Layer2>" + } + ], + "display_name": "clanguml::t00019::Layer1>>", + "id": "659076058325663708", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Layer1", + "namespace": "clanguml::t00019", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00019::Base" + } + ], + "type": "clanguml::t00019::Layer3" + } + ], + "type": "clanguml::t00019::Layer2" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00019::A", + "id": "1015164998787089197", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "layers", + "source_location": { + "file": "../../tests/t00019/t00019.cc", + "line": 13 + }, + "type": "std::unique_ptr>>>" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00019", + "source_location": { + "file": "../../tests/t00019/t00019.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00019_class", + "relationships": [ + { + "access": "public", + "destination": "261668487476634123", + "source": "972890420743280319", + "type": "dependency" + }, + { + "access": "public", + "destination": "1853410560073854945", + "source": "972890420743280319", + "type": "instantiation" + }, + { + "access": "public", + "destination": "261668487476634123", + "source": "972890420743280319", + "type": "extension" + }, + { + "access": "public", + "destination": "972890420743280319", + "source": "129784999866998870", + "type": "dependency" + }, + { + "access": "public", + "destination": "1115150925302580647", + "source": "129784999866998870", + "type": "instantiation" + }, + { + "access": "public", + "destination": "972890420743280319", + "source": "129784999866998870", + "type": "extension" + }, + { + "access": "public", + "destination": "129784999866998870", + "source": "659076058325663708", + "type": "dependency" + }, + { + "access": "public", + "destination": "902631298537519271", + "source": "659076058325663708", + "type": "instantiation" + }, + { + "access": "public", + "destination": "129784999866998870", + "source": "659076058325663708", + "type": "extension" + }, + { + "access": "public", + "destination": "659076058325663708", + "source": "1015164998787089197", + "type": "dependency" + }, + { + "access": "public", + "destination": "659076058325663708", + "label": "layers", + "source": "1015164998787089197", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00019" +} +``` diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index fb79a242..9c24a0d2 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Base @@ -25,8 +25,8 @@ m2() : std::string - - + + Layer1 @@ -39,8 +39,8 @@ m2() : std::string - - + + Layer2 @@ -51,8 +51,8 @@ all_calls_count() const : int - - + + Layer3 @@ -60,18 +60,18 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int @@ -83,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020.md b/docs/test_cases/t00020.md index 462db2a6..3a2425a2 100644 --- a/docs/test_cases/t00020.md +++ b/docs/test_cases/t00020.md @@ -98,3 +98,516 @@ public: ``` ## Generated UML diagrams ![t00020_class](./t00020_class.svg "Abstract factory pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00020::ProductA", + "id": "425267229659464944", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~ProductA", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "sell", + "parameters": [ + { + "name": "price", + "type": "int" + } + ], + "type": "bool" + } + ], + "name": "ProductA", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "425267229659464944", + "is_virtual": false, + "name": "clanguml::t00020::ProductA" + } + ], + "display_name": "clanguml::t00020::ProductA1", + "id": "1756496029797864207", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "sell", + "parameters": [ + { + "name": "price", + "type": "int" + } + ], + "type": "bool" + } + ], + "name": "ProductA1", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "425267229659464944", + "is_virtual": false, + "name": "clanguml::t00020::ProductA" + } + ], + "display_name": "clanguml::t00020::ProductA2", + "id": "1531708592885216981", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "sell", + "parameters": [ + { + "name": "price", + "type": "int" + } + ], + "type": "bool" + } + ], + "name": "ProductA2", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00020::ProductB", + "id": "2235759006374865842", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~ProductB", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "buy", + "parameters": [ + { + "name": "price", + "type": "int" + } + ], + "type": "bool" + } + ], + "name": "ProductB", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2235759006374865842", + "is_virtual": false, + "name": "clanguml::t00020::ProductB" + } + ], + "display_name": "clanguml::t00020::ProductB1", + "id": "1465493024233223845", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "buy", + "parameters": [ + { + "name": "price", + "type": "int" + } + ], + "type": "bool" + } + ], + "name": "ProductB1", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2235759006374865842", + "is_virtual": false, + "name": "clanguml::t00020::ProductB" + } + ], + "display_name": "clanguml::t00020::ProductB2", + "id": "2154665562370057871", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "buy", + "parameters": [ + { + "name": "price", + "type": "int" + } + ], + "type": "bool" + } + ], + "name": "ProductB2", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 33 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00020::AbstractFactory", + "id": "1705546469218961425", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "make_a", + "parameters": [], + "type": "std::unique_ptr" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "make_b", + "parameters": [], + "type": "std::unique_ptr" + } + ], + "name": "AbstractFactory", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 38 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1705546469218961425", + "is_virtual": false, + "name": "clanguml::t00020::AbstractFactory" + } + ], + "display_name": "clanguml::t00020::Factory1", + "id": "692346848484854107", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "make_a", + "parameters": [], + "type": "std::unique_ptr" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "make_b", + "parameters": [], + "type": "std::unique_ptr" + } + ], + "name": "Factory1", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 44 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1705546469218961425", + "is_virtual": false, + "name": "clanguml::t00020::AbstractFactory" + } + ], + "display_name": "clanguml::t00020::Factory2", + "id": "1566325870805013023", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "make_a", + "parameters": [], + "type": "std::unique_ptr" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "make_b", + "parameters": [], + "type": "std::unique_ptr" + } + ], + "name": "Factory2", + "namespace": "clanguml::t00020", + "source_location": { + "file": "../../tests/t00020/t00020.cc", + "line": 57 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00020_class", + "relationships": [ + { + "access": "public", + "destination": "425267229659464944", + "source": "1756496029797864207", + "type": "extension" + }, + { + "access": "public", + "destination": "425267229659464944", + "source": "1531708592885216981", + "type": "extension" + }, + { + "access": "public", + "destination": "2235759006374865842", + "source": "1465493024233223845", + "type": "extension" + }, + { + "access": "public", + "destination": "2235759006374865842", + "source": "2154665562370057871", + "type": "extension" + }, + { + "access": "public", + "destination": "425267229659464944", + "source": "1705546469218961425", + "type": "dependency" + }, + { + "access": "public", + "destination": "2235759006374865842", + "source": "1705546469218961425", + "type": "dependency" + }, + { + "access": "public", + "destination": "425267229659464944", + "source": "692346848484854107", + "type": "dependency" + }, + { + "access": "public", + "destination": "2235759006374865842", + "source": "692346848484854107", + "type": "dependency" + }, + { + "access": "public", + "destination": "1705546469218961425", + "source": "692346848484854107", + "type": "extension" + }, + { + "access": "public", + "destination": "425267229659464944", + "source": "1566325870805013023", + "type": "dependency" + }, + { + "access": "public", + "destination": "2235759006374865842", + "source": "1566325870805013023", + "type": "dependency" + }, + { + "access": "public", + "destination": "1705546469218961425", + "source": "1566325870805013023", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00020" +} +``` diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 8d0285cf..2b37a08a 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ProductA @@ -21,8 +21,8 @@ sell(int price) const = 0 : bool - - + + ProductA1 @@ -31,8 +31,8 @@ sell(int price) const : bool - - + + ProductA2 @@ -41,8 +41,8 @@ sell(int price) const : bool - - + + ProductB @@ -53,8 +53,8 @@ buy(int price) const = 0 : bool - - + + ProductB1 @@ -63,8 +63,8 @@ buy(int price) const : bool - - + + ProductB2 @@ -73,8 +73,8 @@ buy(int price) const : bool - - + + AbstractFactory @@ -85,8 +85,8 @@ make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 @@ -97,8 +97,8 @@ make_b() const : std::unique_ptr<ProductB> - - + + Factory2 diff --git a/docs/test_cases/t00021.md b/docs/test_cases/t00021.md index 0d431d17..b9a2038d 100644 --- a/docs/test_cases/t00021.md +++ b/docs/test_cases/t00021.md @@ -72,3 +72,504 @@ public: ``` ## Generated UML diagrams ![t00021_class](./t00021_class.svg "Visitor pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00021::Visitor", + "id": "1668671110672744395", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~Visitor", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "visit_A", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::A &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "visit_B", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::B &" + } + ], + "type": "void" + } + ], + "name": "Visitor", + "namespace": "clanguml::t00021", + "source_location": { + "file": "../../tests/t00021/t00021.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1668671110672744395", + "is_virtual": false, + "name": "clanguml::t00021::Visitor" + } + ], + "display_name": "clanguml::t00021::Visitor1", + "id": "1028369219400401946", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "visit_A", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::A &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "visit_B", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::B &" + } + ], + "type": "void" + } + ], + "name": "Visitor1", + "namespace": "clanguml::t00021", + "source_location": { + "file": "../../tests/t00021/t00021.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1668671110672744395", + "is_virtual": false, + "name": "clanguml::t00021::Visitor" + } + ], + "display_name": "clanguml::t00021::Visitor2", + "id": "1710373315476287130", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "visit_A", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::A &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "visit_B", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::B &" + } + ], + "type": "void" + } + ], + "name": "Visitor2", + "namespace": "clanguml::t00021", + "source_location": { + "file": "../../tests/t00021/t00021.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1668671110672744395", + "is_virtual": false, + "name": "clanguml::t00021::Visitor" + } + ], + "display_name": "clanguml::t00021::Visitor3", + "id": "1399026228179178025", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "visit_A", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::A &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "visit_B", + "parameters": [ + { + "name": "item", + "type": "const clanguml::t00021::B &" + } + ], + "type": "void" + } + ], + "name": "Visitor3", + "namespace": "clanguml::t00021", + "source_location": { + "file": "../../tests/t00021/t00021.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00021::Item", + "id": "1491568826758947722", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~Item", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "accept", + "parameters": [ + { + "name": "visitor", + "type": "const clanguml::t00021::Visitor &" + } + ], + "type": "void" + } + ], + "name": "Item", + "namespace": "clanguml::t00021", + "source_location": { + "file": "../../tests/t00021/t00021.cc", + "line": 34 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1491568826758947722", + "is_virtual": false, + "name": "clanguml::t00021::Item" + } + ], + "display_name": "clanguml::t00021::A", + "id": "1494142745564026823", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "accept", + "parameters": [ + { + "name": "visitor", + "type": "const clanguml::t00021::Visitor &" + } + ], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00021", + "source_location": { + "file": "../../tests/t00021/t00021.cc", + "line": 40 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1491568826758947722", + "is_virtual": false, + "name": "clanguml::t00021::Item" + } + ], + "display_name": "clanguml::t00021::B", + "id": "1452948650450999568", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "accept", + "parameters": [ + { + "name": "visitor", + "type": "const clanguml::t00021::Visitor &" + } + ], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00021", + "source_location": { + "file": "../../tests/t00021/t00021.cc", + "line": 45 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00021_class", + "relationships": [ + { + "access": "public", + "destination": "1494142745564026823", + "source": "1668671110672744395", + "type": "dependency" + }, + { + "access": "public", + "destination": "1452948650450999568", + "source": "1668671110672744395", + "type": "dependency" + }, + { + "access": "public", + "destination": "1494142745564026823", + "source": "1028369219400401946", + "type": "dependency" + }, + { + "access": "public", + "destination": "1452948650450999568", + "source": "1028369219400401946", + "type": "dependency" + }, + { + "access": "public", + "destination": "1668671110672744395", + "source": "1028369219400401946", + "type": "extension" + }, + { + "access": "public", + "destination": "1494142745564026823", + "source": "1710373315476287130", + "type": "dependency" + }, + { + "access": "public", + "destination": "1452948650450999568", + "source": "1710373315476287130", + "type": "dependency" + }, + { + "access": "public", + "destination": "1668671110672744395", + "source": "1710373315476287130", + "type": "extension" + }, + { + "access": "public", + "destination": "1494142745564026823", + "source": "1399026228179178025", + "type": "dependency" + }, + { + "access": "public", + "destination": "1452948650450999568", + "source": "1399026228179178025", + "type": "dependency" + }, + { + "access": "public", + "destination": "1668671110672744395", + "source": "1399026228179178025", + "type": "extension" + }, + { + "access": "public", + "destination": "1668671110672744395", + "source": "1491568826758947722", + "type": "dependency" + }, + { + "access": "public", + "destination": "1668671110672744395", + "source": "1494142745564026823", + "type": "dependency" + }, + { + "access": "public", + "destination": "1491568826758947722", + "source": "1494142745564026823", + "type": "extension" + }, + { + "access": "public", + "destination": "1668671110672744395", + "source": "1452948650450999568", + "type": "dependency" + }, + { + "access": "public", + "destination": "1491568826758947722", + "source": "1452948650450999568", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00021" +} +``` diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index 4aaa781f..a51a7eb4 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Visitor @@ -23,8 +23,8 @@ visit_B(const B & item) const = 0 : void - - + + Visitor1 @@ -35,8 +35,8 @@ visit_B(const B & item) const : void - - + + Visitor2 @@ -47,8 +47,8 @@ visit_B(const B & item) const : void - - + + Visitor3 @@ -59,8 +59,8 @@ visit_B(const B & item) const : void - - + + Item @@ -71,8 +71,8 @@ accept(const Visitor & visitor) const = 0 : void - - + + A @@ -81,8 +81,8 @@ accept(const Visitor & visitor) const : void - - + + B diff --git a/docs/test_cases/t00022.md b/docs/test_cases/t00022.md index 17101292..4aec1a19 100644 --- a/docs/test_cases/t00022.md +++ b/docs/test_cases/t00022.md @@ -53,3 +53,188 @@ protected: ``` ## Generated UML diagrams ![t00022_class](./t00022_class.svg "Template method pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00022::A", + "id": "2012435893382068755", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "template_method", + "parameters": [], + "type": "void" + }, + { + "access": "protected", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "method1", + "parameters": [], + "type": "void" + }, + { + "access": "protected", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "method2", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00022", + "source_location": { + "file": "../../tests/t00022/t00022.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2012435893382068755", + "is_virtual": false, + "name": "clanguml::t00022::A" + } + ], + "display_name": "clanguml::t00022::A1", + "id": "2282061426381077447", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "protected", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "method1", + "parameters": [], + "type": "void" + }, + { + "access": "protected", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "method2", + "parameters": [], + "type": "void" + } + ], + "name": "A1", + "namespace": "clanguml::t00022", + "source_location": { + "file": "../../tests/t00022/t00022.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2012435893382068755", + "is_virtual": false, + "name": "clanguml::t00022::A" + } + ], + "display_name": "clanguml::t00022::A2", + "id": "158819862916671538", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "protected", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "method1", + "parameters": [], + "type": "void" + }, + { + "access": "protected", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "method2", + "parameters": [], + "type": "void" + } + ], + "name": "A2", + "namespace": "clanguml::t00022", + "source_location": { + "file": "../../tests/t00022/t00022.cc", + "line": 25 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00022_class", + "relationships": [ + { + "access": "public", + "destination": "2012435893382068755", + "source": "2282061426381077447", + "type": "extension" + }, + { + "access": "public", + "destination": "2012435893382068755", + "source": "158819862916671538", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00022" +} +``` diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index 77149e2a..d3fd3698 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -23,8 +23,8 @@ method2() = 0 : void - - + + A1 @@ -35,8 +35,8 @@ method2() : void - - + + A2 diff --git a/docs/test_cases/t00023.md b/docs/test_cases/t00023.md index b7a5dadf..ea52e1d9 100644 --- a/docs/test_cases/t00023.md +++ b/docs/test_cases/t00023.md @@ -62,3 +62,272 @@ private: ``` ## Generated UML diagrams ![t00023_class](./t00023_class.svg "Strategy pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00023::Strategy", + "id": "1469857696438841976", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~Strategy", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "algorithm", + "parameters": [], + "type": "void" + } + ], + "name": "Strategy", + "namespace": "clanguml::t00023", + "source_location": { + "file": "../../tests/t00023/t00023.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1469857696438841976", + "is_virtual": false, + "name": "clanguml::t00023::Strategy" + } + ], + "display_name": "clanguml::t00023::StrategyA", + "id": "1245533075819635385", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "algorithm", + "parameters": [], + "type": "void" + } + ], + "name": "StrategyA", + "namespace": "clanguml::t00023", + "source_location": { + "file": "../../tests/t00023/t00023.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1469857696438841976", + "is_virtual": false, + "name": "clanguml::t00023::Strategy" + } + ], + "display_name": "clanguml::t00023::StrategyB", + "id": "264986406899645", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "algorithm", + "parameters": [], + "type": "void" + } + ], + "name": "StrategyB", + "namespace": "clanguml::t00023", + "source_location": { + "file": "../../tests/t00023/t00023.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1469857696438841976", + "is_virtual": false, + "name": "clanguml::t00023::Strategy" + } + ], + "display_name": "clanguml::t00023::StrategyC", + "id": "174795176193483089", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "algorithm", + "parameters": [], + "type": "void" + } + ], + "name": "StrategyC", + "namespace": "clanguml::t00023", + "source_location": { + "file": "../../tests/t00023/t00023.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00023::Context", + "id": "2038594012979479050", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "m_strategy", + "source_location": { + "file": "../../tests/t00023/t00023.cc", + "line": 37 + }, + "type": "std::unique_ptr" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "Context", + "parameters": [ + { + "name": "strategy", + "type": "std::unique_ptr" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "apply", + "parameters": [], + "type": "void" + } + ], + "name": "Context", + "namespace": "clanguml::t00023", + "source_location": { + "file": "../../tests/t00023/t00023.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00023_class", + "relationships": [ + { + "access": "public", + "destination": "1469857696438841976", + "source": "1245533075819635385", + "type": "extension" + }, + { + "access": "public", + "destination": "1469857696438841976", + "source": "264986406899645", + "type": "extension" + }, + { + "access": "public", + "destination": "1469857696438841976", + "source": "174795176193483089", + "type": "extension" + }, + { + "access": "public", + "destination": "1469857696438841976", + "source": "2038594012979479050", + "type": "dependency" + }, + { + "access": "private", + "destination": "1469857696438841976", + "label": "m_strategy", + "source": "2038594012979479050", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00023" +} +``` diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 8bc7e504..292bed26 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Strategy @@ -21,8 +21,8 @@ algorithm() = 0 : void - - + + StrategyA @@ -31,8 +31,8 @@ algorithm() : void - - + + StrategyB @@ -41,8 +41,8 @@ algorithm() : void - - + + StrategyC @@ -51,18 +51,18 @@ algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> diff --git a/docs/test_cases/t00024.md b/docs/test_cases/t00024.md index 18210cfa..dafe2158 100644 --- a/docs/test_cases/t00024.md +++ b/docs/test_cases/t00024.md @@ -61,3 +61,287 @@ private: ``` ## Generated UML diagrams ![t00024_class](./t00024_class.svg "Proxy pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00024::Target", + "id": "1116408959993110019", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "~Target", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "m1", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "m2", + "parameters": [], + "type": "void" + } + ], + "name": "Target", + "namespace": "clanguml::t00024", + "source_location": { + "file": "../../tests/t00024/t00024.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1116408959993110019", + "is_virtual": false, + "name": "clanguml::t00024::Target" + } + ], + "display_name": "clanguml::t00024::Target1", + "id": "669517069151826610", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m1", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m2", + "parameters": [], + "type": "void" + } + ], + "name": "Target1", + "namespace": "clanguml::t00024", + "source_location": { + "file": "../../tests/t00024/t00024.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1116408959993110019", + "is_virtual": false, + "name": "clanguml::t00024::Target" + } + ], + "display_name": "clanguml::t00024::Target2", + "id": "1210513233906695933", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m1", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m2", + "parameters": [], + "type": "void" + } + ], + "name": "Target2", + "namespace": "clanguml::t00024", + "source_location": { + "file": "../../tests/t00024/t00024.cc", + "line": 20 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1116408959993110019", + "is_virtual": false, + "name": "clanguml::t00024::Target" + } + ], + "display_name": "clanguml::t00024::Proxy", + "id": "594707401639991215", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "m_target", + "source_location": { + "file": "../../tests/t00024/t00024.cc", + "line": 36 + }, + "type": "std::shared_ptr" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "Proxy", + "parameters": [ + { + "name": "target", + "type": "std::shared_ptr" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m1", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "m2", + "parameters": [], + "type": "void" + } + ], + "name": "Proxy", + "namespace": "clanguml::t00024", + "source_location": { + "file": "../../tests/t00024/t00024.cc", + "line": 26 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00024_class", + "relationships": [ + { + "access": "public", + "destination": "1116408959993110019", + "source": "669517069151826610", + "type": "extension" + }, + { + "access": "public", + "destination": "1116408959993110019", + "source": "1210513233906695933", + "type": "extension" + }, + { + "access": "public", + "destination": "1116408959993110019", + "source": "594707401639991215", + "type": "dependency" + }, + { + "access": "private", + "destination": "1116408959993110019", + "label": "m_target", + "source": "594707401639991215", + "type": "association" + }, + { + "access": "public", + "destination": "1116408959993110019", + "source": "594707401639991215", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00024" +} +``` diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 3d5979e3..147ee095 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target @@ -23,8 +23,8 @@ m2() = 0 : void - - + + Target1 @@ -35,8 +35,8 @@ m2() : void - - + + Target2 @@ -47,18 +47,18 @@ m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> diff --git a/docs/test_cases/t00025.md b/docs/test_cases/t00025.md index 25c1ebdd..9e8ad51a 100644 --- a/docs/test_cases/t00025.md +++ b/docs/test_cases/t00025.md @@ -59,3 +59,310 @@ public: ``` ## Generated UML diagrams ![t00025_class](./t00025_class.svg "Template proxy pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00025::Target1", + "id": "1573849034571194138", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m1", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m2", + "parameters": [], + "type": "void" + } + ], + "name": "Target1", + "namespace": "clanguml::t00025", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00025::Target2", + "id": "751896409461834669", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m1", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m2", + "parameters": [], + "type": "void" + } + ], + "name": "Target2", + "namespace": "clanguml::t00025", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00025::Proxy", + "id": "1483353300536405088", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "m_target", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 28 + }, + "type": "std::shared_ptr" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "Proxy", + "parameters": [ + { + "name": "target", + "type": "std::shared_ptr" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m1", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "m2", + "parameters": [], + "type": "void" + } + ], + "name": "Proxy", + "namespace": "clanguml::t00025", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 18 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00025::Proxy", + "id": "1644966842838139424", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Proxy", + "namespace": "clanguml::t00025", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00025::Target1" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00025::Proxy", + "id": "1190103100236298763", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Proxy", + "namespace": "clanguml::t00025", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00025::Target2" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00025::ProxyHolder", + "id": "1906317303950647748", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "proxy1", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 33 + }, + "type": "Proxy" + }, + { + "access": "public", + "is_static": false, + "name": "proxy2", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 34 + }, + "type": "Proxy" + } + ], + "methods": [], + "name": "ProxyHolder", + "namespace": "clanguml::t00025", + "source_location": { + "file": "../../tests/t00025/t00025.cc", + "line": 31 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00025_class", + "relationships": [ + { + "access": "public", + "destination": "1573849034571194138", + "source": "1644966842838139424", + "type": "dependency" + }, + { + "access": "public", + "destination": "1483353300536405088", + "source": "1644966842838139424", + "type": "instantiation" + }, + { + "access": "public", + "destination": "751896409461834669", + "source": "1190103100236298763", + "type": "dependency" + }, + { + "access": "public", + "destination": "1483353300536405088", + "source": "1190103100236298763", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1644966842838139424", + "label": "proxy1", + "source": "1906317303950647748", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1190103100236298763", + "label": "proxy2", + "source": "1906317303950647748", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00025" +} +``` diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index 6e2cff91..e06c209d 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target1 @@ -21,8 +21,8 @@ m2() : void - - + + Target2 @@ -33,8 +33,8 @@ m2() : void - - + + Proxy @@ -42,11 +42,11 @@ T - + - + m_target : std::shared_ptr<T> @@ -56,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026.md b/docs/test_cases/t00026.md index 3e5b3729..6ca8c99f 100644 --- a/docs/test_cases/t00026.md +++ b/docs/test_cases/t00026.md @@ -80,3 +80,406 @@ struct StringMemento { ``` ## Generated UML diagrams ![t00026_class](./t00026_class.svg "Template memento pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00026::Memento", + "id": "1241204213727905390", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "m_value", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 18 + }, + "type": "T" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "Memento", + "parameters": [ + { + "name": "v", + "type": "T &&" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "value", + "parameters": [], + "type": "T" + } + ], + "name": "Memento", + "namespace": "clanguml::t00026", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 8 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00026::Originator", + "id": "1324770803720816727", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "m_value", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 37 + }, + "type": "T" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "Originator", + "parameters": [ + { + "name": "v", + "type": "T &&" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "memoize_value", + "parameters": [], + "type": "Memento" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "load", + "parameters": [ + { + "name": "m", + "type": "const Memento &" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "print", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "set", + "parameters": [ + { + "name": "v", + "type": "T &&" + } + ], + "type": "void" + } + ], + "name": "Originator", + "namespace": "clanguml::t00026", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 21 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00026::Caretaker", + "id": "2032715387182792204", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "m_mementos", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 50 + }, + "type": "std::unordered_map>" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "state", + "parameters": [ + { + "name": "n", + "type": "const std::string &" + } + ], + "type": "Memento &" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "set_state", + "parameters": [ + { + "name": "s", + "type": "const std::string &" + }, + { + "name": "m", + "type": "Memento &&" + } + ], + "type": "void" + } + ], + "name": "Caretaker", + "namespace": "clanguml::t00026", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 40 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00026::Caretaker", + "id": "1708482137721157489", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Caretaker", + "namespace": "clanguml::t00026", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00026::Originator", + "id": "1014247960805363560", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Originator", + "namespace": "clanguml::t00026", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00026::StringMemento", + "id": "851750942915129289", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "caretaker", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 54 + }, + "type": "Caretaker" + }, + { + "access": "public", + "is_static": false, + "name": "originator", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 55 + }, + "type": "Originator" + } + ], + "methods": [], + "name": "StringMemento", + "namespace": "clanguml::t00026", + "source_location": { + "file": "../../tests/t00026/t00026.cc", + "line": 53 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00026_class", + "relationships": [ + { + "access": "public", + "destination": "1241204213727905390", + "source": "1324770803720816727", + "type": "dependency" + }, + { + "access": "public", + "destination": "1241204213727905390", + "source": "2032715387182792204", + "type": "dependency" + }, + { + "access": "private", + "destination": "1241204213727905390", + "label": "m_mementos", + "source": "2032715387182792204", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2032715387182792204", + "source": "1708482137721157489", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1324770803720816727", + "source": "1014247960805363560", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1708482137721157489", + "label": "caretaker", + "source": "851750942915129289", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1014247960805363560", + "label": "originator", + "source": "851750942915129289", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00026" +} +``` diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 82641929..82741827 100644 --- a/docs/test_cases/t00026_class.svg +++ b/docs/test_cases/t00026_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Memento @@ -18,11 +18,11 @@ T - + - + m_value : T @@ -30,8 +30,8 @@ Memento<T>(T && v) : void value() const : T - - + + Originator @@ -39,11 +39,11 @@ T - + - + m_value : T @@ -57,8 +57,8 @@ print() const : void set(T && v) : void - - + + Caretaker @@ -66,11 +66,11 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> @@ -78,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027.md b/docs/test_cases/t00027.md index e94a8eee..08a7deb1 100644 --- a/docs/test_cases/t00027.md +++ b/docs/test_cases/t00027.md @@ -77,3 +77,590 @@ struct Window { ``` ## Generated UML diagrams ![t00027_class](./t00027_class.svg "Template decorator pattern") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00027::Shape", + "id": "1593092483959332221", + "is_abstract": true, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "display", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": true, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "~Shape", + "parameters": [], + "type": "void" + } + ], + "name": "Shape", + "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::Line", + "id": "1568932879061562228", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Line", + "namespace": "clanguml::t00027", + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1593092483959332221", + "is_virtual": false, + "name": "clanguml::t00027::Shape" + }, + { + "access": "public", + "id": "2184609081997324211", + "is_virtual": false, + "name": "T>" + } + ], + "display_name": "clanguml::t00027::Line...>", + "id": "142374082478337852", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "display", + "parameters": [], + "type": "void" + } + ], + "name": "Line", + "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 15 + }, + "template_parameters": [ + { + "is_variadic": true, + "kind": "template_template_type", + "name": "T<>...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::Text", + "id": "1833467466291294724", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Text", + "namespace": "clanguml::t00027", + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1593092483959332221", + "is_virtual": false, + "name": "clanguml::t00027::Shape" + }, + { + "access": "public", + "id": "2247508827463056747", + "is_virtual": false, + "name": "T>" + } + ], + "display_name": "clanguml::t00027::Text...>", + "id": "1114634647721878603", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "display", + "parameters": [], + "type": "void" + } + ], + "name": "Text", + "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 25 + }, + "template_parameters": [ + { + "is_variadic": true, + "kind": "template_template_type", + "name": "T<>...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::ShapeDecorator", + "id": "2049188825706164566", + "is_abstract": true, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "display", + "parameters": [], + "type": "void" + } + ], + "name": "ShapeDecorator", + "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 34 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2049188825706164566", + "is_virtual": false, + "name": "clanguml::t00027::ShapeDecorator" + } + ], + "display_name": "clanguml::t00027::Color", + "id": "1473536569433029444", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "display", + "parameters": [], + "type": "void" + } + ], + "name": "Color", + "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 38 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2049188825706164566", + "is_virtual": false, + "name": "clanguml::t00027::ShapeDecorator" + } + ], + "display_name": "clanguml::t00027::Weight", + "id": "2049455532387561338", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "display", + "parameters": [], + "type": "void" + } + ], + "name": "Weight", + "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 43 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::Line", + "id": "2082936326417164202", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Line", + "namespace": "clanguml::t00027", + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "clanguml::t00027::Color", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "clanguml::t00027::Weight", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::Line", + "id": "675132943535054947", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Line", + "namespace": "clanguml::t00027", + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "clanguml::t00027::Color", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::Text", + "id": "1678874302644303776", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Text", + "namespace": "clanguml::t00027", + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "clanguml::t00027::Color", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "clanguml::t00027::Weight", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::Text", + "id": "1887786688778664182", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Text", + "namespace": "clanguml::t00027", + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "clanguml::t00027::Color", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00027::Window", + "id": "1373544984027721472", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "border", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 49 + }, + "type": "Line" + }, + { + "access": "public", + "is_static": false, + "name": "divider", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 50 + }, + "type": "Line" + }, + { + "access": "public", + "is_static": false, + "name": "title", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 51 + }, + "type": "Text" + }, + { + "access": "public", + "is_static": false, + "name": "description", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 52 + }, + "type": "Text" + } + ], + "methods": [], + "name": "Window", + "namespace": "clanguml::t00027", + "source_location": { + "file": "../../tests/t00027/t00027.cc", + "line": 48 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00027_class", + "relationships": [ + { + "access": "public", + "destination": "142374082478337852", + "source": "1568932879061562228", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1593092483959332221", + "source": "142374082478337852", + "type": "extension" + }, + { + "access": "public", + "destination": "2184609081997324211", + "source": "142374082478337852", + "type": "extension" + }, + { + "access": "public", + "destination": "1114634647721878603", + "source": "1833467466291294724", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1593092483959332221", + "source": "1114634647721878603", + "type": "extension" + }, + { + "access": "public", + "destination": "2247508827463056747", + "source": "1114634647721878603", + "type": "extension" + }, + { + "access": "public", + "destination": "2049188825706164566", + "source": "1473536569433029444", + "type": "extension" + }, + { + "access": "public", + "destination": "2049188825706164566", + "source": "2049455532387561338", + "type": "extension" + }, + { + "access": "public", + "destination": "142374082478337852", + "source": "2082936326417164202", + "type": "instantiation" + }, + { + "access": "public", + "destination": "142374082478337852", + "source": "675132943535054947", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1114634647721878603", + "source": "1678874302644303776", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1114634647721878603", + "source": "1887786688778664182", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2082936326417164202", + "label": "border", + "source": "1373544984027721472", + "type": "aggregation" + }, + { + "access": "public", + "destination": "675132943535054947", + "label": "divider", + "source": "1373544984027721472", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1678874302644303776", + "label": "title", + "source": "1373544984027721472", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1887786688778664182", + "label": "description", + "source": "1373544984027721472", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00027" +} +``` diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index cadd73ad..4d963ed1 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Shape @@ -21,14 +21,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028.md b/docs/test_cases/t00028.md index 35ad898c..652039eb 100644 --- a/docs/test_cases/t00028.md +++ b/docs/test_cases/t00028.md @@ -86,3 +86,386 @@ class R { ``` ## Generated UML diagrams ![t00028_class](./t00028_class.svg "PlantUML note decorator test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "comment": { + "formatted": "\\uml{note[top] A class note.}", + "raw": "/// \\uml{note[top] A class note.}" + }, + "display_name": "clanguml::t00028::A", + "id": "1519850480962783588", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "\\uml{note[] B class note.}", + "raw": "/// \\uml{note[] B class note.}" + }, + "display_name": "clanguml::t00028::B", + "id": "1980597091567213070", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "\n @uml{note:t00028_class[bottom] C class note.}\n This is class C.", + "raw": "///\n/// @uml{note:t00028_class[bottom] C class note.}\n/// This is class C." + }, + "display_name": "clanguml::t00028::C", + "id": "984577258575112753", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "\\uml{note\nD\nclass\nnote.}", + "raw": "/// \\uml{note\n/// D\n/// class\n/// note.}" + }, + "display_name": "clanguml::t00028::D", + "id": "1263778658518784070", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "\\uml{note E template class note.}", + "raw": "/// \\uml{note E template class note.}" + }, + "display_name": "clanguml::t00028::E", + "id": "1014136565447389473", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "param", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 26 + }, + "type": "T" + } + ], + "methods": [], + "name": "E", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 25 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "\\uml{note:other_diagram[left] G class note.}", + "raw": "/// \\uml{note:other_diagram[left] G class note.}" + }, + "display_name": "clanguml::t00028::G", + "id": "764713728396057122", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 30 + }, + "template_parameters": [], + "type": "class" + }, + { + "comment": { + "formatted": "@uml{note[ bottom ] F enum note.}", + "raw": "/// @uml{note[ bottom ] F enum note.}" + }, + "constants": [ + "one", + "two", + "three" + ], + "display_name": "clanguml::t00028::F", + "id": "589227897266388677", + "is_nested": false, + "name": "F", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 33 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00028::E", + "id": "1949673179441298667", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00028", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "\\uml{note[right] R class note.}", + "raw": "/// \\uml{note[right] R class note.}" + }, + "display_name": "clanguml::t00028::R", + "id": "1189142882239313116", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "private", + "comment": { + "formatted": "\\uml{note[left] R contains an instance of A.}", + "raw": "/// \\uml{note[left] R contains an instance of A.}" + }, + "is_static": false, + "name": "aaa", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 43 + }, + "type": "clanguml::t00028::A" + }, + { + "access": "private", + "comment": { + "formatted": "\\uml{note:other_diagram[right] R contains an pointer to B.}", + "raw": "/// \\uml{note:other_diagram[right] R contains an pointer to B.}" + }, + "is_static": false, + "name": "bbb", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 46 + }, + "type": "clanguml::t00028::B *" + }, + { + "access": "private", + "is_static": false, + "name": "ccc", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 48 + }, + "type": "clanguml::t00028::C &" + }, + { + "access": "private", + "is_static": false, + "name": "ddd", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 50 + }, + "type": "std::vector>" + }, + { + "access": "private", + "is_static": false, + "name": "eee", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 52 + }, + "type": "E" + }, + { + "access": "private", + "is_static": false, + "name": "ggg", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 54 + }, + "type": "clanguml::t00028::G **" + } + ], + "methods": [ + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "R", + "parameters": [ + { + "name": "c", + "type": "clanguml::t00028::C &" + } + ], + "type": "void" + } + ], + "name": "R", + "namespace": "clanguml::t00028", + "source_location": { + "file": "../../tests/t00028/t00028.cc", + "line": 36 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00028_class", + "relationships": [ + { + "access": "public", + "destination": "1014136565447389473", + "source": "1949673179441298667", + "type": "instantiation" + }, + { + "access": "public", + "destination": "984577258575112753", + "source": "1189142882239313116", + "type": "dependency" + }, + { + "access": "private", + "destination": "1519850480962783588", + "label": "aaa", + "source": "1189142882239313116", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1980597091567213070", + "label": "bbb", + "source": "1189142882239313116", + "type": "association" + }, + { + "access": "private", + "destination": "984577258575112753", + "label": "ccc", + "source": "1189142882239313116", + "type": "association" + }, + { + "access": "private", + "destination": "1263778658518784070", + "label": "ddd", + "source": "1189142882239313116", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1949673179441298667", + "label": "eee", + "source": "1189142882239313116", + "type": "aggregation" + }, + { + "access": "private", + "destination": "764713728396057122", + "label": "ggg", + "source": "1189142882239313116", + "type": "association" + } + ], + "using_namespace": "clanguml::t00028" +} +``` diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index a0fc906d..b2a939e7 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + A - + A class note. - - + + B - + B class note. - - + + C - + C class note. - - + + D - + D class note. - - + + E @@ -64,27 +64,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -94,10 +94,10 @@ three - + F enum note. - + E @@ -105,65 +105,65 @@ int - - + + R - + - + aaa : A - + - + bbb : B * - + - + ccc : C & - + - + ddd : std::vector<std::shared_ptr<D>> - + - + eee : E<int> - + - + ggg : G ** R(C & c) : void - + R class note. - + R contains an instance of A. - + Reference to C. diff --git a/docs/test_cases/t00029.md b/docs/test_cases/t00029.md index fd3386b0..f050f6b1 100644 --- a/docs/test_cases/t00029.md +++ b/docs/test_cases/t00029.md @@ -69,3 +69,239 @@ struct R { ``` ## Generated UML diagrams ![t00029_class](./t00029_class.svg "PlantUML skip decorator test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00029::A", + "id": "1970994826766369014", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00029::C", + "id": "543766389270348470", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "param", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 13 + }, + "type": "T" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 12 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "constants": [ + "one", + "two", + "three" + ], + "display_name": "clanguml::t00029::E", + "id": "1936873082456592219", + "is_nested": false, + "name": "E", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 21 + }, + "type": "enum" + }, + { + "bases": [], + "display_name": "clanguml::t00029::G1", + "id": "1980718063838190763", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G1", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 26 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00029::G2", + "id": "2204627213593766591", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G2", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00029::G3", + "id": "767180516665070631", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G3", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 30 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00029::G4", + "id": "715074622924270214", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G4", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 32 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00029::R", + "id": "348749731659902910", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "g1", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 35 + }, + "type": "clanguml::t00029::G1" + }, + { + "access": "public", + "comment": { + "formatted": "\\uml{skiprelationship}", + "raw": "/// \\uml{skiprelationship}" + }, + "is_static": false, + "name": "g3", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 41 + }, + "type": "clanguml::t00029::G3 &" + }, + { + "access": "public", + "is_static": false, + "name": "g4", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 43 + }, + "type": "std::shared_ptr" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00029", + "source_location": { + "file": "../../tests/t00029/t00029.cc", + "line": 34 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00029_class", + "relationships": [ + { + "access": "public", + "destination": "1980718063838190763", + "label": "g1", + "source": "348749731659902910", + "type": "aggregation" + }, + { + "access": "public", + "destination": "715074622924270214", + "label": "g4", + "source": "348749731659902910", + "type": "association" + } + ], + "using_namespace": "clanguml::t00029" +} +``` diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 37ac1cd7..52a0ca38 100644 --- a/docs/test_cases/t00029_class.svg +++ b/docs/test_cases/t00029_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + A - - + + C @@ -26,16 +26,16 @@ T - + - + param : T - - + + E @@ -45,64 +45,64 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3 & - + - + g4 : std::shared_ptr<G4> diff --git a/docs/test_cases/t00030.md b/docs/test_cases/t00030.md index 235fc4c2..363006df 100644 --- a/docs/test_cases/t00030.md +++ b/docs/test_cases/t00030.md @@ -57,3 +57,247 @@ struct R { ``` ## Generated UML diagrams ![t00030_class](./t00030_class.svg "PlantUML relationship decorators test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00030::A", + "id": "64769484767514424", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00030", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00030::B", + "id": "156923198106222307", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00030", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00030::C", + "id": "1651557398557662399", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00030", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00030::D", + "id": "1089781072752262158", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00030", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00030::E", + "id": "425964641881054607", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00030", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00030::R", + "id": "263468735940481091", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "comment": { + "formatted": "@uml{association[]}", + "raw": "/// @uml{association[]}" + }, + "is_static": false, + "name": "aaa", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 19 + }, + "type": "clanguml::t00030::A" + }, + { + "access": "public", + "comment": { + "formatted": "@uml{composition[0..1:1..*]}", + "raw": "/// @uml{composition[0..1:1..*]}" + }, + "is_static": false, + "name": "bbb", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 22 + }, + "type": "std::vector" + }, + { + "access": "public", + "comment": { + "formatted": "@uml{aggregation[0..1:1..5]}", + "raw": "/// @uml{aggregation[0..1:1..5]}" + }, + "is_static": false, + "name": "ccc", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 25 + }, + "type": "std::vector" + }, + { + "access": "public", + "comment": { + "formatted": "@uml{association[:1]}", + "raw": "/// @uml{association[:1]}" + }, + "is_static": false, + "name": "ddd", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 28 + }, + "type": "clanguml::t00030::D" + }, + { + "access": "public", + "comment": { + "formatted": "@uml{aggregation[:1]}", + "raw": "/// @uml{aggregation[:1]}" + }, + "is_static": false, + "name": "eee", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 31 + }, + "type": "clanguml::t00030::E *" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00030", + "source_location": { + "file": "../../tests/t00030/t00030.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00030_class", + "relationships": [ + { + "access": "public", + "destination": "64769484767514424", + "label": "aaa", + "source": "263468735940481091", + "type": "association" + }, + { + "access": "public", + "destination": "156923198106222307", + "label": "bbb", + "multiplicity_destination": "1..*", + "multiplicity_source": "0..1", + "source": "263468735940481091", + "type": "composition" + }, + { + "access": "public", + "destination": "1651557398557662399", + "label": "ccc", + "multiplicity_destination": "1..5", + "multiplicity_source": "0..1", + "source": "263468735940481091", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1089781072752262158", + "label": "ddd", + "multiplicity_destination": "1", + "source": "263468735940481091", + "type": "association" + }, + { + "access": "public", + "destination": "425964641881054607", + "label": "eee", + "multiplicity_destination": "1", + "source": "263468735940481091", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00030" +} +``` diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index 9f96f86d..d3656053 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,86 +9,86 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + - + eee : E * diff --git a/docs/test_cases/t00031.md b/docs/test_cases/t00031.md index bc874f5a..d45fc832 100644 --- a/docs/test_cases/t00031.md +++ b/docs/test_cases/t00031.md @@ -58,3 +58,256 @@ struct R { ``` ## Generated UML diagrams ![t00031_class](./t00031_class.svg "PlantUML style decorator test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "comment": { + "formatted": "@uml{style[#back:lightgreen|yellow;header:blue/red]}", + "raw": "/// @uml{style[#back:lightgreen|yellow;header:blue/red]}" + }, + "display_name": "clanguml::t00031::A", + "id": "847775539502907247", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00031", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "comment": { + "formatted": "@uml{style[#line.dotted:blue]}", + "raw": "/// @uml{style[#line.dotted:blue]}" + }, + "constants": [ + "one", + "two", + "three" + ], + "display_name": "clanguml::t00031::B", + "id": "1441796358326382179", + "is_nested": false, + "name": "B", + "namespace": "clanguml::t00031", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 11 + }, + "type": "enum" + }, + { + "bases": [], + "comment": { + "formatted": "@uml{style[#pink;line:red;line.bold;text:red]}", + "raw": "/// @uml{style[#pink;line:red;line.bold;text:red]}" + }, + "display_name": "clanguml::t00031::C", + "id": "116209144733282955", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "ttt", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 15 + }, + "type": "T" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00031", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 14 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00031::D", + "id": "2266534344475505157", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00031", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00031::C", + "id": "208700529175860645", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00031", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00031::R", + "id": "484712092364868032", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "comment": { + "formatted": "@uml{style[#red,dashed,thickness=2]}", + "raw": "/// @uml{style[#red,dashed,thickness=2]}" + }, + "is_static": false, + "name": "aaa", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 22 + }, + "type": "clanguml::t00031::A *" + }, + { + "access": "public", + "comment": { + "formatted": "@uml{composition}\n@uml{style[#green,dashed,thickness=4]}", + "raw": "/// @uml{composition}\n /// @uml{style[#green,dashed,thickness=4]}" + }, + "is_static": false, + "name": "bbb", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 26 + }, + "type": "std::vector" + }, + { + "access": "public", + "comment": { + "formatted": "@uml{style[#blue,dotted,thickness=8]}", + "raw": "/// @uml{style[#blue,dotted,thickness=8]}" + }, + "is_static": false, + "name": "ccc", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 29 + }, + "type": "C" + }, + { + "access": "public", + "comment": { + "formatted": "@uml{style[#blue,plain,thickness=16]}", + "raw": "/// @uml{style[#blue,plain,thickness=16]}" + }, + "is_static": false, + "name": "ddd", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 32 + }, + "type": "clanguml::t00031::D *" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00031", + "source_location": { + "file": "../../tests/t00031/t00031.cc", + "line": 20 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00031_class", + "relationships": [ + { + "access": "public", + "destination": "116209144733282955", + "source": "208700529175860645", + "type": "instantiation" + }, + { + "access": "public", + "destination": "847775539502907247", + "label": "aaa", + "source": "484712092364868032", + "type": "association" + }, + { + "access": "public", + "destination": "1441796358326382179", + "label": "bbb", + "source": "484712092364868032", + "type": "composition" + }, + { + "access": "public", + "destination": "208700529175860645", + "label": "ccc", + "source": "484712092364868032", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2266534344475505157", + "label": "ddd", + "source": "484712092364868032", + "type": "association" + } + ], + "using_namespace": "clanguml::t00031" +} +``` diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 5ada614f..facc4534 100644 --- a/docs/test_cases/t00031_class.svg +++ b/docs/test_cases/t00031_class.svg @@ -1,33 +1,33 @@ - + - + - + - - - + + + A - - + + B @@ -37,8 +37,8 @@ three - - + + @@ -47,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032.md b/docs/test_cases/t00032.md index 4e75128e..1525a0b6 100644 --- a/docs/test_cases/t00032.md +++ b/docs/test_cases/t00032.md @@ -58,3 +58,381 @@ struct R { ``` ## Generated UML diagrams ![t00032_class](./t00032_class.svg "Class template with template base classes test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00032::Base", + "id": "1619396229227632210", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Base", + "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00032::TBase", + "id": "543776954602127752", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "TBase", + "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00032::A", + "id": "687909853333071234", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "operator()", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00032::B", + "id": "737235057776029746", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "operator()", + "parameters": [], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00032::C", + "id": "1497964256865073382", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "operator()", + "parameters": [], + "type": "void" + } + ], + "name": "C", + "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1619396229227632210", + "is_virtual": false, + "name": "clanguml::t00032::Base" + } + ], + "display_name": "clanguml::t00032::Overload", + "id": "1463422997970691679", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "counter", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 26 + }, + "type": "L" + } + ], + "methods": [], + "name": "Overload", + "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 24 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "L", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Ts...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "543776954602127752", + "is_virtual": false, + "name": "clanguml::t00032::TBase" + }, + { + "access": "public", + "id": "687909853333071234", + "is_virtual": false, + "name": "clanguml::t00032::A" + }, + { + "access": "public", + "id": "737235057776029746", + "is_virtual": false, + "name": "clanguml::t00032::B" + }, + { + "access": "public", + "id": "1497964256865073382", + "is_virtual": false, + "name": "clanguml::t00032::C" + } + ], + "display_name": "clanguml::t00032::Overload", + "id": "1706455047176879286", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Overload", + "namespace": "clanguml::t00032", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00032::TBase" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00032::A" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00032::B" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00032::C" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00032::R", + "id": "85539867332573320", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "overload", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 32 + }, + "type": "Overload" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00032", + "source_location": { + "file": "../../tests/t00032/t00032.cc", + "line": 31 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00032_class", + "relationships": [ + { + "access": "public", + "destination": "1619396229227632210", + "source": "1463422997970691679", + "type": "extension" + }, + { + "access": "public", + "destination": "543776954602127752", + "source": "1706455047176879286", + "type": "dependency" + }, + { + "access": "public", + "destination": "687909853333071234", + "source": "1706455047176879286", + "type": "dependency" + }, + { + "access": "public", + "destination": "737235057776029746", + "source": "1706455047176879286", + "type": "dependency" + }, + { + "access": "public", + "destination": "1497964256865073382", + "source": "1706455047176879286", + "type": "dependency" + }, + { + "access": "public", + "destination": "1463422997970691679", + "source": "1706455047176879286", + "type": "instantiation" + }, + { + "access": "public", + "destination": "543776954602127752", + "source": "1706455047176879286", + "type": "extension" + }, + { + "access": "public", + "destination": "687909853333071234", + "source": "1706455047176879286", + "type": "extension" + }, + { + "access": "public", + "destination": "737235057776029746", + "source": "1706455047176879286", + "type": "extension" + }, + { + "access": "public", + "destination": "1497964256865073382", + "source": "1706455047176879286", + "type": "extension" + }, + { + "access": "public", + "destination": "1706455047176879286", + "label": "overload", + "source": "85539867332573320", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00032" +} +``` diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index 12fc21eb..e77c395a 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,24 +9,24 @@ - - + + Base - - + + TBase - - + + A @@ -35,8 +35,8 @@ operator()() : void - - + + B @@ -45,8 +45,8 @@ operator()() : void - - + + C @@ -55,8 +55,8 @@ operator()() : void - - + + Overload @@ -64,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033.md b/docs/test_cases/t00033.md index 800398db..afce35dc 100644 --- a/docs/test_cases/t00033.md +++ b/docs/test_cases/t00033.md @@ -50,3 +50,338 @@ struct R { ``` ## Generated UML diagrams ![t00033_class](./t00033_class.svg "Nested template instantiation dependency test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00033::A", + "id": "2036031998980633871", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "aaa", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 8 + }, + "type": "T" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00033", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 7 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00033::B", + "id": "765515233845859023", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "bbb", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 12 + }, + "type": "T" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00033", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 11 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00033::C", + "id": "1436835384265552869", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "ccc", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 16 + }, + "type": "T" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00033", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 15 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00033::D", + "id": "2199581366769423637", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "ddd", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 20 + }, + "type": "int" + } + ], + "methods": [], + "name": "D", + "namespace": "clanguml::t00033", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00033::C", + "id": "1609446044604054241", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00033", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00033::D" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00033::B>>", + "id": "384927316081978893", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00033", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00033::D" + } + ], + "type": "clanguml::t00033::C" + } + ], + "type": "std::unique_ptr" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00033::A>>>", + "id": "1747493965420341251", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00033", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00033::D" + } + ], + "type": "clanguml::t00033::C" + } + ], + "type": "std::unique_ptr" + } + ], + "type": "clanguml::t00033::B" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00033::R", + "id": "1866392706312766470", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "abc", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 24 + }, + "type": "A>>>" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00033", + "source_location": { + "file": "../../tests/t00033/t00033.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00033_class", + "relationships": [ + { + "access": "public", + "destination": "2199581366769423637", + "source": "1609446044604054241", + "type": "dependency" + }, + { + "access": "public", + "destination": "1436835384265552869", + "source": "1609446044604054241", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1609446044604054241", + "source": "384927316081978893", + "type": "dependency" + }, + { + "access": "public", + "destination": "765515233845859023", + "source": "384927316081978893", + "type": "instantiation" + }, + { + "access": "public", + "destination": "384927316081978893", + "source": "1747493965420341251", + "type": "dependency" + }, + { + "access": "public", + "destination": "2036031998980633871", + "source": "1747493965420341251", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1747493965420341251", + "label": "abc", + "source": "1866392706312766470", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00033" +} +``` diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 38853689..09e71d53 100644 --- a/docs/test_cases/t00033_class.svg +++ b/docs/test_cases/t00033_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + aaa : T - - + + B @@ -35,16 +35,16 @@ T - + - + bbb : T - - + + C @@ -52,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034.md b/docs/test_cases/t00034.md index 5e2acd46..15da7587 100644 --- a/docs/test_cases/t00034.md +++ b/docs/test_cases/t00034.md @@ -76,3 +76,258 @@ struct R { ``` ## Generated UML diagrams ![t00034_class](./t00034_class.svg "Template metaprogramming type function test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00034::Void", + "id": "1704456490210873213", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "operator==", + "parameters": [ + { + "name": "", + "type": "const clanguml::t00034::Void &" + } + ], + "type": "bool" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "operator!=", + "parameters": [ + { + "name": "", + "type": "const clanguml::t00034::Void &" + } + ], + "type": "bool" + } + ], + "name": "Void", + "namespace": "clanguml::t00034", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00034::lift_void", + "id": "867472442996685316", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "lift_void", + "namespace": "clanguml::t00034", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 16 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00034::lift_void", + "id": "126450862226197239", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "lift_void", + "namespace": "clanguml::t00034", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 20 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "void" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00034::drop_void", + "id": "1578745816100337706", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "drop_void", + "namespace": "clanguml::t00034", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 33 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00034::drop_void", + "id": "1849836134504075115", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "drop_void", + "namespace": "clanguml::t00034", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 37 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00034::Void" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00034::A", + "id": "1383912907884688827", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00034", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 43 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00034::R", + "id": "1713991735741265309", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "la", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 46 + }, + "type": "lift_void_t *" + }, + { + "access": "public", + "is_static": false, + "name": "lv", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 47 + }, + "type": "lift_void_t *" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00034", + "source_location": { + "file": "../../tests/t00034/t00034.cc", + "line": 45 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00034_class", + "relationships": [ + { + "access": "public", + "destination": "867472442996685316", + "source": "126450862226197239", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1578745816100337706", + "source": "1849836134504075115", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1383912907884688827", + "label": "la", + "source": "1713991735741265309", + "type": "association" + } + ], + "using_namespace": "clanguml::t00034" +} +``` diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index 23e59f9b..f02f85e3 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Void @@ -21,8 +21,8 @@ operator!=(const Void & ) const : bool - - + + lift_void @@ -31,8 +31,8 @@ - - + + lift_void @@ -41,8 +41,8 @@ - - + + drop_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,33 +61,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035.md b/docs/test_cases/t00035.md index e8acaa28..b2220472 100644 --- a/docs/test_cases/t00035.md +++ b/docs/test_cases/t00035.md @@ -43,3 +43,114 @@ struct Right { }; ``` ## Generated UML diagrams ![t00035_class](./t00035_class.svg "PlantUML class diagram layout hints test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00035::Top", + "id": "2241062883697294772", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Top", + "namespace": "clanguml::t00035", + "source_location": { + "file": "../../tests/t00035/t00035.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00035::Left", + "id": "242562856080127946", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Left", + "namespace": "clanguml::t00035", + "source_location": { + "file": "../../tests/t00035/t00035.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00035::Center", + "id": "1933304541849408421", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Center", + "namespace": "clanguml::t00035", + "source_location": { + "file": "../../tests/t00035/t00035.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00035::Bottom", + "id": "1646691079607377420", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Bottom", + "namespace": "clanguml::t00035", + "source_location": { + "file": "../../tests/t00035/t00035.cc", + "line": 10 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00035::Right", + "id": "200121820090372322", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "Right", + "namespace": "clanguml::t00035", + "source_location": { + "file": "../../tests/t00035/t00035.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00035_class", + "relationships": [], + "using_namespace": "clanguml::t00035" +} +``` diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 48572509..46fdda44 100644 --- a/docs/test_cases/t00035_class.svg +++ b/docs/test_cases/t00035_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + Top - - + + Left - - + + Center - - + + Bottom - - + + Right diff --git a/docs/test_cases/t00036.md b/docs/test_cases/t00036.md index 82661f6c..cda15954 100644 --- a/docs/test_cases/t00036.md +++ b/docs/test_cases/t00036.md @@ -56,3 +56,191 @@ struct C { }; ``` ## Generated UML diagrams ![t00036_class](./t00036_class.svg "Class diagram with namespaces generated as packages") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "display_name": "clanguml::t00036::ns1", + "elements": [ + { + "constants": [ + "blue", + "yellow" + ], + "display_name": "clanguml::t00036::ns1::E", + "id": "2144761953049158478", + "is_nested": false, + "name": "E", + "namespace": "clanguml::t00036::ns1", + "source_location": { + "file": "../../tests/t00036/t00036.cc", + "line": 6 + }, + "type": "enum" + }, + { + "display_name": "clanguml::t00036::ns1::ns11", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00036::ns1::ns11::A", + "id": "571573305652194946", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00036/t00036.cc", + "line": 11 + }, + "type": "T" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00036::ns1::ns11", + "source_location": { + "file": "../../tests/t00036/t00036.cc", + "line": 10 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "display_name": "clanguml::t00036::ns1::ns11::ns111", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00036::ns1::ns11::ns111::B", + "id": "1964031933563607376", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a_int", + "source_location": { + "file": "../../tests/t00036/t00036.cc", + "line": 17 + }, + "type": "A" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00036::ns1::ns11::ns111", + "source_location": { + "file": "../../tests/t00036/t00036.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "ns111", + "type": "namespace" + }, + { + "bases": [], + "display_name": "clanguml::t00036::ns1::ns11::A", + "id": "1832710427462319797", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00036::ns1::ns11", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + } + ], + "name": "ns11", + "type": "namespace" + } + ], + "name": "ns1", + "type": "namespace" + }, + { + "display_name": "clanguml::t00036::ns2", + "elements": [ + { + "display_name": "clanguml::t00036::ns2::ns22", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00036::ns2::ns22::C", + "id": "2038956882066165590", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00036::ns2::ns22", + "source_location": { + "file": "../../tests/t00036/t00036.cc", + "line": 28 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "ns22", + "type": "namespace" + } + ], + "name": "ns2", + "type": "namespace" + } + ], + "name": "t00036_class", + "relationships": [ + { + "access": "public", + "destination": "1832710427462319797", + "label": "a_int", + "source": "1964031933563607376", + "type": "aggregation" + }, + { + "access": "public", + "destination": "571573305652194946", + "source": "1832710427462319797", + "type": "instantiation" + } + ], + "using_namespace": "clanguml::t00036" +} +``` diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg index 9764d5ee..4f66b033 100644 --- a/docs/test_cases/t00036_class.svg +++ b/docs/test_cases/t00036_class.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - + ns1 - + ns11 - + ns111 - + ns2 - + ns22 - - + + E @@ -34,8 +34,8 @@ yellow - - + + A @@ -43,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037.md b/docs/test_cases/t00037.md index 0f251d01..013df5a3 100644 --- a/docs/test_cases/t00037.md +++ b/docs/test_cases/t00037.md @@ -55,3 +55,223 @@ struct A { ``` ## Generated UML diagrams ![t00037_class](./t00037_class.svg "Anonymous nested struct test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00037::ST", + "id": "11203041379038775", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "dimensions", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 11 + }, + "type": "ST##(anonymous_662)" + }, + { + "access": "private", + "is_static": false, + "name": "units", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 17 + }, + "type": "ST##(anonymous_792)" + } + ], + "methods": [], + "name": "ST", + "namespace": "clanguml::t00037", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00037::ST::(dimensions)", + "id": "1980820317972901050", + "is_abstract": false, + "is_nested": true, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 7 + }, + "type": "double" + }, + { + "access": "public", + "is_static": false, + "name": "x", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 8 + }, + "type": "double" + }, + { + "access": "public", + "is_static": false, + "name": "y", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 9 + }, + "type": "double" + }, + { + "access": "public", + "is_static": false, + "name": "z", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 10 + }, + "type": "double" + } + ], + "methods": [], + "name": "ST::(dimensions)", + "namespace": "clanguml::t00037", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00037::ST::(units)", + "id": "1811145508890403377", + "is_abstract": false, + "is_nested": true, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 15 + }, + "type": "double" + }, + { + "access": "public", + "is_static": false, + "name": "h", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 16 + }, + "type": "double" + } + ], + "methods": [], + "name": "ST::(units)", + "namespace": "clanguml::t00037", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00037::A", + "id": "1322794181774144954", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "st", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 29 + }, + "type": "clanguml::t00037::ST" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "A", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00037", + "source_location": { + "file": "../../tests/t00037/t00037.cc", + "line": 20 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00037_class", + "relationships": [ + { + "access": "public", + "destination": "1980820317972901050", + "label": "dimensions", + "source": "11203041379038775", + "type": "aggregation" + }, + { + "access": "private", + "destination": "1811145508890403377", + "label": "units", + "source": "11203041379038775", + "type": "aggregation" + }, + { + "access": "public", + "destination": "11203041379038775", + "label": "st", + "source": "1322794181774144954", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00037" +} +``` diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 98c6f40c..0ae3edcf 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,98 +9,98 @@ - - + + ST - + - + dimensions : ST::(anonymous_662) - + - + units : ST::(anonymous_792) - - + + ST::(dimensions) - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + ST::(units) - + - + c : double - + - + h : double - - + + A - + - + st : ST diff --git a/docs/test_cases/t00038.md b/docs/test_cases/t00038.md index 850e0e30..9024497c 100644 --- a/docs/test_cases/t00038.md +++ b/docs/test_cases/t00038.md @@ -74,3 +74,480 @@ struct map", + "id": "1917560728132448300", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "map", + "namespace": "clanguml::t00038", + "source_location": { + "file": "../../tests/t00038/t00038.cc", + "line": 30 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1642222718760881014", + "is_virtual": false, + "name": "thirdparty::ns1::E" + } + ], + "display_name": "clanguml::t00038::map>", + "id": "1664022047310891203", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "map", + "namespace": "clanguml::t00038", + "source_location": { + "file": "../../tests/t00038/t00038.cc", + "line": 34 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "thirdparty::ns1::color_t" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "thirdparty::ns1::color_t::red" + } + ], + "type": "std::integral_constant" + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "790040432414172612", + "is_virtual": false, + "name": "clanguml::t00038::A" + } + ], + "display_name": "clanguml::t00038::map>", + "id": "307700801045535833", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "map", + "namespace": "clanguml::t00038", + "source_location": { + "file": "../../tests/t00038/t00038.cc", + "line": 37 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00038::property_t" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00038::property_t::property_a" + } + ], + "type": "std::integral_constant" + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1295970068907562690", + "is_virtual": false, + "name": "clanguml::t00038::B" + } + ], + "display_name": "clanguml::t00038::map>>", + "id": "548231528417484191", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "map", + "namespace": "clanguml::t00038", + "source_location": { + "file": "../../tests/t00038/t00038.cc", + "line": 41 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00038::property_t" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00038::property_t::property_b" + } + ], + "type": "std::integral_constant" + } + ], + "type": "std::vector" + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "154510361779680983", + "is_virtual": false, + "name": "clanguml::t00038::C" + } + ], + "display_name": "clanguml::t00038::map>>>", + "id": "1510200402118706005", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "map", + "namespace": "clanguml::t00038", + "source_location": { + "file": "../../tests/t00038/t00038.cc", + "line": 46 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00038::key_t" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00038::property_t" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00038::property_t::property_c" + } + ], + "type": "std::integral_constant" + } + ], + "type": "std::vector" + } + ], + "type": "std::map" + } + ], + "type": "class" + } + ], + "name": "t00038_class", + "relationships": [ + { + "access": "public", + "destination": "566782399856868761", + "source": "1664022047310891203", + "type": "dependency" + }, + { + "access": "public", + "destination": "1917560728132448300", + "source": "1664022047310891203", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1642222718760881014", + "source": "1664022047310891203", + "type": "extension" + }, + { + "access": "public", + "destination": "7376951310260829", + "source": "307700801045535833", + "type": "dependency" + }, + { + "access": "public", + "destination": "1917560728132448300", + "source": "307700801045535833", + "type": "instantiation" + }, + { + "access": "public", + "destination": "790040432414172612", + "source": "307700801045535833", + "type": "extension" + }, + { + "access": "public", + "destination": "7376951310260829", + "source": "548231528417484191", + "type": "dependency" + }, + { + "access": "public", + "destination": "1917560728132448300", + "source": "548231528417484191", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1295970068907562690", + "source": "548231528417484191", + "type": "extension" + }, + { + "access": "public", + "destination": "137163683637529037", + "source": "1510200402118706005", + "type": "dependency" + }, + { + "access": "public", + "destination": "7376951310260829", + "source": "1510200402118706005", + "type": "dependency" + }, + { + "access": "public", + "destination": "1917560728132448300", + "source": "1510200402118706005", + "type": "instantiation" + }, + { + "access": "public", + "destination": "154510361779680983", + "source": "1510200402118706005", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00038" +} +``` diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index 5a3ec793..e30d120a 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + thirdparty::ns1::color_t @@ -20,16 +20,16 @@ blue - - + + thirdparty::ns1::E - - + + property_t @@ -39,47 +39,47 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - + - + key : std::string - - + + map @@ -88,8 +88,8 @@ - - + + map @@ -98,8 +98,8 @@ - - + + map @@ -108,8 +108,8 @@ - - + + map @@ -118,8 +118,8 @@ - - + + map diff --git a/docs/test_cases/t00039.md b/docs/test_cases/t00039.md index 28f54d8c..3f4eb548 100644 --- a/docs/test_cases/t00039.md +++ b/docs/test_cases/t00039.md @@ -89,3 +89,574 @@ template struct FFF : public FF { ``` ## Generated UML diagrams ![t00039_class](./t00039_class.svg "Subclass class diagram filter test") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00039::C", + "id": "241234977032861936", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00039::D", + "id": "1975187139659616784", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00039::E", + "id": "1959131184346890363", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 10 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "241234977032861936", + "is_virtual": false, + "name": "clanguml::t00039::C" + }, + { + "access": "public", + "id": "1975187139659616784", + "is_virtual": false, + "name": "clanguml::t00039::D" + } + ], + "display_name": "clanguml::t00039::CD", + "id": "850483622527996929", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "CD", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1975187139659616784", + "is_virtual": false, + "name": "clanguml::t00039::D" + }, + { + "access": "public", + "id": "1959131184346890363", + "is_virtual": false, + "name": "clanguml::t00039::E" + } + ], + "display_name": "clanguml::t00039::DE", + "id": "1316022308303681160", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "DE", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "241234977032861936", + "is_virtual": false, + "name": "clanguml::t00039::C" + }, + { + "access": "public", + "id": "1975187139659616784", + "is_virtual": false, + "name": "clanguml::t00039::D" + }, + { + "access": "public", + "id": "1959131184346890363", + "is_virtual": false, + "name": "clanguml::t00039::E" + } + ], + "display_name": "clanguml::t00039::CDE", + "id": "1877487144594774465", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "CDE", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 20 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00039::A", + "id": "1051171525946759825", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1051171525946759825", + "is_virtual": false, + "name": "clanguml::t00039::A" + } + ], + "display_name": "clanguml::t00039::AA", + "id": "1761969273600680013", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AA", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 24 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1761969273600680013", + "is_virtual": false, + "name": "clanguml::t00039::AA" + } + ], + "display_name": "clanguml::t00039::AAA", + "id": "2158483243842147804", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 27 + }, + "type": "clanguml::t00039::B *" + } + ], + "methods": [], + "name": "AAA", + "namespace": "clanguml::t00039", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 26 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2158483243842147804", + "is_virtual": true, + "name": "clanguml::t00039::AAA" + } + ], + "display_name": "clanguml::t00039::ns2::AAAA", + "id": "1857294881176816154", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AAAA", + "namespace": "clanguml::t00039::ns2", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 31 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00039::ns3::F", + "id": "955785395599769805", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 40 + }, + "type": "T *" + } + ], + "methods": [], + "name": "F", + "namespace": "clanguml::t00039::ns3", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 39 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "955785395599769805", + "is_virtual": false, + "name": "F" + } + ], + "display_name": "clanguml::t00039::ns3::FF", + "id": "1321996888067531304", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "m", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 44 + }, + "type": "M *" + } + ], + "methods": [], + "name": "FF", + "namespace": "clanguml::t00039::ns3", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 43 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "M", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "955785395599769805", + "is_virtual": false, + "name": "F" + } + ], + "display_name": "clanguml::t00039::ns3::FE", + "id": "2008055732881129924", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "m", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 48 + }, + "type": "M *" + } + ], + "methods": [], + "name": "FE", + "namespace": "clanguml::t00039::ns3", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 47 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "M", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1321996888067531304", + "is_virtual": false, + "name": "FF" + } + ], + "display_name": "clanguml::t00039::ns3::FFF", + "id": "1617455840736919039", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "n", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 52 + }, + "type": "N *" + } + ], + "methods": [], + "name": "FFF", + "namespace": "clanguml::t00039::ns3", + "source_location": { + "file": "../../tests/t00039/t00039.cc", + "line": 51 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "M", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "N", + "template_parameters": [] + } + ], + "type": "class" + } + ], + "name": "t00039_class", + "relationships": [ + { + "access": "public", + "destination": "241234977032861936", + "source": "850483622527996929", + "type": "extension" + }, + { + "access": "public", + "destination": "1975187139659616784", + "source": "850483622527996929", + "type": "extension" + }, + { + "access": "public", + "destination": "1975187139659616784", + "source": "1316022308303681160", + "type": "extension" + }, + { + "access": "public", + "destination": "1959131184346890363", + "source": "1316022308303681160", + "type": "extension" + }, + { + "access": "public", + "destination": "241234977032861936", + "source": "1877487144594774465", + "type": "extension" + }, + { + "access": "public", + "destination": "1975187139659616784", + "source": "1877487144594774465", + "type": "extension" + }, + { + "access": "public", + "destination": "1959131184346890363", + "source": "1877487144594774465", + "type": "extension" + }, + { + "access": "public", + "destination": "1051171525946759825", + "source": "1761969273600680013", + "type": "extension" + }, + { + "access": "public", + "destination": "247983380974491424", + "label": "b", + "source": "2158483243842147804", + "type": "association" + }, + { + "access": "public", + "destination": "1761969273600680013", + "source": "2158483243842147804", + "type": "extension" + }, + { + "access": "public", + "destination": "2158483243842147804", + "source": "1857294881176816154", + "type": "extension" + }, + { + "access": "public", + "destination": "955785395599769805", + "source": "1321996888067531304", + "type": "extension" + }, + { + "access": "public", + "destination": "955785395599769805", + "source": "2008055732881129924", + "type": "extension" + }, + { + "access": "public", + "destination": "1321996888067531304", + "source": "1617455840736919039", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00039" +} +``` diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index c2f7d303..5fd6e339 100644 --- a/docs/test_cases/t00039_class.svg +++ b/docs/test_cases/t00039_class.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - + + C - - + + D - - + + E - - + + CD - - + + DE - - + + CDE - - + + A - - + + AA - - + + AAA - + - + b : B * - - + + ns2::AAAA - - + + ns3::F @@ -105,16 +105,16 @@ T - + - + t : T * - - + + ns3::FF @@ -122,16 +122,16 @@ T,M - + - + m : M * - - + + ns3::FE @@ -139,16 +139,16 @@ T,M - + - + m : M * - - + + ns3::FFF @@ -156,11 +156,11 @@ T,M,N - + - + n : N * diff --git a/docs/test_cases/t00040.md b/docs/test_cases/t00040.md index 717561b9..744b2123 100644 --- a/docs/test_cases/t00040.md +++ b/docs/test_cases/t00040.md @@ -65,3 +65,225 @@ struct R { ``` ## Generated UML diagrams ![t00040_class](./t00040_class.svg "Relationship and access filter test") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00040::A", + "id": "307580006083737677", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "protected", + "is_static": false, + "name": "ii_", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 10 + }, + "type": "int" + }, + { + "access": "private", + "is_static": false, + "name": "hidden_a_", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 15 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_a", + "parameters": [], + "type": "int" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00040", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "307580006083737677", + "is_virtual": false, + "name": "clanguml::t00040::A" + } + ], + "display_name": "clanguml::t00040::AA", + "id": "534115812779766127", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AA", + "namespace": "clanguml::t00040", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "534115812779766127", + "is_virtual": false, + "name": "clanguml::t00040::AA" + } + ], + "display_name": "clanguml::t00040::AAA", + "id": "745371908432158369", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 25 + }, + "type": "clanguml::t00040::B *" + }, + { + "access": "private", + "is_static": false, + "name": "hidden_aaa_", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 28 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_aaa", + "parameters": [], + "type": "int" + } + ], + "name": "AAA", + "namespace": "clanguml::t00040", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00040::R", + "id": "1539035020975101539", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [ + { + "name": "a", + "type": "clanguml::t00040::A *" + } + ], + "type": "void" + } + ], + "name": "R", + "namespace": "clanguml::t00040", + "source_location": { + "file": "../../tests/t00040/t00040.cc", + "line": 31 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00040_class", + "relationships": [ + { + "access": "public", + "destination": "307580006083737677", + "source": "534115812779766127", + "type": "extension" + }, + { + "access": "public", + "destination": "534115812779766127", + "source": "745371908432158369", + "type": "extension" + }, + { + "access": "public", + "destination": "307580006083737677", + "source": "1539035020975101539", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t00040" +} +``` diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index e38717b0..03a18891 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + - + ii_ : int get_a() : int - - + + AA - - + + AAA - + - + b : B * get_aaa() : int - - + + R diff --git a/docs/test_cases/t00041.md b/docs/test_cases/t00041.md index 01ec9d8d..64df9137 100644 --- a/docs/test_cases/t00041.md +++ b/docs/test_cases/t00041.md @@ -76,3 +76,334 @@ struct NM : public N { }; ``` ## Generated UML diagrams ![t00041_class](./t00041_class.svg "Context diagram filter test") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00041::R", + "id": "775317088453163919", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "R", + "namespace": "clanguml::t00041", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00041::D", + "id": "1798851434286108347", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "rr", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 14 + }, + "type": "clanguml::t00041::RR *" + } + ], + "methods": [], + "name": "D", + "namespace": "clanguml::t00041", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00041::E", + "id": "2158730167547707264", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00041", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00041::F", + "id": "430600213408545846", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "clanguml::t00041", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "775317088453163919", + "is_virtual": false, + "name": "clanguml::t00041::R" + } + ], + "display_name": "clanguml::t00041::RR", + "id": "175608867682236642", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "e", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 28 + }, + "type": "clanguml::t00041::E *" + }, + { + "access": "public", + "is_static": false, + "name": "f", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 29 + }, + "type": "clanguml::t00041::F *" + }, + { + "access": "public", + "is_static": false, + "name": "g", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 30 + }, + "type": "detail::G *" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [ + { + "name": "h", + "type": "clanguml::t00041::H *" + } + ], + "type": "void" + } + ], + "name": "RR", + "namespace": "clanguml::t00041", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "175608867682236642", + "is_virtual": false, + "name": "clanguml::t00041::RR" + } + ], + "display_name": "clanguml::t00041::RRR", + "id": "819254010294444715", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "RRR", + "namespace": "clanguml::t00041", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 35 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00041::ns1::N", + "id": "220253364661036147", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "N", + "namespace": "clanguml::t00041::ns1", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 38 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "220253364661036147", + "is_virtual": false, + "name": "clanguml::t00041::ns1::N" + } + ], + "display_name": "clanguml::t00041::ns1::NN", + "id": "618038667214398895", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "NN", + "namespace": "clanguml::t00041::ns1", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 40 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "220253364661036147", + "is_virtual": false, + "name": "clanguml::t00041::ns1::N" + } + ], + "display_name": "clanguml::t00041::ns1::NM", + "id": "1206750351408617127", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "NM", + "namespace": "clanguml::t00041::ns1", + "source_location": { + "file": "../../tests/t00041/t00041.cc", + "line": 42 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00041_class", + "relationships": [ + { + "access": "public", + "destination": "175608867682236642", + "label": "rr", + "source": "1798851434286108347", + "type": "association" + }, + { + "access": "public", + "destination": "648827958379389524", + "source": "175608867682236642", + "type": "dependency" + }, + { + "access": "public", + "destination": "2158730167547707264", + "label": "e", + "source": "175608867682236642", + "type": "association" + }, + { + "access": "public", + "destination": "430600213408545846", + "label": "f", + "source": "175608867682236642", + "type": "association" + }, + { + "access": "public", + "destination": "775317088453163919", + "source": "175608867682236642", + "type": "extension" + }, + { + "access": "public", + "destination": "175608867682236642", + "source": "819254010294444715", + "type": "extension" + }, + { + "access": "public", + "destination": "220253364661036147", + "source": "618038667214398895", + "type": "extension" + }, + { + "access": "public", + "destination": "220253364661036147", + "source": "1206750351408617127", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00041" +} +``` diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index 6e80efb7..bc96a619 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,102 +9,102 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * foo(H * h) : void - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042.md b/docs/test_cases/t00042.md index 65bf767e..228b9a48 100644 --- a/docs/test_cases/t00042.md +++ b/docs/test_cases/t00042.md @@ -61,3 +61,233 @@ struct R { ``` ## Generated UML diagrams ![t00042_class](./t00042_class.svg "Specialization class template diagram filter test") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00042::A", + "id": "462160951579835462", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 6 + }, + "type": "T" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00042", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 5 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00042::A", + "id": "1422802342059669545", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00042", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 9 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "void" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00042::B", + "id": "1414456934388678010", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 14 + }, + "type": "T" + }, + { + "access": "public", + "is_static": false, + "name": "bb", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 15 + }, + "type": "K" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00042", + "source_location": { + "file": "../../tests/t00042/t00042.cc", + "line": 13 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "K", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00042::A", + "id": "364538479078826988", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00042", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "double" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00042::A", + "id": "496773262538580186", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00042", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00042::B", + "id": "1833471931530161359", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00042", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "float" + } + ], + "type": "class" + } + ], + "name": "t00042_class", + "relationships": [ + { + "access": "public", + "destination": "462160951579835462", + "source": "1422802342059669545", + "type": "instantiation" + }, + { + "access": "public", + "destination": "462160951579835462", + "source": "364538479078826988", + "type": "instantiation" + }, + { + "access": "public", + "destination": "462160951579835462", + "source": "496773262538580186", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1414456934388678010", + "source": "1833471931530161359", + "type": "instantiation" + } + ], + "using_namespace": "clanguml::t00042" +} +``` diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index fdfc3357..5ad739eb 100644 --- a/docs/test_cases/t00042_class.svg +++ b/docs/test_cases/t00042_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + a : T - - + + A @@ -36,8 +36,8 @@ - - + + B @@ -45,22 +45,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -68,7 +68,7 @@ double - + A @@ -76,7 +76,7 @@ std::string - + B diff --git a/docs/test_cases/t00043.md b/docs/test_cases/t00043.md index 5f6aa811..0075df73 100644 --- a/docs/test_cases/t00043.md +++ b/docs/test_cases/t00043.md @@ -80,3 +80,487 @@ struct J { ``` ## Generated UML diagrams ![t00043_class](./t00043_class.svg "Dependants and dependencies class diagram filter test") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "display_name": "clanguml::t00043::dependants", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00043::dependants::A", + "id": "1454679300998460550", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00043::dependants", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependants::B", + "id": "1972977265990430931", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "b", + "parameters": [ + { + "name": "a", + "type": "clanguml::t00043::dependants::A *" + } + ], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00043::dependants", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependants::BB", + "id": "1906291555025945295", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "bb", + "parameters": [ + { + "name": "a", + "type": "clanguml::t00043::dependants::A *" + } + ], + "type": "void" + } + ], + "name": "BB", + "namespace": "clanguml::t00043::dependants", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 10 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependants::C", + "id": "823759225351121534", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "c", + "parameters": [ + { + "name": "b", + "type": "clanguml::t00043::dependants::B *" + } + ], + "type": "void" + } + ], + "name": "C", + "namespace": "clanguml::t00043::dependants", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependants::D", + "id": "2277976215348279426", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "d", + "parameters": [ + { + "name": "c", + "type": "clanguml::t00043::dependants::C *" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "dd", + "parameters": [ + { + "name": "bb", + "type": "clanguml::t00043::dependants::BB *" + } + ], + "type": "void" + } + ], + "name": "D", + "namespace": "clanguml::t00043::dependants", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependants::E", + "id": "1694685540293810116", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "e", + "parameters": [ + { + "name": "d", + "type": "clanguml::t00043::dependants::D *" + } + ], + "type": "void" + } + ], + "name": "E", + "namespace": "clanguml::t00043::dependants", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "dependants", + "type": "namespace" + }, + { + "display_name": "clanguml::t00043::dependencies", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00043::dependencies::G", + "id": "736400571183204899", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00043::dependencies", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 32 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependencies::GG", + "id": "1522297681294871411", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "GG", + "namespace": "clanguml::t00043::dependencies", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 34 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependencies::H", + "id": "1534191494825314170", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "h", + "parameters": [ + { + "name": "g", + "type": "clanguml::t00043::dependencies::G *" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "hh", + "parameters": [ + { + "name": "gg", + "type": "clanguml::t00043::dependencies::GG *" + } + ], + "type": "void" + } + ], + "name": "H", + "namespace": "clanguml::t00043::dependencies", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 36 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependencies::I", + "id": "97422543769740359", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "i", + "parameters": [ + { + "name": "h", + "type": "clanguml::t00043::dependencies::H *" + } + ], + "type": "void" + } + ], + "name": "I", + "namespace": "clanguml::t00043::dependencies", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 45 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00043::dependencies::J", + "id": "1498530043106438011", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "i", + "parameters": [ + { + "name": "i", + "type": "clanguml::t00043::dependencies::I *" + } + ], + "type": "void" + } + ], + "name": "J", + "namespace": "clanguml::t00043::dependencies", + "source_location": { + "file": "../../tests/t00043/t00043.cc", + "line": 49 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "dependencies", + "type": "namespace" + } + ], + "name": "t00043_class", + "relationships": [ + { + "access": "public", + "destination": "1454679300998460550", + "source": "1972977265990430931", + "type": "dependency" + }, + { + "access": "public", + "destination": "1454679300998460550", + "source": "1906291555025945295", + "type": "dependency" + }, + { + "access": "public", + "destination": "1972977265990430931", + "source": "823759225351121534", + "type": "dependency" + }, + { + "access": "public", + "destination": "823759225351121534", + "source": "2277976215348279426", + "type": "dependency" + }, + { + "access": "public", + "destination": "1906291555025945295", + "source": "2277976215348279426", + "type": "dependency" + }, + { + "access": "public", + "destination": "2277976215348279426", + "source": "1694685540293810116", + "type": "dependency" + }, + { + "access": "public", + "destination": "736400571183204899", + "source": "1534191494825314170", + "type": "dependency" + }, + { + "access": "public", + "destination": "1522297681294871411", + "source": "1534191494825314170", + "type": "dependency" + }, + { + "access": "public", + "destination": "1534191494825314170", + "source": "97422543769740359", + "type": "dependency" + }, + { + "access": "public", + "destination": "97422543769740359", + "source": "1498530043106438011", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t00043" +} +``` diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 151d49ca..2aeb44aa 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - + dependants - + dependencies - - + + A - - + + B @@ -33,8 +33,8 @@ b(dependants::A * a) : void - - + + BB @@ -43,8 +43,8 @@ bb(dependants::A * a) : void - - + + C @@ -53,8 +53,8 @@ c(dependants::B * b) : void - - + + D @@ -65,8 +65,8 @@ dd(dependants::BB * bb) : void - - + + E @@ -75,24 +75,24 @@ e(dependants::D * d) : void - - + + G - - + + GG - - + + H @@ -103,8 +103,8 @@ hh(dependencies::GG * gg) : void - - + + I @@ -113,8 +113,8 @@ i(dependencies::H * h) : void - - + + J diff --git a/docs/test_cases/t00044.md b/docs/test_cases/t00044.md index 8ca9b898..37c66420 100644 --- a/docs/test_cases/t00044.md +++ b/docs/test_cases/t00044.md @@ -56,3 +56,160 @@ sink sink1{int_handler}; ``` ## Generated UML diagrams ![t00044_class](./t00044_class.svg "Test case for inner type aliases with parent class template args") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00044::sink>", + "id": "1813783008369291713", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "sink", + "namespace": "clanguml::t00044", + "source_location": { + "file": "../../tests/t00044/t00044.cc", + "line": 10 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "type-parameter-0-2" + } + ], + "type": "clanguml::t00044::signal_handler" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00044::signal_handler", + "id": "1591729735727316875", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "signal_handler", + "namespace": "clanguml::t00044", + "source_location": { + "file": "../../tests/t00044/t00044.cc", + "line": 24 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "Ret(Args...)", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "A", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00044::signal_handler", + "id": "276594465967577895", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "signal_handler", + "namespace": "clanguml::t00044", + "source_location": { + "file": "../../tests/t00044/t00044.cc", + "line": 7 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "A", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00044::sink", + "id": "1759724482769288325", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "sink", + "namespace": "clanguml::t00044", + "source_location": { + "file": "../../tests/t00044/t00044.cc", + "line": 5 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + } + ], + "name": "t00044_class", + "relationships": [ + { + "access": "public", + "destination": "1759724482769288325", + "source": "1813783008369291713", + "type": "instantiation" + }, + { + "access": "public", + "destination": "276594465967577895", + "source": "1591729735727316875", + "type": "instantiation" + } + ], + "using_namespace": "clanguml::t00044" +} +``` diff --git a/docs/test_cases/t00044_class.svg b/docs/test_cases/t00044_class.svg index 24b17829..383fe537 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + sink @@ -19,8 +19,8 @@ - - + + signal_handler @@ -29,8 +29,8 @@ - - + + signal_handler @@ -39,8 +39,8 @@ - - + + sink diff --git a/docs/test_cases/t00045.md b/docs/test_cases/t00045.md index b3d0c1fe..eeb254af 100644 --- a/docs/test_cases/t00045.md +++ b/docs/test_cases/t00045.md @@ -62,3 +62,424 @@ public: ``` ## Generated UML diagrams ![t00045_class](./t00045_class.svg "Test case for root namespace handling") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "A", + "id": "864916647665253425", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 1 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "AA", + "id": "386872828559902182", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AA", + "namespace": "", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 3 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "AAA", + "id": "54164402597771463", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AAA", + "namespace": "", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "AAAA", + "id": "375905626569465019", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 8 + }, + "type": "T" + } + ], + "methods": [], + "name": "AAAA", + "namespace": "", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 7 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "ns1::A", + "id": "619642232943663499", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "ns1", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "ns1::ns2::A", + "id": "2207007194029669343", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2207007194029669343", + "is_virtual": false, + "name": "ns1::ns2::A" + } + ], + "display_name": "ns1::ns2::B", + "id": "204051985124373077", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 19 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "619642232943663499", + "is_virtual": false, + "name": "ns1::A" + } + ], + "display_name": "ns1::ns2::C", + "id": "1837009554564742531", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 21 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2207007194029669343", + "is_virtual": false, + "name": "ns1::ns2::A" + } + ], + "display_name": "ns1::ns2::D", + "id": "2029929560931799980", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "864916647665253425", + "is_virtual": false, + "name": "A" + } + ], + "display_name": "ns1::ns2::E", + "id": "2305358535757579772", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 25 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "ns1::ns2::AAA", + "id": "1731264248793686366", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AAA", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 27 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "ns1::ns2::R", + "id": "974430595320588991", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 31 + }, + "type": "ns1::ns2::A *" + }, + { + "access": "public", + "is_static": false, + "name": "ns1_a", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 32 + }, + "type": "ns1::A *" + }, + { + "access": "public", + "is_static": false, + "name": "ns1_ns2_a", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 33 + }, + "type": "ns1::ns2::A *" + }, + { + "access": "public", + "is_static": false, + "name": "root_a", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 34 + }, + "type": "::A *" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [ + { + "name": "aa", + "type": "::AA &" + } + ], + "type": "void" + } + ], + "name": "R", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00045/t00045.cc", + "line": 29 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00045_class", + "relationships": [ + { + "access": "public", + "destination": "2207007194029669343", + "source": "204051985124373077", + "type": "extension" + }, + { + "access": "public", + "destination": "619642232943663499", + "source": "1837009554564742531", + "type": "extension" + }, + { + "access": "public", + "destination": "2207007194029669343", + "source": "2029929560931799980", + "type": "extension" + }, + { + "access": "public", + "destination": "864916647665253425", + "source": "2305358535757579772", + "type": "extension" + }, + { + "access": "public", + "destination": "386872828559902182", + "source": "974430595320588991", + "type": "dependency" + }, + { + "access": "public", + "destination": "2207007194029669343", + "label": "a", + "source": "974430595320588991", + "type": "association" + }, + { + "access": "public", + "destination": "619642232943663499", + "label": "ns1_a", + "source": "974430595320588991", + "type": "association" + }, + { + "access": "public", + "destination": "2207007194029669343", + "label": "ns1_ns2_a", + "source": "974430595320588991", + "type": "association" + }, + { + "access": "public", + "destination": "864916647665253425", + "label": "root_a", + "source": "974430595320588991", + "type": "association" + }, + { + "access": "public", + "destination": "54164402597771463", + "label": "<>", + "source": "974430595320588991", + "type": "friendship" + } + ] +} +``` diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index a1546c15..d1c17cb5 100644 --- a/docs/test_cases/t00045_class.svg +++ b/docs/test_cases/t00045_class.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + A - - + + AA - - + + AAA - - + + AAAA @@ -42,103 +42,103 @@ T - + - + t : T - - + + ns1::A - - + + ns1::ns2::A - - + + ns1::ns2::B - - + + ns1::ns2::C - - + + ns1::ns2::D - - + + ns1::ns2::E - - + + ns1::ns2::AAA - - + + ns1::ns2::R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * diff --git a/docs/test_cases/t00046.md b/docs/test_cases/t00046.md index 1b531293..84d0df44 100644 --- a/docs/test_cases/t00046.md +++ b/docs/test_cases/t00046.md @@ -55,3 +55,368 @@ public: ``` ## Generated UML diagrams ![t00046_class](./t00046_class.svg "Test case for root namespace handling with packages") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "display_name": "__gnu_cxx", + "name": "__gnu_cxx", + "type": "namespace" + }, + { + "bases": [], + "display_name": "A", + "id": "864916647665253425", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "AA", + "id": "386872828559902182", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "AA", + "namespace": "", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "display_name": "ns1", + "elements": [ + { + "bases": [], + "display_name": "ns1::A", + "id": "619642232943663499", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "ns1", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 10 + }, + "template_parameters": [], + "type": "class" + }, + { + "display_name": "ns1::ns2", + "elements": [ + { + "bases": [], + "display_name": "ns1::ns2::A", + "id": "2207007194029669343", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2207007194029669343", + "is_virtual": false, + "name": "ns1::ns2::A" + } + ], + "display_name": "ns1::ns2::B", + "id": "204051985124373077", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "619642232943663499", + "is_virtual": false, + "name": "ns1::A" + } + ], + "display_name": "ns1::ns2::C", + "id": "1837009554564742531", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "2207007194029669343", + "is_virtual": false, + "name": "ns1::ns2::A" + } + ], + "display_name": "ns1::ns2::D", + "id": "2029929560931799980", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 20 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "864916647665253425", + "is_virtual": false, + "name": "A" + } + ], + "display_name": "ns1::ns2::E", + "id": "2305358535757579772", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "ns1::ns2::R", + "id": "974430595320588991", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 26 + }, + "type": "ns1::ns2::A *" + }, + { + "access": "public", + "is_static": false, + "name": "ns1_a", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 27 + }, + "type": "ns1::A *" + }, + { + "access": "public", + "is_static": false, + "name": "ns1_ns2_a", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 28 + }, + "type": "ns1::ns2::A *" + }, + { + "access": "public", + "is_static": false, + "name": "root_a", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 29 + }, + "type": "::A *" + }, + { + "access": "public", + "is_static": false, + "name": "i", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 30 + }, + "type": "std::vector" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [ + { + "name": "aa", + "type": "::AA &" + } + ], + "type": "void" + } + ], + "name": "R", + "namespace": "ns1::ns2", + "source_location": { + "file": "../../tests/t00046/t00046.cc", + "line": 24 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "ns2", + "type": "namespace" + } + ], + "name": "ns1", + "type": "namespace" + } + ], + "name": "t00046_class", + "relationships": [ + { + "access": "public", + "destination": "2207007194029669343", + "source": "204051985124373077", + "type": "extension" + }, + { + "access": "public", + "destination": "619642232943663499", + "source": "1837009554564742531", + "type": "extension" + }, + { + "access": "public", + "destination": "2207007194029669343", + "source": "2029929560931799980", + "type": "extension" + }, + { + "access": "public", + "destination": "864916647665253425", + "source": "2305358535757579772", + "type": "extension" + }, + { + "access": "public", + "destination": "386872828559902182", + "source": "974430595320588991", + "type": "dependency" + }, + { + "access": "public", + "destination": "2207007194029669343", + "label": "a", + "source": "974430595320588991", + "type": "association" + }, + { + "access": "public", + "destination": "619642232943663499", + "label": "ns1_a", + "source": "974430595320588991", + "type": "association" + }, + { + "access": "public", + "destination": "2207007194029669343", + "label": "ns1_ns2_a", + "source": "974430595320588991", + "type": "association" + }, + { + "access": "public", + "destination": "864916647665253425", + "label": "root_a", + "source": "974430595320588991", + "type": "association" + } + ] +} +``` diff --git a/docs/test_cases/t00046_class.svg b/docs/test_cases/t00046_class.svg index 52da4a40..2ec4900a 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047.md b/docs/test_cases/t00047.md index ce7656a0..bc8b76b7 100644 --- a/docs/test_cases/t00047.md +++ b/docs/test_cases/t00047.md @@ -45,3 +45,165 @@ using conditional = typename conditional_t::type; ``` ## Generated UML diagrams ![t00047_class](./t00047_class.svg "Test case for recursive variadic template") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00047::conditional_t", + "id": "47394280824625133", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "conditional_t", + "namespace": "clanguml::t00047", + "source_location": { + "file": "../../tests/t00047/t00047.cc", + "line": 8 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "Else", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00047::conditional_t", + "id": "599782159389775809", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "conditional_t", + "namespace": "clanguml::t00047", + "source_location": { + "file": "../../tests/t00047/t00047.cc", + "line": 13 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::true_type" + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "Result", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Tail...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00047::conditional_t", + "id": "824938194184364511", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "conditional_t", + "namespace": "clanguml::t00047", + "source_location": { + "file": "../../tests/t00047/t00047.cc", + "line": 18 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::false_type" + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "Result", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Tail...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00047::conditional_t", + "id": "1673692992642087414", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "conditional_t", + "namespace": "clanguml::t00047", + "source_location": { + "file": "../../tests/t00047/t00047.cc", + "line": 6 + }, + "template_parameters": [ + { + "is_variadic": true, + "kind": "template_type", + "name": "Ts...", + "template_parameters": [] + } + ], + "type": "class" + } + ], + "name": "t00047_class", + "relationships": [ + { + "access": "public", + "destination": "1673692992642087414", + "source": "47394280824625133", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1673692992642087414", + "source": "599782159389775809", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1673692992642087414", + "source": "824938194184364511", + "type": "instantiation" + } + ], + "using_namespace": "clanguml::t00047" +} +``` diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 291ef34a..354cefea 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + conditional_t @@ -19,8 +19,8 @@ - - + + conditional_t @@ -29,8 +29,8 @@ - - + + conditional_t @@ -39,8 +39,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048.md b/docs/test_cases/t00048.md index 9a78f499..d8c4cfbe 100644 --- a/docs/test_cases/t00048.md +++ b/docs/test_cases/t00048.md @@ -122,3 +122,352 @@ template struct BaseTemplate { ``` ## Generated UML diagrams ![t00048_class](./t00048_class.svg "Test case for unique entity id with multiple translation units") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00048::Base", + "id": "10200626899013233", + "is_abstract": true, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "base", + "source_location": { + "file": "../../tests/t00048/t00048.h", + "line": 7 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "Base", + "namespace": "clanguml::t00048", + "source_location": { + "file": "../../tests/t00048/t00048.h", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00048::BaseTemplate", + "id": "630197772543569536", + "is_abstract": true, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "base", + "source_location": { + "file": "../../tests/t00048/t00048.h", + "line": 13 + }, + "type": "T" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": true, + "is_static": false, + "is_virtual": true, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "BaseTemplate", + "namespace": "clanguml::t00048", + "source_location": { + "file": "../../tests/t00048/t00048.h", + "line": 12 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "10200626899013233", + "is_virtual": false, + "name": "clanguml::t00048::Base" + } + ], + "display_name": "clanguml::t00048::B", + "id": "59336049758992190", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00048/b_t00048.h", + "line": 9 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00048", + "source_location": { + "file": "../../tests/t00048/b_t00048.h", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "630197772543569536", + "is_virtual": false, + "name": "BaseTemplate" + } + ], + "display_name": "clanguml::t00048::BTemplate", + "id": "1635850649347735305", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00048/b_t00048.h", + "line": 15 + }, + "type": "T" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "BTemplate", + "namespace": "clanguml::t00048", + "source_location": { + "file": "../../tests/t00048/b_t00048.h", + "line": 14 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "10200626899013233", + "is_virtual": false, + "name": "clanguml::t00048::Base" + } + ], + "display_name": "clanguml::t00048::A", + "id": "199333691834211223", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00048/a_t00048.h", + "line": 9 + }, + "type": "int" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": true, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00048", + "source_location": { + "file": "../../tests/t00048/a_t00048.h", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "630197772543569536", + "is_virtual": false, + "name": "BaseTemplate" + } + ], + "display_name": "clanguml::t00048::ATemplate", + "id": "1025697108404463905", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00048/a_t00048.h", + "line": 15 + }, + "type": "T" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "foo", + "parameters": [], + "type": "void" + } + ], + "name": "ATemplate", + "namespace": "clanguml::t00048", + "source_location": { + "file": "../../tests/t00048/a_t00048.h", + "line": 14 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + } + ], + "name": "t00048_class", + "relationships": [ + { + "access": "public", + "destination": "10200626899013233", + "source": "59336049758992190", + "type": "extension" + }, + { + "access": "public", + "destination": "630197772543569536", + "source": "1635850649347735305", + "type": "extension" + }, + { + "access": "public", + "destination": "10200626899013233", + "source": "199333691834211223", + "type": "extension" + }, + { + "access": "public", + "destination": "630197772543569536", + "source": "1025697108404463905", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00048" +} +``` diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 48029937..e8b4fca0 100644 --- a/docs/test_cases/t00048_class.svg +++ b/docs/test_cases/t00048_class.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + Base - + - + base : int foo() = 0 : void - - + + BaseTemplate @@ -35,35 +35,35 @@ T - + - + base : T foo() = 0 : void - - + + B - + - + b : int foo() : void - - + + BTemplate @@ -71,35 +71,35 @@ T - + - + b : T foo() : void - - + + A - + - + a : int foo() : void - - + + ATemplate @@ -107,11 +107,11 @@ T - + - + a : T diff --git a/docs/test_cases/t00049.md b/docs/test_cases/t00049.md index ba4bfbe2..2b2ffc70 100644 --- a/docs/test_cases/t00049.md +++ b/docs/test_cases/t00049.md @@ -48,3 +48,261 @@ struct R { ``` ## Generated UML diagrams ![t00049_class](./t00049_class.svg "Test case configurable type aliases") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00049::A", + "id": "372971769516871577", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 8 + }, + "type": "T" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_a", + "parameters": [], + "type": "T &" + } + ], + "name": "A", + "namespace": "clanguml::t00049", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 7 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00049::A", + "id": "654829353386288443", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00049", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "intmap" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00049::A", + "id": "973058255816844469", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00049", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "thestring" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00049::A", + "id": "562074851310302010", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00049", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "string_vector" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00049::R", + "id": "2288024073053091226", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a_string", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 14 + }, + "type": "A>" + }, + { + "access": "public", + "is_static": false, + "name": "a_vector_string", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 15 + }, + "type": "A>" + }, + { + "access": "public", + "is_static": false, + "name": "a_int_map", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 16 + }, + "type": "A>" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_int_map", + "parameters": [], + "type": "clanguml::t00049::A>" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "set_int_map", + "parameters": [ + { + "name": "int_map", + "type": "clanguml::t00049::A> &&" + } + ], + "type": "void" + } + ], + "name": "R", + "namespace": "clanguml::t00049", + "source_location": { + "file": "../../tests/t00049/t00049.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00049_class", + "relationships": [ + { + "access": "public", + "destination": "372971769516871577", + "source": "654829353386288443", + "type": "instantiation" + }, + { + "access": "public", + "destination": "372971769516871577", + "source": "973058255816844469", + "type": "instantiation" + }, + { + "access": "public", + "destination": "372971769516871577", + "source": "562074851310302010", + "type": "instantiation" + }, + { + "access": "public", + "destination": "654829353386288443", + "source": "2288024073053091226", + "type": "dependency" + }, + { + "access": "public", + "destination": "973058255816844469", + "label": "a_string", + "source": "2288024073053091226", + "type": "aggregation" + }, + { + "access": "public", + "destination": "562074851310302010", + "label": "a_vector_string", + "source": "2288024073053091226", + "type": "aggregation" + }, + { + "access": "public", + "destination": "654829353386288443", + "label": "a_int_map", + "source": "2288024073053091226", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00049" +} +``` diff --git a/docs/test_cases/t00049_class.svg b/docs/test_cases/t00049_class.svg index 92482219..1f800654 100644 --- a/docs/test_cases/t00049_class.svg +++ b/docs/test_cases/t00049_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ string_vector - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050.md b/docs/test_cases/t00050.md index 7110fa96..046d4a41 100644 --- a/docs/test_cases/t00050.md +++ b/docs/test_cases/t00050.md @@ -182,3 +182,309 @@ class NoComment { }; ``` ## Generated UML diagrams ![t00050_class](./t00050_class.svg "Test case for generating notes from comments using jinja templates") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "comment": { + "formatted": "Lorem ipsum dolor sit", + "paragraph": [ + " Lorem ipsum dolor sit\n" + ], + "raw": "/// Lorem ipsum dolor sit", + "text": "\n Lorem ipsum dolor sit\n" + }, + "display_name": "clanguml::t00050::A", + "id": "1885563213397742674", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00050", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "comment": { + "brief": [ + " Lorem ipsum\n" + ], + "formatted": "\n \\brief Lorem ipsum\n\n Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n tellus ligula porttitor metus.\n\n \\todo 1. Write meaningful comment\n \\todo 2. Write tests\n \\todo 3. Implement\n ", + "paragraph": [ + " \n", + " Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n tellus ligula porttitor metus.\n", + " \n" + ], + "raw": "/**\n * \\brief Lorem ipsum\n *\n * Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n * vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n * Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n * integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n * tellus ligula porttitor metus.\n *\n * \\todo 1. Write meaningful comment\n * \\todo 2. Write tests\n * \\todo 3. Implement\n */", + "text": "\n \n\n Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n tellus ligula porttitor metus.\n\n \n", + "todo": [ + " 1. Write meaningful comment\n \n", + " 2. Write tests\n \n", + " 3. Implement\n" + ] + }, + "display_name": "clanguml::t00050::B", + "id": "500262098409836244", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00050", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 24 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "comment": { + "brief": [ + " Long comment example\n" + ], + "formatted": "\\brief Long comment example\n\nLorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\nvehicula class ultricies mollis dictumst, aenean non a in donec nulla.\nPhasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\ninteger placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\ntellus ligula porttitor metus.\n\nVivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\neuismod libero facilisi aptent elementum felis blandit cursus gravida sociis\nerat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\nad. Massa curae fringilla porttitor quam sollicitudin iaculis aptent leo\nligula euismod dictumst, orci penatibus mauris eros etiam praesent erat\nvolutpat posuere hac. Metus fringilla nec ullamcorper odio aliquam lacinia\nconubia mauris tempor, etiam ultricies proin quisque lectus sociis id\ntristique, integer phasellus taciti pretium adipiscing tortor sagittis\nligula.\n\nMollis pretium lorem primis senectus habitasse lectus scelerisque\ndonec, ultricies tortor suspendisse adipiscing fusce morbi volutpat\npellentesque, consectetur mi risus molestie curae malesuada cum. Dignissim\nlacus convallis massa mauris enim ad mattis magnis senectus montes, mollis\ntaciti phasellus accumsan bibendum semper blandit suspendisse faucibus nibh\nest, metus lobortis morbi cras magna vivamus per risus fermentum. Dapibus\nimperdiet praesent magnis ridiculus congue gravida curabitur dictum\nsagittis, enim et magna sit inceptos sodales parturient pharetra mollis,\naenean vel nostra tellus commodo pretium sapien sociosqu.", + "paragraph": [ + " \n", + " Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n tellus ligula porttitor metus.\n", + " Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad. Massa curae fringilla porttitor quam sollicitudin iaculis aptent leo\n ligula euismod dictumst, orci penatibus mauris eros etiam praesent erat\n volutpat posuere hac. Metus fringilla nec ullamcorper odio aliquam lacinia\n conubia mauris tempor, etiam ultricies proin quisque lectus sociis id\n tristique, integer phasellus taciti pretium adipiscing tortor sagittis\n ligula.\n", + " Mollis pretium lorem primis senectus habitasse lectus scelerisque\n donec, ultricies tortor suspendisse adipiscing fusce morbi volutpat\n pellentesque, consectetur mi risus molestie curae malesuada cum. Dignissim\n lacus convallis massa mauris enim ad mattis magnis senectus montes, mollis\n taciti phasellus accumsan bibendum semper blandit suspendisse faucibus nibh\n est, metus lobortis morbi cras magna vivamus per risus fermentum. Dapibus\n imperdiet praesent magnis ridiculus congue gravida curabitur dictum\n sagittis, enim et magna sit inceptos sodales parturient pharetra mollis,\n aenean vel nostra tellus commodo pretium sapien sociosqu.\n" + ], + "raw": "/// \\brief Long comment example\n///\n/// Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n/// vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n/// Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n/// integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n/// tellus ligula porttitor metus.\n///\n/// Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n/// euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n/// erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n/// ad. Massa curae fringilla porttitor quam sollicitudin iaculis aptent leo\n/// ligula euismod dictumst, orci penatibus mauris eros etiam praesent erat\n/// volutpat posuere hac. Metus fringilla nec ullamcorper odio aliquam lacinia\n/// conubia mauris tempor, etiam ultricies proin quisque lectus sociis id\n/// tristique, integer phasellus taciti pretium adipiscing tortor sagittis\n/// ligula.\n///\n/// Mollis pretium lorem primis senectus habitasse lectus scelerisque\n/// donec, ultricies tortor suspendisse adipiscing fusce morbi volutpat\n/// pellentesque, consectetur mi risus molestie curae malesuada cum. Dignissim\n/// lacus convallis massa mauris enim ad mattis magnis senectus montes, mollis\n/// taciti phasellus accumsan bibendum semper blandit suspendisse faucibus nibh\n/// est, metus lobortis morbi cras magna vivamus per risus fermentum. Dapibus\n/// imperdiet praesent magnis ridiculus congue gravida curabitur dictum\n/// sagittis, enim et magna sit inceptos sodales parturient pharetra mollis,\n/// aenean vel nostra tellus commodo pretium sapien sociosqu.", + "text": "\n \n\n Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n tellus ligula porttitor metus.\n\n Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,\n euismod libero facilisi aptent elementum felis blandit cursus gravida sociis\n erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est\n ad. Massa curae fringilla porttitor quam sollicitudin iaculis aptent leo\n ligula euismod dictumst, orci penatibus mauris eros etiam praesent erat\n volutpat posuere hac. Metus fringilla nec ullamcorper odio aliquam lacinia\n conubia mauris tempor, etiam ultricies proin quisque lectus sociis id\n tristique, integer phasellus taciti pretium adipiscing tortor sagittis\n ligula.\n\n Mollis pretium lorem primis senectus habitasse lectus scelerisque\n donec, ultricies tortor suspendisse adipiscing fusce morbi volutpat\n pellentesque, consectetur mi risus molestie curae malesuada cum. Dignissim\n lacus convallis massa mauris enim ad mattis magnis senectus montes, mollis\n taciti phasellus accumsan bibendum semper blandit suspendisse faucibus nibh\n est, metus lobortis morbi cras magna vivamus per risus fermentum. Dapibus\n imperdiet praesent magnis ridiculus congue gravida curabitur dictum\n sagittis, enim et magna sit inceptos sodales parturient pharetra mollis,\n aenean vel nostra tellus commodo pretium sapien sociosqu.\n" + }, + "display_name": "clanguml::t00050::C", + "id": "1663081653671078922", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00050", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 53 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\nvehicula class ultricies mollis dictumst, aenean non a in donec nulla.\nPhasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\ninteger placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\ntellus ligula porttitor metus.\n\n\\todo Implement...", + "paragraph": [ + " Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n tellus ligula porttitor metus.\n", + " \n" + ], + "raw": "/// Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n/// vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n/// Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n/// integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n/// tellus ligula porttitor metus.\n///\n/// \\todo Implement...", + "text": "\n Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis\n vehicula class ultricies mollis dictumst, aenean non a in donec nulla.\n Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,\n integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora\n tellus ligula porttitor metus.\n\n \n", + "todo": [ + " Implement...\n" + ] + }, + "display_name": "clanguml::t00050::utils::D", + "id": "1492514566602019299", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00050::utils", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 65 + }, + "template_parameters": [], + "type": "class" + }, + { + "comment": { + "formatted": "Mollis pretium lorem primis", + "paragraph": [ + " Mollis pretium lorem primis\n" + ], + "raw": "/// Mollis pretium lorem primis", + "text": "\n Mollis pretium lorem primis\n" + }, + "constants": [ + "E1", + "E2", + "E3" + ], + "display_name": "clanguml::t00050::E", + "id": "2027344031570117998", + "is_nested": false, + "name": "E", + "namespace": "clanguml::t00050", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 70 + }, + "type": "enum" + }, + { + "bases": [], + "comment": { + "brief": [ + " Simple array wrapper.\n" + ], + "formatted": "\\brief Simple array wrapper.\n\nThis class is just for testing tparam parsing, it serves no other\npurpose.\n\n\\tparam T Type of array elements.\n\\tparam V Type of regular element.\n\\tparam N Size of T array.", + "paragraph": [ + " \n", + " This class is just for testing tparam parsing, it serves no other\n purpose.\n", + " \n" + ], + "raw": "/// \\brief Simple array wrapper.\n///\n/// This class is just for testing tparam parsing, it serves no other\n/// purpose.\n///\n/// \\tparam T Type of array elements.\n/// \\tparam V Type of regular element.\n/// \\tparam N Size of T array.\n///", + "text": "\n \n\n This class is just for testing tparam parsing, it serves no other\n purpose.\n\n \n", + "tparam": [ + { + "description": " Type of array elements.\n \n", + "name": "T" + }, + { + "description": " Type of regular element.\n \n", + "name": "V" + }, + { + "description": " Size of T array.\n", + "name": "N" + } + ] + }, + "display_name": "clanguml::t00050::F", + "id": "793698410848959592", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "private", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 82 + }, + "type": "T[N]" + }, + { + "access": "private", + "is_static": false, + "name": "v", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 83 + }, + "type": "V" + } + ], + "methods": [], + "name": "F", + "namespace": "clanguml::t00050", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 81 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "V", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "non_type_template", + "name": "N", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "comment": { + "formatted": "This is a short description of class G.\n\nThis is an intermediate description of class G.\n\nThis is a long description of class G.", + "paragraph": [ + " This is a short description of class G.\n", + " This is an intermediate description of class G.\n", + " This is a long description of class G.\n" + ], + "raw": "/// This is a short description of class G.\n///\n/// This is an intermediate description of class G.\n///\n/// This is a long description of class G.", + "text": "\n This is a short description of class G.\n\n This is an intermediate description of class G.\n\n This is a long description of class G.\n" + }, + "display_name": "clanguml::t00050::G", + "id": "449485154531299941", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00050", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 91 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00050::NoComment", + "id": "1832693799357996932", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "NoComment", + "namespace": "clanguml::t00050", + "source_location": { + "file": "../../tests/t00050/t00050.cc", + "line": 93 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00050_class", + "relationships": [], + "using_namespace": "clanguml::t00050" +} +``` diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index ff20ac50..1941b0b9 100644 --- a/docs/test_cases/t00050_class.svg +++ b/docs/test_cases/t00050_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + utils::D - - + + E @@ -52,8 +52,8 @@ E3 - - + + F @@ -61,44 +61,44 @@ T,V,int N - + - + t : T[N] - + - + v : V - - + + G - - + + NoComment - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies mollis dictumst, aenean non a in donec nulla. @@ -125,50 +125,50 @@ imperdiet praesent magnis ridiculus congue gravida curabitur dictum sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, aenean vel nostra tellus commodo pretium sapien sociosqu. - + This is a short description of class G. - + This is an intermediate description of class G. - + This is a long description of class G. - + Lorem ipsum - + TODO 1. Write meaningful comment - + TODO 2. Write tests - + TODO 3. Implement - + Long comment example - + TODO Implement... - + Simple array wrapper. - + Template parameters diff --git a/docs/test_cases/t00051.md b/docs/test_cases/t00051.md index cb6b1e66..27937a57 100644 --- a/docs/test_cases/t00051.md +++ b/docs/test_cases/t00051.md @@ -84,3 +84,374 @@ A::custom_thread2 A::start_thread2() ``` ## Generated UML diagrams ![t00051_class](./t00051_class.svg "Test case for relative paths in lambda names") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [ + { + "access": "private", + "id": "1911564114172366679", + "is_virtual": false, + "name": "std::thread" + } + ], + "display_name": "clanguml::t00051::B", + "id": "486675674447050206", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "f_", + "source_location": { + "file": "../../tests/t00051/t00051.cc", + "line": 16 + }, + "type": "F" + }, + { + "access": "public", + "is_static": false, + "name": "ff_", + "source_location": { + "file": "../../tests/t00051/t00051.cc", + "line": 17 + }, + "type": "FF" + } + ], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "B", + "parameters": [ + { + "name": "f", + "type": "F &&" + }, + { + "name": "ff", + "type": "FF &&" + } + ], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "f", + "parameters": [], + "type": "void" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "ff", + "parameters": [], + "type": "void" + } + ], + "name": "B", + "namespace": "clanguml::t00051", + "source_location": { + "file": "../../tests/t00051/t00051.cc", + "line": 6 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "F", + "template_parameters": [] + }, + { + "default": "F", + "is_variadic": false, + "kind": "template_type", + "name": "FF", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "private", + "id": "1911564114172366679", + "is_virtual": false, + "name": "std::thread" + } + ], + "display_name": "clanguml::t00051::B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)>", + "id": "129489662928342298", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00051", + "source_location": { + "file": "../../tests/t00051/t00051.cc", + "line": 6 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "(lambda at ../../tests/t00051/t00051.cc:43:18)" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "(lambda at ../../tests/t00051/t00051.cc:43:27)" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00051::A", + "id": "1064663612772326174", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": true, + "is_virtual": false, + "name": "start_thread1", + "parameters": [], + "type": "clanguml::t00051::A::custom_thread1" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": true, + "is_virtual": false, + "name": "start_thread2", + "parameters": [], + "type": "clanguml::t00051::A::custom_thread2" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "start_thread3", + "parameters": [], + "type": "clanguml::t00051::B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)>" + }, + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_function", + "parameters": [], + "type": "(lambda at ../../tests/t00051/t00051.cc:48:16)" + } + ], + "name": "A", + "namespace": "clanguml::t00051", + "source_location": { + "file": "../../tests/t00051/t00051.cc", + "line": 20 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "private", + "id": "1911564114172366679", + "is_virtual": false, + "name": "std::thread" + } + ], + "display_name": "clanguml::t00051::A::custom_thread1", + "id": "267762118222214764", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "custom_thread1", + "parameters": [ + { + "name": "f", + "type": "Function &&" + }, + { + "name": "args", + "type": "Args &&..." + } + ], + "type": "void" + } + ], + "name": "A::custom_thread1", + "namespace": "clanguml::t00051", + "source_location": { + "file": "../../tests/t00051/t00051.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "private", + "id": "1911564114172366679", + "is_virtual": false, + "name": "std::thread" + } + ], + "display_name": "clanguml::t00051::A::custom_thread2", + "id": "728501319748477470", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "thread", + "parameters": [ + { + "name": "", + "type": "(lambda at ../../tests/t00051/t00051.cc:59:27) &&" + } + ], + "type": "void" + } + ], + "name": "A::custom_thread2", + "namespace": "clanguml::t00051", + "source_location": { + "file": "../../tests/t00051/t00051.cc", + "line": 35 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00051_class", + "relationships": [ + { + "access": "private", + "destination": "1911564114172366679", + "source": "486675674447050206", + "type": "extension" + }, + { + "access": "public", + "destination": "486675674447050206", + "source": "129489662928342298", + "type": "instantiation" + }, + { + "access": "private", + "destination": "1911564114172366679", + "source": "129489662928342298", + "type": "extension" + }, + { + "access": "public", + "destination": "129489662928342298", + "source": "1064663612772326174", + "type": "dependency" + }, + { + "access": "public", + "destination": "1064663612772326174", + "source": "267762118222214764", + "type": "containment" + }, + { + "access": "private", + "destination": "1911564114172366679", + "source": "267762118222214764", + "type": "extension" + }, + { + "access": "public", + "destination": "1064663612772326174", + "source": "728501319748477470", + "type": "containment" + }, + { + "access": "private", + "destination": "1911564114172366679", + "source": "728501319748477470", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00051" +} +``` diff --git a/docs/test_cases/t00051_class.svg b/docs/test_cases/t00051_class.svg index df0ab88a..ce6fa271 100644 --- a/docs/test_cases/t00051_class.svg +++ b/docs/test_cases/t00051_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + B @@ -18,18 +18,18 @@ F,FF=F - + - + f_ : F - + - + ff_ : FF @@ -39,16 +39,16 @@ f() : void ff() : void - - + + B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> - - + + A @@ -63,8 +63,8 @@ get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) - - + + A::custom_thread1 @@ -73,8 +73,8 @@ custom_thread1<Function,Args...>(Function && f, Args &&... args) : void - - + + A::custom_thread2 diff --git a/docs/test_cases/t00052.md b/docs/test_cases/t00052.md index 206f049e..e4edb209 100644 --- a/docs/test_cases/t00052.md +++ b/docs/test_cases/t00052.md @@ -55,3 +55,315 @@ struct R { ``` ## Generated UML diagrams ![t00052_class](./t00052_class.svg "Test case for template methods rendering") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00052::A", + "id": "2200853067459698271", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "a", + "parameters": [ + { + "name": "p", + "type": "T" + } + ], + "type": "T" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "aa", + "parameters": [ + { + "name": "f", + "type": "F &&" + }, + { + "name": "q", + "type": "Q" + } + ], + "type": "void" + } + ], + "name": "A", + "namespace": "clanguml::t00052", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00052::B", + "id": "1737293776724790064", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "b", + "parameters": [ + { + "name": "t", + "type": "T" + } + ], + "type": "T" + }, + { + "access": "public", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "bb", + "parameters": [ + { + "name": "f", + "type": "F &&" + }, + { + "name": "t", + "type": "T" + } + ], + "type": "T" + } + ], + "name": "B", + "namespace": "clanguml::t00052", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 13 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00052::C", + "id": "687756639884832524", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "private", + "is_const": false, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "c", + "parameters": [ + { + "name": "p", + "type": "P" + } + ], + "type": "T" + } + ], + "name": "C", + "namespace": "clanguml::t00052", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 20 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00052::B", + "id": "1043027222809675776", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00052", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00052::C", + "id": "492968837554438176", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00052", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00052::R", + "id": "1157978668683299226", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 30 + }, + "type": "clanguml::t00052::A" + }, + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 31 + }, + "type": "B" + }, + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 32 + }, + "type": "C" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00052", + "source_location": { + "file": "../../tests/t00052/t00052.cc", + "line": 29 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00052_class", + "relationships": [ + { + "access": "public", + "destination": "1737293776724790064", + "source": "1043027222809675776", + "type": "instantiation" + }, + { + "access": "public", + "destination": "687756639884832524", + "source": "492968837554438176", + "type": "instantiation" + }, + { + "access": "public", + "destination": "2200853067459698271", + "label": "a", + "source": "1157978668683299226", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1043027222809675776", + "label": "b", + "source": "1157978668683299226", + "type": "aggregation" + }, + { + "access": "public", + "destination": "492968837554438176", + "label": "c", + "source": "1157978668683299226", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00052" +} +``` diff --git a/docs/test_cases/t00052_class.svg b/docs/test_cases/t00052_class.svg index fc42ddc9..edb6b1d6 100644 --- a/docs/test_cases/t00052_class.svg +++ b/docs/test_cases/t00052_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ aa<F,Q>(F && f, Q q) : void - - + + B @@ -35,8 +35,8 @@ bb<F>(F && f, T t) : T - - + + C @@ -47,7 +47,7 @@ c<P>(P p) : T - + B @@ -55,7 +55,7 @@ int - + C @@ -63,32 +63,32 @@ int - - + + R - + - + a : A - + - + b : B<int> - + - + c : C<int> diff --git a/docs/test_cases/t00053.md b/docs/test_cases/t00053.md index 24e04454..a157614e 100644 --- a/docs/test_cases/t00053.md +++ b/docs/test_cases/t00053.md @@ -52,3 +52,339 @@ enum class j { jjj }; ``` ## Generated UML diagrams ![t00053_class](./t00053_class.svg "Test case for `together` layout hint in class diagram") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00053::a", + "id": "347629837292519144", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "a", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 3 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::b", + "id": "1376344645244260547", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "b", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::c", + "id": "504463801094568803", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "c", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::d", + "id": "1264455164862224089", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "d", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::e", + "id": "907921963776939609", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "e", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::f", + "id": "1421289128664274084", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "f", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::g", + "id": "200227126708762001", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "g", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::A", + "id": "322642841130459425", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::B", + "id": "876623970071162908", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::C", + "id": "1248473990784124468", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 13 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::D", + "id": "470228045297785394", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::E", + "id": "1038384764221361257", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::F", + "id": "530253748811039667", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 16 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00053::G", + "id": "1031614323468823578", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 17 + }, + "template_parameters": [], + "type": "class" + }, + { + "constants": [ + "hhh" + ], + "display_name": "clanguml::t00053::h", + "id": "190978367074032185", + "is_nested": false, + "name": "h", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 19 + }, + "type": "enum" + }, + { + "constants": [ + "iii" + ], + "display_name": "clanguml::t00053::i", + "id": "1473214620883985930", + "is_nested": false, + "name": "i", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 20 + }, + "type": "enum" + }, + { + "constants": [ + "jjj" + ], + "display_name": "clanguml::t00053::j", + "id": "965083605473661435", + "is_nested": false, + "name": "j", + "namespace": "clanguml::t00053", + "source_location": { + "file": "../../tests/t00053/t00053.cc", + "line": 21 + }, + "type": "enum" + } + ], + "name": "t00053_class", + "relationships": [], + "using_namespace": "clanguml::t00053" +} +``` diff --git a/docs/test_cases/t00053_class.svg b/docs/test_cases/t00053_class.svg index d47d42e5..69100fba 100644 --- a/docs/test_cases/t00053_class.svg +++ b/docs/test_cases/t00053_class.svg @@ -1,6 +1,6 @@ - + @@ -9,72 +9,72 @@ - - + + A - - + + C - - + + E - - + + F - - + + a - - + + c - - + + e - - + + f - - + + h @@ -82,8 +82,8 @@ hhh - - + + j @@ -91,56 +91,56 @@ jjj - - + + b - - + + d - - + + g - - + + B - - + + D - - + + G - - + + i diff --git a/docs/test_cases/t00054.md b/docs/test_cases/t00054.md index 4563343c..cd368dc6 100644 --- a/docs/test_cases/t00054.md +++ b/docs/test_cases/t00054.md @@ -66,3 +66,367 @@ enum class j { jjj }; ``` ## Generated UML diagrams ![t00054_class](./t00054_class.svg "Test case for `together` layout hint in class diagram with rendered namespaces") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00054::a", + "id": "1158868779503074564", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "a", + "namespace": "clanguml::t00054", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 3 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00054::b", + "id": "252416999805673718", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "b", + "namespace": "clanguml::t00054", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "display_name": "clanguml::t00054::detail", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00054::detail::c", + "id": "1168031834662719964", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "c", + "namespace": "clanguml::t00054::detail", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00054::detail::d", + "id": "1569559620782547158", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "d", + "namespace": "clanguml::t00054::detail", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00054::detail::e", + "id": "2037550833462858827", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "e", + "namespace": "clanguml::t00054::detail", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "detail", + "type": "namespace" + }, + { + "bases": [], + "display_name": "clanguml::t00054::f", + "id": "2123626454198320938", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "f", + "namespace": "clanguml::t00054", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00054::g", + "id": "595494794840378320", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "g", + "namespace": "clanguml::t00054", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00054::A", + "id": "917656824503504804", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00054", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 14 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00054::B", + "id": "1235773045370563004", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00054", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "display_name": "clanguml::t00054::detail2", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00054::detail2::C", + "id": "540054955081677892", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00054::detail2", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "display_name": "clanguml::t00054::detail2::detail3", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00054::detail2::detail3::D", + "id": "1266390196945323478", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00054::detail2::detail3", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 20 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00054::detail2::detail3::E", + "id": "134928214982255105", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00054::detail2::detail3", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 21 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "detail3", + "type": "namespace" + }, + { + "bases": [], + "display_name": "clanguml::t00054::detail2::F", + "id": "446694692150903211", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "clanguml::t00054::detail2", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 23 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "detail2", + "type": "namespace" + }, + { + "bases": [], + "display_name": "clanguml::t00054::G", + "id": "1365815261671395853", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00054", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 25 + }, + "template_parameters": [], + "type": "class" + }, + { + "display_name": "clanguml::t00054::detail4", + "elements": [ + { + "constants": [ + "hhh" + ], + "display_name": "clanguml::t00054::detail4::h", + "id": "1592677999268391183", + "is_nested": false, + "name": "h", + "namespace": "clanguml::t00054::detail4", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 28 + }, + "type": "enum" + }, + { + "constants": [ + "iii" + ], + "display_name": "clanguml::t00054::detail4::i", + "id": "441521323390223397", + "is_nested": false, + "name": "i", + "namespace": "clanguml::t00054::detail4", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 29 + }, + "type": "enum" + }, + { + "constants": [ + "jjj" + ], + "display_name": "clanguml::t00054::detail4::j", + "id": "499334434426587347", + "is_nested": false, + "name": "j", + "namespace": "clanguml::t00054::detail4", + "source_location": { + "file": "../../tests/t00054/t00054.cc", + "line": 30 + }, + "type": "enum" + } + ], + "name": "detail4", + "type": "namespace" + } + ], + "name": "t00054_class", + "relationships": [], + "using_namespace": "clanguml::t00054" +} +``` diff --git a/docs/test_cases/t00054_class.svg b/docs/test_cases/t00054_class.svg index 58d8752f..79817306 100644 --- a/docs/test_cases/t00054_class.svg +++ b/docs/test_cases/t00054_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - + detail - + detail2 - + detail3 - + detail4 - - + + d - - + + a - - + + c - - + + e - - + + C - - + + F - - + + D - - + + E - - + + A - - + + B - - + + f - - + + G - - + + h @@ -127,8 +127,8 @@ hhh - - + + i @@ -137,8 +137,8 @@ iii - - + + j @@ -147,16 +147,16 @@ jjj - - + + b - - + + g diff --git a/docs/test_cases/t00055.md b/docs/test_cases/t00055.md index 6ba7921e..fb1813d5 100644 --- a/docs/test_cases/t00055.md +++ b/docs/test_cases/t00055.md @@ -39,3 +39,214 @@ struct J { }; ``` ## Generated UML diagrams ![t00055_class](./t00055_class.svg "Test case for `row` and `column` layout hints") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00055::A", + "id": "1697191682863715554", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 3 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::B", + "id": "188599859894721517", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::C", + "id": "625177137967392996", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::D", + "id": "1046415640323289221", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::E", + "id": "702117239243796422", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "E", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::F", + "id": "1511375015718046137", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "F", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 8 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::G", + "id": "651600874645139639", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "G", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 9 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::H", + "id": "374142601071476038", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "H", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 10 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::I", + "id": "295372236079742697", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "I", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00055::J", + "id": "769231292718551090", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "J", + "namespace": "clanguml::t00055", + "source_location": { + "file": "../../tests/t00055/t00055.cc", + "line": 12 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00055_class", + "relationships": [], + "using_namespace": "clanguml::t00055" +} +``` diff --git a/docs/test_cases/t00055_class.svg b/docs/test_cases/t00055_class.svg index 1fc2307b..b2164e3b 100644 --- a/docs/test_cases/t00055_class.svg +++ b/docs/test_cases/t00055_class.svg @@ -1,6 +1,6 @@ - + @@ -9,80 +9,80 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J diff --git a/docs/test_cases/t00056.md b/docs/test_cases/t00056.md index 188159cb..0c6b7439 100644 --- a/docs/test_cases/t00056.md +++ b/docs/test_cases/t00056.md @@ -113,3 +113,538 @@ struct F { ``` ## Generated UML diagrams ![t00056_class](./t00056_class.svg "Basic C++20 concepts test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "display_name": "clanguml::t00056::greater_than_simple", + "id": "902541696362244204", + "name": "greater_than_simple", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 7 + }, + "statements": [], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::greater_than_with_requires", + "id": "1830716585637735576", + "name": "greater_than_with_requires", + "namespace": "clanguml::t00056", + "parameters": [ + { + "name": "clanguml::t00056::l", + "type": "T" + }, + { + "name": "clanguml::t00056::r", + "type": "P" + } + ], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 10 + }, + "statements": [ + "sizeof (l) > sizeof (r)" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::max_four_bytes", + "id": "385255522691733325", + "name": "max_four_bytes", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 15 + }, + "statements": [], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::iterable", + "id": "392540961352249242", + "name": "iterable", + "namespace": "clanguml::t00056", + "parameters": [ + { + "name": "clanguml::t00056::container", + "type": "T" + } + ], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 19 + }, + "statements": [ + "container.begin()", + "container.end()" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::has_value_type", + "id": "1850394311226276678", + "name": "has_value_type", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 26 + }, + "statements": [ + "typename T::value_type" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::convertible_to_string", + "id": "137304962071054497", + "name": "convertible_to_string", + "namespace": "clanguml::t00056", + "parameters": [ + { + "name": "clanguml::t00056::s", + "type": "T" + } + ], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 29 + }, + "statements": [ + "std::string{s}", + "{std::to_string(s)} noexcept", + "{std::to_string(s)} -> std::same_as" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::iterable_with_value_type", + "id": "1043398062146751019", + "name": "iterable_with_value_type", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 45 + }, + "statements": [], + "type": "concept" + }, + { + "display_name": "clanguml::t00056::iterable_or_small_value_type", + "id": "866345615551223718", + "name": "iterable_or_small_value_type", + "namespace": "clanguml::t00056", + "parameters": [], + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 48 + }, + "statements": [], + "type": "concept" + }, + { + "bases": [], + "display_name": "clanguml::t00056::A", + "id": "1418333499545421661", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 53 + }, + "type": "T" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00056", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 52 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::B", + "id": "1814355496814977880", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 60 + }, + "type": "T" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00056", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 59 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::C", + "id": "1512618198241549089", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 70 + }, + "type": "T" + } + ], + "methods": [], + "name": "C", + "namespace": "clanguml::t00056", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 69 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::D", + "id": "1635109601630198093", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00056", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 75 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T1", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T2", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T3", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T4", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T5", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::E", + "id": "1429225801945621089", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "e1", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 80 + }, + "type": "T1" + }, + { + "access": "public", + "is_static": false, + "name": "e2", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 81 + }, + "type": "T2" + }, + { + "access": "public", + "is_static": false, + "name": "e3", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 82 + }, + "type": "T3" + } + ], + "methods": [], + "name": "E", + "namespace": "clanguml::t00056", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 79 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T1", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T2", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T3", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00056::F", + "id": "856301122972546034", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "f1", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 88 + }, + "type": "T1" + }, + { + "access": "public", + "is_static": false, + "name": "f2", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 89 + }, + "type": "T2" + }, + { + "access": "public", + "is_static": false, + "name": "f3", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 90 + }, + "type": "T3" + } + ], + "methods": [], + "name": "F", + "namespace": "clanguml::t00056", + "source_location": { + "file": "../../tests/t00056/t00056.cc", + "line": 87 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T1", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T2", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "T3", + "template_parameters": [] + } + ], + "type": "class" + } + ], + "name": "t00056_class", + "relationships": [ + { + "destination": "385255522691733325", + "label": "T", + "source": "137304962071054497", + "type": "constraint" + }, + { + "destination": "392540961352249242", + "label": "T", + "source": "1043398062146751019", + "type": "constraint" + }, + { + "destination": "1850394311226276678", + "label": "T", + "source": "1043398062146751019", + "type": "constraint" + }, + { + "destination": "1043398062146751019", + "label": "T", + "source": "866345615551223718", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T", + "source": "866345615551223718", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T", + "source": "1418333499545421661", + "type": "constraint" + }, + { + "destination": "866345615551223718", + "label": "T", + "source": "1814355496814977880", + "type": "constraint" + }, + { + "destination": "137304962071054497", + "label": "T", + "source": "1512618198241549089", + "type": "constraint" + }, + { + "destination": "392540961352249242", + "label": "T1", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "392540961352249242", + "label": "T3", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T2", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "385255522691733325", + "label": "T5", + "source": "1635109601630198093", + "type": "constraint" + }, + { + "destination": "1830716585637735576", + "label": "T1,T3", + "source": "1429225801945621089", + "type": "constraint" + }, + { + "destination": "902541696362244204", + "label": "T1,T3", + "source": "856301122972546034", + "type": "constraint" + } + ], + "using_namespace": "clanguml::t00056" +} +``` diff --git a/docs/test_cases/t00056_class.svg b/docs/test_cases/t00056_class.svg index f27bfd7c..fccb4a32 100644 --- a/docs/test_cases/t00056_class.svg +++ b/docs/test_cases/t00056_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -20,8 +20,8 @@ - - + + «concept» @@ -33,8 +33,8 @@ sizeof (l) > sizeof (r) - - + + «concept» @@ -44,8 +44,8 @@ - - + + «concept» @@ -58,8 +58,8 @@ container.begin() container.end() - - + + «concept» @@ -71,8 +71,8 @@ typename T::value_type - - + + «concept» @@ -86,8 +86,8 @@ {std::to_string(s)} noexcept {std::to_string(s)} -> std::same_as<std::string> - - + + «concept» @@ -97,8 +97,8 @@ - - + + «concept» @@ -108,8 +108,8 @@ - - + + A @@ -117,16 +117,16 @@ max_four_bytes T - + - + a : T - - + + B @@ -134,16 +134,16 @@ T - + - + b : T - - + + C @@ -151,16 +151,16 @@ convertible_to_string T - + - + c : T - - + + D @@ -169,8 +169,8 @@ - - + + E @@ -178,30 +178,30 @@ T1,T2,T3 - + - + e1 : T1 - + - + e2 : T2 - + - + e3 : T3 - - + + F @@ -209,25 +209,25 @@ T1,T2,T3 - + - + f1 : T1 - + - + f2 : T2 - + - + f3 : T3 diff --git a/docs/test_cases/t00057.md b/docs/test_cases/t00057.md index d61678a6..1d9f60ba 100644 --- a/docs/test_cases/t00057.md +++ b/docs/test_cases/t00057.md @@ -56,3 +56,449 @@ struct t00057_R { ``` ## Generated UML diagrams ![t00057_class](./t00057_class.svg "Test case C99/C11 translation units with structs and unions") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "t00057_A", + "id": "940295970488928395", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a1", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 4 + }, + "type": "int" + } + ], + "methods": [], + "name": "t00057_A", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 3 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_B", + "id": "1030391494410415852", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b1", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 8 + }, + "type": "int" + } + ], + "methods": [], + "name": "t00057_B", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 7 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_C", + "id": "388213894542327772", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "c1", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 12 + }, + "type": "int" + } + ], + "methods": [], + "name": "t00057_C", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 11 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_D", + "id": "784667124248020371", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": true, + "members": [ + { + "access": "public", + "is_static": false, + "name": "d1", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 16 + }, + "type": "int" + }, + { + "access": "public", + "is_static": false, + "name": "d2", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 17 + }, + "type": "float" + } + ], + "methods": [], + "name": "t00057_D", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 15 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_E", + "id": "682873132844345324", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "e", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 21 + }, + "type": "int" + }, + { + "access": "public", + "is_static": false, + "name": "coordinates", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 25 + }, + "type": "t00057_E##(anonymous_739)" + }, + { + "access": "public", + "is_static": false, + "name": "height", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 29 + }, + "type": "t00057_E##(anonymous_807)" + } + ], + "methods": [], + "name": "t00057_E", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 20 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_E::(coordinates)", + "id": "161676142413826748", + "is_abstract": false, + "is_nested": true, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "x", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 23 + }, + "type": "int" + }, + { + "access": "public", + "is_static": false, + "name": "y", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 24 + }, + "type": "int" + } + ], + "methods": [], + "name": "t00057_E::(coordinates)", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 22 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_E::(height)", + "id": "2265335931722752750", + "is_abstract": false, + "is_nested": true, + "is_struct": false, + "is_template": false, + "is_union": true, + "members": [ + { + "access": "public", + "is_static": false, + "name": "z", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 27 + }, + "type": "int" + }, + { + "access": "public", + "is_static": false, + "name": "t", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 28 + }, + "type": "double" + } + ], + "methods": [], + "name": "t00057_E::(height)", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 26 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_R", + "id": "370583978606928327", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 33 + }, + "type": "struct t00057_A" + }, + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 34 + }, + "type": "t00057_B" + }, + { + "access": "public", + "is_static": false, + "name": "c", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 35 + }, + "type": "struct t00057_C *" + }, + { + "access": "public", + "is_static": false, + "name": "d", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 36 + }, + "type": "union t00057_D" + }, + { + "access": "public", + "is_static": false, + "name": "e", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 37 + }, + "type": "struct t00057_E *" + }, + { + "access": "public", + "is_static": false, + "name": "f", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 38 + }, + "type": "struct t00057_F *" + } + ], + "methods": [], + "name": "t00057_R", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/t00057.c", + "line": 32 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "t00057_F", + "id": "85797106299568719", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "f1", + "source_location": { + "file": "../../tests/t00057/src/t00057_impl.c", + "line": 4 + }, + "type": "int" + } + ], + "methods": [], + "name": "t00057_F", + "namespace": "", + "source_location": { + "file": "../../tests/t00057/include/t00057.h", + "line": 3 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00057_class", + "relationships": [ + { + "access": "public", + "destination": "161676142413826748", + "label": "coordinates", + "source": "682873132844345324", + "type": "aggregation" + }, + { + "access": "public", + "destination": "2265335931722752750", + "label": "height", + "source": "682873132844345324", + "type": "aggregation" + }, + { + "access": "public", + "destination": "940295970488928395", + "label": "a", + "source": "370583978606928327", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1030391494410415852", + "label": "b", + "source": "370583978606928327", + "type": "aggregation" + }, + { + "access": "public", + "destination": "388213894542327772", + "label": "c", + "source": "370583978606928327", + "type": "association" + }, + { + "access": "public", + "destination": "784667124248020371", + "label": "d", + "source": "370583978606928327", + "type": "aggregation" + }, + { + "access": "public", + "destination": "682873132844345324", + "label": "e", + "source": "370583978606928327", + "type": "association" + }, + { + "access": "public", + "destination": "85797106299568719", + "label": "f", + "source": "370583978606928327", + "type": "association" + } + ] +} +``` diff --git a/docs/test_cases/t00057_class.svg b/docs/test_cases/t00057_class.svg index 9b424947..0fbc57ea 100644 --- a/docs/test_cases/t00057_class.svg +++ b/docs/test_cases/t00057_class.svg @@ -1,6 +1,6 @@ - + @@ -9,210 +9,210 @@ - - + + t00057_A - + - + a1 : int - - + + t00057_B - + - + b1 : int - - + + t00057_C - + - + c1 : int - - + + «union» t00057_D - + - + d1 : int - + - + d2 : float - - + + t00057_E - + - + e : int - + - + coordinates : t00057_E::(anonymous_739) - + - + height : t00057_E::(anonymous_807) - - + + t00057_E::(coordinates) - + - + x : int - + - + y : int - - + + «union» t00057_E::(height) - + - + z : int - + - + t : double - - + + t00057_R - + - + a : struct t00057_A - + - + b : t00057_B - + - + c : struct t00057_C * - + - + d : union t00057_D - + - + e : struct t00057_E * - + - + f : struct t00057_F * - - + + t00057_F - + - + f1 : int diff --git a/docs/test_cases/t00058.md b/docs/test_cases/t00058.md index 2a967e55..d32cc43b 100644 --- a/docs/test_cases/t00058.md +++ b/docs/test_cases/t00058.md @@ -67,3 +67,386 @@ struct R { ``` ## Generated UML diagrams ![t00058_class](./t00058_class.svg "Test case for concepts with variadic parameters and type aliases") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00058::first_type", + "id": "39461943261269692", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [], + "methods": [], + "name": "first_type", + "namespace": "clanguml::t00058", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 11 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Args...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "display_name": "clanguml::t00058::same_as_first_type", + "id": "1725820236573641307", + "name": "same_as_first_type", + "namespace": "clanguml::t00058", + "parameters": [], + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 22 + }, + "statements": [], + "type": "concept" + }, + { + "bases": [], + "display_name": "clanguml::t00058::A", + "id": "798619347004821702", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "a", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 28 + }, + "type": "std::vector" + } + ], + "methods": [], + "name": "A", + "namespace": "clanguml::t00058", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 27 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Args...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00058::B", + "id": "420594889696591405", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "b", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 34 + }, + "type": "std::vector" + }, + { + "access": "public", + "is_static": false, + "name": "bb", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 35 + }, + "type": "P" + } + ], + "methods": [], + "name": "B", + "namespace": "clanguml::t00058", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 33 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "P", + "template_parameters": [] + }, + { + "is_variadic": true, + "kind": "template_type", + "name": "Args...", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00058::A", + "id": "1724002183455178980", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00058", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "double" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00058::A", + "id": "1372381231906520278", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00058", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00058::B>", + "id": "290383080560130133", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00058", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "std::string" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "double" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "int" + } + ], + "type": "clanguml::t00058::A" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00058::R", + "id": "1015108159699260009", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "aa", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 39 + }, + "type": "A" + }, + { + "access": "public", + "is_static": false, + "name": "bb", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 40 + }, + "type": "B>" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00058", + "source_location": { + "file": "../../tests/t00058/t00058.cc", + "line": 38 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00058_class", + "relationships": [ + { + "destination": "1725820236573641307", + "label": "T,Args...", + "source": "798619347004821702", + "type": "constraint" + }, + { + "destination": "1725820236573641307", + "label": "T,Args...", + "source": "420594889696591405", + "type": "constraint" + }, + { + "access": "public", + "destination": "798619347004821702", + "source": "1724002183455178980", + "type": "instantiation" + }, + { + "access": "public", + "destination": "798619347004821702", + "source": "1372381231906520278", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1372381231906520278", + "source": "290383080560130133", + "type": "dependency" + }, + { + "access": "public", + "destination": "420594889696591405", + "source": "290383080560130133", + "type": "instantiation" + }, + { + "access": "public", + "destination": "1724002183455178980", + "label": "aa", + "source": "1015108159699260009", + "type": "aggregation" + }, + { + "access": "public", + "destination": "290383080560130133", + "label": "bb", + "source": "1015108159699260009", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00058" +} +``` diff --git a/docs/test_cases/t00058_class.svg b/docs/test_cases/t00058_class.svg index 99b869c8..b079a2dc 100644 --- a/docs/test_cases/t00058_class.svg +++ b/docs/test_cases/t00058_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + first_type @@ -19,8 +19,8 @@ - - + + «concept» @@ -30,8 +30,8 @@ - - + + A @@ -39,16 +39,16 @@ T,Args... - + - + a : std::vector<T> - - + + B @@ -56,22 +56,22 @@ T,P,Args... - + - + b : std::vector<T> - + - + bb : P - + A @@ -79,7 +79,7 @@ int,int,double,std::string - + A @@ -87,7 +87,7 @@ int,int - + B @@ -95,25 +95,25 @@ int,std::string,int,double,A<int,int> - - + + R - + - + aa : A<int,int,double,std::string> - + - + bb : B<int,std::string,int,double,A<int,int>> diff --git a/docs/test_cases/t00059.md b/docs/test_cases/t00059.md index aedaf7fa..1cb7b46c 100644 --- a/docs/test_cases/t00059.md +++ b/docs/test_cases/t00059.md @@ -76,3 +76,487 @@ struct R { ``` ## Generated UML diagrams ![t00059_class](./t00059_class.svg "Non-virtual abstract factory pattern using concepts test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "display_name": "clanguml::t00059::fruit_c", + "id": "1926201868069460340", + "name": "fruit_c", + "namespace": "clanguml::t00059", + "parameters": [ + { + "name": "clanguml::t00059::t", + "type": "T" + } + ], + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 7 + }, + "statements": [ + "T{}", + "t.get_name()" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00059::apple_c", + "id": "1932582371736186409", + "name": "apple_c", + "namespace": "clanguml::t00059", + "parameters": [ + { + "name": "clanguml::t00059::t", + "type": "T" + } + ], + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 13 + }, + "statements": [ + "t.get_sweetness()" + ], + "type": "concept" + }, + { + "display_name": "clanguml::t00059::orange_c", + "id": "1483904441065806133", + "name": "orange_c", + "namespace": "clanguml::t00059", + "parameters": [ + { + "name": "clanguml::t00059::t", + "type": "T" + } + ], + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 16 + }, + "statements": [ + "t.get_bitterness()" + ], + "type": "concept" + }, + { + "bases": [], + "display_name": "clanguml::t00059::gala_apple", + "id": "399997161214328320", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_name", + "parameters": [], + "type": "std::string" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_sweetness", + "parameters": [], + "type": "float" + } + ], + "name": "gala_apple", + "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 18 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00059::empire_apple", + "id": "660406972347773654", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_name", + "parameters": [], + "type": "std::string" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_sweetness", + "parameters": [], + "type": "float" + } + ], + "name": "empire_apple", + "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 24 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00059::lima_orange", + "id": "1649295452510454080", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_name", + "parameters": [], + "type": "std::string" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_bitterness", + "parameters": [], + "type": "float" + } + ], + "name": "lima_orange", + "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 30 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00059::valencia_orange", + "id": "802727760415733923", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_name", + "parameters": [], + "type": "std::string" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "get_bitterness", + "parameters": [], + "type": "float" + } + ], + "name": "valencia_orange", + "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 36 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00059::fruit_factory", + "id": "2301786483822933456", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": true, + "is_union": false, + "members": [], + "methods": [ + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "create_apple", + "parameters": [], + "type": "TA" + }, + { + "access": "public", + "is_const": true, + "is_defaulted": false, + "is_implicit": false, + "is_pure_virtual": false, + "is_static": false, + "is_virtual": false, + "name": "create_orange", + "parameters": [], + "type": "TO" + } + ], + "name": "fruit_factory", + "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 42 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "TA", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "TO", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00059::fruit_factory", + "id": "551278102444647278", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "fruit_factory", + "namespace": "clanguml::t00059", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00059::gala_apple" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00059::valencia_orange" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00059::fruit_factory", + "id": "536390279563541226", + "is_abstract": false, + "is_nested": false, + "is_struct": false, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "fruit_factory", + "namespace": "clanguml::t00059", + "template_parameters": [ + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00059::empire_apple" + }, + { + "is_variadic": false, + "kind": "argument", + "template_parameters": [], + "type": "clanguml::t00059::lima_orange" + } + ], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00059::R", + "id": "1128300671453354325", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "factory_1", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 52 + }, + "type": "clanguml::t00059::fruit_factory_1" + }, + { + "access": "public", + "is_static": false, + "name": "factory_2", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 53 + }, + "type": "clanguml::t00059::fruit_factory_2" + } + ], + "methods": [], + "name": "R", + "namespace": "clanguml::t00059", + "source_location": { + "file": "../../tests/t00059/t00059.cc", + "line": 51 + }, + "template_parameters": [], + "type": "class" + } + ], + "name": "t00059_class", + "relationships": [ + { + "destination": "1926201868069460340", + "label": "T", + "source": "1932582371736186409", + "type": "constraint" + }, + { + "destination": "1926201868069460340", + "label": "T", + "source": "1483904441065806133", + "type": "constraint" + }, + { + "destination": "1932582371736186409", + "label": "TA", + "source": "2301786483822933456", + "type": "constraint" + }, + { + "destination": "1483904441065806133", + "label": "TO", + "source": "2301786483822933456", + "type": "constraint" + }, + { + "access": "public", + "destination": "399997161214328320", + "source": "551278102444647278", + "type": "dependency" + }, + { + "access": "public", + "destination": "802727760415733923", + "source": "551278102444647278", + "type": "dependency" + }, + { + "access": "public", + "destination": "2301786483822933456", + "source": "551278102444647278", + "type": "instantiation" + }, + { + "access": "public", + "destination": "660406972347773654", + "source": "536390279563541226", + "type": "dependency" + }, + { + "access": "public", + "destination": "1649295452510454080", + "source": "536390279563541226", + "type": "dependency" + }, + { + "access": "public", + "destination": "2301786483822933456", + "source": "536390279563541226", + "type": "instantiation" + }, + { + "access": "public", + "destination": "551278102444647278", + "label": "factory_1", + "source": "1128300671453354325", + "type": "aggregation" + }, + { + "access": "public", + "destination": "536390279563541226", + "label": "factory_2", + "source": "1128300671453354325", + "type": "aggregation" + } + ], + "using_namespace": "clanguml::t00059" +} +``` diff --git a/docs/test_cases/t00059_class.svg b/docs/test_cases/t00059_class.svg index c784af76..8059e4aa 100644 --- a/docs/test_cases/t00059_class.svg +++ b/docs/test_cases/t00059_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -23,8 +23,8 @@ T{} t.get_name() - - + + «concept» @@ -36,8 +36,8 @@ t.get_sweetness() - - + + «concept» @@ -49,8 +49,8 @@ t.get_bitterness() - - + + gala_apple @@ -61,8 +61,8 @@ get_sweetness() const : float - - + + empire_apple @@ -73,8 +73,8 @@ get_sweetness() const : float - - + + lima_orange @@ -85,8 +85,8 @@ get_bitterness() const : float - - + + valencia_orange @@ -97,8 +97,8 @@ get_bitterness() const : float - - + + fruit_factory @@ -111,7 +111,7 @@ create_orange() const : TO - + fruit_factory @@ -119,7 +119,7 @@ gala_apple,valencia_orange - + fruit_factory @@ -127,25 +127,25 @@ empire_apple,lima_orange - - + + R - + - + factory_1 : fruit_factory_1 - + - + factory_2 : fruit_factory_2 diff --git a/docs/test_cases/t00060.md b/docs/test_cases/t00060.md index a2ebd074..f5fddcb4 100644 --- a/docs/test_cases/t00060.md +++ b/docs/test_cases/t00060.md @@ -43,3 +43,258 @@ template struct H : public G { ``` ## Generated UML diagrams ![t00060_class](./t00060_class.svg "Parents (base classes) diagram filter test case") +## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [ + { + "bases": [], + "display_name": "clanguml::t00060::A", + "id": "1373615549846303472", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "A", + "namespace": "clanguml::t00060", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 3 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1373615549846303472", + "is_virtual": false, + "name": "clanguml::t00060::A" + } + ], + "display_name": "clanguml::t00060::B", + "id": "479650368930934571", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "B", + "namespace": "clanguml::t00060", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 4 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1373615549846303472", + "is_virtual": false, + "name": "clanguml::t00060::A" + } + ], + "display_name": "clanguml::t00060::C", + "id": "1827660844127264787", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "C", + "namespace": "clanguml::t00060", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 5 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "479650368930934571", + "is_virtual": false, + "name": "clanguml::t00060::B" + }, + { + "access": "public", + "id": "1827660844127264787", + "is_virtual": false, + "name": "clanguml::t00060::C" + } + ], + "display_name": "clanguml::t00060::D", + "id": "1629687372290281981", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": false, + "is_union": false, + "members": [], + "methods": [], + "name": "D", + "namespace": "clanguml::t00060", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 6 + }, + "template_parameters": [], + "type": "class" + }, + { + "bases": [], + "display_name": "clanguml::t00060::G", + "id": "1877304825033069517", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "g", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 11 + }, + "type": "T" + } + ], + "methods": [], + "name": "G", + "namespace": "clanguml::t00060", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 10 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + } + ], + "type": "class" + }, + { + "bases": [ + { + "access": "public", + "id": "1877304825033069517", + "is_virtual": false, + "name": "G" + } + ], + "display_name": "clanguml::t00060::H", + "id": "1881610349123495638", + "is_abstract": false, + "is_nested": false, + "is_struct": true, + "is_template": true, + "is_union": false, + "members": [ + { + "access": "public", + "is_static": false, + "name": "h", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 15 + }, + "type": "G" + }, + { + "access": "public", + "is_static": false, + "name": "hh", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 16 + }, + "type": "P" + } + ], + "methods": [], + "name": "H", + "namespace": "clanguml::t00060", + "source_location": { + "file": "../../tests/t00060/t00060.cc", + "line": 14 + }, + "template_parameters": [ + { + "is_variadic": false, + "kind": "template_type", + "name": "T", + "template_parameters": [] + }, + { + "is_variadic": false, + "kind": "template_type", + "name": "P", + "template_parameters": [] + } + ], + "type": "class" + } + ], + "name": "t00060_class", + "relationships": [ + { + "access": "public", + "destination": "1373615549846303472", + "source": "479650368930934571", + "type": "extension" + }, + { + "access": "public", + "destination": "1373615549846303472", + "source": "1827660844127264787", + "type": "extension" + }, + { + "access": "public", + "destination": "479650368930934571", + "source": "1629687372290281981", + "type": "extension" + }, + { + "access": "public", + "destination": "1827660844127264787", + "source": "1629687372290281981", + "type": "extension" + }, + { + "access": "public", + "destination": "1877304825033069517", + "label": "h", + "source": "1881610349123495638", + "type": "aggregation" + }, + { + "access": "public", + "destination": "1877304825033069517", + "source": "1881610349123495638", + "type": "extension" + } + ], + "using_namespace": "clanguml::t00060" +} +``` diff --git a/docs/test_cases/t00060_class.svg b/docs/test_cases/t00060_class.svg index ce46cf35..187676ce 100644 --- a/docs/test_cases/t00060_class.svg +++ b/docs/test_cases/t00060_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + D - - + + G @@ -50,16 +50,16 @@ T - + - + g : T - - + + H @@ -67,18 +67,18 @@ T,P - + - + h : G<T> - + - + hh : P diff --git a/docs/test_cases/t20001.md b/docs/test_cases/t20001.md index 65e31390..6ff7f716 100644 --- a/docs/test_cases/t20001.md +++ b/docs/test_cases/t20001.md @@ -103,3 +103,182 @@ int tmain() ``` ## Generated UML diagrams ![t20001_sequence](./t20001_sequence.svg "Basic sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20001_sequence", + "participants": [ + { + "id": "622672604730036140", + "name": "clanguml::t20001::tmain()", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 61 + }, + "type": "function" + }, + { + "id": "1771943546649183134", + "name": "clanguml::t20001::A", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 13 + }, + "type": "class" + }, + { + "id": "272433898507800600", + "name": "clanguml::t20001::B", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 36 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "622672604730036140", + "activity_name": "clanguml::t20001::tmain()", + "participant_id": "622672604730036140", + "participant_name": "clanguml::t20001::tmain()" + }, + "name": "add(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 66 + }, + "to": { + "activity_id": "1131549932713395402", + "activity_name": "clanguml::t20001::A::add(int,int)", + "participant_id": "1771943546649183134", + "participant_name": "clanguml::t20001::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "622672604730036140", + "activity_name": "clanguml::t20001::tmain()", + "participant_id": "622672604730036140", + "participant_name": "clanguml::t20001::tmain()" + }, + "name": "wrap_add3(int,int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 68 + }, + "to": { + "activity_id": "642550151323208936", + "activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)", + "participant_id": "272433898507800600", + "participant_name": "clanguml::t20001::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "642550151323208936", + "activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)", + "participant_id": "272433898507800600", + "participant_name": "clanguml::t20001::B" + }, + "name": "add3(int,int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 52 + }, + "to": { + "activity_id": "2090436635449419593", + "activity_name": "clanguml::t20001::A::add3(int,int,int)", + "participant_id": "1771943546649183134", + "participant_name": "clanguml::t20001::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2090436635449419593", + "activity_name": "clanguml::t20001::A::add3(int,int,int)", + "participant_id": "1771943546649183134", + "participant_name": "clanguml::t20001::A" + }, + "name": "add(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 25 + }, + "to": { + "activity_id": "1131549932713395402", + "activity_name": "clanguml::t20001::A::add(int,int)", + "participant_id": "1771943546649183134", + "participant_name": "clanguml::t20001::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2090436635449419593", + "activity_name": "clanguml::t20001::A::add3(int,int,int)", + "participant_id": "1771943546649183134", + "participant_name": "clanguml::t20001::A" + }, + "name": "log_result(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 26 + }, + "to": { + "activity_id": "1205947631808952097", + "activity_name": "clanguml::t20001::A::log_result(int)", + "participant_id": "1771943546649183134", + "participant_name": "clanguml::t20001::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "642550151323208936", + "activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)", + "participant_id": "272433898507800600", + "participant_name": "clanguml::t20001::B" + }, + "name": "log_result(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20001/t20001.cc", + "line": 53 + }, + "to": { + "activity_id": "1205947631808952097", + "activity_name": "clanguml::t20001::A::log_result(int)", + "participant_id": "1771943546649183134", + "participant_name": "clanguml::t20001::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 622672604730036140, + "location": "clanguml::t20001::tmain()" + } + } + ], + "using_namespace": "clanguml::t20001" +} +``` diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 9e01b57e..9ec5af81 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,59 +9,59 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - + + + + + + + + add(int,int) - + wrap_add3(int,int,int) - + add3(int,int,int) - + @@ -72,7 +72,7 @@ - + @@ -81,14 +81,14 @@ - + log_result(int) - + Main test function diff --git a/docs/test_cases/t20002.md b/docs/test_cases/t20002.md index 65f8c51e..dd0e9567 100644 --- a/docs/test_cases/t20002.md +++ b/docs/test_cases/t20002.md @@ -40,3 +40,125 @@ void m1() { m2(); } ``` ## Generated UML diagrams ![t20002_sequence](./t20002_sequence.svg "Free function sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20002_sequence", + "participants": [ + { + "id": "1619421429271064154", + "name": "clanguml::t20002::m1()", + "source_location": { + "file": "../../tests/t20002/t20002.cc", + "line": 14 + }, + "type": "function" + }, + { + "id": "1575240232156112674", + "name": "clanguml::t20002::m2()", + "source_location": { + "file": "../../tests/t20002/t20002.cc", + "line": 12 + }, + "type": "function" + }, + { + "id": "1838809176089209580", + "name": "clanguml::t20002::m3()", + "source_location": { + "file": "../../tests/t20002/t20002.cc", + "line": 10 + }, + "type": "function" + }, + { + "id": "63715062711218534", + "name": "clanguml::t20002::m4()", + "source_location": { + "file": "../../tests/t20002/t20002.cc", + "line": 8 + }, + "type": "function" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1619421429271064154", + "activity_name": "clanguml::t20002::m1()", + "participant_id": "1619421429271064154", + "participant_name": "clanguml::t20002::m1()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20002/t20002.cc", + "line": 14 + }, + "to": { + "activity_id": "1575240232156112674", + "activity_name": "clanguml::t20002::m2()", + "participant_id": "1575240232156112674", + "participant_name": "clanguml::t20002::m2()" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1575240232156112674", + "activity_name": "clanguml::t20002::m2()", + "participant_id": "1575240232156112674", + "participant_name": "clanguml::t20002::m2()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20002/t20002.cc", + "line": 12 + }, + "to": { + "activity_id": "1838809176089209580", + "activity_name": "clanguml::t20002::m3()", + "participant_id": "1838809176089209580", + "participant_name": "clanguml::t20002::m3()" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1838809176089209580", + "activity_name": "clanguml::t20002::m3()", + "participant_id": "1838809176089209580", + "participant_name": "clanguml::t20002::m3()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20002/t20002.cc", + "line": 10 + }, + "to": { + "activity_id": "63715062711218534", + "activity_name": "clanguml::t20002::m4()", + "participant_id": "63715062711218534", + "participant_name": "clanguml::t20002::m4()" + }, + "type": "message" + } + ], + "start_from": { + "id": 1619421429271064154, + "location": "clanguml::t20002::m1()" + } + } + ], + "using_namespace": "clanguml::t20002" +} +``` diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index 5fa454fb..f77ca2a9 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1() - + m1() - - + + m2() - + m2() - - + + m3() - + m3() - - + + m4() - + m4() - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20003.md b/docs/test_cases/t20003.md index f38f01e6..d4b5241e 100644 --- a/docs/test_cases/t20003.md +++ b/docs/test_cases/t20003.md @@ -36,3 +36,125 @@ template void m1(T p) { m2(p); } ``` ## Generated UML diagrams ![t20003_sequence](./t20003_sequence.svg "Function template sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20003_sequence", + "participants": [ + { + "id": "469205740799240869", + "name": "clanguml::t20003::m1(T)", + "source_location": { + "file": "../../tests/t20003/t20003.cc", + "line": 10 + }, + "type": "function_template" + }, + { + "id": "1502957449367040488", + "name": "clanguml::t20003::m2(T)", + "source_location": { + "file": "../../tests/t20003/t20003.cc", + "line": 8 + }, + "type": "function_template" + }, + { + "id": "613477682313507585", + "name": "clanguml::t20003::m3(T)", + "source_location": { + "file": "../../tests/t20003/t20003.cc", + "line": 6 + }, + "type": "function_template" + }, + { + "id": "619960023608507925", + "name": "clanguml::t20003::m4(T)", + "source_location": { + "file": "../../tests/t20003/t20003.cc", + "line": 4 + }, + "type": "function_template" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "469205740799240869", + "activity_name": "clanguml::t20003::m1(T)", + "participant_id": "469205740799240869", + "participant_name": "clanguml::t20003::m1(T)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20003/t20003.cc", + "line": 10 + }, + "to": { + "activity_id": "1502957449367040488", + "activity_name": "clanguml::t20003::m2(T)", + "participant_id": "1502957449367040488", + "participant_name": "clanguml::t20003::m2(T)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1502957449367040488", + "activity_name": "clanguml::t20003::m2(T)", + "participant_id": "1502957449367040488", + "participant_name": "clanguml::t20003::m2(T)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20003/t20003.cc", + "line": 8 + }, + "to": { + "activity_id": "613477682313507585", + "activity_name": "clanguml::t20003::m3(T)", + "participant_id": "613477682313507585", + "participant_name": "clanguml::t20003::m3(T)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "613477682313507585", + "activity_name": "clanguml::t20003::m3(T)", + "participant_id": "613477682313507585", + "participant_name": "clanguml::t20003::m3(T)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20003/t20003.cc", + "line": 6 + }, + "to": { + "activity_id": "619960023608507925", + "activity_name": "clanguml::t20003::m4(T)", + "participant_id": "619960023608507925", + "participant_name": "clanguml::t20003::m4(T)" + }, + "type": "message" + } + ], + "start_from": { + "id": 469205740799240869, + "location": "clanguml::t20003::m1(T)" + } + } + ], + "using_namespace": "clanguml::t20003" +} +``` diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index a24732b3..a000e488 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1<T>(T) - + m1<T>(T) - - + + m2<T>(T) - + m2<T>(T) - - + + m3<T>(T) - + m3<T>(T) - - + + m4<T>(T) - + m4<T>(T) - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20004.md b/docs/test_cases/t20004.md index 6d9fdd8d..7e61a578 100644 --- a/docs/test_cases/t20004.md +++ b/docs/test_cases/t20004.md @@ -72,3 +72,311 @@ int main() ``` ## Generated UML diagrams ![t20004_sequence](./t20004_sequence.svg "Function template instantiation sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20004_sequence", + "participants": [ + { + "id": "2299662004367884401", + "name": "clanguml::t20004::main()", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 38 + }, + "type": "function" + }, + { + "id": "138925040763435897", + "name": "clanguml::t20004::m1(float)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 26 + }, + "type": "function_template" + }, + { + "id": "1239083518717603720", + "name": "clanguml::t20004::m1(unsigned long)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 28 + }, + "type": "function_template" + }, + { + "id": "376599675205498367", + "name": "clanguml::t20004::m4(unsigned long)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 10 + }, + "type": "function_template" + }, + { + "id": "1845817984839618223", + "name": "clanguml::t20004::m1(std::string)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 33 + }, + "type": "function_template" + }, + { + "id": "1735054254122948614", + "name": "clanguml::t20004::m2(std::string)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 19 + }, + "type": "function_template" + }, + { + "id": "121663532044911922", + "name": "clanguml::t20004::m1(int)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 24 + }, + "type": "function_template" + }, + { + "id": "1475362124497386656", + "name": "clanguml::t20004::m2(int)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 17 + }, + "type": "function_template" + }, + { + "id": "734999226157549914", + "name": "clanguml::t20004::m3(int)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 15 + }, + "type": "function_template" + }, + { + "id": "1006390865908497562", + "name": "clanguml::t20004::m4(int)", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 8 + }, + "type": "function_template" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "2299662004367884401", + "activity_name": "clanguml::t20004::main()", + "participant_id": "2299662004367884401", + "participant_name": "clanguml::t20004::main()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 40 + }, + "to": { + "activity_id": "138925040763435897", + "activity_name": "clanguml::t20004::m1(float)", + "participant_id": "138925040763435897", + "participant_name": "clanguml::t20004::m1(float)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2299662004367884401", + "activity_name": "clanguml::t20004::main()", + "participant_id": "2299662004367884401", + "participant_name": "clanguml::t20004::main()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 42 + }, + "to": { + "activity_id": "1239083518717603720", + "activity_name": "clanguml::t20004::m1(unsigned long)", + "participant_id": "1239083518717603720", + "participant_name": "clanguml::t20004::m1(unsigned long)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1239083518717603720", + "activity_name": "clanguml::t20004::m1(unsigned long)", + "participant_id": "1239083518717603720", + "participant_name": "clanguml::t20004::m1(unsigned long)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 30 + }, + "to": { + "activity_id": "376599675205498367", + "activity_name": "clanguml::t20004::m4(unsigned long)", + "participant_id": "376599675205498367", + "participant_name": "clanguml::t20004::m4(unsigned long)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2299662004367884401", + "activity_name": "clanguml::t20004::main()", + "participant_id": "2299662004367884401", + "participant_name": "clanguml::t20004::main()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 44 + }, + "to": { + "activity_id": "1845817984839618223", + "activity_name": "clanguml::t20004::m1(std::string)", + "participant_id": "1845817984839618223", + "participant_name": "clanguml::t20004::m1(std::string)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1845817984839618223", + "activity_name": "clanguml::t20004::m1(std::string)", + "participant_id": "1845817984839618223", + "participant_name": "clanguml::t20004::m1(std::string)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 35 + }, + "to": { + "activity_id": "1735054254122948614", + "activity_name": "clanguml::t20004::m2(std::string)", + "participant_id": "1735054254122948614", + "participant_name": "clanguml::t20004::m2(std::string)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2299662004367884401", + "activity_name": "clanguml::t20004::main()", + "participant_id": "2299662004367884401", + "participant_name": "clanguml::t20004::main()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 46 + }, + "to": { + "activity_id": "121663532044911922", + "activity_name": "clanguml::t20004::m1(int)", + "participant_id": "121663532044911922", + "participant_name": "clanguml::t20004::m1(int)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "121663532044911922", + "activity_name": "clanguml::t20004::m1(int)", + "participant_id": "121663532044911922", + "participant_name": "clanguml::t20004::m1(int)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 24 + }, + "to": { + "activity_id": "1475362124497386656", + "activity_name": "clanguml::t20004::m2(int)", + "participant_id": "1475362124497386656", + "participant_name": "clanguml::t20004::m2(int)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1475362124497386656", + "activity_name": "clanguml::t20004::m2(int)", + "participant_id": "1475362124497386656", + "participant_name": "clanguml::t20004::m2(int)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 17 + }, + "to": { + "activity_id": "734999226157549914", + "activity_name": "clanguml::t20004::m3(int)", + "participant_id": "734999226157549914", + "participant_name": "clanguml::t20004::m3(int)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "734999226157549914", + "activity_name": "clanguml::t20004::m3(int)", + "participant_id": "734999226157549914", + "participant_name": "clanguml::t20004::m3(int)" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20004/t20004.cc", + "line": 15 + }, + "to": { + "activity_id": "1006390865908497562", + "activity_name": "clanguml::t20004::m4(int)", + "participant_id": "1006390865908497562", + "participant_name": "clanguml::t20004::m4(int)" + }, + "type": "message" + } + ], + "start_from": { + "id": 2299662004367884401, + "location": "clanguml::t20004::main()" + } + } + ], + "using_namespace": "clanguml::t20004" +} +``` diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index fd57b6f7..9449b5f1 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,87 +29,87 @@ - - + + main() - + main() - - + + m1<float>(float) - + m1<float>(float) - - + + m1<unsigned long>(unsigned long) - + m1<unsigned long>(unsigned long) - - + + m4<unsigned long>(unsigned long) - + m4<unsigned long>(unsigned long) - - + + m1<std::string>(std::string) - + m1<std::string>(std::string) - - + + m2<std::string>(std::string) - + m2<std::string>(std::string) - - + + m1<int>(int) - + m1<int>(int) - - + + m2<int>(int) - + m2<int>(int) - - + + m3<int>(int) - + m3<int>(int) - - + + m4<int>(int) - + m4<int>(int) - - - - - - - - - - - + + + + + + + + + + + - + - + @@ -117,11 +117,11 @@ - + - + @@ -129,19 +129,19 @@ - + - + - + - + diff --git a/docs/test_cases/t20005.md b/docs/test_cases/t20005.md index d3d4e8c9..dea3b4ad 100644 --- a/docs/test_cases/t20005.md +++ b/docs/test_cases/t20005.md @@ -43,3 +43,94 @@ template struct C { ``` ## Generated UML diagrams ![t20005_sequence](./t20005_sequence.svg "Class template basic sequence diagram") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20005_sequence", + "participants": [ + { + "id": "365569130532127604", + "name": "clanguml::t20005::C", + "source_location": { + "file": "../../tests/t20005/t20005.cc", + "line": 14 + }, + "type": "class" + }, + { + "id": "666000829532846850", + "name": "clanguml::t20005::B", + "source_location": { + "file": "../../tests/t20005/t20005.cc", + "line": 8 + }, + "type": "class" + }, + { + "id": "1278330455625941185", + "name": "clanguml::t20005::A", + "source_location": { + "file": "../../tests/t20005/t20005.cc", + "line": 4 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "578718872965404973", + "activity_name": "clanguml::t20005::C::c(T)", + "participant_id": "365569130532127604", + "participant_name": "clanguml::t20005::C" + }, + "name": "b(T)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20005/t20005.cc", + "line": 15 + }, + "to": { + "activity_id": "870466496899932117", + "activity_name": "clanguml::t20005::B::b(T)", + "participant_id": "666000829532846850", + "participant_name": "clanguml::t20005::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "870466496899932117", + "activity_name": "clanguml::t20005::B::b(T)", + "participant_id": "666000829532846850", + "participant_name": "clanguml::t20005::B" + }, + "name": "a(T)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20005/t20005.cc", + "line": 9 + }, + "to": { + "activity_id": "124853455814403745", + "activity_name": "clanguml::t20005::A::a(T)", + "participant_id": "1278330455625941185", + "participant_name": "clanguml::t20005::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 578718872965404973, + "location": "clanguml::t20005::C::c(T)" + } + } + ], + "using_namespace": "clanguml::t20005" +} +``` diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index e6ecf1ba..9bc92713 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - + + + - - + + C<T> - + C<T> - - + + B<T> - + B<T> - - + + A<T> - + A<T> - - - + + + c(T) - + b(T) - + a(T) diff --git a/docs/test_cases/t20006.md b/docs/test_cases/t20006.md index 6f766f95..46365896 100644 --- a/docs/test_cases/t20006.md +++ b/docs/test_cases/t20006.md @@ -101,3 +101,434 @@ void tmain() ``` ## Generated UML diagrams ![t20006_sequence](./t20006_sequence.svg "Class template specialization basic sequence diagram") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20006_sequence", + "participants": [ + { + "id": "363965584448680958", + "name": "clanguml::t20006::tmain()", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 57 + }, + "type": "function" + }, + { + "id": "2197760498261923035", + "name": "clanguml::t20006::B", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 11 + }, + "type": "class" + }, + { + "id": "596484796124829039", + "name": "clanguml::t20006::A", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "2102622661983365981", + "name": "clanguml::t20006::B", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 16 + }, + "type": "class" + }, + { + "id": "413459875415381273", + "name": "clanguml::t20006::A", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "264392653889863384", + "name": "clanguml::t20006::BB", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 26 + }, + "type": "class" + }, + { + "id": "1903567228894636312", + "name": "clanguml::t20006::AA", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 21 + }, + "type": "class" + }, + { + "id": "2269742833301555472", + "name": "clanguml::t20006::BB", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 33 + }, + "type": "class" + }, + { + "id": "1743503037360505162", + "name": "clanguml::t20006::BB", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 45 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "363965584448680958", + "activity_name": "clanguml::t20006::tmain()", + "participant_id": "363965584448680958", + "participant_name": "clanguml::t20006::tmain()" + }, + "name": "b(int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 62 + }, + "to": { + "activity_id": "250247217888843587", + "activity_name": "clanguml::t20006::B::b(int)", + "participant_id": "2197760498261923035", + "participant_name": "clanguml::t20006::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "250247217888843587", + "activity_name": "clanguml::t20006::B::b(int)", + "participant_id": "2197760498261923035", + "participant_name": "clanguml::t20006::B" + }, + "name": "a1(int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 12 + }, + "to": { + "activity_id": "196390487987395669", + "activity_name": "clanguml::t20006::A::a1(int)", + "participant_id": "596484796124829039", + "participant_name": "clanguml::t20006::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "363965584448680958", + "activity_name": "clanguml::t20006::tmain()", + "participant_id": "363965584448680958", + "participant_name": "clanguml::t20006::tmain()" + }, + "name": "b(std::string)", + "return_type": "std::string", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 63 + }, + "to": { + "activity_id": "13049632552871157", + "activity_name": "clanguml::t20006::B::b(std::string)", + "participant_id": "2102622661983365981", + "participant_name": "clanguml::t20006::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "13049632552871157", + "activity_name": "clanguml::t20006::B::b(std::string)", + "participant_id": "2102622661983365981", + "participant_name": "clanguml::t20006::B" + }, + "name": "a2(std::string)", + "return_type": "class std::basic_string", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 17 + }, + "to": { + "activity_id": "11762588624112907", + "activity_name": "clanguml::t20006::A::a2(std::string)", + "participant_id": "413459875415381273", + "participant_name": "clanguml::t20006::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "363965584448680958", + "activity_name": "clanguml::t20006::tmain()", + "participant_id": "363965584448680958", + "participant_name": "clanguml::t20006::tmain()" + }, + "name": "bb1(int,int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 70 + }, + "to": { + "activity_id": "1213865121829347654", + "activity_name": "clanguml::t20006::BB::bb1(int,int)", + "participant_id": "264392653889863384", + "participant_name": "clanguml::t20006::BB" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1213865121829347654", + "activity_name": "clanguml::t20006::BB::bb1(int,int)", + "participant_id": "264392653889863384", + "participant_name": "clanguml::t20006::BB" + }, + "name": "aa1(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 27 + }, + "to": { + "activity_id": "1235428163990670191", + "activity_name": "clanguml::t20006::AA::aa1(int)", + "participant_id": "1903567228894636312", + "participant_name": "clanguml::t20006::AA" + }, + "type": "message" + }, + { + "from": { + "activity_id": "363965584448680958", + "activity_name": "clanguml::t20006::tmain()", + "participant_id": "363965584448680958", + "participant_name": "clanguml::t20006::tmain()" + }, + "name": "bb2(int,int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 71 + }, + "to": { + "activity_id": "361650123916792854", + "activity_name": "clanguml::t20006::BB::bb2(int,int)", + "participant_id": "264392653889863384", + "participant_name": "clanguml::t20006::BB" + }, + "type": "message" + }, + { + "from": { + "activity_id": "361650123916792854", + "activity_name": "clanguml::t20006::BB::bb2(int,int)", + "participant_id": "264392653889863384", + "participant_name": "clanguml::t20006::BB" + }, + "name": "aa2(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 28 + }, + "to": { + "activity_id": "582097827335267290", + "activity_name": "clanguml::t20006::AA::aa2(int)", + "participant_id": "1903567228894636312", + "participant_name": "clanguml::t20006::AA" + }, + "type": "message" + }, + { + "from": { + "activity_id": "363965584448680958", + "activity_name": "clanguml::t20006::tmain()", + "participant_id": "363965584448680958", + "participant_name": "clanguml::t20006::tmain()" + }, + "name": "bb1(int,std::string)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 73 + }, + "to": { + "activity_id": "1062874005712014125", + "activity_name": "clanguml::t20006::BB::bb1(int,std::string)", + "participant_id": "2269742833301555472", + "participant_name": "clanguml::t20006::BB" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1062874005712014125", + "activity_name": "clanguml::t20006::BB::bb1(int,std::string)", + "participant_id": "2269742833301555472", + "participant_name": "clanguml::t20006::BB" + }, + "name": "aa2(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 34 + }, + "to": { + "activity_id": "582097827335267290", + "activity_name": "clanguml::t20006::AA::aa2(int)", + "participant_id": "1903567228894636312", + "participant_name": "clanguml::t20006::AA" + }, + "type": "message" + }, + { + "from": { + "activity_id": "363965584448680958", + "activity_name": "clanguml::t20006::tmain()", + "participant_id": "363965584448680958", + "participant_name": "clanguml::t20006::tmain()" + }, + "name": "bb2(int,std::string)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 74 + }, + "to": { + "activity_id": "787705189994778234", + "activity_name": "clanguml::t20006::BB::bb2(int,std::string)", + "participant_id": "2269742833301555472", + "participant_name": "clanguml::t20006::BB" + }, + "type": "message" + }, + { + "from": { + "activity_id": "787705189994778234", + "activity_name": "clanguml::t20006::BB::bb2(int,std::string)", + "participant_id": "2269742833301555472", + "participant_name": "clanguml::t20006::BB" + }, + "name": "aa1(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 35 + }, + "to": { + "activity_id": "1235428163990670191", + "activity_name": "clanguml::t20006::AA::aa1(int)", + "participant_id": "1903567228894636312", + "participant_name": "clanguml::t20006::AA" + }, + "type": "message" + }, + { + "from": { + "activity_id": "363965584448680958", + "activity_name": "clanguml::t20006::tmain()", + "participant_id": "363965584448680958", + "participant_name": "clanguml::t20006::tmain()" + }, + "name": "bb1(int,float)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 76 + }, + "to": { + "activity_id": "1463188845572485713", + "activity_name": "clanguml::t20006::BB::bb1(int,float)", + "participant_id": "1743503037360505162", + "participant_name": "clanguml::t20006::BB" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1463188845572485713", + "activity_name": "clanguml::t20006::BB::bb1(int,float)", + "participant_id": "1743503037360505162", + "participant_name": "clanguml::t20006::BB" + }, + "name": "bb2(int,float)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 46 + }, + "to": { + "activity_id": "732362671329401903", + "activity_name": "clanguml::t20006::BB::bb2(int,float)", + "participant_id": "1743503037360505162", + "participant_name": "clanguml::t20006::BB" + }, + "type": "message" + }, + { + "from": { + "activity_id": "732362671329401903", + "activity_name": "clanguml::t20006::BB::bb2(int,float)", + "participant_id": "1743503037360505162", + "participant_name": "clanguml::t20006::BB" + }, + "name": "aa2(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20006/t20006.cc", + "line": 47 + }, + "to": { + "activity_id": "582097827335267290", + "activity_name": "clanguml::t20006::AA::aa2(int)", + "participant_id": "1903567228894636312", + "participant_name": "clanguml::t20006::AA" + }, + "type": "message" + } + ], + "start_from": { + "id": 363965584448680958, + "location": "clanguml::t20006::tmain()" + } + } + ], + "using_namespace": "clanguml::t20006" +} +``` diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index 01f4bdf4..c9b07bdc 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,82 +34,82 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + BB<int,int> - + BB<int,int> - - + + AA<int> - + AA<int> - - + + BB<int,std::string> - + BB<int,std::string> - - + + BB<int,float> - + BB<int,float> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + b(int) - + a1(int) @@ -118,12 +118,12 @@ - + b(std::string) - + a2(std::string) @@ -132,59 +132,59 @@ - + bb1(int,int) - + aa1(int) - + bb2(int,int) - + aa2(int) - + bb1(int,std::string) - + aa2(int) - + bb2(int,std::string) - + aa1(int) - + bb1(int,float) - + bb2(int,float) - + aa2(int) diff --git a/docs/test_cases/t20007.md b/docs/test_cases/t20007.md index 37f55b34..f00e6272 100644 --- a/docs/test_cases/t20007.md +++ b/docs/test_cases/t20007.md @@ -47,3 +47,125 @@ void tmain() ``` ## Generated UML diagrams ![t20007_sequence](./t20007_sequence.svg "Class template variadic argument list sequence diagram") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20007_sequence", + "participants": [ + { + "id": "622662006747239840", + "name": "clanguml::t20007::tmain()", + "source_location": { + "file": "../../tests/t20007/t20007.cc", + "line": 11 + }, + "type": "function" + }, + { + "id": "1742497005509009302", + "name": "clanguml::t20007::Adder", + "source_location": { + "file": "../../tests/t20007/t20007.cc", + "line": 7 + }, + "type": "class" + }, + { + "id": "599640474306956868", + "name": "clanguml::t20007::Adder", + "source_location": { + "file": "../../tests/t20007/t20007.cc", + "line": 7 + }, + "type": "class" + }, + { + "id": "228191787514523926", + "name": "clanguml::t20007::Adder", + "source_location": { + "file": "../../tests/t20007/t20007.cc", + "line": 7 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "622662006747239840", + "activity_name": "clanguml::t20007::tmain()", + "participant_id": "622662006747239840", + "participant_name": "clanguml::t20007::tmain()" + }, + "name": "add(int &&,int &&)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20007/t20007.cc", + "line": 19 + }, + "to": { + "activity_id": "438133719207269065", + "activity_name": "clanguml::t20007::Adder::add(int &&,int &&)", + "participant_id": "1742497005509009302", + "participant_name": "clanguml::t20007::Adder" + }, + "type": "message" + }, + { + "from": { + "activity_id": "622662006747239840", + "activity_name": "clanguml::t20007::tmain()", + "participant_id": "622662006747239840", + "participant_name": "clanguml::t20007::tmain()" + }, + "name": "add(int &&,float &&,double &&)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20007/t20007.cc", + "line": 20 + }, + "to": { + "activity_id": "9522724767688870", + "activity_name": "clanguml::t20007::Adder::add(int &&,float &&,double &&)", + "participant_id": "599640474306956868", + "participant_name": "clanguml::t20007::Adder" + }, + "type": "message" + }, + { + "from": { + "activity_id": "622662006747239840", + "activity_name": "clanguml::t20007::tmain()", + "participant_id": "622662006747239840", + "participant_name": "clanguml::t20007::tmain()" + }, + "name": "add(std::string &&,std::string &&,std::string &&)", + "return_type": "class std::basic_string", + "scope": "normal", + "source_location": { + "file": "../../tests/t20007/t20007.cc", + "line": 21 + }, + "to": { + "activity_id": "384866641042941480", + "activity_name": "clanguml::t20007::Adder::add(std::string &&,std::string &&,std::string &&)", + "participant_id": "228191787514523926", + "participant_name": "clanguml::t20007::Adder" + }, + "type": "message" + } + ], + "start_from": { + "id": 622662006747239840, + "location": "clanguml::t20007::tmain()" + } + } + ], + "using_namespace": "clanguml::t20007" +} +``` diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index 931fac7a..6c6e56fb 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + Adder<int,int> - + Adder<int,int> - - + + Adder<int,float,double> - + Adder<int,float,double> - - + + Adder<std::string,std::string,std::string> - + Adder<std::string,std::string,std::string> - - - - - + + + + + add(int &&,int &&) - + add(int &&,float &&,double &&) - + add(std::string &&,std::string &&,std::string &&) diff --git a/docs/test_cases/t20008.md b/docs/test_cases/t20008.md index e2ca37a0..033e8431 100644 --- a/docs/test_cases/t20008.md +++ b/docs/test_cases/t20008.md @@ -65,3 +65,218 @@ void tmain() ``` ## Generated UML diagrams ![t20008_sequence](./t20008_sequence.svg "Constexpr if sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20008_sequence", + "participants": [ + { + "id": "1180776240543224244", + "name": "clanguml::t20008::tmain()", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 30 + }, + "type": "function" + }, + { + "id": "1906510289157013670", + "name": "clanguml::t20008::B", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 13 + }, + "type": "class" + }, + { + "id": "1376149084762923197", + "name": "clanguml::t20008::A", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 7 + }, + "type": "class" + }, + { + "id": "867098551202196741", + "name": "clanguml::t20008::B", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 13 + }, + "type": "class" + }, + { + "id": "144833378017373200", + "name": "clanguml::t20008::A", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 7 + }, + "type": "class" + }, + { + "id": "927702553742507923", + "name": "clanguml::t20008::B", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 13 + }, + "type": "class" + }, + { + "id": "390605614583363778", + "name": "clanguml::t20008::A", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 7 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1180776240543224244", + "activity_name": "clanguml::t20008::tmain()", + "participant_id": "1180776240543224244", + "participant_name": "clanguml::t20008::tmain()" + }, + "name": "b(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 38 + }, + "to": { + "activity_id": "379850145437051189", + "activity_name": "clanguml::t20008::B::b(int)", + "participant_id": "1906510289157013670", + "participant_name": "clanguml::t20008::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "379850145437051189", + "activity_name": "clanguml::t20008::B::b(int)", + "participant_id": "1906510289157013670", + "participant_name": "clanguml::t20008::B" + }, + "name": "a1(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 19 + }, + "to": { + "activity_id": "2066363630174644719", + "activity_name": "clanguml::t20008::A::a1(int)", + "participant_id": "1376149084762923197", + "participant_name": "clanguml::t20008::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1180776240543224244", + "activity_name": "clanguml::t20008::tmain()", + "participant_id": "1180776240543224244", + "participant_name": "clanguml::t20008::tmain()" + }, + "name": "b(const char *)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 39 + }, + "to": { + "activity_id": "1347162523481637780", + "activity_name": "clanguml::t20008::B::b(const char *)", + "participant_id": "867098551202196741", + "participant_name": "clanguml::t20008::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1347162523481637780", + "activity_name": "clanguml::t20008::B::b(const char *)", + "participant_id": "867098551202196741", + "participant_name": "clanguml::t20008::B" + }, + "name": "a2(const char *)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 22 + }, + "to": { + "activity_id": "718650834962275580", + "activity_name": "clanguml::t20008::A::a2(const char *)", + "participant_id": "144833378017373200", + "participant_name": "clanguml::t20008::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1180776240543224244", + "activity_name": "clanguml::t20008::tmain()", + "participant_id": "1180776240543224244", + "participant_name": "clanguml::t20008::tmain()" + }, + "name": "b(std::string)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 40 + }, + "to": { + "activity_id": "1286410946666951254", + "activity_name": "clanguml::t20008::B::b(std::string)", + "participant_id": "927702553742507923", + "participant_name": "clanguml::t20008::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1286410946666951254", + "activity_name": "clanguml::t20008::B::b(std::string)", + "participant_id": "927702553742507923", + "participant_name": "clanguml::t20008::B" + }, + "name": "a3(std::string)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20008/t20008.cc", + "line": 25 + }, + "to": { + "activity_id": "1404594247101138737", + "activity_name": "clanguml::t20008::A::a3(std::string)", + "participant_id": "390605614583363778", + "participant_name": "clanguml::t20008::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 1180776240543224244, + "location": "clanguml::t20008::tmain()" + } + } + ], + "using_namespace": "clanguml::t20008" +} +``` diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index 90eb3492..3082972e 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<const char *> - + B<const char *> - - + + A<const char *> - + A<const char *> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - - - - - - - + + + + + + + + b(int) - + a1(int) - + b(const char *) - + a2(const char *) - + b(std::string) - + a3(std::string) diff --git a/docs/test_cases/t20009.md b/docs/test_cases/t20009.md index e73dcf56..03b914e8 100644 --- a/docs/test_cases/t20009.md +++ b/docs/test_cases/t20009.md @@ -51,3 +51,218 @@ void tmain() ``` ## Generated UML diagrams ![t20009_sequence](./t20009_sequence.svg "Smart pointer dereference call expression test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20009_sequence", + "participants": [ + { + "id": "791066686606379857", + "name": "clanguml::t20009::tmain()", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 18 + }, + "type": "function" + }, + { + "id": "450813573860627679", + "name": "clanguml::t20009::B", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 10 + }, + "type": "class" + }, + { + "id": "1197403810800583218", + "name": "clanguml::t20009::A", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "2002310682025149090", + "name": "clanguml::t20009::B", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 10 + }, + "type": "class" + }, + { + "id": "1228498754558363121", + "name": "clanguml::t20009::A", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "1461902328659683203", + "name": "clanguml::t20009::B", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 10 + }, + "type": "class" + }, + { + "id": "1243520246309441967", + "name": "clanguml::t20009::A", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 6 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "791066686606379857", + "activity_name": "clanguml::t20009::tmain()", + "participant_id": "791066686606379857", + "participant_name": "clanguml::t20009::tmain()" + }, + "name": "b(std::string)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 24 + }, + "to": { + "activity_id": "1960266381909090879", + "activity_name": "clanguml::t20009::B::b(std::string)", + "participant_id": "450813573860627679", + "participant_name": "clanguml::t20009::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1960266381909090879", + "activity_name": "clanguml::t20009::B::b(std::string)", + "participant_id": "450813573860627679", + "participant_name": "clanguml::t20009::B" + }, + "name": "a(std::string)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 11 + }, + "to": { + "activity_id": "1716775846967761286", + "activity_name": "clanguml::t20009::A::a(std::string)", + "participant_id": "1197403810800583218", + "participant_name": "clanguml::t20009::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "791066686606379857", + "activity_name": "clanguml::t20009::tmain()", + "participant_id": "791066686606379857", + "participant_name": "clanguml::t20009::tmain()" + }, + "name": "b(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 25 + }, + "to": { + "activity_id": "660557928399203634", + "activity_name": "clanguml::t20009::B::b(int)", + "participant_id": "2002310682025149090", + "participant_name": "clanguml::t20009::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "660557928399203634", + "activity_name": "clanguml::t20009::B::b(int)", + "participant_id": "2002310682025149090", + "participant_name": "clanguml::t20009::B" + }, + "name": "a(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 11 + }, + "to": { + "activity_id": "2030629454810805092", + "activity_name": "clanguml::t20009::A::a(int)", + "participant_id": "1228498754558363121", + "participant_name": "clanguml::t20009::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "791066686606379857", + "activity_name": "clanguml::t20009::tmain()", + "participant_id": "791066686606379857", + "participant_name": "clanguml::t20009::tmain()" + }, + "name": "b(float)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 26 + }, + "to": { + "activity_id": "367805163135583282", + "activity_name": "clanguml::t20009::B::b(float)", + "participant_id": "1461902328659683203", + "participant_name": "clanguml::t20009::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "367805163135583282", + "activity_name": "clanguml::t20009::B::b(float)", + "participant_id": "1461902328659683203", + "participant_name": "clanguml::t20009::B" + }, + "name": "a(float)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20009/t20009.cc", + "line": 11 + }, + "to": { + "activity_id": "1643733911490581293", + "activity_name": "clanguml::t20009::A::a(float)", + "participant_id": "1243520246309441967", + "participant_name": "clanguml::t20009::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 791066686606379857, + "location": "clanguml::t20009::tmain()" + } + } + ], + "using_namespace": "clanguml::t20009" +} +``` diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index ddf296cb..228e46bc 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<float> - + B<float> - - + + A<float> - + A<float> - - - - - - - - + + + + + + + + b(std::string) - + a(std::string) - + b(int) - + a(int) - + b(float) - + a(float) diff --git a/docs/test_cases/t20010.md b/docs/test_cases/t20010.md index 0a067b96..c9d3ece1 100644 --- a/docs/test_cases/t20010.md +++ b/docs/test_cases/t20010.md @@ -61,3 +61,226 @@ void tmain() ``` ## Generated UML diagrams ![t20010_sequence](./t20010_sequence.svg "Container sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20010_sequence", + "participants": [ + { + "id": "1364660609791735244", + "name": "clanguml::t20010::tmain()", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 28 + }, + "type": "function" + }, + { + "id": "2154977200904210115", + "name": "clanguml::t20010::B", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 16 + }, + "type": "class" + }, + { + "id": "102070351492425113", + "name": "clanguml::t20010::A", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 9 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1364660609791735244", + "activity_name": "clanguml::t20010::tmain()", + "participant_id": "1364660609791735244", + "participant_name": "clanguml::t20010::tmain()" + }, + "name": "b1()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 32 + }, + "to": { + "activity_id": "343626060927491836", + "activity_name": "clanguml::t20010::B::b1()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "343626060927491836", + "activity_name": "clanguml::t20010::B::b1()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "name": "a1()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 17 + }, + "to": { + "activity_id": "981184681827469850", + "activity_name": "clanguml::t20010::A::a1()", + "participant_id": "102070351492425113", + "participant_name": "clanguml::t20010::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1364660609791735244", + "activity_name": "clanguml::t20010::tmain()", + "participant_id": "1364660609791735244", + "participant_name": "clanguml::t20010::tmain()" + }, + "name": "b2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 33 + }, + "to": { + "activity_id": "1633031113603062043", + "activity_name": "clanguml::t20010::B::b2()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1633031113603062043", + "activity_name": "clanguml::t20010::B::b2()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "name": "a2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 18 + }, + "to": { + "activity_id": "664370880632146592", + "activity_name": "clanguml::t20010::A::a2()", + "participant_id": "102070351492425113", + "participant_name": "clanguml::t20010::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1364660609791735244", + "activity_name": "clanguml::t20010::tmain()", + "participant_id": "1364660609791735244", + "participant_name": "clanguml::t20010::tmain()" + }, + "name": "b3()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 34 + }, + "to": { + "activity_id": "786218543654309692", + "activity_name": "clanguml::t20010::B::b3()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "786218543654309692", + "activity_name": "clanguml::t20010::B::b3()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "name": "a3()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 19 + }, + "to": { + "activity_id": "2145739294823015899", + "activity_name": "clanguml::t20010::A::a3()", + "participant_id": "102070351492425113", + "participant_name": "clanguml::t20010::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1364660609791735244", + "activity_name": "clanguml::t20010::tmain()", + "participant_id": "1364660609791735244", + "participant_name": "clanguml::t20010::tmain()" + }, + "name": "b4()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 35 + }, + "to": { + "activity_id": "1866068965397702666", + "activity_name": "clanguml::t20010::B::b4()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1866068965397702666", + "activity_name": "clanguml::t20010::B::b4()", + "participant_id": "2154977200904210115", + "participant_name": "clanguml::t20010::B" + }, + "name": "a4()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20010/t20010.cc", + "line": 20 + }, + "to": { + "activity_id": "1224936485834400821", + "activity_name": "clanguml::t20010::A::a4()", + "participant_id": "102070351492425113", + "participant_name": "clanguml::t20010::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 1364660609791735244, + "location": "clanguml::t20010::tmain()" + } + } + ], + "using_namespace": "clanguml::t20010" +} +``` diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index 020e4ec8..f6da7b82 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A - + A - - - - - - - - - - + + + + + + + + + + b1() - + a1() - + b2() - + a2() - + b3() - + a3() - + b4() - + a4() diff --git a/docs/test_cases/t20011.md b/docs/test_cases/t20011.md index 3c9f43ef..cd14b480 100644 --- a/docs/test_cases/t20011.md +++ b/docs/test_cases/t20011.md @@ -53,3 +53,219 @@ void tmain() ``` ## Generated UML diagrams ![t20011_sequence](./t20011_sequence.svg "Recursive calls sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20011_sequence", + "participants": [ + { + "id": "1866210527166391126", + "name": "clanguml::t20011::tmain()", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 22 + }, + "type": "function" + }, + { + "id": "816061502062128285", + "name": "clanguml::t20011::A", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 4 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1866210527166391126", + "activity_name": "clanguml::t20011::tmain()", + "participant_id": "1866210527166391126", + "participant_name": "clanguml::t20011::tmain()" + }, + "name": "a(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 26 + }, + "to": { + "activity_id": "1647578261840204206", + "activity_name": "clanguml::t20011::A::a(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "type": "message" + }, + { + "activity_id": "1647578261840204206", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "1647578261840204206", + "activity_name": "clanguml::t20011::A::a(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "name": "a(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 8 + }, + "to": { + "activity_id": "1647578261840204206", + "activity_name": "clanguml::t20011::A::a(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "type": "message" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + }, + { + "from": { + "activity_id": "1866210527166391126", + "activity_name": "clanguml::t20011::tmain()", + "participant_id": "1866210527166391126", + "participant_name": "clanguml::t20011::tmain()" + }, + "name": "b(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 28 + }, + "to": { + "activity_id": "305456175818875420", + "activity_name": "clanguml::t20011::A::b(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "305456175818875420", + "activity_name": "clanguml::t20011::A::b(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "name": "c(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 11 + }, + "to": { + "activity_id": "963268672079901211", + "activity_name": "clanguml::t20011::A::c(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "963268672079901211", + "activity_name": "clanguml::t20011::A::c(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "name": "d(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 12 + }, + "to": { + "activity_id": "1874311762268001137", + "activity_name": "clanguml::t20011::A::d(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "type": "message" + }, + { + "activity_id": "1874311762268001137", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "1874311762268001137", + "activity_name": "clanguml::t20011::A::d(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "name": "b(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 16 + }, + "to": { + "activity_id": "305456175818875420", + "activity_name": "clanguml::t20011::A::b(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1874311762268001137", + "activity_name": "clanguml::t20011::A::d(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "name": "a(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20011/t20011.cc", + "line": 18 + }, + "to": { + "activity_id": "1647578261840204206", + "activity_name": "clanguml::t20011::A::a(int)", + "participant_id": "816061502062128285", + "participant_name": "clanguml::t20011::A" + }, + "type": "message" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + } + ], + "start_from": { + "id": 1866210527166391126, + "location": "clanguml::t20011::tmain()" + } + } + ], + "using_namespace": "clanguml::t20011" +} +``` diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 13bf80a0..66ec6fdb 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - + + + + + + + + + + a(int) @@ -52,26 +52,26 @@ alt - + a(int) - + b(int) - + c(int) - + @@ -81,14 +81,14 @@ alt - + b(int) - + @@ -98,7 +98,7 @@ alt - + diff --git a/docs/test_cases/t20012.md b/docs/test_cases/t20012.md index a874e7a7..ffe5f498 100644 --- a/docs/test_cases/t20012.md +++ b/docs/test_cases/t20012.md @@ -126,3 +126,456 @@ void tmain() ``` ## Generated UML diagrams ![t20012_sequence](./t20012_sequence.svg "Lambda expression call sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20012_sequence", + "participants": [ + { + "id": "893699278278125827", + "name": "clanguml::t20012::tmain()", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 58 + }, + "type": "function" + }, + { + "id": "871571755123349249", + "name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 66 + }, + "type": "class" + }, + { + "id": "1798184226128732119", + "name": "clanguml::t20012::A", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 9 + }, + "type": "class" + }, + { + "id": "1893469899260202653", + "name": "clanguml::t20012::B", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 17 + }, + "type": "class" + }, + { + "id": "516948909715002916", + "name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 79 + }, + "type": "class" + }, + { + "id": "2071958121786360262", + "name": "clanguml::t20012::C", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 27 + }, + "type": "class" + }, + { + "id": "1639905845562724067", + "name": "clanguml::t20012::R", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 47 + }, + "type": "class" + }, + { + "id": "105322683015690128", + "name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 85 + }, + "type": "class" + }, + { + "id": "1627226326147373737", + "name": "clanguml::t20012::D", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 35 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "893699278278125827", + "activity_name": "clanguml::t20012::tmain()", + "participant_id": "893699278278125827", + "participant_name": "clanguml::t20012::tmain()" + }, + "name": "operator()()", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 72 + }, + "to": { + "activity_id": "601151241333493101", + "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", + "participant_id": "871571755123349249", + "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "601151241333493101", + "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", + "participant_id": "871571755123349249", + "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)" + }, + "name": "a()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 67 + }, + "to": { + "activity_id": "1871432932744498976", + "activity_name": "clanguml::t20012::A::a()", + "participant_id": "1798184226128732119", + "participant_name": "clanguml::t20012::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1871432932744498976", + "activity_name": "clanguml::t20012::A::a()", + "participant_id": "1798184226128732119", + "participant_name": "clanguml::t20012::A" + }, + "name": "aa()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 10 + }, + "to": { + "activity_id": "1100933039353876539", + "activity_name": "clanguml::t20012::A::aa()", + "participant_id": "1798184226128732119", + "participant_name": "clanguml::t20012::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1100933039353876539", + "activity_name": "clanguml::t20012::A::aa()", + "participant_id": "1798184226128732119", + "participant_name": "clanguml::t20012::A" + }, + "name": "aaa()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 12 + }, + "to": { + "activity_id": "941636185823691898", + "activity_name": "clanguml::t20012::A::aaa()", + "participant_id": "1798184226128732119", + "participant_name": "clanguml::t20012::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "601151241333493101", + "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", + "participant_id": "871571755123349249", + "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)" + }, + "name": "b()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 68 + }, + "to": { + "activity_id": "2142697410385270633", + "activity_name": "clanguml::t20012::B::b()", + "participant_id": "1893469899260202653", + "participant_name": "clanguml::t20012::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2142697410385270633", + "activity_name": "clanguml::t20012::B::b()", + "participant_id": "1893469899260202653", + "participant_name": "clanguml::t20012::B" + }, + "name": "bb()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 18 + }, + "to": { + "activity_id": "973718340784931313", + "activity_name": "clanguml::t20012::B::bb()", + "participant_id": "1893469899260202653", + "participant_name": "clanguml::t20012::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "973718340784931313", + "activity_name": "clanguml::t20012::B::bb()", + "participant_id": "1893469899260202653", + "participant_name": "clanguml::t20012::B" + }, + "name": "bbb()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 20 + }, + "to": { + "activity_id": "195788529004378403", + "activity_name": "clanguml::t20012::B::bbb()", + "participant_id": "1893469899260202653", + "participant_name": "clanguml::t20012::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "893699278278125827", + "activity_name": "clanguml::t20012::tmain()", + "participant_id": "893699278278125827", + "participant_name": "clanguml::t20012::tmain()" + }, + "name": "operator()()", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 83 + }, + "to": { + "activity_id": "435249756897748529", + "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:79:20)::operator()()", + "participant_id": "516948909715002916", + "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:79:20)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "435249756897748529", + "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)::operator()()", + "participant_id": "516948909715002916", + "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)" + }, + "name": "c()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 80 + }, + "to": { + "activity_id": "675369415318225607", + "activity_name": "clanguml::t20012::C::c()", + "participant_id": "2071958121786360262", + "participant_name": "clanguml::t20012::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "675369415318225607", + "activity_name": "clanguml::t20012::C::c()", + "participant_id": "2071958121786360262", + "participant_name": "clanguml::t20012::C" + }, + "name": "cc()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 28 + }, + "to": { + "activity_id": "1451821704315336057", + "activity_name": "clanguml::t20012::C::cc()", + "participant_id": "2071958121786360262", + "participant_name": "clanguml::t20012::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1451821704315336057", + "activity_name": "clanguml::t20012::C::cc()", + "participant_id": "2071958121786360262", + "participant_name": "clanguml::t20012::C" + }, + "name": "ccc()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 30 + }, + "to": { + "activity_id": "1956141408799600460", + "activity_name": "clanguml::t20012::C::ccc()", + "participant_id": "2071958121786360262", + "participant_name": "clanguml::t20012::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "435249756897748529", + "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)::operator()()", + "participant_id": "516948909715002916", + "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)" + }, + "name": "operator()()", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 81 + }, + "to": { + "activity_id": "601151241333493101", + "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", + "participant_id": "871571755123349249", + "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "893699278278125827", + "activity_name": "clanguml::t20012::tmain()", + "participant_id": "893699278278125827", + "participant_name": "clanguml::t20012::tmain()" + }, + "name": "r()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 87 + }, + "to": { + "activity_id": "1003931867044486762", + "activity_name": "clanguml::t20012::R::r()", + "participant_id": "1639905845562724067", + "participant_name": "clanguml::t20012::R" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1003931867044486762", + "activity_name": "clanguml::t20012::R::r()", + "participant_id": "1639905845562724067", + "participant_name": "clanguml::t20012::R" + }, + "name": "operator()()", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 53 + }, + "to": { + "activity_id": "31472345599504206", + "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:85:9)::operator()()", + "participant_id": "105322683015690128", + "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:85:9)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "31472345599504206", + "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)::operator()()", + "participant_id": "105322683015690128", + "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)" + }, + "name": "c()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 85 + }, + "to": { + "activity_id": "675369415318225607", + "activity_name": "clanguml::t20012::C::c()", + "participant_id": "2071958121786360262", + "participant_name": "clanguml::t20012::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "893699278278125827", + "activity_name": "clanguml::t20012::tmain()", + "participant_id": "893699278278125827", + "participant_name": "clanguml::t20012::tmain()" + }, + "name": "add5(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20012/t20012.cc", + "line": 93 + }, + "to": { + "activity_id": "1355013132527568474", + "activity_name": "clanguml::t20012::D::add5(int)", + "participant_id": "1627226326147373737", + "participant_name": "clanguml::t20012::D" + }, + "type": "message" + } + ], + "start_from": { + "id": 893699278278125827, + "location": "clanguml::t20012::tmain()" + } + } + ], + "using_namespace": "clanguml::t20012" +} +``` diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index 33bc84c6..cbd04446 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -43,122 +43,122 @@ - - + + tmain() - + tmain() - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - - + + D - + D - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -167,67 +167,67 @@ - + operator()() - + c() - + cc() - + ccc() - + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -238,29 +238,29 @@ - + r() - + operator()() - + c() - + cc() - + @@ -269,7 +269,7 @@ - + add5(int) diff --git a/docs/test_cases/t20013.md b/docs/test_cases/t20013.md index 3b282d26..51ae1bd0 100644 --- a/docs/test_cases/t20013.md +++ b/docs/test_cases/t20013.md @@ -49,3 +49,182 @@ void tmain(int argc, char **argv) ``` ## Generated UML diagrams ![t20013_sequence](./t20013_sequence.svg "Function and method arguments in sequence diagrams test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20013_sequence", + "participants": [ + { + "id": "1249768632077843821", + "name": "clanguml::t20013::tmain(int,char **)", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 18 + }, + "type": "function" + }, + { + "id": "1106407610612951303", + "name": "clanguml::t20013::B", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 10 + }, + "type": "class" + }, + { + "id": "976623130699225079", + "name": "clanguml::t20013::A", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 4 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1249768632077843821", + "activity_name": "clanguml::t20013::tmain(int,char **)", + "participant_id": "1249768632077843821", + "participant_name": "clanguml::t20013::tmain(int,char **)" + }, + "name": "b(int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 22 + }, + "to": { + "activity_id": "2144804108273682993", + "activity_name": "clanguml::t20013::B::b(int)", + "participant_id": "1106407610612951303", + "participant_name": "clanguml::t20013::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2144804108273682993", + "activity_name": "clanguml::t20013::B::b(int)", + "participant_id": "1106407610612951303", + "participant_name": "clanguml::t20013::B" + }, + "name": "a1(int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 11 + }, + "to": { + "activity_id": "1034027282942033004", + "activity_name": "clanguml::t20013::A::a1(int)", + "participant_id": "976623130699225079", + "participant_name": "clanguml::t20013::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1249768632077843821", + "activity_name": "clanguml::t20013::tmain(int,char **)", + "participant_id": "1249768632077843821", + "participant_name": "clanguml::t20013::tmain(int,char **)" + }, + "name": "b(double)", + "return_type": "double", + "scope": "normal", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 23 + }, + "to": { + "activity_id": "640747884486165287", + "activity_name": "clanguml::t20013::B::b(double)", + "participant_id": "1106407610612951303", + "participant_name": "clanguml::t20013::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "640747884486165287", + "activity_name": "clanguml::t20013::B::b(double)", + "participant_id": "1106407610612951303", + "participant_name": "clanguml::t20013::B" + }, + "name": "a2(double)", + "return_type": "double", + "scope": "normal", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 12 + }, + "to": { + "activity_id": "394053399890813915", + "activity_name": "clanguml::t20013::A::a2(double)", + "participant_id": "976623130699225079", + "participant_name": "clanguml::t20013::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1249768632077843821", + "activity_name": "clanguml::t20013::tmain(int,char **)", + "participant_id": "1249768632077843821", + "participant_name": "clanguml::t20013::tmain(int,char **)" + }, + "name": "b(const char *)", + "return_type": "const char *", + "scope": "normal", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 24 + }, + "to": { + "activity_id": "1066935874364409142", + "activity_name": "clanguml::t20013::B::b(const char *)", + "participant_id": "1106407610612951303", + "participant_name": "clanguml::t20013::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1066935874364409142", + "activity_name": "clanguml::t20013::B::b(const char *)", + "participant_id": "1106407610612951303", + "participant_name": "clanguml::t20013::B" + }, + "name": "a3(const char *)", + "return_type": "const char *", + "scope": "normal", + "source_location": { + "file": "../../tests/t20013/t20013.cc", + "line": 13 + }, + "to": { + "activity_id": "1841239321495867611", + "activity_name": "clanguml::t20013::A::a3(const char *)", + "participant_id": "976623130699225079", + "participant_name": "clanguml::t20013::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 1249768632077843821, + "location": "clanguml::t20013::tmain(int,char **)" + } + } + ], + "using_namespace": "clanguml::t20013" +} +``` diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index 7fb367d9..3dcc79a9 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -58,12 +58,12 @@ - + b(double) - + a2(double) @@ -72,12 +72,12 @@ - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20014.md b/docs/test_cases/t20014.md index 8b66928c..68de8c88 100644 --- a/docs/test_cases/t20014.md +++ b/docs/test_cases/t20014.md @@ -84,3 +84,191 @@ namespace t20014 { ``` ## Generated UML diagrams ![t20014_sequence](./t20014_sequence.svg "Multiple translation units sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20014_sequence", + "participants": [ + { + "id": "512436830818921250", + "name": "clanguml::t20014::tmain()", + "source_location": { + "file": "../../tests/t20014/t20014.cc", + "line": 10 + }, + "type": "function" + }, + { + "id": "1537634076295867978", + "name": "clanguml::t20014::B", + "source_location": { + "file": "../../tests/t20014/include/t20014_b.h", + "line": 8 + }, + "type": "class" + }, + { + "id": "1504706415756333840", + "name": "clanguml::t20014::A", + "source_location": { + "file": "../../tests/t20014/include/t20014_a.h", + "line": 6 + }, + "type": "class" + }, + { + "id": "500712304857049435", + "name": "clanguml::t20014::C", + "source_location": { + "file": "../../tests/t20014/include/t20014_c.h", + "line": 6 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "512436830818921250", + "activity_name": "clanguml::t20014::tmain()", + "participant_id": "512436830818921250", + "participant_name": "clanguml::t20014::tmain()" + }, + "name": "b1(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20014/t20014.cc", + "line": 15 + }, + "to": { + "activity_id": "1251633571711578431", + "activity_name": "clanguml::t20014::B::b1(int,int)", + "participant_id": "1537634076295867978", + "participant_name": "clanguml::t20014::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1251633571711578431", + "activity_name": "clanguml::t20014::B::b1(int,int)", + "participant_id": "1537634076295867978", + "participant_name": "clanguml::t20014::B" + }, + "name": "a1(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20014/t20014_b.cc", + "line": 5 + }, + "to": { + "activity_id": "1753682948110709616", + "activity_name": "clanguml::t20014::A::a1(int,int)", + "participant_id": "1504706415756333840", + "participant_name": "clanguml::t20014::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "512436830818921250", + "activity_name": "clanguml::t20014::tmain()", + "participant_id": "512436830818921250", + "participant_name": "clanguml::t20014::tmain()" + }, + "name": "b2(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20014/t20014.cc", + "line": 16 + }, + "to": { + "activity_id": "767830966714379991", + "activity_name": "clanguml::t20014::B::b2(int,int)", + "participant_id": "1537634076295867978", + "participant_name": "clanguml::t20014::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "767830966714379991", + "activity_name": "clanguml::t20014::B::b2(int,int)", + "participant_id": "1537634076295867978", + "participant_name": "clanguml::t20014::B" + }, + "name": "a2(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20014/t20014_b.cc", + "line": 7 + }, + "to": { + "activity_id": "1943487088673912694", + "activity_name": "clanguml::t20014::A::a2(int,int)", + "participant_id": "1504706415756333840", + "participant_name": "clanguml::t20014::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "512436830818921250", + "activity_name": "clanguml::t20014::tmain()", + "participant_id": "512436830818921250", + "participant_name": "clanguml::t20014::tmain()" + }, + "name": "c1(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20014/t20014.cc", + "line": 18 + }, + "to": { + "activity_id": "407559038402563981", + "activity_name": "clanguml::t20014::C::c1(int,int)", + "participant_id": "500712304857049435", + "participant_name": "clanguml::t20014::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "407559038402563981", + "activity_name": "clanguml::t20014::C::c1(int,int)", + "participant_id": "500712304857049435", + "participant_name": "clanguml::t20014::C" + }, + "name": "b1(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20014/include/t20014_c.h", + "line": 7 + }, + "to": { + "activity_id": "1251633571711578431", + "activity_name": "clanguml::t20014::B::b1(int,int)", + "participant_id": "1537634076295867978", + "participant_name": "clanguml::t20014::B" + }, + "type": "message" + } + ], + "start_from": { + "id": 512436830818921250, + "location": "clanguml::t20014::tmain()" + } + } + ], + "using_namespace": "clanguml::t20014" +} +``` diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index 40796222..34639fa5 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - - - - - - - + + + + + + + + - - + + tmain() - + tmain() - - + + B - + B - - + + A - + A - - + + C<B,int> - + C<B,int> - - - - - - - - - + + + + + + + + + b1(int,int) - + a1(int,int) @@ -67,12 +67,12 @@ - + b2(int,int) - + a2(int,int) @@ -81,17 +81,17 @@ - + c1(int,int) - + b1(int,int) - + a1(int,int) diff --git a/docs/test_cases/t20015.md b/docs/test_cases/t20015.md index b8f6ebaa..9174ca02 100644 --- a/docs/test_cases/t20015.md +++ b/docs/test_cases/t20015.md @@ -65,3 +65,63 @@ void tmain() ``` ## Generated UML diagrams ![t20015_sequence](./t20015_sequence.svg "Class exclusion by namespace in sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20015_sequence", + "participants": [ + { + "id": "1011496551872082945", + "name": "clanguml::t20015::tmain()", + "source_location": { + "file": "../../tests/t20015/t20015.cc", + "line": 31 + }, + "type": "function" + }, + { + "id": "1302656676783358645", + "name": "clanguml::t20015::B", + "source_location": { + "file": "../../tests/t20015/t20015.cc", + "line": 21 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1011496551872082945", + "activity_name": "clanguml::t20015::tmain()", + "participant_id": "1011496551872082945", + "participant_name": "clanguml::t20015::tmain()" + }, + "name": "setup_a(std::shared_ptr &)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20015/t20015.cc", + "line": 37 + }, + "to": { + "activity_id": "431575772398797060", + "activity_name": "clanguml::t20015::B::setup_a(std::shared_ptr &)", + "participant_id": "1302656676783358645", + "participant_name": "clanguml::t20015::B" + }, + "type": "message" + } + ], + "start_from": { + "id": 1011496551872082945, + "location": "clanguml::t20015::tmain()" + } + } + ], + "using_namespace": "clanguml::t20015" +} +``` diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index e77a03e3..49953ceb 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + B - + B - - - + + + setup_a(std::shared_ptr<detail::A> &) diff --git a/docs/test_cases/t20016.md b/docs/test_cases/t20016.md index a9dcb528..8358bfc2 100644 --- a/docs/test_cases/t20016.md +++ b/docs/test_cases/t20016.md @@ -47,3 +47,138 @@ void tmain() ``` ## Generated UML diagrams ![t20016_sequence](./t20016_sequence.svg "Template method specialization sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20016_sequence", + "participants": [ + { + "id": "1912662358651926712", + "name": "clanguml::t20016::tmain()", + "source_location": { + "file": "../../tests/t20016/t20016.cc", + "line": 16 + }, + "type": "function" + }, + { + "id": "1688340912643326666", + "name": "clanguml::t20016::B", + "source_location": { + "file": "../../tests/t20016/t20016.cc", + "line": 8 + }, + "type": "class" + }, + { + "id": "1351242594275053195", + "name": "clanguml::t20016::A", + "source_location": { + "file": "../../tests/t20016/t20016.cc", + "line": 3 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1912662358651926712", + "activity_name": "clanguml::t20016::tmain()", + "participant_id": "1912662358651926712", + "participant_name": "clanguml::t20016::tmain()" + }, + "name": "b1(long)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20016/t20016.cc", + "line": 20 + }, + "to": { + "activity_id": "2064264710178722261", + "activity_name": "clanguml::t20016::B::b1(long)", + "participant_id": "1688340912643326666", + "participant_name": "clanguml::t20016::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2064264710178722261", + "activity_name": "clanguml::t20016::B::b1(long)", + "participant_id": "1688340912643326666", + "participant_name": "clanguml::t20016::B" + }, + "name": "a1(int)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20016/t20016.cc", + "line": 9 + }, + "to": { + "activity_id": "1198371121423942542", + "activity_name": "clanguml::t20016::A::a1(int)", + "participant_id": "1351242594275053195", + "participant_name": "clanguml::t20016::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1912662358651926712", + "activity_name": "clanguml::t20016::tmain()", + "participant_id": "1912662358651926712", + "participant_name": "clanguml::t20016::tmain()" + }, + "name": "b2(long)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20016/t20016.cc", + "line": 22 + }, + "to": { + "activity_id": "203381140188081853", + "activity_name": "clanguml::t20016::B::b2(long)", + "participant_id": "1688340912643326666", + "participant_name": "clanguml::t20016::B" + }, + "type": "message" + }, + { + "from": { + "activity_id": "203381140188081853", + "activity_name": "clanguml::t20016::B::b2(long)", + "participant_id": "1688340912643326666", + "participant_name": "clanguml::t20016::B" + }, + "name": "a2(const long &)", + "return_type": "long", + "scope": "normal", + "source_location": { + "file": "../../tests/t20016/t20016.cc", + "line": 11 + }, + "to": { + "activity_id": "1208784669530380166", + "activity_name": "clanguml::t20016::A::a2(const long &)", + "participant_id": "1351242594275053195", + "participant_name": "clanguml::t20016::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 1912662358651926712, + "location": "clanguml::t20016::tmain()" + } + } + ], + "using_namespace": "clanguml::t20016" +} +``` diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index a75b3c5a..10e2b0f1 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - - - - + + + + + - - + + tmain() - + tmain() - - + + B<long> - + B<long> - - + + A - + A - - - - - - + + + + + + b1(long) - + a1(int) - + b2(long) - + a2(const long &) diff --git a/docs/test_cases/t20017.md b/docs/test_cases/t20017.md index a023c4ea..45faa15e 100644 --- a/docs/test_cases/t20017.md +++ b/docs/test_cases/t20017.md @@ -44,3 +44,160 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } ``` ## Generated UML diagrams ![t20017_sequence](./t20017_sequence.svg "Test case for combine_free_functions_into_file_participants option") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20017_sequence", + "participants": [ + { + "id": "294332401323799021", + "name": "t20017.cc", + "source_location": { + "file": "t20017.cc", + "line": 6 + }, + "type": "function" + }, + { + "id": "1591222867263639510", + "name": "include/t20017_a.h", + "source_location": { + "file": "include/t20017_a.h", + "line": 7 + }, + "type": "function" + }, + { + "id": "1113611539183189365", + "name": "include/t20017_b.h", + "source_location": { + "file": "include/t20017_b.h", + "line": 5 + }, + "type": "function" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1484746432546296115", + "activity_name": "clanguml::t20017::tmain()", + "participant_id": "294332401323799021", + "participant_name": "t20017.cc" + }, + "name": "a3(int,int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "t20017.cc", + "line": 6 + }, + "to": { + "activity_id": "1681392050252260928", + "activity_name": "clanguml::t20017::a3(int,int)", + "participant_id": "1591222867263639510", + "participant_name": "include/t20017_a.h" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1484746432546296115", + "activity_name": "clanguml::t20017::tmain()", + "participant_id": "294332401323799021", + "participant_name": "t20017.cc" + }, + "name": "b1(int,int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "t20017.cc", + "line": 6 + }, + "to": { + "activity_id": "1714277838806105702", + "activity_name": "clanguml::t20017::b1(int,int)", + "participant_id": "1113611539183189365", + "participant_name": "include/t20017_b.h" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1484746432546296115", + "activity_name": "clanguml::t20017::tmain()", + "participant_id": "294332401323799021", + "participant_name": "t20017.cc" + }, + "name": "a2(int,int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "t20017.cc", + "line": 6 + }, + "to": { + "activity_id": "291553542743365259", + "activity_name": "clanguml::t20017::a2(int,int)", + "participant_id": "1591222867263639510", + "participant_name": "include/t20017_a.h" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1484746432546296115", + "activity_name": "clanguml::t20017::tmain()", + "participant_id": "294332401323799021", + "participant_name": "t20017.cc" + }, + "name": "a1(int,int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "t20017.cc", + "line": 6 + }, + "to": { + "activity_id": "113759676939330212", + "activity_name": "clanguml::t20017::a1(int,int)", + "participant_id": "1591222867263639510", + "participant_name": "include/t20017_a.h" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1484746432546296115", + "activity_name": "clanguml::t20017::tmain()", + "participant_id": "294332401323799021", + "participant_name": "t20017.cc" + }, + "name": "b2(int,int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "t20017.cc", + "line": 6 + }, + "to": { + "activity_id": "775081116464505528", + "activity_name": "clanguml::t20017::b2(int,int)", + "participant_id": "1113611539183189365", + "participant_name": "include/t20017_b.h" + }, + "type": "message" + } + ], + "start_from": { + "id": 1484746432546296115, + "location": "clanguml::t20017::tmain()" + } + } + ], + "using_namespace": "clanguml::t20017" +} +``` diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index 86e801c7..8f319b13 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,65 +9,65 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_a.h - + include/t20017_a.h - + include/t20017_b.h - + include/t20017_b.h - - - - - - + + + + + + tmain() - + a3(int,int) - + b1(int,int) - + a2(int,int) - + a1(int,int) - + b2<int>(int,int) diff --git a/docs/test_cases/t20018.md b/docs/test_cases/t20018.md index 4caa67e9..24d01a05 100644 --- a/docs/test_cases/t20018.md +++ b/docs/test_cases/t20018.md @@ -49,3 +49,249 @@ void tmain() { Answer>::print(); } ``` ## Generated UML diagrams ![t20018_sequence](./t20018_sequence.svg "Recursive template sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20018_sequence", + "participants": [ + { + "id": "227581758025403815", + "name": "clanguml::t20018::tmain()", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 25 + }, + "type": "function" + }, + { + "id": "1163521725351533502", + "name": "clanguml::t20018::Answer,120>", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 21 + }, + "type": "class" + }, + { + "id": "1482779373563849921", + "name": "clanguml::t20018::Factorial<5>", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "52416404065514823", + "name": "clanguml::t20018::Factorial<4>", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "1658728078296100018", + "name": "clanguml::t20018::Factorial<3>", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "969903469166760124", + "name": "clanguml::t20018::Factorial<2>", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "2032621198190600516", + "name": "clanguml::t20018::Factorial<1>", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "1581865799666386458", + "name": "clanguml::t20018::Factorial<0>", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 12 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "227581758025403815", + "activity_name": "clanguml::t20018::tmain()", + "participant_id": "227581758025403815", + "participant_name": "clanguml::t20018::tmain()" + }, + "name": "print()", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 25 + }, + "to": { + "activity_id": "1185770766239304952", + "activity_name": "clanguml::t20018::Answer,120>::print()", + "participant_id": "1163521725351533502", + "participant_name": "clanguml::t20018::Answer,120>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1185770766239304952", + "activity_name": "clanguml::t20018::Answer,120>::print()", + "participant_id": "1163521725351533502", + "participant_name": "clanguml::t20018::Answer,120>" + }, + "name": "print(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 22 + }, + "to": { + "activity_id": "833100888453299461", + "activity_name": "clanguml::t20018::Factorial<5>::print(int)", + "participant_id": "1482779373563849921", + "participant_name": "clanguml::t20018::Factorial<5>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "833100888453299461", + "activity_name": "clanguml::t20018::Factorial<5>::print(int)", + "participant_id": "1482779373563849921", + "participant_name": "clanguml::t20018::Factorial<5>" + }, + "name": "print(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 9 + }, + "to": { + "activity_id": "1782586643813991247", + "activity_name": "clanguml::t20018::Factorial<4>::print(int)", + "participant_id": "52416404065514823", + "participant_name": "clanguml::t20018::Factorial<4>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1782586643813991247", + "activity_name": "clanguml::t20018::Factorial<4>::print(int)", + "participant_id": "52416404065514823", + "participant_name": "clanguml::t20018::Factorial<4>" + }, + "name": "print(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 9 + }, + "to": { + "activity_id": "1238078028595736678", + "activity_name": "clanguml::t20018::Factorial<3>::print(int)", + "participant_id": "1658728078296100018", + "participant_name": "clanguml::t20018::Factorial<3>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1238078028595736678", + "activity_name": "clanguml::t20018::Factorial<3>::print(int)", + "participant_id": "1658728078296100018", + "participant_name": "clanguml::t20018::Factorial<3>" + }, + "name": "print(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 9 + }, + "to": { + "activity_id": "2163270950475476780", + "activity_name": "clanguml::t20018::Factorial<2>::print(int)", + "participant_id": "969903469166760124", + "participant_name": "clanguml::t20018::Factorial<2>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2163270950475476780", + "activity_name": "clanguml::t20018::Factorial<2>::print(int)", + "participant_id": "969903469166760124", + "participant_name": "clanguml::t20018::Factorial<2>" + }, + "name": "print(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 9 + }, + "to": { + "activity_id": "501166016325937670", + "activity_name": "clanguml::t20018::Factorial<1>::print(int)", + "participant_id": "2032621198190600516", + "participant_name": "clanguml::t20018::Factorial<1>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "501166016325937670", + "activity_name": "clanguml::t20018::Factorial<1>::print(int)", + "participant_id": "2032621198190600516", + "participant_name": "clanguml::t20018::Factorial<1>" + }, + "name": "print(int)", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20018/t20018.cc", + "line": 9 + }, + "to": { + "activity_id": "577232827352391544", + "activity_name": "clanguml::t20018::Factorial<0>::print(int)", + "participant_id": "1581865799666386458", + "participant_name": "clanguml::t20018::Factorial<0>" + }, + "type": "message" + } + ], + "start_from": { + "id": 227581758025403815, + "location": "clanguml::t20018::tmain()" + } + } + ], + "using_namespace": "clanguml::t20018" +} +``` diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index dcec0e02..e4035be0 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + @@ -25,93 +25,93 @@ - - + + tmain() - + tmain() - - + + Answer<Factorial<5>,120> - + Answer<Factorial<5>,120> - - + + Factorial<5> - + Factorial<5> - - + + Factorial<4> - + Factorial<4> - - + + Factorial<3> - + Factorial<3> - - + + Factorial<2> - + Factorial<2> - - + + Factorial<1> - + Factorial<1> - - + + Factorial<0> - + Factorial<0> - - - - - - - - - + + + + + + + + + print() - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) diff --git a/docs/test_cases/t20019.md b/docs/test_cases/t20019.md index 8188a2b0..3702f494 100644 --- a/docs/test_cases/t20019.md +++ b/docs/test_cases/t20019.md @@ -56,3 +56,200 @@ void tmain() ``` ## Generated UML diagrams ![t20019_sequence](./t20019_sequence.svg "Curiously Recurring Template Pattern sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20019_sequence", + "participants": [ + { + "id": "375304196268652861", + "name": "clanguml::t20019::tmain()", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 20 + }, + "type": "function" + }, + { + "id": "381327373934972004", + "name": "clanguml::t20019::Base", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 8 + }, + "type": "class" + }, + { + "id": "1282259011856139592", + "name": "clanguml::t20019::D1", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 12 + }, + "type": "class" + }, + { + "id": "1659477498076328530", + "name": "clanguml::t20019::Base", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 8 + }, + "type": "class" + }, + { + "id": "1307471723138212117", + "name": "clanguml::t20019::D2", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 16 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "375304196268652861", + "activity_name": "clanguml::t20019::tmain()", + "participant_id": "375304196268652861", + "participant_name": "clanguml::t20019::tmain()" + }, + "name": "name()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 23 + }, + "to": { + "activity_id": "1038853547136467401", + "activity_name": "clanguml::t20019::Base::name()", + "participant_id": "381327373934972004", + "participant_name": "clanguml::t20019::Base" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1038853547136467401", + "activity_name": "clanguml::t20019::Base::name()", + "participant_id": "381327373934972004", + "participant_name": "clanguml::t20019::Base" + }, + "name": "impl()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 9 + }, + "to": { + "activity_id": "603969604599968603", + "activity_name": "clanguml::t20019::D1::impl()", + "participant_id": "1282259011856139592", + "participant_name": "clanguml::t20019::D1" + }, + "type": "message" + }, + { + "from": { + "activity_id": "375304196268652861", + "activity_name": "clanguml::t20019::tmain()", + "participant_id": "375304196268652861", + "participant_name": "clanguml::t20019::tmain()" + }, + "name": "name()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 25 + }, + "to": { + "activity_id": "1918672956676175365", + "activity_name": "clanguml::t20019::Base::name()", + "participant_id": "1659477498076328530", + "participant_name": "clanguml::t20019::Base" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1918672956676175365", + "activity_name": "clanguml::t20019::Base::name()", + "participant_id": "1659477498076328530", + "participant_name": "clanguml::t20019::Base" + }, + "name": "impl()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 9 + }, + "to": { + "activity_id": "861400435979772695", + "activity_name": "clanguml::t20019::D2::impl()", + "participant_id": "1307471723138212117", + "participant_name": "clanguml::t20019::D2" + }, + "type": "message" + }, + { + "from": { + "activity_id": "375304196268652861", + "activity_name": "clanguml::t20019::tmain()", + "participant_id": "375304196268652861", + "participant_name": "clanguml::t20019::tmain()" + }, + "name": "name()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 28 + }, + "to": { + "activity_id": "1038853547136467401", + "activity_name": "clanguml::t20019::Base::name()", + "participant_id": "381327373934972004", + "participant_name": "clanguml::t20019::Base" + }, + "type": "message" + }, + { + "from": { + "activity_id": "375304196268652861", + "activity_name": "clanguml::t20019::tmain()", + "participant_id": "375304196268652861", + "participant_name": "clanguml::t20019::tmain()" + }, + "name": "name()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20019/t20019.cc", + "line": 30 + }, + "to": { + "activity_id": "1918672956676175365", + "activity_name": "clanguml::t20019::Base::name()", + "participant_id": "1659477498076328530", + "participant_name": "clanguml::t20019::Base" + }, + "type": "message" + } + ], + "start_from": { + "id": 375304196268652861, + "location": "clanguml::t20019::tmain()" + } + } + ], + "using_namespace": "clanguml::t20019" +} +``` diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg index 34c8e115..c11b1680 100644 --- a/docs/test_cases/t20019_sequence.svg +++ b/docs/test_cases/t20019_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + Base<D1> - + Base<D1> - - + + D1 - + D1 - - + + Base<D2> - + Base<D2> - - + + D2 - + D2 - - - - - - - - - - + + + + + + + + + + name() - + impl() - + name() - + impl() - + name() - + impl() - + name() - + impl() diff --git a/docs/test_cases/t20020.md b/docs/test_cases/t20020.md index 0e8eed4c..a22d1d0a 100644 --- a/docs/test_cases/t20020.md +++ b/docs/test_cases/t20020.md @@ -108,3 +108,402 @@ int tmain() ``` ## Generated UML diagrams ![t20020_sequence](./t20020_sequence.svg "If statement sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20020_sequence", + "participants": [ + { + "id": "432124388562400664", + "name": "clanguml::t20020::tmain()", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 39 + }, + "type": "function" + }, + { + "id": "208941846648931609", + "name": "clanguml::t20020::A", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 6 + }, + "type": "class" + }, + { + "id": "1562462306909405383", + "name": "clanguml::t20020::C", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 20 + }, + "type": "class" + }, + { + "id": "1342563483612170412", + "name": "clanguml::t20020::B", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 13 + }, + "type": "class" + }, + { + "id": "1605914310746811866", + "name": "clanguml::t20020::D", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 34 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "activity_id": "432124388562400664", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "a1()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 49 + }, + "to": { + "activity_id": "43928675765534701", + "activity_name": "clanguml::t20020::A::a1()", + "participant_id": "208941846648931609", + "participant_name": "clanguml::t20020::A" + }, + "type": "message" + } + ], + "type": "consequent" + }, + { + "messages": [ + { + "activity_id": "432124388562400664", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "a2()", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 52 + }, + "to": { + "activity_id": "1289745252290688140", + "activity_name": "clanguml::t20020::A::a2()", + "participant_id": "208941846648931609", + "participant_name": "clanguml::t20020::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "c3(int)", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 52 + }, + "to": { + "activity_id": "1303438784842196201", + "activity_name": "clanguml::t20020::C::c3(int)", + "participant_id": "1562462306909405383", + "participant_name": "clanguml::t20020::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "b1()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 53 + }, + "to": { + "activity_id": "542196582335607343", + "activity_name": "clanguml::t20020::B::b1()", + "participant_id": "1342563483612170412", + "participant_name": "clanguml::t20020::B" + }, + "type": "message" + } + ], + "type": "consequent" + }, + { + "messages": [ + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "a3()", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 54 + }, + "to": { + "activity_id": "1983660679554669898", + "activity_name": "clanguml::t20020::A::a3()", + "participant_id": "208941846648931609", + "participant_name": "clanguml::t20020::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "b2()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 55 + }, + "to": { + "activity_id": "505760236964179187", + "activity_name": "clanguml::t20020::B::b2()", + "participant_id": "1342563483612170412", + "participant_name": "clanguml::t20020::B" + }, + "type": "message" + } + ], + "type": "alternative" + } + ], + "name": "if", + "type": "alt" + }, + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "a4()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 60 + }, + "to": { + "activity_id": "20573198999978866", + "activity_name": "clanguml::t20020::A::a4()", + "participant_id": "208941846648931609", + "participant_name": "clanguml::t20020::A" + }, + "type": "message" + } + ], + "type": "alternative" + } + ], + "name": "if", + "type": "alt" + }, + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "log()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 63 + }, + "to": { + "activity_id": "1436250788704205026", + "activity_name": "clanguml::t20020::B::log()", + "participant_id": "1342563483612170412", + "participant_name": "clanguml::t20020::B" + }, + "type": "message" + }, + { + "activity_id": "432124388562400664", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "c1()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 66 + }, + "to": { + "activity_id": "1962953889020699702", + "activity_name": "clanguml::t20020::C::c1()", + "participant_id": "1562462306909405383", + "participant_name": "clanguml::t20020::C" + }, + "type": "message" + }, + { + "activity_id": "1962953889020699702", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "1962953889020699702", + "activity_name": "clanguml::t20020::C::c1()", + "participant_id": "1562462306909405383", + "participant_name": "clanguml::t20020::C" + }, + "name": "c2()", + "return_type": "_Bool", + "scope": "condition", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 25 + }, + "to": { + "activity_id": "1224151733617799047", + "activity_name": "clanguml::t20020::C::c2()", + "participant_id": "1562462306909405383", + "participant_name": "clanguml::t20020::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1962953889020699702", + "activity_name": "clanguml::t20020::C::c1()", + "participant_id": "1562462306909405383", + "participant_name": "clanguml::t20020::C" + }, + "name": "log()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 26 + }, + "to": { + "activity_id": "1108114094862697094", + "activity_name": "clanguml::t20020::C::log()", + "participant_id": "1562462306909405383", + "participant_name": "clanguml::t20020::C" + }, + "type": "message" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + }, + { + "activity_id": "432124388562400664", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "432124388562400664", + "activity_name": "clanguml::t20020::tmain()", + "participant_id": "432124388562400664", + "participant_name": "clanguml::t20020::tmain()" + }, + "name": "d1(int,int)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20020/t20020.cc", + "line": 69 + }, + "to": { + "activity_id": "1780002010052842766", + "activity_name": "clanguml::t20020::D::d1(int,int)", + "participant_id": "1605914310746811866", + "participant_name": "clanguml::t20020::D" + }, + "type": "message" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + } + ], + "start_from": { + "id": 432124388562400664, + "location": "clanguml::t20020::tmain()" + } + } + ], + "using_namespace": "clanguml::t20020" +} +``` diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index 0d520991..589448fb 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,78 +9,78 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + C - + C - - + + B - + B - - + + D<int> - + D<int> - - - - - - - - - - - - - + + + + + + + + + + + + + alt - + a1() @@ -91,7 +91,7 @@ alt - + [ @@ -100,7 +100,7 @@ - + [ @@ -109,7 +109,7 @@ - + b1() @@ -117,7 +117,7 @@ - + [ @@ -126,21 +126,21 @@ - + b2() - + a4() - + log() @@ -148,7 +148,7 @@ alt - + c1() @@ -156,7 +156,7 @@ alt - + @@ -169,7 +169,7 @@ - + @@ -179,7 +179,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20021.md b/docs/test_cases/t20021.md index a1080295..5fcf502e 100644 --- a/docs/test_cases/t20021.md +++ b/docs/test_cases/t20021.md @@ -79,3 +79,336 @@ int tmain() ``` ## Generated UML diagrams ![t20021_sequence](./t20021_sequence.svg "Loop statements sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20021_sequence", + "participants": [ + { + "id": "1682631020380557915", + "name": "clanguml::t20021::tmain()", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 30 + }, + "type": "function" + }, + { + "id": "451128000259357438", + "name": "clanguml::t20021::C", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 18 + }, + "type": "class" + }, + { + "id": "1280483607329510730", + "name": "clanguml::t20021::A", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 5 + }, + "type": "class" + }, + { + "id": "1849696080443395393", + "name": "clanguml::t20021::B", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 11 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "activity_id": "1682631020380557915", + "messages": [ + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "c4()", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 37 + }, + "to": { + "activity_id": "124927877622321176", + "activity_name": "clanguml::t20021::C::c4()", + "participant_id": "451128000259357438", + "participant_name": "clanguml::t20021::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "124927877622321176", + "activity_name": "clanguml::t20021::C::c4()", + "participant_id": "451128000259357438", + "participant_name": "clanguml::t20021::C" + }, + "name": "c5()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 22 + }, + "to": { + "activity_id": "1325720714179808628", + "activity_name": "clanguml::t20021::C::c5()", + "participant_id": "451128000259357438", + "participant_name": "clanguml::t20021::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "a3()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 38 + }, + "to": { + "activity_id": "1867955233624891190", + "activity_name": "clanguml::t20021::A::a3()", + "participant_id": "1280483607329510730", + "participant_name": "clanguml::t20021::A" + }, + "type": "message" + }, + { + "activity_id": "1682631020380557915", + "messages": [ + { + "activity_id": "1682631020380557915", + "messages": [ + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "a2()", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 40 + }, + "to": { + "activity_id": "1139294797758415018", + "activity_name": "clanguml::t20021::A::a2()", + "participant_id": "1280483607329510730", + "participant_name": "clanguml::t20021::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "c1()", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 40 + }, + "to": { + "activity_id": "2143764740072323303", + "activity_name": "clanguml::t20021::C::c1()", + "participant_id": "451128000259357438", + "participant_name": "clanguml::t20021::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "c2()", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 40 + }, + "to": { + "activity_id": "1707693479408501017", + "activity_name": "clanguml::t20021::C::c2()", + "participant_id": "451128000259357438", + "participant_name": "clanguml::t20021::C" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "a1()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 41 + }, + "to": { + "activity_id": "1659488549696810992", + "activity_name": "clanguml::t20021::A::a1()", + "participant_id": "1280483607329510730", + "participant_name": "clanguml::t20021::A" + }, + "type": "message" + } + ], + "name": "for", + "type": "loop" + }, + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "c3()", + "return_type": "int", + "scope": "condition", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 42 + }, + "to": { + "activity_id": "1302892753246800390", + "activity_name": "clanguml::t20021::C::c3()", + "participant_id": "451128000259357438", + "participant_name": "clanguml::t20021::C" + }, + "type": "message" + } + ], + "name": "do", + "type": "loop" + } + ], + "name": "while", + "type": "loop" + }, + { + "activity_id": "1682631020380557915", + "messages": [ + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "b2()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 47 + }, + "to": { + "activity_id": "1387752719733375782", + "activity_name": "clanguml::t20021::B::b2()", + "participant_id": "1849696080443395393", + "participant_name": "clanguml::t20021::B" + }, + "type": "message" + } + ], + "name": "for", + "type": "loop" + }, + { + "activity_id": "1682631020380557915", + "messages": [ + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "contents()", + "return_type": "std::vector &", + "scope": "condition", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 50 + }, + "to": { + "activity_id": "814405216385697964", + "activity_name": "clanguml::t20021::C::contents()", + "participant_id": "451128000259357438", + "participant_name": "clanguml::t20021::C" + }, + "type": "message" + } + ], + "name": "for", + "type": "loop" + }, + { + "from": { + "activity_id": "1682631020380557915", + "activity_name": "clanguml::t20021::tmain()", + "participant_id": "1682631020380557915", + "participant_name": "clanguml::t20021::tmain()" + }, + "name": "b2()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20021/t20021.cc", + "line": 54 + }, + "to": { + "activity_id": "1387752719733375782", + "activity_name": "clanguml::t20021::B::b2()", + "participant_id": "1849696080443395393", + "participant_name": "clanguml::t20021::B" + }, + "type": "message" + } + ], + "start_from": { + "id": 1682631020380557915, + "location": "clanguml::t20021::tmain()" + } + } + ], + "using_namespace": "clanguml::t20021" +} +``` diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index a26edf43..24e6a231 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + C - + C - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + loop - + [ c4() ] - + @@ -89,7 +89,7 @@ - + a3() @@ -102,7 +102,7 @@ loop - + [ @@ -111,7 +111,7 @@ - + [ @@ -120,7 +120,7 @@ - + [ @@ -129,14 +129,14 @@ - + a1() - + [ @@ -148,7 +148,7 @@ loop - + b2() @@ -158,7 +158,7 @@ loop - + [ @@ -167,7 +167,7 @@ - + b2() diff --git a/docs/test_cases/t20022.md b/docs/test_cases/t20022.md index 526f2c12..e9e6cc89 100644 --- a/docs/test_cases/t20022.md +++ b/docs/test_cases/t20022.md @@ -59,3 +59,94 @@ int tmain() ``` ## Generated UML diagrams ![t20022_sequence](./t20022_sequence.svg "Forward class declaration sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20022_sequence", + "participants": [ + { + "id": "1374011101998494743", + "name": "clanguml::t20022::tmain()", + "source_location": { + "file": "../../tests/t20022/t20022.cc", + "line": 28 + }, + "type": "function" + }, + { + "id": "1535467498096081224", + "name": "clanguml::t20022::A", + "source_location": { + "file": "../../tests/t20022/t20022.cc", + "line": 7 + }, + "type": "class" + }, + { + "id": "1316821731069034940", + "name": "clanguml::t20022::B", + "source_location": { + "file": "../../tests/t20022/t20022.cc", + "line": 16 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1374011101998494743", + "activity_name": "clanguml::t20022::tmain()", + "participant_id": "1374011101998494743", + "participant_name": "clanguml::t20022::tmain()" + }, + "name": "a()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20022/t20022.cc", + "line": 32 + }, + "to": { + "activity_id": "1158824701633811441", + "activity_name": "clanguml::t20022::A::a()", + "participant_id": "1535467498096081224", + "participant_name": "clanguml::t20022::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1158824701633811441", + "activity_name": "clanguml::t20022::A::a()", + "participant_id": "1535467498096081224", + "participant_name": "clanguml::t20022::A" + }, + "name": "b()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20022/t20022.cc", + "line": 26 + }, + "to": { + "activity_id": "2114222968575993291", + "activity_name": "clanguml::t20022::B::b()", + "participant_id": "1316821731069034940", + "participant_name": "clanguml::t20022::B" + }, + "type": "message" + } + ], + "start_from": { + "id": 1374011101998494743, + "location": "clanguml::t20022::tmain()" + } + } + ], + "using_namespace": "clanguml::t20022" +} +``` diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index 65d0dfe3..aa3eb6e5 100644 --- a/docs/test_cases/t20022_sequence.svg +++ b/docs/test_cases/t20022_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - + + + + a() - + b() diff --git a/docs/test_cases/t20023.md b/docs/test_cases/t20023.md index e88c8048..4eeb48e2 100644 --- a/docs/test_cases/t20023.md +++ b/docs/test_cases/t20023.md @@ -62,3 +62,178 @@ int tmain() ``` ## Generated UML diagrams ![t20023_sequence](./t20023_sequence.svg "Try/catch statement sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20023_sequence", + "participants": [ + { + "id": "761552264135157511", + "name": "clanguml::t20023::tmain()", + "source_location": { + "file": "../../tests/t20023/t20023.cc", + "line": 29 + }, + "type": "function" + }, + { + "id": "750638294800359616", + "name": "clanguml::t20023::A", + "source_location": { + "file": "../../tests/t20023/t20023.cc", + "line": 6 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "761552264135157511", + "activity_name": "clanguml::t20023::tmain()", + "participant_id": "761552264135157511", + "participant_name": "clanguml::t20023::tmain()" + }, + "name": "a()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20023/t20023.cc", + "line": 35 + }, + "to": { + "activity_id": "530651320277188697", + "activity_name": "clanguml::t20023::A::a()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "type": "message" + }, + { + "activity_id": "530651320277188697", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "530651320277188697", + "activity_name": "clanguml::t20023::A::a()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "name": "a1()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20023/t20023.cc", + "line": 15 + }, + "to": { + "activity_id": "94135113932519208", + "activity_name": "clanguml::t20023::A::a1()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "type": "message" + } + ], + "type": "main" + }, + { + "messages": [ + { + "from": { + "activity_id": "530651320277188697", + "activity_name": "clanguml::t20023::A::a()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "name": "a2()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20023/t20023.cc", + "line": 18 + }, + "to": { + "activity_id": "2060438178899014465", + "activity_name": "clanguml::t20023::A::a2()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "type": "message" + } + ], + "type": "catch" + }, + { + "messages": [ + { + "from": { + "activity_id": "530651320277188697", + "activity_name": "clanguml::t20023::A::a()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "name": "a3()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20023/t20023.cc", + "line": 21 + }, + "to": { + "activity_id": "1776927259621603017", + "activity_name": "clanguml::t20023::A::a3()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "type": "message" + } + ], + "type": "catch" + }, + { + "messages": [ + { + "from": { + "activity_id": "530651320277188697", + "activity_name": "clanguml::t20023::A::a()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "name": "a4()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20023/t20023.cc", + "line": 24 + }, + "to": { + "activity_id": "1082587698374248813", + "activity_name": "clanguml::t20023::A::a4()", + "participant_id": "750638294800359616", + "participant_name": "clanguml::t20023::A" + }, + "type": "message" + } + ], + "type": "catch" + } + ], + "name": "try", + "type": "break" + } + ], + "start_from": { + "id": 761552264135157511, + "location": "clanguml::t20023::tmain()" + } + } + ], + "using_namespace": "clanguml::t20023" +} +``` diff --git a/docs/test_cases/t20023_sequence.svg b/docs/test_cases/t20023_sequence.svg index 5f7368e5..49ff7c9b 100644 --- a/docs/test_cases/t20023_sequence.svg +++ b/docs/test_cases/t20023_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - + + + + + + + a() @@ -47,7 +47,7 @@ try - + @@ -60,7 +60,7 @@ [std::runtime_error &] - + @@ -73,7 +73,7 @@ [std::logic_error &] - + @@ -86,7 +86,7 @@ [...] - + diff --git a/docs/test_cases/t20024.md b/docs/test_cases/t20024.md index 5e439a97..60ff1377 100644 --- a/docs/test_cases/t20024.md +++ b/docs/test_cases/t20024.md @@ -87,3 +87,332 @@ int tmain() ``` ## Generated UML diagrams ![t20024_sequence](./t20024_sequence.svg "Switch statement sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20024_sequence", + "participants": [ + { + "id": "1919714441225983014", + "name": "clanguml::t20024::tmain()", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 53 + }, + "type": "function" + }, + { + "id": "40786919835708828", + "name": "clanguml::t20024::A", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 8 + }, + "type": "class" + }, + { + "id": "933287014626440872", + "name": "clanguml::t20024::B", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 29 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1919714441225983014", + "activity_name": "clanguml::t20024::tmain()", + "participant_id": "1919714441225983014", + "participant_name": "clanguml::t20024::tmain()" + }, + "name": "select(enum_a)", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 58 + }, + "to": { + "activity_id": "1200587047701031901", + "activity_name": "clanguml::t20024::A::select(enum_a)", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "type": "message" + }, + { + "activity_id": "1200587047701031901", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "1200587047701031901", + "activity_name": "clanguml::t20024::A::select(enum_a)", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "name": "a0()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 13 + }, + "to": { + "activity_id": "1859614580641799156", + "activity_name": "clanguml::t20024::A::a0()", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "type": "message" + } + ], + "name": "zero", + "type": "case" + }, + { + "messages": [ + { + "from": { + "activity_id": "1200587047701031901", + "activity_name": "clanguml::t20024::A::select(enum_a)", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "name": "a1()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 15 + }, + "to": { + "activity_id": "501598940454911460", + "activity_name": "clanguml::t20024::A::a1()", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "type": "message" + } + ], + "name": "one", + "type": "case" + }, + { + "messages": [ + { + "from": { + "activity_id": "1200587047701031901", + "activity_name": "clanguml::t20024::A::select(enum_a)", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "name": "a2()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 17 + }, + "to": { + "activity_id": "1698866541173753340", + "activity_name": "clanguml::t20024::A::a2()", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "type": "message" + } + ], + "name": "two", + "type": "case" + }, + { + "messages": [ + { + "from": { + "activity_id": "1200587047701031901", + "activity_name": "clanguml::t20024::A::select(enum_a)", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "name": "a3()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 19 + }, + "to": { + "activity_id": "490376438551958259", + "activity_name": "clanguml::t20024::A::a3()", + "participant_id": "40786919835708828", + "participant_name": "clanguml::t20024::A" + }, + "type": "message" + } + ], + "name": "default", + "type": "case" + } + ], + "name": "switch", + "type": "alt" + }, + { + "from": { + "activity_id": "1919714441225983014", + "activity_name": "clanguml::t20024::tmain()", + "participant_id": "1919714441225983014", + "participant_name": "clanguml::t20024::tmain()" + }, + "name": "select(colors)", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 60 + }, + "to": { + "activity_id": "286108218156977422", + "activity_name": "clanguml::t20024::B::select(colors)", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "type": "message" + }, + { + "activity_id": "286108218156977422", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "286108218156977422", + "activity_name": "clanguml::t20024::B::select(colors)", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "name": "red()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 34 + }, + "to": { + "activity_id": "112014563206084467", + "activity_name": "clanguml::t20024::B::red()", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "type": "message" + } + ], + "name": "enum colors::red", + "type": "case" + }, + { + "messages": [ + { + "from": { + "activity_id": "286108218156977422", + "activity_name": "clanguml::t20024::B::select(colors)", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "name": "orange()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 37 + }, + "to": { + "activity_id": "2222823236498505185", + "activity_name": "clanguml::t20024::B::orange()", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "type": "message" + } + ], + "name": "enum colors::orange", + "type": "case" + }, + { + "messages": [ + { + "from": { + "activity_id": "286108218156977422", + "activity_name": "clanguml::t20024::B::select(colors)", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "name": "green()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 40 + }, + "to": { + "activity_id": "519021723720658376", + "activity_name": "clanguml::t20024::B::green()", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "type": "message" + } + ], + "name": "enum colors::green", + "type": "case" + }, + { + "messages": [ + { + "from": { + "activity_id": "286108218156977422", + "activity_name": "clanguml::t20024::B::select(colors)", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "name": "grey()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20024/t20024.cc", + "line": 43 + }, + "to": { + "activity_id": "1813557671878544737", + "activity_name": "clanguml::t20024::B::grey()", + "participant_id": "933287014626440872", + "participant_name": "clanguml::t20024::B" + }, + "type": "message" + } + ], + "name": "default", + "type": "case" + } + ], + "name": "switch", + "type": "alt" + } + ], + "start_from": { + "id": 1919714441225983014, + "location": "clanguml::t20024::tmain()" + } + } + ], + "using_namespace": "clanguml::t20024" +} +``` diff --git a/docs/test_cases/t20024_sequence.svg b/docs/test_cases/t20024_sequence.svg index 3cd09910..6b131bba 100644 --- a/docs/test_cases/t20024_sequence.svg +++ b/docs/test_cases/t20024_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -33,36 +33,36 @@ - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + select(enum_a) @@ -72,7 +72,7 @@ switch [zero] - + @@ -85,7 +85,7 @@ [one] - + @@ -98,7 +98,7 @@ [two] - + @@ -111,7 +111,7 @@ [default] - + @@ -124,7 +124,7 @@ - + select(colors) @@ -134,7 +134,7 @@ switch [enum colors::red] - + @@ -143,7 +143,7 @@ [enum colors::orange] - + @@ -152,7 +152,7 @@ [enum colors::green] - + @@ -161,7 +161,7 @@ [default] - + diff --git a/docs/test_cases/t20025.md b/docs/test_cases/t20025.md index f5e9601a..a72f0615 100644 --- a/docs/test_cases/t20025.md +++ b/docs/test_cases/t20025.md @@ -67,3 +67,116 @@ int tmain() ``` ## Generated UML diagrams ![t20025_sequence](./t20025_sequence.svg "Skip decorator sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20025_sequence", + "participants": [ + { + "id": "1268545806896171690", + "name": "clanguml::t20025::tmain()", + "source_location": { + "file": "../../tests/t20025/t20025.cc", + "line": 30 + }, + "type": "function" + }, + { + "id": "2144852170258286289", + "name": "clanguml::t20025::A", + "source_location": { + "file": "../../tests/t20025/t20025.cc", + "line": 14 + }, + "type": "class" + }, + { + "id": "228843323046630374", + "name": "clanguml::t20025::add(int,int)", + "source_location": { + "file": "../../tests/t20025/t20025.cc", + "line": 4 + }, + "type": "function" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1268545806896171690", + "activity_name": "clanguml::t20025::tmain()", + "participant_id": "1268545806896171690", + "participant_name": "clanguml::t20025::tmain()" + }, + "name": "a()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20025/t20025.cc", + "line": 36 + }, + "to": { + "activity_id": "1119830104994271584", + "activity_name": "clanguml::t20025::A::a()", + "participant_id": "2144852170258286289", + "participant_name": "clanguml::t20025::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1119830104994271584", + "activity_name": "clanguml::t20025::A::a()", + "participant_id": "2144852170258286289", + "participant_name": "clanguml::t20025::A" + }, + "name": "a2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20025/t20025.cc", + "line": 19 + }, + "to": { + "activity_id": "2059622670024664066", + "activity_name": "clanguml::t20025::A::a2()", + "participant_id": "2144852170258286289", + "participant_name": "clanguml::t20025::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1268545806896171690", + "activity_name": "clanguml::t20025::tmain()", + "participant_id": "1268545806896171690", + "participant_name": "clanguml::t20025::tmain()" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20025/t20025.cc", + "line": 38 + }, + "to": { + "activity_id": "228843323046630374", + "activity_name": "clanguml::t20025::add(int,int)", + "participant_id": "228843323046630374", + "participant_name": "clanguml::t20025::add(int,int)" + }, + "type": "message" + } + ], + "start_from": { + "id": 1268545806896171690, + "location": "clanguml::t20025::tmain()" + } + } + ], + "using_namespace": "clanguml::t20025" +} +``` diff --git a/docs/test_cases/t20025_sequence.svg b/docs/test_cases/t20025_sequence.svg index 0d6e5f21..cf298ae3 100644 --- a/docs/test_cases/t20025_sequence.svg +++ b/docs/test_cases/t20025_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,41 +9,41 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + add(int,int) - + add(int,int) - - - - - + + + + + a() - + @@ -52,7 +52,7 @@ - + diff --git a/docs/test_cases/t20026.md b/docs/test_cases/t20026.md index 6bba6e41..0c037d13 100644 --- a/docs/test_cases/t20026.md +++ b/docs/test_cases/t20026.md @@ -47,3 +47,63 @@ int tmain() ``` ## Generated UML diagrams ![t20026_sequence](./t20026_sequence.svg "Virtual method call sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20026_sequence", + "participants": [ + { + "id": "2268697350307997040", + "name": "clanguml::t20026::tmain()", + "source_location": { + "file": "../../tests/t20026/t20026.cc", + "line": 16 + }, + "type": "function" + }, + { + "id": "1962121823853291899", + "name": "clanguml::t20026::A", + "source_location": { + "file": "../../tests/t20026/t20026.cc", + "line": 4 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "2268697350307997040", + "activity_name": "clanguml::t20026::tmain()", + "participant_id": "2268697350307997040", + "participant_name": "clanguml::t20026::tmain()" + }, + "name": "a()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20026/t20026.cc", + "line": 20 + }, + "to": { + "activity_id": "600590770418147864", + "activity_name": "clanguml::t20026::A::a()", + "participant_id": "1962121823853291899", + "participant_name": "clanguml::t20026::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 2268697350307997040, + "location": "clanguml::t20026::tmain()" + } + } + ], + "using_namespace": "clanguml::t20026" +} +``` diff --git a/docs/test_cases/t20026_sequence.svg b/docs/test_cases/t20026_sequence.svg index d8b230d7..e5081fbe 100644 --- a/docs/test_cases/t20026_sequence.svg +++ b/docs/test_cases/t20026_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20027.md b/docs/test_cases/t20027.md index d1adac47..345a1ad5 100644 --- a/docs/test_cases/t20027.md +++ b/docs/test_cases/t20027.md @@ -46,3 +46,63 @@ void tmain() ``` ## Generated UML diagrams ![t20027_sequence](./t20027_sequence.svg "Filter call expressions based on access test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20027_sequence", + "participants": [ + { + "id": "1581009482994430286", + "name": "clanguml::t20027::tmain()", + "source_location": { + "file": "../../tests/t20027/t20027.cc", + "line": 15 + }, + "type": "function" + }, + { + "id": "583525629936262089", + "name": "clanguml::t20027::A", + "source_location": { + "file": "../../tests/t20027/t20027.cc", + "line": 4 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "1581009482994430286", + "activity_name": "clanguml::t20027::tmain()", + "participant_id": "1581009482994430286", + "participant_name": "clanguml::t20027::tmain()" + }, + "name": "a()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20027/t20027.cc", + "line": 19 + }, + "to": { + "activity_id": "910514967786202717", + "activity_name": "clanguml::t20027::A::a()", + "participant_id": "583525629936262089", + "participant_name": "clanguml::t20027::A" + }, + "type": "message" + } + ], + "start_from": { + "id": 1581009482994430286, + "location": "clanguml::t20027::tmain()" + } + } + ], + "using_namespace": "clanguml::t20027" +} +``` diff --git a/docs/test_cases/t20027_sequence.svg b/docs/test_cases/t20027_sequence.svg index 06d3dc7e..f2a3cc34 100644 --- a/docs/test_cases/t20027_sequence.svg +++ b/docs/test_cases/t20027_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20028.md b/docs/test_cases/t20028.md index b603b9fb..a02f5ae9 100644 --- a/docs/test_cases/t20028.md +++ b/docs/test_cases/t20028.md @@ -56,3 +56,146 @@ int tmain() ``` ## Generated UML diagrams ![t20028_sequence](./t20028_sequence.svg "Conditional (ternary) '?:' operator test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20028_sequence", + "participants": [ + { + "id": "1347206662193933194", + "name": "clanguml::t20028::tmain()", + "source_location": { + "file": "../../tests/t20028/t20028.cc", + "line": 17 + }, + "type": "function" + }, + { + "id": "2073479923903128898", + "name": "clanguml::t20028::A", + "source_location": { + "file": "../../tests/t20028/t20028.cc", + "line": 4 + }, + "type": "class" + } + ], + "sequences": [ + { + "messages": [ + { + "activity_id": "1347206662193933194", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "1347206662193933194", + "activity_name": "clanguml::t20028::tmain()", + "participant_id": "1347206662193933194", + "participant_name": "clanguml::t20028::tmain()" + }, + "name": "a()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20028/t20028.cc", + "line": 26 + }, + "to": { + "activity_id": "666210834901940781", + "activity_name": "clanguml::t20028::A::a()", + "participant_id": "2073479923903128898", + "participant_name": "clanguml::t20028::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1347206662193933194", + "activity_name": "clanguml::t20028::tmain()", + "participant_id": "1347206662193933194", + "participant_name": "clanguml::t20028::tmain()" + }, + "name": "b()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20028/t20028.cc", + "line": 26 + }, + "to": { + "activity_id": "793793464184037795", + "activity_name": "clanguml::t20028::A::b()", + "participant_id": "2073479923903128898", + "participant_name": "clanguml::t20028::A" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1347206662193933194", + "activity_name": "clanguml::t20028::tmain()", + "participant_id": "1347206662193933194", + "participant_name": "clanguml::t20028::tmain()" + }, + "name": "c()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20028/t20028.cc", + "line": 26 + }, + "to": { + "activity_id": "1582152567698110078", + "activity_name": "clanguml::t20028::A::c()", + "participant_id": "2073479923903128898", + "participant_name": "clanguml::t20028::A" + }, + "type": "message" + } + ], + "type": "consequent" + }, + { + "messages": [ + { + "from": { + "activity_id": "1347206662193933194", + "activity_name": "clanguml::t20028::tmain()", + "participant_id": "1347206662193933194", + "participant_name": "clanguml::t20028::tmain()" + }, + "name": "d()", + "return_type": "int", + "scope": "normal", + "source_location": { + "file": "../../tests/t20028/t20028.cc", + "line": 26 + }, + "to": { + "activity_id": "1178268687951492696", + "activity_name": "clanguml::t20028::A::d()", + "participant_id": "2073479923903128898", + "participant_name": "clanguml::t20028::A" + }, + "type": "message" + } + ], + "type": "alternative" + } + ], + "name": "conditional", + "type": "alt" + } + ], + "start_from": { + "id": 1347206662193933194, + "location": "clanguml::t20028::tmain()" + } + } + ], + "using_namespace": "clanguml::t20028" +} +``` diff --git a/docs/test_cases/t20028_sequence.svg b/docs/test_cases/t20028_sequence.svg index d5d0402d..d3f4e627 100644 --- a/docs/test_cases/t20028_sequence.svg +++ b/docs/test_cases/t20028_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - - - - - + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - + + + + + alt - + a() - + b() - + c() @@ -60,7 +60,7 @@ - + d() diff --git a/docs/test_cases/t20029.md b/docs/test_cases/t20029.md index 352f9f77..5dc92331 100644 --- a/docs/test_cases/t20029.md +++ b/docs/test_cases/t20029.md @@ -100,3 +100,238 @@ int tmain() ``` ## Generated UML diagrams ![t20029_sequence](./t20029_sequence.svg "Combined feature sequence diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "sequence", + "name": "t20029_sequence", + "participants": [ + { + "id": "2091374738808319642", + "name": "clanguml::t20029::tmain()", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 55 + }, + "type": "function" + }, + { + "id": "1673261195873192383", + "name": "clanguml::t20029::Encoder>", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 11 + }, + "type": "class" + }, + { + "id": "658058855590948094", + "name": "clanguml::t20029::Retrier", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 22 + }, + "type": "class" + }, + { + "id": "1896406205097618937", + "name": "clanguml::t20029::ConnectionPool", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 39 + }, + "type": "class" + }, + { + "id": "1362646431260879440", + "name": "clanguml::t20029::encode_b64(std::string &&)", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 9 + }, + "type": "function" + } + ], + "sequences": [ + { + "messages": [ + { + "from": { + "activity_id": "2091374738808319642", + "activity_name": "clanguml::t20029::tmain()", + "participant_id": "2091374738808319642", + "participant_name": "clanguml::t20029::tmain()" + }, + "name": "connect()", + "return_type": "void", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 59 + }, + "to": { + "activity_id": "940428568182104530", + "activity_name": "clanguml::t20029::ConnectionPool::connect()", + "participant_id": "1896406205097618937", + "participant_name": "clanguml::t20029::ConnectionPool" + }, + "type": "message" + }, + { + "activity_id": "2091374738808319642", + "messages": [ + { + "activity_id": "2091374738808319642", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "2091374738808319642", + "activity_name": "clanguml::t20029::tmain()", + "participant_id": "2091374738808319642", + "participant_name": "clanguml::t20029::tmain()" + }, + "name": "send(std::string &&)", + "return_type": "_Bool", + "scope": "condition", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 62 + }, + "to": { + "activity_id": "2026763864005979273", + "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", + "participant_id": "1673261195873192383", + "participant_name": "clanguml::t20029::Encoder>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2026763864005979273", + "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", + "participant_id": "1673261195873192383", + "participant_name": "clanguml::t20029::Encoder>" + }, + "name": "encode(std::string &&)", + "return_type": "std::string", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 15 + }, + "to": { + "activity_id": "1468258269466480773", + "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", + "participant_id": "1673261195873192383", + "participant_name": "clanguml::t20029::Encoder>" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1468258269466480773", + "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", + "participant_id": "1673261195873192383", + "participant_name": "clanguml::t20029::Encoder>" + }, + "name": "", + "return_type": "", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 19 + }, + "to": { + "activity_id": "1362646431260879440", + "activity_name": "clanguml::t20029::encode_b64(std::string &&)", + "participant_id": "1362646431260879440", + "participant_name": "clanguml::t20029::encode_b64(std::string &&)" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2026763864005979273", + "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", + "participant_id": "1673261195873192383", + "participant_name": "clanguml::t20029::Encoder>" + }, + "name": "send(std::string &&)", + "return_type": "_Bool", + "scope": "normal", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 15 + }, + "to": { + "activity_id": "30515971485361302", + "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", + "participant_id": "658058855590948094", + "participant_name": "clanguml::t20029::Retrier" + }, + "type": "message" + }, + { + "activity_id": "30515971485361302", + "messages": [ + { + "activity_id": "30515971485361302", + "branches": [ + { + "messages": [ + { + "from": { + "activity_id": "30515971485361302", + "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", + "participant_id": "658058855590948094", + "participant_name": "clanguml::t20029::Retrier" + }, + "name": "send(const std::string &)", + "return_type": "_Bool", + "scope": "condition", + "source_location": { + "file": "../../tests/t20029/t20029.cc", + "line": 31 + }, + "to": { + "activity_id": "972625940114169157", + "activity_name": "clanguml::t20029::ConnectionPool::send(const std::string &)", + "participant_id": "1896406205097618937", + "participant_name": "clanguml::t20029::ConnectionPool" + }, + "type": "message" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + } + ], + "name": "while", + "type": "loop" + } + ], + "type": "consequent" + } + ], + "name": "if", + "type": "alt" + } + ], + "name": "for", + "type": "loop" + } + ], + "start_from": { + "id": 2091374738808319642, + "location": "clanguml::t20029::tmain()" + } + } + ], + "using_namespace": "clanguml::t20029" +} +``` diff --git a/docs/test_cases/t20029_sequence.svg b/docs/test_cases/t20029_sequence.svg index 3cb2fc4a..428f0973 100644 --- a/docs/test_cases/t20029_sequence.svg +++ b/docs/test_cases/t20029_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,60 +9,60 @@ - - - - - - - - - - - + + + + + + + + + + + - - + + tmain() - + tmain() - - + + Encoder<Retrier<ConnectionPool>> - + Encoder<Retrier<ConnectionPool>> - - + + Retrier<ConnectionPool> - + Retrier<ConnectionPool> - - + + ConnectionPool - + ConnectionPool - - + + encode_b64(std::string &&) - + encode_b64(std::string &&) - - - - - - - - + + + + + + + + connect() @@ -73,21 +73,21 @@ alt - + [ send(std::string &&) ] - + encode(std::string &&) - + @@ -97,7 +97,7 @@ - + send(std::string &&) @@ -108,7 +108,7 @@ alt - + [ diff --git a/docs/test_cases/t30001.md b/docs/test_cases/t30001.md index a81a983f..dc4f0dbe 100644 --- a/docs/test_cases/t30001.md +++ b/docs/test_cases/t30001.md @@ -58,3 +58,140 @@ namespace BB { ``` ## Generated UML diagrams ![t30001_package](./t30001_package.svg "Basic package diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml::t30001::A", + "elements": [ + { + "comment": { + "formatted": "This is namespace AA in namespace A", + "raw": "/// This is namespace AA in namespace A" + }, + "display_name": "clanguml::t30001::A::AA", + "elements": [ + { + "display_name": "clanguml::t30001::A::AA::AAA", + "id": "274638237740249424", + "is_deprecated": false, + "name": "AAA", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 6 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30001::A::AA::BBB", + "id": "2129154382024012563", + "is_deprecated": false, + "name": "BBB", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 8 + }, + "type": "namespace" + } + ], + "id": "1528517990989164155", + "is_deprecated": false, + "name": "AA", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 5 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30001::A::BB", + "id": "983199564524723281", + "is_deprecated": false, + "name": "BB", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 11 + }, + "type": "namespace" + } + ], + "id": "1184614645531659789", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 3 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30001::B", + "elements": [ + { + "comment": { + "formatted": "This is namespace AA in namespace B", + "raw": "/// This is namespace AA in namespace B" + }, + "display_name": "clanguml::t30001::B::AA", + "elements": [ + { + "display_name": "clanguml::t30001::B::AA::AAA", + "id": "262162485307734028", + "is_deprecated": false, + "name": "AAA", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 17 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30001::B::AA::BBB", + "id": "18542334992237803", + "is_deprecated": false, + "name": "BBB", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 19 + }, + "type": "namespace" + } + ], + "id": "895913707182089871", + "is_deprecated": false, + "name": "AA", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 16 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30001::B::BB", + "id": "2230464321696304488", + "is_deprecated": false, + "name": "BB", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 22 + }, + "type": "namespace" + } + ], + "id": "1931735210112054430", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30001/t30001.cc", + "line": 14 + }, + "type": "namespace" + } + ], + "name": "t30001_package", + "relationships": [], + "using_namespace": "clanguml::t30001" +} +``` diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 021a78a6..9ae8b415 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + A - - + + AA - - + + B - - + + AA - - + + AAA - - + + BBB - - + + BB - - + + AAA - - + + BBB - - + + BB - + A AAA note... - + This is namespace AA in namespace A - + This is namespace AA in namespace B diff --git a/docs/test_cases/t30002.md b/docs/test_cases/t30002.md index 27475505..357e11f0 100644 --- a/docs/test_cases/t30002.md +++ b/docs/test_cases/t30002.md @@ -138,3 +138,367 @@ template std::map> cm() ``` ## Generated UML diagrams ![t30002_package](./t30002_package.svg "Package dependency test case") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml::t30002::A", + "elements": [ + { + "display_name": "clanguml::t30002::A::AA", + "elements": [ + { + "display_name": "clanguml::t30002::A::AA::A1", + "id": "1164966689017271053", + "is_deprecated": false, + "name": "A1", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 10 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A2", + "id": "695366113361481509", + "is_deprecated": false, + "name": "A2", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 13 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A3", + "id": "1267709074800873528", + "is_deprecated": false, + "name": "A3", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 16 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A4", + "id": "299262817531370604", + "is_deprecated": false, + "name": "A4", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 19 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A5", + "id": "1207764290216680521", + "is_deprecated": false, + "name": "A5", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 22 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A6", + "id": "899091126727901939", + "is_deprecated": false, + "name": "A6", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 25 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A7", + "id": "563861734550555261", + "is_deprecated": false, + "name": "A7", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 28 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A8", + "id": "839146342143718390", + "is_deprecated": false, + "name": "A8", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 31 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A9", + "id": "1650835159458422245", + "is_deprecated": false, + "name": "A9", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 34 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A10", + "id": "1453242941322376182", + "is_deprecated": false, + "name": "A10", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 37 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A11", + "id": "384833776371876986", + "is_deprecated": false, + "name": "A11", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 40 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A12", + "id": "1199527037490355138", + "is_deprecated": false, + "name": "A12", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 43 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A13", + "id": "620689743711615190", + "is_deprecated": false, + "name": "A13", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 46 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A14", + "id": "301858476377711436", + "is_deprecated": false, + "name": "A14", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 49 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A15", + "id": "561239706327729436", + "is_deprecated": false, + "name": "A15", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 52 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A16", + "id": "1415398383158410524", + "is_deprecated": false, + "name": "A16", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 55 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::A::AA::A17", + "id": "532437874530119999", + "is_deprecated": false, + "name": "A17", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 58 + }, + "type": "namespace" + } + ], + "id": "1669745471968085401", + "is_deprecated": false, + "name": "AA", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 9 + }, + "type": "namespace" + } + ], + "id": "1543480715632256641", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 9 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30002::B", + "elements": [ + { + "display_name": "clanguml::t30002::B::BB", + "elements": [ + { + "display_name": "clanguml::t30002::B::BB::BBB", + "id": "2255521339657425355", + "is_deprecated": false, + "name": "BBB", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 62 + }, + "type": "namespace" + } + ], + "id": "1938861639623819235", + "is_deprecated": false, + "name": "BB", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 62 + }, + "type": "namespace" + } + ], + "id": "145302773464360955", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30002/t30002.cc", + "line": 62 + }, + "type": "namespace" + } + ], + "name": "t30002_package", + "relationships": [ + { + "access": "public", + "destination": "301858476377711436", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "1207764290216680521", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "563861734550555261", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "839146342143718390", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "1650835159458422245", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "1164966689017271053", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "695366113361481509", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "1267709074800873528", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "299262817531370604", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "561239706327729436", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "1415398383158410524", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "532437874530119999", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "899091126727901939", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "1453242941322376182", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "384833776371876986", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "1199527037490355138", + "source": "2255521339657425355", + "type": "dependency" + }, + { + "access": "public", + "destination": "620689743711615190", + "source": "2255521339657425355", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t30002" +} +``` diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg index 48d097b8..aa760946 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003.md b/docs/test_cases/t30003.md index f8407a0c..1b926eea 100644 --- a/docs/test_cases/t30003.md +++ b/docs/test_cases/t30003.md @@ -26,27 +26,123 @@ namespace t30003 { namespace ns1 { namespace ns2_v1_0_0 { class A { }; -} +} // namespace ns2_v1_0_0 namespace [[deprecated]] ns2_v0_9_0 { class A { }; -} +} // namespace ns2_v0_9_0 namespace { class Anon final { }; -} -} +} // namespace +} // namespace ns1 namespace [[deprecated]] ns3 { namespace ns1::ns2 { class Anon : public t30003::ns1::ns2_v1_0_0::A { }; -} +} // namespace ns1::ns2 class B : public ns1::ns2::Anon { }; -} -} -} +} // namespace ns3 +} // namespace t30003 +} // namespace clanguml ``` ## Generated UML diagrams ![t30003_package](./t30003_package.svg "Package deprecated attribute test case") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml::t30003::ns1", + "elements": [ + { + "display_name": "clanguml::t30003::ns1::ns2_v1_0_0", + "id": "647755950450743637", + "is_deprecated": false, + "name": "ns2_v1_0_0", + "source_location": { + "file": "../../tests/t30003/t30003.cc", + "line": 5 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30003::ns1::ns2_v0_9_0", + "id": "1013406647495422406", + "is_deprecated": true, + "name": "ns2_v0_9_0", + "source_location": { + "file": "../../tests/t30003/t30003.cc", + "line": 9 + }, + "type": "namespace" + } + ], + "id": "600452871069546589", + "is_deprecated": false, + "name": "ns1", + "source_location": { + "file": "../../tests/t30003/t30003.cc", + "line": 4 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30003::ns3", + "elements": [ + { + "display_name": "clanguml::t30003::ns3::ns1", + "elements": [ + { + "display_name": "clanguml::t30003::ns3::ns1::ns2", + "id": "820462660523726751", + "is_deprecated": false, + "name": "ns2", + "source_location": { + "file": "../../tests/t30003/t30003.cc", + "line": 20 + }, + "type": "namespace" + } + ], + "id": "1209144861141334061", + "is_deprecated": false, + "name": "ns1", + "source_location": { + "file": "../../tests/t30003/t30003.cc", + "line": 20 + }, + "type": "namespace" + } + ], + "id": "427104404739526818", + "is_deprecated": true, + "name": "ns3", + "source_location": { + "file": "../../tests/t30003/t30003.cc", + "line": 18 + }, + "type": "namespace" + } + ], + "name": "t30003_package", + "relationships": [ + { + "access": "public", + "destination": "820462660523726751", + "source": "427104404739526818", + "type": "dependency" + }, + { + "access": "public", + "destination": "647755950450743637", + "source": "820462660523726751", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t30003" +} +``` diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index a216c1b2..8405efa9 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,35 @@ - - + + ns1 - - + + ns3 «deprecated» - - + + ns1 - - + + ns2_v1_0_0 - - + + ns2_v0_9_0 «deprecated» - - + + ns2 diff --git a/docs/test_cases/t30004.md b/docs/test_cases/t30004.md index df36dab7..48da7baa 100644 --- a/docs/test_cases/t30004.md +++ b/docs/test_cases/t30004.md @@ -58,3 +58,91 @@ namespace CCC { ``` ## Generated UML diagrams ![t30004_package](./t30004_package.svg "PlantUML package decorators test case") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "comment": { + "formatted": "@uml{style[#green]}", + "raw": "/// @uml{style[#green]}" + }, + "display_name": "clanguml::t30004::A", + "elements": [ + { + "comment": { + "formatted": "@uml{note[ bottom ] Package AAA.}", + "raw": "/// @uml{note[ bottom ] Package AAA.}" + }, + "display_name": "clanguml::t30004::A::AAA", + "id": "1517185300862579159", + "is_deprecated": false, + "name": "AAA", + "source_location": { + "file": "../../tests/t30004/t30004.cc", + "line": 8 + }, + "type": "namespace" + }, + { + "comment": { + "formatted": "\\uml{note[right] Package BBB.}", + "raw": "/// \\uml{note[right] Package BBB.}" + }, + "display_name": "clanguml::t30004::A::BBB", + "id": "1982379087062354928", + "is_deprecated": false, + "name": "BBB", + "source_location": { + "file": "../../tests/t30004/t30004.cc", + "line": 12 + }, + "type": "namespace" + }, + { + "comment": { + "formatted": "\n @uml{note:t30004_package[bottom] CCCC package note.}\n This is package CCC.", + "raw": "///\n/// @uml{note:t30004_package[bottom] CCCC package note.}\n/// This is package CCC." + }, + "display_name": "clanguml::t30004::A::CCC", + "id": "2304726195556701567", + "is_deprecated": false, + "name": "CCC", + "source_location": { + "file": "../../tests/t30004/t30004.cc", + "line": 18 + }, + "type": "namespace" + }, + { + "comment": { + "formatted": "@uml{style[#pink;line:red;line.bold;text:red]}\n\\uml{note[top] We skipped DDD.}", + "raw": "/// @uml{style[#pink;line:red;line.bold;text:red]}\n/// \\uml{note[top] We skipped DDD.}" + }, + "display_name": "clanguml::t30004::A::EEE", + "id": "1084924732216290779", + "is_deprecated": false, + "name": "EEE", + "source_location": { + "file": "../../tests/t30004/t30004.cc", + "line": 27 + }, + "type": "namespace" + } + ], + "id": "33410665874039845", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30004/t30004.cc", + "line": 5 + }, + "type": "namespace" + } + ], + "name": "t30004_package", + "relationships": [], + "using_namespace": "clanguml::t30004" +} +``` diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg index 7c0f42ba..ac0952e0 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005.md b/docs/test_cases/t30005.md index 273f2b41..fbbe02ef 100644 --- a/docs/test_cases/t30005.md +++ b/docs/test_cases/t30005.md @@ -50,3 +50,138 @@ struct C2 { ``` ## Generated UML diagrams ![t30005_package](./t30005_package.svg "Package namespace alias test case") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml::t30005::A", + "elements": [ + { + "display_name": "clanguml::t30005::A::AA", + "elements": [ + { + "display_name": "clanguml::t30005::A::AA::AAA", + "id": "914090901927655181", + "is_deprecated": false, + "name": "AAA", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 4 + }, + "type": "namespace" + } + ], + "id": "1777547159021391040", + "is_deprecated": false, + "name": "AA", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 4 + }, + "type": "namespace" + } + ], + "id": "1768303675686131578", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 4 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30005::B", + "elements": [ + { + "display_name": "clanguml::t30005::B::BB", + "elements": [ + { + "display_name": "clanguml::t30005::B::BB::BBB", + "id": "1871026935460001668", + "is_deprecated": false, + "name": "BBB", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 8 + }, + "type": "namespace" + } + ], + "id": "1696631362104244809", + "is_deprecated": false, + "name": "BB", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 8 + }, + "type": "namespace" + } + ], + "id": "378529216628023051", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 8 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30005::C", + "elements": [ + { + "display_name": "clanguml::t30005::C::CC", + "elements": [ + { + "display_name": "clanguml::t30005::C::CC::CCC", + "id": "1763279540133487999", + "is_deprecated": false, + "name": "CCC", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 16 + }, + "type": "namespace" + } + ], + "id": "2134234141727442046", + "is_deprecated": false, + "name": "CC", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 16 + }, + "type": "namespace" + } + ], + "id": "1041076320925403190", + "is_deprecated": false, + "name": "C", + "source_location": { + "file": "../../tests/t30005/t30005.cc", + "line": 16 + }, + "type": "namespace" + } + ], + "name": "t30005_package", + "relationships": [ + { + "access": "public", + "destination": "914090901927655181", + "source": "1871026935460001668", + "type": "dependency" + }, + { + "access": "public", + "destination": "914090901927655181", + "source": "1763279540133487999", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t30005" +} +``` diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index a4e5785d..667219f3 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,48 +9,48 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + C - - + + CC - - + + AAA - - + + BBB - - + + CCC diff --git a/docs/test_cases/t30006.md b/docs/test_cases/t30006.md index 859cc273..2c783572 100644 --- a/docs/test_cases/t30006.md +++ b/docs/test_cases/t30006.md @@ -50,3 +50,64 @@ struct A2 { ``` ## Generated UML diagrams ![t30006_package](./t30006_package.svg "Package split namespace test case") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml::t30006::B", + "id": "1659090172211944144", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30006/t30006.cc", + "line": 4 + }, + "type": "namespace" + }, + { + "comment": { + "formatted": "\\uml{note[top] Top A note.}", + "raw": "/// \\uml{note[top] Top A note.}" + }, + "display_name": "clanguml::t30006::A", + "id": "1499919423527579699", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30006/t30006.cc", + "line": 9 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30006::C", + "id": "1380567463986115369", + "is_deprecated": false, + "name": "C", + "source_location": { + "file": "../../tests/t30006/t30006.cc", + "line": 15 + }, + "type": "namespace" + } + ], + "name": "t30006_package", + "relationships": [ + { + "access": "public", + "destination": "1659090172211944144", + "source": "1499919423527579699", + "type": "dependency" + }, + { + "access": "public", + "destination": "1380567463986115369", + "source": "1499919423527579699", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t30006" +} +``` diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg index 8e55e359..b593cdbe 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007.md b/docs/test_cases/t30007.md index 40e86e09..a0c5c263 100644 --- a/docs/test_cases/t30007.md +++ b/docs/test_cases/t30007.md @@ -58,3 +58,77 @@ struct A2 { ``` ## Generated UML diagrams ![t30007_package](./t30007_package.svg "Package diagram layout hints test case") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml::t30007::B", + "id": "1852704221005355550", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30007/t30007.cc", + "line": 4 + }, + "type": "namespace" + }, + { + "comment": { + "formatted": "\\uml{note[top] Compare layout with t30006.}", + "raw": "/// \\uml{note[top] Compare layout with t30006.}" + }, + "display_name": "clanguml::t30007::A", + "elements": [ + { + "display_name": "clanguml::t30007::A::AA", + "id": "357722505818238170", + "is_deprecated": false, + "name": "AA", + "source_location": { + "file": "../../tests/t30007/t30007.cc", + "line": 10 + }, + "type": "namespace" + } + ], + "id": "870874615388866345", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30007/t30007.cc", + "line": 9 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30007::C", + "id": "937791537887318363", + "is_deprecated": false, + "name": "C", + "source_location": { + "file": "../../tests/t30007/t30007.cc", + "line": 17 + }, + "type": "namespace" + } + ], + "name": "t30007_package", + "relationships": [ + { + "access": "public", + "destination": "1852704221005355550", + "source": "357722505818238170", + "type": "dependency" + }, + { + "access": "public", + "destination": "937791537887318363", + "source": "357722505818238170", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t30007" +} +``` diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index 96a79144..d5477fa6 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008.md b/docs/test_cases/t30008.md index 2b61f3b7..54a32b17 100644 --- a/docs/test_cases/t30008.md +++ b/docs/test_cases/t30008.md @@ -68,3 +68,155 @@ struct FF { ``` ## Generated UML diagrams ![t30008_package](./t30008_package.svg "Dependants and dependencies package diagram filter test") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml", + "elements": [ + { + "display_name": "clanguml::t30008", + "id": "588296309731944574", + "is_deprecated": false, + "name": "t30008", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 2 + }, + "type": "namespace" + } + ], + "id": "2174271399507040339", + "is_deprecated": false, + "name": "clanguml", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 1 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30008::dependants", + "elements": [ + { + "display_name": "clanguml::t30008::dependants::A", + "id": "2096441629244782012", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 7 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30008::dependants::B", + "id": "500208250168931957", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 10 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30008::dependants::C", + "id": "1095841247154575825", + "is_deprecated": false, + "name": "C", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 15 + }, + "type": "namespace" + } + ], + "id": "1601960042765615222", + "is_deprecated": false, + "name": "dependants", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 4 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30008::dependencies", + "elements": [ + { + "display_name": "clanguml::t30008::dependencies::D", + "id": "912387297717034254", + "is_deprecated": false, + "name": "D", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 27 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30008::dependencies::E", + "id": "1114997990364518938", + "is_deprecated": false, + "name": "E", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 30 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30008::dependencies::F", + "id": "1062827161678172094", + "is_deprecated": false, + "name": "F", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 35 + }, + "type": "namespace" + } + ], + "id": "2103969167872217960", + "is_deprecated": false, + "name": "dependencies", + "source_location": { + "file": "../../tests/t30008/t30008.cc", + "line": 23 + }, + "type": "namespace" + } + ], + "name": "t30008_package", + "relationships": [ + { + "access": "public", + "destination": "2096441629244782012", + "source": "500208250168931957", + "type": "dependency" + }, + { + "access": "public", + "destination": "500208250168931957", + "source": "1095841247154575825", + "type": "dependency" + }, + { + "access": "public", + "destination": "912387297717034254", + "source": "1114997990364518938", + "type": "dependency" + }, + { + "access": "public", + "destination": "1114997990364518938", + "source": "1062827161678172094", + "type": "dependency" + } + ], + "using_namespace": "clanguml::t30008" +} +``` diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index fca2649e..e17827b0 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F diff --git a/docs/test_cases/t30009.md b/docs/test_cases/t30009.md index 3dd65cb1..47469e8a 100644 --- a/docs/test_cases/t30009.md +++ b/docs/test_cases/t30009.md @@ -48,3 +48,128 @@ namespace D { ``` ## Generated UML diagrams ![t30009_package](./t30009_package.svg "Together layout hint test") +## Generated JSON models +```json +{ + "diagram_type": "package", + "elements": [ + { + "display_name": "clanguml::t30009::One", + "elements": [ + { + "display_name": "clanguml::t30009::One::A", + "id": "1189741240939898414", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 3 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30009::One::B", + "id": "209763670816643341", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 5 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30009::One::C", + "id": "946522260503371974", + "is_deprecated": false, + "name": "C", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 7 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30009::One::D", + "id": "1181245940399690936", + "is_deprecated": false, + "name": "D", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 9 + }, + "type": "namespace" + } + ], + "id": "1187941209208108244", + "is_deprecated": false, + "name": "One", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 2 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30009::Two", + "elements": [ + { + "display_name": "clanguml::t30009::Two::A", + "id": "986505573514384282", + "is_deprecated": false, + "name": "A", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 13 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30009::Two::B", + "id": "2156827588463114203", + "is_deprecated": false, + "name": "B", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 15 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30009::Two::C", + "id": "1653274432960093632", + "is_deprecated": false, + "name": "C", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 17 + }, + "type": "namespace" + }, + { + "display_name": "clanguml::t30009::Two::D", + "id": "263095551354153183", + "is_deprecated": false, + "name": "D", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 19 + }, + "type": "namespace" + } + ], + "id": "1940839474792549233", + "is_deprecated": false, + "name": "Two", + "source_location": { + "file": "../../tests/t30009/t30009.cc", + "line": 12 + }, + "type": "namespace" + } + ], + "name": "t30009_package", + "relationships": [], + "using_namespace": "clanguml::t30009" +} +``` diff --git a/docs/test_cases/t30009_package.svg b/docs/test_cases/t30009_package.svg index 6ea3a7db..08b5acab 100644 --- a/docs/test_cases/t30009_package.svg +++ b/docs/test_cases/t30009_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + One - - + + Two - - + + B - - + + D - - + + A - - + + C - - + + A - - + + B - - + + C - - + + D diff --git a/docs/test_cases/t40001.md b/docs/test_cases/t40001.md index d4663270..ef8bd71f 100644 --- a/docs/test_cases/t40001.md +++ b/docs/test_cases/t40001.md @@ -28,3 +28,116 @@ diagrams: ## Source code ## Generated UML diagrams ![t40001_include](./t40001_include.svg "Basic include graph diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "include", + "elements": [ + { + "display_name": "src", + "elements": [ + { + "display_name": "src/t40001.cc", + "file_kind": "implementation", + "id": "1755015016680017839", + "name": "t40001.cc", + "type": "file" + } + ], + "id": "1387619747296316447", + "name": "src", + "type": "folder" + }, + { + "display_name": "string", + "file_kind": "header", + "id": "1687197357150905926", + "name": "string", + "type": "file" + }, + { + "display_name": "vector", + "file_kind": "header", + "id": "405203884025072971", + "name": "vector", + "type": "file" + }, + { + "display_name": "include", + "elements": [ + { + "display_name": "include/t40001_include1.h", + "file_kind": "header", + "id": "1926692816440595520", + "name": "t40001_include1.h", + "type": "file" + }, + { + "display_name": "include/lib1", + "elements": [ + { + "display_name": "include/lib1/lib1.h", + "file_kind": "header", + "id": "2193549214042244690", + "name": "lib1.h", + "type": "file" + } + ], + "id": "1687675335949018432", + "name": "lib1", + "type": "folder" + } + ], + "id": "989412417490706876", + "name": "include", + "type": "folder" + }, + { + "display_name": "yaml-cpp/yaml.h", + "file_kind": "header", + "id": "1659736894483045485", + "name": "yaml-cpp/yaml.h", + "type": "file" + } + ], + "name": "t40001_include", + "relationships": [ + { + "access": "public", + "destination": "1687197357150905926", + "source": "1755015016680017839", + "type": "dependency" + }, + { + "access": "public", + "destination": "405203884025072971", + "source": "1755015016680017839", + "type": "dependency" + }, + { + "access": "public", + "destination": "1926692816440595520", + "source": "1755015016680017839", + "type": "association" + }, + { + "access": "public", + "destination": "2193549214042244690", + "source": "1926692816440595520", + "type": "association" + }, + { + "access": "public", + "destination": "1659736894483045485", + "source": "1926692816440595520", + "type": "dependency" + }, + { + "access": "public", + "destination": "1687197357150905926", + "source": "1926692816440595520", + "type": "dependency" + } + ] +} +``` diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 4d50cc51..14caaed2 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + yaml-cpp/yaml.h - + This is a lib1 include dir - + This is a t40001_include1.h include file diff --git a/docs/test_cases/t40002.md b/docs/test_cases/t40002.md index e51460be..7f2da126 100644 --- a/docs/test_cases/t40002.md +++ b/docs/test_cases/t40002.md @@ -29,3 +29,127 @@ diagrams: ## Source code ## Generated UML diagrams ![t40002_include](./t40002_include.svg "Cyclic include graph diagram test case") +## Generated JSON models +```json +{ + "diagram_type": "include", + "elements": [ + { + "display_name": "src", + "elements": [ + { + "display_name": "src/t40002.cc", + "file_kind": "implementation", + "id": "1489450289909741706", + "name": "t40002.cc", + "type": "file" + }, + { + "display_name": "src/lib1", + "elements": [ + { + "display_name": "src/lib1/lib1.cc", + "file_kind": "implementation", + "id": "1493913207373215402", + "name": "lib1.cc", + "type": "file" + } + ], + "id": "1284742705549910910", + "name": "lib1", + "type": "folder" + }, + { + "display_name": "src/lib2", + "elements": [ + { + "display_name": "src/lib2/lib2.cc", + "file_kind": "implementation", + "id": "1761875020766116446", + "name": "lib2.cc", + "type": "file" + } + ], + "id": "1397224709580110803", + "name": "lib2", + "type": "folder" + } + ], + "id": "1387619747296316447", + "name": "src", + "type": "folder" + }, + { + "display_name": "include", + "elements": [ + { + "display_name": "include/lib1", + "elements": [ + { + "display_name": "include/lib1/lib1.h", + "file_kind": "header", + "id": "2193549214042244690", + "name": "lib1.h", + "type": "file" + } + ], + "id": "1687675335949018432", + "name": "lib1", + "type": "folder" + }, + { + "display_name": "include/lib2", + "elements": [ + { + "display_name": "include/lib2/lib2.h", + "file_kind": "header", + "id": "1969674835696841438", + "name": "lib2.h", + "type": "file" + } + ], + "id": "1248530620501446930", + "name": "lib2", + "type": "folder" + } + ], + "id": "989412417490706876", + "name": "include", + "type": "folder" + } + ], + "name": "t40002_include", + "relationships": [ + { + "access": "public", + "destination": "2193549214042244690", + "source": "1489450289909741706", + "type": "association" + }, + { + "access": "public", + "destination": "1969674835696841438", + "source": "1489450289909741706", + "type": "association" + }, + { + "access": "public", + "destination": "2193549214042244690", + "source": "1493913207373215402", + "type": "association" + }, + { + "access": "public", + "destination": "1969674835696841438", + "source": "1761875020766116446", + "type": "association" + }, + { + "access": "public", + "destination": "1969674835696841438", + "source": "2193549214042244690", + "type": "association" + } + ] +} +``` diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index ab86090c..e184123c 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - + src - + lib1 - + lib2 - + include - + lib1 - + lib2 - - + + t40002.cc - - + + lib1.cc - - + + lib2.cc - - + + lib1.h - - + + lib2.h diff --git a/docs/test_cases/t40003.md b/docs/test_cases/t40003.md index d5fc9c01..a9c088ef 100644 --- a/docs/test_cases/t40003.md +++ b/docs/test_cases/t40003.md @@ -27,3 +27,179 @@ diagrams: ## Source code ## Generated UML diagrams ![t40003_include](./t40003_include.svg "Dependants and dependencies include diagram filter test") +## Generated JSON models +```json +{ + "diagram_type": "include", + "elements": [ + { + "display_name": "src", + "elements": [ + { + "display_name": "src/dependants", + "elements": [ + { + "display_name": "src/dependants/t1.cc", + "file_kind": "implementation", + "id": "1215324434184692437", + "name": "t1.cc", + "type": "file" + } + ], + "id": "1128556599972003761", + "name": "dependants", + "type": "folder" + }, + { + "display_name": "src/dependencies", + "elements": [ + { + "display_name": "src/dependencies/t2.cc", + "file_kind": "implementation", + "id": "2215849176605856058", + "name": "t2.cc", + "type": "file" + } + ], + "id": "2015386828772336316", + "name": "dependencies", + "type": "folder" + } + ], + "id": "1387619747296316447", + "name": "src", + "type": "folder" + }, + { + "display_name": "include", + "elements": [ + { + "display_name": "include/dependants", + "elements": [ + { + "display_name": "include/dependants/t3.h", + "file_kind": "header", + "id": "60001020671836182", + "name": "t3.h", + "type": "file" + }, + { + "display_name": "include/dependants/t2.h", + "file_kind": "header", + "id": "1921842892192045013", + "name": "t2.h", + "type": "file" + }, + { + "display_name": "include/dependants/t1.h", + "file_kind": "header", + "id": "2295271780650013565", + "name": "t1.h", + "type": "file" + } + ], + "id": "1763526330848915994", + "name": "dependants", + "type": "folder" + }, + { + "display_name": "include/dependencies", + "elements": [ + { + "display_name": "include/dependencies/t3.h", + "file_kind": "header", + "id": "1226843223635488673", + "name": "t3.h", + "type": "file" + }, + { + "display_name": "include/dependencies/t2.h", + "file_kind": "header", + "id": "1849348825646635129", + "name": "t2.h", + "type": "file" + }, + { + "display_name": "include/dependencies/t1.h", + "file_kind": "header", + "id": "1120257488305564427", + "name": "t1.h", + "type": "file" + }, + { + "display_name": "include/dependencies/t5.h", + "file_kind": "header", + "id": "2106129159239499468", + "name": "t5.h", + "type": "file" + } + ], + "id": "1833478793852674517", + "name": "dependencies", + "type": "folder" + } + ], + "id": "989412417490706876", + "name": "include", + "type": "folder" + } + ], + "name": "t40003_include", + "relationships": [ + { + "access": "public", + "destination": "60001020671836182", + "source": "1215324434184692437", + "type": "association" + }, + { + "access": "public", + "destination": "1882940911178525353", + "source": "1215324434184692437", + "type": "association" + }, + { + "access": "public", + "destination": "1226843223635488673", + "source": "2215849176605856058", + "type": "association" + }, + { + "access": "public", + "destination": "2106129159239499468", + "source": "2215849176605856058", + "type": "association" + }, + { + "access": "public", + "destination": "1921842892192045013", + "source": "60001020671836182", + "type": "association" + }, + { + "access": "public", + "destination": "2295271780650013565", + "source": "1921842892192045013", + "type": "association" + }, + { + "access": "public", + "destination": "1849348825646635129", + "source": "1226843223635488673", + "type": "association" + }, + { + "access": "public", + "destination": "1120257488305564427", + "source": "1849348825646635129", + "type": "association" + }, + { + "access": "public", + "destination": "1120257488305564427", + "source": "2106129159239499468", + "type": "association" + } + ] +} +``` diff --git a/docs/test_cases/t40003_include.svg b/docs/test_cases/t40003_include.svg index 6719d62d..cb1d7c74 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + src - + dependants - + dependencies - + include - + dependants - + dependencies - - + + t1.cc - - + + t2.cc - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h diff --git a/docs/test_cases/t90000.md b/docs/test_cases/t90000.md index 47496b72..95ffd5ff 100644 --- a/docs/test_cases/t90000.md +++ b/docs/test_cases/t90000.md @@ -30,3 +30,4 @@ File t90000.cc ``` ## Generated UML diagrams ![t90000_class](./t90000_class.svg "Basic config test") +## Generated JSON models From 3b75da062e017d889d926aadeb76a1669de7336c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 20:21:13 +0100 Subject: [PATCH 23/30] Refactored diagram visitor and generator selection based on traits --- src/common/generators/generators.cc | 218 ++++++++-------------------- src/common/generators/generators.h | 85 +++++++++++ 2 files changed, 144 insertions(+), 159 deletions(-) diff --git a/src/common/generators/generators.cc b/src/common/generators/generators.cc index b7b9dd1d..748460d4 100644 --- a/src/common/generators/generators.cc +++ b/src/common/generators/generators.cc @@ -55,6 +55,56 @@ void find_translation_units_for_diagrams( } } +namespace detail { + +template +void generate_diagram_select_generator(const std::string &od, + const std::string &name, std::shared_ptr diagram, + const DiagramModel &model) +{ + using diagram_generator = typename diagram_generator_t::type; + + auto path = std::filesystem::path{od} / + fmt::format("{}.{}", name, GeneratorTag::extension); + std::ofstream ofs; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + ofs << diagram_generator(dynamic_cast(*diagram), *model); + + ofs.close(); + + LOG_INFO("Written {} diagram to {}", name, path.string()); +} + +template +void generate_diagram_impl(const std::string &od, const std::string &name, + std::shared_ptr diagram, + const clang::tooling::CompilationDatabase &db, + const std::vector &translation_units, + const std::vector &generators, + bool verbose) +{ + using diagram_config = DiagramConfig; + using diagram_model = typename diagram_model_t::type; + using diagram_visitor = typename diagram_visitor_t::type; + + auto model = clanguml::common::generators::generate(db, diagram->name, + dynamic_cast(*diagram), translation_units, verbose); + + for (const auto generator_type : generators) { + if (generator_type == generator_type_t::plantuml) { + generate_diagram_select_generator(od, name, diagram, model); + } + else if (generator_type == generator_type_t::json) { + generate_diagram_select_generator(od, name, diagram, model); + } + } +} +} // namespace detail + void generate_diagram(const std::string &od, const std::string &name, std::shared_ptr diagram, const clang::tooling::CompilationDatabase &db, @@ -64,177 +114,27 @@ void generate_diagram(const std::string &od, const std::string &name, { using clanguml::common::generator_type_t; using clanguml::common::model::diagram_t; + using clanguml::config::class_diagram; using clanguml::config::include_diagram; using clanguml::config::package_diagram; using clanguml::config::sequence_diagram; if (diagram->type() == diagram_t::kClass) { - using diagram_config = class_diagram; - using diagram_model = clanguml::class_diagram::model::diagram; - using diagram_visitor = - clanguml::class_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - for (const auto generator_type : generators) { - if (generator_type == generator_type_t::plantuml) { - auto path = - std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::class_diagram::generators::plantuml::generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - else if (generator_type == generator_type_t::json) { - auto path = - std::filesystem::path{od} / fmt::format("{}.json", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::class_diagram::generators::json::generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - } + detail::generate_diagram_impl( + od, name, diagram, db, translation_units, generators, verbose); } else if (diagram->type() == diagram_t::kSequence) { - using diagram_config = sequence_diagram; - using diagram_model = clanguml::sequence_diagram::model::diagram; - using diagram_visitor = - clanguml::sequence_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - for (const auto generator_type : generators) { - if (generator_type == generator_type_t::plantuml) { - auto path = - std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::sequence_diagram::generators::plantuml:: - generator( - dynamic_cast( - *diagram), - *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - else if (generator_type == generator_type_t::json) { - auto path = - std::filesystem::path{od} / fmt::format("{}.json", name); - std::ofstream ofs; - - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::sequence_diagram::generators::json::generator( - dynamic_cast( - *diagram), - *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - } + detail::generate_diagram_impl( + od, name, diagram, db, translation_units, generators, verbose); } else if (diagram->type() == diagram_t::kPackage) { - using diagram_config = package_diagram; - using diagram_model = clanguml::package_diagram::model::diagram; - using diagram_visitor = - clanguml::package_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - for (const auto generator_type : generators) { - if (generator_type == generator_type_t::plantuml) { - auto path = - std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - - ofs << clanguml::package_diagram::generators::plantuml:: - generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - else if (generator_type == generator_type_t::json) { - auto path = - std::filesystem::path{od} / fmt::format("{}.json", name); - std::ofstream ofs; - - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::package_diagram::generators::json::generator( - dynamic_cast(*diagram), - *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - } + detail::generate_diagram_impl( + od, name, diagram, db, translation_units, generators, verbose); } else if (diagram->type() == diagram_t::kInclude) { - using diagram_config = include_diagram; - using diagram_model = clanguml::include_diagram::model::diagram; - using diagram_visitor = - clanguml::include_diagram::visitor::translation_unit_visitor; - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), translation_units, - verbose); - - for (const auto generator_type : generators) { - if (generator_type == generator_type_t::plantuml) { - auto path = - std::filesystem::path{od} / fmt::format("{}.puml", name); - std::ofstream ofs; - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - - ofs << clanguml::include_diagram::generators::plantuml:: - generator( - dynamic_cast(*diagram), *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - else if (generator_type == generator_type_t::json) { - auto path = - std::filesystem::path{od} / fmt::format("{}.json", name); - std::ofstream ofs; - - ofs.open(path, std::ofstream::out | std::ofstream::trunc); - ofs << clanguml::include_diagram::generators::json::generator( - dynamic_cast(*diagram), - *model); - - ofs.close(); - - LOG_INFO("Written {} diagram to {}", name, path.string()); - } - } + detail::generate_diagram_impl( + od, name, diagram, db, translation_units, generators, verbose); } } diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h index e5e03803..c2a6e956 100644 --- a/src/common/generators/generators.h +++ b/src/common/generators/generators.h @@ -48,6 +48,91 @@ namespace clanguml::common::generators { +// template trait for selecting diagram model type based on diagram config +// type +template struct diagram_model_t; +template <> struct diagram_model_t { + using type = clanguml::class_diagram::model::diagram; +}; +template <> struct diagram_model_t { + using type = clanguml::sequence_diagram::model::diagram; +}; +template <> struct diagram_model_t { + using type = clanguml::package_diagram::model::diagram; +}; +template <> struct diagram_model_t { + using type = clanguml::include_diagram::model::diagram; +}; + +// template trait for selecting diagram visitor type based on diagram config +// type +template struct diagram_visitor_t; +template <> struct diagram_visitor_t { + using type = clanguml::class_diagram::visitor::translation_unit_visitor; +}; +template <> struct diagram_visitor_t { + using type = clanguml::sequence_diagram::visitor::translation_unit_visitor; +}; +template <> struct diagram_visitor_t { + using type = clanguml::package_diagram::visitor::translation_unit_visitor; +}; +template <> struct diagram_visitor_t { + using type = clanguml::include_diagram::visitor::translation_unit_visitor; +}; + +// template trait for selecting diagram generator type based on diagram config +// type +struct plantuml_generator_tag { + inline static const std::string extension = "puml"; +}; +struct json_generator_tag { + inline static const std::string extension = "json"; +}; + +template +struct diagram_generator_t; +template <> +struct diagram_generator_t { + using type = clanguml::class_diagram::generators::plantuml::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::sequence_diagram::generators::plantuml::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::package_diagram::generators::plantuml::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::include_diagram::generators::plantuml::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::class_diagram::generators::json::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::sequence_diagram::generators::json::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::package_diagram::generators::json::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::include_diagram::generators::json::generator; +}; + +template struct diagram_visitor_t; void find_translation_units_for_diagrams( const std::vector &diagram_names, clanguml::config::config &config, From 9e7c290685f87a4b541e107d5ea599172671472d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 20:41:00 +0100 Subject: [PATCH 24/30] Updated docs --- CHANGELOG.md | 1 + README.md | 11 +++++++---- docs/Makefile | 1 + docs/README.md | 3 ++- docs/generator_types.md | 22 ++++++++++++++++++++++ docs/quick_start.md | 4 ++-- 6 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 docs/generator_types.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 2658b920..085f0d9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # CHANGELOG + * Added JSON generator (#114) * Added diagram templates support (#105) * Added parents (base classes) diagram filter * Fixed namespace handling for nested template specializations diff --git a/README.md b/README.md index a0126b87..f3cc4753 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ YAML configuration files. The main idea behind the project is to easily maintain up-to-date diagrams within a code-base or document legacy code. The configuration file or files for `clang-uml` define the type and contents of each generated diagram. -Currently, the diagrams are generated in [PlantUML](https://plantuml.com) and JSON formats. +The diagrams can be generated in [PlantUML](https://plantuml.com) and JSON formats. `clang-uml` currently supports C++ up to version 17 and partial support for C++ 20. @@ -44,14 +44,16 @@ Main features supported so far include: * **Include graph diagram generation** * Show include graph for selected files -To see what `clang-uml` can do so far, checkout the diagrams generated for unit test cases [here](./docs/test_cases.md) -and examples in [clang-uml-examples](https://github.com/bkryza/clang-uml-examples) repository. +To see what `clang-uml` can do so far, checkout the diagrams generated for unit +test cases [here](./docs/test_cases.md) and examples in +[clang-uml-examples](https://github.com/bkryza/clang-uml-examples) repository. More comprehensive documentation can be found [here](./docs/README.md). ## Installation -Installation instructions for `Linux`, `macos` and `Windows` can be found [here](./docs/installation.md). +Installation instructions for `Linux`, `macos` and `Windows` can be found +[here](./docs/installation.md). ## Usage @@ -425,6 +427,7 @@ This project relies on the following great tools: * [CLI11](https://github.com/CLIUtils/CLI11) - command line parser for C++ * [inja](https://github.com/pantor/inja) - a template engine for modern C++ * [backward-cpp](https://github.com/bombela/backward-cpp) - stack trace pretty printer for C++ +* [yaml-cpp](https://github.com/jbeder/yaml-cpp) - YAML parser library for C++ ## Contributing diff --git a/docs/Makefile b/docs/Makefile index 66ae9e98..ed309583 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -22,6 +22,7 @@ toc: $(UPDATE_TOC) class_diagrams.md $(UPDATE_TOC) comment_decorators.md $(UPDATE_TOC) common_options.md + $(UPDATE_TOC) generator_types.md $(UPDATE_TOC) configuration_file.md $(UPDATE_TOC) diagram_filters.md $(UPDATE_TOC) doxygen_integration.md diff --git a/docs/README.md b/docs/README.md index 0fb0ae20..740fabc8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,7 +3,8 @@ * [Quick start](./quick_start.md) * [Installation](./installation.md) * Generating diagrams - * [Common options](./common_options.md) + * [Common options](./common_options.md) + * [Generator types](./generator_types.md) * [Class diagrams](./class_diagrams.md) * [Sequence diagrams](./sequence_diagrams.md) * [Package diagrams](./package_diagrams.md) diff --git a/docs/generator_types.md b/docs/generator_types.md new file mode 100644 index 00000000..ad6b0786 --- /dev/null +++ b/docs/generator_types.md @@ -0,0 +1,22 @@ +# Generator types + + + +* [PlantUML](#plantuml) +* [JSON](#json) + + + +Currently, there are 2 types of diagram generators: `plantuml` and `json`. + +## PlantUML + +Generates UML diagrams in textual PlantUML format, which can then +be converted to various image formats. + +## JSON + +Generates a JSON representation of the intermediate `clang-uml` model, which +can be used for scripting, integrations as well as analysing the code base +or even generating diagrams in other formats. + diff --git a/docs/quick_start.md b/docs/quick_start.md index 268c09ad..39971f86 100644 --- a/docs/quick_start.md +++ b/docs/quick_start.md @@ -56,7 +56,7 @@ To add an initial class diagram to your project, follow these steps: - another_diagram [sequence] - some_class_diagram [class] ``` -7. Generate only the new diagram: +7. Generate only the new diagram in JSON format: ```bash - clang-uml -n another_diagram + clang-uml -n another_diagram -g json ``` From a797a992b424ffbb071c311ec088ea49524facf1 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 21:14:07 +0100 Subject: [PATCH 25/30] Refactored test case diagram visitor and generator selection based on traits --- tests/test_cases.cc | 222 +++++++++++++++++++------------------------- 1 file changed, 93 insertions(+), 129 deletions(-) diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 38909c61..3854f730 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -56,196 +56,160 @@ load_config(const std::string &test_name) return std::make_pair(std::move(config), std::move(compilation_database)); } -std::unique_ptr -generate_sequence_diagram(clang::tooling::CompilationDatabase &db, +namespace detail { +template +auto generate_diagram_impl(clang::tooling::CompilationDatabase &db, std::shared_ptr diagram) { - using diagram_config = clanguml::config::sequence_diagram; - using diagram_model = clanguml::sequence_diagram::model::diagram; + using diagram_config = DiagramConfig; + using diagram_model = + typename clanguml::common::generators::diagram_model_t< + diagram_config>::type; using diagram_visitor = - clanguml::sequence_diagram::visitor::translation_unit_visitor; + typename clanguml::common::generators::diagram_visitor_t< + diagram_config>::type; inject_diagram_options(diagram); auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), + dynamic_cast(*diagram), diagram->get_translation_units()); return model; } +template +auto generate_diagram_puml( + std::shared_ptr config, DiagramModel &model) +{ + using diagram_config = DiagramConfig; + using diagram_model = DiagramModel; + using diagram_generator = + typename clanguml::common::generators::diagram_generator_t< + DiagramConfig, + clanguml::common::generators::plantuml_generator_tag>::type; + + std::stringstream ss; + + ss << diagram_generator(dynamic_cast(*config), model); + + return ss.str(); +} + +template +auto generate_diagram_json( + std::shared_ptr config, DiagramModel &model) +{ + using diagram_config = DiagramConfig; + using diagram_model = DiagramModel; + using diagram_generator = + typename clanguml::common::generators::diagram_generator_t< + DiagramConfig, + clanguml::common::generators::json_generator_tag>::type; + + std::stringstream ss; + + ss << diagram_generator(dynamic_cast(*config), model); + + return nlohmann::json::parse(ss.str()); +} +} + std::unique_ptr generate_class_diagram( clang::tooling::CompilationDatabase &db, std::shared_ptr diagram) { - using diagram_config = clanguml::config::class_diagram; - using diagram_model = clanguml::class_diagram::model::diagram; - using diagram_visitor = - clanguml::class_diagram::visitor::translation_unit_visitor; + return detail::generate_diagram_impl( + db, diagram); +} - inject_diagram_options(diagram); - - auto model = clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), - diagram->get_translation_units()); - - return model; +std::unique_ptr +generate_sequence_diagram(clang::tooling::CompilationDatabase &db, + std::shared_ptr diagram) +{ + return detail::generate_diagram_impl( + db, diagram); } std::unique_ptr generate_package_diagram(clang::tooling::CompilationDatabase &db, std::shared_ptr diagram) { - using diagram_config = clanguml::config::package_diagram; - using diagram_model = clanguml::package_diagram::model::diagram; - using diagram_visitor = - clanguml::package_diagram::visitor::translation_unit_visitor; - - inject_diagram_options(diagram); - - return clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), - diagram->get_translation_units()); + return detail::generate_diagram_impl( + db, diagram); } std::unique_ptr generate_include_diagram(clang::tooling::CompilationDatabase &db, std::shared_ptr diagram) { - using diagram_config = clanguml::config::include_diagram; - using diagram_model = clanguml::include_diagram::model::diagram; - using diagram_visitor = - clanguml::include_diagram::visitor::translation_unit_visitor; - - inject_diagram_options(diagram); - - return clanguml::common::generators::generate(db, diagram->name, - dynamic_cast(*diagram), - diagram->get_translation_units()); -} - -std::string generate_sequence_puml( - std::shared_ptr config, - clanguml::sequence_diagram::model::diagram &model) -{ - using namespace clanguml::sequence_diagram::generators::plantuml; - - std::stringstream ss; - - ss << generator( - dynamic_cast(*config), model); - - return ss.str(); -} - -nlohmann::json generate_sequence_json( - std::shared_ptr config, - clanguml::sequence_diagram::model::diagram &model) -{ - using namespace clanguml::sequence_diagram::generators::json; - - std::stringstream ss; - - ss << generator( - dynamic_cast(*config), model); - - return nlohmann::json::parse(ss.str()); + return detail::generate_diagram_impl( + db, diagram); } std::string generate_class_puml( std::shared_ptr config, clanguml::class_diagram::model::diagram &model) { - using namespace clanguml::class_diagram::generators::plantuml; - - std::stringstream ss; - - ss << generator( - dynamic_cast(*config), model); - - return ss.str(); + return detail::generate_diagram_puml( + config, model); } -nlohmann::json generate_class_json( +std::string generate_sequence_puml( std::shared_ptr config, - clanguml::class_diagram::model::diagram &model) + clanguml::sequence_diagram::model::diagram &model) { - using namespace clanguml::class_diagram::generators::json; - - std::stringstream ss; - - ss << generator( - dynamic_cast(*config), model); - - return nlohmann::json::parse(ss.str()); + return detail::generate_diagram_puml( + config, model); } std::string generate_package_puml( std::shared_ptr config, clanguml::package_diagram::model::diagram &model) { - using namespace clanguml::package_diagram::generators::plantuml; - - std::stringstream ss; - - assert(config.get() != nullptr); - - ss << generator( - dynamic_cast(*config), model); - - return ss.str(); -} - -nlohmann::json generate_package_json( - std::shared_ptr config, - clanguml::package_diagram::model::diagram &model) -{ - using namespace clanguml::package_diagram::generators::json; - - std::stringstream ss; - - assert(config.get() != nullptr); - - ss << generator( - dynamic_cast(*config), model); - - return nlohmann::json::parse(ss.str()); + return detail::generate_diagram_puml( + config, model); } std::string generate_include_puml( std::shared_ptr config, clanguml::include_diagram::model::diagram &model) { - using namespace clanguml::include_diagram::generators::plantuml; + return detail::generate_diagram_puml( + config, model); +} - std::stringstream ss; +nlohmann::json generate_class_json( + std::shared_ptr config, + clanguml::class_diagram::model::diagram &model) +{ + return detail::generate_diagram_json( + config, model); +} - assert(config.get() != nullptr); +nlohmann::json generate_sequence_json( + std::shared_ptr config, + clanguml::sequence_diagram::model::diagram &model) +{ + return detail::generate_diagram_json( + config, model); +} - ss << generator( - dynamic_cast(*config), model); - - return ss.str(); +nlohmann::json generate_package_json( + std::shared_ptr config, + clanguml::package_diagram::model::diagram &model) +{ + return detail::generate_diagram_json( + config, model); } nlohmann::json generate_include_json( std::shared_ptr config, clanguml::include_diagram::model::diagram &model) { - using namespace clanguml::include_diagram::generators::json; - - std::stringstream ss; - - assert(config.get() != nullptr); - - ss << generator( - dynamic_cast(*config), model); - - return nlohmann::json::parse(ss.str()); + return detail::generate_diagram_json( + config, model); } void save_puml(const std::string &path, const std::string &puml) From 9e3c387fbd721d3bab9a552ff9c754a760a9fef7 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 21:19:27 +0100 Subject: [PATCH 26/30] Optimized sequence diagram JSON models --- .../json/sequence_diagram_generator.cc | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc index 9cf9b287..b330edc9 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -30,7 +30,6 @@ std::string render_name(std::string name) } // namespace clanguml::sequence_diagram::generators::json namespace clanguml::sequence_diagram::model { -// using nlohmann::json; void to_json(nlohmann::json &j, const participant &c) { @@ -118,10 +117,6 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const msg["from"]["participant_id"] = std::to_string(class_participant.class_id()); - msg["from"]["participant_name"] = generators::json::render_name( - m_model.get_participant(class_participant.class_id()) - .value() - .full_name(false)); } else if (from.value().type_name() == "function" || from.value().type_name() == "function_template") { @@ -131,10 +126,6 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const .value(); msg["from"]["participant_id"] = std::to_string(common::to_id(file_participant.file_relative())); - msg["from"]["participant_name"] = util::path_to_url( - std::filesystem::relative(file_participant.file(), - std::filesystem::canonical(m_config.relative_to()) - .string())); } else { msg["from"]["participant_id"] = std::to_string(from.value().id()); @@ -143,8 +134,6 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const } else if (from.value().type_name() == "lambda") { msg["from"]["participant_id"] = std::to_string(from.value().id()); - msg["from"]["participant_name"] = - generators::json::render_name(from.value().full_name(false)); } if (to.value().type_name() == "method") { @@ -153,10 +142,6 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const msg["to"]["participant_id"] = std::to_string(class_participant.class_id()); - msg["to"]["participant_name"] = - m_model.get_participant(class_participant.class_id()) - .value() - .full_name(false); } else if (to.value().type_name() == "function" || to.value().type_name() == "function_template") { @@ -166,20 +151,13 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const .value(); msg["to"]["participant_id"] = std::to_string(common::to_id(file_participant.file_relative())); - msg["to"]["participant_name"] = util::path_to_url( - std::filesystem::relative(file_participant.file(), - std::filesystem::canonical(m_config.relative_to()) - .string())); } else { msg["to"]["participant_id"] = std::to_string(to.value().id()); - msg["to"]["participant_name"] = to.value().full_name(false); } } else if (to.value().type_name() == "lambda") { msg["to"]["participant_id"] = std::to_string(to.value().id()); - msg["to"]["participant_name"] = - generators::json::render_name(to.value().full_name(false)); } msg["source_location"] = From 90307793d818ebe0db8e46d1303e7d9e9ef0b7cc Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 22:28:32 +0100 Subject: [PATCH 27/30] Remove access for relationships in include and package diagrams --- src/include_diagram/visitor/translation_unit_visitor.cc | 7 ++++--- src/package_diagram/visitor/translation_unit_visitor.cc | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/include_diagram/visitor/translation_unit_visitor.cc b/src/include_diagram/visitor/translation_unit_visitor.cc index a2ebd18b..6f47e1ea 100644 --- a/src/include_diagram/visitor/translation_unit_visitor.cc +++ b/src/include_diagram/visitor/translation_unit_visitor.cc @@ -147,8 +147,8 @@ translation_unit_visitor::include_visitor::process_internal_header( diagram() .get(current_file_id) .value() - .add_relationship(common::model::relationship{ - relationship_type, include_file.id()}); + .add_relationship(common::model::relationship{relationship_type, + include_file.id(), common::model::access_t::kNone}); } return include_file.id(); @@ -176,7 +176,8 @@ translation_unit_visitor::include_visitor::process_external_system_header( .get(current_file_id) .value() .add_relationship(common::model::relationship{ - common::model::relationship_t::kDependency, f_id}); + common::model::relationship_t::kDependency, f_id, + common::model::access_t::kNone}); } return f_id; diff --git a/src/package_diagram/visitor/translation_unit_visitor.cc b/src/package_diagram/visitor/translation_unit_visitor.cc index d7e01d25..d12f4a3f 100644 --- a/src/package_diagram/visitor/translation_unit_visitor.cc +++ b/src/package_diagram/visitor/translation_unit_visitor.cc @@ -167,7 +167,8 @@ void translation_unit_visitor::add_relationships( if (current_package) { for (const auto &dependency : relationships) { const auto destination_id = std::get<0>(dependency); - relationship r{relationship_t::kDependency, destination_id}; + relationship r{relationship_t::kDependency, destination_id, + common::model::access_t::kNone}; if (destination_id != current_package_id) current_package.value().add_relationship(std::move(r)); } From fc3110fd4e8ffc431522b4acd11cb67e982d695a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 25 Mar 2023 22:49:47 +0100 Subject: [PATCH 28/30] Fixed clang-tidy warnings --- .../visitor/translation_unit_visitor.cc | 10 +++++--- src/common/generators/json/generator.cc | 12 ++++----- src/common/model/enums.h | 2 +- src/common/model/template_parameter.h | 25 ++++++++++--------- .../json/include_diagram_generator.cc | 4 +-- .../json/sequence_diagram_generator.cc | 18 ++++++------- .../json/sequence_diagram_generator.h | 6 ++--- src/sequence_diagram/model/participant.cc | 2 +- .../visitor/translation_unit_visitor.cc | 7 +++++- 9 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index 781ba0be..549bc9aa 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -1981,18 +1981,21 @@ void translation_unit_visitor:: bool translation_unit_visitor::find_relationships_in_unexposed_template_params( const template_parameter &ct, found_relationships_t &relationships) { - assert(ct.type()); + const auto &type = ct.type(); + + if (!type) + return false; bool found{false}; LOG_DBG("Finding relationships in user defined type: {}", ct.to_string(config().using_namespace(), false)); auto type_with_namespace = - std::make_optional(ct.type().value()); + std::make_optional(type.value()); if (!type_with_namespace.has_value()) { // Couldn't find declaration of this type - type_with_namespace = common::model::namespace_{ct.type().value()}; + type_with_namespace = common::model::namespace_{type.value()}; } auto element_opt = diagram().get(type_with_namespace.value().to_string()); @@ -2007,6 +2010,7 @@ bool translation_unit_visitor::find_relationships_in_unexposed_template_params( nested_template_params, relationships) || found; } + return found; } diff --git a/src/common/generators/json/generator.cc b/src/common/generators/json/generator.cc index a36ace46..3f00666f 100644 --- a/src/common/generators/json/generator.cc +++ b/src/common/generators/json/generator.cc @@ -54,12 +54,12 @@ void to_json(nlohmann::json &j, const element &c) void to_json(nlohmann::json &j, const template_parameter &c) { j["kind"] = to_string(c.kind()); - if (c.type()) - j["type"] = c.type().value(); - if (c.name()) - j["name"] = c.name().value(); - if (c.default_value()) - j["default"] = c.default_value().value(); + if (const auto &t = c.type(); t) + j["type"] = t.value(); + if (const auto &n = c.name(); n) + j["name"] = n.value(); + if (const auto &d = c.default_value(); d) + j["default"] = d.value(); j["is_variadic"] = c.is_variadic(); j["template_parameters"] = c.template_params(); } diff --git a/src/common/model/enums.h b/src/common/model/enums.h index 1fb71ae4..c8156faa 100644 --- a/src/common/model/enums.h +++ b/src/common/model/enums.h @@ -81,7 +81,7 @@ std::string to_string(message_t m); std::string to_string(diagram_t r); -std::string to_string(message_scope_t); +std::string to_string(message_scope_t t); diagram_t from_string(const std::string &s); diff --git a/src/common/model/template_parameter.h b/src/common/model/template_parameter.h index 4a8453c2..516ca258 100644 --- a/src/common/model/template_parameter.h +++ b/src/common/model/template_parameter.h @@ -44,20 +44,21 @@ std::string to_string(template_parameter_kind_t k); /// nested templates class template_parameter { public: - static template_parameter make_template_type(std::string name, + static template_parameter make_template_type(const std::string &name, const std::optional &default_value = {}, bool is_variadic = false) { template_parameter p; p.set_kind(template_parameter_kind_t::template_type); - p.set_name(std::move(name)); + p.set_name(name); p.is_variadic(is_variadic); if (default_value) p.set_default_value(default_value.value()); return p; } - static template_parameter make_template_template_type(std::string name, + static template_parameter make_template_template_type( + const std::string &name, const std::optional &default_value = {}, bool is_variadic = false) { @@ -70,14 +71,14 @@ public: return p; } - static template_parameter make_non_type_template(std::string type, + static template_parameter make_non_type_template(const std::string &type, const std::optional &name, const std::optional &default_value = {}, bool is_variadic = false) { template_parameter p; p.set_kind(template_parameter_kind_t::non_type_template); - p.set_type(std::move(type)); + p.set_type(type); if (name) p.set_name(name.value()); if (default_value) @@ -86,21 +87,21 @@ public: return p; } - static template_parameter make_argument( - std::string type, const std::optional &default_value = {}) + static template_parameter make_argument(const std::string &type, + const std::optional &default_value = {}) { template_parameter p; p.set_kind(template_parameter_kind_t::argument); - p.set_type(std::move(type)); + p.set_type(type); if (default_value) p.set_default_value(default_value.value()); return p; } - static template_parameter make_unexposed_argument( - std::string type, const std::optional &default_value = {}) + static template_parameter make_unexposed_argument(const std::string &type, + const std::optional &default_value = {}) { - template_parameter p = make_argument(std::move(type), default_value); + template_parameter p = make_argument(type, default_value); p.set_unexposed(true); return p; } @@ -178,7 +179,7 @@ public: private: template_parameter() = default; - template_parameter_kind_t kind_; + template_parameter_kind_t kind_{template_parameter_kind_t::template_type}; /// Represents the type of non-type template parameters /// e.g. 'int' or type of template arguments diff --git a/src/include_diagram/generators/json/include_diagram_generator.cc b/src/include_diagram/generators/json/include_diagram_generator.cc index ce26063b..675adb2b 100644 --- a/src/include_diagram/generators/json/include_diagram_generator.cc +++ b/src/include_diagram/generators/json/include_diagram_generator.cc @@ -32,8 +32,6 @@ void generator::generate_relationships( { LOG_DBG("Generating relationships for file {}", f.full_name(true)); - namespace json_common = clanguml::common::generators::json; - if (f.type() == common::model::source_file_t::kDirectory) { util::for_each(f, [this, &parent](const auto &file) { generate_relationships( @@ -93,7 +91,7 @@ void generator::generate(std::ostream &ostr) const // Generate files and folders util::for_each_if( m_model, [](const auto & /*f*/) { return true; }, - [this, &ostr](const auto &f) { + [this](const auto &f) { generate(dynamic_cast(*f), json_); }); diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc index b330edc9..d69f12b3 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.cc +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.cc @@ -48,7 +48,7 @@ void to_json(nlohmann::json &j, const activity &c) j["participant_id"] = std::to_string(c.from()); } -} // namespace clanguml::class_diagram::model +} // namespace clanguml::sequence_diagram::model namespace clanguml::sequence_diagram::generators::json { @@ -172,11 +172,8 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const m.from(), to, m.to()); } -void generator::generate_activity( - common::model::diagram_element::id_t activity_id, const activity &a, - nlohmann::json &unused, - std::vector &visited, - std::optional nested_block) const +void generator::generate_activity(const activity &a, + std::vector &visited) const { // Generate calls from this activity to other activities for (const auto &m : a.messages()) { @@ -265,8 +262,7 @@ void generator::process_call_message(const model::message &m, LOG_DBG("Creating activity {} --> {} - missing sequence {}", m.from(), m.to(), m.to()); - generate_activity(m.to(), m_model.get_activity(m.to()), - current_block_statement(), visited, {}); + generate_activity(m_model.get_activity(m.to()), visited); } } else @@ -644,8 +640,8 @@ void generator::generate(std::ostream &ostr) const block_statements_stack_.push_back(std::ref(sequence)); - generate_activity(start_from, m_model.get_activity(start_from), - sequence, visited_participants, {}); + generate_activity( + m_model.get_activity(start_from), visited_participants); json_["sequences"].push_back(std::move(sequence)); @@ -666,4 +662,4 @@ void generator::generate(std::ostream &ostr) const ostr << json_; } -} // namespace clanguml::sequence_diagram::generators::plantuml +} // namespace clanguml::sequence_diagram::generators::json diff --git a/src/sequence_diagram/generators/json/sequence_diagram_generator.h b/src/sequence_diagram/generators/json/sequence_diagram_generator.h index 84e3a28a..dbad2163 100644 --- a/src/sequence_diagram/generators/json/sequence_diagram_generator.h +++ b/src/sequence_diagram/generators/json/sequence_diagram_generator.h @@ -53,10 +53,8 @@ public: void generate_participant( nlohmann::json &parent, const std::string &name) const; - void generate_activity(common::model::diagram_element::id_t activity_id, - const sequence_diagram::model::activity &a, nlohmann::json &parent, - std::vector &visited, - std::optional nested_block) const; + void generate_activity(const sequence_diagram::model::activity &a, + std::vector &visited) const; void generate(std::ostream &ostr) const override; diff --git a/src/sequence_diagram/model/participant.cc b/src/sequence_diagram/model/participant.cc index 1db4ac6d..dabb05fc 100644 --- a/src/sequence_diagram/model/participant.cc +++ b/src/sequence_diagram/model/participant.cc @@ -185,7 +185,7 @@ std::string method::message_name(message_render_mode mode) const { constexpr auto kAbbreviatedMethodArgumentsLength{15}; - const std::string style = ""; + const std::string style{}; if (mode == message_render_mode::no_arguments) { return fmt::format("{}{}(){}{}", style, method_name(), diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index ec417a54..c9f9e3ee 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -1606,8 +1606,13 @@ translation_unit_visitor::build_template_instantiation_process_type_argument( // If this is a nested template type - add nested templates as // template arguments - if (arg.getAsType()->getAs() != nullptr) { + if (const auto *function_template_type = + arg.getAsType()->getAs(); + function_template_type != nullptr) { // TODO + argument = template_parameter::make_argument( + common::to_string(function_template_type->getReturnType(), + template_decl->getASTContext())); } else if (const auto *nested_template_type = arg.getAsType()->getAs(); From f2062c59097ad23967aefe09e28b2cc88011cf8a Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 26 Mar 2023 00:24:04 +0100 Subject: [PATCH 29/30] Updated test cases documentation --- docs/test_cases/t00002_class.svg | 36 ++--- docs/test_cases/t00003_class.svg | 46 +++---- docs/test_cases/t00004_class.svg | 76 +++++------ docs/test_cases/t00005_class.svg | 110 +++++++-------- docs/test_cases/t00006_class.svg | 132 +++++++++--------- docs/test_cases/t00007_class.svg | 30 ++-- docs/test_cases/t00008_class.svg | 68 +++++----- docs/test_cases/t00009_class.svg | 32 ++--- docs/test_cases/t00010_class.svg | 34 ++--- docs/test_cases/t00011_class.svg | 22 +-- docs/test_cases/t00012_class.svg | 66 ++++----- docs/test_cases/t00013_class.svg | 82 +++++------ docs/test_cases/t00014_class.svg | 116 ++++++++-------- docs/test_cases/t00015_class.svg | 22 +-- docs/test_cases/t00016_class.svg | 26 ++-- docs/test_cases/t00017_class.svg | 66 ++++----- docs/test_cases/t00018_class.svg | 18 +-- docs/test_cases/t00019_class.svg | 40 +++--- docs/test_cases/t00020_class.svg | 38 +++--- docs/test_cases/t00021_class.svg | 30 ++-- docs/test_cases/t00022_class.svg | 14 +- docs/test_cases/t00023_class.svg | 26 ++-- docs/test_cases/t00024_class.svg | 22 +-- docs/test_cases/t00025_class.svg | 34 ++--- docs/test_cases/t00026_class.svg | 42 +++--- docs/test_cases/t00027_class.svg | 58 ++++---- docs/test_cases/t00028_class.svg | 82 +++++------ docs/test_cases/t00029_class.svg | 50 +++---- docs/test_cases/t00030_class.svg | 46 +++---- docs/test_cases/t00031_class.svg | 50 +++---- docs/test_cases/t00032_class.svg | 40 +++--- docs/test_cases/t00033_class.svg | 48 +++---- docs/test_cases/t00034_class.svg | 38 +++--- docs/test_cases/t00035_class.svg | 22 +-- docs/test_cases/t00036_class.svg | 38 +++--- docs/test_cases/t00037_class.svg | 54 ++++---- docs/test_cases/t00038_class.svg | 54 ++++---- docs/test_cases/t00039_class.svg | 78 +++++------ docs/test_cases/t00040_class.svg | 26 ++-- docs/test_cases/t00041_class.svg | 54 ++++---- docs/test_cases/t00042_class.svg | 32 ++--- docs/test_cases/t00043_class.svg | 50 +++---- docs/test_cases/t00044_class.svg | 18 +-- docs/test_cases/t00045_class.svg | 70 +++++----- docs/test_cases/t00046_class.svg | 64 ++++----- docs/test_cases/t00047_class.svg | 18 +-- docs/test_cases/t00048_class.svg | 50 +++---- docs/test_cases/t00049_class.svg | 32 ++--- docs/test_cases/t00050_class.svg | 70 +++++----- docs/test_cases/t00051_class.svg | 30 ++-- docs/test_cases/t00052_class.svg | 34 ++--- docs/test_cases/t00053_class.svg | 70 +++++----- docs/test_cases/t00054_class.svg | 78 +++++------ docs/test_cases/t00055_class.svg | 42 +++--- docs/test_cases/t00056_class.svg | 94 ++++++------- docs/test_cases/t00057_class.svg | 114 ++++++++-------- docs/test_cases/t00058_class.svg | 48 +++---- docs/test_cases/t00059_class.svg | 50 +++---- docs/test_cases/t00060_class.svg | 38 +++--- docs/test_cases/t20001.md | 30 ++-- docs/test_cases/t20001_sequence.svg | 62 ++++----- docs/test_cases/t20002.md | 9 +- docs/test_cases/t20002_sequence.svg | 48 +++---- docs/test_cases/t20003.md | 9 +- docs/test_cases/t20003_sequence.svg | 48 +++---- docs/test_cases/t20004.md | 27 ++-- docs/test_cases/t20004_sequence.svg | 120 ++++++++-------- docs/test_cases/t20005.md | 12 +- docs/test_cases/t20005_sequence.svg | 36 ++--- docs/test_cases/t20006.md | 69 ++++------ docs/test_cases/t20006_sequence.svg | 150 ++++++++++---------- docs/test_cases/t20007.md | 9 +- docs/test_cases/t20007_sequence.svg | 48 +++---- docs/test_cases/t20008.md | 27 ++-- docs/test_cases/t20008_sequence.svg | 84 ++++++------ docs/test_cases/t20009.md | 27 ++-- docs/test_cases/t20009_sequence.svg | 84 ++++++------ docs/test_cases/t20010.md | 36 ++--- docs/test_cases/t20010_sequence.svg | 72 +++++----- docs/test_cases/t20011.md | 36 ++--- docs/test_cases/t20011_sequence.svg | 72 +++++----- docs/test_cases/t20012.md | 84 ++++-------- docs/test_cases/t20012_sequence.svg | 204 ++++++++++++++-------------- docs/test_cases/t20013.md | 27 ++-- docs/test_cases/t20013_sequence.svg | 60 ++++---- docs/test_cases/t20014.md | 27 ++-- docs/test_cases/t20014_sequence.svg | 72 +++++----- docs/test_cases/t20015.md | 3 +- docs/test_cases/t20015_sequence.svg | 24 ++-- docs/test_cases/t20016.md | 18 +-- docs/test_cases/t20016_sequence.svg | 48 +++---- docs/test_cases/t20017.md | 30 ++-- docs/test_cases/t20017_sequence.svg | 48 +++---- docs/test_cases/t20018.md | 39 ++---- docs/test_cases/t20018_sequence.svg | 96 ++++++------- docs/test_cases/t20019.md | 24 ++-- docs/test_cases/t20019_sequence.svg | 84 ++++++------ docs/test_cases/t20020.md | 42 ++---- docs/test_cases/t20020_sequence.svg | 118 ++++++++-------- docs/test_cases/t20021.md | 36 ++--- docs/test_cases/t20021_sequence.svg | 106 +++++++-------- docs/test_cases/t20022.md | 9 +- docs/test_cases/t20022_sequence.svg | 36 ++--- docs/test_cases/t20023.md | 27 ++-- docs/test_cases/t20023_sequence.svg | 50 +++---- docs/test_cases/t20024.md | 54 +++----- docs/test_cases/t20024_sequence.svg | 88 ++++++------ docs/test_cases/t20025.md | 12 +- docs/test_cases/t20025_sequence.svg | 42 +++--- docs/test_cases/t20026.md | 3 +- docs/test_cases/t20026_sequence.svg | 24 ++-- docs/test_cases/t20027.md | 3 +- docs/test_cases/t20027_sequence.svg | 24 ++-- docs/test_cases/t20028.md | 12 +- docs/test_cases/t20028_sequence.svg | 44 +++--- docs/test_cases/t20029.md | 30 ++-- docs/test_cases/t20029_sequence.svg | 80 +++++------ docs/test_cases/t30001_package.svg | 48 +++---- docs/test_cases/t30002.md | 17 --- docs/test_cases/t30002_package.svg | 90 ++++++------ docs/test_cases/t30003.md | 2 - docs/test_cases/t30003_package.svg | 26 ++-- docs/test_cases/t30004_package.svg | 30 ++-- docs/test_cases/t30005.md | 2 - docs/test_cases/t30005_package.svg | 38 +++--- docs/test_cases/t30006.md | 2 - docs/test_cases/t30006_package.svg | 16 +-- docs/test_cases/t30007.md | 2 - docs/test_cases/t30007_package.svg | 20 +-- docs/test_cases/t30008.md | 4 - docs/test_cases/t30008_package.svg | 34 ++--- docs/test_cases/t30009_package.svg | 42 +++--- docs/test_cases/t40001.md | 6 - docs/test_cases/t40001_include.svg | 30 ++-- docs/test_cases/t40002.md | 5 - docs/test_cases/t40002_include.svg | 34 ++--- docs/test_cases/t40003.md | 9 -- docs/test_cases/t40003_include.svg | 50 +++---- 138 files changed, 3006 insertions(+), 3312 deletions(-) diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index 515dd8b0..c1ce5fa2 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ foo_c() = 0 : void - - + + B @@ -31,8 +31,8 @@ foo_a() : void - - + + C @@ -41,18 +41,18 @@ foo_c() : void - - + + D - + - + as : std::vector<A *> @@ -60,18 +60,18 @@ foo_a() : void foo_c() : void - - + + E - + - + as : std::vector<A *> @@ -79,13 +79,13 @@ foo_a() : void foo_c() : void - + This is class A - + This is class B - + This is class D diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index af586036..54ab4f49 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - + + A - + - + public_member : int - + - + protected_member : int - + - + private_member : int - + - + a_ : int - + - + b_ : int - + - + c_ : int - + - + static_int : int - + - + static_const_int : const int - + - + auto_member : const unsigned long @@ -112,11 +112,11 @@ protected_method() : void private_method() : void - + - + compare : std::function<bool (const int)> diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 40b69332..1ec23a4d 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + B - - + + B::AA @@ -28,8 +28,8 @@ AA_3 - - + + A @@ -40,16 +40,16 @@ foo2() const : void - - + + A::AA - - + + A::AA::Lights @@ -59,15 +59,15 @@ Red - - + + A::AA::AAA - + C::B @@ -75,8 +75,8 @@ int - - + + C @@ -84,39 +84,39 @@ T - + - + t : T - + - + b_int : B<int> - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -125,8 +125,8 @@ CCC_2 - - + + C::B @@ -134,16 +134,16 @@ V - + - + b : V - - + + C::CC @@ -152,16 +152,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -171,8 +171,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index a682e90a..930ca103 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,204 +9,204 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & - + - + a : A - + - + b : B * - + - + c : C & - + - + d : const D * - + - + e : const E & - + - + f : F && - + - + g : G ** - + - + h : H *** - + - + i : I *& - + - + j : volatile J * - + - + k : K * diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 664ab90c..c11488ac 100644 --- a/docs/test_cases/t00006_class.svg +++ b/docs/test_cases/t00006_class.svg @@ -1,6 +1,6 @@ - + @@ -9,136 +9,136 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + L - - + + M - - + + N - - + + NN - - + + NNN - - + + custom_container @@ -146,15 +146,15 @@ T - + - + data : std::vector<T> - + custom_container @@ -162,102 +162,102 @@ E - - + + R - + - + a : std::vector<A> - + - + b : std::vector<B *> - + - + c : std::map<int,C> - + - + d : std::map<int,D *> - + - + e : custom_container<E> - + - + f : std::vector<std::vector<F>> - + - + g : std::map<int,std::vector<G *>> - + - + h : std::array<H,10> - + - + i : std::array<I *,5> - + - + j : J[10] - + - + k : K *[20] - + - + lm : std::vector<std::pair<L,M>> - + - + ns : std::tuple<N,NN,NNN> diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index bc7b3aca..16da5104 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index a185794a..d7f3d198 100644 --- a/docs/test_cases/t00008_class.svg +++ b/docs/test_cases/t00008_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,51 +18,51 @@ T,P=T,CMP=nullptr,int N=3 - + - + value : T - + - + pointer : T * - + - + reference : T & - + - + values : std::vector<P> - + - + ints : std::array<int,N> - + - + comparator : CMP - - + + Vector @@ -70,16 +70,16 @@ T - + - + values : std::vector<T> - - + + B @@ -87,15 +87,15 @@ T,C<> - + - + template_template : C<T> - + B @@ -103,18 +103,18 @@ int,Vector - - + + D - + - + ints : B<int,Vector> @@ -122,16 +122,16 @@ add(int i) : void D<Items...>(std::tuple<Items...> * ) : void - - + + E - - + + E::nested_template @@ -142,8 +142,8 @@ get(ET * d) : E::nested_template::DT * - - + + E::nested_template diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index 58f0d7a1..ef5d34ee 100644 --- a/docs/test_cases/t00009_class.svg +++ b/docs/test_cases/t00009_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,15 +18,15 @@ T - + - + value : T - + A @@ -34,7 +34,7 @@ int - + A @@ -42,7 +42,7 @@ std::string - + A @@ -50,32 +50,32 @@ std::vector<std::string> - - + + B - + - + aint : A<int> - + - + astring : A<std::string> * - + - + avector : A<std::vector<std::string>> & diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index 47e73499..b120d38f 100644 --- a/docs/test_cases/t00010_class.svg +++ b/docs/test_cases/t00010_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,22 +18,22 @@ T,P - + - + first : T - + - + second : P - + A @@ -41,8 +41,8 @@ T,std::string - - + + B @@ -50,15 +50,15 @@ T - + - + astring : A<T,std::string> - + B @@ -66,18 +66,18 @@ int - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index d059675c..29e2fdfe 100644 --- a/docs/test_cases/t00011_class.svg +++ b/docs/test_cases/t00011_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + D @@ -18,16 +18,16 @@ T - + - + value : T - - + + A @@ -36,18 +36,18 @@ foo() : void - - + + B - + - + m_a : A * diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index 64719ffb..90ff5807 100644 --- a/docs/test_cases/t00012_class.svg +++ b/docs/test_cases/t00012_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,23 +18,23 @@ T,Ts... - + - + value : T - + - + values : std::variant<Ts...> - - + + B @@ -43,15 +43,15 @@ - + - + ints : std::array<int,sizeof...(Is)> - - + + C @@ -60,14 +60,14 @@ - + - + ints : std::array<T,sizeof...(Is)> - + A @@ -75,7 +75,7 @@ int,std::string,float - + A @@ -83,7 +83,7 @@ int,std::string,bool - + B @@ -91,7 +91,7 @@ 3,2,1 - + B @@ -99,7 +99,7 @@ 1,1,1,1 - + C @@ -107,50 +107,50 @@ std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3 - - + + R - + - + a1 : A<int,std::string,float> - + - + a2 : A<int,std::string,bool> - + - + b1 : B<3,2,1> - + - + b2 : B<1,1,1,1> - + - + c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> - + Long template annotation diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index b9c163dd..9d11a4fa 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ABCD::F @@ -18,15 +18,15 @@ T - + - + f : T - + ABCD::F @@ -34,70 +34,70 @@ int - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + d : int print(R * r) : void - - + + E @@ -105,16 +105,16 @@ T - + - + e : T - - + + G @@ -122,22 +122,22 @@ T,Args... - + - + g : T - + - + args : std::tuple<Args...> - + E @@ -145,7 +145,7 @@ int - + G @@ -153,7 +153,7 @@ int,float,std::string - + E @@ -161,25 +161,25 @@ std::string - - + + R - + - + gintstring : G<int,float,std::string> - + - + estring : E<std::string> diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index 1d599019..39cad1d1 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,37 +18,37 @@ T,P - + - + t : T - + - + p : P - - + + B - + - + value : std::string - + A @@ -56,7 +56,7 @@ T,std::string - + A @@ -64,7 +64,7 @@ T,std::unique_ptr<std::string> - + A @@ -72,7 +72,7 @@ long,T - + A @@ -80,7 +80,7 @@ double,T - + A @@ -88,7 +88,7 @@ long,U - + A @@ -96,7 +96,7 @@ long,bool - + A @@ -104,7 +104,7 @@ double,bool - + A @@ -112,7 +112,7 @@ long,float - + A @@ -120,7 +120,7 @@ double,float - + A @@ -128,7 +128,7 @@ bool,std::string - + A @@ -136,7 +136,7 @@ float,std::unique_ptr<std::string> - + A @@ -144,7 +144,7 @@ int,std::string - + A @@ -152,7 +152,7 @@ std::string,std::string - + A @@ -160,7 +160,7 @@ char,std::string - + A @@ -168,116 +168,116 @@ wchar_t,std::string - - + + R - + - + bapair : PairPairBA<bool> - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + boolstring : A<bool,std::string> - + - + floatstring : AStringPtr<float> - + - + intstring : AIntString - + - + stringstring : AStringString - + - + bstringstring : BStringString - + - + bs : BVector - + - + bs2 : BVector2 - + - + cb : SimpleCallback<ACharString> - + - + gcb : GenericCallback<R::AWCharString> - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index b62eecb8..35afda28 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + ns1::A - - + + ns1::ns2_v0_9_0::A - - + + ns1::Anon - - + + ns3::ns1::ns2::Anon - - + + ns3::B diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg index 3b9f2aa4..f71bf18f 100644 --- a/docs/test_cases/t00016_class.svg +++ b/docs/test_cases/t00016_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + is_numeric<> @@ -19,8 +19,8 @@ value : enum - - + + is_numeric @@ -29,8 +29,8 @@ - - + + is_numeric @@ -39,8 +39,8 @@ - - + + is_numeric @@ -49,8 +49,8 @@ - - + + is_numeric @@ -59,8 +59,8 @@ - - + + is_numeric diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index 1e558c9c..d31d6b8d 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,127 +9,127 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 807dc8c1..19397c5d 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,18 +9,18 @@ - - + + impl::widget - + - + n : int @@ -30,18 +30,18 @@ draw(const widget & w) : void widget(int n) : void - - + + widget - + - + pImpl : std::unique_ptr<impl::widget> diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 9c24a0d2..762ffd09 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Base @@ -25,8 +25,8 @@ m2() : std::string - - + + Layer1 @@ -39,8 +39,8 @@ m2() : std::string - - + + Layer2 @@ -51,8 +51,8 @@ all_calls_count() const : int - - + + Layer3 @@ -60,18 +60,18 @@ LowerLayer - + - + m_m1_calls : int - + - + m_m2_calls : int @@ -83,7 +83,7 @@ m1_calls() const : int m2_calls() const : int - + Layer3 @@ -91,7 +91,7 @@ Base - + Layer2 @@ -99,7 +99,7 @@ Layer3<Base> - + Layer1 @@ -107,18 +107,18 @@ Layer2<Layer3<Base>> - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 2b37a08a..b73a8ee6 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ProductA @@ -21,8 +21,8 @@ sell(int price) const = 0 : bool - - + + ProductA1 @@ -31,8 +31,8 @@ sell(int price) const : bool - - + + ProductA2 @@ -41,8 +41,8 @@ sell(int price) const : bool - - + + ProductB @@ -53,8 +53,8 @@ buy(int price) const = 0 : bool - - + + ProductB1 @@ -63,8 +63,8 @@ buy(int price) const : bool - - + + ProductB2 @@ -73,8 +73,8 @@ buy(int price) const : bool - - + + AbstractFactory @@ -85,8 +85,8 @@ make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 @@ -97,8 +97,8 @@ make_b() const : std::unique_ptr<ProductB> - - + + Factory2 diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index a51a7eb4..ec5c6d64 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Visitor @@ -23,8 +23,8 @@ visit_B(const B & item) const = 0 : void - - + + Visitor1 @@ -35,8 +35,8 @@ visit_B(const B & item) const : void - - + + Visitor2 @@ -47,8 +47,8 @@ visit_B(const B & item) const : void - - + + Visitor3 @@ -59,8 +59,8 @@ visit_B(const B & item) const : void - - + + Item @@ -71,8 +71,8 @@ accept(const Visitor & visitor) const = 0 : void - - + + A @@ -81,8 +81,8 @@ accept(const Visitor & visitor) const : void - - + + B diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index d3fd3698..9d0a25b2 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -23,8 +23,8 @@ method2() = 0 : void - - + + A1 @@ -35,8 +35,8 @@ method2() : void - - + + A2 diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 292bed26..0274f234 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Strategy @@ -21,8 +21,8 @@ algorithm() = 0 : void - - + + StrategyA @@ -31,8 +31,8 @@ algorithm() : void - - + + StrategyB @@ -41,8 +41,8 @@ algorithm() : void - - + + StrategyC @@ -51,18 +51,18 @@ algorithm() : void - - + + Context - + - + m_strategy : std::unique_ptr<Strategy> diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 147ee095..2de4613c 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target @@ -23,8 +23,8 @@ m2() = 0 : void - - + + Target1 @@ -35,8 +35,8 @@ m2() : void - - + + Target2 @@ -47,18 +47,18 @@ m2() : void - - + + Proxy - + - + m_target : std::shared_ptr<Target> diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index e06c209d..63f1b528 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Target1 @@ -21,8 +21,8 @@ m2() : void - - + + Target2 @@ -33,8 +33,8 @@ m2() : void - - + + Proxy @@ -42,11 +42,11 @@ T - + - + m_target : std::shared_ptr<T> @@ -56,7 +56,7 @@ m1() : void m2() : void - + Proxy @@ -64,7 +64,7 @@ Target1 - + Proxy @@ -72,25 +72,25 @@ Target2 - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 82741827..ef4f9aa2 100644 --- a/docs/test_cases/t00026_class.svg +++ b/docs/test_cases/t00026_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Memento @@ -18,11 +18,11 @@ T - + - + m_value : T @@ -30,8 +30,8 @@ Memento<T>(T && v) : void value() const : T - - + + Originator @@ -39,11 +39,11 @@ T - + - + m_value : T @@ -57,8 +57,8 @@ print() const : void set(T && v) : void - - + + Caretaker @@ -66,11 +66,11 @@ T - + - + m_mementos : std::unordered_map<std::string,Memento<T>> @@ -78,7 +78,7 @@ state(const std::string & n) : Memento<T> & set_state(const std::string & s, Memento<T> && m) : void - + Caretaker @@ -86,7 +86,7 @@ std::string - + Originator @@ -94,25 +94,25 @@ std::string - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index 4d963ed1..c77ded72 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Shape @@ -21,14 +21,14 @@ ~Shape() = default : void - + Line - - + + Line @@ -39,14 +39,14 @@ display() : void - + Text - - + + Text @@ -57,8 +57,8 @@ display() : void - - + + ShapeDecorator @@ -67,8 +67,8 @@ display() = 0 : void - - + + Color @@ -79,8 +79,8 @@ display() : void - - + + Weight @@ -91,7 +91,7 @@ display() : void - + Line @@ -99,7 +99,7 @@ Color,Weight - + Line @@ -107,7 +107,7 @@ Color - + Text @@ -115,7 +115,7 @@ Color,Weight - + Text @@ -123,39 +123,39 @@ Color - - + + Window - + - + border : Line<Color,Weight> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> - + - + description : Text<Color> diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index b2a939e7..80a4e896 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + A - + A class note. - - + + B - + B class note. - - + + C - + C class note. - - + + D - + D class note. - - + + E @@ -64,27 +64,27 @@ T - + - + param : T - + E template class note. - - + + G - - + + F @@ -94,10 +94,10 @@ three - + F enum note. - + E @@ -105,65 +105,65 @@ int - - + + R - + - + aaa : A - + - + bbb : B * - + - + ccc : C & - + - + ddd : std::vector<std::shared_ptr<D>> - + - + eee : E<int> - + - + ggg : G ** R(C & c) : void - + R class note. - + R contains an instance of A. - + Reference to C. diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 52a0ca38..69cc08d4 100644 --- a/docs/test_cases/t00029_class.svg +++ b/docs/test_cases/t00029_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + A - - + + C @@ -26,16 +26,16 @@ T - + - + param : T - - + + E @@ -45,64 +45,64 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3 & - + - + g4 : std::shared_ptr<G4> diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index d3656053..ab716fe6 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,86 +9,86 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + - + eee : E * diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index facc4534..f8a281d0 100644 --- a/docs/test_cases/t00031_class.svg +++ b/docs/test_cases/t00031_class.svg @@ -1,33 +1,33 @@ - + - + - + - - - + + + A - - + + B @@ -37,8 +37,8 @@ three - - + + @@ -47,23 +47,23 @@ T - + - + ttt : T - - + + D - + C @@ -71,39 +71,39 @@ int - - + + R - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index e77c395a..570709e8 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,24 +9,24 @@ - - + + Base - - + + TBase - - + + A @@ -35,8 +35,8 @@ operator()() : void - - + + B @@ -45,8 +45,8 @@ operator()() : void - - + + C @@ -55,8 +55,8 @@ operator()() : void - - + + Overload @@ -64,15 +64,15 @@ T,L,Ts... - + - + counter : L - + Overload @@ -80,18 +80,18 @@ TBase,int,A,B,C - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index 09e71d53..3fe8f913 100644 --- a/docs/test_cases/t00033_class.svg +++ b/docs/test_cases/t00033_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + aaa : T - - + + B @@ -35,16 +35,16 @@ T - + - + bbb : T - - + + C @@ -52,30 +52,30 @@ T - + - + ccc : T - - + + D - + - + ddd : int - + C @@ -83,7 +83,7 @@ D - + B @@ -91,7 +91,7 @@ std::unique_ptr<C<D>> - + A @@ -99,18 +99,18 @@ B<std::unique_ptr<C<D>>> - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index f02f85e3..4e86dec7 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Void @@ -21,8 +21,8 @@ operator!=(const Void & ) const : bool - - + + lift_void @@ -31,8 +31,8 @@ - - + + lift_void @@ -41,8 +41,8 @@ - - + + drop_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,33 +61,33 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index 46fdda44..a15218b2 100644 --- a/docs/test_cases/t00035_class.svg +++ b/docs/test_cases/t00035_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + Top - - + + Left - - + + Center - - + + Bottom - - + + Right diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg index 4f66b033..43bf0a9b 100644 --- a/docs/test_cases/t00036_class.svg +++ b/docs/test_cases/t00036_class.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - + ns1 - + ns11 - + ns111 - + ns2 - + ns22 - - + + E @@ -34,8 +34,8 @@ yellow - - + + A @@ -43,15 +43,15 @@ T - + - + a : T - + A @@ -59,23 +59,23 @@ int - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 0ae3edcf..6caa4188 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,98 +9,98 @@ - - + + ST - + - + dimensions : ST::(anonymous_662) - + - + units : ST::(anonymous_792) - - + + ST::(dimensions) - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + ST::(units) - + - + c : double - + - + h : double - - + + A - + - + st : ST diff --git a/docs/test_cases/t00038_class.svg b/docs/test_cases/t00038_class.svg index e30d120a..42525fa0 100644 --- a/docs/test_cases/t00038_class.svg +++ b/docs/test_cases/t00038_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + thirdparty::ns1::color_t @@ -20,16 +20,16 @@ blue - - + + thirdparty::ns1::E - - + + property_t @@ -39,47 +39,47 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - + - + key : std::string - - + + map @@ -88,8 +88,8 @@ - - + + map @@ -98,8 +98,8 @@ - - + + map @@ -108,8 +108,8 @@ - - + + map @@ -118,8 +118,8 @@ - - + + map diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 5fd6e339..bd3e0f25 100644 --- a/docs/test_cases/t00039_class.svg +++ b/docs/test_cases/t00039_class.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - + + C - - + + D - - + + E - - + + CD - - + + DE - - + + CDE - - + + A - - + + AA - - + + AAA - + - + b : B * - - + + ns2::AAAA - - + + ns3::F @@ -105,16 +105,16 @@ T - + - + t : T * - - + + ns3::FF @@ -122,16 +122,16 @@ T,M - + - + m : M * - - + + ns3::FE @@ -139,16 +139,16 @@ T,M - + - + m : M * - - + + ns3::FFF @@ -156,11 +156,11 @@ T,M,N - + - + n : N * diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index 03a18891..a4632c91 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - + + A - + - + ii_ : int get_a() : int - - + + AA - - + + AAA - + - + b : B * get_aaa() : int - - + + R diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index bc96a619..b8b0cfe0 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,102 +9,102 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + e : E * - + - + f : F * - + - + g : detail::G * foo(H * h) : void - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index 5ad739eb..7970054d 100644 --- a/docs/test_cases/t00042_class.svg +++ b/docs/test_cases/t00042_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,16 +18,16 @@ T - + - + a : T - - + + A @@ -36,8 +36,8 @@ - - + + B @@ -45,22 +45,22 @@ T,K - + - + b : T - + - + bb : K - + A @@ -68,7 +68,7 @@ double - + A @@ -76,7 +76,7 @@ std::string - + B diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index 2aeb44aa..2621fad3 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - + dependants - + dependencies - - + + A - - + + B @@ -33,8 +33,8 @@ b(dependants::A * a) : void - - + + BB @@ -43,8 +43,8 @@ bb(dependants::A * a) : void - - + + C @@ -53,8 +53,8 @@ c(dependants::B * b) : void - - + + D @@ -65,8 +65,8 @@ dd(dependants::BB * bb) : void - - + + E @@ -75,24 +75,24 @@ e(dependants::D * d) : void - - + + G - - + + GG - - + + H @@ -103,8 +103,8 @@ hh(dependencies::GG * gg) : void - - + + I @@ -113,8 +113,8 @@ i(dependencies::H * h) : void - - + + J diff --git a/docs/test_cases/t00044_class.svg b/docs/test_cases/t00044_class.svg index 383fe537..80eb4fb4 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + sink @@ -19,8 +19,8 @@ - - + + signal_handler @@ -29,8 +29,8 @@ - - + + signal_handler @@ -39,8 +39,8 @@ - - + + sink diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index d1c17cb5..bc24938f 100644 --- a/docs/test_cases/t00045_class.svg +++ b/docs/test_cases/t00045_class.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + A - - + + AA - - + + AAA - - + + AAAA @@ -42,103 +42,103 @@ T - + - + t : T - - + + ns1::A - - + + ns1::ns2::A - - + + ns1::ns2::B - - + + ns1::ns2::C - - + + ns1::ns2::D - - + + ns1::ns2::E - - + + ns1::ns2::AAA - - + + ns1::ns2::R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * diff --git a/docs/test_cases/t00046_class.svg b/docs/test_cases/t00046_class.svg index 2ec4900a..c62e403e 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - + ns1 - + ns2 - + __gnu_cxx - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + a : ns1::ns2::A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - + - + i : std::vector<std::uint8_t> foo(AA & aa) : void - - + + A - - + + AA diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index 354cefea..5918c2ab 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + conditional_t @@ -19,8 +19,8 @@ - - + + conditional_t @@ -29,8 +29,8 @@ - - + + conditional_t @@ -39,8 +39,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index e8b4fca0..81101d50 100644 --- a/docs/test_cases/t00048_class.svg +++ b/docs/test_cases/t00048_class.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + Base - + - + base : int foo() = 0 : void - - + + BaseTemplate @@ -35,35 +35,35 @@ T - + - + base : T foo() = 0 : void - - + + B - + - + b : int foo() : void - - + + BTemplate @@ -71,35 +71,35 @@ T - + - + b : T foo() : void - - + + A - + - + a : int foo() : void - - + + ATemplate @@ -107,11 +107,11 @@ T - + - + a : T diff --git a/docs/test_cases/t00049_class.svg b/docs/test_cases/t00049_class.svg index 1f800654..98458667 100644 --- a/docs/test_cases/t00049_class.svg +++ b/docs/test_cases/t00049_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,17 +18,17 @@ T - + - + a : T get_a() : T & - + A @@ -36,7 +36,7 @@ intmap - + A @@ -44,7 +44,7 @@ thestring - + A @@ -52,32 +52,32 @@ string_vector - - + + R - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> - + - + a_int_map : A<intmap> diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 1941b0b9..f730926f 100644 --- a/docs/test_cases/t00050_class.svg +++ b/docs/test_cases/t00050_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + utils::D - - + + E @@ -52,8 +52,8 @@ E3 - - + + F @@ -61,44 +61,44 @@ T,V,int N - + - + t : T[N] - + - + v : V - - + + G - - + + NoComment - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies mollis dictumst, aenean non a in donec nulla. @@ -125,50 +125,50 @@ imperdiet praesent magnis ridiculus congue gravida curabitur dictum sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, aenean vel nostra tellus commodo pretium sapien sociosqu. - + This is a short description of class G. - + This is an intermediate description of class G. - + This is a long description of class G. - + Lorem ipsum - + TODO 1. Write meaningful comment - + TODO 2. Write tests - + TODO 3. Implement - + Long comment example - + TODO Implement... - + Simple array wrapper. - + Template parameters diff --git a/docs/test_cases/t00051_class.svg b/docs/test_cases/t00051_class.svg index ce6fa271..e1191377 100644 --- a/docs/test_cases/t00051_class.svg +++ b/docs/test_cases/t00051_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + B @@ -18,18 +18,18 @@ F,FF=F - + - + f_ : F - + - + ff_ : FF @@ -39,16 +39,16 @@ f() : void ff() : void - - + + B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> - - + + A @@ -63,8 +63,8 @@ get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) - - + + A::custom_thread1 @@ -73,8 +73,8 @@ custom_thread1<Function,Args...>(Function && f, Args &&... args) : void - - + + A::custom_thread2 diff --git a/docs/test_cases/t00052_class.svg b/docs/test_cases/t00052_class.svg index edb6b1d6..8820dbe2 100644 --- a/docs/test_cases/t00052_class.svg +++ b/docs/test_cases/t00052_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ aa<F,Q>(F && f, Q q) : void - - + + B @@ -35,8 +35,8 @@ bb<F>(F && f, T t) : T - - + + C @@ -47,7 +47,7 @@ c<P>(P p) : T - + B @@ -55,7 +55,7 @@ int - + C @@ -63,32 +63,32 @@ int - - + + R - + - + a : A - + - + b : B<int> - + - + c : C<int> diff --git a/docs/test_cases/t00053_class.svg b/docs/test_cases/t00053_class.svg index 69100fba..b2893c7c 100644 --- a/docs/test_cases/t00053_class.svg +++ b/docs/test_cases/t00053_class.svg @@ -1,6 +1,6 @@ - + @@ -9,72 +9,72 @@ - - + + A - - + + C - - + + E - - + + F - - + + a - - + + c - - + + e - - + + f - - + + h @@ -82,8 +82,8 @@ hhh - - + + j @@ -91,56 +91,56 @@ jjj - - + + b - - + + d - - + + g - - + + B - - + + D - - + + G - - + + i diff --git a/docs/test_cases/t00054_class.svg b/docs/test_cases/t00054_class.svg index 79817306..78d53ee6 100644 --- a/docs/test_cases/t00054_class.svg +++ b/docs/test_cases/t00054_class.svg @@ -1,6 +1,6 @@ - + @@ -9,116 +9,116 @@ - + detail - + detail2 - + detail3 - + detail4 - - + + d - - + + a - - + + c - - + + e - - + + C - - + + F - - + + D - - + + E - - + + A - - + + B - - + + f - - + + G - - + + h @@ -127,8 +127,8 @@ hhh - - + + i @@ -137,8 +137,8 @@ iii - - + + j @@ -147,16 +147,16 @@ jjj - - + + b - - + + g diff --git a/docs/test_cases/t00055_class.svg b/docs/test_cases/t00055_class.svg index b2164e3b..2aaba423 100644 --- a/docs/test_cases/t00055_class.svg +++ b/docs/test_cases/t00055_class.svg @@ -1,6 +1,6 @@ - + @@ -9,80 +9,80 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J diff --git a/docs/test_cases/t00056_class.svg b/docs/test_cases/t00056_class.svg index fccb4a32..4802bcea 100644 --- a/docs/test_cases/t00056_class.svg +++ b/docs/test_cases/t00056_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -20,8 +20,8 @@ - - + + «concept» @@ -33,8 +33,8 @@ sizeof (l) > sizeof (r) - - + + «concept» @@ -44,8 +44,8 @@ - - + + «concept» @@ -58,8 +58,8 @@ container.begin() container.end() - - + + «concept» @@ -71,8 +71,8 @@ typename T::value_type - - + + «concept» @@ -86,8 +86,8 @@ {std::to_string(s)} noexcept {std::to_string(s)} -> std::same_as<std::string> - - + + «concept» @@ -97,8 +97,8 @@ - - + + «concept» @@ -108,8 +108,8 @@ - - + + A @@ -117,16 +117,16 @@ max_four_bytes T - + - + a : T - - + + B @@ -134,16 +134,16 @@ T - + - + b : T - - + + C @@ -151,16 +151,16 @@ convertible_to_string T - + - + c : T - - + + D @@ -169,8 +169,8 @@ - - + + E @@ -178,30 +178,30 @@ T1,T2,T3 - + - + e1 : T1 - + - + e2 : T2 - + - + e3 : T3 - - + + F @@ -209,25 +209,25 @@ T1,T2,T3 - + - + f1 : T1 - + - + f2 : T2 - + - + f3 : T3 diff --git a/docs/test_cases/t00057_class.svg b/docs/test_cases/t00057_class.svg index 0fbc57ea..aa46c150 100644 --- a/docs/test_cases/t00057_class.svg +++ b/docs/test_cases/t00057_class.svg @@ -1,6 +1,6 @@ - + @@ -9,210 +9,210 @@ - - + + t00057_A - + - + a1 : int - - + + t00057_B - + - + b1 : int - - + + t00057_C - + - + c1 : int - - + + «union» t00057_D - + - + d1 : int - + - + d2 : float - - + + t00057_E - + - + e : int - + - + coordinates : t00057_E::(anonymous_739) - + - + height : t00057_E::(anonymous_807) - - + + t00057_E::(coordinates) - + - + x : int - + - + y : int - - + + «union» t00057_E::(height) - + - + z : int - + - + t : double - - + + t00057_R - + - + a : struct t00057_A - + - + b : t00057_B - + - + c : struct t00057_C * - + - + d : union t00057_D - + - + e : struct t00057_E * - + - + f : struct t00057_F * - - + + t00057_F - + - + f1 : int diff --git a/docs/test_cases/t00058_class.svg b/docs/test_cases/t00058_class.svg index b079a2dc..6025a9f6 100644 --- a/docs/test_cases/t00058_class.svg +++ b/docs/test_cases/t00058_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + first_type @@ -19,8 +19,8 @@ - - + + «concept» @@ -30,8 +30,8 @@ - - + + A @@ -39,16 +39,16 @@ T,Args... - + - + a : std::vector<T> - - + + B @@ -56,22 +56,22 @@ T,P,Args... - + - + b : std::vector<T> - + - + bb : P - + A @@ -79,7 +79,7 @@ int,int,double,std::string - + A @@ -87,7 +87,7 @@ int,int - + B @@ -95,25 +95,25 @@ int,std::string,int,double,A<int,int> - - + + R - + - + aa : A<int,int,double,std::string> - + - + bb : B<int,std::string,int,double,A<int,int>> diff --git a/docs/test_cases/t00059_class.svg b/docs/test_cases/t00059_class.svg index 8059e4aa..380eb6a3 100644 --- a/docs/test_cases/t00059_class.svg +++ b/docs/test_cases/t00059_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -23,8 +23,8 @@ T{} t.get_name() - - + + «concept» @@ -36,8 +36,8 @@ t.get_sweetness() - - + + «concept» @@ -49,8 +49,8 @@ t.get_bitterness() - - + + gala_apple @@ -61,8 +61,8 @@ get_sweetness() const : float - - + + empire_apple @@ -73,8 +73,8 @@ get_sweetness() const : float - - + + lima_orange @@ -85,8 +85,8 @@ get_bitterness() const : float - - + + valencia_orange @@ -97,8 +97,8 @@ get_bitterness() const : float - - + + fruit_factory @@ -111,7 +111,7 @@ create_orange() const : TO - + fruit_factory @@ -119,7 +119,7 @@ gala_apple,valencia_orange - + fruit_factory @@ -127,25 +127,25 @@ empire_apple,lima_orange - - + + R - + - + factory_1 : fruit_factory_1 - + - + factory_2 : fruit_factory_2 diff --git a/docs/test_cases/t00060_class.svg b/docs/test_cases/t00060_class.svg index 187676ce..4d7762ce 100644 --- a/docs/test_cases/t00060_class.svg +++ b/docs/test_cases/t00060_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + D - - + + G @@ -50,16 +50,16 @@ T - + - + g : T - - + + H @@ -67,18 +67,18 @@ T,P - + - + h : G<T> - + - + hh : P diff --git a/docs/test_cases/t20001.md b/docs/test_cases/t20001.md index 6ff7f716..76b6fa02 100644 --- a/docs/test_cases/t20001.md +++ b/docs/test_cases/t20001.md @@ -157,8 +157,7 @@ int tmain() "to": { "activity_id": "1131549932713395402", "activity_name": "clanguml::t20001::A::add(int,int)", - "participant_id": "1771943546649183134", - "participant_name": "clanguml::t20001::A" + "participant_id": "1771943546649183134" }, "type": "message" }, @@ -179,8 +178,7 @@ int tmain() "to": { "activity_id": "642550151323208936", "activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)", - "participant_id": "272433898507800600", - "participant_name": "clanguml::t20001::B" + "participant_id": "272433898507800600" }, "type": "message" }, @@ -188,8 +186,7 @@ int tmain() "from": { "activity_id": "642550151323208936", "activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)", - "participant_id": "272433898507800600", - "participant_name": "clanguml::t20001::B" + "participant_id": "272433898507800600" }, "name": "add3(int,int,int)", "return_type": "int", @@ -201,8 +198,7 @@ int tmain() "to": { "activity_id": "2090436635449419593", "activity_name": "clanguml::t20001::A::add3(int,int,int)", - "participant_id": "1771943546649183134", - "participant_name": "clanguml::t20001::A" + "participant_id": "1771943546649183134" }, "type": "message" }, @@ -210,8 +206,7 @@ int tmain() "from": { "activity_id": "2090436635449419593", "activity_name": "clanguml::t20001::A::add3(int,int,int)", - "participant_id": "1771943546649183134", - "participant_name": "clanguml::t20001::A" + "participant_id": "1771943546649183134" }, "name": "add(int,int)", "return_type": "int", @@ -223,8 +218,7 @@ int tmain() "to": { "activity_id": "1131549932713395402", "activity_name": "clanguml::t20001::A::add(int,int)", - "participant_id": "1771943546649183134", - "participant_name": "clanguml::t20001::A" + "participant_id": "1771943546649183134" }, "type": "message" }, @@ -232,8 +226,7 @@ int tmain() "from": { "activity_id": "2090436635449419593", "activity_name": "clanguml::t20001::A::add3(int,int,int)", - "participant_id": "1771943546649183134", - "participant_name": "clanguml::t20001::A" + "participant_id": "1771943546649183134" }, "name": "log_result(int)", "return_type": "", @@ -245,8 +238,7 @@ int tmain() "to": { "activity_id": "1205947631808952097", "activity_name": "clanguml::t20001::A::log_result(int)", - "participant_id": "1771943546649183134", - "participant_name": "clanguml::t20001::A" + "participant_id": "1771943546649183134" }, "type": "message" }, @@ -254,8 +246,7 @@ int tmain() "from": { "activity_id": "642550151323208936", "activity_name": "clanguml::t20001::B::wrap_add3(int,int,int)", - "participant_id": "272433898507800600", - "participant_name": "clanguml::t20001::B" + "participant_id": "272433898507800600" }, "name": "log_result(int)", "return_type": "", @@ -267,8 +258,7 @@ int tmain() "to": { "activity_id": "1205947631808952097", "activity_name": "clanguml::t20001::A::log_result(int)", - "participant_id": "1771943546649183134", - "participant_name": "clanguml::t20001::A" + "participant_id": "1771943546649183134" }, "type": "message" } diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index 9ec5af81..ca23ae1c 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,59 +9,59 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - + + + + + + + + add(int,int) - + wrap_add3(int,int,int) - + add3(int,int,int) - + @@ -72,7 +72,7 @@ - + @@ -81,14 +81,14 @@ - + log_result(int) - + Main test function diff --git a/docs/test_cases/t20002.md b/docs/test_cases/t20002.md index dd0e9567..4ac0a0f3 100644 --- a/docs/test_cases/t20002.md +++ b/docs/test_cases/t20002.md @@ -103,8 +103,7 @@ void m1() { m2(); } "to": { "activity_id": "1575240232156112674", "activity_name": "clanguml::t20002::m2()", - "participant_id": "1575240232156112674", - "participant_name": "clanguml::t20002::m2()" + "participant_id": "1575240232156112674" }, "type": "message" }, @@ -125,8 +124,7 @@ void m1() { m2(); } "to": { "activity_id": "1838809176089209580", "activity_name": "clanguml::t20002::m3()", - "participant_id": "1838809176089209580", - "participant_name": "clanguml::t20002::m3()" + "participant_id": "1838809176089209580" }, "type": "message" }, @@ -147,8 +145,7 @@ void m1() { m2(); } "to": { "activity_id": "63715062711218534", "activity_name": "clanguml::t20002::m4()", - "participant_id": "63715062711218534", - "participant_name": "clanguml::t20002::m4()" + "participant_id": "63715062711218534" }, "type": "message" } diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index f77ca2a9..ce35d2bb 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1() - + m1() - - + + m2() - + m2() - - + + m3() - + m3() - - + + m4() - + m4() - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20003.md b/docs/test_cases/t20003.md index d4b5241e..a6f7f584 100644 --- a/docs/test_cases/t20003.md +++ b/docs/test_cases/t20003.md @@ -99,8 +99,7 @@ template void m1(T p) { m2(p); } "to": { "activity_id": "1502957449367040488", "activity_name": "clanguml::t20003::m2(T)", - "participant_id": "1502957449367040488", - "participant_name": "clanguml::t20003::m2(T)" + "participant_id": "1502957449367040488" }, "type": "message" }, @@ -121,8 +120,7 @@ template void m1(T p) { m2(p); } "to": { "activity_id": "613477682313507585", "activity_name": "clanguml::t20003::m3(T)", - "participant_id": "613477682313507585", - "participant_name": "clanguml::t20003::m3(T)" + "participant_id": "613477682313507585" }, "type": "message" }, @@ -143,8 +141,7 @@ template void m1(T p) { m2(p); } "to": { "activity_id": "619960023608507925", "activity_name": "clanguml::t20003::m4(T)", - "participant_id": "619960023608507925", - "participant_name": "clanguml::t20003::m4(T)" + "participant_id": "619960023608507925" }, "type": "message" } diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index a000e488..a17b9231 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1<T>(T) - + m1<T>(T) - - + + m2<T>(T) - + m2<T>(T) - - + + m3<T>(T) - + m3<T>(T) - - + + m4<T>(T) - + m4<T>(T) - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20004.md b/docs/test_cases/t20004.md index 7e61a578..bad41aa7 100644 --- a/docs/test_cases/t20004.md +++ b/docs/test_cases/t20004.md @@ -189,8 +189,7 @@ int main() "to": { "activity_id": "138925040763435897", "activity_name": "clanguml::t20004::m1(float)", - "participant_id": "138925040763435897", - "participant_name": "clanguml::t20004::m1(float)" + "participant_id": "138925040763435897" }, "type": "message" }, @@ -211,8 +210,7 @@ int main() "to": { "activity_id": "1239083518717603720", "activity_name": "clanguml::t20004::m1(unsigned long)", - "participant_id": "1239083518717603720", - "participant_name": "clanguml::t20004::m1(unsigned long)" + "participant_id": "1239083518717603720" }, "type": "message" }, @@ -233,8 +231,7 @@ int main() "to": { "activity_id": "376599675205498367", "activity_name": "clanguml::t20004::m4(unsigned long)", - "participant_id": "376599675205498367", - "participant_name": "clanguml::t20004::m4(unsigned long)" + "participant_id": "376599675205498367" }, "type": "message" }, @@ -255,8 +252,7 @@ int main() "to": { "activity_id": "1845817984839618223", "activity_name": "clanguml::t20004::m1(std::string)", - "participant_id": "1845817984839618223", - "participant_name": "clanguml::t20004::m1(std::string)" + "participant_id": "1845817984839618223" }, "type": "message" }, @@ -277,8 +273,7 @@ int main() "to": { "activity_id": "1735054254122948614", "activity_name": "clanguml::t20004::m2(std::string)", - "participant_id": "1735054254122948614", - "participant_name": "clanguml::t20004::m2(std::string)" + "participant_id": "1735054254122948614" }, "type": "message" }, @@ -299,8 +294,7 @@ int main() "to": { "activity_id": "121663532044911922", "activity_name": "clanguml::t20004::m1(int)", - "participant_id": "121663532044911922", - "participant_name": "clanguml::t20004::m1(int)" + "participant_id": "121663532044911922" }, "type": "message" }, @@ -321,8 +315,7 @@ int main() "to": { "activity_id": "1475362124497386656", "activity_name": "clanguml::t20004::m2(int)", - "participant_id": "1475362124497386656", - "participant_name": "clanguml::t20004::m2(int)" + "participant_id": "1475362124497386656" }, "type": "message" }, @@ -343,8 +336,7 @@ int main() "to": { "activity_id": "734999226157549914", "activity_name": "clanguml::t20004::m3(int)", - "participant_id": "734999226157549914", - "participant_name": "clanguml::t20004::m3(int)" + "participant_id": "734999226157549914" }, "type": "message" }, @@ -365,8 +357,7 @@ int main() "to": { "activity_id": "1006390865908497562", "activity_name": "clanguml::t20004::m4(int)", - "participant_id": "1006390865908497562", - "participant_name": "clanguml::t20004::m4(int)" + "participant_id": "1006390865908497562" }, "type": "message" } diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index 9449b5f1..d06f62c5 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,87 +29,87 @@ - - + + main() - + main() - - + + m1<float>(float) - + m1<float>(float) - - + + m1<unsigned long>(unsigned long) - + m1<unsigned long>(unsigned long) - - + + m4<unsigned long>(unsigned long) - + m4<unsigned long>(unsigned long) - - + + m1<std::string>(std::string) - + m1<std::string>(std::string) - - + + m2<std::string>(std::string) - + m2<std::string>(std::string) - - + + m1<int>(int) - + m1<int>(int) - - + + m2<int>(int) - + m2<int>(int) - - + + m3<int>(int) - + m3<int>(int) - - + + m4<int>(int) - + m4<int>(int) - - - - - - - - - - - + + + + + + + + + + + - + - + @@ -117,11 +117,11 @@ - + - + @@ -129,19 +129,19 @@ - + - + - + - + diff --git a/docs/test_cases/t20005.md b/docs/test_cases/t20005.md index dea3b4ad..c7f6f189 100644 --- a/docs/test_cases/t20005.md +++ b/docs/test_cases/t20005.md @@ -84,8 +84,7 @@ template struct C { "from": { "activity_id": "578718872965404973", "activity_name": "clanguml::t20005::C::c(T)", - "participant_id": "365569130532127604", - "participant_name": "clanguml::t20005::C" + "participant_id": "365569130532127604" }, "name": "b(T)", "return_type": "", @@ -97,8 +96,7 @@ template struct C { "to": { "activity_id": "870466496899932117", "activity_name": "clanguml::t20005::B::b(T)", - "participant_id": "666000829532846850", - "participant_name": "clanguml::t20005::B" + "participant_id": "666000829532846850" }, "type": "message" }, @@ -106,8 +104,7 @@ template struct C { "from": { "activity_id": "870466496899932117", "activity_name": "clanguml::t20005::B::b(T)", - "participant_id": "666000829532846850", - "participant_name": "clanguml::t20005::B" + "participant_id": "666000829532846850" }, "name": "a(T)", "return_type": "", @@ -119,8 +116,7 @@ template struct C { "to": { "activity_id": "124853455814403745", "activity_name": "clanguml::t20005::A::a(T)", - "participant_id": "1278330455625941185", - "participant_name": "clanguml::t20005::A" + "participant_id": "1278330455625941185" }, "type": "message" } diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index 9bc92713..dfd4f3c7 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - + + + - - + + C<T> - + C<T> - - + + B<T> - + B<T> - - + + A<T> - + A<T> - - - + + + c(T) - + b(T) - + a(T) diff --git a/docs/test_cases/t20006.md b/docs/test_cases/t20006.md index 46365896..b9cf4fe0 100644 --- a/docs/test_cases/t20006.md +++ b/docs/test_cases/t20006.md @@ -209,8 +209,7 @@ void tmain() "to": { "activity_id": "250247217888843587", "activity_name": "clanguml::t20006::B::b(int)", - "participant_id": "2197760498261923035", - "participant_name": "clanguml::t20006::B" + "participant_id": "2197760498261923035" }, "type": "message" }, @@ -218,8 +217,7 @@ void tmain() "from": { "activity_id": "250247217888843587", "activity_name": "clanguml::t20006::B::b(int)", - "participant_id": "2197760498261923035", - "participant_name": "clanguml::t20006::B" + "participant_id": "2197760498261923035" }, "name": "a1(int)", "return_type": "int", @@ -231,8 +229,7 @@ void tmain() "to": { "activity_id": "196390487987395669", "activity_name": "clanguml::t20006::A::a1(int)", - "participant_id": "596484796124829039", - "participant_name": "clanguml::t20006::A" + "participant_id": "596484796124829039" }, "type": "message" }, @@ -253,8 +250,7 @@ void tmain() "to": { "activity_id": "13049632552871157", "activity_name": "clanguml::t20006::B::b(std::string)", - "participant_id": "2102622661983365981", - "participant_name": "clanguml::t20006::B" + "participant_id": "2102622661983365981" }, "type": "message" }, @@ -262,8 +258,7 @@ void tmain() "from": { "activity_id": "13049632552871157", "activity_name": "clanguml::t20006::B::b(std::string)", - "participant_id": "2102622661983365981", - "participant_name": "clanguml::t20006::B" + "participant_id": "2102622661983365981" }, "name": "a2(std::string)", "return_type": "class std::basic_string", @@ -275,8 +270,7 @@ void tmain() "to": { "activity_id": "11762588624112907", "activity_name": "clanguml::t20006::A::a2(std::string)", - "participant_id": "413459875415381273", - "participant_name": "clanguml::t20006::A" + "participant_id": "413459875415381273" }, "type": "message" }, @@ -297,8 +291,7 @@ void tmain() "to": { "activity_id": "1213865121829347654", "activity_name": "clanguml::t20006::BB::bb1(int,int)", - "participant_id": "264392653889863384", - "participant_name": "clanguml::t20006::BB" + "participant_id": "264392653889863384" }, "type": "message" }, @@ -306,8 +299,7 @@ void tmain() "from": { "activity_id": "1213865121829347654", "activity_name": "clanguml::t20006::BB::bb1(int,int)", - "participant_id": "264392653889863384", - "participant_name": "clanguml::t20006::BB" + "participant_id": "264392653889863384" }, "name": "aa1(int)", "return_type": "void", @@ -319,8 +311,7 @@ void tmain() "to": { "activity_id": "1235428163990670191", "activity_name": "clanguml::t20006::AA::aa1(int)", - "participant_id": "1903567228894636312", - "participant_name": "clanguml::t20006::AA" + "participant_id": "1903567228894636312" }, "type": "message" }, @@ -341,8 +332,7 @@ void tmain() "to": { "activity_id": "361650123916792854", "activity_name": "clanguml::t20006::BB::bb2(int,int)", - "participant_id": "264392653889863384", - "participant_name": "clanguml::t20006::BB" + "participant_id": "264392653889863384" }, "type": "message" }, @@ -350,8 +340,7 @@ void tmain() "from": { "activity_id": "361650123916792854", "activity_name": "clanguml::t20006::BB::bb2(int,int)", - "participant_id": "264392653889863384", - "participant_name": "clanguml::t20006::BB" + "participant_id": "264392653889863384" }, "name": "aa2(int)", "return_type": "void", @@ -363,8 +352,7 @@ void tmain() "to": { "activity_id": "582097827335267290", "activity_name": "clanguml::t20006::AA::aa2(int)", - "participant_id": "1903567228894636312", - "participant_name": "clanguml::t20006::AA" + "participant_id": "1903567228894636312" }, "type": "message" }, @@ -385,8 +373,7 @@ void tmain() "to": { "activity_id": "1062874005712014125", "activity_name": "clanguml::t20006::BB::bb1(int,std::string)", - "participant_id": "2269742833301555472", - "participant_name": "clanguml::t20006::BB" + "participant_id": "2269742833301555472" }, "type": "message" }, @@ -394,8 +381,7 @@ void tmain() "from": { "activity_id": "1062874005712014125", "activity_name": "clanguml::t20006::BB::bb1(int,std::string)", - "participant_id": "2269742833301555472", - "participant_name": "clanguml::t20006::BB" + "participant_id": "2269742833301555472" }, "name": "aa2(int)", "return_type": "void", @@ -407,8 +393,7 @@ void tmain() "to": { "activity_id": "582097827335267290", "activity_name": "clanguml::t20006::AA::aa2(int)", - "participant_id": "1903567228894636312", - "participant_name": "clanguml::t20006::AA" + "participant_id": "1903567228894636312" }, "type": "message" }, @@ -429,8 +414,7 @@ void tmain() "to": { "activity_id": "787705189994778234", "activity_name": "clanguml::t20006::BB::bb2(int,std::string)", - "participant_id": "2269742833301555472", - "participant_name": "clanguml::t20006::BB" + "participant_id": "2269742833301555472" }, "type": "message" }, @@ -438,8 +422,7 @@ void tmain() "from": { "activity_id": "787705189994778234", "activity_name": "clanguml::t20006::BB::bb2(int,std::string)", - "participant_id": "2269742833301555472", - "participant_name": "clanguml::t20006::BB" + "participant_id": "2269742833301555472" }, "name": "aa1(int)", "return_type": "void", @@ -451,8 +434,7 @@ void tmain() "to": { "activity_id": "1235428163990670191", "activity_name": "clanguml::t20006::AA::aa1(int)", - "participant_id": "1903567228894636312", - "participant_name": "clanguml::t20006::AA" + "participant_id": "1903567228894636312" }, "type": "message" }, @@ -473,8 +455,7 @@ void tmain() "to": { "activity_id": "1463188845572485713", "activity_name": "clanguml::t20006::BB::bb1(int,float)", - "participant_id": "1743503037360505162", - "participant_name": "clanguml::t20006::BB" + "participant_id": "1743503037360505162" }, "type": "message" }, @@ -482,8 +463,7 @@ void tmain() "from": { "activity_id": "1463188845572485713", "activity_name": "clanguml::t20006::BB::bb1(int,float)", - "participant_id": "1743503037360505162", - "participant_name": "clanguml::t20006::BB" + "participant_id": "1743503037360505162" }, "name": "bb2(int,float)", "return_type": "void", @@ -495,8 +475,7 @@ void tmain() "to": { "activity_id": "732362671329401903", "activity_name": "clanguml::t20006::BB::bb2(int,float)", - "participant_id": "1743503037360505162", - "participant_name": "clanguml::t20006::BB" + "participant_id": "1743503037360505162" }, "type": "message" }, @@ -504,8 +483,7 @@ void tmain() "from": { "activity_id": "732362671329401903", "activity_name": "clanguml::t20006::BB::bb2(int,float)", - "participant_id": "1743503037360505162", - "participant_name": "clanguml::t20006::BB" + "participant_id": "1743503037360505162" }, "name": "aa2(int)", "return_type": "void", @@ -517,8 +495,7 @@ void tmain() "to": { "activity_id": "582097827335267290", "activity_name": "clanguml::t20006::AA::aa2(int)", - "participant_id": "1903567228894636312", - "participant_name": "clanguml::t20006::AA" + "participant_id": "1903567228894636312" }, "type": "message" } diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index c9b07bdc..07957a40 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -34,82 +34,82 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + BB<int,int> - + BB<int,int> - - + + AA<int> - + AA<int> - - + + BB<int,std::string> - + BB<int,std::string> - - + + BB<int,float> - + BB<int,float> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + b(int) - + a1(int) @@ -118,12 +118,12 @@ - + b(std::string) - + a2(std::string) @@ -132,59 +132,59 @@ - + bb1(int,int) - + aa1(int) - + bb2(int,int) - + aa2(int) - + bb1(int,std::string) - + aa2(int) - + bb2(int,std::string) - + aa1(int) - + bb1(int,float) - + bb2(int,float) - + aa2(int) diff --git a/docs/test_cases/t20007.md b/docs/test_cases/t20007.md index f00e6272..d62d6d2c 100644 --- a/docs/test_cases/t20007.md +++ b/docs/test_cases/t20007.md @@ -110,8 +110,7 @@ void tmain() "to": { "activity_id": "438133719207269065", "activity_name": "clanguml::t20007::Adder::add(int &&,int &&)", - "participant_id": "1742497005509009302", - "participant_name": "clanguml::t20007::Adder" + "participant_id": "1742497005509009302" }, "type": "message" }, @@ -132,8 +131,7 @@ void tmain() "to": { "activity_id": "9522724767688870", "activity_name": "clanguml::t20007::Adder::add(int &&,float &&,double &&)", - "participant_id": "599640474306956868", - "participant_name": "clanguml::t20007::Adder" + "participant_id": "599640474306956868" }, "type": "message" }, @@ -154,8 +152,7 @@ void tmain() "to": { "activity_id": "384866641042941480", "activity_name": "clanguml::t20007::Adder::add(std::string &&,std::string &&,std::string &&)", - "participant_id": "228191787514523926", - "participant_name": "clanguml::t20007::Adder" + "participant_id": "228191787514523926" }, "type": "message" } diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index 6c6e56fb..13f13af9 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + Adder<int,int> - + Adder<int,int> - - + + Adder<int,float,double> - + Adder<int,float,double> - - + + Adder<std::string,std::string,std::string> - + Adder<std::string,std::string,std::string> - - - - - + + + + + add(int &&,int &&) - + add(int &&,float &&,double &&) - + add(std::string &&,std::string &&,std::string &&) diff --git a/docs/test_cases/t20008.md b/docs/test_cases/t20008.md index 033e8431..2b95228f 100644 --- a/docs/test_cases/t20008.md +++ b/docs/test_cases/t20008.md @@ -155,8 +155,7 @@ void tmain() "to": { "activity_id": "379850145437051189", "activity_name": "clanguml::t20008::B::b(int)", - "participant_id": "1906510289157013670", - "participant_name": "clanguml::t20008::B" + "participant_id": "1906510289157013670" }, "type": "message" }, @@ -164,8 +163,7 @@ void tmain() "from": { "activity_id": "379850145437051189", "activity_name": "clanguml::t20008::B::b(int)", - "participant_id": "1906510289157013670", - "participant_name": "clanguml::t20008::B" + "participant_id": "1906510289157013670" }, "name": "a1(int)", "return_type": "void", @@ -177,8 +175,7 @@ void tmain() "to": { "activity_id": "2066363630174644719", "activity_name": "clanguml::t20008::A::a1(int)", - "participant_id": "1376149084762923197", - "participant_name": "clanguml::t20008::A" + "participant_id": "1376149084762923197" }, "type": "message" }, @@ -199,8 +196,7 @@ void tmain() "to": { "activity_id": "1347162523481637780", "activity_name": "clanguml::t20008::B::b(const char *)", - "participant_id": "867098551202196741", - "participant_name": "clanguml::t20008::B" + "participant_id": "867098551202196741" }, "type": "message" }, @@ -208,8 +204,7 @@ void tmain() "from": { "activity_id": "1347162523481637780", "activity_name": "clanguml::t20008::B::b(const char *)", - "participant_id": "867098551202196741", - "participant_name": "clanguml::t20008::B" + "participant_id": "867098551202196741" }, "name": "a2(const char *)", "return_type": "void", @@ -221,8 +216,7 @@ void tmain() "to": { "activity_id": "718650834962275580", "activity_name": "clanguml::t20008::A::a2(const char *)", - "participant_id": "144833378017373200", - "participant_name": "clanguml::t20008::A" + "participant_id": "144833378017373200" }, "type": "message" }, @@ -243,8 +237,7 @@ void tmain() "to": { "activity_id": "1286410946666951254", "activity_name": "clanguml::t20008::B::b(std::string)", - "participant_id": "927702553742507923", - "participant_name": "clanguml::t20008::B" + "participant_id": "927702553742507923" }, "type": "message" }, @@ -252,8 +245,7 @@ void tmain() "from": { "activity_id": "1286410946666951254", "activity_name": "clanguml::t20008::B::b(std::string)", - "participant_id": "927702553742507923", - "participant_name": "clanguml::t20008::B" + "participant_id": "927702553742507923" }, "name": "a3(std::string)", "return_type": "void", @@ -265,8 +257,7 @@ void tmain() "to": { "activity_id": "1404594247101138737", "activity_name": "clanguml::t20008::A::a3(std::string)", - "participant_id": "390605614583363778", - "participant_name": "clanguml::t20008::A" + "participant_id": "390605614583363778" }, "type": "message" } diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index 3082972e..6e5a195f 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<const char *> - + B<const char *> - - + + A<const char *> - + A<const char *> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - - - - - - - + + + + + + + + b(int) - + a1(int) - + b(const char *) - + a2(const char *) - + b(std::string) - + a3(std::string) diff --git a/docs/test_cases/t20009.md b/docs/test_cases/t20009.md index 03b914e8..0375bc5c 100644 --- a/docs/test_cases/t20009.md +++ b/docs/test_cases/t20009.md @@ -141,8 +141,7 @@ void tmain() "to": { "activity_id": "1960266381909090879", "activity_name": "clanguml::t20009::B::b(std::string)", - "participant_id": "450813573860627679", - "participant_name": "clanguml::t20009::B" + "participant_id": "450813573860627679" }, "type": "message" }, @@ -150,8 +149,7 @@ void tmain() "from": { "activity_id": "1960266381909090879", "activity_name": "clanguml::t20009::B::b(std::string)", - "participant_id": "450813573860627679", - "participant_name": "clanguml::t20009::B" + "participant_id": "450813573860627679" }, "name": "a(std::string)", "return_type": "void", @@ -163,8 +161,7 @@ void tmain() "to": { "activity_id": "1716775846967761286", "activity_name": "clanguml::t20009::A::a(std::string)", - "participant_id": "1197403810800583218", - "participant_name": "clanguml::t20009::A" + "participant_id": "1197403810800583218" }, "type": "message" }, @@ -185,8 +182,7 @@ void tmain() "to": { "activity_id": "660557928399203634", "activity_name": "clanguml::t20009::B::b(int)", - "participant_id": "2002310682025149090", - "participant_name": "clanguml::t20009::B" + "participant_id": "2002310682025149090" }, "type": "message" }, @@ -194,8 +190,7 @@ void tmain() "from": { "activity_id": "660557928399203634", "activity_name": "clanguml::t20009::B::b(int)", - "participant_id": "2002310682025149090", - "participant_name": "clanguml::t20009::B" + "participant_id": "2002310682025149090" }, "name": "a(int)", "return_type": "void", @@ -207,8 +202,7 @@ void tmain() "to": { "activity_id": "2030629454810805092", "activity_name": "clanguml::t20009::A::a(int)", - "participant_id": "1228498754558363121", - "participant_name": "clanguml::t20009::A" + "participant_id": "1228498754558363121" }, "type": "message" }, @@ -229,8 +223,7 @@ void tmain() "to": { "activity_id": "367805163135583282", "activity_name": "clanguml::t20009::B::b(float)", - "participant_id": "1461902328659683203", - "participant_name": "clanguml::t20009::B" + "participant_id": "1461902328659683203" }, "type": "message" }, @@ -238,8 +231,7 @@ void tmain() "from": { "activity_id": "367805163135583282", "activity_name": "clanguml::t20009::B::b(float)", - "participant_id": "1461902328659683203", - "participant_name": "clanguml::t20009::B" + "participant_id": "1461902328659683203" }, "name": "a(float)", "return_type": "void", @@ -251,8 +243,7 @@ void tmain() "to": { "activity_id": "1643733911490581293", "activity_name": "clanguml::t20009::A::a(float)", - "participant_id": "1243520246309441967", - "participant_name": "clanguml::t20009::A" + "participant_id": "1243520246309441967" }, "type": "message" } diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index 228e46bc..58bfb798 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<float> - + B<float> - - + + A<float> - + A<float> - - - - - - - - + + + + + + + + b(std::string) - + a(std::string) - + b(int) - + a(int) - + b(float) - + a(float) diff --git a/docs/test_cases/t20010.md b/docs/test_cases/t20010.md index c9d3ece1..e9a04c8b 100644 --- a/docs/test_cases/t20010.md +++ b/docs/test_cases/t20010.md @@ -115,8 +115,7 @@ void tmain() "to": { "activity_id": "343626060927491836", "activity_name": "clanguml::t20010::B::b1()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "type": "message" }, @@ -124,8 +123,7 @@ void tmain() "from": { "activity_id": "343626060927491836", "activity_name": "clanguml::t20010::B::b1()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "name": "a1()", "return_type": "void", @@ -137,8 +135,7 @@ void tmain() "to": { "activity_id": "981184681827469850", "activity_name": "clanguml::t20010::A::a1()", - "participant_id": "102070351492425113", - "participant_name": "clanguml::t20010::A" + "participant_id": "102070351492425113" }, "type": "message" }, @@ -159,8 +156,7 @@ void tmain() "to": { "activity_id": "1633031113603062043", "activity_name": "clanguml::t20010::B::b2()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "type": "message" }, @@ -168,8 +164,7 @@ void tmain() "from": { "activity_id": "1633031113603062043", "activity_name": "clanguml::t20010::B::b2()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "name": "a2()", "return_type": "void", @@ -181,8 +176,7 @@ void tmain() "to": { "activity_id": "664370880632146592", "activity_name": "clanguml::t20010::A::a2()", - "participant_id": "102070351492425113", - "participant_name": "clanguml::t20010::A" + "participant_id": "102070351492425113" }, "type": "message" }, @@ -203,8 +197,7 @@ void tmain() "to": { "activity_id": "786218543654309692", "activity_name": "clanguml::t20010::B::b3()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "type": "message" }, @@ -212,8 +205,7 @@ void tmain() "from": { "activity_id": "786218543654309692", "activity_name": "clanguml::t20010::B::b3()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "name": "a3()", "return_type": "void", @@ -225,8 +217,7 @@ void tmain() "to": { "activity_id": "2145739294823015899", "activity_name": "clanguml::t20010::A::a3()", - "participant_id": "102070351492425113", - "participant_name": "clanguml::t20010::A" + "participant_id": "102070351492425113" }, "type": "message" }, @@ -247,8 +238,7 @@ void tmain() "to": { "activity_id": "1866068965397702666", "activity_name": "clanguml::t20010::B::b4()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "type": "message" }, @@ -256,8 +246,7 @@ void tmain() "from": { "activity_id": "1866068965397702666", "activity_name": "clanguml::t20010::B::b4()", - "participant_id": "2154977200904210115", - "participant_name": "clanguml::t20010::B" + "participant_id": "2154977200904210115" }, "name": "a4()", "return_type": "void", @@ -269,8 +258,7 @@ void tmain() "to": { "activity_id": "1224936485834400821", "activity_name": "clanguml::t20010::A::a4()", - "participant_id": "102070351492425113", - "participant_name": "clanguml::t20010::A" + "participant_id": "102070351492425113" }, "type": "message" } diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index f6da7b82..140f3a16 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A - + A - - - - - - - - - - + + + + + + + + + + b1() - + a1() - + b2() - + a2() - + b3() - + a3() - + b4() - + a4() diff --git a/docs/test_cases/t20011.md b/docs/test_cases/t20011.md index cd14b480..7512bb1f 100644 --- a/docs/test_cases/t20011.md +++ b/docs/test_cases/t20011.md @@ -98,8 +98,7 @@ void tmain() "to": { "activity_id": "1647578261840204206", "activity_name": "clanguml::t20011::A::a(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "type": "message" }, @@ -112,8 +111,7 @@ void tmain() "from": { "activity_id": "1647578261840204206", "activity_name": "clanguml::t20011::A::a(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "name": "a(int)", "return_type": "void", @@ -125,8 +123,7 @@ void tmain() "to": { "activity_id": "1647578261840204206", "activity_name": "clanguml::t20011::A::a(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "type": "message" } @@ -154,8 +151,7 @@ void tmain() "to": { "activity_id": "305456175818875420", "activity_name": "clanguml::t20011::A::b(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "type": "message" }, @@ -163,8 +159,7 @@ void tmain() "from": { "activity_id": "305456175818875420", "activity_name": "clanguml::t20011::A::b(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "name": "c(int)", "return_type": "void", @@ -176,8 +171,7 @@ void tmain() "to": { "activity_id": "963268672079901211", "activity_name": "clanguml::t20011::A::c(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "type": "message" }, @@ -185,8 +179,7 @@ void tmain() "from": { "activity_id": "963268672079901211", "activity_name": "clanguml::t20011::A::c(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "name": "d(int)", "return_type": "void", @@ -198,8 +191,7 @@ void tmain() "to": { "activity_id": "1874311762268001137", "activity_name": "clanguml::t20011::A::d(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "type": "message" }, @@ -212,8 +204,7 @@ void tmain() "from": { "activity_id": "1874311762268001137", "activity_name": "clanguml::t20011::A::d(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "name": "b(int)", "return_type": "void", @@ -225,8 +216,7 @@ void tmain() "to": { "activity_id": "305456175818875420", "activity_name": "clanguml::t20011::A::b(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "type": "message" }, @@ -234,8 +224,7 @@ void tmain() "from": { "activity_id": "1874311762268001137", "activity_name": "clanguml::t20011::A::d(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "name": "a(int)", "return_type": "void", @@ -247,8 +236,7 @@ void tmain() "to": { "activity_id": "1647578261840204206", "activity_name": "clanguml::t20011::A::a(int)", - "participant_id": "816061502062128285", - "participant_name": "clanguml::t20011::A" + "participant_id": "816061502062128285" }, "type": "message" } diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 66ec6fdb..c44f0a29 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - + + + + + + + + + + a(int) @@ -52,26 +52,26 @@ alt - + a(int) - + b(int) - + c(int) - + @@ -81,14 +81,14 @@ alt - + b(int) - + @@ -98,7 +98,7 @@ alt - + diff --git a/docs/test_cases/t20012.md b/docs/test_cases/t20012.md index ffe5f498..f27809de 100644 --- a/docs/test_cases/t20012.md +++ b/docs/test_cases/t20012.md @@ -234,8 +234,7 @@ void tmain() "to": { "activity_id": "601151241333493101", "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", - "participant_id": "871571755123349249", - "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)" + "participant_id": "871571755123349249" }, "type": "message" }, @@ -243,8 +242,7 @@ void tmain() "from": { "activity_id": "601151241333493101", "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", - "participant_id": "871571755123349249", - "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)" + "participant_id": "871571755123349249" }, "name": "a()", "return_type": "void", @@ -256,8 +254,7 @@ void tmain() "to": { "activity_id": "1871432932744498976", "activity_name": "clanguml::t20012::A::a()", - "participant_id": "1798184226128732119", - "participant_name": "clanguml::t20012::A" + "participant_id": "1798184226128732119" }, "type": "message" }, @@ -265,8 +262,7 @@ void tmain() "from": { "activity_id": "1871432932744498976", "activity_name": "clanguml::t20012::A::a()", - "participant_id": "1798184226128732119", - "participant_name": "clanguml::t20012::A" + "participant_id": "1798184226128732119" }, "name": "aa()", "return_type": "void", @@ -278,8 +274,7 @@ void tmain() "to": { "activity_id": "1100933039353876539", "activity_name": "clanguml::t20012::A::aa()", - "participant_id": "1798184226128732119", - "participant_name": "clanguml::t20012::A" + "participant_id": "1798184226128732119" }, "type": "message" }, @@ -287,8 +282,7 @@ void tmain() "from": { "activity_id": "1100933039353876539", "activity_name": "clanguml::t20012::A::aa()", - "participant_id": "1798184226128732119", - "participant_name": "clanguml::t20012::A" + "participant_id": "1798184226128732119" }, "name": "aaa()", "return_type": "void", @@ -300,8 +294,7 @@ void tmain() "to": { "activity_id": "941636185823691898", "activity_name": "clanguml::t20012::A::aaa()", - "participant_id": "1798184226128732119", - "participant_name": "clanguml::t20012::A" + "participant_id": "1798184226128732119" }, "type": "message" }, @@ -309,8 +302,7 @@ void tmain() "from": { "activity_id": "601151241333493101", "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", - "participant_id": "871571755123349249", - "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)" + "participant_id": "871571755123349249" }, "name": "b()", "return_type": "void", @@ -322,8 +314,7 @@ void tmain() "to": { "activity_id": "2142697410385270633", "activity_name": "clanguml::t20012::B::b()", - "participant_id": "1893469899260202653", - "participant_name": "clanguml::t20012::B" + "participant_id": "1893469899260202653" }, "type": "message" }, @@ -331,8 +322,7 @@ void tmain() "from": { "activity_id": "2142697410385270633", "activity_name": "clanguml::t20012::B::b()", - "participant_id": "1893469899260202653", - "participant_name": "clanguml::t20012::B" + "participant_id": "1893469899260202653" }, "name": "bb()", "return_type": "void", @@ -344,8 +334,7 @@ void tmain() "to": { "activity_id": "973718340784931313", "activity_name": "clanguml::t20012::B::bb()", - "participant_id": "1893469899260202653", - "participant_name": "clanguml::t20012::B" + "participant_id": "1893469899260202653" }, "type": "message" }, @@ -353,8 +342,7 @@ void tmain() "from": { "activity_id": "973718340784931313", "activity_name": "clanguml::t20012::B::bb()", - "participant_id": "1893469899260202653", - "participant_name": "clanguml::t20012::B" + "participant_id": "1893469899260202653" }, "name": "bbb()", "return_type": "void", @@ -366,8 +354,7 @@ void tmain() "to": { "activity_id": "195788529004378403", "activity_name": "clanguml::t20012::B::bbb()", - "participant_id": "1893469899260202653", - "participant_name": "clanguml::t20012::B" + "participant_id": "1893469899260202653" }, "type": "message" }, @@ -388,8 +375,7 @@ void tmain() "to": { "activity_id": "435249756897748529", "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:79:20)::operator()()", - "participant_id": "516948909715002916", - "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:79:20)" + "participant_id": "516948909715002916" }, "type": "message" }, @@ -397,8 +383,7 @@ void tmain() "from": { "activity_id": "435249756897748529", "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)::operator()()", - "participant_id": "516948909715002916", - "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)" + "participant_id": "516948909715002916" }, "name": "c()", "return_type": "void", @@ -410,8 +395,7 @@ void tmain() "to": { "activity_id": "675369415318225607", "activity_name": "clanguml::t20012::C::c()", - "participant_id": "2071958121786360262", - "participant_name": "clanguml::t20012::C" + "participant_id": "2071958121786360262" }, "type": "message" }, @@ -419,8 +403,7 @@ void tmain() "from": { "activity_id": "675369415318225607", "activity_name": "clanguml::t20012::C::c()", - "participant_id": "2071958121786360262", - "participant_name": "clanguml::t20012::C" + "participant_id": "2071958121786360262" }, "name": "cc()", "return_type": "void", @@ -432,8 +415,7 @@ void tmain() "to": { "activity_id": "1451821704315336057", "activity_name": "clanguml::t20012::C::cc()", - "participant_id": "2071958121786360262", - "participant_name": "clanguml::t20012::C" + "participant_id": "2071958121786360262" }, "type": "message" }, @@ -441,8 +423,7 @@ void tmain() "from": { "activity_id": "1451821704315336057", "activity_name": "clanguml::t20012::C::cc()", - "participant_id": "2071958121786360262", - "participant_name": "clanguml::t20012::C" + "participant_id": "2071958121786360262" }, "name": "ccc()", "return_type": "void", @@ -454,8 +435,7 @@ void tmain() "to": { "activity_id": "1956141408799600460", "activity_name": "clanguml::t20012::C::ccc()", - "participant_id": "2071958121786360262", - "participant_name": "clanguml::t20012::C" + "participant_id": "2071958121786360262" }, "type": "message" }, @@ -463,8 +443,7 @@ void tmain() "from": { "activity_id": "435249756897748529", "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)::operator()()", - "participant_id": "516948909715002916", - "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)" + "participant_id": "516948909715002916" }, "name": "operator()()", "return_type": "", @@ -476,8 +455,7 @@ void tmain() "to": { "activity_id": "601151241333493101", "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)::operator()()", - "participant_id": "871571755123349249", - "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:66:20)" + "participant_id": "871571755123349249" }, "type": "message" }, @@ -498,8 +476,7 @@ void tmain() "to": { "activity_id": "1003931867044486762", "activity_name": "clanguml::t20012::R::r()", - "participant_id": "1639905845562724067", - "participant_name": "clanguml::t20012::R" + "participant_id": "1639905845562724067" }, "type": "message" }, @@ -507,8 +484,7 @@ void tmain() "from": { "activity_id": "1003931867044486762", "activity_name": "clanguml::t20012::R::r()", - "participant_id": "1639905845562724067", - "participant_name": "clanguml::t20012::R" + "participant_id": "1639905845562724067" }, "name": "operator()()", "return_type": "", @@ -520,8 +496,7 @@ void tmain() "to": { "activity_id": "31472345599504206", "activity_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:85:9)::operator()()", - "participant_id": "105322683015690128", - "participant_name": "clanguml::t20012::tmain()##(lambda ../../tests/t20012/t20012.cc:85:9)" + "participant_id": "105322683015690128" }, "type": "message" }, @@ -529,8 +504,7 @@ void tmain() "from": { "activity_id": "31472345599504206", "activity_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)::operator()()", - "participant_id": "105322683015690128", - "participant_name": "clanguml::t20012::tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)" + "participant_id": "105322683015690128" }, "name": "c()", "return_type": "void", @@ -542,8 +516,7 @@ void tmain() "to": { "activity_id": "675369415318225607", "activity_name": "clanguml::t20012::C::c()", - "participant_id": "2071958121786360262", - "participant_name": "clanguml::t20012::C" + "participant_id": "2071958121786360262" }, "type": "message" }, @@ -564,8 +537,7 @@ void tmain() "to": { "activity_id": "1355013132527568474", "activity_name": "clanguml::t20012::D::add5(int)", - "participant_id": "1627226326147373737", - "participant_name": "clanguml::t20012::D" + "participant_id": "1627226326147373737" }, "type": "message" } diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index cbd04446..81d86091 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -43,122 +43,122 @@ - - + + tmain() - + tmain() - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:66:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:79:20) - - + + C - + C - - + + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - + R<R::(lambda ../../tests/t20012/t20012.cc:85:9)> - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - + tmain()::(lambda ../../tests/t20012/t20012.cc:85:9) - - + + D - + D - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -167,67 +167,67 @@ - + operator()() - + c() - + cc() - + ccc() - + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -238,29 +238,29 @@ - + r() - + operator()() - + c() - + cc() - + @@ -269,7 +269,7 @@ - + add5(int) diff --git a/docs/test_cases/t20013.md b/docs/test_cases/t20013.md index 51ae1bd0..fda98bfc 100644 --- a/docs/test_cases/t20013.md +++ b/docs/test_cases/t20013.md @@ -103,8 +103,7 @@ void tmain(int argc, char **argv) "to": { "activity_id": "2144804108273682993", "activity_name": "clanguml::t20013::B::b(int)", - "participant_id": "1106407610612951303", - "participant_name": "clanguml::t20013::B" + "participant_id": "1106407610612951303" }, "type": "message" }, @@ -112,8 +111,7 @@ void tmain(int argc, char **argv) "from": { "activity_id": "2144804108273682993", "activity_name": "clanguml::t20013::B::b(int)", - "participant_id": "1106407610612951303", - "participant_name": "clanguml::t20013::B" + "participant_id": "1106407610612951303" }, "name": "a1(int)", "return_type": "int", @@ -125,8 +123,7 @@ void tmain(int argc, char **argv) "to": { "activity_id": "1034027282942033004", "activity_name": "clanguml::t20013::A::a1(int)", - "participant_id": "976623130699225079", - "participant_name": "clanguml::t20013::A" + "participant_id": "976623130699225079" }, "type": "message" }, @@ -147,8 +144,7 @@ void tmain(int argc, char **argv) "to": { "activity_id": "640747884486165287", "activity_name": "clanguml::t20013::B::b(double)", - "participant_id": "1106407610612951303", - "participant_name": "clanguml::t20013::B" + "participant_id": "1106407610612951303" }, "type": "message" }, @@ -156,8 +152,7 @@ void tmain(int argc, char **argv) "from": { "activity_id": "640747884486165287", "activity_name": "clanguml::t20013::B::b(double)", - "participant_id": "1106407610612951303", - "participant_name": "clanguml::t20013::B" + "participant_id": "1106407610612951303" }, "name": "a2(double)", "return_type": "double", @@ -169,8 +164,7 @@ void tmain(int argc, char **argv) "to": { "activity_id": "394053399890813915", "activity_name": "clanguml::t20013::A::a2(double)", - "participant_id": "976623130699225079", - "participant_name": "clanguml::t20013::A" + "participant_id": "976623130699225079" }, "type": "message" }, @@ -191,8 +185,7 @@ void tmain(int argc, char **argv) "to": { "activity_id": "1066935874364409142", "activity_name": "clanguml::t20013::B::b(const char *)", - "participant_id": "1106407610612951303", - "participant_name": "clanguml::t20013::B" + "participant_id": "1106407610612951303" }, "type": "message" }, @@ -200,8 +193,7 @@ void tmain(int argc, char **argv) "from": { "activity_id": "1066935874364409142", "activity_name": "clanguml::t20013::B::b(const char *)", - "participant_id": "1106407610612951303", - "participant_name": "clanguml::t20013::B" + "participant_id": "1106407610612951303" }, "name": "a3(const char *)", "return_type": "const char *", @@ -213,8 +205,7 @@ void tmain(int argc, char **argv) "to": { "activity_id": "1841239321495867611", "activity_name": "clanguml::t20013::A::a3(const char *)", - "participant_id": "976623130699225079", - "participant_name": "clanguml::t20013::A" + "participant_id": "976623130699225079" }, "type": "message" } diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index 3dcc79a9..b3e8d594 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -58,12 +58,12 @@ - + b(double) - + a2(double) @@ -72,12 +72,12 @@ - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20014.md b/docs/test_cases/t20014.md index 68de8c88..3c60a84c 100644 --- a/docs/test_cases/t20014.md +++ b/docs/test_cases/t20014.md @@ -147,8 +147,7 @@ namespace t20014 { "to": { "activity_id": "1251633571711578431", "activity_name": "clanguml::t20014::B::b1(int,int)", - "participant_id": "1537634076295867978", - "participant_name": "clanguml::t20014::B" + "participant_id": "1537634076295867978" }, "type": "message" }, @@ -156,8 +155,7 @@ namespace t20014 { "from": { "activity_id": "1251633571711578431", "activity_name": "clanguml::t20014::B::b1(int,int)", - "participant_id": "1537634076295867978", - "participant_name": "clanguml::t20014::B" + "participant_id": "1537634076295867978" }, "name": "a1(int,int)", "return_type": "int", @@ -169,8 +167,7 @@ namespace t20014 { "to": { "activity_id": "1753682948110709616", "activity_name": "clanguml::t20014::A::a1(int,int)", - "participant_id": "1504706415756333840", - "participant_name": "clanguml::t20014::A" + "participant_id": "1504706415756333840" }, "type": "message" }, @@ -191,8 +188,7 @@ namespace t20014 { "to": { "activity_id": "767830966714379991", "activity_name": "clanguml::t20014::B::b2(int,int)", - "participant_id": "1537634076295867978", - "participant_name": "clanguml::t20014::B" + "participant_id": "1537634076295867978" }, "type": "message" }, @@ -200,8 +196,7 @@ namespace t20014 { "from": { "activity_id": "767830966714379991", "activity_name": "clanguml::t20014::B::b2(int,int)", - "participant_id": "1537634076295867978", - "participant_name": "clanguml::t20014::B" + "participant_id": "1537634076295867978" }, "name": "a2(int,int)", "return_type": "int", @@ -213,8 +208,7 @@ namespace t20014 { "to": { "activity_id": "1943487088673912694", "activity_name": "clanguml::t20014::A::a2(int,int)", - "participant_id": "1504706415756333840", - "participant_name": "clanguml::t20014::A" + "participant_id": "1504706415756333840" }, "type": "message" }, @@ -235,8 +229,7 @@ namespace t20014 { "to": { "activity_id": "407559038402563981", "activity_name": "clanguml::t20014::C::c1(int,int)", - "participant_id": "500712304857049435", - "participant_name": "clanguml::t20014::C" + "participant_id": "500712304857049435" }, "type": "message" }, @@ -244,8 +237,7 @@ namespace t20014 { "from": { "activity_id": "407559038402563981", "activity_name": "clanguml::t20014::C::c1(int,int)", - "participant_id": "500712304857049435", - "participant_name": "clanguml::t20014::C" + "participant_id": "500712304857049435" }, "name": "b1(int,int)", "return_type": "int", @@ -257,8 +249,7 @@ namespace t20014 { "to": { "activity_id": "1251633571711578431", "activity_name": "clanguml::t20014::B::b1(int,int)", - "participant_id": "1537634076295867978", - "participant_name": "clanguml::t20014::B" + "participant_id": "1537634076295867978" }, "type": "message" } diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index 34639fa5..222a2b21 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - - - - - - - + + + + + + + + - - + + tmain() - + tmain() - - + + B - + B - - + + A - + A - - + + C<B,int> - + C<B,int> - - - - - - - - - + + + + + + + + + b1(int,int) - + a1(int,int) @@ -67,12 +67,12 @@ - + b2(int,int) - + a2(int,int) @@ -81,17 +81,17 @@ - + c1(int,int) - + b1(int,int) - + a1(int,int) diff --git a/docs/test_cases/t20015.md b/docs/test_cases/t20015.md index 9174ca02..34af04ed 100644 --- a/docs/test_cases/t20015.md +++ b/docs/test_cases/t20015.md @@ -110,8 +110,7 @@ void tmain() "to": { "activity_id": "431575772398797060", "activity_name": "clanguml::t20015::B::setup_a(std::shared_ptr &)", - "participant_id": "1302656676783358645", - "participant_name": "clanguml::t20015::B" + "participant_id": "1302656676783358645" }, "type": "message" } diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index 49953ceb..846ba3fc 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + B - + B - - - + + + setup_a(std::shared_ptr<detail::A> &) diff --git a/docs/test_cases/t20016.md b/docs/test_cases/t20016.md index 8358bfc2..8a8052b8 100644 --- a/docs/test_cases/t20016.md +++ b/docs/test_cases/t20016.md @@ -101,8 +101,7 @@ void tmain() "to": { "activity_id": "2064264710178722261", "activity_name": "clanguml::t20016::B::b1(long)", - "participant_id": "1688340912643326666", - "participant_name": "clanguml::t20016::B" + "participant_id": "1688340912643326666" }, "type": "message" }, @@ -110,8 +109,7 @@ void tmain() "from": { "activity_id": "2064264710178722261", "activity_name": "clanguml::t20016::B::b1(long)", - "participant_id": "1688340912643326666", - "participant_name": "clanguml::t20016::B" + "participant_id": "1688340912643326666" }, "name": "a1(int)", "return_type": "void", @@ -123,8 +121,7 @@ void tmain() "to": { "activity_id": "1198371121423942542", "activity_name": "clanguml::t20016::A::a1(int)", - "participant_id": "1351242594275053195", - "participant_name": "clanguml::t20016::A" + "participant_id": "1351242594275053195" }, "type": "message" }, @@ -145,8 +142,7 @@ void tmain() "to": { "activity_id": "203381140188081853", "activity_name": "clanguml::t20016::B::b2(long)", - "participant_id": "1688340912643326666", - "participant_name": "clanguml::t20016::B" + "participant_id": "1688340912643326666" }, "type": "message" }, @@ -154,8 +150,7 @@ void tmain() "from": { "activity_id": "203381140188081853", "activity_name": "clanguml::t20016::B::b2(long)", - "participant_id": "1688340912643326666", - "participant_name": "clanguml::t20016::B" + "participant_id": "1688340912643326666" }, "name": "a2(const long &)", "return_type": "long", @@ -167,8 +162,7 @@ void tmain() "to": { "activity_id": "1208784669530380166", "activity_name": "clanguml::t20016::A::a2(const long &)", - "participant_id": "1351242594275053195", - "participant_name": "clanguml::t20016::A" + "participant_id": "1351242594275053195" }, "type": "message" } diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index 10e2b0f1..e33585f2 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - - - - + + + + + - - + + tmain() - + tmain() - - + + B<long> - + B<long> - - + + A - + A - - - - - - + + + + + + b1(long) - + a1(int) - + b2(long) - + a2(const long &) diff --git a/docs/test_cases/t20017.md b/docs/test_cases/t20017.md index 45faa15e..532e1a41 100644 --- a/docs/test_cases/t20017.md +++ b/docs/test_cases/t20017.md @@ -85,8 +85,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021", - "participant_name": "t20017.cc" + "participant_id": "294332401323799021" }, "name": "a3(int,int)", "return_type": "", @@ -98,8 +97,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "to": { "activity_id": "1681392050252260928", "activity_name": "clanguml::t20017::a3(int,int)", - "participant_id": "1591222867263639510", - "participant_name": "include/t20017_a.h" + "participant_id": "1591222867263639510" }, "type": "message" }, @@ -107,8 +105,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021", - "participant_name": "t20017.cc" + "participant_id": "294332401323799021" }, "name": "b1(int,int)", "return_type": "", @@ -120,8 +117,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "to": { "activity_id": "1714277838806105702", "activity_name": "clanguml::t20017::b1(int,int)", - "participant_id": "1113611539183189365", - "participant_name": "include/t20017_b.h" + "participant_id": "1113611539183189365" }, "type": "message" }, @@ -129,8 +125,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021", - "participant_name": "t20017.cc" + "participant_id": "294332401323799021" }, "name": "a2(int,int)", "return_type": "", @@ -142,8 +137,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "to": { "activity_id": "291553542743365259", "activity_name": "clanguml::t20017::a2(int,int)", - "participant_id": "1591222867263639510", - "participant_name": "include/t20017_a.h" + "participant_id": "1591222867263639510" }, "type": "message" }, @@ -151,8 +145,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021", - "participant_name": "t20017.cc" + "participant_id": "294332401323799021" }, "name": "a1(int,int)", "return_type": "", @@ -164,8 +157,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "to": { "activity_id": "113759676939330212", "activity_name": "clanguml::t20017::a1(int,int)", - "participant_id": "1591222867263639510", - "participant_name": "include/t20017_a.h" + "participant_id": "1591222867263639510" }, "type": "message" }, @@ -173,8 +165,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "from": { "activity_id": "1484746432546296115", "activity_name": "clanguml::t20017::tmain()", - "participant_id": "294332401323799021", - "participant_name": "t20017.cc" + "participant_id": "294332401323799021" }, "name": "b2(int,int)", "return_type": "", @@ -186,8 +177,7 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } "to": { "activity_id": "775081116464505528", "activity_name": "clanguml::t20017::b2(int,int)", - "participant_id": "1113611539183189365", - "participant_name": "include/t20017_b.h" + "participant_id": "1113611539183189365" }, "type": "message" } diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index 8f319b13..81a90e4a 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,65 +9,65 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_a.h - + include/t20017_a.h - + include/t20017_b.h - + include/t20017_b.h - - - - - - + + + + + + tmain() - + a3(int,int) - + b1(int,int) - + a2(int,int) - + a1(int,int) - + b2<int>(int,int) diff --git a/docs/test_cases/t20018.md b/docs/test_cases/t20018.md index 24d01a05..443ca571 100644 --- a/docs/test_cases/t20018.md +++ b/docs/test_cases/t20018.md @@ -148,8 +148,7 @@ void tmain() { Answer>::print(); } "to": { "activity_id": "1185770766239304952", "activity_name": "clanguml::t20018::Answer,120>::print()", - "participant_id": "1163521725351533502", - "participant_name": "clanguml::t20018::Answer,120>" + "participant_id": "1163521725351533502" }, "type": "message" }, @@ -157,8 +156,7 @@ void tmain() { Answer>::print(); } "from": { "activity_id": "1185770766239304952", "activity_name": "clanguml::t20018::Answer,120>::print()", - "participant_id": "1163521725351533502", - "participant_name": "clanguml::t20018::Answer,120>" + "participant_id": "1163521725351533502" }, "name": "print(int)", "return_type": "", @@ -170,8 +168,7 @@ void tmain() { Answer>::print(); } "to": { "activity_id": "833100888453299461", "activity_name": "clanguml::t20018::Factorial<5>::print(int)", - "participant_id": "1482779373563849921", - "participant_name": "clanguml::t20018::Factorial<5>" + "participant_id": "1482779373563849921" }, "type": "message" }, @@ -179,8 +176,7 @@ void tmain() { Answer>::print(); } "from": { "activity_id": "833100888453299461", "activity_name": "clanguml::t20018::Factorial<5>::print(int)", - "participant_id": "1482779373563849921", - "participant_name": "clanguml::t20018::Factorial<5>" + "participant_id": "1482779373563849921" }, "name": "print(int)", "return_type": "", @@ -192,8 +188,7 @@ void tmain() { Answer>::print(); } "to": { "activity_id": "1782586643813991247", "activity_name": "clanguml::t20018::Factorial<4>::print(int)", - "participant_id": "52416404065514823", - "participant_name": "clanguml::t20018::Factorial<4>" + "participant_id": "52416404065514823" }, "type": "message" }, @@ -201,8 +196,7 @@ void tmain() { Answer>::print(); } "from": { "activity_id": "1782586643813991247", "activity_name": "clanguml::t20018::Factorial<4>::print(int)", - "participant_id": "52416404065514823", - "participant_name": "clanguml::t20018::Factorial<4>" + "participant_id": "52416404065514823" }, "name": "print(int)", "return_type": "", @@ -214,8 +208,7 @@ void tmain() { Answer>::print(); } "to": { "activity_id": "1238078028595736678", "activity_name": "clanguml::t20018::Factorial<3>::print(int)", - "participant_id": "1658728078296100018", - "participant_name": "clanguml::t20018::Factorial<3>" + "participant_id": "1658728078296100018" }, "type": "message" }, @@ -223,8 +216,7 @@ void tmain() { Answer>::print(); } "from": { "activity_id": "1238078028595736678", "activity_name": "clanguml::t20018::Factorial<3>::print(int)", - "participant_id": "1658728078296100018", - "participant_name": "clanguml::t20018::Factorial<3>" + "participant_id": "1658728078296100018" }, "name": "print(int)", "return_type": "", @@ -236,8 +228,7 @@ void tmain() { Answer>::print(); } "to": { "activity_id": "2163270950475476780", "activity_name": "clanguml::t20018::Factorial<2>::print(int)", - "participant_id": "969903469166760124", - "participant_name": "clanguml::t20018::Factorial<2>" + "participant_id": "969903469166760124" }, "type": "message" }, @@ -245,8 +236,7 @@ void tmain() { Answer>::print(); } "from": { "activity_id": "2163270950475476780", "activity_name": "clanguml::t20018::Factorial<2>::print(int)", - "participant_id": "969903469166760124", - "participant_name": "clanguml::t20018::Factorial<2>" + "participant_id": "969903469166760124" }, "name": "print(int)", "return_type": "", @@ -258,8 +248,7 @@ void tmain() { Answer>::print(); } "to": { "activity_id": "501166016325937670", "activity_name": "clanguml::t20018::Factorial<1>::print(int)", - "participant_id": "2032621198190600516", - "participant_name": "clanguml::t20018::Factorial<1>" + "participant_id": "2032621198190600516" }, "type": "message" }, @@ -267,8 +256,7 @@ void tmain() { Answer>::print(); } "from": { "activity_id": "501166016325937670", "activity_name": "clanguml::t20018::Factorial<1>::print(int)", - "participant_id": "2032621198190600516", - "participant_name": "clanguml::t20018::Factorial<1>" + "participant_id": "2032621198190600516" }, "name": "print(int)", "return_type": "", @@ -280,8 +268,7 @@ void tmain() { Answer>::print(); } "to": { "activity_id": "577232827352391544", "activity_name": "clanguml::t20018::Factorial<0>::print(int)", - "participant_id": "1581865799666386458", - "participant_name": "clanguml::t20018::Factorial<0>" + "participant_id": "1581865799666386458" }, "type": "message" } diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index e4035be0..f996eafc 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + @@ -25,93 +25,93 @@ - - + + tmain() - + tmain() - - + + Answer<Factorial<5>,120> - + Answer<Factorial<5>,120> - - + + Factorial<5> - + Factorial<5> - - + + Factorial<4> - + Factorial<4> - - + + Factorial<3> - + Factorial<3> - - + + Factorial<2> - + Factorial<2> - - + + Factorial<1> - + Factorial<1> - - + + Factorial<0> - + Factorial<0> - - - - - - - - - + + + + + + + + + print() - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) diff --git a/docs/test_cases/t20019.md b/docs/test_cases/t20019.md index 3702f494..8601073d 100644 --- a/docs/test_cases/t20019.md +++ b/docs/test_cases/t20019.md @@ -128,8 +128,7 @@ void tmain() "to": { "activity_id": "1038853547136467401", "activity_name": "clanguml::t20019::Base::name()", - "participant_id": "381327373934972004", - "participant_name": "clanguml::t20019::Base" + "participant_id": "381327373934972004" }, "type": "message" }, @@ -137,8 +136,7 @@ void tmain() "from": { "activity_id": "1038853547136467401", "activity_name": "clanguml::t20019::Base::name()", - "participant_id": "381327373934972004", - "participant_name": "clanguml::t20019::Base" + "participant_id": "381327373934972004" }, "name": "impl()", "return_type": "void", @@ -150,8 +148,7 @@ void tmain() "to": { "activity_id": "603969604599968603", "activity_name": "clanguml::t20019::D1::impl()", - "participant_id": "1282259011856139592", - "participant_name": "clanguml::t20019::D1" + "participant_id": "1282259011856139592" }, "type": "message" }, @@ -172,8 +169,7 @@ void tmain() "to": { "activity_id": "1918672956676175365", "activity_name": "clanguml::t20019::Base::name()", - "participant_id": "1659477498076328530", - "participant_name": "clanguml::t20019::Base" + "participant_id": "1659477498076328530" }, "type": "message" }, @@ -181,8 +177,7 @@ void tmain() "from": { "activity_id": "1918672956676175365", "activity_name": "clanguml::t20019::Base::name()", - "participant_id": "1659477498076328530", - "participant_name": "clanguml::t20019::Base" + "participant_id": "1659477498076328530" }, "name": "impl()", "return_type": "void", @@ -194,8 +189,7 @@ void tmain() "to": { "activity_id": "861400435979772695", "activity_name": "clanguml::t20019::D2::impl()", - "participant_id": "1307471723138212117", - "participant_name": "clanguml::t20019::D2" + "participant_id": "1307471723138212117" }, "type": "message" }, @@ -216,8 +210,7 @@ void tmain() "to": { "activity_id": "1038853547136467401", "activity_name": "clanguml::t20019::Base::name()", - "participant_id": "381327373934972004", - "participant_name": "clanguml::t20019::Base" + "participant_id": "381327373934972004" }, "type": "message" }, @@ -238,8 +231,7 @@ void tmain() "to": { "activity_id": "1918672956676175365", "activity_name": "clanguml::t20019::Base::name()", - "participant_id": "1659477498076328530", - "participant_name": "clanguml::t20019::Base" + "participant_id": "1659477498076328530" }, "type": "message" } diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg index c11b1680..b124ccdc 100644 --- a/docs/test_cases/t20019_sequence.svg +++ b/docs/test_cases/t20019_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + Base<D1> - + Base<D1> - - + + D1 - + D1 - - + + Base<D2> - + Base<D2> - - + + D2 - + D2 - - - - - - - - - - + + + + + + + + + + name() - + impl() - + name() - + impl() - + name() - + impl() - + name() - + impl() diff --git a/docs/test_cases/t20020.md b/docs/test_cases/t20020.md index a22d1d0a..9131d727 100644 --- a/docs/test_cases/t20020.md +++ b/docs/test_cases/t20020.md @@ -185,8 +185,7 @@ int tmain() "to": { "activity_id": "43928675765534701", "activity_name": "clanguml::t20020::A::a1()", - "participant_id": "208941846648931609", - "participant_name": "clanguml::t20020::A" + "participant_id": "208941846648931609" }, "type": "message" } @@ -217,8 +216,7 @@ int tmain() "to": { "activity_id": "1289745252290688140", "activity_name": "clanguml::t20020::A::a2()", - "participant_id": "208941846648931609", - "participant_name": "clanguml::t20020::A" + "participant_id": "208941846648931609" }, "type": "message" }, @@ -239,8 +237,7 @@ int tmain() "to": { "activity_id": "1303438784842196201", "activity_name": "clanguml::t20020::C::c3(int)", - "participant_id": "1562462306909405383", - "participant_name": "clanguml::t20020::C" + "participant_id": "1562462306909405383" }, "type": "message" }, @@ -261,8 +258,7 @@ int tmain() "to": { "activity_id": "542196582335607343", "activity_name": "clanguml::t20020::B::b1()", - "participant_id": "1342563483612170412", - "participant_name": "clanguml::t20020::B" + "participant_id": "1342563483612170412" }, "type": "message" } @@ -288,8 +284,7 @@ int tmain() "to": { "activity_id": "1983660679554669898", "activity_name": "clanguml::t20020::A::a3()", - "participant_id": "208941846648931609", - "participant_name": "clanguml::t20020::A" + "participant_id": "208941846648931609" }, "type": "message" }, @@ -310,8 +305,7 @@ int tmain() "to": { "activity_id": "505760236964179187", "activity_name": "clanguml::t20020::B::b2()", - "participant_id": "1342563483612170412", - "participant_name": "clanguml::t20020::B" + "participant_id": "1342563483612170412" }, "type": "message" } @@ -339,8 +333,7 @@ int tmain() "to": { "activity_id": "20573198999978866", "activity_name": "clanguml::t20020::A::a4()", - "participant_id": "208941846648931609", - "participant_name": "clanguml::t20020::A" + "participant_id": "208941846648931609" }, "type": "message" } @@ -368,8 +361,7 @@ int tmain() "to": { "activity_id": "1436250788704205026", "activity_name": "clanguml::t20020::B::log()", - "participant_id": "1342563483612170412", - "participant_name": "clanguml::t20020::B" + "participant_id": "1342563483612170412" }, "type": "message" }, @@ -395,8 +387,7 @@ int tmain() "to": { "activity_id": "1962953889020699702", "activity_name": "clanguml::t20020::C::c1()", - "participant_id": "1562462306909405383", - "participant_name": "clanguml::t20020::C" + "participant_id": "1562462306909405383" }, "type": "message" }, @@ -409,8 +400,7 @@ int tmain() "from": { "activity_id": "1962953889020699702", "activity_name": "clanguml::t20020::C::c1()", - "participant_id": "1562462306909405383", - "participant_name": "clanguml::t20020::C" + "participant_id": "1562462306909405383" }, "name": "c2()", "return_type": "_Bool", @@ -422,8 +412,7 @@ int tmain() "to": { "activity_id": "1224151733617799047", "activity_name": "clanguml::t20020::C::c2()", - "participant_id": "1562462306909405383", - "participant_name": "clanguml::t20020::C" + "participant_id": "1562462306909405383" }, "type": "message" }, @@ -431,8 +420,7 @@ int tmain() "from": { "activity_id": "1962953889020699702", "activity_name": "clanguml::t20020::C::c1()", - "participant_id": "1562462306909405383", - "participant_name": "clanguml::t20020::C" + "participant_id": "1562462306909405383" }, "name": "log()", "return_type": "void", @@ -444,8 +432,7 @@ int tmain() "to": { "activity_id": "1108114094862697094", "activity_name": "clanguml::t20020::C::log()", - "participant_id": "1562462306909405383", - "participant_name": "clanguml::t20020::C" + "participant_id": "1562462306909405383" }, "type": "message" } @@ -485,8 +472,7 @@ int tmain() "to": { "activity_id": "1780002010052842766", "activity_name": "clanguml::t20020::D::d1(int,int)", - "participant_id": "1605914310746811866", - "participant_name": "clanguml::t20020::D" + "participant_id": "1605914310746811866" }, "type": "message" } diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index 589448fb..d8b5ed9b 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,78 +9,78 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + C - + C - - + + B - + B - - + + D<int> - + D<int> - - - - - - - - - - - - - + + + + + + + + + + + + + alt - + a1() @@ -91,7 +91,7 @@ alt - + [ @@ -100,7 +100,7 @@ - + [ @@ -109,7 +109,7 @@ - + b1() @@ -117,7 +117,7 @@ - + [ @@ -126,21 +126,21 @@ - + b2() - + a4() - + log() @@ -148,7 +148,7 @@ alt - + c1() @@ -156,7 +156,7 @@ alt - + @@ -169,7 +169,7 @@ - + @@ -179,7 +179,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20021.md b/docs/test_cases/t20021.md index 5fcf502e..835556b0 100644 --- a/docs/test_cases/t20021.md +++ b/docs/test_cases/t20021.md @@ -145,8 +145,7 @@ int tmain() "to": { "activity_id": "124927877622321176", "activity_name": "clanguml::t20021::C::c4()", - "participant_id": "451128000259357438", - "participant_name": "clanguml::t20021::C" + "participant_id": "451128000259357438" }, "type": "message" }, @@ -154,8 +153,7 @@ int tmain() "from": { "activity_id": "124927877622321176", "activity_name": "clanguml::t20021::C::c4()", - "participant_id": "451128000259357438", - "participant_name": "clanguml::t20021::C" + "participant_id": "451128000259357438" }, "name": "c5()", "return_type": "int", @@ -167,8 +165,7 @@ int tmain() "to": { "activity_id": "1325720714179808628", "activity_name": "clanguml::t20021::C::c5()", - "participant_id": "451128000259357438", - "participant_name": "clanguml::t20021::C" + "participant_id": "451128000259357438" }, "type": "message" }, @@ -189,8 +186,7 @@ int tmain() "to": { "activity_id": "1867955233624891190", "activity_name": "clanguml::t20021::A::a3()", - "participant_id": "1280483607329510730", - "participant_name": "clanguml::t20021::A" + "participant_id": "1280483607329510730" }, "type": "message" }, @@ -217,8 +213,7 @@ int tmain() "to": { "activity_id": "1139294797758415018", "activity_name": "clanguml::t20021::A::a2()", - "participant_id": "1280483607329510730", - "participant_name": "clanguml::t20021::A" + "participant_id": "1280483607329510730" }, "type": "message" }, @@ -239,8 +234,7 @@ int tmain() "to": { "activity_id": "2143764740072323303", "activity_name": "clanguml::t20021::C::c1()", - "participant_id": "451128000259357438", - "participant_name": "clanguml::t20021::C" + "participant_id": "451128000259357438" }, "type": "message" }, @@ -261,8 +255,7 @@ int tmain() "to": { "activity_id": "1707693479408501017", "activity_name": "clanguml::t20021::C::c2()", - "participant_id": "451128000259357438", - "participant_name": "clanguml::t20021::C" + "participant_id": "451128000259357438" }, "type": "message" }, @@ -283,8 +276,7 @@ int tmain() "to": { "activity_id": "1659488549696810992", "activity_name": "clanguml::t20021::A::a1()", - "participant_id": "1280483607329510730", - "participant_name": "clanguml::t20021::A" + "participant_id": "1280483607329510730" }, "type": "message" } @@ -309,8 +301,7 @@ int tmain() "to": { "activity_id": "1302892753246800390", "activity_name": "clanguml::t20021::C::c3()", - "participant_id": "451128000259357438", - "participant_name": "clanguml::t20021::C" + "participant_id": "451128000259357438" }, "type": "message" } @@ -342,8 +333,7 @@ int tmain() "to": { "activity_id": "1387752719733375782", "activity_name": "clanguml::t20021::B::b2()", - "participant_id": "1849696080443395393", - "participant_name": "clanguml::t20021::B" + "participant_id": "1849696080443395393" }, "type": "message" } @@ -371,8 +361,7 @@ int tmain() "to": { "activity_id": "814405216385697964", "activity_name": "clanguml::t20021::C::contents()", - "participant_id": "451128000259357438", - "participant_name": "clanguml::t20021::C" + "participant_id": "451128000259357438" }, "type": "message" } @@ -397,8 +386,7 @@ int tmain() "to": { "activity_id": "1387752719733375782", "activity_name": "clanguml::t20021::B::b2()", - "participant_id": "1849696080443395393", - "participant_name": "clanguml::t20021::B" + "participant_id": "1849696080443395393" }, "type": "message" } diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index 24e6a231..c58193db 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + C - + C - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + loop - + [ c4() ] - + @@ -89,7 +89,7 @@ - + a3() @@ -102,7 +102,7 @@ loop - + [ @@ -111,7 +111,7 @@ - + [ @@ -120,7 +120,7 @@ - + [ @@ -129,14 +129,14 @@ - + a1() - + [ @@ -148,7 +148,7 @@ loop - + b2() @@ -158,7 +158,7 @@ loop - + [ @@ -167,7 +167,7 @@ - + b2() diff --git a/docs/test_cases/t20022.md b/docs/test_cases/t20022.md index e9e6cc89..d6143bde 100644 --- a/docs/test_cases/t20022.md +++ b/docs/test_cases/t20022.md @@ -113,8 +113,7 @@ int tmain() "to": { "activity_id": "1158824701633811441", "activity_name": "clanguml::t20022::A::a()", - "participant_id": "1535467498096081224", - "participant_name": "clanguml::t20022::A" + "participant_id": "1535467498096081224" }, "type": "message" }, @@ -122,8 +121,7 @@ int tmain() "from": { "activity_id": "1158824701633811441", "activity_name": "clanguml::t20022::A::a()", - "participant_id": "1535467498096081224", - "participant_name": "clanguml::t20022::A" + "participant_id": "1535467498096081224" }, "name": "b()", "return_type": "void", @@ -135,8 +133,7 @@ int tmain() "to": { "activity_id": "2114222968575993291", "activity_name": "clanguml::t20022::B::b()", - "participant_id": "1316821731069034940", - "participant_name": "clanguml::t20022::B" + "participant_id": "1316821731069034940" }, "type": "message" } diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index aa3eb6e5..c434fa59 100644 --- a/docs/test_cases/t20022_sequence.svg +++ b/docs/test_cases/t20022_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - + + + + a() - + b() diff --git a/docs/test_cases/t20023.md b/docs/test_cases/t20023.md index 4eeb48e2..ea8a3c9d 100644 --- a/docs/test_cases/t20023.md +++ b/docs/test_cases/t20023.md @@ -107,8 +107,7 @@ int tmain() "to": { "activity_id": "530651320277188697", "activity_name": "clanguml::t20023::A::a()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "type": "message" }, @@ -121,8 +120,7 @@ int tmain() "from": { "activity_id": "530651320277188697", "activity_name": "clanguml::t20023::A::a()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "name": "a1()", "return_type": "int", @@ -134,8 +132,7 @@ int tmain() "to": { "activity_id": "94135113932519208", "activity_name": "clanguml::t20023::A::a1()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "type": "message" } @@ -148,8 +145,7 @@ int tmain() "from": { "activity_id": "530651320277188697", "activity_name": "clanguml::t20023::A::a()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "name": "a2()", "return_type": "int", @@ -161,8 +157,7 @@ int tmain() "to": { "activity_id": "2060438178899014465", "activity_name": "clanguml::t20023::A::a2()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "type": "message" } @@ -175,8 +170,7 @@ int tmain() "from": { "activity_id": "530651320277188697", "activity_name": "clanguml::t20023::A::a()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "name": "a3()", "return_type": "int", @@ -188,8 +182,7 @@ int tmain() "to": { "activity_id": "1776927259621603017", "activity_name": "clanguml::t20023::A::a3()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "type": "message" } @@ -202,8 +195,7 @@ int tmain() "from": { "activity_id": "530651320277188697", "activity_name": "clanguml::t20023::A::a()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "name": "a4()", "return_type": "int", @@ -215,8 +207,7 @@ int tmain() "to": { "activity_id": "1082587698374248813", "activity_name": "clanguml::t20023::A::a4()", - "participant_id": "750638294800359616", - "participant_name": "clanguml::t20023::A" + "participant_id": "750638294800359616" }, "type": "message" } diff --git a/docs/test_cases/t20023_sequence.svg b/docs/test_cases/t20023_sequence.svg index 49ff7c9b..50932c6a 100644 --- a/docs/test_cases/t20023_sequence.svg +++ b/docs/test_cases/t20023_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - + + + + + + + a() @@ -47,7 +47,7 @@ try - + @@ -60,7 +60,7 @@ [std::runtime_error &] - + @@ -73,7 +73,7 @@ [std::logic_error &] - + @@ -86,7 +86,7 @@ [...] - + diff --git a/docs/test_cases/t20024.md b/docs/test_cases/t20024.md index 60ff1377..8581de79 100644 --- a/docs/test_cases/t20024.md +++ b/docs/test_cases/t20024.md @@ -141,8 +141,7 @@ int tmain() "to": { "activity_id": "1200587047701031901", "activity_name": "clanguml::t20024::A::select(enum_a)", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "type": "message" }, @@ -155,8 +154,7 @@ int tmain() "from": { "activity_id": "1200587047701031901", "activity_name": "clanguml::t20024::A::select(enum_a)", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "name": "a0()", "return_type": "int", @@ -168,8 +166,7 @@ int tmain() "to": { "activity_id": "1859614580641799156", "activity_name": "clanguml::t20024::A::a0()", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "type": "message" } @@ -183,8 +180,7 @@ int tmain() "from": { "activity_id": "1200587047701031901", "activity_name": "clanguml::t20024::A::select(enum_a)", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "name": "a1()", "return_type": "int", @@ -196,8 +192,7 @@ int tmain() "to": { "activity_id": "501598940454911460", "activity_name": "clanguml::t20024::A::a1()", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "type": "message" } @@ -211,8 +206,7 @@ int tmain() "from": { "activity_id": "1200587047701031901", "activity_name": "clanguml::t20024::A::select(enum_a)", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "name": "a2()", "return_type": "int", @@ -224,8 +218,7 @@ int tmain() "to": { "activity_id": "1698866541173753340", "activity_name": "clanguml::t20024::A::a2()", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "type": "message" } @@ -239,8 +232,7 @@ int tmain() "from": { "activity_id": "1200587047701031901", "activity_name": "clanguml::t20024::A::select(enum_a)", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "name": "a3()", "return_type": "int", @@ -252,8 +244,7 @@ int tmain() "to": { "activity_id": "490376438551958259", "activity_name": "clanguml::t20024::A::a3()", - "participant_id": "40786919835708828", - "participant_name": "clanguml::t20024::A" + "participant_id": "40786919835708828" }, "type": "message" } @@ -282,8 +273,7 @@ int tmain() "to": { "activity_id": "286108218156977422", "activity_name": "clanguml::t20024::B::select(colors)", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "type": "message" }, @@ -296,8 +286,7 @@ int tmain() "from": { "activity_id": "286108218156977422", "activity_name": "clanguml::t20024::B::select(colors)", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "name": "red()", "return_type": "void", @@ -309,8 +298,7 @@ int tmain() "to": { "activity_id": "112014563206084467", "activity_name": "clanguml::t20024::B::red()", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "type": "message" } @@ -324,8 +312,7 @@ int tmain() "from": { "activity_id": "286108218156977422", "activity_name": "clanguml::t20024::B::select(colors)", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "name": "orange()", "return_type": "void", @@ -337,8 +324,7 @@ int tmain() "to": { "activity_id": "2222823236498505185", "activity_name": "clanguml::t20024::B::orange()", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "type": "message" } @@ -352,8 +338,7 @@ int tmain() "from": { "activity_id": "286108218156977422", "activity_name": "clanguml::t20024::B::select(colors)", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "name": "green()", "return_type": "void", @@ -365,8 +350,7 @@ int tmain() "to": { "activity_id": "519021723720658376", "activity_name": "clanguml::t20024::B::green()", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "type": "message" } @@ -380,8 +364,7 @@ int tmain() "from": { "activity_id": "286108218156977422", "activity_name": "clanguml::t20024::B::select(colors)", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "name": "grey()", "return_type": "void", @@ -393,8 +376,7 @@ int tmain() "to": { "activity_id": "1813557671878544737", "activity_name": "clanguml::t20024::B::grey()", - "participant_id": "933287014626440872", - "participant_name": "clanguml::t20024::B" + "participant_id": "933287014626440872" }, "type": "message" } diff --git a/docs/test_cases/t20024_sequence.svg b/docs/test_cases/t20024_sequence.svg index 6b131bba..f5d81b7a 100644 --- a/docs/test_cases/t20024_sequence.svg +++ b/docs/test_cases/t20024_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -33,36 +33,36 @@ - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + select(enum_a) @@ -72,7 +72,7 @@ switch [zero] - + @@ -85,7 +85,7 @@ [one] - + @@ -98,7 +98,7 @@ [two] - + @@ -111,7 +111,7 @@ [default] - + @@ -124,7 +124,7 @@ - + select(colors) @@ -134,7 +134,7 @@ switch [enum colors::red] - + @@ -143,7 +143,7 @@ [enum colors::orange] - + @@ -152,7 +152,7 @@ [enum colors::green] - + @@ -161,7 +161,7 @@ [default] - + diff --git a/docs/test_cases/t20025.md b/docs/test_cases/t20025.md index a72f0615..0d26f510 100644 --- a/docs/test_cases/t20025.md +++ b/docs/test_cases/t20025.md @@ -121,8 +121,7 @@ int tmain() "to": { "activity_id": "1119830104994271584", "activity_name": "clanguml::t20025::A::a()", - "participant_id": "2144852170258286289", - "participant_name": "clanguml::t20025::A" + "participant_id": "2144852170258286289" }, "type": "message" }, @@ -130,8 +129,7 @@ int tmain() "from": { "activity_id": "1119830104994271584", "activity_name": "clanguml::t20025::A::a()", - "participant_id": "2144852170258286289", - "participant_name": "clanguml::t20025::A" + "participant_id": "2144852170258286289" }, "name": "a2()", "return_type": "void", @@ -143,8 +141,7 @@ int tmain() "to": { "activity_id": "2059622670024664066", "activity_name": "clanguml::t20025::A::a2()", - "participant_id": "2144852170258286289", - "participant_name": "clanguml::t20025::A" + "participant_id": "2144852170258286289" }, "type": "message" }, @@ -165,8 +162,7 @@ int tmain() "to": { "activity_id": "228843323046630374", "activity_name": "clanguml::t20025::add(int,int)", - "participant_id": "228843323046630374", - "participant_name": "clanguml::t20025::add(int,int)" + "participant_id": "228843323046630374" }, "type": "message" } diff --git a/docs/test_cases/t20025_sequence.svg b/docs/test_cases/t20025_sequence.svg index cf298ae3..713acf04 100644 --- a/docs/test_cases/t20025_sequence.svg +++ b/docs/test_cases/t20025_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,41 +9,41 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + add(int,int) - + add(int,int) - - - - - + + + + + a() - + @@ -52,7 +52,7 @@ - + diff --git a/docs/test_cases/t20026.md b/docs/test_cases/t20026.md index 0c037d13..71cacbec 100644 --- a/docs/test_cases/t20026.md +++ b/docs/test_cases/t20026.md @@ -92,8 +92,7 @@ int tmain() "to": { "activity_id": "600590770418147864", "activity_name": "clanguml::t20026::A::a()", - "participant_id": "1962121823853291899", - "participant_name": "clanguml::t20026::A" + "participant_id": "1962121823853291899" }, "type": "message" } diff --git a/docs/test_cases/t20026_sequence.svg b/docs/test_cases/t20026_sequence.svg index e5081fbe..9023d066 100644 --- a/docs/test_cases/t20026_sequence.svg +++ b/docs/test_cases/t20026_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20027.md b/docs/test_cases/t20027.md index 345a1ad5..18831ed1 100644 --- a/docs/test_cases/t20027.md +++ b/docs/test_cases/t20027.md @@ -91,8 +91,7 @@ void tmain() "to": { "activity_id": "910514967786202717", "activity_name": "clanguml::t20027::A::a()", - "participant_id": "583525629936262089", - "participant_name": "clanguml::t20027::A" + "participant_id": "583525629936262089" }, "type": "message" } diff --git a/docs/test_cases/t20027_sequence.svg b/docs/test_cases/t20027_sequence.svg index f2a3cc34..03a9f2f2 100644 --- a/docs/test_cases/t20027_sequence.svg +++ b/docs/test_cases/t20027_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20028.md b/docs/test_cases/t20028.md index a02f5ae9..2410d623 100644 --- a/docs/test_cases/t20028.md +++ b/docs/test_cases/t20028.md @@ -106,8 +106,7 @@ int tmain() "to": { "activity_id": "666210834901940781", "activity_name": "clanguml::t20028::A::a()", - "participant_id": "2073479923903128898", - "participant_name": "clanguml::t20028::A" + "participant_id": "2073479923903128898" }, "type": "message" }, @@ -128,8 +127,7 @@ int tmain() "to": { "activity_id": "793793464184037795", "activity_name": "clanguml::t20028::A::b()", - "participant_id": "2073479923903128898", - "participant_name": "clanguml::t20028::A" + "participant_id": "2073479923903128898" }, "type": "message" }, @@ -150,8 +148,7 @@ int tmain() "to": { "activity_id": "1582152567698110078", "activity_name": "clanguml::t20028::A::c()", - "participant_id": "2073479923903128898", - "participant_name": "clanguml::t20028::A" + "participant_id": "2073479923903128898" }, "type": "message" } @@ -177,8 +174,7 @@ int tmain() "to": { "activity_id": "1178268687951492696", "activity_name": "clanguml::t20028::A::d()", - "participant_id": "2073479923903128898", - "participant_name": "clanguml::t20028::A" + "participant_id": "2073479923903128898" }, "type": "message" } diff --git a/docs/test_cases/t20028_sequence.svg b/docs/test_cases/t20028_sequence.svg index d3f4e627..79b1c953 100644 --- a/docs/test_cases/t20028_sequence.svg +++ b/docs/test_cases/t20028_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,50 +9,50 @@ - - - - - - + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - + + + + + alt - + a() - + b() - + c() @@ -60,7 +60,7 @@ - + d() diff --git a/docs/test_cases/t20029.md b/docs/test_cases/t20029.md index 5dc92331..68148a2a 100644 --- a/docs/test_cases/t20029.md +++ b/docs/test_cases/t20029.md @@ -172,8 +172,7 @@ int tmain() "to": { "activity_id": "940428568182104530", "activity_name": "clanguml::t20029::ConnectionPool::connect()", - "participant_id": "1896406205097618937", - "participant_name": "clanguml::t20029::ConnectionPool" + "participant_id": "1896406205097618937" }, "type": "message" }, @@ -202,8 +201,7 @@ int tmain() "to": { "activity_id": "2026763864005979273", "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", - "participant_id": "1673261195873192383", - "participant_name": "clanguml::t20029::Encoder>" + "participant_id": "1673261195873192383" }, "type": "message" }, @@ -211,8 +209,7 @@ int tmain() "from": { "activity_id": "2026763864005979273", "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", - "participant_id": "1673261195873192383", - "participant_name": "clanguml::t20029::Encoder>" + "participant_id": "1673261195873192383" }, "name": "encode(std::string &&)", "return_type": "std::string", @@ -224,8 +221,7 @@ int tmain() "to": { "activity_id": "1468258269466480773", "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", - "participant_id": "1673261195873192383", - "participant_name": "clanguml::t20029::Encoder>" + "participant_id": "1673261195873192383" }, "type": "message" }, @@ -233,8 +229,7 @@ int tmain() "from": { "activity_id": "1468258269466480773", "activity_name": "clanguml::t20029::Encoder>::encode(std::string &&)", - "participant_id": "1673261195873192383", - "participant_name": "clanguml::t20029::Encoder>" + "participant_id": "1673261195873192383" }, "name": "", "return_type": "", @@ -246,8 +241,7 @@ int tmain() "to": { "activity_id": "1362646431260879440", "activity_name": "clanguml::t20029::encode_b64(std::string &&)", - "participant_id": "1362646431260879440", - "participant_name": "clanguml::t20029::encode_b64(std::string &&)" + "participant_id": "1362646431260879440" }, "type": "message" }, @@ -255,8 +249,7 @@ int tmain() "from": { "activity_id": "2026763864005979273", "activity_name": "clanguml::t20029::Encoder>::send(std::string &&)", - "participant_id": "1673261195873192383", - "participant_name": "clanguml::t20029::Encoder>" + "participant_id": "1673261195873192383" }, "name": "send(std::string &&)", "return_type": "_Bool", @@ -268,8 +261,7 @@ int tmain() "to": { "activity_id": "30515971485361302", "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", - "participant_id": "658058855590948094", - "participant_name": "clanguml::t20029::Retrier" + "participant_id": "658058855590948094" }, "type": "message" }, @@ -285,8 +277,7 @@ int tmain() "from": { "activity_id": "30515971485361302", "activity_name": "clanguml::t20029::Retrier::send(std::string &&)", - "participant_id": "658058855590948094", - "participant_name": "clanguml::t20029::Retrier" + "participant_id": "658058855590948094" }, "name": "send(const std::string &)", "return_type": "_Bool", @@ -298,8 +289,7 @@ int tmain() "to": { "activity_id": "972625940114169157", "activity_name": "clanguml::t20029::ConnectionPool::send(const std::string &)", - "participant_id": "1896406205097618937", - "participant_name": "clanguml::t20029::ConnectionPool" + "participant_id": "1896406205097618937" }, "type": "message" } diff --git a/docs/test_cases/t20029_sequence.svg b/docs/test_cases/t20029_sequence.svg index 428f0973..9b98034c 100644 --- a/docs/test_cases/t20029_sequence.svg +++ b/docs/test_cases/t20029_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,60 +9,60 @@ - - - - - - - - - - - + + + + + + + + + + + - - + + tmain() - + tmain() - - + + Encoder<Retrier<ConnectionPool>> - + Encoder<Retrier<ConnectionPool>> - - + + Retrier<ConnectionPool> - + Retrier<ConnectionPool> - - + + ConnectionPool - + ConnectionPool - - + + encode_b64(std::string &&) - + encode_b64(std::string &&) - - - - - - - - + + + + + + + + connect() @@ -73,21 +73,21 @@ alt - + [ send(std::string &&) ] - + encode(std::string &&) - + @@ -97,7 +97,7 @@ - + send(std::string &&) @@ -108,7 +108,7 @@ alt - + [ diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 9ae8b415..618bb949 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + A - - + + AA - - + + B - - + + AA - - + + AAA - - + + BBB - - + + BB - - + + AAA - - + + BBB - - + + BB - + A AAA note... - + This is namespace AA in namespace A - + This is namespace AA in namespace B diff --git a/docs/test_cases/t30002.md b/docs/test_cases/t30002.md index 357e11f0..58ff65e6 100644 --- a/docs/test_cases/t30002.md +++ b/docs/test_cases/t30002.md @@ -397,103 +397,86 @@ template std::map> cm() "name": "t30002_package", "relationships": [ { - "access": "public", "destination": "301858476377711436", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "1207764290216680521", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "563861734550555261", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "839146342143718390", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "1650835159458422245", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "1164966689017271053", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "695366113361481509", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "1267709074800873528", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "299262817531370604", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "561239706327729436", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "1415398383158410524", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "532437874530119999", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "899091126727901939", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "1453242941322376182", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "384833776371876986", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "1199527037490355138", "source": "2255521339657425355", "type": "dependency" }, { - "access": "public", "destination": "620689743711615190", "source": "2255521339657425355", "type": "dependency" diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg index aa760946..7dded662 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,113 +9,113 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + BBB diff --git a/docs/test_cases/t30003.md b/docs/test_cases/t30003.md index 1b926eea..0d0171cf 100644 --- a/docs/test_cases/t30003.md +++ b/docs/test_cases/t30003.md @@ -131,13 +131,11 @@ class B : public ns1::ns2::Anon { }; "name": "t30003_package", "relationships": [ { - "access": "public", "destination": "820462660523726751", "source": "427104404739526818", "type": "dependency" }, { - "access": "public", "destination": "647755950450743637", "source": "820462660523726751", "type": "dependency" diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 8405efa9..f3160539 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,35 @@ - - + + ns1 - - + + ns3 «deprecated» - - + + ns1 - - + + ns2_v1_0_0 - - + + ns2_v0_9_0 «deprecated» - - + + ns2 diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg index ac0952e0..edd7fc2a 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30005.md b/docs/test_cases/t30005.md index fbbe02ef..c1224fe5 100644 --- a/docs/test_cases/t30005.md +++ b/docs/test_cases/t30005.md @@ -170,13 +170,11 @@ struct C2 { "name": "t30005_package", "relationships": [ { - "access": "public", "destination": "914090901927655181", "source": "1871026935460001668", "type": "dependency" }, { - "access": "public", "destination": "914090901927655181", "source": "1763279540133487999", "type": "dependency" diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 667219f3..c571a8f8 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,48 +9,48 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + C - - + + CC - - + + AAA - - + + BBB - - + + CCC diff --git a/docs/test_cases/t30006.md b/docs/test_cases/t30006.md index 2c783572..8b1a4625 100644 --- a/docs/test_cases/t30006.md +++ b/docs/test_cases/t30006.md @@ -96,13 +96,11 @@ struct A2 { "name": "t30006_package", "relationships": [ { - "access": "public", "destination": "1659090172211944144", "source": "1499919423527579699", "type": "dependency" }, { - "access": "public", "destination": "1380567463986115369", "source": "1499919423527579699", "type": "dependency" diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg index b593cdbe..ba240342 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30007.md b/docs/test_cases/t30007.md index a0c5c263..7875f4c2 100644 --- a/docs/test_cases/t30007.md +++ b/docs/test_cases/t30007.md @@ -117,13 +117,11 @@ struct A2 { "name": "t30007_package", "relationships": [ { - "access": "public", "destination": "1852704221005355550", "source": "357722505818238170", "type": "dependency" }, { - "access": "public", "destination": "937791537887318363", "source": "357722505818238170", "type": "dependency" diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index d5477fa6..c005cd28 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30008.md b/docs/test_cases/t30008.md index 54a32b17..3b39a8c4 100644 --- a/docs/test_cases/t30008.md +++ b/docs/test_cases/t30008.md @@ -193,25 +193,21 @@ struct FF { "name": "t30008_package", "relationships": [ { - "access": "public", "destination": "2096441629244782012", "source": "500208250168931957", "type": "dependency" }, { - "access": "public", "destination": "500208250168931957", "source": "1095841247154575825", "type": "dependency" }, { - "access": "public", "destination": "912387297717034254", "source": "1114997990364518938", "type": "dependency" }, { - "access": "public", "destination": "1114997990364518938", "source": "1062827161678172094", "type": "dependency" diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index e17827b0..9b6dc74f 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F diff --git a/docs/test_cases/t30009_package.svg b/docs/test_cases/t30009_package.svg index 08b5acab..03e2b4e6 100644 --- a/docs/test_cases/t30009_package.svg +++ b/docs/test_cases/t30009_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + One - - + + Two - - + + B - - + + D - - + + A - - + + C - - + + A - - + + B - - + + C - - + + D diff --git a/docs/test_cases/t40001.md b/docs/test_cases/t40001.md index ef8bd71f..c04d3727 100644 --- a/docs/test_cases/t40001.md +++ b/docs/test_cases/t40001.md @@ -103,37 +103,31 @@ diagrams: "name": "t40001_include", "relationships": [ { - "access": "public", "destination": "1687197357150905926", "source": "1755015016680017839", "type": "dependency" }, { - "access": "public", "destination": "405203884025072971", "source": "1755015016680017839", "type": "dependency" }, { - "access": "public", "destination": "1926692816440595520", "source": "1755015016680017839", "type": "association" }, { - "access": "public", "destination": "2193549214042244690", "source": "1926692816440595520", "type": "association" }, { - "access": "public", "destination": "1659736894483045485", "source": "1926692816440595520", "type": "dependency" }, { - "access": "public", "destination": "1687197357150905926", "source": "1926692816440595520", "type": "dependency" diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index 14caaed2..e066b65f 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + yaml-cpp/yaml.h - + This is a lib1 include dir - + This is a t40001_include1.h include file diff --git a/docs/test_cases/t40002.md b/docs/test_cases/t40002.md index 7f2da126..e5b37af6 100644 --- a/docs/test_cases/t40002.md +++ b/docs/test_cases/t40002.md @@ -121,31 +121,26 @@ diagrams: "name": "t40002_include", "relationships": [ { - "access": "public", "destination": "2193549214042244690", "source": "1489450289909741706", "type": "association" }, { - "access": "public", "destination": "1969674835696841438", "source": "1489450289909741706", "type": "association" }, { - "access": "public", "destination": "2193549214042244690", "source": "1493913207373215402", "type": "association" }, { - "access": "public", "destination": "1969674835696841438", "source": "1761875020766116446", "type": "association" }, { - "access": "public", "destination": "1969674835696841438", "source": "2193549214042244690", "type": "association" diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index e184123c..7b5ffe57 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - + src - + lib1 - + lib2 - + include - + lib1 - + lib2 - - + + t40002.cc - - + + lib1.cc - - + + lib2.cc - - + + lib1.h - - + + lib2.h diff --git a/docs/test_cases/t40003.md b/docs/test_cases/t40003.md index a9c088ef..6355e2ba 100644 --- a/docs/test_cases/t40003.md +++ b/docs/test_cases/t40003.md @@ -147,55 +147,46 @@ diagrams: "name": "t40003_include", "relationships": [ { - "access": "public", "destination": "60001020671836182", "source": "1215324434184692437", "type": "association" }, { - "access": "public", "destination": "1882940911178525353", "source": "1215324434184692437", "type": "association" }, { - "access": "public", "destination": "1226843223635488673", "source": "2215849176605856058", "type": "association" }, { - "access": "public", "destination": "2106129159239499468", "source": "2215849176605856058", "type": "association" }, { - "access": "public", "destination": "1921842892192045013", "source": "60001020671836182", "type": "association" }, { - "access": "public", "destination": "2295271780650013565", "source": "1921842892192045013", "type": "association" }, { - "access": "public", "destination": "1849348825646635129", "source": "1226843223635488673", "type": "association" }, { - "access": "public", "destination": "1120257488305564427", "source": "1849348825646635129", "type": "association" }, { - "access": "public", "destination": "1120257488305564427", "source": "2106129159239499468", "type": "association" diff --git a/docs/test_cases/t40003_include.svg b/docs/test_cases/t40003_include.svg index cb1d7c74..9d58ebcc 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + src - + dependants - + dependencies - + include - + dependants - + dependencies - - + + t1.cc - - + + t2.cc - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h From 017fc7025bf72781ffb79b65a8eb611c57f8e327 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 26 Mar 2023 00:43:35 +0100 Subject: [PATCH 30/30] Fixed json generator selector --- src/common/generators/generators.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/generators/generators.cc b/src/common/generators/generators.cc index 748460d4..83d1f5c1 100644 --- a/src/common/generators/generators.cc +++ b/src/common/generators/generators.cc @@ -62,8 +62,8 @@ void generate_diagram_select_generator(const std::string &od, const std::string &name, std::shared_ptr diagram, const DiagramModel &model) { - using diagram_generator = typename diagram_generator_t::type; + using diagram_generator = + typename diagram_generator_t::type; auto path = std::filesystem::path{od} / fmt::format("{}.{}", name, GeneratorTag::extension);