+ // compiler-generated default ctor and other methods are ok
+
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual wxMBConv *Clone() const { return new wxMBConvStrictUTF8(); }
+
+#if wxUSE_UNICODE_UTF8
+ // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
+ // take the shortcut in that case
+ virtual bool IsUTF8() const { return true; }
+#endif
+};
+
+class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8
+{
+public:
+ enum
+ {
+ MAP_INVALID_UTF8_NOT = 0,
+ MAP_INVALID_UTF8_TO_PUA = 1,
+ MAP_INVALID_UTF8_TO_OCTAL = 2
+ };
+
+ wxMBConvUTF8(int options = MAP_INVALID_UTF8_NOT) : m_options(options) { }
+
+ virtual size_t ToWChar(wchar_t *dst, size_t dstLen,
+ const char *src, size_t srcLen = wxNO_LEN) const;
+ virtual size_t FromWChar(char *dst, size_t dstLen,
+ const wchar_t *src, size_t srcLen = wxNO_LEN) const;
+
+ virtual wxMBConv *Clone() const { return new wxMBConvUTF8(m_options); }
+
+#if wxUSE_UNICODE_UTF8
+ // NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
+ // take the shortcut in that case
+ virtual bool IsUTF8() const { return m_options == MAP_INVALID_UTF8_NOT; }
+#endif
+
+private:
+ int m_options;
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF16Base: for both LE and BE variants
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF16Base : public wxMBConv
+{
+public:
+ enum { BYTES_PER_CHAR = 2 };
+
+ virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; }
+
+protected:
+ // return the length of the buffer using srcLen if it's not wxNO_LEN and
+ // computing the length ourselves if it is; also checks that the length is
+ // even if specified as we need an entire number of UTF-16 characters and
+ // returns wxNO_LEN which indicates error if it is odd
+ static size_t GetLength(const char *src, size_t srcLen);