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

chrislit at crosswire.org chrislit at crosswire.org
Mon Jun 10 05:25:59 MST 2013


Author: chrislit
Date: 2013-06-10 05:25:58 -0700 (Mon, 10 Jun 2013)
New Revision: 2815

Added:
   trunk/include/osisenum.h
   trunk/include/osisglosses.h
   trunk/include/osisxlit.h
   trunk/src/modules/filters/osisenum.cpp
   trunk/src/modules/filters/osisglosses.cpp
   trunk/src/modules/filters/osisxlit.cpp
Removed:
   trunk/include/osisruby.h
   trunk/src/modules/filters/osisruby.cpp
Modified:
   trunk/src/mgr/swmgr.cpp
   trunk/src/modules/filters/Makefile.am
Log:
added basic OSISEnum & OSISXlit filters
renamed OSISRuby to the more general OSISGlosses

Added: trunk/include/osisenum.h
===================================================================
--- trunk/include/osisenum.h	                        (rev 0)
+++ trunk/include/osisenum.h	2013-06-10 12:25:58 UTC (rev 2815)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright 2013 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISENUM_H
+#define OSISENUM_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISEnum : public SWOptionFilter {
+public:
+	OSISEnum();
+	virtual ~OSISEnum();
+	virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif


Property changes on: trunk/include/osisenum.h
___________________________________________________________________
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Added: trunk/include/osisglosses.h
===================================================================
--- trunk/include/osisglosses.h	                        (rev 0)
+++ trunk/include/osisglosses.h	2013-06-10 12:25:58 UTC (rev 2815)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISGLOSSES_H
+#define OSISGLOSSES_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISGlosses : public SWOptionFilter {
+public:
+	OSISGlosses();
+	virtual ~OSISGlosses();
+	virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif


Property changes on: trunk/include/osisglosses.h
___________________________________________________________________
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Deleted: trunk/include/osisruby.h
===================================================================
--- trunk/include/osisruby.h	2013-06-10 10:11:33 UTC (rev 2814)
+++ trunk/include/osisruby.h	2013-06-10 12:25:58 UTC (rev 2815)
@@ -1,38 +0,0 @@
-/******************************************************************************
- *
- * $Id: osisruby.h 1688 2005-01-01 04:42:26Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- *	CrossWire Bible Society
- *	P. O. Box 2528
- *	Tempe, AZ  85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- */
-
-#ifndef OSISRUBY_H
-#define OSISRUBY_H
-
-#include <swoptfilter.h>
-
-SWORD_NAMESPACE_START
-
-/** This Filter shows/hides headings in a OSIS text
- */
-class SWDLLEXPORT OSISRuby : public SWOptionFilter {
-public:
-	OSISRuby();
-	virtual ~OSISRuby();
-	virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
-};
-
-SWORD_NAMESPACE_END
-#endif

Added: trunk/include/osisxlit.h
===================================================================
--- trunk/include/osisxlit.h	                        (rev 0)
+++ trunk/include/osisxlit.h	2013-06-10 12:25:58 UTC (rev 2815)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright 2013 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISXLIT_H
+#define OSISXLIT_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISXlit : public SWOptionFilter {
+public:
+	OSISXlit();
+	virtual ~OSISXlit();
+	virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif


Property changes on: trunk/include/osisxlit.h
___________________________________________________________________
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2013-06-10 10:11:33 UTC (rev 2814)
+++ trunk/src/mgr/swmgr.cpp	2013-06-10 12:25:58 UTC (rev 2815)
@@ -51,6 +51,8 @@
 #include <gbfheadings.h>
 #include <gbfredletterwords.h>
 #include <gbfmorph.h>
+#include <osisenum.h>
+#include <osisglosses.h>
 #include <osisheadings.h>
 #include <osisfootnotes.h>
 #include <osisstrongs.h>
@@ -58,8 +60,8 @@
 #include <osislemma.h>
 #include <osisredletterwords.h>
 #include <osismorphsegmentation.h>
-#include <osisruby.h>
 #include <osisscripref.h>
+#include <osisxlit.h>
 #include <thmlstrongs.h>
 #include <thmlfootnotes.h>
 #include <thmlheadings.h>
@@ -187,10 +189,19 @@
 	optionFilters.insert(OptionFilterMap::value_type("OSISMorphSegmentation", tmpFilter));
 	cleanupFilters.push_back(tmpFilter);
 
-	tmpFilter = new OSISRuby();
+	tmpFilter = new OSISGlosses();
+	optionFilters.insert(OptionFilterMap::value_type("OSISGlosses", tmpFilter));
 	optionFilters.insert(OptionFilterMap::value_type("OSISRuby", tmpFilter));
 	cleanupFilters.push_back(tmpFilter);
 
