diff options
| author | John Wiegley <johnw@newartisans.com> | 2007-04-19 20:31:46 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:28 -0400 |
| commit | 0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c (patch) | |
| tree | 0a2c2aca7100d045f491b03f0a5bda92378d3ef9 /mask.cc | |
| parent | 176b3044e355398a0c31e0c42a3cd7b8a2e3f3e5 (diff) | |
| download | ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.gz ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.bz2 ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.zip | |
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.
Diffstat (limited to 'mask.cc')
| -rw-r--r-- | mask.cc | 39 |
1 files changed, 2 insertions, 37 deletions
@@ -4,13 +4,10 @@ #include <cstdlib> -#include <pcre.h> - mask_t::mask_t(const std::string& pat) : exclude(false) { - TRACE_CTOR("mask_t(const std::string&)"); - const char * p = pat.c_str(); + if (*p == '-') { exclude = true; p++; @@ -22,38 +19,6 @@ mask_t::mask_t(const std::string& pat) : exclude(false) while (std::isspace(*p)) p++; } - pattern = p; - - const char *error; - int erroffset; - regexp = pcre_compile(pattern.c_str(), PCRE_CASELESS, - &error, &erroffset, NULL); - if (! regexp) - throw new mask_error(std::string("Failed to compile regexp '") + - pattern + "'"); -} - -mask_t::mask_t(const mask_t& m) : exclude(m.exclude), pattern(m.pattern) -{ - TRACE_CTOR("mask_t(copy)"); - - const char *error; - int erroffset; - regexp = pcre_compile(pattern.c_str(), PCRE_CASELESS, - &error, &erroffset, NULL); - assert(regexp); -} -mask_t::~mask_t() { - TRACE_DTOR("mask_t"); - if (regexp) - pcre_free((pcre *)regexp); -} - -bool mask_t::match(const std::string& str) const -{ - static int ovec[30]; - int result = pcre_exec((pcre *)regexp, NULL, - str.c_str(), str.length(), 0, 0, ovec, 30); - return result >= 0 && ! exclude; + expr.assign(p); } |
