+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);
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF16LE (for conversion using UTF16 Little Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF16LE : public wxMBConvUTF16Base
+{
+public:
+ 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 wxMBConvUTF16LE; }
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF16BE (for conversion using UTF16 Big Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF16BE : public wxMBConvUTF16Base
+{
+public:
+ 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 wxMBConvUTF16BE; }
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF32Base: base class for both LE and BE variants
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF32Base : public wxMBConv
+{
+public:
+ enum { BYTES_PER_CHAR = 4 };
+
+ virtual size_t GetMBNulLen() const { return BYTES_PER_CHAR; }
+
+protected:
+ // this is similar to wxMBConvUTF16Base method with the same name except
+ // that, of course, it verifies that length is divisible by 4 if given and
+ // not by 2
+ static size_t GetLength(const char *src, size_t srcLen);
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF32LE (for conversion using UTF32 Little Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF32LE : public wxMBConvUTF32Base
+{
+public:
+ 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 wxMBConvUTF32LE; }
+};
+
+// ----------------------------------------------------------------------------
+// wxMBConvUTF32BE (for conversion using UTF32 Big Endian encoding)
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMBConvUTF32BE : public wxMBConvUTF32Base
+{
+public:
+ 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 wxMBConvUTF32BE; }
+};