1 #ifndef __StringConv_hh__
2 #define __StringConv_hh__
6 # pragma warning(disable: 4005 4996)
26 #define WxToAscii(s) (const char*)(wxString(s).mb_str(wxConvUTF8))
27 #define WxToFilenames(s) (const char*)(wxString(s).mb_str(wxConvFile))
28 #define WxToFunctionString(s) (const char*)(wxString(s).fn_str())
34 return wxString(thestring, wxConvUTF8);
39 return wxString(thestring, wxConvFile);
44 inline wxString
AsciiToWx(
const std::string& thestring)
46 return wxString(thestring.c_str(), wxConvUTF8);
51 return wxString(thestring.c_str(), wxConvFile);
65 _AsciiStrings =
new char*[size];
66 for (
int i = 0; i < size; i++)
68 _AsciiStrings[i] = strdup(WxToAscii(strings[i]));
75 for (
int i = 0; i < _Size; i++)
77 free(_AsciiStrings[i]);
79 delete[] _AsciiStrings;
95 return std::string(wxString(s.c_str(),wxCSConv(_T(
"ISO8859-1"))).mb_str(wxConvUTF8));
99 inline void CleanStringIP(wxString &input,
const wxString replaceWith=wxEmptyString)
101 wxRegEx rex( wxT(
"[^[:alnum:]_()-,]") );
102 if ( rex.IsValid() ) {
103 rex.ReplaceAll(&input, replaceWith);
107 inline wxString
CleanString(
const wxString &input,
const wxString replaceWith=wxEmptyString)
109 wxString res = input;
118 # pragma warning(pop)
121 #endif // __StringConv_hh__
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
std::string IsoLatin1ToUtf8(const std::string &s)
wxString FilenamesToWx(const char *thestring)
WxToAsciiArray(wxChar **strings, int size)
Class for converting an array of wxStrings to an array of non-const ASCII strings.
wxString CleanString(const wxString &input, const wxString replaceWith=wxEmptyString)
void CleanStringIP(wxString &input, const wxString replaceWith=wxEmptyString)