Wildcard pattern matching (* and ?)
More...
#include <IFilterStrategy.hpp>
|
| | WildcardStrategy ()=default |
| |
| bool | matches (const std::string &value, const std::string &pattern, bool caseSensitive) const override |
| | Match a value against the pattern.
|
| |
| bool | isValidPattern (const std::string &) const override |
| | Validate pattern syntax.
|
| |
| std::string | getName () const override |
| | Get strategy name for serialization/debugging.
|
| |
| std::unique_ptr< IFilterStrategy > | clone () const override |
| | Clone this strategy (for copy semantics)
|
| |
|
| static bool | matchWildcard (const std::string &value, const std::string &pattern, size_t valueIdx, size_t patternIdx) |
| | Recursive wildcard matching implementation.
|
| |
Wildcard pattern matching (* and ?)
Simple wildcard matching with * (zero or more chars) and ? (one char). Faster than regex for simple patterns like "*.log" or "test_?.txt".
- Performance:
- Matching: O(n) with backtracking for *
- Memory: No additional state
◆ WildcardStrategy()
| filters::WildcardStrategy::WildcardStrategy |
( |
| ) |
|
|
default |
◆ clone()
| std::unique_ptr< IFilterStrategy > filters::WildcardStrategy::clone |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getName()
| std::string filters::WildcardStrategy::getName |
( |
| ) |
const |
|
inlineoverridevirtual |
Get strategy name for serialization/debugging.
- Returns
- Strategy identifier (e.g., "regex", "exact", "fuzzy")
Implements filters::IFilterStrategy.
◆ isValidPattern()
| bool filters::WildcardStrategy::isValidPattern |
( |
const std::string & |
pattern | ) |
const |
|
inlineoverridevirtual |
Validate pattern syntax.
- Parameters
-
| pattern | The pattern to validate |
- Returns
- true if pattern is valid for this strategy, false otherwise
Used to provide early feedback when constructing filters.
Implements filters::IFilterStrategy.
◆ matches()
| bool filters::WildcardStrategy::matches |
( |
const std::string & |
value, |
|
|
const std::string & |
pattern, |
|
|
bool |
caseSensitive |
|
) |
| const |
|
overridevirtual |
Match a value against the pattern.
- Parameters
-
| value | The string to test |
| pattern | The pattern to match against |
| caseSensitive | Whether matching should be case-sensitive |
- Returns
- true if value matches pattern, false otherwise
- Thread Safety:
- Must be thread-safe for concurrent calls.
Implements filters::IFilterStrategy.
◆ matchWildcard()
| bool filters::WildcardStrategy::matchWildcard |
( |
const std::string & |
value, |
|
|
const std::string & |
pattern, |
|
|
size_t |
valueIdx, |
|
|
size_t |
patternIdx |
|
) |
| |
|
staticprivate |
Recursive wildcard matching implementation.
- Parameters
-
| value | String to test |
| pattern | Wildcard pattern |
| valueIdx | Current position in value |
| patternIdx | Current position in pattern |
- Returns
- true if match found
The documentation for this class was generated from the following files: