blfwk::ExcludesListMatcher Class Reference

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

`#include <ExcludesListMatcher.h>`

Inheritance diagram for blfwk::ExcludesListMatcher:
[legend]
Collaboration diagram for blfwk::ExcludesListMatcher:
[legend]

## 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 blfwk::GlobMatcher
| GlobMatcher (const std::string &pattern)
| Constructor.

## Protected Types

typedef std::vector< glob_list_item_t > | glob_list_t

## Protected Attributes

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

## Additional Inherited Members

Protected Member Functions inherited from blfwk::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 blfwk::ExcludesListMatcher::glob_list_item_t

Information about one glob pattern entry in a match list.

Collaboration diagram for blfwk::ExcludesListMatcher::glob_list_item_t:
[legend]

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

  isInclude | True if this pattern is an include, false if it is an exclude.
  pattern | String 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

  testValue | The string to match against the pattern list.

Return values

  true | The testValue argument matches.
  false | No match was made against the argument.

Reimplemented from blfwk::GlobMatcher.

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

- src/blfwk/ExcludesListMatcher.h
- src/blfwk/src/ExcludesListMatcher.cpp