The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Latin1UTF16 Class Reference

#include <latin1utf16.h>

+ Inheritance diagram for Latin1UTF16:
+ Collaboration diagram for Latin1UTF16:

Public Member Functions

virtual const char * getHeader () const
 
 Latin1UTF16 ()
 
virtual char processText (SWBuf &text, const SWKey *key=0, const SWModule *module=0)
 

Detailed Description

This filter converts Latin-1 encoded text to UTF-16

Definition at line 33 of file latin1utf16.h.

Constructor & Destructor Documentation

SWORD_NAMESPACE_START Latin1UTF16::Latin1UTF16 ( )

Definition at line 31 of file latin1utf16.cpp.

31  {
32 }

Member Function Documentation

virtual const char* SWFilter::getHeader ( ) const
inlinevirtualinherited

This method can supply a header associated with the processing done with this filter. A typical example is a suggested CSS style block for classed containers.

Reimplemented in OSISLaTeX, OSISXHTML, ThMLLaTeX, ThMLXHTML, TEIXHTML, GBFLaTeX, and GBFXHTML.

Definition at line 62 of file swfilter.h.

62 { return ""; }
char Latin1UTF16::processText ( SWBuf text,
const SWKey key = 0,
const SWModule module = 0 
)
virtual

This method processes and appropriately modifies the text given it for a particular filter task

Parameters
textThe text to be filtered/converted
keyCurrent key That was used.
moduleCurrent module.
Returns
0

Implements SWFilter.

Definition at line 35 of file latin1utf16.cpp.

35  {
36  const unsigned char *from;
37  if ((unsigned long)key < 2) // hack, we're en(1)/de(0)ciphering
38  return (char)-1;
39 
40 
41  SWBuf orig = text;
42  from = (const unsigned char *)orig.c_str();
43 
44  for (text = ""; *from; from++) {
45  text.setSize(text.size()+2);
46  switch (*from) {
47  case 0x80: // '€'
48  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x20AC;
49  break;
50  case 0x82: // '‚'
51  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201A;
52  break;
53  case 0x83: // 'ƒ'
54  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0192;
55  break;
56  case 0x84: // '„'
57  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201E;
58  break;
59  case 0x85: // '…'
60  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2026;
61  break;
62  case 0x86: // '†'
63  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2020;
64  break;
65  case 0x87: // '‡'
66  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2021;
67  break;
68  case 0x88: // 'ˆ'
69  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x02C6;
70  break;
71  case 0x89: // '‰'
72  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2030;
73  break;
74  case 0x8A: // 'Š'
75  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0160;
76  break;
77  case 0x8B: // '‹'
78  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2039;
79  break;
80  case 0x8C: // 'Œ'
81  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0152;
82  break;
83  case 0x8E: // 'Ž'
84  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x017D;
85  break;
86  case 0x91: // '‘'
87  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2018;
88  break;
89  case 0x92: // '’'
90  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2019;
91  break;
92  case 0x93: // '“'
93  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201C;
94  break;
95  case 0x94: // '”'
96  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x201D;
97  break;
98  case 0x95: // '•'
99  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2022;
100  break;
101  case 0x96: // '–'
102  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2013;
103  break;
104  case 0x97: // '—'
105  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2014;
106  break;
107  case 0x98: // '˜'
108  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x02DC;
109  break;
110  case 0x99: // '™'
111  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x2122;
112  break;
113  case 0x9A: // 'š'
114  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0161;
115  break;
116  case 0x9B: // '›'
117  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x203A;
118  break;
119  case 0x9C: // 'œ'
120  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0153;
121  break;
122  case 0x9E: // 'ž'
123  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x017E;
124  break;
125  case 0x9F: // 'Ÿ'
126  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) 0x0178;
127  break;
128  default:
129  *((unsigned short *)(text.getRawData()+(text.size()-2))) = (unsigned short) *from;
130  }
131  }
132  return 0;
133 }
Definition: swbuf.h:47
char * getRawData()
Definition: swbuf.h:379
const char * c_str() const
Definition: swbuf.h:158
unsigned long size() const
Definition: swbuf.h:185
void setSize(unsigned long len)
Definition: swbuf.h:255

The documentation for this class was generated from the following files: