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 {
00020 SWCompress *compressor;
00021
00022 protected:
00023 static int instance;
00024
00025 FileDesc *idxfp[2];
00026 FileDesc *textfp[2];
00027 FileDesc *compfp[2];
00028 char *path;
00029 void preptext (char *buf);
00030 void settext (char testmt, long idxoff, const char *buf);
00031 void linkentry (char testmt, long destidxoff, long srcidxoff);
00032 void flushCache ();
00033
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 =
00050 CHAPTERBLOCKS, SWCompress * icomp = 0);
00051 virtual ~ zVerse ();
00052 void findoffset (char testmt, long idxoff, long *start,
00053 unsigned short *end);
00054 void swgettext (char testmt, long start, unsigned short size, char *buf);
00055
00056 static char createModule (const char *path, int blockBound);
00057 };
00058
00059
00060 #endif