X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fjisx0201.h;h=180f710f3d87d1234ff3c129310032435ad4c8a0;hb=a0a5c796a6ec11a13c49912672a82bf1857bbc71;hp=8cc1e22c451f675fd5592d579f585f1e6b1506b6;hpb=9da6abdcabec59f4845da256a8ad75a810ed1589;p=libs%2Fcore.git diff --git a/source/jisx0201.h b/source/jisx0201.h index 8cc1e22..180f710 100644 --- a/source/jisx0201.h +++ b/source/jisx0201.h @@ -11,30 +11,34 @@ Distributed under the LGPL #include "codec.h" namespace Msp { +namespace Codecs { -class JisX0201: public StringCodec +class JisX0201: 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 "JIS X 0201"; } + + 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