summaryrefslogtreecommitdiff
path: root/src/modules/lexdict/rawld4/rawld4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/lexdict/rawld4/rawld4.cpp')
-rw-r--r--src/modules/lexdict/rawld4/rawld4.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/modules/lexdict/rawld4/rawld4.cpp b/src/modules/lexdict/rawld4/rawld4.cpp
index 6d60d9a..1f81d83 100644
--- a/src/modules/lexdict/rawld4/rawld4.cpp
+++ b/src/modules/lexdict/rawld4/rawld4.cpp
@@ -1,9 +1,11 @@
/******************************************************************************
- * rawld.cpp - code for class 'RawLD'- a module that reads raw lexicon and
- * dictionary files: *.dat *.idx
*
+ * rawld4.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)
+ * $Id: rawld4.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
@@ -28,8 +30,10 @@
#include <stdio.h>
+
SWORD_NAMESPACE_START
+
/******************************************************************************
* RawLD Constructor - Initializes data for instance of RawLD
*
@@ -39,7 +43,7 @@ SWORD_NAMESPACE_START
* idisp - Display object to use for displaying
*/
-RawLD4::RawLD4(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : RawStr4(ipath), SWLD(iname, idesc, idisp, enc, dir, mark, ilang)
+RawLD4::RawLD4(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive, bool strongsPadding) : RawStr4(ipath, -1, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang, strongsPadding)
{
}
@@ -53,7 +57,7 @@ RawLD4::~RawLD4()
}
-bool RawLD4::isWritable() {
+bool RawLD4::isWritable() const {
return ((idxfd->getFd() > 0) && ((idxfd->mode & FileMgr::RDWR) == FileMgr::RDWR));
}
@@ -67,7 +71,7 @@ bool RawLD4::isWritable() {
* RET: error status
*/
-char RawLD4::getEntry(long away)
+char RawLD4::getEntry(long away) const
{
__u32 start = 0;
__u32 size = 0;
@@ -85,7 +89,7 @@ char RawLD4::getEntry(long away)
rawFilter(entryBuf, 0); // hack, decipher
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.
@@ -104,7 +108,7 @@ char RawLD4::getEntry(long away)
* RET: string buffer with entry
*/
-SWBuf &RawLD4::getRawEntryBuf() {
+SWBuf &RawLD4::getRawEntryBuf() const {
char ret = getEntry();
if (!ret) {
@@ -130,7 +134,7 @@ void RawLD4::increment(int steps) {
if (key->isTraversable()) {
*key += steps;
- error = key->Error();
+ error = key->popError();
steps = 0;
}
@@ -160,11 +164,13 @@ void RawLD4::deleteEntry() {
doSetText(*key, "");
}
+
long RawLD4::getEntryCount() const {
if (idxfd < 0) return 0;
return idxfd->seek(0, SEEK_END) / IDXENTRYSIZE;
}
+
long RawLD4::getEntryForKey(const char *key) const {
__u32 start, offset;
__u32 size;
@@ -181,10 +187,13 @@ long RawLD4::getEntryForKey(const char *key) const {
return offset / IDXENTRYSIZE;
}
+
char *RawLD4::getKeyForEntry(long entry) const {
char *key = 0;
getIDXBuf(entry * IDXENTRYSIZE, &key);
return key;
}
+
SWORD_NAMESPACE_END
+