LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
filters::WildcardStrategy Class Reference

Wildcard pattern matching (* and ?) More...

#include <IFilterStrategy.hpp>

Inheritance diagram for filters::WildcardStrategy:
Inheritance graph
Collaboration diagram for filters::WildcardStrategy:
Collaboration graph

Public Member Functions

 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 Private Member Functions

static bool matchWildcard (const std::string &value, const std::string &pattern, size_t valueIdx, size_t patternIdx)
 Recursive wildcard matching implementation.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ WildcardStrategy()

filters::WildcardStrategy::WildcardStrategy ( )
default

Member Function Documentation

◆ clone()

std::unique_ptr< IFilterStrategy > filters::WildcardStrategy::clone ( ) const
inlineoverridevirtual

Clone this strategy (for copy semantics)

Returns
Unique pointer to cloned strategy

Implements filters::IFilterStrategy.

◆ 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
patternThe 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
valueThe string to test
patternThe pattern to match against
caseSensitiveWhether 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.

Here is the call graph for this function:

◆ 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
valueString to test
patternWildcard pattern
valueIdxCurrent position in value
patternIdxCurrent position in pattern
Returns
true if match found
Here is the call graph for this function:
Here is the caller graph for this function:

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