[sword-svn] r3332 - in trunk: include src/modules src/modules/filters
scribe at crosswire.org
scribe at crosswire.org
Thu Mar 12 01:50:52 MST 2015
Author: scribe
Date: 2015-03-12 01:50:51 -0700 (Thu, 12 Mar 2015)
New Revision: 3332
Modified:
trunk/include/swmodule.h
trunk/src/modules/filters/osisplain.cpp
trunk/src/modules/swmodule.cpp
Log:
split renderText out between const and non-const
methods. added notes to explain why the body of the const method
sometimes does non-const stuff for internal purposes.
Made notes work in osisplain.cpp
Modified: trunk/include/swmodule.h
===================================================================
--- trunk/include/swmodule.h 2015-03-11 23:12:17 UTC (rev 3331)
+++ trunk/include/swmodule.h 2015-03-12 08:50:51 UTC (rev 3332)
@@ -662,7 +662,8 @@
* @param render for internal use
* @return result buffer
*/
- SWBuf renderText(const char *buf = 0, int len = -1, bool render = true);
+ SWBuf renderText();
+ SWBuf renderText(const char *buf, int len = -1, bool render = true) const;
SWDEPRECATED const char *RenderText(const char *buf = 0, int len = -1, bool render = true) { return renderText(buf, len, render); }
/** Produces any header data which might be useful which is associated with the
Modified: trunk/src/modules/filters/osisplain.cpp
===================================================================
--- trunk/src/modules/filters/osisplain.cpp 2015-03-11 23:12:17 UTC (rev 3331)
+++ trunk/src/modules/filters/osisplain.cpp 2015-03-12 08:50:51 UTC (rev 3332)
@@ -25,6 +25,8 @@
#include <ctype.h>
#include <versekey.h>
#include <stringmgr.h>
+#include <utilxml.h>
+#include <swmodule.h>
SWORD_NAMESPACE_START
@@ -168,6 +170,12 @@
buf.append(" [");
}
else u->suspendTextPassThru = true;
+ if (u) {
+ XMLTag tag = token;
+ SWBuf swordFootnote = tag.getAttribute("swordFootnote");
+ SWBuf footnoteBody = u->module->getEntryAttributes()["Footnote"][swordFootnote]["body"];
+ buf.append(u->module->renderText(footnoteBody));
+ }
}
else if (!strncmp(token, "/note", 5)) {
if (!u->suspendTextPassThru)
Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp 2015-03-11 23:12:17 UTC (rev 3331)
+++ trunk/src/modules/swmodule.cpp 2015-03-12 08:50:51 UTC (rev 3332)
@@ -901,14 +901,33 @@
/******************************************************************************
- * SWModule::renderText - calls all renderfilters on current text
+ * SWModule::renderText - calls all renderfilters on current module
+ * position
*
- * ENT: buf - buffer to Render instead of current module position
+ * RET: this module's text at current key location massaged by renderText filters
+ */
+SWBuf SWModule::renderText() {
+ return renderText((const char *)0);
+}
+
+/******************************************************************************
+ * SWModule::renderText - calls all renderfilters on provided text
+ * or current module position provided text null
*
+ * ENT: buf - buffer to render
+ *
* RET: this module's text at current key location massaged by renderText filters
+ *
+ * NOTES: This method is only truly const if called with a provided text; using
+ * module's current position may produce a new entry attributes map which
+ * logically violates the const semantic, which is why the above method
+ * which takes no params is not const, i.e., don't call this method with
+ * null as text param, but instead use non-const method above. The public
+ * interface for this method expects a value for the text param. We use it
+ * internally sometimes calling with null to save duplication of code.
*/
- SWBuf SWModule::renderText(const char *buf, int len, bool render) {
+SWBuf SWModule::renderText(const char *buf, int len, bool render) const {
bool savePEA = isProcessEntryAttributes();
if (!buf) {
entryAttributes.clear();
@@ -928,7 +947,7 @@
if (tmpbuf) {
unsigned long size = (len < 0) ? ((getEntrySize()<0) ? strlen(tmpbuf) : getEntrySize()) : len;
if (size > 0) {
- key = (SWKey *)*this;
+ key = this->getKey();
optionFilter(tmpbuf, key);
More information about the sword-cvs
mailing list