Always enable wxMBConv::IsUTF8()
These where previously guarded by wxUSE_UNICODE_UTF8 but may be useful in other configurations too.
This commit is contained in:
@@ -133,12 +133,10 @@ public:
|
|||||||
// encoding
|
// encoding
|
||||||
static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; }
|
static size_t GetMaxMBNulLen() { return 4 /* for UTF-32 */; }
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
// return true if the converter's charset is UTF-8, i.e. char* strings
|
// return true if the converter's charset is UTF-8, i.e. char* strings
|
||||||
// decoded using this object can be directly copied to wxString's internal
|
// decoded using this object can be directly copied to wxString's internal
|
||||||
// storage without converting to WC and than back to UTF-8 MB string
|
// storage without converting to WC and than back to UTF-8 MB string
|
||||||
virtual bool IsUTF8() const { return false; }
|
virtual bool IsUTF8() const { return false; }
|
||||||
#endif
|
|
||||||
|
|
||||||
// The old conversion functions. The existing classes currently mostly
|
// The old conversion functions. The existing classes currently mostly
|
||||||
// implement these ones but we're in transition to using To/FromWChar()
|
// implement these ones but we're in transition to using To/FromWChar()
|
||||||
@@ -180,9 +178,7 @@ public:
|
|||||||
|
|
||||||
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvLibc; }
|
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvLibc; }
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
virtual bool IsUTF8() const wxOVERRIDE { return wxLocaleIsUtf8; }
|
virtual bool IsUTF8() const wxOVERRIDE { return wxLocaleIsUtf8; }
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
@@ -221,9 +217,7 @@ public:
|
|||||||
return m_conv->GetMBNulLen();
|
return m_conv->GetMBNulLen();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
virtual bool IsUTF8() const wxOVERRIDE { return m_conv->IsUTF8(); }
|
virtual bool IsUTF8() const wxOVERRIDE { return m_conv->IsUTF8(); }
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvBrokenFileNames(*this); }
|
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxConvBrokenFileNames(*this); }
|
||||||
|
|
||||||
@@ -342,11 +336,9 @@ public:
|
|||||||
|
|
||||||
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvStrictUTF8(); }
|
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvStrictUTF8(); }
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
// NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
|
// NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
|
||||||
// take the shortcut in that case
|
// take the shortcut in that case
|
||||||
virtual bool IsUTF8() const wxOVERRIDE { return true; }
|
virtual bool IsUTF8() const wxOVERRIDE { return true; }
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8
|
class WXDLLIMPEXP_BASE wxMBConvUTF8 : public wxMBConvStrictUTF8
|
||||||
@@ -368,11 +360,9 @@ public:
|
|||||||
|
|
||||||
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF8(m_options); }
|
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxMBConvUTF8(m_options); }
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
// NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
|
// NB: other mapping modes are not, strictly speaking, UTF-8, so we can't
|
||||||
// take the shortcut in that case
|
// take the shortcut in that case
|
||||||
virtual bool IsUTF8() const wxOVERRIDE { return m_options == MAP_INVALID_UTF8_NOT; }
|
virtual bool IsUTF8() const wxOVERRIDE { return m_options == MAP_INVALID_UTF8_NOT; }
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_options;
|
int m_options;
|
||||||
@@ -496,9 +486,7 @@ public:
|
|||||||
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
|
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
|
||||||
virtual size_t GetMBNulLen() const wxOVERRIDE;
|
virtual size_t GetMBNulLen() const wxOVERRIDE;
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
virtual bool IsUTF8() const wxOVERRIDE;
|
virtual bool IsUTF8() const wxOVERRIDE;
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxCSConv(*this); }
|
virtual wxMBConv *Clone() const wxOVERRIDE { return new wxCSConv(*this); }
|
||||||
|
|
||||||
|
@@ -75,7 +75,6 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
/* flag indicating whether the current locale uses UTF-8 or not; must be
|
/* flag indicating whether the current locale uses UTF-8 or not; must be
|
||||||
updated every time the locale is changed! */
|
updated every time the locale is changed! */
|
||||||
#if wxUSE_UTF8_LOCALE_ONLY
|
#if wxUSE_UTF8_LOCALE_ONLY
|
||||||
@@ -85,9 +84,6 @@
|
|||||||
#endif
|
#endif
|
||||||
/* function used to update the flag: */
|
/* function used to update the flag: */
|
||||||
extern WXDLLIMPEXP_BASE void wxUpdateLocaleIsUtf8();
|
extern WXDLLIMPEXP_BASE void wxUpdateLocaleIsUtf8();
|
||||||
#else /* !wxUSE_UNICODE_UTF8 */
|
|
||||||
inline void wxUpdateLocaleIsUtf8() {}
|
|
||||||
#endif /* wxUSE_UNICODE_UTF8/!wxUSE_UNICODE_UTF8 */
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
@@ -68,6 +68,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
static size_t GetMaxMBNulLen();
|
static size_t GetMaxMBNulLen();
|
||||||
|
|
||||||
|
/**
|
||||||
|
return true if the converter's charset is UTF-8, i.e. char* strings
|
||||||
|
decoded using this object can be directly copied to wxString's internal
|
||||||
|
storage without converting to WC and than back to UTF-8 MB string
|
||||||
|
*/
|
||||||
|
virtual bool IsUTF8() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert multibyte string to a wide character one.
|
Convert multibyte string to a wide character one.
|
||||||
|
|
||||||
|
@@ -2128,9 +2128,7 @@ public:
|
|||||||
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
|
const wchar_t *src, size_t srcLen = wxNO_LEN) const wxOVERRIDE;
|
||||||
virtual size_t GetMBNulLen() const wxOVERRIDE;
|
virtual size_t GetMBNulLen() const wxOVERRIDE;
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
virtual bool IsUTF8() const wxOVERRIDE;
|
virtual bool IsUTF8() const wxOVERRIDE;
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual wxMBConv *Clone() const wxOVERRIDE
|
virtual wxMBConv *Clone() const wxOVERRIDE
|
||||||
{
|
{
|
||||||
@@ -2516,13 +2514,11 @@ size_t wxMBConv_iconv::GetMBNulLen() const
|
|||||||
return m_minMBCharWidth;
|
return m_minMBCharWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
bool wxMBConv_iconv::IsUTF8() const
|
bool wxMBConv_iconv::IsUTF8() const
|
||||||
{
|
{
|
||||||
return wxStricmp(m_name, "UTF-8") == 0 ||
|
return wxStricmp(m_name, "UTF-8") == 0 ||
|
||||||
wxStricmp(m_name, "UTF8") == 0;
|
wxStricmp(m_name, "UTF8") == 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // HAVE_ICONV
|
#endif // HAVE_ICONV
|
||||||
|
|
||||||
@@ -3250,7 +3246,6 @@ size_t wxCSConv::GetMBNulLen() const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
bool wxCSConv::IsUTF8() const
|
bool wxCSConv::IsUTF8() const
|
||||||
{
|
{
|
||||||
if ( m_convReal )
|
if ( m_convReal )
|
||||||
@@ -3259,7 +3254,6 @@ bool wxCSConv::IsUTF8() const
|
|||||||
// otherwise, we are ISO-8859-1
|
// otherwise, we are ISO-8859-1
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@@ -1091,8 +1091,6 @@ char *strdup(const char *s)
|
|||||||
// wxLocaleIsUtf8
|
// wxLocaleIsUtf8
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
#if wxUSE_UNICODE_UTF8
|
|
||||||
|
|
||||||
#if !wxUSE_UTF8_LOCALE_ONLY
|
#if !wxUSE_UTF8_LOCALE_ONLY
|
||||||
bool wxLocaleIsUtf8 = false; // the safer setting if not known
|
bool wxLocaleIsUtf8 = false; // the safer setting if not known
|
||||||
#endif
|
#endif
|
||||||
@@ -1147,8 +1145,6 @@ void wxUpdateLocaleIsUtf8()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_UNICODE_UTF8
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wx wrappers for CRT functions
|
// wx wrappers for CRT functions
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
Reference in New Issue
Block a user