Remove wxUSE_WCHAR_T checks.

wxWidgets requires wchar_t for some time now; wx/chartype.h has a check
to fail complation without it. Simplify code by removing now-dead code
for the !wxUSE_WCHAR_T case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2010-04-16 10:43:18 +00:00
parent 605ff820f5
commit 8d94819c43
28 changed files with 80 additions and 278 deletions

View File

@@ -359,7 +359,6 @@ public:
wxCharBuffer(const wxCStrData& cstr);
};
#if wxUSE_WCHAR_T
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxScopedCharTypeBuffer<wchar_t> )
WXDLLIMPEXP_TEMPLATE_INSTANCE_BASE( wxCharTypeBuffer<wchar_t> )
@@ -379,7 +378,6 @@ public:
wxWCharBuffer(const wxCStrData& cstr);
};
#endif // wxUSE_WCHAR_T
// wxCharTypeBuffer<T> implicitly convertible to T*
template <typename T>

View File

@@ -59,37 +59,35 @@
#endif
#endif
#if wxUSE_WCHAR_T
#ifdef HAVE_WCHAR_H
/* the current (as of Nov 2002) version of cygwin has a bug in its */
/* wchar.h -- there is no extern "C" around the declarations in it */
/* and this results in linking errors later; also, at least on some */
/* Cygwin versions, wchar.h requires sys/types.h */
#ifdef __CYGWIN__
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* Cygwin */
#ifdef HAVE_WCHAR_H
/* the current (as of Nov 2002) version of cygwin has a bug in its */
/* wchar.h -- there is no extern "C" around the declarations in it */
/* and this results in linking errors later; also, at least on some */
/* Cygwin versions, wchar.h requires sys/types.h */
#ifdef __CYGWIN__
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#endif /* Cygwin */
#include <wchar.h>
#include <wchar.h>
#if defined(__CYGWIN__) && defined(__cplusplus)
}
#endif /* Cygwin and C++ */
#if defined(__CYGWIN__) && defined(__cplusplus)
}
#endif /* Cygwin and C++ */
#elif defined(HAVE_WCSTR_H)
/* old compilers have relevant declarations here */
#include <wcstr.h>
#elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
/* include stdlib.h for wchar_t */
#include <stdlib.h>
#endif /* HAVE_WCHAR_H */
#elif defined(HAVE_WCSTR_H)
/* old compilers have relevant declarations here */
#include <wcstr.h>
#elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
/* include stdlib.h for wchar_t */
#include <stdlib.h>
#endif /* HAVE_WCHAR_H */
#ifdef HAVE_WIDEC_H
#include <widec.h>
#endif
#endif /* wxUSE_WCHAR_T */
#ifdef HAVE_WIDEC_H
#include <widec.h>
#endif
/* -------------------------------------------------------------------------- */
/* define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type */

View File

@@ -1313,15 +1313,6 @@
# endif
#endif /* wxUSE_TEXTFILE */
#if wxUSE_XML && !wxUSE_WCHAR_T
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_XML requires wxUSE_WCHAR_T"
# else
# undef wxUSE_XML
# define wxUSE_XML 0
# endif
#endif /* wxUSE_XML */
#if !wxUSE_DYNLIB_CLASS
# if wxUSE_DYNAMIC_LOADER
# ifdef wxABORT_ON_CONFIG_ERROR

View File

@@ -226,10 +226,8 @@ public:
// template Read() would be used
wxString Read(const wxString& key, const char* defVal) const
{ return Read(key, wxString(defVal)); }
#if wxUSE_WCHAR_T
wxString Read(const wxString& key, const wchar_t* defVal) const
{ return Read(key, wxString(defVal)); }
#endif
long ReadLong(const wxString& key, long defVal) const
{ long l; (void)Read(key, &l, defVal); return l; }
@@ -273,10 +271,8 @@ public:
{ return Write(key, wxString(value)); }
bool Write(const wxString& key, const unsigned char *value)
{ return Write(key, wxString(value)); }
#if wxUSE_WCHAR_T
bool Write(const wxString& key, const wchar_t *value)
{ return Write(key, wxString(value)); }
#endif
// we also have to provide specializations for other types which we want to

View File

@@ -14,8 +14,6 @@
#include "wx/strconv.h"
#include "wx/fontenc.h"
#if wxUSE_WCHAR_T
// ----------------------------------------------------------------------------
// wxConvAuto: uses BOM to automatically detect input encoding
// ----------------------------------------------------------------------------
@@ -144,7 +142,5 @@ private:
wxDECLARE_NO_ASSIGN_CLASS(wxConvAuto);
};
#endif // wxUSE_WCHAR_T
#endif // _WX_CONVAUTO_H_

View File

