]> git.tdb.fi Git - libs/core.git/blobdiff - source/iso646fi.h
Make codecs able to tell their name
[libs/core.git] / source / iso646fi.h
index 1f0df917af6ea0d8d46478f84744cd29716c3799..3047edff021d030e0f655a3cc4d825050e736332 100644 (file)
@@ -1,33 +1,44 @@
+/* $Id$
+
+This file is part of libmspstrings
+Copyright © 2006-2007 Mikko Rasa
+Distributed under the LGPL
+*/
+
 #ifndef MSP_STRINGS_ISO646FI_H_
 #define MSP_STRINGS_ISO646FI_H_
 
 #include "codec.h"
 
 namespace Msp {
+namespace Codecs {
 
-class Iso646Fi: public StringCodec
+class Iso646Fi: public Codec
 {
 public:
-       class Encoder: public StringCodec::Encoder
+       class Encoder: public Codec::Encoder
        {
        public:
-               Encoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Encoder(em) { }
-               void encode_char(wchar_t);
+               Encoder(ErrorMode em=THROW_ON_ERROR): Codec::Encoder(em) { }
+               virtual void encode_char(UnicodeChar, std::string &);
        private:
-               void append_replacement() { append(032); }
+               virtual void transliterate(UnicodeChar, std::string &);
        };
 
-       class Decoder: public StringCodec::Decoder
+       class Decoder: public Codec::Decoder
        {
        public:
-               Decoder(ErrorMode em=THROW_ON_ERROR): StringCodec::Decoder(em) { }
-               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(ErrorMode em=THROW_ON_ERROR) const { return new Encoder(em); }
-       Decoder *create_decoder(ErrorMode em=THROW_ON_ERROR) const { return new Decoder(em); }
+       virtual const char *get_name() const { return "ISO-646-FI"; }
+
+       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); }
 };
 
+} // namespace Codecs
 } // namespace Msp
 
 #endif