summaryrefslogtreecommitdiff
path: root/src/modules/filters/gbfwordjs.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/gbfwordjs.cpp
parentb745315323de9f27538edac9453205ca70e6186e (diff)
Imported Upstream version 1.7.2+dfsg
Diffstat (limited to 'src/modules/filters/gbfwordjs.cpp')
-rw-r--r--src/modules/filters/gbfwordjs.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/modules/filters/gbfwordjs.cpp b/src/modules/filters/gbfwordjs.cpp
index c3ab166..c9d1bd3 100644
--- a/src/modules/filters/gbfwordjs.cpp
+++ b/src/modules/filters/gbfwordjs.cpp
@@ -1,10 +1,10 @@
/******************************************************************************
*
- * gbfstrongs - SWFilter descendant to hide or show strongs number
- * in a GBF module.
+ * gbfwordjs.cpp - SWFilter descendant for ???
*
+ * $Id: gbfwordjs.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
@@ -28,17 +28,23 @@
#include <utilstr.h>
#include <versekey.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;
+ }
+}
-GBFWordJS::GBFWordJS() : SWOptionFilter(oName, oTip, &oValues) {
- setOptionValue("Off");
+GBFWordJS::GBFWordJS() : SWOptionFilter(oName, oTip, oValues()) {
defaultGreekLex = 0;
defaultHebLex = 0;
@@ -57,7 +63,6 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
char token[2112]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
- bool lastspace = false;
int word = 1;
char val[128];
char wordstr[5];
@@ -66,7 +71,7 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
bool newText = false;
bool needWordOut = false;
AttributeValue *wordAttrs = 0;
- SWBuf modName = (module)?module->Name():"";
+ SWBuf modName = (module)?module->getName():"";
SWBuf wordSrcPrefix = modName;
const SWBuf orig = text;
@@ -146,7 +151,7 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
gh = isdigit(strong[0]) ? 0:strong[0];
if (!gh) {
if (vkey) {
- gh = vkey->Testament() ? 'H' : 'G';
+ gh = vkey->getTestament() ? 'H' : 'G';
}
}
else strong << 1;
@@ -165,7 +170,7 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
if (sLex) {
// we can pass the real lex name in, but we have some
// aliases in the javascript to optimize bandwidth
- lexName = sLex->Name();
+ lexName = sLex->getName();
if (lexName == "StrongsGreek")
lexName = "G";
if (lexName == "StrongsHebrew")
@@ -174,7 +179,7 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
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();
@@ -192,10 +197,11 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
+ if (!sMorph) sMorph = 0; // to pass unused warning for now
/*
if (sMorph) {
SWBuf popMorph = "<a onclick=\"";
- popMorph.appendFormatted("p(\'%s\',\'%s\','%s','');\" >%s</a>", sMorph->Name(), morph.c_str(), wordID.c_str(), morph.c_str());
+ popMorph.appendFormatted("p(\'%s\',\'%s\','%s','');\" >%s</a>", sMorph->getName(), morph.c_str(), wordID.c_str(), morph.c_str());
morph = popMorph;
}
*/
@@ -223,7 +229,6 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
}
else {
text += *from;
- lastspace = (*from == ' ');
}
}
@@ -241,7 +246,7 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
gh = isdigit(strong[0]) ? 0:strong[0];
if (!gh) {
if (vkey) {
- gh = vkey->Testament() ? 'H' : 'G';
+ gh = vkey->getTestament() ? 'H' : 'G';
}
}
else strong << 1;
@@ -257,7 +262,7 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
if (sLex) {
// we can pass the real lex name in, but we have some
// aliases in the javascript to optimize bandwidth
- lexName = sLex->Name();
+ lexName = sLex->getName();
if (lexName == "StrongsGreek")
lexName = "G";
if (lexName == "StrongsHebrew")
@@ -266,7 +271,7 @@ char GBFWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modul
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();