]> git.tdb.fi Git - libs/core.git/blobdiff - source/stringcodec/utf8.h
Allow error mode to be specified when creating the codec object
[libs/core.git] / source / stringcodec / utf8.h
index cb4924aeeed36b0960668e08f315c70bbc86663e..fcf23eff35e55e0a03532f9e9b541ea2ac4a6414 100644 (file)
@@ -6,7 +6,7 @@
 namespace Msp {
 namespace StringCodec {
 
-class Utf8: public Codec
+class Utf8: public StandardCodec<Utf8>
 {
 public:
        class Encoder: public Codec::Encoder
@@ -27,10 +27,9 @@ public:
                virtual unichar decode_char(const std::string &, std::string::const_iterator &);
        };
 
-       virtual const char *get_name() const { return "UTF-8"; }
+       Utf8(ErrorMode em = THROW_ON_ERROR): StandardCodec<Utf8>(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 "UTF-8"; }
 };
 
 } // namespace StringCodec