The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zverse4.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * zverse4.h - class zVerse4: a helper class for module drivers
4  * which provide 4 byte size entries and use VerseKey
5  * for their entry keys
6  *
7  * $Id: zverse4.h 3786 2020-08-30 11:35:14Z scribe $
8  *
9  * Copyright 2000-2014 CrossWire Bible Society (http://www.crosswire.org)
10  * CrossWire Bible Society
11  * P. O. Box 2528
12  * Tempe, AZ 85280-2528
13  *
14  * This program is free software; you can redistribute it and/or modify it
15  * under the terms of the GNU General Public License as published by the
16  * Free Software Foundation version 2.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * General Public License for more details.
22  *
23  */
24 
25 
26 #ifndef ZVERSE4_H
27 #define ZVERSE4_H
28 
29 #include <defs.h>
30 
32 
33 class FileDesc;
34 class SWCompress;
35 class SWBuf;
36 
38 
39 private:
41 
42 protected:
43  static int instance; // number of instantiated zVerse4 objects or derivitives
44 
45  FileDesc *idxfp[2];
46  FileDesc *textfp[2];
47  FileDesc *compfp[2];
48  char *path;
49  void doSetText(char testmt, long idxoff, const char *buf, long len = 0);
50  void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
51  void flushCache() const;
52  mutable char *cacheBuf;
53  mutable unsigned int cacheBufSize;
54  mutable char cacheTestament;
55  mutable long cacheBufIdx;
56  mutable bool dirtyCache;
57 
58 public:
59 
60 #define VERSEBLOCKS 2
61 #define CHAPTERBLOCKS 3
62 #define BOOKBLOCKS 4
63 
64  static const char uniqueIndexID[];
65 
66 
67  // fileMode default = RDONLY
68  zVerse4(const char *ipath, int fileMode = -1, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
69  virtual ~zVerse4();
70 
71  void findOffset(char testmt, long idxoff, long *start, unsigned long *size, unsigned long *buffnum) const;
72  void zReadText(char testmt, long start, unsigned long size, unsigned long buffnum, SWBuf &buf) const;
73  virtual void rawZFilter(SWBuf &buf, char direction = 0) const { (void) buf; (void) direction; }
74  static char createModule(const char *path, int blockBound, const char *v11n = "KJV");
75 };
76 
78 #endif
virtual void rawZFilter(SWBuf &buf, char direction=0) const
Definition: zverse4.h:73
#define SWORD_NAMESPACE_START
Definition: defs.h:39
bool dirtyCache
Definition: zverse4.h:56
Definition: swbuf.h:47
char cacheTestament
Definition: zverse4.h:54
#define SWDLLEXPORT
Definition: defs.h:171
char * path
Definition: zverse4.h:48
SWBuf v11n
Definition: osis2mod.cpp:107
char * cacheBuf
Definition: zverse4.h:52
long cacheBufIdx
Definition: zverse4.h:55
int size
Definition: regex.c:5043
unsigned int cacheBufSize
Definition: zverse4.h:53
#define SWORD_NAMESPACE_END
Definition: defs.h:40
SWCompress * compressor
Definition: zverse4.h:40
#define CHAPTERBLOCKS
Definition: zverse4.h:61
static int instance
Definition: zverse4.h:43