X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Fiso88591.cpp;h=a21b6f15d6601e04be4cbeb7100218a5308cc90b;hp=064d4a76792eae33f12ee45a802187fc66a56750;hb=242a4a9abe1e1113b5eb39aa751aa054f696d7be;hpb=b56eb5ec1da675da0c66abc53c1e4f6c4e4cccbd diff --git a/source/stringcodec/iso88591.cpp b/source/stringcodec/iso88591.cpp index 064d4a7..a21b6f1 100644 --- a/source/stringcodec/iso88591.cpp +++ b/source/stringcodec/iso88591.cpp @@ -1,38 +1,31 @@ -/* $Id$ - -This file is part of libmspstrings -Copyright © 2006-2007 Mikko Rasa -Distributed under the LGPL -*/ - #include "iso88591.h" using namespace std; namespace Msp { -namespace Codecs { +namespace StringCodec { -void Iso88591::Encoder::encode_char(UnicodeChar ch, string &buf) +void Iso88591::Encoder::encode_char(unichar ch, string &buf) { if(ch<0 || ch>0xFF) - return error(ch, buf, "Can't express character in ISO-8859-1"); + return error(ch, buf, invalid_character(ch, "ISO-8859-1")); buf += ch; } -void Iso88591::Encoder::transliterate(UnicodeChar, string &buf) +void Iso88591::Encoder::transliterate(unichar, string &buf) { buf += '?'; } -UnicodeChar Iso88591::Decoder::decode_char(const string &str, string::const_iterator &i) +unichar Iso88591::Decoder::decode_char(const string &str, string::const_iterator &i) { if(i==str.end()) - return error("No input"); + return -1; return static_cast(*i++); } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp