0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Functions
YAML serialization emitters

Detailed Description

Overloads for YAML serializations for various config types.

Overloads for YAML serializations for various model types.

Functions

YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const config &c)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const inheritable_diagram_options &c)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const filter &f)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const plantuml &p)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const mermaid &p)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const graphml &p)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const method_arguments &ma)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const generate_links_config &glc)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const git_config &gc)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const relationship_hint_t &rh)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const comment_parser_t &cp)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const hint_t &h)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const class_diagram &c)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const sequence_diagram &c)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const include_diagram &c)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const package_diagram &c)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const layout_hint &c)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const element_filter_t &ef)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const diagram_template &dt)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const inja::json &ef)
 
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const source_location &sc)
 
template<typename T >
bool clanguml::config::is_null (const T &)
 
template<>
bool clanguml::config::is_null (const std::string &v)
 
template<>
bool clanguml::config::is_null (const glob_t &v)
 
template<>
bool clanguml::config::is_null (const plantuml &v)
 
template<>
bool clanguml::config::is_null (const mermaid &v)
 
template<>
bool clanguml::config::is_null (const graphml &v)
 
template<>
bool clanguml::config::is_null (const inja::json &v)
 
template<typename T >
YAML::Emitter & clanguml::config::operator<< (YAML::Emitter &out, const option< T > &o)
 
YAML::Emitter & clanguml::common::model::operator<< (YAML::Emitter &out, const namespace_ &n)
 
YAML::Emitter & clanguml::common::model::operator<< (YAML::Emitter &out, const relationship_t &r)
 
YAML::Emitter & clanguml::common::model::operator<< (YAML::Emitter &out, const access_t &r)
 
YAML::Emitter & clanguml::common::model::operator<< (YAML::Emitter &out, const diagram_t &d)
 

Function Documentation

◆ is_null() [1/7]

template<>
bool clanguml::config::is_null ( const glob_t v)

Definition at line 534 of file yaml_emitters.cc.

535{
536 return v.include.empty() && v.exclude.empty();
537}

◆ is_null() [2/7]

template<>
bool clanguml::config::is_null ( const graphml v)

Definition at line 550 of file yaml_emitters.cc.

550{ return v.notes.empty(); }

◆ is_null() [3/7]

template<>
bool clanguml::config::is_null ( const inja::json &  v)

Definition at line 552 of file yaml_emitters.cc.

552{ return v.is_null(); }

◆ is_null() [4/7]

template<>
bool clanguml::config::is_null ( const mermaid v)

Definition at line 545 of file yaml_emitters.cc.

546{
547 return v.before.empty() && v.after.empty() && v.cmd.empty();
548}

◆ is_null() [5/7]

template<>
bool clanguml::config::is_null ( const plantuml v)

Definition at line 539 of file yaml_emitters.cc.

540{
541 return v.before.empty() && v.after.empty() && v.cmd.empty() &&
542 v.style.empty();
543}

◆ is_null() [6/7]

template<>
bool clanguml::config::is_null ( const std::string &  v)

Definition at line 532 of file yaml_emitters.cc.

532{ return v.empty(); }

◆ is_null() [7/7]

template<typename T >
bool clanguml::config::is_null ( const T &  )

Definition at line 935 of file config.h.

935{ return false; }

◆ operator<<() [1/26]

YAML::Emitter & clanguml::common::model::operator<< ( YAML::Emitter &  out,
const access_t r 
)

Definition at line 66 of file yaml_emitters.cc.

67{
68 out << to_string(a);
69 return out;
70}

◆ operator<<() [2/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const class_diagram c 
)

Definition at line 480 of file yaml_emitters.cc.

481{
482 out << YAML::BeginMap;
483 out << YAML::Key << "type" << YAML::Value << c.type();
484 out << c.layout;
485 out << dynamic_cast<const inheritable_diagram_options &>(c);
486 out << YAML::EndMap;
487 return out;
488}

◆ operator<<() [3/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const comment_parser_t cp 
)

Definition at line 263 of file yaml_emitters.cc.

264{
265 out << to_string(cp);
266 return out;
267}

◆ operator<<() [4/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const config c 
)

Definition at line 371 of file yaml_emitters.cc.

