-
- const wxChar *i;
- wxChar *o;
-
- if (m_UnicodeInput)
- for (i = input, o = output; *i != 0; i++, o++)
- *o = (wxChar)(m_Table[(wxUint16)*i]);
- else
- for (i = input, o = output; *i != 0; i++, o++)
- *o = (wxChar)(m_Table[(wxUint8)*i]);
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (char)(m_Table[(wxUint8)*(i++)]);
+ *o = 0;
+}
+
+
+#if wxUSE_WCHAR_T
+
+void wxEncodingConverter::Convert(const char* input, wchar_t* output)
+{
+ 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;
+ }
+
+ wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (wchar_t)(m_Table[(wxUint8)*(i++)]);
+ *o = 0;
+}
+
+
+
+void wxEncodingConverter::Convert(const wchar_t* input, char* output)
+{
+ 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;
+ }
+
+ wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+
+ for (i = input, o = output; *i != 0;)
+ *(o++) = (char)(m_Table[(wxUint16)*(i++)]);