blob: 13ab57b542a4569975ce2286121e1f043196222a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef _MASK_H
#define _MASK_H
#include "error.h"
#include <string>
#include <exception>
#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;
}
};
class mask_error : public error {
public:
mask_error(const string& _reason) throw() : error(_reason) {}
virtual ~mask_error() throw() {}
};
} // namespace ledger
#endif // _MASK_H
|