Unicode related compilation and run-time fixes (wxUSE_MULTIBYTE removed)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7062 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-04-05 00:13:47 +00:00
parent a7db881a8b
commit 8474223c94
8 changed files with 44 additions and 26 deletions

View File

@@ -54,6 +54,7 @@ public:
return *this;
}
const char *data() const { return m_str; }
operator const char *() const { return m_str; }
char operator[](size_t n) const { return m_str[n]; }
@@ -103,6 +104,7 @@ public:
return *this;
}
const wchar_t *data() const { return m_wcs; }
operator const wchar_t *() const { return m_wcs; }
wchar_t operator[](size_t n) const { return m_wcs[n]; }

View File

@@ -67,9 +67,9 @@ public:
// returns true on success
bool Write(const wxString& s, wxMBConv& conv = wxConvLibc)
{
wxCharBuffer buf = s.mb_str(conv);
const wxWX2MBbuf buf = s.mb_str(conv);
size_t size = strlen(buf);
return Write((const char *) buf, size) == size;
return Write((const char *)buf, size) == size;
}
// flush data not yet written
bool Flush();

View File

@@ -471,7 +471,7 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode);
// this second version will only log the message if the mask had been
// added to the list of masks with AddTraceMask()
DECLARE_LOG_FUNCTION2(Trace, const char *mask);
DECLARE_LOG_FUNCTION2(Trace, const wxChar *mask);
// the last one does nothing if all of level bits are not set
// in wxLog::GetActive()->GetTraceMask() - it's deprecated in favour of

View File

@@ -428,18 +428,30 @@ public:
operator const wxChar*() const { return m_pchData; }
// explicit conversion to C string (use this with printf()!)
const wxChar* c_str() const { return m_pchData; }
// (and this with [wx]Printf()!)
// identical to c_str()
const wxChar* wx_str() const { return m_pchData; }
// identical to c_str()
const wxChar* GetData() const { return m_pchData; }
// conversions with (possible) format convertions: have to return a
// buffer with temporary data
//
// the functions defined (in either Unicode or ANSI) mode are mb_str() to
// return an ANSI (multibyte) string, wc_str() to return a wide string and
// fn_str() to return a string which should be used with the OS APIs
// accepting the file names. The return value is always the same, but the
// type differs because a function may either return pointer to the buffer
// directly or have to use intermediate buffer for translation.
#if wxUSE_UNICODE
const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const { return conv.cWC2MB(m_pchData); }
const wxCharBuffer mb_str(wxMBConv& conv = wxConvLibc) const
{ return conv.cWC2MB(m_pchData); }
const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
const wxChar* wc_str(wxMBConv& WXUNUSED(conv) = wxConvLibc) const { return m_pchData; }
const wxChar* wc_str() const { return m_pchData; }
// for compatibility with !wxUSE_UNICODE version
const wxChar* wc_str(wxMBConv& WXUNUSED(conv)) const { return m_pchData; }
#if wxMBFILES
const wxCharBuffer fn_str() const { return mb_str(wxConvFile); }
@@ -447,17 +459,18 @@ public:
const wxChar* fn_str() const { return m_pchData; }
#endif // wxMBFILES/!wxMBFILES
#else // ANSI
#if wxUSE_MULTIBYTE
const wxChar* mb_str(wxMBConv& WXUNUSED(conv) = wxConvLibc) const
{ return m_pchData; }
const wxWX2MBbuf mbc_str() const { return mb_str(*wxConvCurrent); }
#else // !mmultibyte
const wxChar* mb_str(wxMBConv& WXUNUSED(con) = wxConvLibc) const { return m_pchData; }
const wxChar* mb_str() const { return m_pchData; }
// for compatibility with wxUSE_UNICODE version
const wxChar* mb_str(wxMBConv& WXUNUSED(conv)) const { return m_pchData; }
const wxWX2MBbuf mbc_str() const { return mb_str(); }
#endif // multibyte/!multibyte
#if wxUSE_WCHAR_T
const wxWCharBuffer wc_str(wxMBConv& conv) const { return conv.cMB2WC(m_pchData); }
const wxWCharBuffer wc_str(wxMBConv& conv) const
{ return conv.cMB2WC(m_pchData); }
#endif // wxUSE_WCHAR_T
const wxChar* fn_str() const { return m_pchData; }
#endif // Unicode/ANSI

View File

@@ -6,7 +6,7 @@
// Created: 29/01/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_VERSIONH__
@@ -16,7 +16,7 @@
#define wxMAJOR_VERSION 2
#define wxMINOR_VERSION 1
#define wxRELEASE_NUMBER 15
#define wxVERSION_STRING "wxWindows 2.1.15"
#define wxVERSION_STRING _T("wxWindows 2.1.15")
#define wxVERSION_NUMBER (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER
#define wxBETA_NUMBER 0
#define wxVERSION_FLOAT wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0)