The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zld.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * zld.cpp - class zLD: a module driver that supports compressed lexicon
4  * and dictionary data with entries less than 2 bytes size
5  *
6  * $Id: zld.h 3786 2020-08-30 11:35:14Z scribe $
7  *
8  * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
9  * CrossWire Bible Society
10  * P. O. Box 2528
11  * Tempe, AZ 85280-2528
12  *
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of the GNU General Public License as published by the
15  * Free Software Foundation version 2.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * General Public License for more details.
21  *
22  */
23 
24 #ifndef ZLD_H
25 #define ZLD_H
26 
27 #include <zstr.h>
28 #include <swld.h>
29 
30 #include <defs.h>
31 
33 
34 class SWDLLEXPORT zLD : public zStr, public SWLD {
35 
36 private:
37  char getEntry(long away = 0) const;
38 
39 public:
40  zLD(const char *ipath, const char *iname = 0, const char *idesc = 0, long blockCount = 200, SWCompress *icomp = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0, bool caseSensitive = false, bool strongsPadding = true);
41  virtual ~zLD();
42  virtual SWBuf &getRawEntryBuf() const;
43 
44  virtual void increment(int steps = 1);
45  virtual void decrement(int steps = 1) { increment(-steps); }
46 
47  // write interface ----------------------------
48  virtual bool isWritable() const;
49  static char createModule(const char *path) {
50  return zStr::createModule(path);
51  }
52 
53  virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
54  virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
55  virtual void deleteEntry(); // Delete current module entry
56  // end write interface ------------------------
57 
58  virtual void rawZFilter(SWBuf &buf, char direction = 0) const { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
59 
60  // swcacher interface ----------------------
61  virtual void flush() { flushCache(); }
62  // end swcacher interface ----------------------
63 
64  virtual long getEntryCount() const;
65  virtual long getEntryForKey(const char *key) const;
66  virtual char *getKeyForEntry(long entry) const;
67 
68 
69  // OPERATORS -----------------------------------------------------------------
70 
72 
73 };
74 
76 #endif
#define SWTextEncoding
Definition: swmodule.h:78
#define SWORD_NAMESPACE_START
Definition: defs.h:39
virtual long getEntryCount() const =0
Definition: swbuf.h:47
Definition: zld.h:34
#define SWDLLEXPORT
Definition: defs.h:171
virtual void rawFilter(SWBuf &buf, const SWKey *key) const
Definition: swmodule.h:716
virtual void deleteEntry()
Definition: swmodule.h:525
virtual void setEntry(const char *inbuf, long len=-1)
Definition: swmodule.cpp:1680
virtual void decrement(int steps=1)
Definition: zld.h:45
void flushCache() const
Definition: zstr.cpp:590
virtual long getEntryForKey(const char *key) const =0
virtual void linkEntry(const SWKey *sourceKey)
Definition: swmodule.cpp:1683
virtual bool isWritable() const
Definition: swmodule.h:506
virtual void increment(int steps=1)
Definition: swmodule.cpp:355
virtual SWBuf & getRawEntryBuf() const =0
virtual void flush()
Definition: zld.h:61
#define SWMODULE_OPERATORS
Definition: swmodule.h:54
virtual void rawZFilter(SWBuf &buf, char direction=0) const
Definition: zld.h:58
static signed char createModule(const char *path)
Definition: zstr.cpp:663
static char createModule(const char *path)
Definition: zld.h:49
virtual char * getKeyForEntry(long entry) const =0
#define SWTextDirection
Definition: swmodule.h:77
#define SWORD_NAMESPACE_END
Definition: defs.h:40
Definition: zstr.h:36
Definition: swkey.h:77
Definition: swld.h:36
#define SWTextMarkup
Definition: swmodule.h:79