X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b5343e065a0a9bb86aeac8a366ca7311c15e9d29..cbeda384e51acb82e13994cb67ac1714669cae10:/include/wx/stringops.h diff --git a/include/wx/stringops.h b/include/wx/stringops.h index 50aa1376ac..c7eb83bc4b 100644 --- a/include/wx/stringops.h +++ b/include/wx/stringops.h @@ -28,25 +28,21 @@ struct WXDLLIMPEXP_BASE wxStringOperationsWchar { // moves the iterator to the next Unicode character - static void IncIter(wxStringImpl::iterator& i) { ++i; } - static void IncIter(wxStringImpl::const_iterator& i) { ++i; } + template + static void IncIter(Iterator& i) { ++i; } // moves the iterator to the previous Unicode character - static void DecIter(wxStringImpl::iterator& i) { --i; } - static void DecIter(wxStringImpl::const_iterator& i) { --i; } + template + static void DecIter(Iterator& i) { --i; } // moves the iterator by n Unicode characters - static wxStringImpl::iterator AddToIter(const wxStringImpl::iterator& i, ptrdiff_t n) - { return i + n; } - static wxStringImpl::const_iterator AddToIter(const wxStringImpl::const_iterator& i, ptrdiff_t n) + template + static Iterator AddToIter(const Iterator& i, ptrdiff_t n) { return i + n; } // returns distance of the two iterators in Unicode characters - static ptrdiff_t DiffIters(const wxStringImpl::iterator& i1, - const wxStringImpl::iterator& i2) - { return i1 - i2; } - static ptrdiff_t DiffIters(const wxStringImpl::const_iterator& i1, - const wxStringImpl::const_iterator& i2) + template + static ptrdiff_t DiffIters(const Iterator& i1, const Iterator& i2) { return i1 - i2; } // encodes the character to a form used to represent it in internal @@ -65,9 +61,10 @@ struct WXDLLIMPEXP_BASE wxStringOperationsUtf8 // checks correctness of UTF-8 sequence static bool IsValidUtf8String(const char *c, size_t len = wxStringImpl::npos); -#ifdef __WXDEBUG__ - static bool IsValidUtf8LeadByte(unsigned char c); -#endif + static bool IsValidUtf8LeadByte(unsigned char c) + { + return (c <= 0x7F) || (c >= 0xC2 && c <= 0xF4); + } // table of offsets to skip forward when iterating over UTF-8 sequence static const unsigned char ms_utf8IterTable[256];