- class const_iterator
- {
- // NB: reference_type is intentionally value, not reference, the character
- // may be encoded differently in wxString data:
- WX_STR_ITERATOR_IMPL(const_iterator, const wxChar*, wxUniChar);
-
- public:
- const_iterator(const const_iterator& i)
- : m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
- const_iterator(const iterator& i)
- : m_cur(i.m_cur), m_node(i.str(), &m_cur) {}
-
- reference operator*() const
- { return wxStringOperations::DecodeChar(m_cur); }
-
- const_iterator operator+(int n) const
- { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, n)); }
- const_iterator operator+(size_t n) const
- { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, (int)n)); }
- const_iterator operator-(int n) const
- { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -n)); }
- const_iterator operator-(size_t n) const
- { return const_iterator(str(), wxStringOperations::AddToIter(m_cur, -(int)n)); }
-
- private:
- // for internal wxString use only:
- const_iterator(const wxString *str, underlying_iterator ptr)
- : m_cur(ptr), m_node(str, &m_cur) {}
- const_iterator(const wxString& str, underlying_iterator ptr)
- : m_cur(ptr), m_node(&str, &m_cur) {}
-
- const wxString* str() const { return m_node.m_str; }
-
- wxStringIteratorNode m_node;
- };
-