Classes | Public Member Functions | Static Public Member Functions | List of all members
Celartem::DjVu::TextSearcher Class Referenceabstract

#include <djv_text.h>

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

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
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

Static Public Member Functions

static AutoPtr< TextSearchercreate (TextZone *inTextZone)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

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
inTextZoneTextZone 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 \ref Match information corresponding to the specified
            indeces.\n
            This method is used with \ref getFullText and you can use
            any searching function against the full text returned by
            \ref 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
inIndexThe position of the pattern.
inLengthThe length of the pattern.
outMatchMatch 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
inTextZoneA TextZone instance to search.
outIndexReference to a variable to receive the position of the specified instance.
If the function failed, the value of the variable is not predictable.
outLengthReference 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:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo