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::modules_filter Struct Reference

Detailed Description

Match diagram elements to a set of specified modules or module regex patterns.

Definition at line 253 of file diagram_filter.h.

#include <diagram_filter.h>

Public Member Functions

 modules_filter (filter_t type, std::vector< common::string_or_regex > modules)
 
 ~modules_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_regexmodules_
 

Constructor & Destructor Documentation

◆ modules_filter()

clanguml::common::model::modules_filter::modules_filter ( filter_t  type,
std::vector< common::string_or_regex modules 
)

Definition at line 434 of file diagram_filter.cc.

437 , modules_{std::move(modules)}
438{
439}

◆ ~modules_filter()

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

Member Function Documentation

◆ match()

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

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

Definition at line 441 of file diagram_filter.cc.

443{
444 if (modules_.empty())
445 return {};
446
447 if (!e.module().has_value())
448 return {false};
449
450 auto module_toks =
451 path::split(e.module().value(), path_type::kModule); // NOLINT
452
453 if (dynamic_cast<const package *>(&e) != nullptr &&
454 e.get_namespace().type() == path_type::kModule) {
455 module_toks.push_back(e.name());
456 }
457
458 auto result = tvl::any_of(modules_.begin(), modules_.end(),
459 [&e, &module_toks](const auto &modit) {
460 if (std::holds_alternative<std::string>(modit.value())) {
461 const auto &modit_str = std::get<std::string>(modit.value());
462 const auto modit_toks =
463 path::split(modit_str, path_type::kModule);
464
465 return e.module() == modit_str ||
466 util::starts_with(module_toks, modit_toks);
467 }
468
469 return std::get<common::regex>(modit.value()) %= e.module().value();
470 });
471
472 if ((type() == filter_t::kInclusive && tvl::is_false(result)) ||
473 (type() == filter_t::kExclusive && tvl::is_true(result))) {
474 LOG_TRACE("Element {} rejected by modules_filter", e.full_name(false));
475 }
476
477 return result;
478}

Member Data Documentation

◆ modules_

std::vector<common::string_or_regex> clanguml::common::model::modules_filter::modules_
private

Definition at line 261 of file diagram_filter.h.


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