#include <djv_text.h>

Classes | |
| struct | Match |
Public Member Functions | |
| virtual String | getFullText () const =0 |
| virtual bool | getMatchFromIndex (size_t inIndex, size_t inLength, Match &outMatch) const =0 |
| virtual bool | locateTextZonePos (const TextZone *inTextZone, size_t &outIndex, size_t &outLength) const =0 |
Static Public Member Functions | |
| static AutoPtr< TextSearcher > | create (TextZone *inTextZone) |
This class provides a way to do full text search against a tree structured TextZone instances.
| static AutoPtr<TextSearcher> Celartem::DjVu::TextSearcher::create | ( | TextZone * | inTextZone | ) | [static] |
Create a new instance of TextSearcher.
| inTextZone | TextZone where you search texts. |
| virtual String Celartem::DjVu::TextSearcher::getFullText | ( | ) | const [pure virtual] |
Return the full text of the tree structured TextZone instances.
| virtual bool Celartem::DjVu::TextSearcher::getMatchFromIndex | ( | size_t | inIndex, | |
| size_t | inLength, | |||
| Match & | outMatch | |||
| ) | const [pure virtual] |
Get Match information corresponding to the specified indeces.
This method is used with getFullText and you can use any searching function against the full text returned by getFullText. This method accepts the index and the length of the matched text. The following sample roughly illustrates the procedure:
AutoPtr<TextSearcher> ts = TextSearcher::create(zone); String fullText = ts->getFullText(); String textToSearch = "Kick me!"; size_t pos = fullText.findPos(textToSearch); if(pos != notFound) { Match match; ts->getMatchFromIndex(pos, textToSearch.getLength(), match); // now match has the searched \ref TextZone instances. }
| inIndex | The position of the pattern. | |
| inLength | The length of the pattern. | |
| outMatch | Match instance which receives the information. |
| virtual bool Celartem::DjVu::TextSearcher::locateTextZonePos | ( | const TextZone * | inTextZone, | |
| size_t & | outIndex, | |||
| size_t & | outLength | |||
| ) | const [pure virtual] |
Locate the position of the specified TextZone instance.
| inTextZone | A TextZone instance to search. | |
| outIndex | Reference to a variable to receive the position of the specified instance. If the function failed, the value of the variable is not predictable. | |
| outLength | Reference to a variable to receive the length of the specified instance. If the function failed, the value of the variable is not predictable. |
ture if the instance is found; otherwise false.