@@ -908,7 +908,7 @@ typedef wxUint16 wxWord;
#if defined(__MACH__) && !defined(SIZEOF_WCHAR_T)
#define SIZEOF_WCHAR_T 4
#endif
#if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T)
#if !defined(SIZEOF_WCHAR_T)
/* also assume that sizeof(wchar_t) == 2 (under Unix the most */
/* common case is 4 but there configure would have defined */
/* SIZEOF_WCHAR_T for us) */
@@ -917,10 +917,14 @@ typedef wxUint16 wxWord;
Wchar_tMustBeExactly2Bytes);
#define SIZEOF_WCHAR_T 2
#endif /* wxUSE_WCHAR_T */
#endif /* !defined(SIZEOF_WCHAR_T) */
#endif
#endif /* Win/!Win */
#ifndef SIZEOF_WCHAR_T
#error "SIZEOF_WCHAR_T must be defined, but isn't"
#endif
/* also define C99-like sized MIN/MAX constants */
#define wxINT8_MIN CHAR_MIN
#define wxINT8_MAX CHAR_MAX
@@ -1248,14 +1252,14 @@ typedef double wxDouble;
/* Define wxChar16 and wxChar32 */
#if wxUSE_WCHAR_T && (!defined(SIZEOF_WCHAR_T) || (SIZEOF_WCHAR_T == 2))
#if SIZEOF_WCHAR_T == 2
#define wxWCHAR_T_IS_WXCHAR16
typedef wchar_t wxChar16;
#else
typedef wxUint16 wxChar16;
#endif
#if wxUSE_WCHAR_T && defined(SIZEOF_WCHAR_T) && (SIZEOF_WCHAR_T == 4)
#if SIZEOF_WCHAR_T == 4
#define wxWCHAR_T_IS_WXCHAR32
typedef wchar_t wxChar32;
#else

View File

@@ -57,7 +57,7 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject
virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; }
// Initialize conversion. Both output or input encoding may
// be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1.
// be wxFONTENCODING_UNICODE.
//
// All subsequent calls to Convert() will interpret it's argument
// as a string in input_enc encoding and will output string in
@@ -91,12 +91,11 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject
bool Convert(char* str) const { return Convert(str, str); }
wxString Convert(const wxString& input) const;
#if wxUSE_WCHAR_T
bool Convert(const char* input, wchar_t* output) const;
bool Convert(const wchar_t* input, char* output) const;
bool Convert(const wchar_t* input, wchar_t* output) const;
bool Convert(wchar_t* str) const { return Convert(str, str); }
#endif
// Return equivalent(s) for given font that are used
// under given platform. wxPLATFORM_CURRENT means the plaform
// this binary was compiled for
@@ -144,12 +143,7 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject
}
private:
#if wxUSE_WCHAR_T
wchar_t *m_Table;
#else
char *m_Table;
#endif
bool m_UnicodeInput, m_UnicodeOutput;
bool m_JustCopy;

View File

@@ -269,8 +269,12 @@ public:
virtual ~wxHtmlEntitiesParser();
// Sets encoding of output string.
// Has no effect if wxUSE_WCHAR_T==0 or wxUSE_UNICODE==1
// Has no effect if wxUSE_UNICODE==1
#if wxUSE_UNICODE
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)
@@ -287,7 +291,7 @@ public:
#endif
protected:
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
#if !wxUSE_UNICODE
wxMBConv *m_conv;
wxFontEncoding m_encoding;
#endif

View File

@@ -64,13 +64,11 @@ public:
m_ptr.charName = str;
m_flags = IsCharPtr;
}
#if wxUSE_WCHAR_T
wxPGPropArgCls( const wchar_t* str )
{
m_ptr.wcharName = str;
m_flags = IsWCharPtr;
}
#endif
/** This constructor is required for NULL. */
wxPGPropArgCls( int )
{
@@ -100,9 +98,7 @@ private:
{
wxPGProperty* property;
const char* charName;
#if wxUSE_WCHAR_T
const wchar_t* wcharName;
#endif
const wxString* stringName;
} m_ptr;
unsigned char m_flags;
@@ -1171,12 +1167,10 @@ public:
wxVariant v(value);
SetPropVal( id, v );
}
#if wxUSE_WCHAR_T
void SetPropertyValue( wxPGPropArg id, const wchar_t* value )
{
SetPropertyValueString( id, wxString(value) );
}
#endif
void SetPropertyValue( wxPGPropArg id, const char* value )
{
SetPropertyValueString( id, wxString(value) );

View File

@@ -29,8 +29,6 @@
#include <stdlib.h>
#endif // ! __WXPALMOS5__
#if wxUSE_WCHAR_T
class WXDLLIMPEXP_FWD_BASE wxString;
// the error value returned by wxMBConv methods
@@ -643,33 +641,6 @@ extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvUI;
#define wxFNSTRINGCAST WXSTRINGCAST
#endif
#else // !wxUSE_WCHAR_T
// ----------------------------------------------------------------------------
// stand-ins in absence of wchar_t
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_BASE wxMBConv
{
public:
const char* cMB2WX(const char *psz) const { return psz; }
const char* cWX2MB(const char *psz) const { return psz; }
};
#define wxConvFile wxConvLocal
extern WXDLLIMPEXP_DATA_BASE(wxMBConv) wxConvLibc,
wxConvLocal,
wxConvISO8859_1,
wxConvUTF8;
extern WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvCurrent;
#define wxFNCONV(name) name
#define wxFNSTRINGCAST WXSTRINGCAST
#endif
// wxUSE_WCHAR_T
// ----------------------------------------------------------------------------
// macros for the most common conversions
// ----------------------------------------------------------------------------

View File

@@ -39,26 +39,16 @@ inline bool wxIsEmpty(const wxCStrData& s) { return s.AsString().empty(); }
/* multibyte to wide char conversion functions and macros */
#if wxUSE_WCHAR_T
/* multibyte<->widechar conversion */
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);
/* multibyte<->widechar conversion */
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
#else /* !wxUSE_UNICODE */
/* No wxUSE_WCHAR_T: we have to do something (JACS) */
#define wxMB2WC wxStrncpy
#define wxWC2MB wxStrncpy
#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