summaryrefslogtreecommitdiff
path: root/src/modules/filters/osiswordjs.cpp
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-05-12 08:21:30 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-05-12 08:21:30 -0400
commit7a00574163029c0c2b649878c95d5acbd083564a (patch)
treec13cc5736025834df2874ed87ee8598070025ea6 /src/modules/filters/osiswordjs.cpp
parentb745315323de9f27538edac9453205ca70e6186e (diff)
Imported Upstream version 1.7.2+dfsg
Diffstat (limited to 'src/modules/filters/osiswordjs.cpp')
-rw-r--r--src/modules/filters/osiswordjs.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/modules/filters/osiswordjs.cpp b/src/modules/filters/osiswordjs.cpp
index da573d3..75946a8 100644
--- a/src/modules/filters/osiswordjs.cpp
+++ b/src/modules/filters/osiswordjs.cpp
@@ -1,10 +1,10 @@
/******************************************************************************
*
- * osisstrongs - SWFilter descendant to hide or show strongs number
- * in a OSIS module.
+ * osiswordjs.cpp - SWFilter descendant for ???
*
+ * $Id: osiswordjs.cpp 2980 2013-09-14 21:51:47Z scribe $
*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2005-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -30,17 +30,23 @@
#include <versekey.h>
#include <stdio.h>
+
SWORD_NAMESPACE_START
-const char oName[] = "Word Javascript";
-const char oTip[] = "Toggles Word Javascript data";
+namespace {
+
+ static const char oName[] = "Word Javascript";
+ static const char oTip[] = "Toggles Word Javascript data";
-const SWBuf choices[3] = {"Off", "On", ""};
-const StringList oValues(&choices[0], &choices[2]);
+ static const StringList *oValues() {
+ static const SWBuf choices[3] = {"Off", "On", ""};
+ static const StringList oVals(&choices[0], &choices[2]);
+ return &oVals;
+ }
+}
-OSISWordJS::OSISWordJS() : SWOptionFilter(oName, oTip, &oValues) {
- setOptionValue("Off");
+OSISWordJS::OSISWordJS() : SWOptionFilter(oName, oTip, oValues()) {
defaultGreekLex = 0;
defaultHebLex = 0;
@@ -59,10 +65,9 @@ char OSISWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
char token[2112]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
- bool lastspace = false;
int wordNum = 1;
char wordstr[5];
- SWBuf modName = (module)?module->Name():"";
+ SWBuf modName = (module)?module->getName():"";
// add TR to w src in KJV then remove this next line
SWBuf wordSrcPrefix = (modName == "KJV")?SWBuf("TR"):modName;
@@ -135,10 +140,10 @@ char OSISWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
// we can pass the real lex name in, but we have some
// aliases in the javascript to optimize bandwidth
if ((gh == 'G') && (defaultGreekLex)) {
- lexName = (!strcmp(defaultGreekLex->Name(), "StrongsGreek"))?"G":defaultGreekLex->Name();
+ lexName = (!strcmp(defaultGreekLex->getName(), "StrongsGreek"))?"G":defaultGreekLex->getName();
}
else if ((gh == 'H') && (defaultHebLex)) {
- lexName = (!strcmp(defaultHebLex->Name(), "StrongsHebrew"))?"H":defaultHebLex->Name();
+ lexName = (!strcmp(defaultHebLex->getName(), "StrongsHebrew"))?"H":defaultHebLex->getName();
}
SWBuf xlit = wtag.getAttribute("xlit");
@@ -151,7 +156,7 @@ char OSISWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
SWBuf wordID;
if (vkey) {
// optimize for bandwidth and use only the verse as the unique entry id
- wordID.appendFormatted("%d", vkey->Verse());
+ wordID.appendFormatted("%d", vkey->getVerse());
}
else {
wordID = key->getText();
@@ -186,7 +191,6 @@ char OSISWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
}
else {
text.append(*from);
- lastspace = (*from == ' ');
}
}
}