39class diagram_filter_factory;
55template <
typename ElementT,
typename DiagramT>
58template <
typename ElementT,
typename DiagramT>
60 const DiagramT &d,
const std::string &full_name);
120 filter_mode_t
mode()
const;
125 filter_mode_t
mode_{filter_mode_t::basic};
130 filter_t type, std::vector<std::unique_ptr<filter_visitor>> filters);
162 template <
typename E>
166 [&d, &
element](
const auto &f) { return f->match(d, element); });
174 std::vector<std::unique_ptr<filter_visitor>>
filters_;
179 filter_t type, std::vector<std::unique_ptr<filter_visitor>> filters);
211 template <
typename E>
215 [&d, &
element](
const auto &f) { return f->match(d, element); });
218 std::vector<std::unique_ptr<filter_visitor>>
filters_;
227 filter_t type, std::vector<common::namespace_or_regex> namespaces);
262 filter_t type, std::vector<common::string_or_regex> elements);
294 filter_t type, std::vector<config::method_type> method_types);
332 std::vector<common::string_or_regex>
roots_;
364template <
typename DiagramT,
typename ElementT,
365 typename ConfigEntryT = std::string,
386 if (!check_diagram_type<DiagramT>(d.
type()))
392 const auto &cd =
dynamic_cast<const DiagramT &
>(d);
397 const auto &fn = e.full_name(
false);
398 auto element_ref = detail::get<ElementT>(cd, fn);
400 if (!element_ref.has_value())
406 [&e](
const auto &te) {
407 std::string tes = te.get().full_name(false);
408 std::string es = e.full_name(false);
418 template <
typename C,
typename D>
420 const std::vector<relationship_t> &relationships)
const
422 bool added_new_element{
false};
424 for (
const auto &from_el : from) {
428 for (
const auto &rel : from_el.get().relationships()) {
431 for (
const auto &to_el : to) {
432 if (rel.destination() ==
434 const auto &to_add =
forward_ ? to_el : from_el;
436 added_new_element =
true;
443 return added_new_element;
452 auto parent = detail::get<ElementT, DiagramT>(
455 while (parent.has_value()) {
456 parents.emplace(parent.value());
457 parent = detail::get<ElementT, DiagramT>(
458 cd, parent.value().path().to_string());
465 void init(
const DiagramT &cd)
const
473 for (
const auto &root_pattern :
roots_) {
474 if constexpr (std::is_same_v<ConfigEntryT,
476 auto root_refs = cd.template find<ElementT>(root_pattern);
478 for (
auto &root : root_refs) {
479 if (root.has_value())
484 auto root_ref = detail::get<ElementT>(cd, root_pattern);
485 if (root_ref.has_value()) {
492 while (keep_looking) {
493 keep_looking =
false;
527 filter_t type, std::vector<relationship_t> relationships);
586 template <
typename ElementT>
589 std::set<eid_t> &effective_context,
590 std::set<eid_t> ¤t_iteration_context)
const
592 static_assert(std::is_same_v<ElementT, class_diagram::model::class_> ||
593 std::is_same_v<ElementT, class_diagram::model::enum_> ||
594 std::is_same_v<ElementT, class_diagram::model::concept_>,
595 "ElementT must be either class_ or enum_ or concept_");
599 for (
const auto &el : cd.elements<ElementT>()) {
603 for (
const relationship &rel : el.get().relationships()) {
622 for (
const auto &element_id : effective_context) {
623 if (rel.destination() == element_id)
624 current_iteration_context.emplace(el.get().id());
631 for (
const auto element_id : effective_context) {
632 const auto &maybe_element = cd.
get(element_id);
638 maybe_element.value().relationships()) {
657 if (rel.destination() == el.get().id())
658 current_iteration_context.emplace(el.get().id());
669 std::set<eid_t> &effective_context,
670 std::set<eid_t> ¤t_iteration_context)
const;
673 std::set<eid_t> &effective_context,
674 std::set<eid_t> ¤t_iteration_context,
676 const std::reference_wrapper<class_diagram::model::class_> &c)
const;
679 std::set<eid_t> ¤t_iteration_context,
681 const std::reference_wrapper<class_diagram::model::class_> &c)
const;
701 const std::filesystem::path &root);
712 std::vector<std::filesystem::path>
paths_;
721 std::unique_ptr<method_type_filter> mtf);
803 assert(ex.get() != nullptr);
805 return ex->match(diagram_, e);
813 assert(in.get() != nullptr);
815 return in->match(diagram_, e);
834template <
typename Collection>
837 col.erase(std::remove_if(col.begin(), col.end(),
839 return !filter.should_include(element);
846 std::vector<std::reference_wrapper<T>> &col,
const diagram_filter &filter)
848 col.erase(std::remove_if(col.begin(), col.end(),
850 return !filter.should_include(element.get());
856bool diagram_filter::should_include<std::string>(
const std::string &name)
const;