// QuickSearch.h #ifndef QuickSearchh #define QuickSearchh #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // Quick and simple method of finding strings without needing them to be Null Terminated // If you know the pattern length is going to be less than 256 characters, you could make the array one of BYTEs rather than DWORDs... class CQuickSearch { DWORD TextLength; const char* Text; DWORD PatternLength; const char* Pattern; DWORD BCST[256]; // Quick Search Algorithm's bad-character shift table DWORD Resume; public: CQuickSearch(const char* Text, const char* Pattern, DWORD textLength=0, DWORD patternLength=0) : Text(Text), Pattern(Pattern), TextLength(textLength ? textLength : strlen(Text)), PatternLength(patternLength ? patternLength : strlen(Pattern)), Resume(0) { for(DWORD i=0; i< TextLength; ++i) BCST [i] =PatternLength+1; for(DWORD i=TextLength; i< 256; ++i) BCST [i] =1; for(DWORD i=0; i