]> git.tdb.fi Git - libs/core.git/blobdiff - source/windows1252.h
Further style and comment adjustments
[libs/core.git] / source / windows1252.h
index 63cb42f7eaf94ca1e0752da5550380bee7fa55a4..47b2cf0f8e2805e7dfd463bc06a45158853f5d6f 100644 (file)
@@ -11,30 +11,36 @@ Distributed under the LGPL
 #include "codec.h"
 
 namespace Msp {
+namespace Codecs {
 
-class Windows1252: public StringCodec
+class Windows1252: 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 "Windows-1252"; }
+
+       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