0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
clanguml::common::model::parents_filter Struct Reference

Detailed Description

Match element based on whether it is a parent of a set of children, or one of them.

Definition at line 358 of file diagram_filter.h.

#include <diagram_filter.h>

Public Member Functions

 parents_filter (filter_t type, std::vector< common::string_or_regex > roots)
 
 ~parents_filter () override=default
 
tvl::value_t match (const diagram &d, const element &e) const override
 
- Public Member Functions inherited from clanguml::common::model::filter_visitor
 filter_visitor (filter_t type)
 
virtual ~filter_visitor ()=default
 
virtual tvl::value_t match (const diagram &d, const common::model::element &e) const
 
virtual tvl::value_t match (const diagram &d, const common::model::relationship &r) const
 
virtual tvl::value_t match (const diagram &d, const common::model::relationship_t &r) const
 
virtual tvl::value_t match (const diagram &d, const common::model::access_t &a) const
 
virtual tvl::value_t match (const diagram &d, const common::model::namespace_ &ns) const
 
virtual tvl::value_t match (const diagram &d, const common::model::source_file &f) const
 
virtual tvl::value_t match (const diagram &d, const common::model::source_location &f) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::class_method &m) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::class_member &m) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::objc_method &m) const
 
virtual tvl::value_t match (const diagram &d, const class_diagram::model::objc_member &m) const
 
virtual tvl::value_t match (const diagram &d, const sequence_diagram::model::participant &p) const
 
bool is_inclusive () const
 
bool is_exclusive () const
 
filter_t type () const
 
filter_mode_t mode () const
 
void set_mode (filter_mode_t mode)
 

Private Attributes

std::vector< common::string_or_regexchildren_
 

Constructor & Destructor Documentation

◆ parents_filter()

clanguml::common::model::parents_filter::parents_filter ( filter_t  type,
std::vector< common::string_or_regex roots 
)

Definition at line 863 of file diagram_filter.cc.

866 , children_{std::move(children)}
867{
868}

◆ ~parents_filter()

clanguml::common::model::parents_filter::~parents_filter ( )
overridedefault

Member Function Documentation

◆ match()

tvl::value_t clanguml::common::model::parents_filter::match ( const diagram d,
const element e 
) const
overridevirtual

Reimplemented from clanguml::common::model::filter_visitor.

Definition at line 870 of file diagram_filter.cc.

871{
872 if (d.type() != diagram_t::kClass)
873 return {};
874
875 if (children_.empty())
876 return {};
877
878 if (!d.complete())
879 return {};
880
881 const auto &cd = dynamic_cast<const class_diagram::model::diagram &>(d);
882
883 // First get all parents of element e
885
886 for (const auto &child_pattern : children_) {
887 auto child_refs = cd.find<class_diagram::model::class_>(child_pattern);
888
889 for (auto &child : child_refs) {
890 if (child.has_value())
891 parents.emplace(child.value());
892 }
893 }
894
895 cd.get_parents(parents);
896
897 for (const auto &parent : parents) {
898 if (e == parent.get())
899 return true;
900 }
901
902 LOG_TRACE("Element {} rejected by parents_filter", e.full_name(false));
903
904 return false;
905}

Member Data Documentation

◆ children_

std::vector<common::string_or_regex> clanguml::common::model::parents_filter::children_
private

Definition at line 366 of file diagram_filter.h.


The documentation for this struct was generated from the following files: