@@ -118,6 +118,111 @@ common::optional_ref<clanguml::common::model::diagram_element> diagram::get(
118118 return res;
119119}
120120
121+ void diagram::add_class (std::unique_ptr<class_> &&c)
122+ {
123+ assert (c->id ().value () != 0 );
124+
125+ if ((config ().generate_packages () &&
126+ config ().package_type () == config::package_type_t ::kDirectory )) {
127+ assert (!c->file ().empty ());
128+
129+ const auto file = config ().make_path_relative (c->file ());
130+
131+ common::model::path p{
132+ file.string (), common::model::path_type::kFilesystem };
133+ p.pop_back ();
134+
135+ add (p, std::move (c));
136+ }
137+ else if ((config ().generate_packages () &&
138+ config ().package_type () == config::package_type_t ::kModule )) {
139+
140+ const auto module_path = config ().make_module_relative (c->module ());
141+
142+ common::model::path p{module_path, common::model::path_type::kModule };
143+
144+ add (p, std::move (c));
145+ }
146+ else {
147+ add (c->path (), std::move (c));
148+ }
149+ }
150+
151+ void diagram::add_objc_interface (std::unique_ptr<objc_interface> &&c)
152+ {
153+ if ((config ().generate_packages () &&
154+ config ().package_type () == config::package_type_t ::kDirectory )) {
155+ assert (!c->file ().empty ());
156+
157+ const auto file = config ().make_path_relative (c->file ());
158+
159+ common::model::path p{
160+ file.string (), common::model::path_type::kFilesystem };
161+ p.pop_back ();
162+
163+ add (p, std::move (c));
164+ }
165+ else {
166+ add (c->path (), std::move (c));
167+ }
168+ }
169+
170+ void diagram::add_enum (std::unique_ptr<enum_> &&e)
171+ {
172+ if ((config ().generate_packages () &&
173+ config ().package_type () == config::package_type_t ::kDirectory )) {
174+ assert (!e->file ().empty ());
175+
176+ const auto file = config ().make_path_relative (e->file ());
177+
178+ common::model::path p{
179+ file.string (), common::model::path_type::kFilesystem };
180+ p.pop_back ();
181+
182+ add (p, std::move (e));
183+ }
184+ else if ((config ().generate_packages () &&
185+ config ().package_type () == config::package_type_t ::kModule )) {
186+
187+ const auto module_path = config ().make_module_relative (e->module ());
188+
189+ common::model::path p{module_path, common::model::path_type::kModule };
190+
191+ add (p, std::move (e));
192+ }
193+ else {
194+ add (e->path (), std::move (e));
195+ }
196+ }
197+
198+ void diagram::add_concept (std::unique_ptr<concept_> &&c)
199+ {
200+ if ((config ().generate_packages () &&
201+ config ().package_type () == config::package_type_t ::kDirectory )) {
202+ assert (!c->file ().empty ());
203+
204+ const auto file = config ().make_path_relative (c->file ());
205+
206+ common::model::path p{
207+ file.string (), common::model::path_type::kFilesystem };
208+ p.pop_back ();
209+
210+ add (p, std::move (c));
211+ }
212+ else if ((config ().generate_packages () &&
213+ config ().package_type () == config::package_type_t ::kModule )) {
214+
215+ const auto module_path = config ().make_module_relative (c->module ());
216+
217+ common::model::path p{module_path, common::model::path_type::kModule };
218+
219+ add (p, std::move (c));
220+ }
221+ else {
222+ add (c->path (), std::move (c));
223+ }
224+ }
225+
121226template <>
122227bool diagram::add_with_namespace_path<common::model::package>(
123228 std::unique_ptr<common::model::package> &&p)
0 commit comments