1
/*****************************************************************************
2
* zstr.h - code for class 'zStr'- a module that reads compressed text
4
* and provides lookup and parsing functions based on
7
* $Id: zstr.h 2303 2009-04-06 13:38:34Z scribe $
9
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
10
* CrossWire Bible Society
12
* Tempe, AZ 85280-2528
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.
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.
37
class SWDLLEXPORT zStr {
40
static int instance; // number of instantiated zStr objects or derivitives
41
EntriesBlock *cacheBlock;
45
mutable long lastoff; // for caching and optimization
47
SWCompress *compressor;
54
static const int IDXENTRYSIZE;
55
static const int ZDXENTRYSIZE;
57
void getCompressedText(long block, long entry, char **buf);
59
void getKeyFromDatOffset(long ioffset, char **buf) const;
60
void getKeyFromIdxOffset(long ioffset, char **buf) const;
64
zStr(const char *ipath, int fileMode = -1, long blockCount = 100, SWCompress *icomp = 0);
66
signed char findKeyIndex(const char *ikey, long *idxoff, long away = 0) const;
67
void getText(long index, char **idxbuf, char **buf);
68
void setText(const char *ikey, const char *buf, long len = -1);
69
void linkEntry(const char *destkey, const char *srckey);
70
virtual void rawZFilter(SWBuf &buf, char direction = 0) {}
71
static signed char createModule (const char *path);