#pragma hdrstop
#endif
+#if wxUSE_FONTMAP
+
#include "wx/encconv.h"
#include <stdlib.h>
-static int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2)
+extern "C" int LINKAGEMODE CompareCharsetItems(const void *i1, const void *i2)
{
return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u );
}
m_Table[128 + i] = (wchar_t)(128 + i);
#else
m_Table[128 + i] = (char)(128 + i);
-#endif
+#endif
}
delete[] rev;
return;
}
- wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+ wxCHECK_RET(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
for (i = input, o = output; *i != 0;)
*(o++) = (char)(m_Table[(wxUint8)*(i++)]);
return;
}
- wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+ wxCHECK_RET(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++)]);
return;
}
- wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+ wxCHECK_RET(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++)]);
return;
}
- wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+ wxCHECK_RET(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++)]);
wxString s;
const wxChar *i;
- wxASSERT_MSG(m_Table != NULL, wxT("You must call wxEncodingConverter::Init() before actually converting!"));
+ wxCHECK_MSG(m_Table != NULL, s,
+ wxT("You must call wxEncodingConverter::Init() before actually converting!"));
if (m_UnicodeInput)
+ {
for (i = input.c_str(); *i != 0; i++)
s << (wxChar)(m_Table[(wxUint16)*i]);
+ }
else
+ {
for (i = input.c_str(); *i != 0; i++)
s << (wxChar)(m_Table[(wxUint8)*i]);
+ }
+
return s;
}
};
-
+static bool FindEncoding(const wxFontEncodingArray& arr, wxFontEncoding f)
+{
+ for (wxFontEncodingArray::const_iterator it = arr.begin(), en = arr.end();
+ it != en; ++it)
+ if (*it == f)
+ return true;
+ return false;
+}
wxFontEncodingArray wxEncodingConverter::GetPlatformEquivalents(wxFontEncoding enc, int platform)
{
if (EquivalentEncodings[clas][i][e] == enc)
{
for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++)
- if (*f == enc) arr.Add(enc);
+ if (*f == enc) arr.push_back(enc);
for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++)
- if (arr.Index(*f) == wxNOT_FOUND) arr.Add(*f);
+ if (!FindEncoding(arr, *f)) arr.push_back(*f);
i = NUM_OF_PLATFORMS/*hack*/; break;
}
clas++;
{
for (j = 0; j < NUM_OF_PLATFORMS; j++)
for (f = EquivalentEncodings[clas][j]; *f != STOP; f++)
- if (arr.Index(*f) == wxNOT_FOUND) arr.Add(*f);
+ if (!FindEncoding(arr, *f)) arr.push_back(*f);
i = NUM_OF_PLATFORMS/*hack*/; break;
}
clas++;
return arr;
}
+
+#endif // wxUSE_FONTMAP