[sword-svn] r3076 - in trunk: cmake include lib/vcppmake src/mgr src/modules/filters

chrislit at crosswire.org chrislit at crosswire.org
Tue Mar 4 21:49:09 MST 2014


Author: chrislit
Date: 2014-03-04 21:49:08 -0700 (Tue, 04 Mar 2014)
New Revision: 3076

Added:
   trunk/include/utf8scsu.h
   trunk/src/modules/filters/utf8scsu.cpp
Modified:
   trunk/cmake/sources.cmake
   trunk/include/encfiltmgr.h
   trunk/lib/vcppmake/libsword.vcxproj
   trunk/src/mgr/encfiltmgr.cpp
   trunk/src/mgr/swmgr.cpp
   trunk/src/modules/filters/Makefile.am
Log:
added UTF8SCSU stub
plugged UTF16UTF8 & UTF8SCSU into library (EncodingFilterMgr & SWMgr)

Modified: trunk/cmake/sources.cmake
===================================================================
--- trunk/cmake/sources.cmake	2014-03-05 02:27:33 UTC (rev 3075)
+++ trunk/cmake/sources.cmake	2014-03-05 04:49:08 UTC (rev 3076)
@@ -133,6 +133,7 @@
 	src/modules/filters/utf8latin1.cpp
 	src/modules/filters/unicodertf.cpp
 	src/modules/filters/scsuutf8.cpp
+	src/modules/filters/utf8scsu.cpp
 
 	src/modules/filters/utf8cantillation.cpp
 	src/modules/filters/utf8hebrewpoints.cpp

Modified: trunk/include/encfiltmgr.h
===================================================================
--- trunk/include/encfiltmgr.h	2014-03-05 02:27:33 UTC (rev 3075)
+++ trunk/include/encfiltmgr.h	2014-03-05 04:49:08 UTC (rev 3076)
@@ -39,15 +39,16 @@
 class SWDLLEXPORT EncodingFilterMgr : public SWFilterMgr {
 
 protected:
-        SWFilter *latin1utf8;
+	SWFilter *latin1utf8;
 	SWFilter *scsuutf8;
-        SWFilter *targetenc;
+	SWFilter *utf16utf8;
+	SWFilter *targetenc;
 
 
 	/*
 	 * current encoding value
 	 */        
-        char encoding;
+	char encoding;
 
 public:
 
@@ -56,33 +57,33 @@
 	 *
 	 * @param encoding The desired encoding.
 	 */
-        EncodingFilterMgr (char encoding = ENC_UTF8);
+	EncodingFilterMgr (char encoding = ENC_UTF8);
 
 	/**
 	 * The destructor of SWEncodingMgr.
 	 */
-        ~EncodingFilterMgr();
+	~EncodingFilterMgr();
 
 	/** Markup sets/gets the encoding after initialization
 	 * 
 	 * @param enc The new encoding or ENC_UNKNOWN if you just want to get the current markup.
 	 * @return The current (possibly changed) encoding format.
 	 */
-        char Encoding(char enc);
+	char Encoding(char enc);
 
 	/**
 	 * Adds the raw filters which are defined in "section" to the SWModule object "module".
 	 * @param module To this module the raw filter(s) are added
 	 * @param section We use this section to get a list of filters we should apply to the module
 	 */
-        virtual void AddRawFilters(SWModule *module, ConfigEntMap &section);
+	virtual void AddRawFilters(SWModule *module, ConfigEntMap &section);
 
 	/**
 	 * Adds the encoding filters which are defined in "section" to the SWModule object "module".
 	 * @param module To this module the encoding filter(s) are added
 	 * @param section We use this section to get a list of filters we should apply to the module
 	 */
-        virtual void AddEncodingFilters(SWModule *module, ConfigEntMap &section);
+	virtual void AddEncodingFilters(SWModule *module, ConfigEntMap &section);
 };
 
 SWORD_NAMESPACE_END

Added: trunk/include/utf8scsu.h
===================================================================
--- trunk/include/utf8scsu.h	                        (rev 0)
+++ trunk/include/utf8scsu.h	2014-03-05 04:49:08 UTC (rev 3076)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ *
+ *  utf8scsu.h -	Implementation of UTF8SCSU
+ *
+ * $Id$
+ *
+ * Copyright 2001-2014 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 UTF8SCSU_H
+#define UTF8SCSU_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts UTF-8 encoded text to SCSU
+ */
+class SWDLLEXPORT UTF8SCSU : public SWFilter {
+public:
+	UTF8SCSU();
+	virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif


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

Modified: trunk/lib/vcppmake/libsword.vcxproj
===================================================================
--- trunk/lib/vcppmake/libsword.vcxproj	2014-03-05 02:27:33 UTC (rev 3075)
+++ trunk/lib/vcppmake/libsword.vcxproj	2014-03-05 04:49:08 UTC (rev 3076)
@@ -145,6 +145,7 @@
     <ClCompile Include="..\..\src\modules\filters\scsuutf8.cpp" />
     <ClCompile Include="..\..\src\modules\filters\teilatex.cpp" />
     <ClCompile Include="..\..\src\modules\filters\thmllatex.cpp" />
+    <ClCompile Include="..\..\src\modules\filters\utf8scsu.cpp" />
     <ClCompile Include="..\..\src\utilfuns\win32\dirent.cpp" />
     <ClCompile Include="..\..\src\mgr\encfiltmgr.cpp" />
     <ClCompile Include="..\..\src\modules\common\entriesblk.cpp" />
@@ -452,6 +453,7 @@
     <ClInclude Include="..\..\include\utf8latin1.h" />
     <ClInclude Include="..\..\include\utf8nfc.h" />
     <ClInclude Include="..\..\include\utf8nfkd.h" />
+    <ClInclude Include="..\..\include\utf8scsu.h" />
     <ClInclude Include="..\..\include\utf8transliterator.h" />
     <ClInclude Include="..\..\include\utf8utf16.h" />
     <ClInclude Include="..\..\include\utilstr.h" />

Modified: trunk/src/mgr/encfiltmgr.cpp
===================================================================
--- trunk/src/mgr/encfiltmgr.cpp	2014-03-05 02:27:33 UTC (rev 3075)
+++ trunk/src/mgr/encfiltmgr.cpp	2014-03-05 04:49:08 UTC (rev 3076)
@@ -27,11 +27,14 @@
 
 #include <scsuutf8.h>
 #include <latin1utf8.h>
+#include <utf16utf8.h>
 
 #include <unicodertf.h>
 #include <utf8latin1.h>
 #include <utf8utf16.h>
 #include <utf8html.h>
+#include <utf8scsu.h>
+
 #include <swmodule.h>
 
 #include <swmgr.h>
@@ -51,6 +54,7 @@
 
 	scsuutf8   = new SCSUUTF8();
 	latin1utf8 = new Latin1UTF8();
+	utf16utf8  = new UTF16UTF8();
 
 	encoding = enc;
 
@@ -59,6 +63,7 @@
 		case ENC_UTF16:  targetenc = new UTF8UTF16();  break;
 		case ENC_RTF:    targetenc = new UnicodeRTF(); break;
 		case ENC_HTML:   targetenc = new UTF8HTML();   break;
+		case ENC_SCSU:   targetenc = new UTF8SCSU();   break;
 		default: // i.e. case ENC_UTF8
 			targetenc = NULL;
 	}
