wordRes::filter Struct Reference

Functor wrapper of allow/deny lists of wordRe for filtering. More...

Public Member Functions

 filter (const UList< wordRe > &allow, const UList< wordRe > &deny) noexcept
 Construct with allow and deny matchers. More...
 
bool empty () const noexcept
 No filtering defined. More...
 
 operator bool () const noexcept
 True if filtering is defined. More...
 
bool operator() (const std::string &text) const
 Apply filter against specified text. More...
 

Detailed Description

Functor wrapper of allow/deny lists of wordRe for filtering.

An empty filter accepts everything. An empty allow accepts everything not in deny. A literal allow match has higher priority than any deny. A regex allow match has lower priority than any deny.

Example (when applied to a list of words),

*    input:  ( abc apple test other val val1 val2 wall wall1 wall2 )
*    allow:  ( abc def "t.*" other val val1 "wall.*" )
*    deny:   ( "[ab].*" "t.*" other "val[0-9]" wall )
* 
*    result:  (abc other val val1 wall1 wall2)
* 

Definition at line 274 of file wordRes.H.

Constructor & Destructor Documentation

◆ filter()

filter ( const UList< wordRe > &  allow,
const UList< wordRe > &  deny 
)
inlinenoexcept

Construct with allow and deny matchers.

Definition at line 206 of file wordResI.H.

Member Function Documentation

◆ empty()

bool empty ( ) const
inlinenoexcept

No filtering defined.

Definition at line 222 of file wordResI.H.

Referenced by wordRes::filter::operator bool().

Here is the caller graph for this function:

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

True if filtering is defined.

Definition at line 293 of file wordRes.H.

References wordRes::filter::empty().

Here is the call graph for this function:

◆ operator()()

bool operator() ( const std::string &  text) const
inline

Apply filter against specified text.

Returns
true if no filtering has been defined
true if matched but not blocked

Definition at line 234 of file wordResI.H.

References wordRe::LITERAL, wordRes::match(), wordRes::matched(), and wordRe::REGEX.

Here is the call graph for this function:

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