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 SWORD_NAMESPACE_START
00019
00020 class SWDLLEXPORT zVerse {
00021 SWCompress *compressor;
00022
00023 protected:
00024 static int instance;
00025
00026 FileDesc *idxfp[2];
00027 FileDesc *textfp[2];
00028 FileDesc *compfp[2];
00029 char *path;
00030 void prepText(SWBuf &buf);
00031 void doSetText(char testmt, long idxoff, const char *buf, long len = 0);
00032 void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
00033 void flushCache();
00034 char *cacheBuf;
00035 char cacheTestament;
00036 long cacheBufIdx;
00037 bool dirtyCache;
00038
00039 public:
00040
00041 #define VERSEBLOCKS 2
00042 #define CHAPTERBLOCKS 3
00043 #define BOOKBLOCKS 4
00044
00045 static const char uniqueIndexID[];
00046 char nl;
00047
00048
00049 zVerse(const char *ipath, int fileMode = O_RDONLY, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
00050 virtual ~zVerse();
00051 void findOffset(char testmt, long idxoff, long *start, unsigned short *end);
00052 void zReadText(char testmt, long start, unsigned short size, SWBuf &buf);
00053 virtual void rawZFilter(char *buf, long size, char direction = 0) {}
00054 static char createModule(const char *path, int blockBound);
00055 };
00056
00057 SWORD_NAMESPACE_END
00058 #endif