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

Represents a single matching condition within a filter structure. More...

#include <Filter.hpp>

Collaboration diagram for filters::FilterCondition:
Collaboration graph

Public Member Functions

 FilterCondition ()=default
 
 FilterCondition (const std::string &col, const std::string &pat, bool paramFilter=false, const std::string &paramKey="", int depth=0, bool caseSensitive=false)
 
 FilterCondition (const FilterCondition &other)
 
FilterCondition & operator= (const FilterCondition &other)
 
 FilterCondition (FilterCondition &&)=default
 
FilterCondition & operator= (FilterCondition &&)=default
 
bool matches (const db::LogEvent &event) const
 
nlohmann::json toJson () const
 

Static Public Member Functions

static FilterCondition fromJson (const nlohmann::json &j)
 

Public Attributes

std::string columnName
 
std::string pattern
 
bool isParameterFilter = false
 
std::string parameterKey
 
int parameterDepth = 0
 
bool isCaseSensitive = false
 
std::unique_ptr< IFilterStrategy > strategy
 

Private Member Functions

bool searchParameterRecursive (const std::vector< std::pair< std::string, std::string > > &items, const std::string &key, int currentDepth) const
 

Detailed Description

Represents a single matching condition within a filter structure.

A filter can have multiple conditions that are combined with AND logic, allowing complex filtering expressions. Each condition specifies:

  • A target column or parameter to search
  • A pattern to match against
  • Strategy for matching (regex, substring, etc.)
  • Optional case sensitivity
Usage Scenarios
  • Column Matching: Match against log event fields (level, timestamp, etc.)
  • Parameter Matching: Search nested JSON structures at configurable depth
  • Complex Patterns: Use regex patterns for sophisticated matching
  • Case Handling: Optional case-sensitive or case-insensitive matching
Thread Safety
FilterCondition is immutable with respect to matching. Once created, the condition can be safely used by multiple threads without synchronization.
Example
// Simple column matching
FilterCondition level_error(
"level", // columnName
"ERROR", // pattern
false, // parameterFilter
"", // parameterKey
0, // depth
true // caseSensitive
);
// Nested parameter search
FilterCondition nested_search(
"", // columnName (not used for parameters)
"connection_timeout", // pattern to find in nested data
true, // isParameterFilter = true
"error_details", // parameterKey
2 // depth = 2 levels deep
);
Represents a single matching condition within a filter structure.
Definition Filter.hpp:64
See also
Filter for combining multiple conditions
IFilterStrategy for matching algorithm details

Constructor & Destructor Documentation

◆ FilterCondition() [1/4]

filters::FilterCondition::FilterCondition ( )
default

◆ FilterCondition() [2/4]

filters::FilterCondition::FilterCondition ( const std::string &  col,
const std::string &  pat,
bool  paramFilter = false,
const std::string &  paramKey = "",
int  depth = 0,
bool  caseSensitive = false 
)
inline

◆ FilterCondition() [3/4]

filters::FilterCondition::FilterCondition ( const FilterCondition &  other)

◆ FilterCondition() [4/4]

filters::FilterCondition::FilterCondition ( FilterCondition &&  )
default

Member Function Documentation

◆ fromJson()

FilterCondition filters::FilterCondition::fromJson ( const nlohmann::json &  j)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ matches()

bool filters::FilterCondition::matches ( const db::LogEvent &  event) const
Here is the call graph for this function:

◆ operator=() [1/2]

FilterCondition & filters::FilterCondition::operator= ( const FilterCondition &  other)

◆ operator=() [2/2]

FilterCondition & filters::FilterCondition::operator= ( FilterCondition &&  )
default

◆ searchParameterRecursive()

bool filters::FilterCondition::searchParameterRecursive ( const std::vector< std::pair< std::string, std::string > > &  items,
const std::string &  key,
int  currentDepth 
) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toJson()

nlohmann::json filters::FilterCondition::toJson ( ) const

Member Data Documentation

◆ columnName

std::string filters::FilterCondition::columnName

◆ isCaseSensitive

bool filters::FilterCondition::isCaseSensitive = false

◆ isParameterFilter

bool filters::FilterCondition::isParameterFilter = false

◆ parameterDepth

int filters::FilterCondition::parameterDepth = 0

◆ parameterKey

std::string filters::FilterCondition::parameterKey

◆ pattern

std::string filters::FilterCondition::pattern

◆ strategy

std::unique_ptr<IFilterStrategy> filters::FilterCondition::strategy

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