[sword-svn] r1887 - in trunk: include src/mgr src/modules/filters

chrislit at crosswire.org chrislit at crosswire.org
Thu Jan 12 00:36:31 MST 2006


Author: chrislit
Date: 2006-01-12 00:35:15 -0700 (Thu, 12 Jan 2006)
New Revision: 1887

Modified:
   trunk/include/osismorphsegmentation.h
   trunk/src/mgr/swmgr.cpp
   trunk/src/modules/filters/osismorphsegmentation.cpp
Log:
hooked OSISMorphSegmentation up to SWMgr and put it into sword namespace

Modified: trunk/include/osismorphsegmentation.h
===================================================================
--- trunk/include/osismorphsegmentation.h	2006-01-12 07:11:42 UTC (rev 1886)
+++ trunk/include/osismorphsegmentation.h	2006-01-12 07:35:15 UTC (rev 1887)
@@ -23,23 +23,20 @@
 
 #include <swoptfilter.h>
 
-using namespace sword;
+SWORD_NAMESPACE_START
 
-namespace Filters {
+/*  This filters toggles splitting of morphemes
+ *  (for morpheme segmented Hebrew in the WLC)
+ */
 
-	/*  This filters toggles splitting of morphemes
-	 *  (for morpheme segmented Hebrew in the WLC)
-	 */
-
 class OSISMorphSegmentation : public SWOptionFilter {
 
 public:
-		OSISMorphSegmentation();
-		virtual ~OSISMorphSegmentation();
+	OSISMorphSegmentation();
+	virtual ~OSISMorphSegmentation();
 
-		virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
-	};
+	virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
 
-}
-
+SWORD_NAMESPACE_END
 #endif

Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2006-01-12 07:11:42 UTC (rev 1886)
+++ trunk/src/mgr/swmgr.cpp	2006-01-12 07:35:15 UTC (rev 1887)
@@ -54,6 +54,7 @@
 #include <osismorph.h>
 #include <osislemma.h>
 #include <osisredletterwords.h>
+#include <osismorphsegmentation.h>
 #include <osisscripref.h>
 #include <thmlstrongs.h>
 #include <thmlfootnotes.h>
@@ -177,6 +178,10 @@
 	optionFilters.insert(OptionFilterMap::value_type("OSISRedLetterWords", tmpFilter));
 	cleanupFilters.push_back(tmpFilter);
 
+	tmpFilter = new OSISMorphSegmentation();
+	optionFilters.insert(OptionFilterMap::value_type("OSISMorphSegmentation", tmpFilter));
+	cleanupFilters.push_back(tmpFilter);
+
 	tmpFilter = new ThMLStrongs();
 	optionFilters.insert(OptionFilterMap::value_type("ThMLStrongs", tmpFilter));
 	cleanupFilters.push_back(tmpFilter);

Modified: trunk/src/modules/filters/osismorphsegmentation.cpp
===================================================================
--- trunk/src/modules/filters/osismorphsegmentation.cpp	2006-01-12 07:11:42 UTC (rev 1886)
+++ trunk/src/modules/filters/osismorphsegmentation.cpp	2006-01-12 07:35:15 UTC (rev 1887)
@@ -7,87 +7,81 @@
 
 #include <osismorphsegmentation.h>
 #include <stdlib.h>
-#include <swmodule.h>
-#include <swbuf.h>
-#include <versekey.h>
 #include <utilxml.h>
-#include <utilstr.h>
 
+SWORD_NAMESPACE_START
+
 const char oName[] = "Morpheme segmentation";
 const char oTip[] = "Toggles morpheme segmentation, when present";
 
-const SWBuf choices[3] = {"Off", "On", ""
-						 };
-
+const SWBuf choices[3] = {"Off", "On", ""};
 const StringList oValues(&choices[0], &choices[2]);
 
-namespace Filters {
-
 OSISMorphSegmentation::OSISMorphSegmentation() : sword::SWOptionFilter(oName, oTip, &oValues) {
-		setOptionValue("Off");
-	}
+	setOptionValue("Off");
+}
 
 
-	OSISMorphSegmentation::~OSISMorphSegmentation() {}
+OSISMorphSegmentation::~OSISMorphSegmentation() {}
 
 
-	char OSISMorphSegmentation::processText(SWBuf &text, const SWKey */*key*/, const SWModule */*module*/) {
-		SWBuf token;
-		bool intoken    = false;
-		bool hide       = false;
+char OSISMorphSegmentation::processText(SWBuf &text, const SWKey */*key*/, const SWModule */*module*/) {
+	SWBuf token;
+	bool intoken    = false;
+	bool hide       = false;
 
-		SWBuf orig( text );
-		const char *from = orig.c_str();
+	SWBuf orig( text );
+	const char *from = orig.c_str();
 
-		XMLTag tag;
+	XMLTag tag;
 
-		for (text = ""; *from; ++from) {
-			if (*from == '<') {
-				intoken = true;
-				token = "";
-				continue;
-			}
+	for (text = ""; *from; ++from) {
+		if (*from == '<') {
+			intoken = true;
+			token = "";
+			continue;
+		}
 
-			if (*from == '>') { // process tokens
-				intoken = false;
+		if (*from == '>') { // process tokens
+			intoken = false;
 
-				if (!strncmp(token.c_str(), "seg ", 4) || !strncmp(token.c_str(), "/seg", 4)) {
-					tag = token;
+			if (!strncmp(token.c_str(), "seg ", 4) || !strncmp(token.c_str(), "/seg", 4)) {
+				tag = token;
 
-					if (!tag.isEndTag() && tag.getAttribute("type") && !strcmp("morph", tag.getAttribute("type"))) {  //<seg type="morph"> start tag
-						hide = !option; //only hide if option is Off
-					}
+				if (!tag.isEndTag() && tag.getAttribute("type") && !strcmp("morph", tag.getAttribute("type"))) {  //<seg type="morph"> start tag
+					hide = !option; //only hide if option is Off
+				}
 
-					if (hide) { //hides start and end tags as long as hide is set
+				if (hide) { //hides start and end tags as long as hide is set
 
-						if (tag.isEndTag()) { //</seg>
-							hide = false;
-						}
-
-						continue; //leave out the current token
+					if (tag.isEndTag()) { //</seg>
+						hide = false;
 					}
-				} //end of seg tag handling
 
-				text.append('<');
+					continue; //leave out the current token
+				}
+			} //end of seg tag handling
 
-				text.append(token);
+			text.append('<');
 
-				text.append('>');
+			text.append(token);
 
-				hide = false;
+			text.append('>');
 
-				continue;
-			} //end of intoken part
+			hide = false;
 
-			if (intoken) { //copy token
-				token.append(*from);
-			}
-			else { //copy text which is not inside of a tag
-				text.append(*from);
-			}
-		}
+			continue;
+		} //end of intoken part
 
-		return 0;
+		if (intoken) { //copy token
+			token.append(*from);
+		}
+		else { //copy text which is not inside of a tag
+			text.append(*from);
+		}
 	}
 
+	return 0;
 }
+
+SWORD_NAMESPACE_END



More information about the sword-cvs mailing list