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 @@ +#include "config.h" +#include "hash.h" +#include "Queue.h" +#include <qstring.h> + +typedef hashtable<tchar,unsigned int>::iterator iter; + +#define WORD_SIZE 32 + +class CRegExpFilt +{ + CQueue<tchar> m_outQueue; + hashtable<tchar,unsigned int> CV; + unsigned int bit[WORD_SIZE]; + unsigned int R; + unsigned int bit_0, endpos; + unsigned int patlength; + unsigned int keep, len; + unsigned int replace, cur; + void regchar(tchar, bool); + void prepreprocessing(const QString& pat, bool insens); + unsigned int preprocessing(const QString& pat, bool insens); + tchar word[WORD_SIZE]; + unsigned int lfcnt[WORD_SIZE]; + tchar escapedchar(tchar c); + int islower(tchar c) + { + return (('a' <= c) && (c <= 'z')); + } + tchar upper(tchar c) + { + return (tchar)(islower(c) ? (c - 'a' + 'A') : c); + } + int isupper(tchar c) + { + return (('A' <= c) && (c <= 'Z')); + } + tchar lower(tchar c) + { + return (tchar)(isupper(c) ? (c + 'a' - 'A') : c); + } + public: + CRegExpFilt(const QString& pat, bool insens); + ~CRegExpFilt(); + bool addch(tchar); + void restart(); + unsigned int matchlength() + { return patlength; } + bool empty(); + tchar pop(); +}; |