Diffstat (limited to 'noncore/apps/opie-reader/CRegExp.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CRegExp.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/CRegExp.h b/noncore/apps/opie-reader/CRegExp.h new file mode 100644 index 0000000..661e300 --- a/dev/null +++ b/noncore/apps/opie-reader/CRegExp.h | |||
@@ -0,0 +1,51 @@ | |||
1 | #include "config.h" | ||
2 | #include "hash.h" | ||
3 | #include "Queue.h" | ||
4 | #include <qstring.h> | ||
5 | |||
6 | typedef hashtable<tchar,unsigned int>::iterator iter; | ||
7 | |||
8 | #define WORD_SIZE32 | ||
9 | |||
10 | class CRegExpFilt | ||
11 | { | ||
12 | CQueue<tchar> m_outQueue; | ||
13 | hashtable<tchar,unsigned int> CV; | ||
14 | unsigned int bit[WORD_SIZE]; | ||
15 | unsigned int R; | ||
16 | unsigned int bit_0, endpos; | ||
17 | unsigned int patlength; | ||
18 | unsigned int keep, len; | ||
19 | unsigned int replace, cur; | ||
20 | void regchar(tchar, bool); | ||
21 | void prepreprocessing(const QString& pat, bool insens); | ||
22 | unsigned int preprocessing(const QString& pat, bool insens); | ||
23 | tchar word[WORD_SIZE]; | ||
24 | unsigned int lfcnt[WORD_SIZE]; | ||
25 | tchar escapedchar(tchar c); | ||
26 | int islower(tchar c) | ||
27 | { | ||
28 | return (('a' <= c) && (c <= 'z')); | ||
29 | } | ||
30 | tchar upper(tchar c) | ||
31 | { | ||
32 | return (tchar)(islower(c) ? (c - 'a' + 'A') : c); | ||
33 | } | ||
34 | int isupper(tchar c) | ||
35 | { | ||
36 | return (('A' <= c) && (c <= 'Z')); | ||
37 | } | ||
38 | tchar lower(tchar c) | ||
39 | { | ||
40 | return (tchar)(isupper(c) ? (c + 'a' - 'A') : c); | ||
41 | } | ||
42 | public: | ||
43 | CRegExpFilt(const QString& pat, bool insens); | ||
44 | ~CRegExpFilt(); | ||
45 | bool addch(tchar); | ||
46 | void restart(); | ||
47 | unsigned int matchlength() | ||
48 | { return patlength; } | ||
49 | bool empty(); | ||
50 | tchar pop(); | ||
51 | }; | ||