ledger/mask.h
John Wiegley 9039e728b2 All system headers (except Boost) now included through system.hh;
also, added support for pre-compiled headers since I'm now using a
centralized resource for system headers.
2008-04-13 03:38:31 -04:00

32 lines
567 B
C++

#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;
}
};
class mask_error : public error {
public:
mask_error(const string& _reason) throw() : error(_reason) {}
virtual ~mask_error() throw() {}
};
} // namespace ledger
#endif // _MASK_H