00001
00002
00003
00004
00005
00006
00007
00008 #ifndef ZVERSE_H
00009 #define ZVERSE_H
00010
00011 #include <filemgr.h>
00012 #include <fcntl.h>
00013 #include <rawverse.h>
00014 #include <swcomprs.h>
00015
00016 #include <defs.h>
00017
00018 class SWDLLEXPORT zVerse {
00019 SWCompress *compressor;
00020
00021 protected:
00022 static int instance;
00023
00024 FileDesc *idxfp[2];
00025 FileDesc *textfp[2];
00026 FileDesc *compfp[2];
00027 char *path;
00028 void preptext (char *buf);
00029 void settext (char testmt, long idxoff, const char *buf, long len = 0);
00030 void linkentry (char testmt, long destidxoff, long srcidxoff);
00031 void flushCache ();
00032
00033 char *cacheBuf;
00034 char cacheTestament;
00035 long cacheBufIdx;
00036 bool dirtyCache;
00037
00038 public:
00039
00040 #define VERSEBLOCKS 2
00041 #define CHAPTERBLOCKS 3
00042 #define BOOKBLOCKS 4
00043
00044 static const char uniqueIndexID[];
00045 char nl;
00046
00047
00048 zVerse (const char *ipath, int fileMode = O_RDONLY, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
00049 virtual ~ zVerse ();
00050 void findoffset (char testmt, long idxoff, long *start, unsigned short *end);
00051 void swgettext (char testmt, long start, unsigned short size, char *buf);
00052 static char createModule (const char *path, int blockBound);
00053 };
00054
00055
00056 #endif