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

Unified Diff: base/i18n/break_iterator.h

Issue 1272683002: Creates BreakIterator::GetWordBreakStatus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made new function, added tests. Created 5 years, 4 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
Index: base/i18n/break_iterator.h
diff --git a/base/i18n/break_iterator.h b/base/i18n/break_iterator.h
index 19fdbe01cbdd84c52cc5c4e481bb296439660e77..7fd4bb5a5ba204445cb2a0cf4ab524fb26984782 100644
--- a/base/i18n/break_iterator.h
+++ b/base/i18n/break_iterator.h
@@ -71,6 +71,8 @@ class BASE_I18N_EXPORT BreakIterator {
RULE_BASED,
};
+ enum WordBreakStatus { IS_WORD_BREAK, IS_SKIPPABLE_WORD, IS_NOT_WORD_BREAK };
please use gerrit instead 2015/08/07 17:16:59 add newlines and comments on the meaning of these
Julius 2015/08/07 20:30:04 Done.
+
// Requires |str| to live as long as the BreakIterator does.
BreakIterator(const StringPiece16& str, BreakType break_type);
// Make a rule-based iterator. BreakType == RULE_BASED is implied.
@@ -101,6 +103,13 @@ class BASE_I18N_EXPORT BreakIterator {
// this distinction doesn't apply and it always returns false.
bool IsWord() const;
+ // Under BREAK_WORD mode, returns IS_WORD_BREAK if the break we just hit is
+ // the end of a word. Under BREAK_LINE and BREAK_NEWLINE modes, this
+ // distinction doesn't apply and it always returns IS_NOT_WORD_BREAK.
+ // Otherwise, the iterator just skipped over e.g. whitespace, punctuation, or
+ // characters that are unsupported by |rules_| and returns IS_SKIPPABLE_WORD.
+ BreakIterator::WordBreakStatus IsWordBreak() const;
+
// Under BREAK_WORD mode, returns true if |position| is at the end of word or
// at the start of word. It always returns false under BREAK_LINE and
// BREAK_NEWLINE modes.
« no previous file with comments | « no previous file | base/i18n/break_iterator.cc » ('j') | chrome/renderer/spellchecker/spellcheck_worditerator_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698