diff options
author | Roberto C. Sanchez <roberto@connexer.com> | 2014-05-12 08:21:30 -0400 |
---|---|---|
committer | Roberto C. Sanchez <roberto@connexer.com> | 2014-05-12 08:21:30 -0400 |
commit | 7a00574163029c0c2b649878c95d5acbd083564a (patch) | |
tree | c13cc5736025834df2874ed87ee8598070025ea6 /src/modules/lexdict/rawld/rawld.cpp | |
parent | b745315323de9f27538edac9453205ca70e6186e (diff) |
Imported Upstream version 1.7.2+dfsg
Diffstat (limited to 'src/modules/lexdict/rawld/rawld.cpp')
-rw-r--r-- | src/modules/lexdict/rawld/rawld.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/modules/lexdict/rawld/rawld.cpp b/src/modules/lexdict/rawld/rawld.cpp index e6a4d57..7446c10 100644 --- a/src/modules/lexdict/rawld/rawld.cpp +++ b/src/modules/lexdict/rawld/rawld.cpp @@ -1,9 +1,11 @@ /****************************************************************************** - * rawld.cpp - code for class 'RawLD'- a module that reads raw lexicon and - * dictionary files: *.dat *.idx * + * 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) + * $Id: rawld.cpp 2980 2013-09-14 21:51:47Z scribe $ + * + * Copyright 1998-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 */ -RawLD::RawLD(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : RawStr(ipath), SWLD(iname, idesc, idisp, enc, dir, mark, ilang) +RawLD::RawLD(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive, bool strongsPadding) : RawStr(ipath, -1, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang, strongsPadding) { } @@ -53,7 +57,7 @@ RawLD::~RawLD() } -bool RawLD::isWritable() { +bool RawLD::isWritable() const { return ((idxfd->getFd() > 0) && ((idxfd->mode & FileMgr::RDWR) == FileMgr::RDWR)); } @@ -67,7 +71,7 @@ bool RawLD::isWritable() { * RET: error status */ -char RawLD::getEntry(long away) +char RawLD::getEntry(long away) const { __u32 start = 0; __u16 size = 0; @@ -77,14 +81,14 @@ char RawLD::getEntry(long away) char *buf = new char [ strlen(*key) + 6 ]; strcpy(buf, *key); - strongsPad(buf); + if (strongsPadding) strongsPad(buf); if (!(retval = findOffset(buf, &start, &size, away))) { readText(start, &size, &idxbuf, entryBuf); 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. @@ -106,7 +110,7 @@ char RawLD::getEntry(long away) * RET: string buffer with entry */ -SWBuf &RawLD::getRawEntryBuf() { +SWBuf &RawLD::getRawEntryBuf() const { char ret = getEntry(); if (!ret) { @@ -132,7 +136,7 @@ void RawLD::increment(int steps) { if (key->isTraversable()) { *key += steps; - error = key->Error(); + error = key->popError(); steps = 0; } @@ -176,7 +180,7 @@ long RawLD::getEntryForKey(const char *key) const { char *buf = new char [ strlen(key) + 6 ]; strcpy(buf, key); - strongsPad(buf); + if (strongsPadding) strongsPad(buf); findOffset(buf, &start, &size, 0, &offset); @@ -192,4 +196,6 @@ char *RawLD::getKeyForEntry(long entry) const { return key; } + SWORD_NAMESPACE_END + |