00001 #include "config.h" 00002 #include "hash.h" 00003 #include "Queue.h" 00004 #include <qstring.h> 00005 00006 typedef hashtable<tchar,unsigned int>::iterator iter; 00007 00008 #define WORD_SIZE 32 00009 00010 class CRegExpFilt 00011 { 00012 CQueue<tchar> m_outQueue; 00013 hashtable<tchar,unsigned int> CV; 00014 unsigned int bit[WORD_SIZE]; 00015 unsigned int R; 00016 unsigned int bit_0, endpos; 00017 unsigned int patlength; 00018 unsigned int keep, len; 00019 unsigned int replace, cur; 00020 void regchar(tchar, bool); 00021 void prepreprocessing(const QString& pat, bool insens); 00022 unsigned int preprocessing(const QString& pat, bool insens); 00023 tchar word[WORD_SIZE]; 00024 unsigned int lfcnt[WORD_SIZE]; 00025 tchar escapedchar(tchar c); 00026 int islower(tchar c) 00027 { 00028 return (('a' <= c) && (c <= 'z')); 00029 } 00030 tchar upper(tchar c) 00031 { 00032 return (tchar)(islower(c) ? (c - 'a' + 'A') : c); 00033 } 00034 int isupper(tchar c) 00035 { 00036 return (('A' <= c) && (c <= 'Z')); 00037 } 00038 tchar lower(tchar c) 00039 { 00040 return (tchar)(isupper(c) ? (c + 'a' - 'A') : c); 00041 } 00042 public: 00043 CRegExpFilt(const QString& pat, bool insens); 00044 ~CRegExpFilt(); 00045 bool addch(tchar); 00046 void restart(); 00047 unsigned int matchlength() 00048 { return patlength; } 00049 bool empty(); 00050 tchar pop(); 00051 };
1.4.2