14 const std::string_view &str ) {
21 const std::string_view & str ) {
22 return std::regex_search( str.begin(), str.end(), rgx ) ;
28 : _fiterFn{[](
const EntryKey & ) {
return true; }} {}
43 ConditionBuilder::operator
Condition()
const {
return condition(); }
50 = [](
const EntryKey & ) {
return true; } ;
53 fn = [fn, rgx = _name.value()](
const EntryKey &e ) {
54 return fn( e ) &&
rgxEvaluation( rgx, e.path.filename().string() ) ;
57 fn = [fn, rgx = _rgxName](
const EntryKey &e ) {
58 return fn( e ) &&
rgxEvaluation( rgx, e.path.filename().string() ) ;
63 fn = [fn, rgx = _path.value()](
const EntryKey &e ) {
64 return fn( e ) &&
rgxEvaluation( rgx, e.path.parent_path().string() +
"/" ) ;
67 fn = [fn, rgx = _rgxPath](
const EntryKey &e ) {
68 return fn( e ) &&
rgxEvaluation( rgx, e.path.parent_path().string() +
"/" ) ;
74 return fn( e ) && type == e.type ;
85 _name = std::optional< std::string >( name ) ;
101 _path = std::optional< std::string >( path ) ;
116 _type = std::optional< std::type_index >( type ) ;
Data selection to identify and manage an Entry.
std::function< bool(const EntryKey &) > FilterFn_t
ConditionBuilder & setType()
only accept when entry type matches.
ConditionBuilder & setName(const std::string_view &name)
only accept when key.name is perfect match to name.
FilterFn_t _fiterFn
actually filter function.
Condition & operator=(const FilterFn_t &filterFn)
Condition condition() const
construct new Condition.
bool rgxEvaluation(const std::string_view &match, const std::string_view &str)
helper to create a Condition.
ConditionBuilder & setPath(const std::string_view &path)
only accept when key.path is perfect match to path.
Condition()
default constructor.
wrapper class for an Entry filter function.