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

Composite of all diagrams filters. More...

Detailed Description

Composite of all diagrams filters.

Instances of this class contain all filters specified in configuration file for a given diagram.

See also
clanguml::common::model::filter_visitor

Definition at line 775 of file diagram_filter.h.

#include <diagram_filter.h>

Classes

struct  private_constructor_tag_t
 

Public Member Functions

 diagram_filter (const common::model::diagram &d, const config::diagram &c, private_constructor_tag_t unused)
 
void add_filter (filter_t filter_type, std::unique_ptr< filter_visitor > fv)
 
void add_inclusive_filter (std::unique_ptr< filter_visitor > fv)
 
void add_exclusive_filter (std::unique_ptr< filter_visitor > fv)
 
bool should_include (const namespace_ &ns, const std::string &name) const
 
template<typename T >
bool should_include (const T &e) const
 
filter_mode_t mode () const
 
void set_mode (filter_mode_t mode)
 

Private Attributes

std::vector< std::unique_ptr< filter_visitor > > inclusive_
 
std::vector< std::unique_ptr< filter_visitor > > exclusive_
 
const common::model::diagramdiagram_
 
filter_mode_t mode_ {filter_mode_t::basic}
 

Friends

class diagram_filter_factory
 

Constructor & Destructor Documentation

◆ diagram_filter()

clanguml::common::model::diagram_filter::diagram_filter ( const common::model::diagram d,
const config::diagram c,
private_constructor_tag_t  unused 
)

Definition at line 1346 of file diagram_filter.cc.

1348 : diagram_{d}
1349{
1350}

Member Function Documentation

◆ add_exclusive_filter()

void clanguml::common::model::diagram_filter::add_exclusive_filter ( std::unique_ptr< filter_visitor fv)

Add exclusive filter.

Parameters
fvFilter visitor.

Definition at line 1366 of file diagram_filter.cc.

1367{
1368 exclusive_.emplace_back(std::move(fv));
1369}

◆ add_filter()

void clanguml::common::model::diagram_filter::add_filter ( filter_t  filter_type,
std::unique_ptr< filter_visitor fv 
)

Definition at line 1352 of file diagram_filter.cc.

1354{
1355 if (filter_type == filter_t::kInclusive)
1356 add_inclusive_filter(std::move(fv));
1357 else
1358 add_exclusive_filter(std::move(fv));
1359}

◆ add_inclusive_filter()

void clanguml::common::model::diagram_filter::add_inclusive_filter ( std::unique_ptr< filter_visitor fv)

Add inclusive filter.

Parameters
fvFilter visitor.

Definition at line 1361 of file diagram_filter.cc.

1362{
1363 inclusive_.emplace_back(std::move(fv));
1364}

◆ mode()

filter_mode_t clanguml::common::model::diagram_filter::mode ( ) const

Definition at line 1385 of file diagram_filter.cc.

1385{ return mode_; }

◆ set_mode()

void clanguml::common::model::diagram_filter::set_mode ( filter_mode_t  mode)

Definition at line 1387 of file diagram_filter.cc.

1387{ mode_ = mode; }

◆ should_include() [1/2]

bool clanguml::common::model::diagram_filter::should_include ( const namespace_ ns,
const std::string &  name 
) const

should_include overload for namespace and name.

Parameters
nsNamespace
nameName
Returns
Match result.

Definition at line 1371 of file diagram_filter.cc.

1373{
1374 if (should_include(ns)) {
1375 element e{namespace_{}};
1376 e.set_name(name);
1377 e.set_namespace(ns);
1378
1379 return should_include(e);
1380 }
1381
1382 return false;
1383}

◆ should_include() [2/2]

template<typename T >
bool clanguml::common::model::diagram_filter::should_include ( const T &  e) const
inline

Generic should_include overload for various diagram elements.

Template Parameters
TType to to match - must match one of filter_visitor's match(T)
Parameters
eValue of type T to match
Returns
Match result.

Definition at line 814 of file diagram_filter.h.

815 {
816 auto exc = tvl::any_of(
817 exclusive_.begin(), exclusive_.end(), [this, &e](const auto &ex) {
818 assert(ex.get() != nullptr);
819
820 return ex->match(diagram_, e);
821 });
822
823 if (tvl::is_true(exc))
824 return false;
825
826 auto inc = tvl::all_of(
827 inclusive_.begin(), inclusive_.end(), [this, &e](const auto &in) {
828 assert(in.get() != nullptr);
829
830 return in->match(diagram_, e);
831 });
832
833 return static_cast<bool>(tvl::is_undefined(inc) || tvl::is_true(inc));
834 }

Friends And Related Symbol Documentation

◆ diagram_filter_factory

friend class diagram_filter_factory
friend

Definition at line 840 of file diagram_filter.h.

Member Data Documentation

◆ diagram_

const common::model::diagram& clanguml::common::model::diagram_filter::diagram_
private

Reference to the diagram model

Definition at line 850 of file diagram_filter.h.

◆ exclusive_

std::vector<std::unique_ptr<filter_visitor> > clanguml::common::model::diagram_filter::exclusive_
private

List of exclusive filters

Definition at line 847 of file diagram_filter.h.

◆ inclusive_

std::vector<std::unique_ptr<filter_visitor> > clanguml::common::model::diagram_filter::inclusive_
private

List of inclusive filters

Definition at line 844 of file diagram_filter.h.

◆ mode_

filter_mode_t clanguml::common::model::diagram_filter::mode_ {filter_mode_t::basic}
private

Definition at line 852 of file diagram_filter.h.


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