3 This file is part of libmspstrings
4 Copyright © 2006-2007 Mikko Rasa
5 Distributed under the LGPL
8 #ifndef MSP_STRINGS_UTF8_H_
9 #define MSP_STRINGS_UTF8_H_
15 class Utf8: public StringCodec
18 class Encoder: public StringCodec::Encoder
21 Encoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Encoder(em) { }
22 void encode_char(wchar_t);
24 void append_replacement() { append("\357\277\275"); }
27 class Decoder: public StringCodec::Decoder
30 Decoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Decoder(em), bytes(0), code(0) { }
31 void decode_char(const std::string &, std::string::const_iterator &);
39 Encoder *create_encoder(ErrorMode em=THROW_ON_ERROR) const { return new Encoder(em); }
40 Decoder *create_decoder(ErrorMode em=THROW_ON_ERROR) const { return new Decoder(em); }