X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Fiso88591.h;fp=source%2Fstringcodec%2Fiso88591.h;h=4365c0d18081c4dce214fc86d93a65234e07cadb;hp=0000000000000000000000000000000000000000;hb=b42ed73a1b241c0e93ee03c43c4584b41c549bac;hpb=5b1368cb791cab043f0435628cacbaff36e39b7b diff --git a/source/stringcodec/iso88591.h b/source/stringcodec/iso88591.h new file mode 100644 index 0000000..4365c0d --- /dev/null +++ b/source/stringcodec/iso88591.h @@ -0,0 +1,46 @@ +/* $Id$ + +This file is part of libmspstrings +Copyright © 2006-2007 Mikko Rasa +Distributed under the LGPL +*/ + +#ifndef MSP_STRINGS_ISO88591_H_ +#define MSP_STRINGS_ISO88591_H_ + +#include "codec.h" + +namespace Msp { +namespace Codecs { + +class Iso88591: public Codec +{ +public: + class Encoder: public Codec::Encoder + { + public: + Encoder(ErrorMode em = THROW_ON_ERROR): Codec::Encoder(em) { } + + virtual void encode_char(UnicodeChar, std::string &); + private: + virtual void transliterate(UnicodeChar, std::string &); + }; + + class Decoder: public Codec::Decoder + { + public: + Decoder(ErrorMode em = THROW_ON_ERROR): Codec::Decoder(em) { } + + virtual UnicodeChar decode_char(const std::string &, std::string::const_iterator &); + }; + + virtual const char *get_name() const { return "ISO-8859-1"; } + + 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