@@ -71,6 +76,7 @@
 EncodingFilterMgr::~EncodingFilterMgr() {
 	delete scsuutf8;
 	delete latin1utf8;
+	delete utf16utf8;
 	delete targetenc;
 }
 
@@ -81,11 +87,14 @@
 
 	SWBuf encoding = ((entry = section.find("Encoding")) != section.end()) ? (*entry).second : (SWBuf)"";
 	if (!encoding.length() || !stricmp(encoding.c_str(), "Latin-1")) {
-                module->addRawFilter(latin1utf8);
+		module->addRawFilter(latin1utf8);
 	}
 	else if (!stricmp(encoding.c_str(), "SCSU")) {
 		module->addRawFilter(scsuutf8);
 	}
+	else if (!stricmp(encoding.c_str(), "UTF-16")) {
+		module->addRawFilter(utf16utf8);
+	}
 }
 
 
@@ -112,6 +121,7 @@
 			case ENC_UTF16:  targetenc = new UTF8UTF16();  break;
 			case ENC_RTF:    targetenc = new UnicodeRTF(); break;
 			case ENC_HTML:   targetenc = new UTF8HTML();   break;
+			case ENC_SCSU:   targetenc = new UTF8SCSU();   break;
 			default: // i.e. case ENC_UTF8
 				targetenc = NULL;
 		}

Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2014-03-05 02:27:33 UTC (rev 3075)
+++ trunk/src/mgr/swmgr.cpp	2014-03-05 04:49:08 UTC (rev 3076)
@@ -916,11 +916,15 @@
 	else
 		markup = FMT_GBF;
 
-	if (!stricmp(encoding.c_str(), "SCSU"))
-		enc = ENC_SCSU;
-	else if (!stricmp(encoding.c_str(), "UTF-8")) {
+	if (!stricmp(encoding.c_str(), "UTF-8")) {
 		enc = ENC_UTF8;
 	}
+	else if (!stricmp(encoding.c_str(), "SCSU")) {
+		enc = ENC_SCSU;
+	}
+	else if (!stricmp(encoding.c_str(), "UTF-16")) {
+		enc = ENC_UTF16;
+	}
 	else enc = ENC_LATIN1;
 
 	if ((entry = section.find("Direction")) == section.end()) {

Modified: trunk/src/modules/filters/Makefile.am
===================================================================
--- trunk/src/modules/filters/Makefile.am	2014-03-05 02:27:33 UTC (rev 3075)
+++ trunk/src/modules/filters/Makefile.am	2014-03-05 04:49:08 UTC (rev 3076)
@@ -74,6 +74,7 @@
 libsword_la_SOURCES += $(filtersdir)/utf8latin1.cpp
 libsword_la_SOURCES += $(filtersdir)/unicodertf.cpp
 libsword_la_SOURCES += $(filtersdir)/scsuutf8.cpp
+libsword_la_SOURCES += $(filtersdir)/utf8scsu.cpp
 
 libsword_la_SOURCES += $(filtersdir)/utf8cantillation.cpp
 libsword_la_SOURCES += $(filtersdir)/utf8hebrewpoints.cpp

Added: trunk/src/modules/filters/utf8scsu.cpp
===================================================================
--- trunk/src/modules/filters/utf8scsu.cpp	                        (rev 0)
+++ trunk/src/modules/filters/utf8scsu.cpp	2014-03-05 04:49:08 UTC (rev 3076)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ *
+ *  utf8scsu.cpp -	SWFilter descendant to convert UTF-8 to SCSU
+ *
+ * $Id$
+ *
+ * Copyright 2001-2014 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 <stdio.h>
+
+#include <sysdata.h>
+#include <utf8scsu.h>
+#include <utilstr.h>
+#include <swbuf.h>
+
+
+SWORD_NAMESPACE_START
+
+
+UTF8SCSU::UTF8SCSU() {
+}
+
+
+char UTF8SCSU::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
+	const unsigned char *from;
+	SWBuf orig = text;
+
+	from = (const unsigned char *)orig.c_str();
+
+
+	return 0;
+}
+
+SWORD_NAMESPACE_END


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




More information about the sword-cvs mailing list