+	tmpFilter = new OSISXlit();
+	optionFilters.insert(OptionFilterMap::value_type("OSISXlit", tmpFilter));
+	cleanupFilters.push_back(tmpFilter);
+
+	tmpFilter = new OSISEnum();
+	optionFilters.insert(OptionFilterMap::value_type("OSISEnum", tmpFilter));
+	cleanupFilters.push_back(tmpFilter);
+
 	tmpFilter = new ThMLStrongs();
 	optionFilters.insert(OptionFilterMap::value_type("ThMLStrongs", tmpFilter));
 	cleanupFilters.push_back(tmpFilter);

Modified: trunk/src/modules/filters/Makefile.am
===================================================================
--- trunk/src/modules/filters/Makefile.am	2013-06-10 10:11:33 UTC (rev 2814)
+++ trunk/src/modules/filters/Makefile.am	2013-06-10 12:25:58 UTC (rev 2815)
@@ -57,7 +57,9 @@
 OSISFIL += $(filtersdir)/osisvariants.cpp
 OSISFIL += $(filtersdir)/osiswordjs.cpp
 OSISFIL += $(filtersdir)/osismorphsegmentation.cpp
-OSISFIL += $(filtersdir)/osisruby.cpp 
+OSISFIL += $(filtersdir)/osisglosses.cpp
+OSISFIL += $(filtersdir)/osisenum.cpp
+OSISFIL += $(filtersdir)/osisxlit.cpp
 
 libsword_la_SOURCES += $(filtersdir)/latin1utf8.cpp
 libsword_la_SOURCES += $(filtersdir)/latin1utf16.cpp

Added: trunk/src/modules/filters/osisenum.cpp
===================================================================
--- trunk/src/modules/filters/osisenum.cpp	                        (rev 0)
+++ trunk/src/modules/filters/osisenum.cpp	2013-06-10 12:25:58 UTC (rev 2815)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ *
+ * osisenum          -	SWFilter descendant to hide or show word enumations
+ *			in an OSIS module.
+ *
+ * $Id$
+ *
+ * Copyright 2013 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <stdlib.h>
+#include <osisenum.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+const char oName[] = "Enumerations";
+const char oTip[] = "Toggles Enumerations On and Off if they exist";
+
+const SWBuf choices[3] = {"Off", "On", ""};
+const StringList oValues(&choices[0], &choices[2]);
+
+OSISEnum::OSISEnum() : SWOptionFilter(oName, oTip, &oValues) {
+	setOptionValue("Off");
+}
+
+
+OSISEnum::~OSISEnum() {
+}
+
+
+char OSISEnum::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
+	SWBuf token;
+	bool intoken = false;
+
+	const SWBuf orig = text;
+	const char * from = orig.c_str();
+
+	if (!option) {
+		for (text = ""; *from; ++from) {
+			if (*from == '<') {
+				intoken = true;
+				token = "";
+				continue;
+			}
+			if (*from == '>') {	// process tokens
+				intoken = false;
+				if (token.startsWith("w ")) {	// Word
+					XMLTag wtag(token);
+					const char *l = wtag.getAttribute("n");
+					if (l) {
+						wtag.setAttribute("n", 0);
+						token = wtag;
+						token.trim();
+						// drop <>
+						token << 1;
+						token--;
+					}
+				}
+				
+				// keep token in text
+				text.append('<');
+				text.append(token);
+				text.append('>');
+				
+				continue;
+			}
+			if (intoken) {
+				token += *from;
+			}
+			else	{
+				text.append(*from);
+			}
+		}
+	}
+	return 0;
+}
+
+SWORD_NAMESPACE_END


Property changes on: trunk/src/modules/filters/osisenum.cpp
___________________________________________________________________
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Added: trunk/src/modules/filters/osisglosses.cpp
===================================================================
--- trunk/src/modules/filters/osisglosses.cpp	                        (rev 0)
+++ trunk/src/modules/filters/osisglosses.cpp	2013-06-10 12:25:58 UTC (rev 2815)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ *
+ * osisglosses        -	SWFilter descendant to hide or show glosses
+ *			in an OSIS module.
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <stdlib.h>
+#include <osisglosses.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+const char oName[] = "Glosses";
+const char oTip[] = "Toggles Glosses On and Off if they exist";
+
+const SWBuf choices[3] = {"Off", "On", ""};
+const StringList oValues(&choices[0], &choices[2]);
+
+OSISGlosses::OSISGlosses() : SWOptionFilter(oName, oTip, &oValues) {
+	setOptionValue("Off");
+}
+
+
+OSISGlosses::~OSISGlosses() {
+}
+
+
+char OSISGlosses::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
+	SWBuf token;
+	bool intoken = false;
+
+	const SWBuf orig = text;
+	const char * from = orig.c_str();
+
+	if (!option) {
+		for (text = ""; *from; ++from) {
+			if (*from == '<') {
+				intoken = true;
+				token = "";
+				continue;
+			}
+			if (*from == '>') {	// process tokens
+				intoken = false;
+				if (token.startsWith("w ")) {	// Word
+					XMLTag wtag(token);
+					const char *l = wtag.getAttribute("gloss");
+					if (l) {
+						wtag.setAttribute("gloss", 0);
+						token = wtag;
+						token.trim();
+						// drop <>
+						token << 1;
+						token--;
+					}
+				}
+				
+				// keep token in text
+				text.append('<');
+				text.append(token);
+				text.append('>');
+				
+				continue;
+			}
+			if (intoken) {
+				token += *from;
+			}
+			else	{
+				text.append(*from);
+			}
+		}
+	}
+	return 0;
+}
+
+SWORD_NAMESPACE_END


