fixed non-const wxString iterators to work when a character is changed to another with different UTF-8 sequence length

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-05-15 13:16:01 +00:00
parent 549b95b3de
commit b0c4d5d792
4 changed files with 287 additions and 37 deletions

View File

@@ -39,6 +39,7 @@
#endif
class WXDLLIMPEXP_BASE wxUniCharRef;
class WXDLLIMPEXP_BASE wxStringIteratorNode;
// This class represents single Unicode character. It can be converted to
// and from char or wchar_t and implements commonly used character operations.
@@ -157,7 +158,7 @@ private:
// create the reference
#if wxUSE_UNICODE_UTF8
wxUniCharRef(wxStringImpl& str, iterator pos) : m_str(str), m_pos(pos) {}
wxUniCharRef(wxStringIteratorNode& node, iterator pos) : m_node(node), m_pos(pos) {}
#else
wxUniCharRef(iterator pos) : m_pos(pos) {}
#endif
@@ -169,8 +170,8 @@ public:
// that must be used explicitly (this is more than using 'explicit'
// keyword on ctor!):
#if wxUSE_UNICODE_UTF8
static wxUniCharRef CreateForString(wxStringImpl& str, iterator pos)
{ return wxUniCharRef(str, pos); }
static wxUniCharRef CreateForString(wxStringIteratorNode& node, iterator pos)
{ return wxUniCharRef(node, pos); }
#else
static wxUniCharRef CreateForString(iterator pos)
{ return wxUniCharRef(pos); }
@@ -249,7 +250,7 @@ private:
private:
// reference to the string and pointer to the character in string
#if wxUSE_UNICODE_UTF8
wxStringImpl& m_str;
wxStringIteratorNode& m_node;
#endif
iterator m_pos;
};