Classes | Public Member Functions | Static Public Member Functions

Celartem::DjVu::TextSearcher Class Reference

#include <djv_text.h>

Inheritance diagram for Celartem::DjVu::TextSearcher:
Inheritance graph
[legend]

List of all members.

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< TextSearchercreate (TextZone *inTextZone)

Detailed Description

This class provides a way to do full text search against a tree structured TextZone instances.


Member Function Documentation

static AutoPtr<TextSearcher> Celartem::DjVu::TextSearcher::create ( TextZone inTextZone  )  [static]

Create a new instance of TextSearcher.

Parameters:
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.

Returns:
The full text.
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.
    }
Parameters:
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.

Parameters:
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.
Returns:
ture if the instance is found; otherwise false.

The documentation for this class was generated from the following file:

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:21.
Caminova Logo