-Base class for string codecs. Mostly abstract. Use one of the derived classes
-or the function create_codec to create a specific codec.
+Base class for string codecs. Use one of the derived classes or the function
+create_codec to create a specific codec.
For the purposes of this class, an std::wstring is considered to contain
Unicode characters and an std::string is considered to be an encoded sequence
For the purposes of this class, an std::wstring is considered to contain
Unicode characters and an std::string is considered to be an encoded sequence
/**
Encodes a string.
*/
virtual void encode(const std::wstring &s)
{ for(std::wstring::const_iterator i=s.begin(); i!=s.end(); ++i) encode_char(*i); }
/**
Encodes a string.
*/
virtual void encode(const std::wstring &s)
{ for(std::wstring::const_iterator i=s.begin(); i!=s.end(); ++i) encode_char(*i); }
/**
Brings the encoder back to its initial state. This allows the encoded
sequence to be extracted or flushed without loss of integrity.
/**
Brings the encoder back to its initial state. This allows the encoded
sequence to be extracted or flushed without loss of integrity.
void append(char c) { buffer_+=c; }
void append(const char *s, unsigned l) { buffer_.append(s, l); }
void append(const std::string &s) { buffer_+=s; }
void append(char c) { buffer_+=c; }
void append(const char *s, unsigned l) { buffer_.append(s, l); }
void append(const std::string &s) { buffer_+=s; }
- virtual Encoder *create_encoder() const =0;
- virtual Decoder *create_decoder() const =0;
+ virtual Encoder *create_encoder(ErrorMode =THROW_ON_ERROR) const =0;
+ virtual Decoder *create_decoder(ErrorMode =THROW_ON_ERROR) const =0;