]> git.tdb.fi Git - libs/core.git/blob - source/stringcodec/iso885915.cpp
Remove deprecated things
[libs/core.git] / source / stringcodec / iso885915.cpp
1 #include "codecutils.h"
2 #include "iso885915.h"
3
4 using namespace std;
5
6 namespace {
7
8 const unsigned map_size = 8;
9
10 const int mapping[map_size*2]=
11 {
12         0x0152, 0xBC,
13         0x0153, 0xBD,
14         0x0160, 0xA6,
15         0x0161, 0xA8,
16         0x0178, 0xBE,
17         0x017D, 0xB4,
18         0x017E, 0xB8,
19         0x20AC, 0xA4
20 };
21
22 }
23
24
25 namespace Msp {
26 namespace StringCodec {
27
28 void Iso885915::Encoder::encode_char(unichar ch, string &buf)
29 {
30         int tch = transform_mapping_or_direct(mapping, map_size, ch, false);
31         if(tch<0 || tch>0xFF)
32                 error(ch, buf, invalid_character(ch, "ISO-8859-15"));
33         else
34                 buf += tch;
35
36 }
37
38 void Iso885915::Encoder::transliterate(unichar, string &buf)
39 {
40         buf += '?';
41 }
42
43
44 unichar Iso885915::Decoder::decode_char(const string &str, string::const_iterator &i)
45 {
46         if(i==str.end())
47                 return -1;
48
49         unsigned char ch = *i++;
50         return transform_mapping_or_direct(mapping, map_size, ch, true);
51 }
52
53 } // namespace StringCodec
54 } // namespace Msp