summaryrefslogtreecommitdiff
path: root/mask.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-08-03 23:44:18 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-08-03 23:44:18 -0400
commitbcffbc96ba88bd19f5f8ac00015ff38131fd6466 (patch)
tree7f4a9646bb05f138b00cdc7127dd45cc05142cb5 /mask.cc
parent8a21391d0a6d6187855b40530f25b1d8beb0d67a (diff)
downloadfork-ledger-bcffbc96ba88bd19f5f8ac00015ff38131fd6466.tar.gz
fork-ledger-bcffbc96ba88bd19f5f8ac00015ff38131fd6466.tar.bz2
fork-ledger-bcffbc96ba88bd19f5f8ac00015ff38131fd6466.zip
Regular expressions are working again, such that very basic register reports
are now possible.
Diffstat (limited to 'mask.cc')
-rw-r--r--mask.cc29
1 files changed, 3 insertions, 26 deletions
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());
}