const wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); }
#endif
};
-WXDLLEXPORT_DATA(extern wxMBConv) wxConv_libc, wxConv_UTF7, wxConv_UTF8;
-#define wxConv_file wxConv_libc
+WXDLLEXPORT_DATA(extern wxMBConv) wxConv_libc;
-class WXDLLEXPORT wxCSConv : wxMBConv
+#define wxANOTHER_MBCONV(type) \
+class type : public wxMBConv { \
+ public: \
+ virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const; \
+ virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const; \
+}
+
+WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConv_file)) wxConv_file;
+WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConv_UTF7)) wxConv_UTF7;
+WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConv_UTF8)) wxConv_UTF8;
+#if defined(__WXGTK__) && (GTK_MINOR_VERSION > 0)
+ WXDLLEXPORT_DATA(extern wxANOTHER_MBCONV(wxMBConv_gdk)) wxConv_gdk;
+#endif // GTK > 1.0
+
+class wxCharacterSet;
+class WXDLLEXPORT wxCSConv : public wxMBConv
{
private:
- wxChar *data;
+ wxChar *m_name;
+ wxCharacterSet *m_cset;
+ bool m_deferred;
+ void SetName(const wxChar *charset);
public:
wxCSConv(const wxChar *charset);
+ virtual ~wxCSConv();
+ void LoadNow();
virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
virtual size_t WC2MB(char *buf, const wchar_t *psz, size_t n) const;
};
+WXDLLEXPORT_DATA(extern wxCSConv) wxConv_local;
+
+WXDLLEXPORT_DATA(extern wxMBConv *) wxConv_current;
+
// filenames are multibyte on Unix and probably widechar on Windows?
#ifdef __UNIX__
#define wxMBFILES 1
// from C string (for compilers using unsigned char)
wxString(const unsigned char* psz, size_t nLength = wxSTRING_MAXLEN)
{ InitWith((const char*)psz, 0, nLength); }
+ // from multibyte string
+ wxString(const char *psz, wxMBConv& WXUNUSED(conv), size_t nLength = wxSTRING_MAXLEN)
+ { InitWith(psz, 0, nLength); }
// from wide (Unicode) string
wxString(const wchar_t *pwz);
// from wxCharBuffer
const wxWCharBuffer wc_str(wxMBConv& conv) const { return conv.cMB2WC(m_pchData); }
const wxChar* fn_str() const { return m_pchData; }
#endif
+ // for convenience
+ const wxWX2MBbuf mbc_str() const { return mb_str(*wxConv_current); }
// overloaded assignment
// from another wxString
wxString WXDLLEXPORT operator+(wxChar ch, const wxString& string);
wxString WXDLLEXPORT operator+(const wxString& string, const wxChar *psz);
wxString WXDLLEXPORT operator+(const wxChar *psz, const wxString& string);
+#if wxUSE_UNICODE
+inline wxString WXDLLEXPORT operator+(const wxString& string, const wxWCharBuffer& buf)
+{ return string + (const wchar_t *)buf; }
+inline wxString WXDLLEXPORT operator+(const wxWCharBuffer& buf, const wxString& string)
+{ return (const wchar_t *)buf + string; }
+#else
+inline wxString WXDLLEXPORT operator+(const wxString& string, const wxCharBuffer& buf)
+{ return string + (const char *)buf; }
+inline wxString WXDLLEXPORT operator+(const wxCharBuffer& buf, const wxString& string)
+{ return (const char *)buf + string; }
+#endif
// ---------------------------------------------------------------------------
// Implementation only from here until the end of file