The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scsuutf8.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * scsuutf8.h - class SCSUUTF8: an Encoding filter which converts SCSU to UTF8
4  *
5  * $Id: scsuutf8.h 3786 2020-08-30 11:35:14Z scribe $
6  *
7  * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
8  * CrossWire Bible Society
9  * P. O. Box 2528
10  * Tempe, AZ 85280-2528
11  *
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU General Public License as published by the
14  * Free Software Foundation version 2.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * General Public License for more details.
20  *
21  */
22 
23 #ifndef SCSUUTF8_H
24 #define SCSUUTF8_H
25 
26 #include <swfilter.h>
27 
28 #ifdef _ICU_
29 #include <unicode/utypes.h>
30 #include <unicode/ucnv.h>
31 #include <unicode/uchar.h>
32 #endif
33 
35 
38 class SWDLLEXPORT SCSUUTF8 : public SWFilter {
39 private:
40 #ifdef _ICU_
41  UConverter* scsuConv;
42  UConverter* utf8Conv;
43  UErrorCode err;
44 #else
45  // without ICU, we'll attempt to use Roman Czyborra's SCSU decoder code
46  unsigned char active;
47  bool mode;
48  unsigned long c, d;
49 
50  static unsigned short start[8];
51  static unsigned short slide[8];
52  static unsigned short win[256];
53 
54  int UTF8Output(unsigned long, SWBuf* utf8Buf);
55 #endif
56 
57 public:
58  SCSUUTF8();
59  ~SCSUUTF8();
60  virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
61 };
62 
64 #endif
#define SWORD_NAMESPACE_START
Definition: defs.h:39
Definition: swbuf.h:47
#define SWDLLEXPORT
Definition: defs.h:171
bool mode
Definition: scsuutf8.h:47
SWText * module
Definition: osis2mod.cpp:105
unsigned long d
Definition: scsuutf8.h:48
unsigned char active
Definition: scsuutf8.h:46
virtual char processText(SWBuf &text, const SWKey *key=0, const SWModule *module=0)=0
#define SWORD_NAMESPACE_END
Definition: defs.h:40
Definition: swkey.h:77