|
Revision 5, 0.6 KB
(checked in by nick, 3 years ago)
|
|
|
| Line | |
|---|
| 1 | #ifndef _FILTERS_H_ |
|---|
| 2 | #define _FILTERS_H_ |
|---|
| 3 | |
|---|
| 4 | /* Filter class |
|---|
| 5 | ** |
|---|
| 6 | ** Each instance has one filter, which is either plaintext or regular |
|---|
| 7 | ** expression (if HAVE_PCRE_H_ is defined): Quick example: |
|---|
| 8 | ** |
|---|
| 9 | ** f = new Filter(); |
|---|
| 10 | ** f->store("(movies|music)"); |
|---|
| 11 | ** if (f->isactive() && f->match("some string with movies in it")) |
|---|
| 12 | ** // you got a match |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | class Filter |
|---|
| 16 | { |
|---|
| 17 | public: |
|---|
| 18 | Filter(void); |
|---|
| 19 | ~Filter(void); |
|---|
| 20 | |
|---|
| 21 | void store(const char *filter); |
|---|
| 22 | bool isactive(void); |
|---|
| 23 | bool match(const char *string); |
|---|
| 24 | |
|---|
| 25 | void empty(void); |
|---|
| 26 | |
|---|
| 27 | private: |
|---|
| 28 | char *filter_text; |
|---|
| 29 | |
|---|
| 30 | #if HAVE_PCRE_H |
|---|
| 31 | RegEx *regexp; |
|---|
| 32 | #endif |
|---|
| 33 | |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | #endif /* _FILTERS_H_ */ |
|---|