The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SWSearchable Class Referenceabstract

#include <swsearchable.h>

+ Inheritance diagram for SWSearchable:
+ Collaboration diagram for SWSearchable:

Public Member Functions

virtual signed char createSearchFramework (void(*percent)(char, void *)=&nullPercent, void *percentUserData=0)
 
virtual void deleteSearchFramework ()
 
virtual bool hasSearchFramework ()
 
virtual bool isSearchOptimallySupported (const char *istr, int searchType, int flags, SWKey *scope)
 
virtual ListKeysearch (const char *istr, int searchType=0, int flags=0, SWKey *scope=0, bool *justCheckIfSupported=0, void(*percent)(char, void *)=&nullPercent, void *percentUserData=0)=0
 
 SWSearchable ()
 
virtual ~SWSearchable ()
 

Static Public Member Functions

static void nullPercent (char percent, void *userData)
 

Detailed Description

used to provide an interface for objects that be searched.

Definition at line 36 of file swsearchable.h.

Constructor & Destructor Documentation

SWSearchable::SWSearchable ( )

Definition at line 34 of file swsearchable.cpp.

34  {
35 }
SWSearchable::~SWSearchable ( )
virtual

Definition at line 38 of file swsearchable.cpp.

38  {
39 }

Member Function Documentation

signed char SWSearchable::createSearchFramework ( void(*)(char, void *)  percent = &nullPercent,
void *  percentUserData = 0 
)
virtual

ask the object to build any indecies it wants for optimal searching

Reimplemented in SWModule.

Definition at line 43 of file swsearchable.cpp.

43  {
44  return 0;
45 }
void SWSearchable::deleteSearchFramework ( )
virtual

Reimplemented in SWModule.

Definition at line 48 of file swsearchable.cpp.

48  {
49 }
virtual bool SWSearchable::hasSearchFramework ( )
inlinevirtual

was SWORD compiled with code to optimize searching for this driver?

Reimplemented in SWModule.

Definition at line 89 of file swsearchable.h.

89 { return false; }
bool SWSearchable::isSearchOptimallySupported ( const char *  istr,
int  searchType,
int  flags,
SWKey scope 
)
virtual

Check if the search is optimally supported (e.g. if index files are presnt and working) This function checks whether the search framework may work in the best way.

Returns
true if the the search is optimally supported, false if it's not working in the best way.

Definition at line 52 of file swsearchable.cpp.

52  {
53  bool retVal = false;
54  search(istr, searchType, flags, scope, &retVal);
55  return retVal;
56 }
virtual ListKey & search(const char *istr, int searchType=0, int flags=0, SWKey *scope=0, bool *justCheckIfSupported=0, void(*percent)(char, void *)=&nullPercent, void *percentUserData=0)=0
SWORD_NAMESPACE_START void SWSearchable::nullPercent ( char  percent,
void *  userData 
)
static

This is the default callback function for searching. This function is a placeholder and does nothing. You can define your own function for search progress evaluation, and pass it over to Search().

Definition at line 31 of file swsearchable.cpp.

31 {}
virtual ListKey& SWSearchable::search ( const char *  istr,
int  searchType = 0,
int  flags = 0,
SWKey scope = 0,
bool *  justCheckIfSupported = 0,
void(*)(char, void *)  percent = &nullPercent,
void *  percentUserData = 0 
)
pure virtual

Searches a module for a string

Parameters
istrstring for which to search
searchTypetype of search to perform >=0 - regex -1 - phrase -2 - multiword -3 - entryAttrib (eg. Word//Strongs/G1234/) -4 - Lucene
flagsoptions flags for search
scopeKey containing the scope. VerseKey or ListKey are useful here.
justCheckIfSupportedif set, don't search, only tell if this function supports requested search.
percentCallback function to get the current search status in %.
percentUserDataUser data that is given to the callback function as parameter.
Returns
ListKey set to verses that contain istr

Implemented in SWModule.


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