31 const package &p, nlohmann::json &parent)
const
36 if (
model().should_include(relationship_t::kDependency)) {
38 nlohmann::json rel = r;
40 auto destination_package =
model().get(r.destination());
42 if (!destination_package)
45 rel[
"source"] = std::to_string(p.
id().
value());
46 parent[
"relationships"].push_back(std::move(rel));
51 for (
const auto &subpackage : p) {
53 dynamic_cast<const package &
>(*subpackage), parent);
61 const auto &uns =
config().using_namespace();
62 if (!uns.starts_with({p.full_name(false)})) {
64 j[
"id"] = std::to_string(p.
id().
value());
66 j[
"type"] = to_string(
config().package_type());
67 j[
"display_name"] = p.
name();
68 switch (
config().package_type()) {
81 if (!p.
file().empty())
82 j[
"source_location"] =
84 if (
const auto &comment = p.
comment(); comment)
85 j[
"comment"] = comment.value();
87 for (
const auto &subpackage : p) {
88 auto &pkg =
dynamic_cast<package &
>(*subpackage);
92 parent[
"elements"].push_back(std::move(j));
95 for (
const auto &subpackage : p) {
96 auto &pkg =
dynamic_cast<package &
>(*subpackage);
104 if (
config().using_namespace)
105 parent[
"using_namespace"] =
config().using_namespace().to_string();
106 if (
config().using_module)
107 parent[
"using_module"] =
config().using_module();
109 parent[
"name"] =
model().name();
110 parent[
"diagram_type"] =
"package";
111 parent[
"package_type"] = to_string(
config().package_type());
112 parent[
"elements"] = std::vector<nlohmann::json>{};
113 parent[
"relationships"] = std::vector<nlohmann::json>{};
115 for (
const auto &p :
model()) {
116 auto &pkg =
dynamic_cast<package &
>(*p);
121 for (
const auto &p :
model()) {