372{
373 out << YAML::BeginMap;
374
375 out << c.compilation_database_dir;
376 out << c.output_directory;
377 out << c.query_driver;
378 out << c.add_compile_flags;
379 out << c.remove_compile_flags;
380 out << c.diagram_templates;
381
382 out << dynamic_cast<const inheritable_diagram_options &>(c);
383
384 if (!c.diagrams.empty()) {
385 out << YAML::Key << "diagrams";
386 out << YAML::BeginMap;
387
388 for (const auto &[k, v] : c.diagrams) {
389 out << YAML::Key << k;
390 if (v->type() == common::model::diagram_t::kClass) {
391 out << YAML::Value << dynamic_cast<class_diagram &>(*v);
392 }
393 else if (v->type() == common::model::diagram_t::kSequence) {
394 out << YAML::Value << dynamic_cast<sequence_diagram &>(*v);
395 }
396 else if (v->type() == common::model::diagram_t::kInclude) {
397 out << YAML::Value << dynamic_cast<include_diagram &>(*v);
398 }
399 else if (v->type() == common::model::diagram_t::kPackage) {
400 out << YAML::Value << dynamic_cast<package_diagram &>(*v);
401 }
402 }
403 }
404
405 out << YAML::EndMap;
406 out << YAML::EndMap;
407 return out;
408}

◆ operator<<() [5/26]

YAML::Emitter & clanguml::common::model::operator<< ( YAML::Emitter &  out,
const diagram_t d 
)

Definition at line 78 of file yaml_emitters.cc.

79{
80 out << to_string(d);
81 return out;
82}

◆ operator<<() [6/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const diagram_template dt 
)

Definition at line 319 of file yaml_emitters.cc.

320{
321 out << YAML::BeginMap;
322 out << YAML::Key << "type" << YAML::Value << dt.type;
323 out << YAML::Key << "description" << YAML::Value << dt.description;
324 out << YAML::Key << "template" << YAML::Literal << dt.jinja_template;
325 out << YAML::EndMap;
326
327 return out;
328}

◆ operator<<() [7/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const element_filter_t ef 
)

Definition at line 522 of file yaml_emitters.cc.

523{
524 out << YAML::BeginMap;
525 out << YAML::Key << "type" << YAML::Value << to_string(ef.type);
526 out << YAML::Key << "name" << YAML::Value << ef.name;
527 out << YAML::EndMap;
528
529 return out;
530}

◆ operator<<() [8/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const filter f 
)

Definition at line 126 of file yaml_emitters.cc.

127{
128 out << YAML::BeginMap;
129 if (!f.namespaces.empty())
130 out << YAML::Key << "namespaces" << YAML::Value << f.namespaces;
131 if (!f.modules.empty())
132 out << YAML::Key << "modules" << YAML::Value << f.modules;
133 if (!f.module_access.empty())
134 out << YAML::Key << "module_access" << YAML::Value << f.module_access;
135 if (!f.access.empty())
136 out << YAML::Key << "access" << YAML::Value << f.access;
137 if (!f.context.empty())
138 out << YAML::Key << "context" << YAML::Value << f.context;
139 if (!f.dependants.empty())
140 out << YAML::Key << "dependants" << YAML::Value << f.dependants;
141 if (!f.dependencies.empty())
142 out << YAML::Key << "dependencies" << YAML::Value << f.dependencies;
143 if (!f.elements.empty())
144 out << YAML::Key << "elements" << YAML::Value << f.elements;
145 if (!f.element_types.empty())
146 out << YAML::Key << "element_types" << YAML::Value << f.element_types;
147 if (!f.method_types.empty())
148 out << YAML::Key << "method_types" << YAML::Value << f.method_types;
149 if (!f.paths.empty())
150 out << YAML::Key << "paths" << YAML::Value << f.paths;
151 if (!f.relationships.empty())
152 out << YAML::Key << "relationships" << YAML::Value << f.relationships;
153 if (!f.specializations.empty())
154 out << YAML::Key << "specializations" << YAML::Value
155 << f.specializations;
156 if (!f.subclasses.empty())
157 out << YAML::Key << "subclasses" << YAML::Value << f.subclasses;
158 if (!f.parents.empty())
159 out << YAML::Key << "parents" << YAML::Value << f.parents;
160 if (!f.method_types.empty())
161 out << YAML::Key << "callee_types" << YAML::Value << f.callee_types;
162 out << YAML::EndMap;
163 return out;
164}

◆ operator<<() [9/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const generate_links_config glc 
)

Definition at line 226 of file yaml_emitters.cc.

227{
228 out << YAML::BeginMap;
229 out << YAML::Key << "link" << YAML::Value << glc.link;
230 out << YAML::Key << "tooltip" << YAML::Value << glc.tooltip;
231 out << YAML::EndMap;
232 return out;
233}

◆ operator<<() [10/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const git_config gc 
)

Definition at line 235 of file yaml_emitters.cc.

