The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zverse.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * zverse.h - class 'zVerse'- a support class for module drivers
4  * which support a 2 byte entry size and use Versekey
5  * for their entry keys
6  *
7  * $Id: zverse.h 3786 2020-08-30 11:35:14Z scribe $
8  *
9  * Copyright 2000-2013 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 ZVERSE_H
27 #define ZVERSE_H
28 
29 #include <defs.h>
30 
32 
33 class FileDesc;
34 class SWCompress;
35 class SWBuf;
36 
39 
40 protected:
41  static int instance; // number of instantiated zVerse objects or derivitives
42 
43  FileDesc *idxfp[2];
44  FileDesc *textfp[2];
45  FileDesc *compfp[2];
46  char *path;
47  void doSetText(char testmt, long idxoff, const char *buf, long len = 0);
48  void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
49  void flushCache() const;
50  mutable char *cacheBuf;
51  mutable unsigned int cacheBufSize;
52  mutable char cacheTestament;
53  mutable long cacheBufIdx;
54  mutable bool dirtyCache;
55 
56 public:
57 
58 #define VERSEBLOCKS 2
59 #define CHAPTERBLOCKS 3
60 #define BOOKBLOCKS 4
61 
62  static const char uniqueIndexID[];
63 
64  // fileMode default = RDONLY
65  zVerse(const char *ipath, int fileMode = -1, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
66  virtual ~zVerse();
67 
68  void findOffset(char testmt, long idxoff, long *start, unsigned short *size, unsigned long *buffnum) const;
69  void zReadText(char testmt, long start, unsigned short size, unsigned long buffnum, SWBuf &buf) const;
70  virtual void rawZFilter(SWBuf &buf, char direction = 0) const { (void) buf; (void) direction; }
71  static char createModule(const char *path, int blockBound, const char *v11n = "KJV");
72 };
73 
75 #endif
SWCompress * compressor
Definition: zverse.h:38
#define SWORD_NAMESPACE_START
Definition: defs.h:39
Definition: swbuf.h:47
#define SWDLLEXPORT
Definition: defs.h:171
char cacheTestament
Definition: zverse.h:52
char * cacheBuf
Definition: zverse.h:50
bool dirtyCache
Definition: zverse.h:54
unsigned int cacheBufSize
Definition: zverse.h:51
long cacheBufIdx
Definition: zverse.h:53
SWBuf v11n
Definition: osis2mod.cpp:107
#define CHAPTERBLOCKS
Definition: zverse.h:59
virtual void rawZFilter(SWBuf &buf, char direction=0) const
Definition: zverse.h:70
int size
Definition: regex.c:5043
Definition: zverse.h:37
static int instance
Definition: zverse.h:41
#define SWORD_NAMESPACE_END
Definition: defs.h:40
char * path
Definition: zverse.h:46