]> git.tdb.fi Git - libs/core.git/blobdiff - source/jisx0201.h
Rework the codec API completely to remove the internal buffering
[libs/core.git] / source / jisx0201.h
index 976a9456f708a150a2d699b2b3c990fe37da535b..1c502f9da1516007882bd1f8f8c4c7dd3cb95fe8 100644 (file)
@@ -1,29 +1,42 @@
+/* $Id$
+
+This file is part of libmspstrings
+Copyright © 2006-2007 Mikko Rasa
+Distributed under the LGPL
+*/
+
 #ifndef MSP_STRINGS_JISX201_H_
 #define MSP_STRINGS_JISX201_H_
 
 #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:
-               void encode_char(wchar_t);
+               Encoder(ErrorMode em=THROW_ON_ERROR): Codec::Encoder(em) { }
+               virtual void encode_char(UnicodeChar, std::string &);
+       private:
+               virtual void transliterate(UnicodeChar, std::string &);
        };
 
-       class Decoder: public StringCodec::Decoder
+       class Decoder: public Codec::Decoder
        {
        public:
-               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() const { return new Encoder; }
-       Decoder *create_decoder() const { return new Decoder; }
+       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); }
 };
 
+} // namespace Codecs
 } // namespace Msp
 
 #endif