]> git.tdb.fi Git - libs/core.git/blob - source/latin1.h
12d880cdc0926b6231c21ea1513f875d882fa375
[libs/core.git] / source / latin1.h
1 #ifndef MSP_STRINGS_LATIN1_H_
2 #define MSP_STRINGS_LATIN1_H_
3
4 #include "codec.h"
5
6 namespace Msp {
7
8 class Latin1: public StringCodec
9 {
10 public:
11         class Encoder: public StringCodec::Encoder
12         {
13         public:
14                 Encoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Encoder(em) { }
15                 void encode_char(wchar_t);
16         private:
17                 void append_replacement() { append(032); }
18         };
19
20         class Decoder: public StringCodec::Decoder
21         {
22         public:
23                 Decoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Decoder(em) { }
24                 void decode_char(const std::string &, std::string::const_iterator &);
25         };
26
27         Encoder *create_encoder(ErrorMode em=THROW_ON_ERROR) const { return new Encoder(em); }
28         Decoder *create_decoder(ErrorMode em=THROW_ON_ERROR) const { return new Decoder(em); }
29 };
30
31 } // namespace Msp
32
33 #endif