236{
237 out << YAML::BeginMap;
238 out << YAML::Key << "branch" << YAML::Value << gc.branch;
239 out << YAML::Key << "revision" << YAML::Value << gc.revision;
240 out << YAML::Key << "commit" << YAML::Value << gc.commit;
241 out << YAML::Key << "toplevel" << YAML::Value << gc.toplevel;
242 out << YAML::EndMap;
243
244 return out;
245}

◆ operator<<() [11/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const graphml p 
)

Definition at line 206 of file yaml_emitters.cc.

207{
208 if (is_null(p)) {
209 out << YAML::Null;
210 return out;
211 }
212
213 out << YAML::BeginMap;
214 out << YAML::Key << "notes" << YAML::Value << p.notes;
215 out << YAML::EndMap;
216
217 return out;
218}

◆ operator<<() [12/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const hint_t h 
)

Definition at line 257 of file yaml_emitters.cc.

258{
259 out << to_string(h);
260 return out;
261}

◆ operator<<() [13/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const include_diagram c 
)

Definition at line 502 of file yaml_emitters.cc.

503{
504 out << YAML::BeginMap;
505 out << YAML::Key << "type" << YAML::Value << c.type();
506 out << c.layout;
507 out << dynamic_cast<const inheritable_diagram_options &>(c);
508 out << YAML::EndMap;
509 return out;
510}

◆ operator<<() [14/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const inheritable_diagram_options c 
)

Definition at line 410 of file yaml_emitters.cc.

412{
413 // Common options
414 out << c.base_directory;
415 out << c.comment_parser;
416 out << c.debug_mode;
417 out << c.exclude;
418 out << c.generate_links;
419 out << c.git;
420 out << c.glob;
421 out << c.include;
422 out << c.puml;
423 out << c.mermaid;
424 out << c.graphml;
425 out << c.relative_to;
426 out << c.using_namespace;
427 out << c.using_module;
428 out << c.generate_metadata;
429 out << c.user_data;
430
431 if (const auto *cd = dynamic_cast<const class_diagram *>(&c);
432 cd != nullptr) {
433 out << cd->title;
434 out << c.generate_method_arguments;
435 out << c.generate_concept_requirements;
436 out << c.generate_packages;
437 out << c.include_relations_also_as_members;
438 if (c.relationship_hints) {
439 out << YAML::Key << "relationship_hints" << YAML::Value
440 << c.relationship_hints();
441 }
442
443 if (c.type_aliases) {
444 out << YAML::Key << "type_aliases" << YAML::Value
445 << c.type_aliases();
446 }
447 out << c.member_order;
448 out << c.package_type;
449 out << c.generate_template_argument_dependencies;
450 out << c.skip_redundant_dependencies;
451 }
452 else if (const auto *sd = dynamic_cast<const sequence_diagram *>(&c);
453 sd != nullptr) {
454 out << sd->title;
455 out << c.combine_free_functions_into_file_participants;
456 out << c.inline_lambda_messages;
457 out << c.generate_condition_statements;
458 out << c.generate_method_arguments;
459 out << c.generate_return_types;
460 out << c.participants_order;
461 out << c.generate_message_comments;
462 out << c.fold_repeated_activities;
463 out << c.message_comment_width;
464 }
465 else if (const auto *pd = dynamic_cast<const package_diagram *>(&c);
466 pd != nullptr) {
467 out << pd->title;
468 out << c.generate_packages;
469 out << c.package_type;
470 }
471 else if (const auto *id = dynamic_cast<const include_diagram *>(&c);
472 id != nullptr) {
473 out << id->title;
474 out << c.generate_system_headers;
475 }
476
477 return out;
478}

◆ operator<<() [15/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const inja::json &  ef 
)

Definition at line 330 of file yaml_emitters.cc.

331{
332 if (j.empty() || j.is_null()) {
333 out << YAML::Null;
334 }
335 else if (j.is_boolean()) {
336 out << j.get<bool>();
337 }
338 else if (j.is_number_integer()) {
339 out << j.get<long long>();
340 }
341 else if (j.is_number_unsigned()) {
342 out << j.get<unsigned long long>();
343 }
344 else if (j.is_number_float()) {
345 out << j.get<double>();
346 }
347 else if (j.is_string()) {
348 out << j.get<std::string>();
349 }
350 else if (j.is_array()) {
351 out << YAML::BeginSeq;
352 for (const auto &element : j) {
353 out << element;
354 }
355 out << YAML::EndSeq;
356 }
357 else if (j.is_object()) {
358 out << YAML::BeginMap;
359 for (auto it = j.begin(); it != j.end(); ++it) {
360 out << YAML::Key << it.key() << YAML::Value;
361 out << it.value();
362 }
363 out << YAML::EndMap;
364 }
365 else {
366 out << YAML::Null;
367 }
368 return out;
369}

