]> git.tdb.fi Git - libs/core.git/blob - source/iso646fi.h
5299054ee4a50e9afce30ce24827b6ecd4e80967
[libs/core.git] / source / iso646fi.h
1 /* $Id$
2
3 This file is part of libmspstrings
4 Copyright © 2006-2007 Mikko Rasa
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_STRINGS_ISO646FI_H_
9 #define MSP_STRINGS_ISO646FI_H_
10
11 #include "codec.h"
12
13 namespace Msp {
14
15 class Iso646Fi: public StringCodec
16 {
17 public:
18         class Encoder: public StringCodec::Encoder
19         {
20         public:
21                 Encoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Encoder(em) { }
22                 void encode_char(wchar_t);
23         private:
24                 void append_replacement() { append(032); }
25         };
26
27         class Decoder: public StringCodec::Decoder
28         {
29         public:
30                 Decoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Decoder(em) { }
31                 void decode_char(const std::string &, std::string::const_iterator &);
32         };
33
34         Encoder *create_encoder(ErrorMode em=THROW_ON_ERROR) const { return new Encoder(em); }
35         Decoder *create_decoder(ErrorMode em=THROW_ON_ERROR) const { return new Decoder(em); }
36 };
37
38 } // namespace Msp
39
40 #endif