Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: base/i18n/char_iterator.h

Issue 23522018: RenderTextWin: Break runs between any two characters that are not in the same code block (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use CharIterator Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/i18n/char_iterator.cc » ('j') | ui/gfx/render_text_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/char_iterator.h
diff --git a/base/i18n/char_iterator.h b/base/i18n/char_iterator.h
index 46928b37d0bf5ba705b1fd1d411fe08046cacb24..33eebff42f3a54a9e225d781b02198b497b6dc9d 100644
--- a/base/i18n/char_iterator.h
+++ b/base/i18n/char_iterator.h
@@ -33,15 +33,15 @@ class BASE_I18N_EXPORT UTF8CharIterator {
explicit UTF8CharIterator(const std::string* str);
~UTF8CharIterator();
- // Return the starting array index of the current character within the
+ // Returns the starting array index of the current character within the
// string.
int32 array_pos() const { return array_pos_; }
- // Return the logical index of the current character, independent of the
+ // Returns the logical index of the current character, independent of the
// number of bytes each character takes.
int32 char_pos() const { return char_pos_; }
- // Return the current char.
+ // Returns the current char.
int32 get() const { return char_; }
// Returns true if we're at the end of the string.
@@ -51,6 +51,11 @@ class BASE_I18N_EXPORT UTF8CharIterator {
// end of the string.
bool Advance();
+ // Set the iterator to the specified |position|. If |position| is not a code
+ // point boundary, the position is set to the beginning of the code point.
+ // Calling this function invalidates all future |char_pos()| results.
+ void SetPosition(int32 position);
+
private:
// The string we're iterating over.
const uint8_t* str_;
@@ -80,15 +85,15 @@ class BASE_I18N_EXPORT UTF16CharIterator {
UTF16CharIterator(const char16* str, size_t str_len);
~UTF16CharIterator();
- // Return the starting array index of the current character within the
+ // Returns the starting array index of the current character within the
// string.
int32 array_pos() const { return array_pos_; }
- // Return the logical index of the current character, independent of the
+ // Returns the logical index of the current character, independent of the
// number of codewords each character takes.
int32 char_pos() const { return char_pos_; }
- // Return the current char.
+ // Returns the current char.
int32 get() const { return char_; }
// Returns true if we're at the end of the string.
@@ -98,6 +103,11 @@ class BASE_I18N_EXPORT UTF16CharIterator {
// end of the string.
bool Advance();
+ // Set the iterator to the specified |position|. If |position| is not a code
+ // point boundary, the position is set to the beginning of the code point.
+ // Calling this function invalidates all future |char_pos()| results.
+ void SetPosition(int32 position);
+
private:
// Fills in the current character we found and advances to the next
// character, updating all flags as necessary.
« no previous file with comments | « no previous file | base/i18n/char_iterator.cc » ('j') | ui/gfx/render_text_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698