Property changes on: trunk/src/modules/filters/osisglosses.cpp
___________________________________________________________________
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Deleted: trunk/src/modules/filters/osisruby.cpp
===================================================================
--- trunk/src/modules/filters/osisruby.cpp	2013-06-10 10:11:33 UTC (rev 2814)
+++ trunk/src/modules/filters/osisruby.cpp	2013-06-10 12:25:58 UTC (rev 2815)
@@ -1,91 +0,0 @@
-/******************************************************************************
- *
- * osisruby          -	SWFilter descendant to hide or show ruby
- *			in a OSIS module.
- *
- *
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
- *	CrossWire Bible Society
- *	P. O. Box 2528
- *	Tempe, AZ  85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- */
-
-#include <stdlib.h>
-#include <osisruby.h>
-#include <utilxml.h>
-
-SWORD_NAMESPACE_START
-
-const char oName[] = "Glosses";
-const char oTip[] = "Toggles Glosses On and Off if they exist";
-
-const SWBuf choices[3] = {"Off", "On", ""};
-const StringList oValues(&choices[0], &choices[2]);
-
-OSISRuby::OSISRuby() : SWOptionFilter(oName, oTip, &oValues) {
-	setOptionValue("Off");
-}
-
-
-OSISRuby::~OSISRuby() {
-}
-
-
-char OSISRuby::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
-	SWBuf token;
-	bool intoken = false;
-
-	const SWBuf orig = text;
-	const char * from = orig.c_str();
-
-	if (!option) {
-		for (text = ""; *from; ++from) {
-			if (*from == '<') {
-				intoken = true;
-				token = "";
-				continue;
-			}
-			if (*from == '>') {	// process tokens
-				intoken = false;
-				if (token.startsWith("w ")) {	// Word
-					XMLTag wtag(token);
-					const char *l = wtag.getAttribute("gloss");
-					if (l) {
-						wtag.setAttribute("gloss", 0);
-						token = wtag;
-						token.trim();
-						// drop <>
-						token << 1;
-						token--;
-					}
-				}
-				
-				// keep token in text
-				text.append('<');
-				text.append(token);
-				text.append('>');
-				
-				continue;
-			}
-			if (intoken) {
-				token += *from;
-			}
-			else	{
-				text.append(*from);
-			}
-		}
-	}
-	return 0;
-}
-
-SWORD_NAMESPACE_END

Added: trunk/src/modules/filters/osisxlit.cpp
===================================================================
--- trunk/src/modules/filters/osisxlit.cpp	                        (rev 0)
+++ trunk/src/modules/filters/osisxlit.cpp	2013-06-10 12:25:58 UTC (rev 2815)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ *
+ * osisxlit	      -	SWFilter descendant to hide or show xlit values
+ *			(encoded transliterations) in an OSIS module.
+ *
+ * $Id$
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <stdlib.h>
+#include <osisxlit.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+const char oName[] = "Transliterated forms";
+const char oTip[] = "Toggles transliterated forms On and Off if they exist";
+
+const SWBuf choices[3] = {"Off", "On", ""};
+const StringList oValues(&choices[0], &choices[2]);
+
+OSISXlit::OSISXlit() : SWOptionFilter(oName, oTip, &oValues) {
+	setOptionValue("Off");
+}
+
+
+OSISXlit::~OSISXlit() {
+}
+
+
+char OSISXlit::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
+	SWBuf token;
+	bool intoken = false;
+
+	const SWBuf orig = text;
+	const char * from = orig.c_str();
+
+	if (!option) {
+		for (text = ""; *from; ++from) {
+			if (*from == '<') {
+				intoken = true;
+				token = "";
+				continue;
+			}
+			if (*from == '>') {	// process tokens
+				intoken = false;
+				if (token.startsWith("w ")) {	// Word
+					XMLTag wtag(token);
+					const char *l = wtag.getAttribute("xlit");
+					if (l) {
+						wtag.setAttribute("xlit", 0);
+						token = wtag;
+						token.trim();
+						// drop <>
+						token << 1;
+						token--;
+					}
+				}
+				
+				// keep token in text
+				text.append('<');
+				text.append(token);
+				text.append('>');
+				
+				continue;
+			}
+			if (intoken) {
+				token += *from;
+			}
+			else	{
+				text.append(*from);
+			}
+		}
+	}
+	return 0;
+}
+
+SWORD_NAMESPACE_END


Property changes on: trunk/src/modules/filters/osisxlit.cpp
___________________________________________________________________
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native




More information about the sword-cvs mailing list