X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Fjisx0208.h;h=b0c03b2af8136593a2e9d26cc882c8596d20f1c9;hp=81b39f2104ca5c638fd967b1baaa91abdb03a8b0;hb=991fabc1956b73a4007859058fb44171000b452e;hpb=02794ef3620d0d9cc3b8f1c0d8f2995c825fdf4f diff --git a/source/stringcodec/jisx0208.h b/source/stringcodec/jisx0208.h index 81b39f2..b0c03b2 100644 --- a/source/stringcodec/jisx0208.h +++ b/source/stringcodec/jisx0208.h @@ -11,46 +11,43 @@ Codec for the JIS X 0208 encoding. This is not particularly useful as a stand-alone codec, due to lack of a linefeed character among other things, but is included as part of some other encodings. */ -class JisX0208: public Codec +class JisX0208: public StandardCodec { public: class Encoder: public Codec::Encoder { public: - Encoder(ErrorMode em = THROW_ON_ERROR): Codec::Encoder(em) { } + Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { } - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; class Decoder: public Codec::Decoder { public: - Decoder(ErrorMode em = THROW_ON_ERROR): Codec::Decoder(em) { } + Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { } - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; }; - virtual const char *get_name() const { return "JIS X 0208"; } + JisX0208(ErrorMode em = DEFAULT): StandardCodec(em) { } - 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); } + const char *get_name() const override { return "JIS X 0208"; } }; struct Kuten { - unsigned short ku; - unsigned short ten; + unsigned short ku = 0; + unsigned short ten = 0; - Kuten(): ku(0), ten(0) { } - - operator bool() { return ku!=0 && ten!=0; } + explicit operator bool() { return ku!=0 && ten!=0; } }; -extern unichar jisx0208_to_ucs(Kuten); -extern Kuten ucs_to_jisx0208(unichar); +unichar jisx0208_to_ucs(Kuten); +Kuten ucs_to_jisx0208(unichar); } // namespace StringCodec } // namespace Msp