]> git.tdb.fi Git - libs/core.git/blobdiff - source/stringcodec/jisx0201.h
Let the base classes decide the default error mode
[libs/core.git] / source / stringcodec / jisx0201.h
index 7a7223ee7cd3aed7f1b9271a45f74517899dcab4..1e7c8ef2e70d4741b91f964ef6b9353e6e19f5a9 100644 (file)
@@ -6,13 +6,13 @@
 namespace Msp {
 namespace StringCodec {
 
-class JisX0201: public Codec
+class JisX0201: public StandardCodec<JisX0201>
 {
 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 &);
        private:
@@ -22,15 +22,14 @@ public:
        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 &);
        };
 
-       virtual const char *get_name() const { return "JIS X 0201"; }
+       JisX0201(ErrorMode em = DEFAULT): StandardCodec<JisX0201>(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); }
+       virtual const char *get_name() const { return "JIS X 0201"; }
 };
 
 } // namespace StringCodec