+
+ wxCHECK_MSG(m_Table != NULL, false,
+ wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ bool replaced = false;
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (char)(GetTableValue(m_Table, (wxUint8)*(i++), replaced));
+ *o = 0;
+
+ return !replaced;
+}
+
+
+#if wxUSE_WCHAR_T
+
+bool wxEncodingConverter::Convert(const char* input, wchar_t* output) const
+{
+ wxASSERT_MSG(m_UnicodeOutput, wxT("You cannot convert to 8-bit if output is const wchar_t*!"));
+ wxASSERT_MSG(!m_UnicodeInput, wxT("You cannot convert from unicode if input is const char*!"));
+
+ const char *i;
+ wchar_t *o;
+
+ if (m_JustCopy)
+ {
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (wchar_t)(*(i++));
+ *o = 0;
+ return true;
+ }
+
+ wxCHECK_MSG(m_Table != NULL, false,
+ wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ bool replaced = false;
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (wchar_t)(GetTableValue(m_Table, (wxUint8)*(i++), replaced));
+ *o = 0;
+
+ return !replaced;
+}
+
+
+
+bool wxEncodingConverter::Convert(const wchar_t* input, char* output) const
+{
+ wxASSERT_MSG(!m_UnicodeOutput, wxT("You cannot convert to unicode if output is const char*!"));
+ wxASSERT_MSG(m_UnicodeInput, wxT("You cannot convert from 8-bit if input is const wchar_t*!"));
+
+ const wchar_t *i;
+ char *o;
+
+ if (m_JustCopy)
+ {
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (char)(*(i++));
+ *o = 0;
+ return true;
+ }
+
+ wxCHECK_MSG(m_Table != NULL, false,
+ wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ bool replaced = false;
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (char)(GetTableValue(m_Table, (wxUint16)*(i++), replaced));
+ *o = 0;
+
+ return !replaced;
+}
+
+
+
+bool wxEncodingConverter::Convert(const wchar_t* input, wchar_t* output) const
+{
+ wxASSERT_MSG(m_UnicodeOutput, wxT("You cannot convert to 8-bit if output is const wchar_t*!"));
+ wxASSERT_MSG(m_UnicodeInput, wxT("You cannot convert from 8-bit if input is const wchar_t*!"));
+
+ const wchar_t *i;
+ wchar_t *o;
+
+ if (m_JustCopy)
+ {
+ // wcscpy() is not guaranteed to exist
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (*(i++));
+ *o = 0;
+ return true;
+ }
+
+ wxCHECK_MSG(m_Table != NULL, false,
+ wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ bool replaced = false;