class Encoder
{
protected:
- ErrorMode err_mode;
+ ErrorMode err_mode = THROW_ON_ERROR;
Encoder(ErrorMode em): err_mode(em==DEFAULT ? THROW_ON_ERROR : em) { }
public:
- virtual ~Encoder() { }
+ virtual ~Encoder() = default;
/** Encodes a single unicode character. If the character can't be
represented in this encoding, error() should be called. */
class Decoder
{
protected:
- ErrorMode err_mode;
+ ErrorMode err_mode = THROW_ON_ERROR;
Decoder(ErrorMode em): err_mode(em==DEFAULT ? THROW_ON_ERROR : em) { }
public:
- virtual ~Decoder() { }
+ virtual ~Decoder() = default;
/** Decodes a single character from a string. The iterator is advanced
to the next character. For stateful codecs, -1 may be returned if a
};
protected:
- Codec() { }
+ Codec() = default;
public:
- virtual ~Codec() { }
+ virtual ~Codec() = default;
/** Returns the name of the encoding handled by this codec. */
virtual const char *get_name() const = 0;
class StandardCodec: public Codec
{
private:
- ErrorMode err_mode;
+ ErrorMode err_mode = THROW_ON_ERROR;
protected:
StandardCodec(ErrorMode em): err_mode(em==DEFAULT ? THROW_ON_ERROR : em) { }
{ return (em==DEFAULT ? err_mode : em); }
public:
- virtual Encoder *create_encoder(ErrorMode em = DEFAULT) const
+ Encoder *create_encoder(ErrorMode em = DEFAULT) const override
{ return new typename C::Encoder(get_error_mode(em)); }
- virtual Decoder *create_decoder(ErrorMode em = DEFAULT) const
+ Decoder *create_decoder(ErrorMode em = DEFAULT) const override
{ return new typename C::Decoder(get_error_mode(em)); }
};