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

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: Rebase and address comments. 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
« no previous file with comments | « no previous file | base/i18n/break_iterator.cc » ('j') | base/i18n/break_iterator_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/break_iterator.h
diff --git a/base/i18n/break_iterator.h b/base/i18n/break_iterator.h
index 19fdbe01cbdd84c52cc5c4e481bb296439660e77..e8988d71a13cecb9e81aaae633d9f5743b4d33d7 100644
--- a/base/i18n/break_iterator.h
+++ b/base/i18n/break_iterator.h
@@ -71,6 +71,19 @@ class BASE_I18N_EXPORT BreakIterator {
RULE_BASED,
};
+ enum WordBreakStatus {
+ // The end of text that the iterator recognizes as word characters.
+ // Non-word characters are things like punctuation and spaces.
+ IS_WORD_BREAK,
+ // Characters that the iterator can skip past, such as punctuation,
+ // whitespace, and, if using RULE_BASED mode, characters from another
+ // character set.
+ IS_SKIPPABLE_WORD,
+ // Only used if not in BREAK_WORD or RULE_BASED mode. This is returned for
+ // newlines, line breaks, and character breaks.
+ IS_LINE_OR_CHAR_BREAK
+ };
+
// 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 +114,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 string of word characters. IS_SKIPPABLE_WORD is returned if
please use gerrit instead 2015/08/10 17:24:42 |string| is an overloaded term. Say "sequence", if
Julius 2015/08/10 18:56:19 Done.
+ // punctuation, spaces, or, under RULE_BASED mode, characters outside the
+ // character set are found. If not under BREAK_WORD or RULE_BASED modes, this
+ // always returns IS_LINE_OR_CHAR_BREAK.
+ BreakIterator::WordBreakStatus IsWordBreak() const;
please use gerrit instead 2015/08/10 17:24:42 I think IsSomething() is best for functions that r
Julius 2015/08/10 18:56:19 Done.
+
// 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') | base/i18n/break_iterator_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698