ledger/mask.h
John Wiegley 0a6b5726ec Made the amount/balance/value interface a bit more rational; added
back a useless version of the register command (just to prove the
 command sequence); and added smart XML semantics to the XPath
 implementation so that nodes can be coerced to values.
2008-04-13 03:38:28 -04:00

31 lines
579 B
C++

#ifndef _MASK_H
#define _MASK_H
#include "error.h"
#include <string>
#include <exception>
#include <boost/regex.hpp>
class mask_t
{
public:
bool exclude;
boost::regex expr;
explicit mask_t(const std::string& pattern);
mask_t(const mask_t& m) : exclude(m.exclude), expr(m.expr) {}
bool match(const std::string& str) const {
return boost::regex_match(str, expr) && ! exclude;
}
};
class mask_error : public error {
public:
mask_error(const std::string& _reason) throw() : error(_reason) {}
virtual ~mask_error() throw() {}
};
#endif // _MASK_H