fswatch
1.14.0
|
Path filters used to accept or reject file change events. More...
#include <filter.hpp>
Static Public Member Functions | |
static std::vector< monitor_filter > | read_from_file (const std::string &path, void(*err_handler)(std::string)=nullptr) |
Load filters from the specified file. More... | |
Public Attributes | |
std::string | text |
Regular expression used to match the paths. More... | |
fsw_filter_type | type |
Filter type. | |
bool | case_sensitive |
Flag indicating whether monitor_filter::text is a case sensitive regular expression. | |
bool | extended |
Flag indicating whether monitor_filter::text is an extended regular expression. More... | |
Path filters used to accept or reject file change events.
A path filter is a regular expression used to accept or reject file change events based on the value of their path. A filter has the following characteristics:
Further information about how filtering works in libfswatch
can be found in Path Filtering.
|
static |
Load filters from the specified file.
Filters can be loaded from a text file containing one filter per line. A filter has the following structure:
^([+-])([ei]*) (.+)$
+
if it is an inclusion filter, -
if it is an exclusion filter.e
if it is an extended regular expression.i
if it is a case insensitive regular expression.Parsing errors are notified through an optional error handler. The valid filters are returned in a vector.
path | The path of the file to read filters from. |
err_handler | An optional error handler. |
invalid_argument | If the specified path cannot be opened. |
bool fsw::monitor_filter::extended |
Flag indicating whether monitor_filter::text is an extended regular expression.
Further information about extended regular expressions can be found here:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04
std::string fsw::monitor_filter::text |
Regular expression used to match the paths.
Further information about regular expressions can be found here:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html