X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fiso88591.h;h=80c706be25211b8814f645347c54135925f8a8c9;hp=ff82df4378e419cbdb385f49c224462d66bb92d7;hb=271ffa9434c8d9397bb5170cf1ee670c5265ec60;hpb=6cbf9d2160a9f8e1ef98acb63ead3a14c88e2703 diff --git a/source/iso88591.h b/source/iso88591.h index ff82df4..80c706b 100644 --- a/source/iso88591.h +++ b/source/iso88591.h @@ -11,30 +11,34 @@ Distributed under the LGPL #include "codec.h" namespace Msp { +namespace Codecs { -class Iso88591: public StringCodec +class Iso88591: public Codec { public: - class Encoder: public StringCodec::Encoder + class Encoder: public Codec::Encoder { public: - Encoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Encoder(em) { } - void encode_char(wchar_t); + Encoder(ErrorMode em=THROW_ON_ERROR): Codec::Encoder(em) { } + virtual void encode_char(UnicodeChar, std::string &); private: - void append_replacement() { append(032); } + virtual void transliterate(UnicodeChar, std::string &); }; - class Decoder: public StringCodec::Decoder + class Decoder: public Codec::Decoder { public: - Decoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Decoder(em) { } - void decode_char(const std::string &, std::string::const_iterator &); + Decoder(ErrorMode em=THROW_ON_ERROR): Codec::Decoder(em) { } + virtual UnicodeChar decode_char(const std::string &, std::string::const_iterator &); }; - Encoder *create_encoder(ErrorMode em=THROW_ON_ERROR) const { return new Encoder(em); } - Decoder *create_decoder(ErrorMode em=THROW_ON_ERROR) const { return new Decoder(em); } + virtual const char *get_name() const { return "ISO-8859-1"; } + + virtual Encoder *create_encoder(ErrorMode em=THROW_ON_ERROR) const { return new Encoder(em); } + virtual Decoder *create_decoder(ErrorMode em=THROW_ON_ERROR) const { return new Decoder(em); } }; +} // namespace Codecs } // namespace Msp #endif