]> git.tdb.fi Git - libs/core.git/blobdiff - source/jisx0208.h
Add copyright notices and Id tags
[libs/core.git] / source / jisx0208.h
index a81f578108c9f933f3fdbf3ac91b16cd7e6b6baf..4e3175066ac4fa097d71f8c572435c3f805b89bb 100644 (file)
@@ -1,3 +1,10 @@
+/* $Id$
+
+This file is part of libmspstrings
+Copyright © 2006-2007 Mikko Rasa
+Distributed under the LGPL
+*/
+
 #ifndef MSP_STRINGS_JISX0208_H_
 #define MSP_STRINGS_JISX0208_H_
 
@@ -11,20 +18,25 @@ public:
        class Encoder: public StringCodec::Encoder
        {
        public:
+               Encoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Encoder(em) { }
                void encode_char(wchar_t);
+       private:
+               void append_replacement() { append("!)"); }
        };
 
        class Decoder: public StringCodec::Decoder
        {
        public:
+               Decoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Decoder(em), high(0) { }
                void decode_char(const std::string &, std::string::const_iterator &);
                void sync();
+               void reset();
        private:
                char high;
        };
 
-       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); }
 };
 
 extern wchar_t jisx0208_to_ucs(unsigned short);