mailfilter  0.8.9
filter.hh
Go to the documentation of this file.
1 // filter.hh - source file for the mailfilter program
2 // Copyright (c) 2000 - 2009 Andreas Bauer <baueran@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 // USA.
18 
19 #ifndef FILTER_HH
20 #define FILTER_HH
21 
22 #include <string>
23 extern "C" {
24 #include <regex.h>
25 #include <sys/types.h>
26 }
27 
28 // Filter modes
29 #define CASE_DEFAULT REG_ICASE
30 #define CASE_SENSITIVE 0
31 #define CASE_INSENSITIVE REG_ICASE
32 
33 using namespace std;
34 
35 class Filter
36 {
37 private:
38  string expr;
39  regex_t comp_expr;
40  // Values can be CASE_SENSITIVE, CASE_INSENSITIVE, or CASE_DEFAULT:
41  int case_sensitivity;
42  bool negativity;
43  bool compiled;
44 
45 public:
46  Filter (void);
47  ~Filter (void);
48  string expression (void) const;
49  void set_expression (const char*);
50  int compile (void);
51  void set_negativity (bool);
52  bool is_negative (void) const;
53  int ccase (void) const;
54  void set_case (int);
55  const regex_t* comp_exp (void) const;
56 };
57 
58 #endif
Definition: filter.hh:36