From bcffbc96ba88bd19f5f8ac00015ff38131fd6466 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 3 Aug 2008 23:44:18 -0400 Subject: Regular expressions are working again, such that very basic register reports are now possible. --- mask.cc | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'mask.cc') diff --git a/mask.cc b/mask.cc index d3ad539e..b32be359 100644 --- a/mask.cc +++ b/mask.cc @@ -34,7 +34,7 @@ namespace ledger { -mask_t::mask_t(const string& pat) : exclude(false), expr() +mask_t::mask_t(const string& pat) : expr() { TRACE_CTOR(mask_t, "const string&"); *this = pat; @@ -42,40 +42,17 @@ mask_t::mask_t(const string& pat) : exclude(false), expr() mask_t& mask_t::operator=(const string& pat) { - exclude = false; - - const char * p = pat.c_str(); - - if (*p == '-') { - exclude = true; - p++; - while (std::isspace(*p)) - p++; - } - else if (*p == '+') { - p++; - while (std::isspace(*p)) - p++; - } - - expr.assign(p); - + expr.assign(pat.c_str(), regex::perl | regex::icase); return *this; } void mask_t::read(const char *& data) { - binary::read_number(data, exclude); - - string pattern; - binary::read_string(data, pattern); - - *this = pattern; + *this = binary::read_string(data); } void mask_t::write(std::ostream& out) const { - binary::write_number(out, exclude); binary::write_string(out, expr.str()); } -- cgit v1.2.3