Remove wxUSE_UNICODE checks as they're always true now

Also remove all code guarded by "#if !wxUSE_UNICODE".
This commit is contained in:
Vadim Zeitlin
2022-10-27 19:43:30 +02:00
parent 5c49448c75
commit 4519d8e08a
195 changed files with 400 additions and 3509 deletions
+1 -5
View File
@@ -473,11 +473,7 @@ public:
// type of argv parameter of main()) or to "wchar_t **" (for compatibility
// with Unicode build in previous wx versions and because the command line
// can, in pr
#if wxUSE_UNICODE
wxCmdLineArgsArray argv;
#else
char **argv;
#endif
protected:
// delete all objects in wxPendingDelete list
@@ -825,7 +821,7 @@ public:
// locale (under Unix UTF-8, capable of representing any Unicode string, is
// almost always used and there is no way to retrieve the Unicode command line
// anyhow).
#if wxUSE_UNICODE && defined(__WINDOWS__)
#if defined(__WINDOWS__)
#ifdef __VISUALC__
#define wxIMPLEMENT_WXWIN_MAIN_CONSOLE \
int wmain(int argc, wchar_t **argv) \
+10 -18
View File
@@ -411,26 +411,18 @@ typedef wxWritableCharTypeBuffer<char> wxWritableCharBuffer;
typedef wxWritableCharTypeBuffer<wchar_t> wxWritableWCharBuffer;
#if wxUSE_UNICODE
#define wxWxCharBuffer wxWCharBuffer
// Compatibility defines, don't use them in the new code.
#define wxWxCharBuffer wxWCharBuffer
#define wxMB2WXbuf wxWCharBuffer
#define wxWX2MBbuf wxCharBuffer
#if wxUSE_UNICODE_WCHAR
#define wxWC2WXbuf wxChar*
#define wxWX2WCbuf wxChar*
#elif wxUSE_UNICODE_UTF8
#define wxWC2WXbuf wxWCharBuffer
#define wxWX2WCbuf wxWCharBuffer
#endif
#else // ANSI
#define wxWxCharBuffer wxCharBuffer
#define wxMB2WXbuf wxChar*
#define wxWX2MBbuf wxChar*
#define wxWC2WXbuf wxCharBuffer
#define wxMB2WXbuf wxWCharBuffer
#define wxWX2MBbuf wxCharBuffer
#if wxUSE_UNICODE_WCHAR
#define wxWC2WXbuf wxChar*
#define wxWX2WCbuf wxChar*
#elif wxUSE_UNICODE_UTF8
#define wxWC2WXbuf wxWCharBuffer
#define wxWX2WCbuf wxWCharBuffer
#endif // Unicode/ANSI
#endif
// ----------------------------------------------------------------------------
// A class for holding growable data buffers (not necessarily strings)
-2
View File
@@ -94,11 +94,9 @@ namespace Catch
i != wxs.end();
++i )
{
#if wxUSE_UNICODE
if ( !iswprint(*i) )
s += wxString::Format(wxASCII_STR("\\u%04X"), *i).ToAscii();
else
#endif // wxUSE_UNICODE
s += *i;
}
+25 -47
View File
@@ -106,55 +106,37 @@
#endif /* wxHAVE_TCHAR_SUPPORT */
/* ------------------------------------------------------------------------- */
/* define wxChar type */
/* define wxChar type for compatibility only */
/* ------------------------------------------------------------------------- */
/* TODO: define wxCharInt to be equal to either int or wint_t? */
#if !wxUSE_UNICODE
typedef char wxChar;
typedef signed char wxSChar;
typedef unsigned char wxUChar;
#else
/* VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as */
/* signed/unsigned version of it which (a) makes sense to me (unlike */
/* char wchar_t is always unsigned) and (b) was how the previous */
/* definitions worked so keep it like this */
typedef wchar_t wxChar;
typedef wchar_t wxSChar;
typedef wchar_t wxUChar;
#endif /* ASCII/Unicode */
typedef wchar_t wxChar;
typedef wchar_t wxSChar;
typedef wchar_t wxUChar;
/* ------------------------------------------------------------------------- */
/* define wxStringCharType */
/* ------------------------------------------------------------------------- */
/* depending on the platform, Unicode build can either store wxStrings as
/* depending on the build options, strings can store their data either as
wchar_t* or UTF-8 encoded char*: */
#if wxUSE_UNICODE
/* FIXME-UTF8: what would be better place for this? */
#if defined(wxUSE_UTF8_LOCALE_ONLY) && !defined(wxUSE_UNICODE_UTF8)
#error "wxUSE_UTF8_LOCALE_ONLY only makes sense with wxUSE_UNICODE_UTF8"
#endif
#ifndef wxUSE_UTF8_LOCALE_ONLY
#define wxUSE_UTF8_LOCALE_ONLY 0
#endif
#ifndef wxUSE_UNICODE_UTF8
#define wxUSE_UNICODE_UTF8 0
#endif
#if wxUSE_UNICODE_UTF8
#define wxUSE_UNICODE_WCHAR 0
#else
#define wxUSE_UNICODE_WCHAR 1
#endif
#else
#define wxUSE_UNICODE_WCHAR 0
#define wxUSE_UNICODE_UTF8 0
/* FIXME-UTF8: what would be better place for this? */
#if defined(wxUSE_UTF8_LOCALE_ONLY) && !defined(wxUSE_UNICODE_UTF8)
#error "wxUSE_UTF8_LOCALE_ONLY only makes sense with wxUSE_UNICODE_UTF8"
#endif
#ifndef wxUSE_UTF8_LOCALE_ONLY
#define wxUSE_UTF8_LOCALE_ONLY 0
#endif
#ifndef wxUSE_UNICODE_UTF8
#define wxUSE_UNICODE_UTF8 0
#endif
#if wxUSE_UNICODE_UTF8
#define wxUSE_UNICODE_WCHAR 0
#else
#define wxUSE_UNICODE_WCHAR 1
#endif
#ifndef SIZEOF_WCHAR_T
#error "SIZEOF_WCHAR_T must be defined before including this file in wx/defs.h"
#endif
@@ -189,15 +171,11 @@
compatibility.
*/
#ifndef wxT
#if !wxUSE_UNICODE
#define wxT(x) x
#else /* Unicode */
/*
Notice that we use an intermediate macro to allow x to be expanded
if it's a macro itself.
*/
#define wxT(x) wxCONCAT_HELPER(L, x)
#endif /* ASCII/Unicode */
/*
Notice that we use an intermediate macro to allow x to be expanded
if it's a macro itself.
*/
#define wxT(x) wxCONCAT_HELPER(L, x)
#endif /* !defined(wxT) */
/*
-8
View File
@@ -370,14 +370,6 @@
# endif
#endif /* !defined(wxUSE_TEXTFILE) */
#ifndef wxUSE_UNICODE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UNICODE must be defined, please read comment near the top of this file."
# else
# define wxUSE_UNICODE 0
# endif
#endif /* !defined(wxUSE_UNICODE) */
#ifndef wxUSE_UNSAFE_WXSTRING_CONV
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UNSAFE_WXSTRING_CONV must be defined, please read comment near the top of this file."
-4
View File
@@ -16,8 +16,6 @@
// wxCmdLineArgsArray: helper class used by wxApp::argv
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
// this class is used instead of either "char **" or "wchar_t **" (neither of
// which would be backwards compatible with all the existing code) for argv
// field of wxApp
@@ -148,7 +146,5 @@ inline bool operator&&(bool cond, const wxCmdLineArgsArray& array)
return cond && !array.IsEmpty();
}
#endif // wxUSE_UNICODE
#endif // _WX_CMDARGS_H_
-6
View File
@@ -206,11 +206,9 @@ public:
// default ctor or ctor giving the cmd line in either Unix or Win form
wxCmdLineParser() { Init(); }
wxCmdLineParser(int argc, char **argv) { Init(); SetCmdLine(argc, argv); }
#if wxUSE_UNICODE
wxCmdLineParser(int argc, wxChar **argv) { Init(); SetCmdLine(argc, argv); }
wxCmdLineParser(int argc, const wxCmdLineArgsArray& argv)
{ Init(); SetCmdLine(argc, argv); }
#endif // wxUSE_UNICODE
wxCmdLineParser(const wxString& cmdline) { Init(); SetCmdLine(cmdline); }
// the same as above, but also gives the cmd line description - otherwise,
@@ -219,23 +217,19 @@ public:
{ Init(); SetDesc(desc); }
wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, char **argv)
{ Init(); SetCmdLine(argc, argv); SetDesc(desc); }
#if wxUSE_UNICODE
wxCmdLineParser(const wxCmdLineEntryDesc *desc, int argc, wxChar **argv)
{ Init(); SetCmdLine(argc, argv); SetDesc(desc); }
wxCmdLineParser(const wxCmdLineEntryDesc *desc,
int argc,
const wxCmdLineArgsArray& argv)
{ Init(); SetCmdLine(argc, argv); SetDesc(desc); }
#endif // wxUSE_UNICODE
wxCmdLineParser(const wxCmdLineEntryDesc *desc, const wxString& cmdline)
{ Init(); SetCmdLine(cmdline); SetDesc(desc); }
// set cmd line to parse after using one of the ctors which don't do it
void SetCmdLine(int argc, char **argv);
#if wxUSE_UNICODE
void SetCmdLine(int argc, wxChar **argv);
void SetCmdLine(int argc, const wxCmdLineArgsArray& argv);
#endif // wxUSE_UNICODE
void SetCmdLine(const wxString& cmdline);
// not virtual, don't use this class polymorphically
+6 -14
View File
@@ -315,13 +315,11 @@ private:
// wxTextDataObject contains text data
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXQT__)
#define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ
#elif defined(__WXMAC__)
#define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ
#endif
#endif // wxUSE_UNICODE
#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXQT__)
#define wxNEEDS_UTF8_FOR_TEXT_DATAOBJ
#elif defined(__WXMAC__)
#define wxNEEDS_UTF16_FOR_TEXT_DATAOBJ
#endif
class WXDLLIMPEXP_CORE wxHTMLDataObject : public wxDataObjectSimple
{
@@ -368,13 +366,7 @@ public:
// ctor: you can specify the text here or in SetText(), or override
// GetText()
wxTextDataObject(const wxString& text = wxEmptyString)
: wxDataObjectSimple(
#if wxUSE_UNICODE
wxDF_UNICODETEXT
#else
wxDF_TEXT
#endif
),
: wxDataObjectSimple(wxDF_UNICODETEXT),
m_text(text)
{
}
-4
View File
@@ -45,10 +45,8 @@ public:
}
#endif // wxUSE_APPLE_IEEE
#if wxUSE_UNICODE
void SetConv( const wxMBConv &conv );
wxMBConv *GetConv() const { return m_conv; }
#endif
protected:
// Ctor and dtor are both protected, this class is never used directly but
@@ -63,9 +61,7 @@ protected:
bool m_useExtendedPrecision;
#endif // wxUSE_APPLE_IEEE
#if wxUSE_UNICODE
wxMBConv *m_conv;
#endif
wxDECLARE_NO_COPY_CLASS(wxDataStreamBase);
};
-3
View File
@@ -166,8 +166,6 @@ inline void wxDisableAsserts() { wxSetAssertHandler(nullptr); }
(assert macros do it).
*/
#if wxUSE_UNICODE
// these overloads are the ones typically used by debugging macros: we have to
// provide wxChar* msg version because it's common to use wxT() in the macros
// and finally, we can't use const wx(char)* msg = nullptr, because that would
@@ -191,7 +189,6 @@ extern WXDLLIMPEXP_BASE void wxOnAssert(const char *file,
const char *func,
const char *cond,
const wxChar *msg) ;
#endif /* wxUSE_UNICODE */
// this version is for compatibility with wx 2.8 Unicode build only, we don't
// use it ourselves any more except in ANSI-only build in which case it is all
+12 -11
View File
@@ -413,12 +413,17 @@ typedef short int WXTYPE;
/* Very common macros */
/* ---------------------------------------------------------------------------- */
/* Printf-like attribute definitions to obtain warnings with GNU C/C++ */
#if defined(__GNUC__) && !wxUSE_UNICODE
/* Printf-like attribute definitions which could be used to obtain warnings
with GNU C/C++ but unfortunately don't work any longer
TODO: make this work with Unicode functions
#if defined(__GNUC__)
# define WX_ATTRIBUTE_FORMAT(like, m, n) __attribute__ ((__format__ (like, m, n)))
#else
# define WX_ATTRIBUTE_FORMAT(like, m, n)
#endif
*/
#define WX_ATTRIBUTE_FORMAT(like, m, n)
#ifndef WX_ATTRIBUTE_PRINTF
# define WX_ATTRIBUTE_PRINTF(m, n) WX_ATTRIBUTE_FORMAT(__printf__, m, n)
@@ -801,12 +806,8 @@ typedef short int WXTYPE;
#define WXUNUSED(identifier) identifier
#endif
/* some arguments are not used in unicode mode */
#if wxUSE_UNICODE
#define WXUNUSED_IN_UNICODE(param) WXUNUSED(param)
#else
#define WXUNUSED_IN_UNICODE(param) param
#endif
/* Defined for compatibility only. */
#define WXUNUSED_IN_UNICODE(param) WXUNUSED(param)
/* unused parameters in non stream builds */
#if wxUSE_STREAMS
@@ -2987,7 +2988,7 @@ typedef GtkWidget *WXWidget;
#endif /* __WXGTK__ */
#if defined(__WXGTK__) || (defined(__WXX11__) && wxUSE_UNICODE)
#if defined(__WXGTK__) || defined(__WXX11__)
#define wxUSE_PANGO 1
#else
#define wxUSE_PANGO 0
+3 -9
View File
@@ -290,20 +290,14 @@ public:
}
#ifdef __WINDOWS__
// this function is useful for loading functions from the standard Windows
// DLLs: such functions have an 'A' (in ANSI build) or 'W' (in Unicode, or
// wide character build) suffix if they take string parameters
// This function is misnamed now as it always loads "W" symbol because we
// always use Unicode now, but keeps its old name for compatibility.
static void *RawGetSymbolAorW(wxDllType handle, const wxString& name)
{
return RawGetSymbol
(
handle,
name +
#if wxUSE_UNICODE
L'W'
#else
'A'
#endif
name + L'W'
);
}
-6
View File
@@ -2207,10 +2207,8 @@ public:
// returns true iff this event's key code is of a certain type
bool IsKeyInCategory(int category) const;
#if wxUSE_UNICODE
// get the Unicode character corresponding to this key
wxChar GetUnicodeKey() const { return m_uniChar; }
#endif // wxUSE_UNICODE
// get the raw key code (platform-dependent)
wxUint32 GetRawKeyCode() const { return m_rawCode; }
@@ -2271,11 +2269,9 @@ public:
long m_keyCode;
#if wxUSE_UNICODE
// This contains the full Unicode character
// in a character events in Unicode mode
wxChar m_uniChar;
#endif
// these fields contain the platform-specific information about
// key that was pressed
@@ -2308,9 +2304,7 @@ private:
m_rawCode = evt.m_rawCode;
m_rawFlags = evt.m_rawFlags;
#if wxUSE_UNICODE
m_uniChar = evt.m_uniChar;
#endif
m_isRepeat = evt.m_isRepeat;
}
+14 -55
View File
@@ -246,66 +246,25 @@ enum wxPosixPermissions
#define wxEof wxPOSIX_IDENT(eof)
// then the functions taking strings
#define wxCRT_Open _wopen
// first the ANSI versions
#define wxCRT_OpenA wxPOSIX_IDENT(open)
#define wxCRT_AccessA wxPOSIX_IDENT(access)
#define wxCRT_ChmodA wxPOSIX_IDENT(chmod)
#define wxCRT_MkDirA wxPOSIX_IDENT(mkdir)
#define wxCRT_RmDirA wxPOSIX_IDENT(rmdir)
wxDECL_FOR_STRICT_MINGW32(int, _wopen, (const wchar_t*, int, ...))
wxDECL_FOR_STRICT_MINGW32(int, _waccess, (const wchar_t*, int))
wxDECL_FOR_STRICT_MINGW32(int, _wchmod, (const wchar_t*, int))
wxDECL_FOR_STRICT_MINGW32(int, _wmkdir, (const wchar_t*))
wxDECL_FOR_STRICT_MINGW32(int, _wrmdir, (const wchar_t*))
wxDECL_FOR_STRICT_MINGW32(int, _wstati64, (const wchar_t*, struct _stati64*))
#define wxCRT_Access _waccess
#define wxCRT_Chmod _wchmod
#define wxCRT_MkDir _wmkdir
#define wxCRT_RmDir _wrmdir
#ifdef wxHAS_HUGE_FILES
// MinGW-64 provides underscore-less versions of all file functions
// except for this one.
#ifdef __MINGW64_TOOLCHAIN__
#define wxCRT_StatA _stati64
#else
#define wxCRT_StatA wxPOSIX_IDENT(stati64)
#endif
#define wxCRT_Stat _wstati64
#else
#define wxCRT_StatA wxPOSIX_IDENT(stat)
#define wxCRT_Stat _wstat
#endif
// then wide char ones
#if wxUSE_UNICODE
#define wxCRT_OpenW _wopen
wxDECL_FOR_STRICT_MINGW32(int, _wopen, (const wchar_t*, int, ...))
wxDECL_FOR_STRICT_MINGW32(int, _waccess, (const wchar_t*, int))
wxDECL_FOR_STRICT_MINGW32(int, _wchmod, (const wchar_t*, int))
wxDECL_FOR_STRICT_MINGW32(int, _wmkdir, (const wchar_t*))
wxDECL_FOR_STRICT_MINGW32(int, _wrmdir, (const wchar_t*))
wxDECL_FOR_STRICT_MINGW32(int, _wstati64, (const wchar_t*, struct _stati64*))
#define wxCRT_AccessW _waccess
#define wxCRT_ChmodW _wchmod
#define wxCRT_MkDirW _wmkdir
#define wxCRT_RmDirW _wrmdir
#ifdef wxHAS_HUGE_FILES
#define wxCRT_StatW _wstati64
#else
#define wxCRT_StatW _wstat
#endif
#endif // wxUSE_UNICODE
// finally the default char-type versions
#if wxUSE_UNICODE
#define wxCRT_Open wxCRT_OpenW
#define wxCRT_Access wxCRT_AccessW
#define wxCRT_Chmod wxCRT_ChmodW
#define wxCRT_MkDir wxCRT_MkDirW
#define wxCRT_RmDir wxCRT_RmDirW
#define wxCRT_Stat wxCRT_StatW
#else // !wxUSE_UNICODE
#define wxCRT_Open wxCRT_OpenA
#define wxCRT_Access wxCRT_AccessA
#define wxCRT_Chmod wxCRT_ChmodA
#define wxCRT_MkDir wxCRT_MkDirA
#define wxCRT_RmDir wxCRT_RmDirA
#define wxCRT_Stat wxCRT_StatA
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
// constants (unless already defined by the user code)
#ifdef wxHAS_UNDERSCORES_IN_POSIX_IDENTS
@@ -44,20 +44,12 @@ public:
private:
static wxString GetAddButtonLabel()
{
#if wxUSE_UNICODE
return wchar_t(0xFF0B); // FULLWIDTH PLUS SIGN
#else
return "+";
#endif
}
static wxString GetRemoveButtonLabel()
{
#if wxUSE_UNICODE
return wchar_t(0x2012); // FIGURE DASH
#else
return "-";
#endif
}
};
-6
View File
@@ -203,12 +203,6 @@ private:
wxString m_label;
int m_value;
#if !wxUSE_UNICODE
// Flag used to indicate that we need to set the label because we were
// unable to do it in the ctor (see comments there).
bool m_needsToSetLabel;
#endif // !wxUSE_UNICODE
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer);
};
+8 -58
View File
@@ -30,65 +30,15 @@
// and use it only to test for pango versions >= 1.16.0
extern const gchar *wx_pango_version_check(int major, int minor, int micro);
#if wxUSE_UNICODE
#define wxGTK_CONV(s) (s).utf8_str()
#define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
#define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
#define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
#define wxGTK_CONV(s) (s).utf8_str()
#define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
#define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
#define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
#define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
#define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s)
#define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s)
#define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s)
#else
#include "wx/font.h"
// convert the text between the given encoding and UTF-8 used by wxGTK
extern WXDLLIMPEXP_CORE wxCharBuffer
wxConvertToGTK(const wxString& s,
wxFontEncoding enc = wxFONTENCODING_SYSTEM);
extern WXDLLIMPEXP_CORE wxCharBuffer
wxConvertFromGTK(const wxString& s,
wxFontEncoding enc = wxFONTENCODING_SYSTEM);
// helper: use the encoding of the given font if it's valid
inline wxCharBuffer wxConvertToGTK(const wxString& s, const wxFont& font)
{
return wxConvertToGTK(s, font.IsOk() ? font.GetEncoding()
: wxFONTENCODING_SYSTEM);
}
inline wxCharBuffer wxConvertFromGTK(const wxString& s, const wxFont& font)
{
return wxConvertFromGTK(s, font.IsOk() ? font.GetEncoding()
: wxFONTENCODING_SYSTEM);
}
// more helpers: allow passing GTK+ strings directly
inline wxCharBuffer
wxConvertFromGTK(const wxGtkString& gs,
wxFontEncoding enc = wxFONTENCODING_SYSTEM)
{
return wxConvertFromGTK(gs.c_str(), enc);
}
inline wxCharBuffer
wxConvertFromGTK(const wxGtkString& gs, const wxFont& font)
{
return wxConvertFromGTK(gs.c_str(), font);
}
#define wxGTK_CONV(s) wxGTK_CONV_FONT((s), m_font)
#define wxGTK_CONV_ENC(s, enc) wxConvertToGTK((s), (enc))
#define wxGTK_CONV_FONT(s, font) wxConvertToGTK((s), (font))
#define wxGTK_CONV_SYS(s) wxConvertToGTK((s))
#define wxGTK_CONV_BACK(s) wxConvertFromGTK((s), m_font)
#define wxGTK_CONV_BACK_ENC(s, enc) wxConvertFromGTK((s), (enc))
#define wxGTK_CONV_BACK_FONT(s, font) wxConvertFromGTK((s), (font))
#define wxGTK_CONV_BACK_SYS(s) wxConvertFromGTK((s))
#endif
#define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
#define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s)
#define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s)
#define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s)
// Define a macro for converting wxString to char* in appropriate encoding for
// the file names.
-2
View File
@@ -547,10 +547,8 @@ struct WXDLLIMPEXP_BASE wxStringEqual
{ return a == b; }
bool operator()( const wxChar* a, const wxChar* b ) const noexcept
{ return wxStrcmp( a, b ) == 0; }
#if wxUSE_UNICODE
bool operator()( const char* a, const char* b ) const noexcept
{ return strcmp( a, b ) == 0; }
#endif // wxUSE_UNICODE
};
#ifdef wxNEEDS_WX_HASH_MAP
+1 -15
View File
@@ -270,13 +270,8 @@ public:
wxHtmlEntitiesParser();
virtual ~wxHtmlEntitiesParser();
// Sets encoding of output string.
// Has no effect if wxUSE_UNICODE==1
#if wxUSE_UNICODE
// Obsolete, has no effect.
void SetEncoding(wxFontEncoding WXUNUSED(encoding)) {}
#else
void SetEncoding(wxFontEncoding encoding);
#endif
// Parses entities in input and replaces them with respective characters
// (with respect to output encoding)
@@ -286,18 +281,9 @@ public:
wxChar GetEntityChar(const wxString& entity) const;
// Returns character that represents given Unicode code
#if wxUSE_UNICODE
wxChar GetCharForCode(unsigned code) const { return (wxChar)code; }
#else
wxChar GetCharForCode(unsigned code) const;
#endif
protected:
#if !wxUSE_UNICODE
wxMBConv *m_conv;
wxFontEncoding m_encoding;
#endif
wxDECLARE_NO_COPY_CLASS(wxHtmlEntitiesParser);
};
-17
View File
@@ -142,13 +142,6 @@ public:
// following space as being part of the same space run as before.
void StopCollapsingSpaces() { m_tmpLastWasSpace = false; }
#if !wxUSE_UNICODE
void SetInputEncoding(wxFontEncoding enc);
wxFontEncoding GetInputEncoding() const { return m_InputEnc; }
wxFontEncoding GetOutputEncoding() const { return m_OutputEnc; }
wxEncodingConverter *GetEncodingConverter() const { return m_EncConv; }
#endif
// creates font depending on m_Font* members.
virtual wxFont* CreateCurrentFont();
@@ -210,9 +203,6 @@ private:
wxFont* m_FontsTable[2][2][2][2][7];
wxString m_FontsFacesTable[2][2][2][2][7];
#if !wxUSE_UNICODE
wxFontEncoding m_FontsEncTable[2][2][2][2][7];
#endif
// table of loaded fonts. 1st four indexes are 0 or 1, depending on on/off
// state of these flags (from left to right):
// [bold][italic][underlined][fixed_size]
@@ -223,13 +213,6 @@ private:
wxString m_FontFaceFixed, m_FontFaceNormal;
// html font sizes and faces of fixed and proportional fonts
#if !wxUSE_UNICODE
wxChar m_nbsp;
wxFontEncoding m_InputEnc, m_OutputEnc;
// I/O font encodings
wxEncodingConverter *m_EncConv;
#endif
// current whitespace handling mode
WhitespaceMode m_whitespaceMode;
+1 -2
View File
@@ -139,8 +139,7 @@ typedef void (wxEvtHandler::*wxHyperlinkEventFunction)(wxHyperlinkEvent&);
#if defined(__WXGTK210__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/hyperlink.h"
// Note that the native control is only available in Unicode version under MSW.
#elif defined(__WXMSW__) && wxUSE_UNICODE && !defined(__WXUNIVERSAL__)
#elif defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/hyperlink.h"
#else
#include "wx/generic/hyperlink.h"
-8
View File
@@ -45,13 +45,9 @@ extern void WXDLLIMPEXP_BASE wxEntryCleanup();
extern int WXDLLIMPEXP_BASE wxEntry(int& argc, wxChar **argv);
// we overload wxEntry[Start]() to take "char **" pointers too
#if wxUSE_UNICODE
extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, char **argv);
extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv);
#endif// wxUSE_UNICODE
// Under Windows we define additional wxEntry() overloads with signature
// compatible with WinMain() and not the traditional main().
#ifdef __WINDOWS__
@@ -68,9 +64,7 @@ extern int WXDLLIMPEXP_BASE wxEntry(int& argc, char **argv);
// call to wxInitialize() must be matched by wxUninitialize())
extern bool WXDLLIMPEXP_BASE wxInitialize();
extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, wxChar **argv);
#if wxUSE_UNICODE
extern bool WXDLLIMPEXP_BASE wxInitialize(int& argc, char **argv);
#endif
// clean up -- the library can't be used any more after the last call to
// wxUninitialize()
@@ -92,12 +86,10 @@ public:
m_ok = wxInitialize(argc, argv);
}
#if wxUSE_UNICODE
wxInitializer(int& argc, char **argv)
{
m_ok = wxInitialize(argc, argv);
}
#endif // wxUSE_UNICODE
// has the initialization been successful? (explicit test)
bool IsOk() const { return m_ok; }
+1 -6
View File
@@ -25,12 +25,7 @@
without them being defined, better give a clearer error right now.
*/
#if !defined(UNICODE)
#ifndef wxUSE_UNICODE
#error "wxUSE_UNICODE must be defined before including this header."
#endif
#if wxUSE_UNICODE
#error "UNICODE must be defined before including this header."
#endif
#error "UNICODE must be defined before including this header."
#endif
/*
+1 -1
View File
@@ -17,7 +17,7 @@
// TD_WARNING_ICON being defined in the headers for this as this symbol is used
// by the task dialogs only. Also notice that task dialogs are available for
// Unicode applications only.
#if defined(TD_WARNING_ICON) && wxUSE_UNICODE
#if defined(TD_WARNING_ICON)
#define wxHAS_MSW_TASKDIALOG
#endif
+1 -5
View File
@@ -21,11 +21,7 @@ struct _EXCEPTION_POINTERS;
struct _SYMBOL_INFO;
struct _SYMBOL_INFOW;
#if wxUSE_UNICODE
#define wxSYMBOL_INFO _SYMBOL_INFOW
#else // !wxUSE_UNICODE
#define wxSYMBOL_INFO _SYMBOL_INFO
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
#define wxSYMBOL_INFO _SYMBOL_INFOW
// ----------------------------------------------------------------------------
// wxStackFrame
-9
View File
@@ -220,15 +220,6 @@ protected:
// the limit is due to a previous call to SetMaxLength() and not built in)
bool HasSpaceLimit(unsigned int *len) const;
#if wxUSE_RICHEDIT && !wxUSE_UNICODE
// replace the selection or the entire control contents with the given text
// in the specified encoding
bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly);
// get the contents of the control out as text in the given encoding
wxString StreamOut(wxFontEncoding encoding, bool selOnly = false) const;
#endif // wxUSE_RICHEDIT
// replace the contents of the selection or of the entire control with the
// given text
void DoWriteText(const wxString& text,
+1 -40
View File
@@ -176,48 +176,9 @@ public:
// Trivial default ctor.
wxUxThemeFont() { }
#if wxUSE_UNICODE
// In Unicode build we always use LOGFONT anyhow so this class is
// completely trivial.
// This class is now completely trivial and should be removed.
LPLOGFONTW GetPtr() { return &m_lfW; }
const LOGFONTW& GetLOGFONT() { return m_lfW; }
#else // !wxUSE_UNICODE
// Return either LOGFONTA or LOGFONTW pointer as required by the current
// Windows version.
LPLOGFONTW GetPtr()
{
return UseLOGFONTW() ? &m_lfW
: reinterpret_cast<LPLOGFONTW>(&m_lfA);
}
// This method returns LOGFONT (i.e. LOGFONTA in ANSI build and LOGFONTW in
// Unicode one) which can be used with other, normal, Windows or wx
// functions. Internally it may need to transform LOGFONTW to LOGFONTA.
const LOGFONTA& GetLOGFONT()
{
if ( UseLOGFONTW() )
{
// Most of the fields are the same in LOGFONTA and LOGFONTW so just
// copy everything by default.
memcpy(&m_lfA, &m_lfW, sizeof(m_lfA));
// But the face name must be converted from Unicode.
WideCharToMultiByte(CP_ACP, 0, m_lfW.lfFaceName, -1,
m_lfA.lfFaceName, sizeof(m_lfA.lfFaceName),
nullptr, nullptr);
}
return m_lfA;
}
private:
static bool UseLOGFONTW()
{
return wxGetWinVersion() >= wxWinVersion_Vista;
}
LOGFONTA m_lfA;
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
private:
LOGFONTW m_lfW;
+1 -1
View File
@@ -21,7 +21,7 @@
// Set Unicode format for a common control
inline void wxSetCCUnicodeFormat(HWND hwnd)
{
::SendMessage(hwnd, CCM_SETUNICODEFORMAT, wxUSE_UNICODE, 0);
::SendMessage(hwnd, CCM_SETUNICODEFORMAT, TRUE, 0);
}
#if wxUSE_GUI
+1 -2
View File
@@ -493,8 +493,7 @@
/*
check the consistency of the settings in setup.h: note that this must be
done after setting wxUSE_UNICODE correctly as it is used in wx/chkconf.h
and after defining the compiler macros which are used in it too
done after defining the compiler macros used in wx/chkconf.h
*/
#include "wx/chkconf.h"
-26
View File
@@ -428,7 +428,6 @@ bool wxPrintfConvSpec<CharType>::Parse(const CharType *format)
break;
case wxT('c'):
#if wxUSE_UNICODE
if (ilen == -1)
{
// %hc == ANSI character
@@ -439,23 +438,10 @@ bool wxPrintfConvSpec<CharType>::Parse(const CharType *format)
// %lc == %c == Unicode character
m_type = wxPAT_WCHAR;
}
#else
if (ilen == 1)
{
// %lc == Unicode character
m_type = wxPAT_WCHAR;
}
else
{
// %hc == %c == ANSI character
m_type = wxPAT_CHAR;
}
#endif
done = true;
break;
case wxT('s'):
#if wxUSE_UNICODE
if (ilen == -1)
{
// wx extension: we'll let %hs mean non-Unicode strings
@@ -466,18 +452,6 @@ bool wxPrintfConvSpec<CharType>::Parse(const CharType *format)
// %ls == %s == Unicode string
m_type = wxPAT_PWCHAR;
}
#else
if (ilen == 1)
{
// %ls == Unicode string
m_type = wxPAT_PWCHAR;
}
else
{
// %s == %hs == ANSI string
m_type = wxPAT_PCHAR;
}
#endif
done = true;
break;
-15
View File
@@ -32,13 +32,6 @@ class wxSymbolListCtrl;
class wxStdDialogButtonSizer;
////@end forward declarations
// __UNICODE__ is a symbol used by DialogBlocks-generated code.
#ifndef __UNICODE__
#if wxUSE_UNICODE
#define __UNICODE__
#endif
#endif
/*!
* Symbols
*/
@@ -110,19 +103,15 @@ public:
/// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FONT
void OnFontCtrlSelected( wxCommandEvent& event );
#if defined(__UNICODE__)
/// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_SUBSET
void OnSubsetSelected( wxCommandEvent& event );
/// wxEVT_UPDATE_UI event handler for ID_SYMBOLPICKERDIALOG_SUBSET
void OnSymbolpickerdialogSubsetUpdate( wxUpdateUIEvent& event );
#endif
#if defined(__UNICODE__)
/// wxEVT_COMBOBOX event handler for ID_SYMBOLPICKERDIALOG_FROM
void OnFromUnicodeSelected( wxCommandEvent& event );
#endif
/// wxEVT_UPDATE_UI event handler for wxID_OK
void OnOkUpdate( wxUpdateUIEvent& event );
@@ -157,15 +146,11 @@ public:
////@begin wxSymbolPickerDialog member variables
wxComboBox* m_fontCtrl;
#if defined(__UNICODE__)
wxComboBox* m_subsetCtrl;
#endif
wxSymbolListCtrl* m_symbolsCtrl;
wxStaticText* m_symbolStaticCtrl;
wxTextCtrl* m_characterCodeCtrl;
#if defined(__UNICODE__)
wxComboBox* m_fromUnicodeCtrl;
#endif
wxStdDialogButtonSizer* m_stdButtonSizer;
wxString m_fontName;
bool m_fromUnicode;
-2
View File
@@ -89,10 +89,8 @@ private:
// arbitrary 8 bit data
wxMBConv& m_conv;
#if wxUSE_UNICODE
// unconverted data from the last call to OnSysWrite()
wxMemoryBuffer m_unconv;
#endif // wxUSE_UNICODE
wxDECLARE_NO_COPY_CLASS(wxStringOutputStream);
};
-22
View File
@@ -16,8 +16,6 @@
//----------------------------------------------------------------------
// Utility functions used within wxSTC
#if wxUSE_UNICODE
extern wxString stc2wx(const char* str);
extern wxString stc2wx(const char* str, size_t len);
extern wxCharBuffer wx2stc(const wxString& str);
@@ -31,24 +29,4 @@ inline size_t wx2stclen(const wxString& WXUNUSED(str), const wxCharBuffer& buf)
return buf.length();
}
#else // not UNICODE
inline wxString stc2wx(const char* str) {
return wxString(str);
}
inline wxString stc2wx(const char* str, size_t len) {
return wxString(str, len);
}
inline const char* wx2stc(const wxString& str) {
return str.mbc_str();
}
// As explained above, the buffer argument is only used in Unicode build.
inline size_t wx2stclen(const wxString& str, const char* WXUNUSED(buf))
{
return str.length();
}
#endif // UNICODE
#endif // _WX_STC_PRIVATE_H_
+16 -31
View File
@@ -107,18 +107,11 @@ public:
wxCharBuffer
cWC2MB(const wchar_t *in, size_t inLen, size_t *outLen) const;
// convenience functions for converting MB or WC to/from wxWin default
#if wxUSE_UNICODE
// Obsolete convenience functions.
wxWCharBuffer cMB2WX(const char *psz) const { return cMB2WC(psz); }
wxCharBuffer cWX2MB(const wchar_t *psz) const { return cWC2MB(psz); }
const wchar_t* cWC2WX(const wchar_t *psz) const { return psz; }
const wchar_t* cWX2WC(const wchar_t *psz) const { return psz; }
#else // ANSI
const char* cMB2WX(const char *psz) const { return psz; }
const char* cWX2MB(const char *psz) const { return psz; }
wxCharBuffer cWC2WX(const wchar_t *psz) const { return cWC2MB(psz); }
wxWCharBuffer cWX2WC(const char *psz) const { return cMB2WC(psz); }
#endif // Unicode/ANSI
// return the maximum number of bytes that can be required to encode a
// single character in this encoding, e.g. 4 for UTF-8
@@ -677,7 +670,7 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
// ----------------------------------------------------------------------------
// filenames are multibyte on Unix and widechar on Windows
#if wxMBFILES && wxUSE_UNICODE
#if wxMBFILES
#define wxFNCONV(name) wxConvFileName->cWX2MB(name)
#define wxFNSTRINGCAST wxMBSTRINGCAST
#else
@@ -693,31 +686,23 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
// macros for the most common conversions
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
#define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s)
#define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s)
#define wxConvertWX2MB(s) wxConvCurrent->cWX2MB(s)
#define wxConvertMB2WX(s) wxConvCurrent->cMB2WX(s)
// these functions should be used when the conversions really, really have
// to succeed (usually because we pass their results to a standard C
// function which would crash if we passed nullptr to it), so these functions
// always return a valid pointer if their argument is non-null
// these functions should be used when the conversions really, really have
// to succeed (usually because we pass their results to a standard C
// function which would crash if we passed nullptr to it), so these functions
// always return a valid pointer if their argument is non-null
inline wxWCharBuffer wxSafeConvertMB2WX(const char *s)
{
return wxConvWhateverWorks.cMB2WC(s);
}
inline wxWCharBuffer wxSafeConvertMB2WX(const char *s)
{
return wxConvWhateverWorks.cMB2WC(s);
}
inline wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws)
{
return wxConvWhateverWorks.cWC2MB(ws);
}
#else // ANSI
// no conversions to do
#define wxConvertWX2MB(s) (s)
#define wxConvertMB2WX(s) (s)
#define wxSafeConvertMB2WX(s) (s)
#define wxSafeConvertWX2MB(s) (s)
#endif // Unicode/ANSI
inline wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws)
{
return wxConvWhateverWorks.cWC2MB(ws);
}
// Macro that indicates the default encoding for converting C strings
// to wxString. It provides a default value for a const wxMBConv&
+10 -113
View File
@@ -352,9 +352,8 @@ private:
const wxMBConv& conv);
#endif
#if !wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_WCHAR or !wxUSE_UNICODE
#if !wxUSE_UNICODE_UTF8 // wxUSE_UNICODE_WCHAR
// returns C string encoded as the implementation expects:
#if wxUSE_UNICODE
static const wchar_t* ImplStr(const wchar_t* str)
{ return str ? str : wxT(""); }
static const SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
@@ -365,20 +364,6 @@ private:
static SubstrBufFromMB ImplStr(const char* str, size_t n,
const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG)
{ return ConvertStr(str, n, conv); }
#else
static const char* ImplStr(const char* str,
const wxMBConv& WXUNUSED(conv) wxSTRING_DEFAULT_CONV_ARG)
{ return str ? str : ""; }
static const SubstrBufFromMB ImplStr(const char* str, size_t n,
const wxMBConv& WXUNUSED(conv) wxSTRING_DEFAULT_CONV_ARG)
{ return SubstrBufFromMB(str, (str && n == npos) ? wxStrlen(str) : n); }
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
static wxScopedCharBuffer ImplStr(const wchar_t* str)
{ return ConvertStr(str, npos, wxConvLibc).data; }
static SubstrBufFromWC ImplStr(const wchar_t* str, size_t n)
{ return ConvertStr(str, n, wxConvLibc); }
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
#endif
// translates position index in wxString to/from index in underlying
// wxStringImpl:
@@ -1246,13 +1231,8 @@ public:
#endif
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
#if !wxUSE_UNICODE // ANSI build
// FIXME-UTF8: do this in UTF8 build #if wxUSE_UTF8_LOCALE_ONLY, too
wxString(const std::string& str) : m_impl(str) {}
#else // Unicode
wxString(const std::string& str)
{ assign(str.c_str(), str.length()); }
#endif
wxString(const std::string& str)
{ assign(str.c_str(), str.length()); }
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
#endif // wxUSE_STD_STRING
@@ -1280,7 +1260,7 @@ public:
}
#endif
#if (!wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY) && wxUSE_STL_BASED_WXSTRING
#if wxUSE_UTF8_LOCALE_ONLY && wxUSE_STL_BASED_WXSTRING
// wxStringImpl is std::string in the encoding we want
#define wxStringToStdStringRetType const std::string&
const std::string& ToStdString() const { return m_impl; }
@@ -1597,16 +1577,8 @@ public:
template <typename T>
wxCharTypeBuffer<T> tchar_str(size_t *len = nullptr) const
{
#if wxUSE_UNICODE
// we need a helper dispatcher depending on type
return wxPrivate::wxStringAsBufHelper<T>::Get(*this, len);
#else // ANSI
// T can only be char in ANSI build
if ( len )
*len = length();
return wxCharTypeBuffer<T>::CreateNonOwned(wx_str(), length());
#endif // Unicode build kind
}
// conversion to/from plain (i.e. 7 bit) ASCII: this is useful for
@@ -1615,18 +1587,10 @@ public:
//
// the behaviour of these functions with the strings containing anything
// else than 7 bit ASCII characters is undefined, use at your own risk.
#if wxUSE_UNICODE
static wxString FromAscii(const char *ascii, size_t len);
static wxString FromAscii(const char *ascii);
static wxString FromAscii(char ascii);
const wxScopedCharBuffer ToAscii(char replaceWith = '_') const;
#else // ANSI
static wxString FromAscii(const char *ascii) { return wxString( ascii ); }
static wxString FromAscii(const char *ascii, size_t len)
{ return wxString( ascii, len ); }
static wxString FromAscii(char ascii) { return wxString( ascii ); }
const char *ToAscii(char WXUNUSED(replaceWith) = '_') const { return c_str(); }
#endif // Unicode/!Unicode
// also provide unsigned char overloads as signed/unsigned doesn't matter
// for 7 bit ASCII characters
@@ -1764,7 +1728,6 @@ public:
const wxScopedCharBuffer ToUTF8() const { return utf8_str(); }
// functions for storing binary data in wxString:
#if wxUSE_UNICODE
static wxString From8BitData(const char *data, size_t len)
{ return wxString(data, wxConvISO8859_1, len); }
// version for NUL-terminated data:
@@ -1772,15 +1735,6 @@ public:
{ return wxString(data, wxConvISO8859_1); }
const wxScopedCharBuffer To8BitData() const
{ return mb_str(wxConvISO8859_1); }
#else // ANSI
static wxString From8BitData(const char *data, size_t len)
{ return wxString(data, len); }
// version for NUL-terminated data:
static wxString From8BitData(const char *data)
{ return wxString(data); }
const wxScopedCharBuffer To8BitData() const
{ return wxScopedCharBuffer::CreateNonOwned(wx_str(), length()); }
#endif // Unicode/ANSI
// conversions with (possible) format conversions: have to return a
// buffer with temporary data
@@ -1792,8 +1746,6 @@ public:
// type differs because a function may either return pointer to the buffer
// directly or have to use intermediate buffer for translation.
#if wxUSE_UNICODE
// this is an optimization: even though using mb_str(wxConvLibc) does the
// same thing (i.e. returns pointer to internal representation as locale is
// always an UTF-8 one) in wxUSE_UTF8_LOCALE_ONLY case, we can avoid the
@@ -1820,7 +1772,7 @@ public:
const wxScopedWCharBuffer wc_str() const
{ return AsWCharBuf(wxMBConvStrictUTF8()); }
#endif
// for compatibility with !wxUSE_UNICODE version
// for compatibility only
const wxWX2WCbuf wc_str(const wxMBConv& WXUNUSED(conv)) const
{ return wc_str(); }
@@ -1830,23 +1782,6 @@ public:
const wxWX2WCbuf fn_str() const { return wc_str(); }
#endif // wxMBFILES/!wxMBFILES
#else // ANSI
const char* mb_str() const { return wx_str(); }
// for compatibility with wxUSE_UNICODE version
const char* mb_str(const wxMBConv& WXUNUSED(conv)) const { return wx_str(); }
const wxWX2MBbuf mbc_str() const { return mb_str(); }
const wxScopedWCharBuffer wc_str(const wxMBConv& conv wxSTRING_DEFAULT_CONV_ARG) const
{ return AsWCharBuf(conv); }
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
const wxScopedCharBuffer fn_str() const
{ return wxConvFile.cWC2WX( wc_str( wxConvLibc ) ); }
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
#endif // Unicode/ANSI
#if wxUSE_UNICODE_UTF8
const wxScopedWCharBuffer t_str() const { return wc_str(); }
#elif wxUSE_UNICODE_WCHAR
@@ -3253,11 +3188,7 @@ public:
// as strpbrk() but starts at nStart, returns npos if not found
size_t find_first_of(const wxString& str, size_t nStart = 0) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_first_of(str.wc_str(), nStart); }
#else
{ return find_first_of(str.mb_str(), nStart); }
#endif
// same as above
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
size_t find_first_of(const char* sz, size_t nStart = 0) const;
@@ -3272,11 +3203,7 @@ public:
{ return find(c, nStart); }
// find the last (starting from nStart) char from str in this string
size_t find_last_of (const wxString& str, size_t nStart = npos) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_last_of(str.wc_str(), nStart); }
#else
{ return find_last_of(str.mb_str(), nStart); }
#endif
// same as above
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
size_t find_last_of (const char* sz, size_t nStart = npos) const;
@@ -3294,11 +3221,7 @@ public:
// as strspn() (starting from nStart), returns npos on failure
size_t find_first_not_of(const wxString& str, size_t nStart = 0) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_first_not_of(str.wc_str(), nStart); }
#else
{ return find_first_not_of(str.mb_str(), nStart); }
#endif
// same as above
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
size_t find_first_not_of(const char* sz, size_t nStart = 0) const;
@@ -3312,11 +3235,7 @@ public:
size_t find_first_not_of(wxUniChar ch, size_t nStart = 0) const;
// as strcspn()
size_t find_last_not_of(const wxString& str, size_t nStart = npos) const
#if wxUSE_UNICODE // FIXME-UTF8: temporary
{ return find_last_not_of(str.wc_str(), nStart); }
#else
{ return find_last_not_of(str.mb_str(), nStart); }
#endif
// same as above
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
size_t find_last_not_of(const char* sz, size_t nStart = npos) const;
@@ -3587,7 +3506,6 @@ private:
};
#if wxUSE_UNICODE
// common mb_str() and wxCStrData::AsChar() helper: performs the conversion
// and returns either m_convertedToChar.m_str (in which case its m_len is
// also updated) or nullptr if it failed
@@ -3635,7 +3553,6 @@ private:
}
ConvertedBuffer<char> m_convertedToChar;
#endif // !wxUSE_UNICODE
#if !wxUSE_UNICODE_WCHAR
// common wc_str() and wxCStrData::AsWChar() helper for both UTF-8 and ANSI
@@ -4212,13 +4129,13 @@ WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedCharBuf
#endif // wxNO_IMPLICIT_WXSTRING_ENCODING
WXDLLIMPEXP_BASE wxSTD ostream& operator<<(wxSTD ostream&, const wxScopedWCharBuffer&);
#if wxUSE_UNICODE && defined(HAVE_WOSTREAM)
#if defined(HAVE_WOSTREAM)
WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxString&);
WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxCStrData&);
WXDLLIMPEXP_BASE wxSTD wostream& operator<<(wxSTD wostream&, const wxScopedWCharBuffer&);
#endif // wxUSE_UNICODE && defined(HAVE_WOSTREAM)
#endif // defined(HAVE_WOSTREAM)
#endif // wxUSE_STD_IOSTREAM
@@ -4259,39 +4176,19 @@ inline const wchar_t* wxCStrData::AsWChar() const
m_str->AsWChar(wxConvLibc);
#endif
// in Unicode build the string always has a valid Unicode representation
// and even if a conversion is needed (as in UTF8 case) it can't fail
//
// but in ANSI build the string contents might be not convertible to
// Unicode using the current locale encoding so we do need to check for
// errors
#if !wxUSE_UNICODE
if ( !p )
{
// if conversion fails, return empty string and not nullptr to avoid
// crashes in code written with either wxWidgets 2 wxString or
// std::string behaviour in mind: neither of them ever returns nullptr
// from its c_str() and so we shouldn't either
//
// notice that the same is done in AsChar() below and
// wxString::wc_str() and mb_str() for the same reasons
return L"";
}
#endif // !wxUSE_UNICODE
return p + m_offset;
}
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
inline const char* wxCStrData::AsChar() const
{
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
#if !wxUSE_UTF8_LOCALE_ONLY
const char * const p = m_str->AsChar(wxConvLibc);
if ( !p )
return "";
#else // !wxUSE_UNICODE || wxUSE_UTF8_LOCALE_ONLY
#else // wxUSE_UTF8_LOCALE_ONLY
const char * const p = m_str->mb_str();
#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
#endif
return p + m_offset;
}
+2 -3
View File
@@ -22,8 +22,7 @@
// one for UTF-8 encoded char* string and one for "raw" wchar_t* strings (or
// char* in ANSI build).
// FIXME-UTF8: only wchar after we remove ANSI build
#if wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE
#if wxUSE_UNICODE_WCHAR
struct WXDLLIMPEXP_BASE wxStringOperationsWchar
{
// moves the iterator to the next Unicode character
@@ -80,7 +79,7 @@ struct WXDLLIMPEXP_BASE wxStringOperationsWchar
static wxUniChar DecodeChar(const wxStringImpl::const_iterator& i)
{ return *i; }
};
#endif // wxUSE_UNICODE_WCHAR || !wxUSE_UNICODE
#endif // wxUSE_UNICODE_WCHAR
#if wxUSE_UNICODE_UTF8
+3 -12
View File
@@ -214,7 +214,7 @@ private:
wxScopedCharBuffer m_convertedChar;
#endif // !wxUSE_UNICODE_WCHAR && !defined wx_NO_IMPLICIT_WXSTRING_ENCODING
#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
#if !wxUSE_UTF8_LOCALE_ONLY
public:
operator const wchar_t*() const
{ return const_cast<wxFormatString*>(this)->AsWChar(); }
@@ -222,7 +222,7 @@ private:
const wchar_t* InputAsWChar();
const wchar_t* AsWChar();
wxScopedWCharBuffer m_convertedWChar;
#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
#endif // !wxUSE_UTF8_LOCALE_ONLY
private:
wxScopedCharBuffer m_char;
@@ -398,12 +398,6 @@ wxFORMAT_STRING_SPECIFIER(long double, wxFormatString::Arg_LongDouble)
wxFORMAT_STRING_SPECIFIER(wchar_t, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
#endif
#if !wxUSE_UNICODE && !defined wxNO_IMPLICIT_WXSTRING_ENCODING
wxFORMAT_STRING_SPECIFIER(char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(signed char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
wxFORMAT_STRING_SPECIFIER(unsigned char, wxFormatString::Arg_Char | wxFormatString::Arg_Int)
#endif
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxFORMAT_STRING_SPECIFIER(char*, wxFormatString::Arg_String)
wxFORMAT_STRING_SPECIFIER(unsigned char*, wxFormatString::Arg_String)
@@ -849,12 +843,11 @@ struct wxArgNormalizer<const wxUniChar&> : public wxArgNormalizer<wchar_t>
// for wchar_t, default handler does the right thing
// char has to be treated differently in Unicode builds: a char argument may
// char has to be treated differently: a char argument may
// be used either for a character value (which should be converted into
// wxUniChar) or as an integer value (which should be left as-is). We take
// advantage of the fact that both char and wchar_t are converted into int
// in variadic arguments here.
#if wxUSE_UNICODE
template<typename T>
struct wxArgNormalizerNarrowChar
{
@@ -903,8 +896,6 @@ struct wxArgNormalizer<signed char>
: wxArgNormalizerNarrowChar<signed char>(value, fmt, index) {}
};
#endif // wxUSE_UNICODE
// convert references:
WX_ARG_NORMALIZER_FORWARD(wxUniChar, const wxUniChar&);
WX_ARG_NORMALIZER_FORWARD(const wxUniCharRef&, const wxUniChar&);
+1 -17
View File
@@ -86,9 +86,7 @@ class WXDLLIMPEXP_BASE wxMsgCatalog
public:
// Ctor is protected, because CreateFromXXX functions must be used,
// but destruction should be unrestricted
#if !wxUSE_UNICODE
~wxMsgCatalog();
#endif
~wxMsgCatalog() = default;
// load the catalog from disk or from data; caller is responsible for
// deleting them if not null
@@ -107,9 +105,6 @@ public:
protected:
wxMsgCatalog(const wxString& domain)
: m_pNext(nullptr), m_domain(domain)
#if !wxUSE_UNICODE
, m_conv(nullptr)
#endif
{}
private:
@@ -120,12 +115,6 @@ private:
wxStringToStringHashMap m_messages; // all messages in the catalog
wxString m_domain; // name of the domain
#if !wxUSE_UNICODE
// the conversion corresponding to this catalog charset if we installed it
// as the global one
wxCSConv *m_conv;
#endif
wxPluralFormsCalculatorPtr m_pluralFormsCalculator;
};
@@ -166,11 +155,6 @@ public:
// wxTranslationsLoader
bool AddCatalog(const wxString& domain,
wxLanguage msgIdLanguage = wxLANGUAGE_ENGLISH_US);
#if !wxUSE_UNICODE
bool AddCatalog(const wxString& domain,
wxLanguage msgIdLanguage,
const wxString& msgIdCharset);
#endif
// check if the given catalog is loaded
bool IsLoaded(const wxString& domain) const;
+4 -16
View File
@@ -36,13 +36,9 @@ WXDLLIMPEXP_BASE wxTextOutputStream &endl( wxTextOutputStream &stream );
class WXDLLIMPEXP_BASE wxTextInputStream
{
public:
#if wxUSE_UNICODE
wxTextInputStream(wxInputStream& s,
const wxString &sep=wxT(" \t"),
const wxMBConv& conv = wxConvAuto());
#else
wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t"));
#endif
~wxTextInputStream();
const wxInputStream& GetInputStream() const { return m_input; }
@@ -67,9 +63,9 @@ public:
// Operators
wxTextInputStream& operator>>(wxString& word);
wxTextInputStream& operator>>(char& c);
#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE
#if wxWCHAR_T_IS_REAL_TYPE
wxTextInputStream& operator>>(wchar_t& wc);
#endif // wxUSE_UNICODE
#endif
wxTextInputStream& operator>>(wxInt16& i);
wxTextInputStream& operator>>(wxInt32& i);
wxTextInputStream& operator>>(wxInt64& i);
@@ -101,7 +97,6 @@ protected:
size_t m_validBegin,
m_validEnd;
#if wxUSE_UNICODE
wxMBConv *m_conv;
// The second half of a surrogate character when using UTF-16 for wchar_t:
@@ -112,7 +107,6 @@ protected:
#if SIZEOF_WCHAR_T == 2
wchar_t m_lastWChar;
#endif // SIZEOF_WCHAR_T == 2
#endif // wxUSE_UNICODE
bool EatEOL(const wxChar &c);
void UngetLast(); // should be used instead of wxInputStream::Ungetch() because of Unicode issues
@@ -132,13 +126,9 @@ enum wxEOL
class WXDLLIMPEXP_BASE wxTextOutputStream
{
public:
#if wxUSE_UNICODE
wxTextOutputStream(wxOutputStream& s,
wxEOL mode = wxEOL_NATIVE,
const wxMBConv& conv = wxConvAuto());
#else
wxTextOutputStream(wxOutputStream& s, wxEOL mode = wxEOL_NATIVE);
#endif
virtual ~wxTextOutputStream();
const wxOutputStream& GetOutputStream() const { return m_output; }
@@ -168,9 +158,9 @@ public:
wxTextOutputStream& operator<<(const wxString& string);
wxTextOutputStream& operator<<(char c);
#if wxUSE_UNICODE && wxWCHAR_T_IS_REAL_TYPE
#if wxWCHAR_T_IS_REAL_TYPE
wxTextOutputStream& operator<<(wchar_t wc);
#endif // wxUSE_UNICODE
#endif
wxTextOutputStream& operator<<(wxInt16 c);
wxTextOutputStream& operator<<(wxInt32 c);
wxTextOutputStream& operator<<(wxInt64 c);
@@ -186,7 +176,6 @@ protected:
wxOutputStream &m_output;
wxEOL m_mode;
#if wxUSE_UNICODE
wxMBConv *m_conv;
#if SIZEOF_WCHAR_T == 2
@@ -194,7 +183,6 @@ protected:
// and couldn't be output when it was called the last time.
wchar_t m_lastWChar;
#endif // SIZEOF_WCHAR_T == 2
#endif // wxUSE_UNICODE
wxDECLARE_NO_COPY_CLASS(wxTextOutputStream);
};
-10
View File
@@ -72,7 +72,6 @@ public:
// must be non-null)
bool GetAsChar(char *c) const
{
#if wxUSE_UNICODE
if ( !IsAscii() )
{
#if !wxUSE_UTF8_LOCALE_ONLY
@@ -82,7 +81,6 @@ public:
return false;
}
#endif // wxUSE_UNICODE
*c = wx_truncate_cast(char, m_value);
return true;
@@ -181,26 +179,18 @@ private:
// characters purely for performance reasons
static value_type From8bit(char c)
{
#if wxUSE_UNICODE
if ( (unsigned char)c < 0x80 )
return c;
return FromHi8bit(c);
#else
return c;
#endif
}
static char To8bit(value_type c)
{
#if wxUSE_UNICODE
if ( c < 0x80 )
return wx_truncate_cast(char, c);
return ToHi8bit(c);
#else
return wx_truncate_cast(char, c);
#endif
}
// helpers of the functions above called to deal with non-ASCII chars
-2
View File
@@ -389,12 +389,10 @@ WXDLLIMPEXP_BASE long wxExecute(const char* const* argv,
int flags = wxEXEC_ASYNC,
wxProcess *process = nullptr,
const wxExecuteEnv *env = nullptr);
#if wxUSE_UNICODE
WXDLLIMPEXP_BASE long wxExecute(const wchar_t* const* argv,
int flags = wxEXEC_ASYNC,
wxProcess *process = nullptr,
const wxExecuteEnv *env = nullptr);
#endif // wxUSE_UNICODE
// execute the command capturing its output into an array line by line, this is
// always synchronous
+36 -48
View File
@@ -42,17 +42,11 @@ inline bool wxIsEmpty(const wxCStrData& s) { return s.AsString().empty(); }
WXDLLIMPEXP_BASE size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n);
WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n);
#if wxUSE_UNICODE
#define wxMB2WX wxMB2WC
#define wxWX2MB wxWC2MB
#define wxWC2WX wxStrncpy
#define wxWX2WC wxStrncpy
#else
#define wxMB2WX wxStrncpy
#define wxWX2MB wxStrncpy
#define wxWC2WX wxWC2MB
#define wxWX2WC wxMB2WC
#endif
// Obsolete helpers.
#define wxMB2WX wxMB2WC
#define wxWX2MB wxWC2MB
#define wxWC2WX wxStrncpy
#define wxWX2WC wxStrncpy
// RN: We could do the usual tricky compiler detection here,
@@ -64,47 +58,45 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n);
//
#include <string.h>
#if wxUSE_UNICODE
//implement our own wmem variants
inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l)
{
for(;l && *s != c;--l, ++s) {}
//implement our own wmem variants
inline wxChar* wxTmemchr(const wxChar* s, wxChar c, size_t l)
{
for(;l && *s != c;--l, ++s) {}
if(l)
return const_cast<wxChar*>(s);
return nullptr;
}
if(l)
return const_cast<wxChar*>(s);
return nullptr;
}
inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len)
{
for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {}
inline int wxTmemcmp(const wxChar* sz1, const wxChar* sz2, size_t len)
{
for(; *sz1 == *sz2 && len; --len, ++sz1, ++sz2) {}
if(len)
return *sz1 < *sz2 ? -1 : *sz1 > *sz2;
else
return 0;
}
if(len)
return *sz1 < *sz2 ? -1 : *sz1 > *sz2;
else
return 0;
}
inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len)
{
return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar));
}
inline wxChar* wxTmemcpy(wxChar* szOut, const wxChar* szIn, size_t len)
{
return (wxChar*) memcpy(szOut, szIn, len * sizeof(wxChar));
}
inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len)
{
return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar));
}
inline wxChar* wxTmemmove(wxChar* szOut, const wxChar* szIn, size_t len)
{
return (wxChar*) memmove(szOut, szIn, len * sizeof(wxChar));
}
inline wxChar* wxTmemset(wxChar* szOut, wxChar cIn, size_t len)
{
wxChar* szRet = szOut;
inline wxChar* wxTmemset(wxChar* szOut, wxChar cIn, size_t len)
{
wxChar* szRet = szOut;
while (len--)
*szOut++ = cIn;
while (len--)
*szOut++ = cIn;
return szRet;
}
#endif /* wxUSE_UNICODE */
return szRet;
}
// provide trivial wrappers for char* versions for both ANSI and Unicode builds
// (notice that these intentionally return "char *" and not "void *" unlike the
@@ -556,15 +548,11 @@ WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String)
template<typename T>
inline int wxStrcoll_String(const wxString& s1, const T& s2)
{
#if wxUSE_UNICODE
// NB: strcoll() doesn't work correctly on UTF-8 strings, so we have to use
// wc_str() even if wxUSE_UNICODE_UTF8; the (const wchar_t*) cast is
// there just as optimization to avoid going through
// wxStrcoll<wxScopedWCharBuffer>:
return wxStrcoll((const wchar_t*)s1.wc_str(), s2);
#else
return wxStrcoll((const char*)s1.mb_str(), s2);
#endif
}
#endif // defined(wxCRT_Strcoll[AW])
+6 -13
View File
@@ -270,18 +270,11 @@ WXDLLIMPEXP_BASE int wxCRT_StrncmpW(const wchar_t *s1, const wchar_t *s2, size_t
}
#endif
/* FIXME-UTF8: remove this once we are Unicode only */
#if wxUSE_UNICODE
#define wxCRT_StrlenNative wxCRT_StrlenW
#define wxCRT_StrncmpNative wxCRT_StrncmpW
#define wxCRT_ToupperNative wxCRT_ToupperW
#define wxCRT_TolowerNative wxCRT_TolowerW
#else
#define wxCRT_StrlenNative wxCRT_StrlenA
#define wxCRT_StrncmpNative wxCRT_StrncmpA
#define wxCRT_ToupperNative toupper
#define wxCRT_TolowerNative tolower
#endif
/* FIXME-UTF8: remove this */
#define wxCRT_StrlenNative wxCRT_StrlenW
#define wxCRT_StrncmpNative wxCRT_StrncmpW
#define wxCRT_ToupperNative wxCRT_ToupperW
#define wxCRT_TolowerNative wxCRT_TolowerW
#ifndef wxCRT_StrcatW
WXDLLIMPEXP_BASE wchar_t *wxCRT_StrcatW(wchar_t *dest, const wchar_t *src);
@@ -413,7 +406,7 @@ WXDLLIMPEXP_BASE wchar_t *wxCRT_StrtokW(wchar_t *psz, const wchar_t *delim, wcha
/* these functions are only needed in the form used for filenames (i.e. char*
on Unix, wchar_t* on Windows), so we don't need to use A/W suffix: */
#if wxMBFILES || !wxUSE_UNICODE /* ANSI filenames */
#if wxMBFILES /* ANSI filenames */
#define wxCRT_Fopen fopen
#define wxCRT_Freopen freopen
+4 -16
View File
@@ -146,9 +146,7 @@
// for wxString code, define wxUSE_WXVSNPRINTF to indicate that wx
// implementation is used no matter what (in UTF-8 build, either *A or *W
// version may be called):
#if !wxUSE_UNICODE
#define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
#elif wxUSE_UNICODE_WCHAR
#if wxUSE_UNICODE_WCHAR
#define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFW
#elif wxUSE_UTF8_LOCALE_ONLY
#define wxUSE_WXVSNPRINTF wxUSE_WXVSNPRINTFA
@@ -238,15 +236,9 @@
// user-friendly wrappers to CRT functions
// ----------------------------------------------------------------------------
// FIXME-UTF8: remove this
#if wxUSE_UNICODE
#define wxCRT_PrintfNative wxCRT_PrintfW
#define wxCRT_FprintfNative wxCRT_FprintfW
#else
#define wxCRT_PrintfNative wxCRT_PrintfA
#define wxCRT_FprintfNative wxCRT_FprintfA
#endif
// FIXME-UTF8: remove this
#define wxCRT_PrintfNative wxCRT_PrintfW
#define wxCRT_FprintfNative wxCRT_FprintfW
wxGCC_ONLY_WARNING_SUPPRESS(format-nonliteral)
@@ -330,8 +322,6 @@ WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (char*, size_t, const wxFormatString&)
int WXDLLIMPEXP_BASE
wxVsnprintf(char *str, size_t size, const wxString& format, va_list argptr);
#if wxUSE_UNICODE
#if !wxUSE_UTF8_LOCALE_ONLY
int WXDLLIMPEXP_BASE wxDoSprintfWchar(wchar_t *str, const wxChar *format, ...);
#endif
@@ -356,8 +346,6 @@ WX_DEFINE_VARARG_FUNC(int, wxSnprintf, 3, (wchar_t*, size_t, const wxFormatStrin
int WXDLLIMPEXP_BASE
wxVsnprintf(wchar_t *str, size_t size, const wxString& format, va_list argptr);
#endif // wxUSE_UNICODE
// We can't use wxArgNormalizer<T> for variadic arguments to wxScanf() etc.
// because they are writable, so instead of providing friendly template
// vararg-like functions, we just provide both char* and wchar_t* variants
-2
View File
@@ -71,12 +71,10 @@ public:
const wxSize& GetInitialSize() const { return m_initialSize; }
bool GetShowIconic() const { return m_showIconic; }
#if wxUSE_UNICODE
// Global context for Pango layout. Either use X11
// or use Xft rendering according to GDK_USE_XFT
// environment variable
PangoContext* GetPangoContext();
#endif
wxXVisualInfo* GetVisualInfo(WXDisplay* WXUNUSED(display))
{
-2
View File
@@ -134,10 +134,8 @@ protected:
wxRegion m_currentClippingRegion;
wxRegion m_paintClippingRegion;
#if wxUSE_UNICODE
PangoContext *m_context;
PangoFontDescription *m_fontdesc;
#endif
void SetUpDC();
void Destroy();
+2 -7
View File
@@ -39,13 +39,8 @@ class WXDLLIMPEXP_FWD_CORE wxWindow;
// Some Unicode <-> UTF8 macros stolen from GTK
// ----------------------------------------------------------------------------
#if wxUSE_UNICODE
#define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s)
#define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s)
#else
#define wxGTK_CONV(s) s.c_str()
#define wxGTK_CONV_BACK(s) s
#endif
#define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s)
#define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s)
// ----------------------------------------------------------------------------
// we maintain a hash table which contains the mapping from Widget to wxWindow
+52 -65
View File
@@ -48,10 +48,7 @@
#include <locale.h>
#include <ctype.h>
#include <stdlib.h>
#if wxUSE_UNICODE
#include <wctype.h>
#endif
#include <wctype.h>
// Locale type and identifier name
typedef locale_t wxXLocale_t;
@@ -250,71 +247,61 @@ extern WXDLLIMPEXP_DATA_BASE(wxXLocale) wxNullXLocale;
inline unsigned long wxStrtoul_lA(const char *c, char **endptr, int base, const wxXLocale& loc)
{ return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); }
#if wxUSE_UNICODE
// ctype functions
#define wxCRT_Isalnum_lW wxXLOCALE_IDENT(iswalnum_l)
#define wxCRT_Isalpha_lW wxXLOCALE_IDENT(iswalpha_l)
#define wxCRT_Iscntrl_lW wxXLOCALE_IDENT(iswcntrl_l)
#define wxCRT_Isdigit_lW wxXLOCALE_IDENT(iswdigit_l)
#define wxCRT_Isgraph_lW wxXLOCALE_IDENT(iswgraph_l)
#define wxCRT_Islower_lW wxXLOCALE_IDENT(iswlower_l)
#define wxCRT_Isprint_lW wxXLOCALE_IDENT(iswprint_l)
#define wxCRT_Ispunct_lW wxXLOCALE_IDENT(iswpunct_l)
#define wxCRT_Isspace_lW wxXLOCALE_IDENT(iswspace_l)
#define wxCRT_Isupper_lW wxXLOCALE_IDENT(iswupper_l)
#define wxCRT_Isxdigit_lW wxXLOCALE_IDENT(iswxdigit_l)
#define wxCRT_Tolower_lW wxXLOCALE_IDENT(towlower_l)
#define wxCRT_Toupper_lW wxXLOCALE_IDENT(towupper_l)
// ctype functions
#define wxCRT_Isalnum_lW wxXLOCALE_IDENT(iswalnum_l)
#define wxCRT_Isalpha_lW wxXLOCALE_IDENT(iswalpha_l)
#define wxCRT_Iscntrl_lW wxXLOCALE_IDENT(iswcntrl_l)
#define wxCRT_Isdigit_lW wxXLOCALE_IDENT(iswdigit_l)
#define wxCRT_Isgraph_lW wxXLOCALE_IDENT(iswgraph_l)
#define wxCRT_Islower_lW wxXLOCALE_IDENT(iswlower_l)
#define wxCRT_Isprint_lW wxXLOCALE_IDENT(iswprint_l)
#define wxCRT_Ispunct_lW wxXLOCALE_IDENT(iswpunct_l)
#define wxCRT_Isspace_lW wxXLOCALE_IDENT(iswspace_l)
#define wxCRT_Isupper_lW wxXLOCALE_IDENT(iswupper_l)
#define wxCRT_Isxdigit_lW wxXLOCALE_IDENT(iswxdigit_l)
#define wxCRT_Tolower_lW wxXLOCALE_IDENT(towlower_l)
#define wxCRT_Toupper_lW wxXLOCALE_IDENT(towupper_l)
inline int wxIsalnum_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isalnum_lW(c, loc.Get()); }
inline int wxIsalpha_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isalpha_lW(c, loc.Get()); }
inline int wxIscntrl_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Iscntrl_lW(c, loc.Get()); }
inline int wxIsdigit_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isdigit_lW(c, loc.Get()); }
inline int wxIsgraph_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isgraph_lW(c, loc.Get()); }
inline int wxIslower_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Islower_lW(c, loc.Get()); }
inline int wxIsprint_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isprint_lW(c, loc.Get()); }
inline int wxIspunct_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Ispunct_lW(c, loc.Get()); }
inline int wxIsspace_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isspace_lW(c, loc.Get()); }
inline int wxIsupper_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isupper_lW(c, loc.Get()); }
inline int wxIsxdigit_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isxdigit_lW(c, loc.Get()); }
inline wchar_t wxTolower_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Tolower_lW(c, loc.Get()); }
inline wchar_t wxToupper_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Toupper_lW(c, loc.Get()); }
inline int wxIsalnum_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isalnum_lW(c, loc.Get()); }
inline int wxIsalpha_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isalpha_lW(c, loc.Get()); }
inline int wxIscntrl_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Iscntrl_lW(c, loc.Get()); }
inline int wxIsdigit_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isdigit_lW(c, loc.Get()); }
inline int wxIsgraph_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isgraph_lW(c, loc.Get()); }
inline int wxIslower_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Islower_lW(c, loc.Get()); }
inline int wxIsprint_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isprint_lW(c, loc.Get()); }
inline int wxIspunct_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Ispunct_lW(c, loc.Get()); }
inline int wxIsspace_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isspace_lW(c, loc.Get()); }
inline int wxIsupper_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isupper_lW(c, loc.Get()); }
inline int wxIsxdigit_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Isxdigit_lW(c, loc.Get()); }
inline wchar_t wxTolower_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Tolower_lW(c, loc.Get()); }
inline wchar_t wxToupper_l(wchar_t c, const wxXLocale& loc)
{ return wxCRT_Toupper_lW(c, loc.Get()); }
// stdlib functions for numeric <-> string conversion
// (see notes above about missing functions)
#define wxCRT_Strtod_lW wxXLOCALE_IDENT(wcstod_l)
#define wxCRT_Strtol_lW wxXLOCALE_IDENT(wcstol_l)
#define wxCRT_Strtoul_lW wxXLOCALE_IDENT(wcstoul_l)
// stdlib functions for numeric <-> string conversion
// (see notes above about missing functions)
#define wxCRT_Strtod_lW wxXLOCALE_IDENT(wcstod_l)
#define wxCRT_Strtol_lW wxXLOCALE_IDENT(wcstol_l)
#define wxCRT_Strtoul_lW wxXLOCALE_IDENT(wcstoul_l)
inline double wxStrtod_l(const wchar_t *c, wchar_t **endptr, const wxXLocale& loc)
{ return wxCRT_Strtod_lW(c, endptr, loc.Get()); }
inline long wxStrtol_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc)
{ return wxCRT_Strtol_lW(c, endptr, base, loc.Get()); }
inline unsigned long wxStrtoul_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc)
{ return wxCRT_Strtoul_lW(c, endptr, base, loc.Get()); }
#else // !wxUSE_UNICODE
inline double wxStrtod_l(const char *c, char **endptr, const wxXLocale& loc)
{ return wxCRT_Strtod_lA(c, endptr, loc.Get()); }
inline long wxStrtol_l(const char *c, char **endptr, int base, const wxXLocale& loc)
{ return wxCRT_Strtol_lA(c, endptr, base, loc.Get()); }
inline unsigned long wxStrtoul_l(const char *c, char **endptr, int base, const wxXLocale& loc)
{ return wxCRT_Strtoul_lA(c, endptr, base, loc.Get()); }
#endif // wxUSE_UNICODE
inline double wxStrtod_l(const wchar_t *c, wchar_t **endptr, const wxXLocale& loc)
{ return wxCRT_Strtod_lW(c, endptr, loc.Get()); }
inline long wxStrtol_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc)
{ return wxCRT_Strtol_lW(c, endptr, base, loc.Get()); }
inline unsigned long wxStrtoul_l(const wchar_t *c, wchar_t **endptr, int base, const wxXLocale& loc)
{ return wxCRT_Strtoul_lW(c, endptr, base, loc.Get()); }
#else // !wxHAS_XLOCALE_SUPPORT
// ctype functions
int WXDLLIMPEXP_BASE wxIsalnum_l(const wxUniChar& c, const wxXLocale& loc);
-14
View File
@@ -88,9 +88,6 @@ private:
// are irrelevant) and wxXML_ELEMENT_NODE (e.g. in <title>hi</title> there is
// element with name="title", irrelevant content and one child (wxXML_TEXT_NODE
// with content="hi").
//
// If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load
// (default is UTF-8).
class WXDLLIMPEXP_XML wxXmlNode
{
@@ -280,22 +277,11 @@ public:
void SetFileType(wxTextFileType fileType);
void AppendToProlog(wxXmlNode *node);
#if !wxUSE_UNICODE
// Returns encoding of in-memory representation of the document
// (same as passed to Load or ctor, defaults to UTF-8).
// NB: this is meaningless in Unicode build where data are stored as wchar_t*
wxString GetEncoding() const { return m_encoding; }
void SetEncoding(const wxString& enc) { m_encoding = enc; }
#endif
static wxVersionInfo GetLibraryVersionInfo();
private:
wxString m_version;
wxString m_fileEncoding;
#if !wxUSE_UNICODE
wxString m_encoding;
#endif
wxXmlDoctype m_doctype;
wxXmlNode *m_docNode;
wxTextFileType m_fileType;
+1 -1
View File
@@ -314,7 +314,7 @@ public:
{
Register();
}
#if 0 // wxUSE_UNICODE
#if 0
wxTypeInfo(wxTypeKind kind,
wxVariant2StringFnc to, wxString2VariantFnc from,
const char *name):

Some files were not shown because too many files have changed in this diff Show More