X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstringcodec%2Fcodec.h;h=d0871ff119ab563ea2ff000ece006c55577ddf48;hb=8245b8036c8bdc51625616ca6248b0f2b0271dc0;hp=c70e052dd1b35e819a591327777f8eec4dbdc9bd;hpb=d3fc0bf0f20f100f2831188c1ce21461d21c2c7a;p=libs%2Fcore.git diff --git a/source/stringcodec/codec.h b/source/stringcodec/codec.h index c70e052..d0871ff 100644 --- a/source/stringcodec/codec.h +++ b/source/stringcodec/codec.h @@ -41,7 +41,7 @@ public: protected: ErrorMode err_mode; - Encoder(ErrorMode em): err_mode(em) { } + Encoder(ErrorMode em): err_mode(em==DEFAULT ? THROW_ON_ERROR : em) { } public: virtual ~Encoder() { } @@ -92,7 +92,7 @@ public: protected: ErrorMode err_mode; - Decoder(ErrorMode em): err_mode(em) { } + Decoder(ErrorMode em): err_mode(em==DEFAULT ? THROW_ON_ERROR : em) { } public: virtual ~Decoder() { } @@ -177,7 +177,7 @@ public: /** Convenience function that decodes a string. */ -template +template ustring decode(const std::string &s) { typename C::Decoder dec; @@ -185,7 +185,7 @@ ustring decode(const std::string &s) } /** Convenience function that encodes a string. */ -template +template std::string encode(const ustring &s) { typename C::Encoder enc; @@ -193,7 +193,7 @@ std::string encode(const ustring &s) } /** Convenience function that transcodes a string from one codec to another. */ -template +template std::string transcode(const std::string &s) { return encode(decode(s));