summaryrefslogtreecommitdiff
path: root/include/scsuutf8.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsuutf8.h')
-rw-r--r--include/scsuutf8.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/include/scsuutf8.h b/include/scsuutf8.h
index 7a36733..cf33887 100644
--- a/include/scsuutf8.h
+++ b/include/scsuutf8.h
@@ -2,7 +2,7 @@
*
* scsuutf8.h - SWFilter descendant to convert a SCSU character to UTF-8
*
- * $Id: scsuutf8.h 2846 2013-06-29 14:48:47Z chrislit $
+ * $Id: scsuutf8.h 3083 2014-03-06 08:13:10Z chrislit $
*
* Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -25,16 +25,38 @@
#include <swfilter.h>
+#ifdef _ICU_
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/uchar.h>
+#endif
+
SWORD_NAMESPACE_START
/** This filter converts SCSU compressed (encoded) text to UTF-8
*/
class SWDLLEXPORT SCSUUTF8 : public SWFilter {
- unsigned long c, d;
- unsigned char* UTF8Output(unsigned long, unsigned char* text);
+private:
+#ifdef _ICU_
+ UConverter* scsuConv;
+ UConverter* utf8Conv;
+ UErrorCode err;
+#else
+ // without ICU, we'll attempt to use Roman Czyborra's SCSU decoder code
+ unsigned char active;
+ bool mode;
+ unsigned long c, d;
+
+ static unsigned short start[8];
+ static unsigned short slide[8];
+ static unsigned short win[256];
+
+ int UTF8Output(unsigned long, SWBuf* utf8Buf);
+#endif
public:
SCSUUTF8();
+ ~SCSUUTF8();
virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};