+/* $Id$
+
+This file is part of libmspstrings
+Copyright © 2006-2007 Mikko Rasa
+Distributed under the LGPL
+*/
+
#include "ascii.h"
#include "codec.h"
#include "iso2022jp.h"
{
for(string::const_iterator i=str.begin(); i!=str.end(); )
dec->decode_char(str, i);
+ dec->sync();
}
catch(const CodecError &)
{
return result;
}
+void StringCodec::Encoder::error(const string &msg)
+{
+ switch(err_mode_)
+ {
+ case IGNORE_ERRORS: break;
+ case REPLACE_ERRORS: append_replacement(); break;
+ default: throw CodecError(msg);
+ }
+}
+
+void StringCodec::Decoder::error(const string &msg)
+{
+ switch(err_mode_)
+ {
+ case IGNORE_ERRORS: break;
+ case REPLACE_ERRORS: append(0xFFFD); break;
+ default: throw CodecError(msg);
+ }
+}
+
/**
Creates a codec for the given encoding. The caller is responsible for deleting
the codec when it's no longer needed.