-
Notifications
You must be signed in to change notification settings - Fork 1
matcher
Mario Bielert edited this page Jun 29, 2017
·
2 revisions
The matcher is a helper class, which provides a very simplified regular expression matching for channel names.
Actually it only supports the usage of *
as a wildcard.
The class can be used as follows. First you create an instance of the class with the pattern as only argument. Then the operator() can be used to check, if a given string matches the pattern, set in the constructor.
scorep::plugin::util::matcher starts_with_smurf("Smurf*");
std::cout << simple_pattern_matcher("SmurfHouse") << std::endl; // returns true
std::cout << simple_pattern_matcher("Smurf") << std::endl; // returns true
std::cout << simple_pattern_matcher("House") << std::endl; // returns false
Construct with pattern. The given pattern will be used to match against it.
Arguments:
- pattern - the used pattern to match
Tries to match input
against the set pattern.
Arguments:
- input - the string, which will be matched against the pattern
Returns:
- bool - true, if input matches the pattern, otherwise false