## wxMBConv

This class is the base class of a hierarchy of classes capable of converting text strings between multibyte (SBCS or DBCS) encodings and Unicode. It is itself a wrapper around the standard libc mbstowcs() and wcstombs() routines, and has one predefined instance, wxConvLibc.

Derived from

No base class

Include files

<wx/strconv.h>

See also

wxCSConv, wxEncodingConverter, wxMBConv classes overview

Members

wxMBConv::wxMBConv
wxMBConv::MB2WC
wxMBConv::WC2MB
wxMBConv::cMB2WC
wxMBConv::cWC2MB
wxMBConv::cMB2WX
wxMBConv::cWX2MB
wxMBConv::cWC2WX
wxMBConv::cWX2WC

### wxMBConv::wxMBConv

wxMBConv()

Constructor.

### wxMBConv::MB2WC

virtual size_t MB2WC(wchar_t* buf, const char* psz, size_t n) const

Converts from multibyte encoding to Unicode, using the libc routine mbstowcs() (this is overridden by derived classes). Returns the size of the destination buffer.

### wxMBConv::WC2MB

virtual size_t WC2MB(char* buf, const wchar_t* psz, size_t n) const

Converts from Unicode to multibyte encoding, using the libc routine wcstombs() (this is overridden by derived classes). Returns the size of the destination buffer.

### wxMBConv::cMB2WC

const wxWCharBuffer cMB2WC(const char* psz) const

Converts from multibyte encoding to Unicode by calling MB2WC, allocating a temporary wxWCharBuffer to hold the result.

### wxMBConv::cWC2MB

const wxCharBuffer cWC2MB(const wchar_t* psz) const

Converts from Unicode to multibyte encoding by calling WC2MB, allocating a temporary wxCharBuffer to hold the result.

### wxMBConv::cMB2WX

const char* cMB2WX(const char* psz) const

const wxWCharBuffer cMB2WX(const char* psz) const

Converts from multibyte encoding to the current wxChar type (which depends on whether wxUSE_UNICODE is set to 1). If wxChar is char, it returns the parameter unaltered. If wxChar is wchar_t, it returns the result in a wxWCharBuffer. The macro wxMB2WXbuf is defined as the correct return type (without const).

### wxMBConv::cWX2MB

const char* cWX2MB(const wxChar* psz) const

const wxCharBuffer cWX2MB(const wxChar* psz) const

Converts from the current wxChar type to multibyte encoding. If wxChar is char, it returns the parameter unaltered. If wxChar is wchar_t, it returns the result in a wxCharBuffer. The macro wxWX2MBbuf is defined as the correct return type (without const).

### wxMBConv::cWC2WX

const wchar_t* cWC2WX(const wchar_t* psz) const

const wxCharBuffer cWC2WX(const wchar_t* psz) const

Converts from Unicode to the current wxChar type. If wxChar is wchar_t, it returns the parameter unaltered. If wxChar is char, it returns the result in a wxCharBuffer. The macro wxWC2WXbuf is defined as the correct return type (without const).

### wxMBConv::cWX2WC

const wchar_t* cWX2WC(const wxChar* psz) const

const wxWCharBuffer cWX2WC(const wxChar* psz) const

Converts from the current wxChar type to Unicode. If wxChar is wchar_t, it returns the parameter unaltered. If wxChar is char, it returns the result in a wxWCharBuffer. The macro wxWX2WCbuf is defined as the correct return type (without const).