Index: base/i18n/char_iterator.cc |
diff --git a/base/i18n/char_iterator.cc b/base/i18n/char_iterator.cc |
index 25efc518694c0fd480253b82f9e55dd3b598d406..58d0652e2e19f81c59f3b53e4ba5f0e2efb95fb4 100644 |
--- a/base/i18n/char_iterator.cc |
+++ b/base/i18n/char_iterator.cc |
@@ -36,6 +36,12 @@ bool UTF8CharIterator::Advance() { |
return true; |
} |
+void UTF8CharIterator::SetPosition(int32 position) { |
+ U8_SET_CP_START(str_, position, array_pos_); |
+ next_pos_ = array_pos_; |
+ U8_NEXT(str_, next_pos_, len_, char_); |
+} |
+ |
UTF16CharIterator::UTF16CharIterator(const string16* str) |
: str_(reinterpret_cast<const char16*>(str->data())), |
len_(str->size()), |
@@ -73,6 +79,13 @@ bool UTF16CharIterator::Advance() { |
return true; |
} |
+void UTF16CharIterator::SetPosition(int32 position) { |
+ array_pos_ = position; |
+ U16_SET_CP_START(str_, 0, array_pos_); |
+ next_pos_ = array_pos_; |
+ ReadChar(); |
+} |
+ |
void UTF16CharIterator::ReadChar() { |
// This is actually a huge macro, so is worth having in a separate function. |
U16_NEXT(str_, next_pos_, len_, char_); |