- // checks correctness of UTF-8 sequence
- static bool IsValidUtf8String(const char *c);
-#ifdef __WXDEBUG__
- static bool IsValidUtf8LeadByte(unsigned char c);
-#endif
-
- // table of offsets to skip forward when iterating
- static unsigned char ms_utf8IterTable[256];
-
- static void IncIter(wxStringImpl::iterator& i)
- {
- wxASSERT( IsValidUtf8LeadByte(*i) );
- i += ms_utf8IterTable[(unsigned char)*i];
- }
- static void IncIter(wxStringImpl::const_iterator& i)
- {
- wxASSERT( IsValidUtf8LeadByte(*i) );
- i += ms_utf8IterTable[(unsigned char)*i];
- }
-
- static void DecIter(wxStringImpl::iterator& i);
- static void DecIter(wxStringImpl::const_iterator& i);
- static wxStringImpl::iterator AddToIter(wxStringImpl::iterator i, int n);
- static wxStringImpl::const_iterator AddToIter(wxStringImpl::const_iterator i, int n);
- static int DiffIters(wxStringImpl::const_iterator i1, wxStringImpl::const_iterator i2);
- static int DiffIters(wxStringImpl::iterator i1, wxStringImpl::iterator i2);
-
- struct Utf8CharBuffer
- {
- char data[5];
- operator const char*() const { return data; }
- };
- static Utf8CharBuffer EncodeChar(wxUniChar ch);
- // returns n copies of ch encoded in UTF-8 string
- static wxCharBuffer EncodeNChars(size_t n, wxUniChar ch);
-
- // returns the length of UTF-8 encoding of the character with lead byte 'c'
- static size_t GetUtf8CharLength(char c)
- {
- wxASSERT( IsValidUtf8LeadByte(c) );
- return ms_utf8IterTable[(unsigned char)c];
- }
+ // FIXME-UTF8: return as-is without copying under UTF8 locale, return
+ // converted string under other locales - needs wxCharBuffer
+ // changes
+ static wxCharBuffer ImplStr(const char* str,
+ const wxMBConv& conv = wxConvLibc)
+ { return ConvertStr(str, npos, conv).data; }
+ static SubstrBufFromMB ImplStr(const char* str, size_t n,
+ const wxMBConv& conv = wxConvLibc)
+ { return ConvertStr(str, n, conv); }