+ // 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; }
+ };