◆ operator<<() [16/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const layout_hint c 
)

Definition at line 287 of file yaml_emitters.cc.

288{
289 out << YAML::BeginMap;
290
291 out << YAML::Key << c.hint << YAML::Value;
292 if (std::holds_alternative<std::string>(c.entity))
293 out << std::get<std::string>(c.entity);
294 else if (std::holds_alternative<std::vector<std::string>>(c.entity))
295 out << std::get<std::vector<std::string>>(c.entity);
296
297 out << YAML::EndMap;
298 return out;
299}

◆ operator<<() [17/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const mermaid p 
)

Definition at line 187 of file yaml_emitters.cc.

188{
189 if (is_null(p)) {
190 out << YAML::Null;
191 return out;
192 }
193
194 out << YAML::BeginMap;
195 if (!p.before.empty())
196 out << YAML::Key << "before" << YAML::Value << p.before;
197 if (!p.after.empty())
198 out << YAML::Key << "after" << YAML::Value << p.after;
199 if (!p.cmd.empty())
200 out << YAML::Key << "cmd" << YAML::Value << p.cmd;
201 out << YAML::EndMap;
202
203 return out;
204}

◆ operator<<() [18/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const method_arguments ma 
)

Definition at line 220 of file yaml_emitters.cc.

221{
222 out << to_string(ma);
223 return out;
224}

◆ operator<<() [19/26]

YAML::Emitter & clanguml::common::model::operator<< ( YAML::Emitter &  out,
const namespace_ n 
)

Definition at line 54 of file yaml_emitters.cc.

55{
56 out << n.to_string();
57 return out;
58}

◆ operator<<() [20/26]

template<typename T >
YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const option< T > &  o 
)

Definition at line 950 of file config.h.

951{
952 if (o.has_value && !is_null(o.value)) {
953 out << YAML::Key << o.name;
954 if constexpr (std::is_same_v<T, std::filesystem::path>)
955 out << YAML::Value << o.value.string();
956 else
957 out << YAML::Value << o.value;
958 }
959 return out;
960}

◆ operator<<() [21/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const package_diagram c 
)

Definition at line 512 of file yaml_emitters.cc.

513{
514 out << YAML::BeginMap;
515 out << YAML::Key << "type" << YAML::Value << c.type();
516 out << c.layout;
517 out << dynamic_cast<const inheritable_diagram_options &>(c);
518 out << YAML::EndMap;
519 return out;
520}

◆ operator<<() [22/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const plantuml p 
)

Definition at line 166 of file yaml_emitters.cc.

167{
168 if (is_null(p)) {
169 out << YAML::Null;
170 return out;
171 }
172
173 out << YAML::BeginMap;
174 if (!p.before.empty())
175 out << YAML::Key << "before" << YAML::Value << p.before;
176 if (!p.after.empty())
177 out << YAML::Key << "after" << YAML::Value << p.after;
178 if (!p.cmd.empty())
179 out << YAML::Key << "cmd" << YAML::Value << p.cmd;
180 if (!p.style.empty())
181 out << YAML::Key << "style" << YAML::Value << p.style;
182 out << YAML::EndMap;
183
184 return out;
185}

◆ operator<<() [23/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const relationship_hint_t rh 
)

Definition at line 247 of file yaml_emitters.cc.

248{
249 out << YAML::BeginMap;
250 out << YAML::Key << "default" << YAML::Value << rh.default_hint;
251 for (const auto &[k, v] : rh.argument_hints)
252 out << YAML::Key << k << YAML::Value << v;
253 out << YAML::EndMap;
254 return out;
255}

◆ operator<<() [24/26]

YAML::Emitter & clanguml::common::model::operator<< ( YAML::Emitter &  out,
const relationship_t r 
)

Definition at line 60 of file yaml_emitters.cc.

61{
62 out << to_string(r);
63 return out;
64}

◆ operator<<() [25/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const sequence_diagram c 
)

Definition at line 490 of file yaml_emitters.cc.

491{
492 out << YAML::BeginMap;
493 out << YAML::Key << "type" << YAML::Value << c.type();
494 out << c.from;
495 out << c.from_to;
496 out << c.to;
497 out << dynamic_cast<const inheritable_diagram_options &>(c);
498 out << YAML::EndMap;
499 return out;
500}

◆ operator<<() [26/26]

YAML::Emitter & clanguml::config::operator<< ( YAML::Emitter &  out,
const source_location sc 
)

Definition at line 301 of file yaml_emitters.cc.

302{
303 out << YAML::BeginMap;
304 out << YAML::Key << to_string(sc.location_type) << YAML::Value
305 << sc.location;
306 out << YAML::EndMap;
307 return out;
308}