[sword-svn] r3781 - in trunk: include src/mgr

scribe at crosswire.org scribe at crosswire.org
Sun Aug 23 06:25:31 EDT 2020


Author: scribe
Date: 2020-08-23 06:25:31 -0400 (Sun, 23 Aug 2020)
New Revision: 3781

Modified:
   trunk/include/encfiltmgr.h
   trunk/src/mgr/encfiltmgr.cpp
Log:
cleaned up refactoring of EncodingFilterMgr


Modified: trunk/include/encfiltmgr.h
===================================================================
--- trunk/include/encfiltmgr.h	2020-08-21 19:49:12 UTC (rev 3780)
+++ trunk/include/encfiltmgr.h	2020-08-23 10:25:31 UTC (rev 3781)
@@ -57,13 +57,22 @@
 	 *
 	 * @param encoding The desired encoding.
 	 */
-	EncodingFilterMgr (char encoding = ENC_UTF8);
+	EncodingFilterMgr(char encoding = ENC_UTF8);
 
 	/**
 	 * The destructor of SWEncodingMgr.
 	 */
 	~EncodingFilterMgr();
 
+	/** Encoding sets/gets the encoding after initialization
+	 * 
+	 * DEPRECATED: use setEncoding / getEncoding
+	 *
+	 * @return The current encoding format.
+	 */
+
+	char Encoding(char enc) { if (enc != ENC_UNKNOWN) setEncoding(enc); return getEncoding(); }
+
 	/** getEncoding gets the encoding after initialization
 	 * 
 	 * @return The current encoding format.

Modified: trunk/src/mgr/encfiltmgr.cpp
===================================================================
--- trunk/src/mgr/encfiltmgr.cpp	2020-08-21 19:49:12 UTC (rev 3780)
+++ trunk/src/mgr/encfiltmgr.cpp	2020-08-23 10:25:31 UTC (rev 3781)
@@ -117,6 +117,7 @@
  * RET: encoding
  */
 void EncodingFilterMgr::setEncoding(char enc) {
+	if (enc && enc != encoding) {
 		encoding = enc;
 		SWFilter *oldfilter = targetenc;
 
@@ -151,6 +152,7 @@
 					module->second->addRenderFilter(targetenc);
 			}
 		}
+	}
 }
 
 



More information about the sword-cvs mailing list