summaryrefslogtreecommitdiff
path: root/src/modules/lexdict/zld/zld.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/lexdict/zld/zld.cpp')
-rw-r--r--src/modules/lexdict/zld/zld.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/modules/lexdict/zld/zld.cpp b/src/modules/lexdict/zld/zld.cpp
index 2c46657..71919d4 100644
--- a/src/modules/lexdict/zld/zld.cpp
+++ b/src/modules/lexdict/zld/zld.cpp
@@ -1,8 +1,11 @@
/******************************************************************************
- * rawld.cpp - code for class 'RawLD'- a module that reads raw lexicon and
- * dictionary files: *.dat *.idx
*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * zld.cpp - code for class 'zLD'- a module that reads zlib compressed
+ * lexicon and dictionary files
+ *
+ * $Id: zld.cpp 2980 2013-09-14 21:51:47Z scribe $
+ *
+ * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -27,8 +30,10 @@
#include <stdio.h>
+
SWORD_NAMESPACE_START
+
/******************************************************************************
* RawLD Constructor - Initializes data for instance of RawLD
*
@@ -38,7 +43,7 @@ SWORD_NAMESPACE_START
* idisp - Display object to use for displaying
*/
-zLD::zLD(const char *ipath, const char *iname, const char *idesc, long blockCount, SWCompress *icomp, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : zStr(ipath, -1, blockCount, icomp), SWLD(iname, idesc, idisp, enc, dir, mark, ilang) {
+zLD::zLD(const char *ipath, const char *iname, const char *idesc, long blockCount, SWCompress *icomp, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive, bool strongsPadding) : zStr(ipath, -1, blockCount, icomp, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang, strongsPadding) {
}
@@ -52,7 +57,7 @@ zLD::~zLD() {
}
-bool zLD::isWritable() {
+bool zLD::isWritable() const {
return ((idxfd->getFd() > 0) && ((idxfd->mode & FileMgr::RDWR) == FileMgr::RDWR));
}
@@ -66,7 +71,7 @@ bool zLD::isWritable() {
* RET: error status
*/
-char zLD::getEntry(long away) {
+char zLD::getEntry(long away) const {
char *idxbuf = 0;
char *ebuf = 0;
char retval = 0;
@@ -75,7 +80,7 @@ char zLD::getEntry(long away) {
char *buf = new char [ strlen(*key) + 6 ];
strcpy(buf, *key);
- strongsPad(buf);
+ if (strongsPadding) strongsPad(buf);
entryBuf = "";
if (!(retval = findKeyIndex(buf, &index, away))) {
@@ -86,7 +91,7 @@ char zLD::getEntry(long away) {
rawFilter(entryBuf, key);
entrySize = size; // support getEntrySize call
- if (!key->Persist()) // If we have our own key
+ if (!key->isPersist()) // If we have our own key
*key = idxbuf; // reset it to entry index buffer
stdstr(&entkeytxt, idxbuf); // set entry key text that module 'snapped' to.
@@ -106,7 +111,7 @@ char zLD::getEntry(long away) {
* RET: string buffer with entry
*/
-SWBuf &zLD::getRawEntryBuf() {
+SWBuf &zLD::getRawEntryBuf() const {
if (!getEntry() /*&& !isUnicode()*/) {
prepText(entryBuf);
}
@@ -128,7 +133,7 @@ void zLD::increment(int steps) {
if (key->isTraversable()) {
*key += steps;
- error = key->Error();
+ error = key->popError();
steps = 0;
}
@@ -172,7 +177,7 @@ long zLD::getEntryForKey(const char* key) const
char *buf = new char [ strlen(key) + 6 ];
strcpy(buf, key);
- strongsPad(buf);
+ if (strongsPadding) strongsPad(buf);
findKeyIndex(buf, &offset);
@@ -191,3 +196,4 @@ char *zLD::getKeyForEntry(long entry) const
SWORD_NAMESPACE_END
+