summaryrefslogtreecommitdiff
path: root/mask.cc
diff options
context:
space:
mode:
Diffstat (limited to 'mask.cc')
-rw-r--r--mask.cc52
1 files changed, 0 insertions, 52 deletions
diff --git a/mask.cc b/mask.cc
deleted file mode 100644
index 33dcf93b..00000000
--- a/mask.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "mask.h"
-#include "debug.h"
-#include "util.h"
-
-#include <cstdlib>
-
-#include <pcre.h>
-
-mask_t::mask_t(const std::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++;
- }
- pattern = p;
-
- const char *error;
- int erroffset;
- regexp = pcre_compile(pattern.c_str(), PCRE_CASELESS,
- &error, &erroffset, NULL);
- if (! regexp)
- throw mask_error(std::string("Failed to compile regexp '") + pattern + "'");
-}
-
-mask_t::mask_t(const mask_t& m) : exclude(m.exclude), pattern(m.pattern)
-{
- const char *error;
- int erroffset;
- regexp = pcre_compile(pattern.c_str(), PCRE_CASELESS,
- &error, &erroffset, NULL);
- assert(regexp);
-}
-
-mask_t::~mask_t() {
- 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;
-}