X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstringcodec%2Futf16.h;h=73d81cb9c26a15ec4ad9c318e4525f5a5a4a3705;hp=1850258a8aaae2857b778865284afc166fc6b234;hb=HEAD;hpb=122846f0881673770d88eff7d925ecf25c01b62e diff --git a/source/stringcodec/utf16.h b/source/stringcodec/utf16.h index 1850258..a588b12 100644 --- a/source/stringcodec/utf16.h +++ b/source/stringcodec/utf16.h @@ -1,6 +1,7 @@ #ifndef MSP_STRINGCODEC_UTF16_H_ #define MSP_STRINGCODEC_UTF16_H_ +#include #include "codec.h" namespace Msp { @@ -11,7 +12,7 @@ The UTF-16 codec, as specified in the Unicode standard. Both little and big endian are supported, as well as autodetection with the BOM. In the absence of a BOM, big endian is assumed. */ -class Utf16: public StandardCodec +class MSPCORE_API Utf16: public StandardCodec { public: enum Endian @@ -21,7 +22,7 @@ public: LITTLE }; - class Encoder: public Codec::Encoder + class MSPCORE_API Encoder: public Codec::Encoder { private: Endian endian = BIG; @@ -30,12 +31,12 @@ public: public: Encoder(ErrorMode em = DEFAULT, Endian en = BIG); - virtual void encode_char(unichar, std::string &); + void encode_char(unichar, std::string &) override; private: - virtual void transliterate(unichar, std::string &); + void transliterate(unichar, std::string &) override; }; - class Decoder: public Codec::Decoder + class MSPCORE_API Decoder: public Codec::Decoder { private: Endian endian = AUTO; @@ -43,7 +44,7 @@ public: public: Decoder(ErrorMode em = DEFAULT, Endian en = AUTO); - virtual unichar decode_char(const std::string &, std::string::const_iterator &); + unichar decode_char(const std::string &, std::string::const_iterator &) override; private: unichar decode_unit(const std::string &, const std::string::const_iterator &, std::string::const_iterator &); }; @@ -57,13 +58,13 @@ public: endian(en) { } - virtual const char *get_name() const + const char *get_name() const override { return endian==BIG ? "UTF-16-BE" : endian==LITTLE ? "UTF-16-LE" : "UTF-16"; } - virtual Encoder *create_encoder(ErrorMode em = DEFAULT) const + Encoder *create_encoder(ErrorMode em = DEFAULT) const override { return new Encoder(get_error_mode(em), endian); } - virtual Decoder *create_decoder(ErrorMode em = DEFAULT) const + Decoder *create_decoder(ErrorMode em = DEFAULT) const override { return new Decoder(get_error_mode(em), endian); } };