The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zcom.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * zcom.h - class zCom: a module driver for uncompressed commentaries
4  * with entries sizes stored at 2 bytes
5  *
6  * $Id: zcom.h 3786 2020-08-30 11:35:14Z scribe $
7  *
8  * Copyright 1996-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 ZCOM_H
25 #define ZCOM_H
26 
27 #include <swcom.h>
28 
29 #include <defs.h>
30 
32 
33 class SWDLLEXPORT zCom : public zVerse, public SWCom {
34 
35 private:
37  bool sameBlock(VerseKey * lastWriteKey, VerseKey * key);
38  int blockType;
39 
40 
41 public:
42 
43  zCom(const char *ipath, const char *iname = 0, const char *idesc = 0,
44  int blockType = CHAPTERBLOCKS, SWCompress *icomp = 0,
45  SWDisplay *idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
47  SWTextMarkup markup = FMT_UNKNOWN, const char *ilang = 0,
48  const char *versification = "KJV");
49  virtual ~zCom();
50  virtual SWBuf &getRawEntryBuf() const;
51  virtual void increment(int steps = 1);
52  virtual void decrement(int steps = 1) { increment(-steps); }
53 
54  // write interface ----------------------------
55  virtual bool isWritable() const;
56  static char createModule(const char *path, int blockBound, const char *v11n = "KJV") {
57  return zVerse::createModule(path, blockBound, v11n);
58  }
59  virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
60  virtual void linkEntry(const SWKey * linkKey); // Link current module entry to other module entry
61  virtual void deleteEntry(); // Delete current module entry
62  // end write interface ------------------------
63 
64  virtual void rawZFilter(SWBuf &buf, char direction = 0) const { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
65 
66  // swcacher interface ----------------------
67  virtual void flush() { flushCache(); }
68  // end swcacher interface ----------------------
69 
70  virtual bool isLinked(const SWKey *k1, const SWKey *k2) const;
71  virtual bool hasEntry(const SWKey *k) const;
72 
74 
75 };
76 
78 
79 #endif
#define SWTextEncoding
Definition: swmodule.h:78
#define SWORD_NAMESPACE_START
Definition: defs.h:39
Definition: swbuf.h:47
#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
VerseKey * lastWriteKey
Definition: zcom.h:36
SWBuf v11n
Definition: osis2mod.cpp:107
#define CHAPTERBLOCKS
Definition: zverse.h:59
virtual bool isLinked(const SWKey *, const SWKey *) const
Definition: swmodule.h:808
static char createModule(const char *path, int blockBound, const char *v11n="KJV")
Definition: zcom.h:56
Definition: zcom.h:33
virtual void linkEntry(const SWKey *sourceKey)
Definition: swmodule.cpp:1683
virtual void rawZFilter(SWBuf &buf, char direction=0) const
Definition: zcom.h:64
static char createModule(const char *path, int blockBound, const char *v11n="KJV")
Definition: zverse.cpp:426
virtual bool isWritable() const
Definition: swmodule.h:506
virtual void flush()
Definition: zcom.h:67
virtual bool hasEntry(const SWKey *) const
Definition: swmodule.h:809
virtual void increment(int steps=1)
Definition: swmodule.cpp:355
Definition: swcom.h:49
virtual SWBuf & getRawEntryBuf() const =0
#define SWMODULE_OPERATORS
Definition: swmodule.h:54
int blockType
Definition: zcom.h:38
Definition: zverse.h:37
#define SWTextDirection
Definition: swmodule.h:77
#define SWORD_NAMESPACE_END
Definition: defs.h:40
Definition: swkey.h:77
#define SWTextMarkup
Definition: swmodule.h:79
virtual void decrement(int steps=1)
Definition: zcom.h:52
void flushCache() const
Definition: zverse.cpp:339