strigi/src/streams
kmpsearcher.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef STRIGI_KMPSEARCHER_H
00021 #define STRIGI_KMPSEARCHER_H
00022
00023 #include <string>
00024 #include <stdlib.h>
00025
00026 #include <strigi/strigiconfig.h>
00027
00028 namespace Strigi {
00034 class STREAMS_EXPORT KmpSearcher {
00035 private:
00036 std::string m_query;
00037 int32_t* table;
00038 int32_t len;
00039 int32_t maxlen;
00040 public:
00041 KmpSearcher() :table(0) { }
00042 KmpSearcher(const std::string& query);
00043 ~KmpSearcher() {
00044 if (table) {
00045 free(table);
00046 }
00047 }
00048 void setQuery(const std::string& query);
00049 int32_t queryLength() const { return len; }
00050 std::string query() const { return m_query; }
00058 const char* search(const char* haystack, int32_t haylen) const;
00059 };
00060
00061 }
00062
00063 #endif