X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Fcodec.h;h=5e67d46049078f3555994eeca393ce9691bf75f8;hp=f434ed82e597c706b7bf54de4e24081b4447f693;hb=HEAD;hpb=99b9121e2158603372c7313400283b622e6754d8 diff --git a/source/stringcodec/codec.h b/source/stringcodec/codec.h index f434ed8..f53bae5 100644 --- a/source/stringcodec/codec.h +++ b/source/stringcodec/codec.h @@ -2,6 +2,7 @@ #define MSP_STRINGCODEC_CODEC_H_ #include +#include #include "except.h" #include "ustring.h" @@ -25,7 +26,7 @@ Unicode strings are represented as ustrings. An std::string is considered to be an encoded sequence of bytes. A codec is able to determine if an encoded string could be decoded with it. */ -class Codec +class MSPCORE_API Codec { public: /** @@ -36,7 +37,7 @@ public: may find it useful or necessary to implement some other functions too (particularly sync and reset for stateful codecs). */ - class Encoder + class MSPCORE_API Encoder { protected: ErrorMode err_mode = THROW_ON_ERROR; @@ -87,7 +88,7 @@ public: Each codec class should contain an Decoder class derived from this. */ - class Decoder + class MSPCORE_API Decoder { protected: ErrorMode err_mode = THROW_ON_ERROR; @@ -171,10 +172,10 @@ protected: { return (em==DEFAULT ? err_mode : em); } public: - virtual Encoder *create_encoder(ErrorMode em = DEFAULT) const + Encoder *create_encoder(ErrorMode em = DEFAULT) const override { return new typename C::Encoder(get_error_mode(em)); } - virtual Decoder *create_decoder(ErrorMode em = DEFAULT) const + Decoder *create_decoder(ErrorMode em = DEFAULT) const override { return new typename C::Decoder(get_error_mode(em)); } }; @@ -204,11 +205,11 @@ std::string transcode(const std::string &s) /** Creates a codec for an encoding by name. The caller is responsible for deleting the codec when it's no longer needed. */ -Codec *create_codec(const std::string &); +MSPCORE_API Codec *create_codec(const std::string &); /** Automatically detects the encoding of a string and creates a codec for it. The codec must be deleted when it's no longer needed. */ -Codec *detect_codec(const std::string &); +MSPCORE_API Codec *detect_codec(const std::string &); } // namespace StringCodec } // namespace Msp