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,7 +67,7 @@ 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;
}

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

@@ -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)

View File

@@ -428,20 +428,15 @@
#define wxUSE_POSTSCRIPT 0
/*
* Compile wxString with some Unicode support?
* Compile wxString with some Unicode (wide character) support?
*/
#define wxUSE_WCHAR_T 0
/*
* Compile wxString in wide character (Unicode) mode?
* Compile wxWindows in Unicode mode (Win32 only for now)?
*/
#define wxUSE_UNICODE 0
/*
* Compile wxString with (limited) multibyte char support?
*/
#define wxUSE_MULTIBYTE 0
/*
* Work around a bug in GNU libc 5.x wcstombs() implementation.
*

View File

@@ -360,7 +360,7 @@ off_t wxFile::Tell() const
{
wxASSERT( IsOpened() );
int iRc = tell(m_fd);
int iRc = wxTell(m_fd);
if ( iRc == -1 ) {
wxLogSysError(_("can't get seek position on file descriptor %d"), m_fd);
return wxInvalidOffset;
@@ -377,7 +377,7 @@ off_t wxFile::Length() const
#ifdef __VISUALC__
int iRc = _filelength(m_fd);
#else // !VC++
int iRc = tell(m_fd);
int iRc = wxTell(m_fd);
if ( iRc != -1 ) {
// @ have to use const_cast :-(
int iLen = ((wxFile *)this)->SeekEnd();

View File

@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "BaseRelease"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MT" /YX /FD /c
# ADD CPP /nologo /MT /W3 /Zi /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D WIN95=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN32__" /D "_MT" /Yu"wx/wxprec.h" /FD /c
# ADD CPP /nologo /MT /W4 /Zi /O2 /I "$(wx)\include" /I "$(wx)\src\zlib" /D "NDEBUG" /D wxUSE_GUI=0 /D WIN95=1 /D "__WIN95__" /D "WIN32" /D "_WIN32" /D WINVER=0x400 /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN32__" /D "_MT" /Yu"wx/wxprec.h" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
@@ -117,6 +117,10 @@ SOURCE=.\src\common\dynlib.cpp
# End Source File
# Begin Source File
SOURCE=.\src\common\encconv.cpp
# End Source File
# Begin Source File
SOURCE=.\src\common\event.cpp
# End Source File
# Begin Source File
@@ -141,6 +145,10 @@ SOURCE=.\src\common\filesys.cpp
# End Source File
# Begin Source File
SOURCE=.\src\common\fontmap.cpp
# End Source File
# Begin Source File
SOURCE=.\src\common\fs_inet.cpp
# End Source File
# Begin Source File