diff options
Diffstat (limited to 'src/mask.h')
-rw-r--r-- | src/mask.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mask.h b/src/mask.h new file mode 100644 index 00000000..82634c19 --- /dev/null +++ b/src/mask.h @@ -0,0 +1,26 @@ +#ifndef _MASK_H +#define _MASK_H + +#include "utils.h" + +#include <boost/regex.hpp> + +namespace ledger { + +class mask_t +{ + public: + bool exclude; + boost::regex expr; + + explicit mask_t(const string& pattern); + mask_t(const mask_t& m) : exclude(m.exclude), expr(m.expr) {} + + bool match(const string& str) const { + return boost::regex_match(str, expr) && ! exclude; + } +}; + +} // namespace ledger + +#endif // _MASK_H |