Unravel Engine C++ Reference
|
A filter that combines include and exclude patterns for file/directory filtering. More...
#include <pattern_filter.h>
Public Member Functions | |
pattern_filter ()=default | |
Default constructor creates a filter that accepts everything. | |
pattern_filter (const std::string &include_pattern) | |
Constructs a filter with include patterns only (for backward compatibility) | |
pattern_filter (const std::vector< std::string > &include_patterns, const std::vector< std::string > &exclude_patterns={}) | |
Constructs a filter with multiple include and exclude patterns. | |
void | add_include_pattern (const std::string &pattern) |
Adds an include pattern to the filter. | |
void | add_exclude_pattern (const std::string &pattern) |
Adds an exclude pattern to the filter. | |
auto | should_include (const fs::path &path) const -> bool |
Tests if a path should be included based on the filter rules Logic: (matches any include pattern OR no include patterns) AND (matches no exclude patterns) | |
auto | should_include_filename (const std::string &filename) const -> bool |
Tests if a filename should be included based on the filter rules. | |
auto | has_patterns () const -> bool |
Checks if this filter has any patterns. | |
auto | is_wildcard () const -> bool |
Checks if this filter is effectively a wildcard (no restrictions) | |
auto | get_include_patterns () const -> const std::vector< wildcard_pattern > & |
Gets all include patterns. | |
auto | get_exclude_patterns () const -> const std::vector< wildcard_pattern > & |
Gets all exclude patterns. | |
A filter that combines include and exclude patterns for file/directory filtering.
Definition at line 47 of file pattern_filter.h.
|
default |
Default constructor creates a filter that accepts everything.
|
explicit |
Constructs a filter with include patterns only (for backward compatibility)
include_pattern | Single include pattern |
Definition at line 70 of file pattern_filter.cpp.
fs::pattern_filter::pattern_filter | ( | const std::vector< std::string > & | include_patterns, |
const std::vector< std::string > & | exclude_patterns = {} ) |
Constructs a filter with multiple include and exclude patterns.
include_patterns | List of include patterns (OR logic) |
exclude_patterns | List of exclude patterns (NOT logic) |
Definition at line 78 of file pattern_filter.cpp.
void fs::pattern_filter::add_exclude_pattern | ( | const std::string & | pattern | ) |
Adds an exclude pattern to the filter.
pattern | Pattern to add to excludes |
Definition at line 99 of file pattern_filter.cpp.
void fs::pattern_filter::add_include_pattern | ( | const std::string & | pattern | ) |
Adds an include pattern to the filter.
pattern | Pattern to add to includes |
Definition at line 91 of file pattern_filter.cpp.
auto fs::pattern_filter::get_exclude_patterns | ( | ) | const -> const std::vector<wildcard_pattern>& |
Gets all exclude patterns.
Definition at line 170 of file pattern_filter.cpp.
auto fs::pattern_filter::get_include_patterns | ( | ) | const -> const std::vector<wildcard_pattern>& |
Gets all include patterns.
Definition at line 165 of file pattern_filter.cpp.
auto fs::pattern_filter::has_patterns | ( | ) | const -> bool |
Checks if this filter has any patterns.
Definition at line 142 of file pattern_filter.cpp.
auto fs::pattern_filter::is_wildcard | ( | ) | const -> bool |
Checks if this filter is effectively a wildcard (no restrictions)
Definition at line 147 of file pattern_filter.cpp.
auto fs::pattern_filter::should_include | ( | const fs::path & | path | ) | const -> bool |
Tests if a path should be included based on the filter rules Logic: (matches any include pattern OR no include patterns) AND (matches no exclude patterns)
path | Path to test |
Definition at line 107 of file pattern_filter.cpp.
auto fs::pattern_filter::should_include_filename | ( | const std::string & | filename | ) | const -> bool |
Tests if a filename should be included based on the filter rules.
filename | Filename to test |
Definition at line 112 of file pattern_filter.cpp.