Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
elftosb::ExcludesListMatcher Class Reference

Matches strings using a series of include and exclude glob patterns. More...

#include <ExcludesListMatcher.h>

+ Inheritance diagram for elftosb::ExcludesListMatcher:
+ Collaboration diagram for elftosb::ExcludesListMatcher:

Classes

struct  glob_list_item_t
 Information about one glob pattern entry in a match list. More...
 

Public Member Functions

 ExcludesListMatcher ()
 Default constructor.
 
 ~ExcludesListMatcher ()
 Destructor.
 
virtual bool match (const std::string &testValue)
 Performs a single string match test against testValue. More...
 
Pattern list
void addPattern (bool isInclude, const std::string &pattern)
 Add one include or exclude pattern to the end of the match list. More...
 
- Public Member Functions inherited from elftosb::GlobMatcher
 GlobMatcher (const std::string &pattern)
 Constructor.
 

Protected Types

typedef std::vector< glob_list_item_tglob_list_t
 

Protected Attributes

glob_list_t m_patterns
 Ordered list of include and exclude patterns.
 
- Protected Attributes inherited from elftosb::GlobMatcher
std::string m_pattern
 The glob pattern to match against.
 

Additional Inherited Members

- Protected Member Functions inherited from elftosb::GlobMatcher
bool globMatch (const char *str, const char *p)
 Glob implementation. More...
 

Detailed Description

Matches strings using a series of include and exclude glob patterns.

This string matcher class uses a sequential, ordered list of glob patterns to determine whether a string matches. Attached to each pattern is an include/exclude action. The patterns in the list effectively form a Boolean expression. Includes act as an OR operator while excludes act as an AND NOT operator.

Examples (plus prefix is include, minus prefix is exclude):

  • +foo: foo
  • -foo: !foo
  • +foo, +bar: foo || bar
  • +foo, -bar: foo && !bar
  • +foo, -bar, +baz: foo && !bar || baz

The only reason for inheriting from GlobMatcher is so we can access the protected globMatch() method.


Class Documentation

struct elftosb::ExcludesListMatcher::glob_list_item_t

Information about one glob pattern entry in a match list.

+ Collaboration diagram for elftosb::ExcludesListMatcher::glob_list_item_t:
Class Members
string m_glob The glob pattern to match.
bool m_isInclude True if include, false if exclude.

Member Function Documentation

void ExcludesListMatcher::addPattern ( bool  isInclude,
const std::string &  pattern 
)

Add one include or exclude pattern to the end of the match list.

Parameters
isIncludeTrue if this pattern is an include, false if it is an exclude.
patternString containing the glob pattern.
bool ExcludesListMatcher::match ( const std::string &  testValue)
virtual

Performs a single string match test against testValue.

If there are no entries in the match list, the match fails.

Parameters
testValueThe string to match against the pattern list.
Return values
trueThe testValue argument matches.
falseNo match was made against the argument.

Reimplemented from elftosb::GlobMatcher.


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