1 #ifndef MSP_STRINGCODEC_JISX0208_H_
2 #define MSP_STRINGCODEC_JISX0208_H_
4 #include <msp/core/mspcore_api.h>
8 namespace StringCodec {
11 Codec for the JIS X 0208 encoding. This is not particularly useful as a
12 stand-alone codec, due to lack of a linefeed character among other things,
13 but is included as part of some other encodings.
15 class MSPCORE_API JisX0208: public StandardCodec<JisX0208>
18 class MSPCORE_API Encoder: public Codec::Encoder
21 Encoder(ErrorMode em = DEFAULT): Codec::Encoder(em) { }
23 void encode_char(unichar, std::string &) override;
25 void transliterate(unichar, std::string &) override;
28 class MSPCORE_API Decoder: public Codec::Decoder
31 Decoder(ErrorMode em = DEFAULT): Codec::Decoder(em) { }
33 unichar decode_char(const std::string &, std::string::const_iterator &) override;
36 JisX0208(ErrorMode em = DEFAULT): StandardCodec<JisX0208>(em) { }
38 const char *get_name() const override { return "JIS X 0208"; }
44 unsigned short ku = 0;
45 unsigned short ten = 0;
47 explicit operator bool() { return ku!=0 && ten!=0; }
50 MSPCORE_API unichar jisx0208_to_ucs(Kuten);
51 MSPCORE_API Kuten ucs_to_jisx0208(unichar);
53 } // namespace StringCodec