#ifndef SWORDINDEX_H #define SWORDINDEX_H #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "resource.h" #include "utils.h" #include #include #include #include //#include #include #include using namespace sword; struct ltstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) < 0; } }; typedef sword::SWModule* Module; typedef std::map ModuleMap; typedef sword::VerseKey Verse; class Searcher { public: virtual void setProgress(int percent)=0; virtual void addResult(const WCString &verse)=0; }; #define RANGEBIBLE 0 #define RANGETESTAMENT 1 #define RANGEBOOK 2 #define METHODMULTIWORD 0 #define METHODEXACTPHRASE 1 class SwordIndex { private: static void initManager(); static void leaveManager(); static int indices; static ModuleMap* texts; sword::sbook getBook(int book); sword::VerseKey* mark; //int book; TCHAR** bookNames; public: SwordIndex(); virtual ~SwordIndex(); WCString toString(); WCString verseText(); WCString verseText(sword::VerseKey* anyVerse); char *SwordIndex::getModName(); ModuleMap::iterator firstModule() {return texts->begin();}; ModuleMap::iterator lastModule() {return texts->end();}; void setModule(Module m); void setMark(); void jumpBack(); void next(); void search(const WCString &text, int range, int method, Searcher* searcher); static sword::SWMgr* manager; static SWModule *greekLex; static SWModule *hebrewLex; static SWModule *greekMorph; static SWModule *hebrewMorph; SWModule* bible; VerseKey* verse; bool initialized() { return (bible!=0);}; WCString bookName(int book); TCHAR** getBookNames() {return bookNames;}; static WCString verseToString(Verse* verse); WCString verseToString(); static int otBookCount() {return 39;}; static int bookCount() {return 66;}; void setBook(int book); int getBook() const {return (verse->Testament() == 1 ? verse->Book() : otBookCount() + verse->Book() /*book*/) - 1;}; int chapCount(); int maxChapCount() {return 150;}; void setChap(int chap); int getChap(); int verseCount(); int maxVerseCount() {return 176;}; void setVerse(int verse); int getVerse(); void setVerseKey(sword::VerseKey* anyVerse); void operator++(int) {verse->increment(1);}; void operator--(int) {verse->decrement(1);}; void operator+=(int count) {verse->increment(count);}; void operator-=(int count) {verse->decrement(count);}; }; void setPercentCB(char percent, void *userData); #endif