summaryrefslogtreecommitdiff
path: root/utilities/diatheke/gbfcgi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities/diatheke/gbfcgi.cpp')
-rw-r--r--utilities/diatheke/gbfcgi.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/utilities/diatheke/gbfcgi.cpp b/utilities/diatheke/gbfcgi.cpp
index 5112c46..3c8ef00 100644
--- a/utilities/diatheke/gbfcgi.cpp
+++ b/utilities/diatheke/gbfcgi.cpp
@@ -1,11 +1,10 @@
/***************************************************************************
- * gbfcgi.cpp - GBF to Diatheke/CGI format
- * -------------------
- * begin : 2001-11-12
- * copyright : 2001 by CrossWire Bible Society
*
+ * gbfcgi.cpp - GBF to Diatheke/CGI format
*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * $Id: gbfcgi.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ *
+ * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -23,10 +22,26 @@
#include <stdlib.h>
#include <string.h>
+#include <map>
#include "gbfcgi.h"
SWORD_NAMESPACE_START
+typedef std::map<SWBuf, SWBuf> DualStringMap;
+
+namespace {
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ DualStringMap properties;
+ };
+}
+
+
+BasicFilterUserData *GBFCGI::createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+}
+
GBFCGI::GBFCGI() {
setTokenStart("<");
setTokenEnd(">");
@@ -64,7 +79,8 @@ GBFCGI::GBFCGI() {
}
-bool GBFCGI::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
+bool GBFCGI::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *baseUserData) {
+ MyUserData *userData = (MyUserData *) baseUserData;
unsigned long i;
if (!substituteToken(buf, token)) {
if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
@@ -113,12 +129,12 @@ bool GBFCGI::handleToken(SWBuf &buf, const char *token, DualStringMap &userData)
else if (!strncmp(token, "RB", 2)) {
buf += "<i>";
- userData["hasFootnotePreTag"] = "true";
+ userData->properties["hasFootnotePreTag"] = "true";
}
else if (!strncmp(token, "RF", 2)) {
- if(userData["hasFootnotePreTag"] == "true") {
- userData["hasFootnotePreTag"] = "false";
+ if(userData->properties["hasFootnotePreTag"] == "true") {
+ userData->properties["hasFootnotePreTag"] = "false";
buf += "</i> ";
}
buf += "<font color=\"#800000\"><small> (";