+ // The functions doing actual conversion from/to narrow to/from wide
+ // character strings.
+ //
+ // On success, the return value is the length (i.e. the number of
+ // characters, not bytes) of the converted string including any trailing
+ // L'\0' or (possibly multiple) '\0'(s). If the conversion fails or if
+ // there is not enough space for everything, including the trailing NUL
+ // character(s), in the output buffer, wxCONV_FAILED is returned.
+ //
+ // In the special case when dst is NULL (the value of dstLen is ignored
+ // then) the return value is the length of the needed buffer but nothing
+ // happens otherwise. If srcLen is wxNO_LEN, the entire string, up to and
+ // including the trailing NUL(s), is converted, otherwise exactly srcLen
+ // bytes are.
+ //
+ // Typical usage:
+ //
+ // size_t dstLen = conv.ToWChar(NULL, 0, src);
+ // if ( dstLen == wxCONV_FAILED )
+ // ... handle error ...
+ // wchar_t *wbuf = new wchar_t[dstLen];
+ // conv.ToWChar(wbuf, dstLen, src);
+ // ... work with wbuf ...
+ // delete [] wbuf;
+ //
+ 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;
+
+
+ // Convenience functions for translating NUL-terminated strings: returns
+ // the buffer containing the converted string or NULL pointer if the
+ // conversion failed.
+ const wxWCharBuffer cMB2WC(const char *in) const;
+ const wxCharBuffer cWC2MB(const wchar_t *in) const;
+
+ // Convenience functions for converting strings which may contain embedded
+ // NULs and don't have to be NUL-terminated.
+ //
+ // inLen is the length of the buffer including trailing NUL if any or
+ // wxNO_LEN if the input is NUL-terminated.
+ //
+ // outLen receives, if not NULL, the length of the converted string or 0 if
+ // the conversion failed (returning 0 and not -1 in this case makes it
+ // difficult to distinguish between failed conversion and empty input but
+ // this is done for backwards compatibility). Notice that the rules for
+ // whether outLen accounts or not for the last NUL are the same as for
+ // To/FromWChar() above: if inLen is specified, outLen is exactly the
+ // number of characters converted, whether the last one of them was NUL or
+ // not. But if inLen == wxNO_LEN then outLen doesn't account for the last
+ // NUL even though it is present.
+ const wxWCharBuffer
+ cMB2WC(const char *in, size_t inLen, size_t *outLen) const;
+ const wxCharBuffer
+ cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const;
+
+ // And yet more convenience functions for converting the entire buffers:
+ // these are the simplest and least error-prone as you never need to bother
+ // with lengths/sizes directly.
+ const wxWCharBuffer cMB2WC(const wxScopedCharBuffer& in) const;
+ const wxCharBuffer cWC2MB(const wxScopedWCharBuffer& in) const;
+
+ // convenience functions for converting MB or WC to/from wxWin default