summaryrefslogtreecommitdiff
path: root/mask.h
blob: 7d38f24f91a8b9db0e0b9f61c980c4dad6824af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _MASK_H
#define _MASK_H

#include <string>
#include <exception>

class mask_t
{
 public:
  bool        exclude;
  std::string pattern;
  void *      regexp;

  explicit mask_t(const std::string& pattern);
  mask_t(const mask_t&);
  ~mask_t();

  bool match(const std::string& str) const;
};

class mask_error : public std::exception {
  std::string reason;
 public:
  mask_error(const std::string& _reason) throw() : reason(_reason) {}
  virtual ~mask_error() throw() {}

  virtual const char* what() const throw() {
    return reason.c_str();
  }
};

#endif // _MASK_H