strigi/src/streams
Strigi::KmpSearcher Class Reference
Class for string search that uses the Knuth-Morris-Pratt algorithm. More...
#include <kmpsearcher.h>
Public Member Functions | |
| KmpSearcher (const std::string &query) | |
| KmpSearcher () | |
| ~KmpSearcher () | |
| std::string | query () const |
| int32_t | queryLength () const |
| const char * | search (const char *haystack, int32_t haylen) const |
| void | setQuery (const std::string &query) |
Detailed Description
Class for string search that uses the Knuth-Morris-Pratt algorithm.
Code based on the example on http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
Definition at line 34 of file kmpsearcher.h.
Constructor & Destructor Documentation
| Strigi::KmpSearcher::KmpSearcher | ( | ) | [inline] |
Definition at line 41 of file kmpsearcher.h.
| KmpSearcher::KmpSearcher | ( | const std::string & | query | ) |
Definition at line 93 of file kmpsearcher.cpp.
| Strigi::KmpSearcher::~KmpSearcher | ( | ) | [inline] |
Definition at line 43 of file kmpsearcher.h.
Member Function Documentation
| std::string Strigi::KmpSearcher::query | ( | ) | const [inline] |
Definition at line 50 of file kmpsearcher.h.
| int32_t Strigi::KmpSearcher::queryLength | ( | ) | const [inline] |
Definition at line 49 of file kmpsearcher.h.
| const char * KmpSearcher::search | ( | const char * | haystack, | |
| int32_t | haylen | |||
| ) | const |
Find the needle in haystack.
- Parameters:
-
haystack the text to search in. haylen the length of the text to search in.
- Returns:
- a pointer to the start of the match if a match is found Otherwise
0.
Definition at line 116 of file kmpsearcher.cpp.
| void Strigi::KmpSearcher::setQuery | ( | const std::string & | query | ) |
The documentation for this class was generated from the following files:
KDE 4.4 API Reference