summaryrefslogtreecommitdiff
path: root/src/modules/lexdict/swld.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/lexdict/swld.cpp')
-rw-r--r--src/modules/lexdict/swld.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/modules/lexdict/swld.cpp b/src/modules/lexdict/swld.cpp
index bccf5d8..5e1909b 100644
--- a/src/modules/lexdict/swld.cpp
+++ b/src/modules/lexdict/swld.cpp
@@ -1,9 +1,11 @@
/******************************************************************************
- * swld.cpp - code for base class 'SWLD'. SWLD is the basis for all
- * types of Lexicon and Dictionary modules (hence the 'LD').
*
+ * swld.cpp - code for base class 'SWLD'. SWLD is the basis for all
+ * types of Lexicon and Dictionary modules (hence the 'LD').
*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * $Id: swld.cpp 2980 2013-09-14 21:51:47Z scribe $
+ *
+ * Copyright 1997-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -23,9 +25,12 @@
#include <stdio.h>
#include <swld.h>
#include <strkey.h>
+#include <swkey.h>
+
SWORD_NAMESPACE_START
+
/******************************************************************************
* SWLD Constructor - Initializes data for instance of SWLD
*
@@ -34,10 +39,10 @@ SWORD_NAMESPACE_START
* idisp - Display object to use for displaying
*/
-SWLD::SWLD(const char *imodname, const char *imoddesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : SWModule(imodname, imoddesc, idisp, (char *)"Lexicons / Dictionaries", enc, dir, mark, ilang)
+SWLD::SWLD(const char *imodname, const char *imoddesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool strongsPadding) : SWModule(imodname, imoddesc, idisp, (char *)"Lexicons / Dictionaries", enc, dir, mark, ilang), strongsPadding(strongsPadding)
{
delete key;
- key = CreateKey();
+ key = createKey();
entkeytxt = new char [1];
*entkeytxt = 0;
}
@@ -54,7 +59,7 @@ SWLD::~SWLD()
}
-SWKey *SWLD::CreateKey() const { return new StrKey(); }
+SWKey *SWLD::createKey() const { return new StrKey(); }
/******************************************************************************
@@ -67,13 +72,11 @@ SWKey *SWLD::CreateKey() const { return new StrKey(); }
* RET: pointer to keytext
*/
-const char *SWLD::KeyText(const char *ikeytext)
-{
- if (key->Persist() && !ikeytext) {
+const char *SWLD::getKeyText() const {
+ if (key->isPersist()) {
getRawEntryBuf(); // force module key to snap to entry
- return entkeytxt;
}
- else return SWModule::KeyText(ikeytext);
+ return entkeytxt;
}
@@ -96,12 +99,13 @@ void SWLD::setPosition(SW_POSITION p) {
getRawEntryBuf();
}
+
bool SWLD::hasEntry(const SWKey *key) const {
const char *key_str = *key;
char *buf = new char [ strlen(key_str) + 6 ];
strcpy(buf, key_str);
- strongsPad(buf);
+ if (strongsPadding) strongsPad(buf);
bool retVal = !strcmp(buf, getKeyForEntry(getEntryForKey(buf)));
delete buf;
@@ -109,6 +113,7 @@ bool SWLD::hasEntry(const SWKey *key) const {
return retVal;
}
+
/******************************************************************************
* SWLD::strongsPad - Pads a key if (it-1) is 100% digits to 5 places
* allows for final to be alpha, e.g. '123B'
@@ -161,3 +166,4 @@ void SWLD::strongsPad(char *buf)
SWORD_NAMESPACE_END
+