swsearchable.h

00001 /******************************************************************************
00002  *  swsearchable.h      - definition of class SWSearchable used to provide an
00003  *      interface for objects that be searched.
00004  *
00005  * $Id: swsearchable.h 2054 2007-05-25 17:31:39Z scribe $
00006  *
00007  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00008  *      CrossWire Bible Society
00009  *      P. O. Box 2528
00010  *      Tempe, AZ  85280-2528
00011  *
00012  * This program is free software; you can redistribute it and/or modify it
00013  * under the terms of the GNU General Public License as published by the
00014  * Free Software Foundation version 2.
00015  *
00016  * This program is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * General Public License for more details.
00020  *
00021  */
00022 
00023 #ifndef SWSEARCHABLE_H
00024 #define SWSEARCHABLE_H
00025 
00026 #include <defs.h>
00027 
00028 SWORD_NAMESPACE_START
00029 
00030 class ListKey;
00031 class SWKey;
00032 
00035 class SWDLLEXPORT SWSearchable {
00036 public:
00037         SWSearchable();
00038         virtual ~SWSearchable();
00039 
00046         static void nullPercent(char percent, void *userData);
00047 
00048         // search interface -------------------------------------------------
00049 
00069         virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0,
00070                         SWKey * scope = 0,
00071                         bool * justCheckIfSupported = 0,
00072                         void (*percent) (char, void *) = &nullPercent,
00073                         void *percentUserData = 0) = 0;
00074 
00078         virtual signed char createSearchFramework(
00079                         void (*percent) (char, void *) = &nullPercent,
00080                         void *percentUserData = 0);     // special search framework
00081 
00082         virtual void deleteSearchFramework();
00083         
00087         virtual bool hasSearchFramework() { return false; }
00088 
00097         virtual bool isSearchOptimallySupported(const char *istr, int searchType, int flags, SWKey *scope);
00098 };
00099 
00100 SWORD_NAMESPACE_END
00101 #endif