X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstringcodec%2Fiso885915.cpp;h=8dfc3a1e91a5c178e26461d686ea1bb340f76ce9;hb=9a79b9ca04d934e8e5b865a1d2b6719f76ec9d15;hp=7aef9d34ef980c1b84356238ee5fffce8eb81ca7;hpb=967785734be5c3fc6f75da122c2d93ebbb338271;p=libs%2Fcore.git diff --git a/source/stringcodec/iso885915.cpp b/source/stringcodec/iso885915.cpp index 7aef9d3..8dfc3a1 100644 --- a/source/stringcodec/iso885915.cpp +++ b/source/stringcodec/iso885915.cpp @@ -23,9 +23,9 @@ const int mapping[map_size*2]= namespace Msp { -namespace Codecs { +namespace StringCodec { -void Iso885915::Encoder::encode_char(UnicodeChar ch, string &buf) +void Iso885915::Encoder::encode_char(unichar ch, string &buf) { int tch = transform_mapping_or_direct(mapping, map_size, ch, false); if(tch<0 || tch>0xFF) @@ -35,29 +35,20 @@ void Iso885915::Encoder::encode_char(UnicodeChar ch, string &buf) } -void Iso885915::Encoder::transliterate(UnicodeChar, string &buf) +void Iso885915::Encoder::transliterate(unichar, string &buf) { buf += '?'; } -UnicodeChar Iso885915::Decoder::decode_char(const string &str, string::const_iterator &i) +unichar Iso885915::Decoder::decode_char(const string &str, string::const_iterator &i) { if(i==str.end()) - return error("No input"); + return -1; - unsigned char ch = *i; - int tch = transform_mapping_or_direct(mapping, map_size, ch, true); - - UnicodeChar result; - if(tch==-1) - result = error("Undefined ISO-8859-15 character"); - else - result = tch; - - ++i; - return result; + unsigned char ch = *i++; + return transform_mapping_or_direct(mapping, map_size, ch, true); } -} // namespace Codecs +} // namespace StringCodec } // namespace Msp