To use C++ API for BreakIterator in Blink, port getRuleStatus from ICU 52
See https://codereview.chromium.org/23618052 for the Blink change.
Patch by Igor Oliveira.
Original review : https://codereview.chromium.org/23480090/
BUG=232922
TEST=ICU is built and Blink is built with Blink CL above once ICU is rolled.
TBR=cpu
Review URL: https://codereview.chromium.org/23532086
git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/icu46@224814 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/README.chromium b/README.chromium
index 07d2898..d3f3dd4 100644
--- a/README.chromium
+++ b/README.chromium
@@ -255,5 +255,6 @@
- patches/csetdet.patch
- upstream bug: http://bugs.icu-project.org/trac/ticket/10318
-
-
+26. Add BreakIterator::getRuleStatus
+ - patches/breakiterator.patch
+ - Copy and paste BreakIterator::getRuleStatus API from ICU 52
diff --git a/patches/breakiterator.patch b/patches/breakiterator.patch
new file mode 100644
index 0000000..59ad7d8
--- /dev/null
+++ b/patches/breakiterator.patch
@@ -0,0 +1,140 @@
+Index: README.chromium
+diff --git a/README.chromium b/README.chromium
+index 76acd4b06530827413286a72fed86771147c88d8..7e85c4949f1b52bbbda26e2d90b49852aaff7563 100644
+--- a/README.chromium
++++ b/README.chromium
+@@ -255,5 +255,5 @@ This directory contains the source code of ICU 4.6 for C/C++
+ - patches/csetdet.patch
+ - upstream bug: http://bugs.icu-project.org/trac/ticket/10318
+
+-
+-
++26. Add BreakIterator::getRuleStatus
++ - Copy and paste BreakIterator::getRuleStatus API from icu 52
+Index: patches/breakiterator.patch
+diff --git a/patches/breakiterator.patch b/patches/breakiterator.patch
+new file mode 100644
+index 0000000000000000000000000000000000000000..f1b36a34d0b408940a9c528fa0c796e2db6cb457
+--- /dev/null
++++ b/patches/breakiterator.patch
+@@ -0,0 +1,74 @@
++From c795f7766bd4f650a2396c834bc2a07768781ae8 Mon Sep 17 00:00:00 2001
++From: Igor Oliveira <igor.o@sisa.samsung.com>
++Date: Tue, 17 Sep 2013 14:43:07 -0700
++Subject: [PATCH] The CL https://codereview.chromium.org/23618052/ depends of
++ an API that will be added by libicu 5.2,
++ BreakIterator::getRuleStatus. This patch is just a copy and
++ paste of the libicu 5.2 API into chromium libicu.
++
++---
++ README.chromium | 3 +++
++ source/common/brkiter.cpp | 7 +++++++
++ source/common/unicode/brkiter.h | 15 +++++++++++++++
++ 3 files changed, 25 insertions(+)
++
++diff --git a/README.chromium b/README.chromium
++index 76acd4b..eaf2e81 100644
++--- a/README.chromium
+++++ b/README.chromium
++@@ -255,5 +255,8 @@ This directory contains the source code of ICU 4.6 for C/C++
++ - patches/csetdet.patch
++ - upstream bug: http://bugs.icu-project.org/trac/ticket/10318
++
+++26. Add BreakIterator::getRuleStatus
+++ - Copy and paste BreakIterator::getRuleStatus API from icu 5.2
+++
++
++
++diff --git a/source/common/brkiter.cpp b/source/common/brkiter.cpp
++index 26f7b6a..41da826 100644
++--- a/source/common/brkiter.cpp
+++++ b/source/common/brkiter.cpp
++@@ -436,6 +436,13 @@ BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
++ return locBased.getLocaleID(type, status);
++ }
++
+++// This implementation of getRuleStatus is a do-nothing stub, here to
+++// provide a default implementation for any derived BreakIterator classes that
+++// do not implement it themselves.
+++int32_t BreakIterator::getRuleStatus() const {
+++ return 0;
+++}
+++
++ U_NAMESPACE_END
++
++ #endif /* #if !UCONFIG_NO_BREAK_ITERATION */
++diff --git a/source/common/unicode/brkiter.h b/source/common/unicode/brkiter.h
++index bdd3cc7..1800336 100644
++--- a/source/common/unicode/brkiter.h
+++++ b/source/common/unicode/brkiter.h
++@@ -284,6 +284,21 @@ public:
++ virtual int32_t next(int32_t n) = 0;
++
++ /**
+++ * For RuleBasedBreakIterators, return the status tag from the
+++ * break rule that determined the most recently
+++ * returned break position.
+++ * <p>
+++ * For break iterator types that do not support a rule status,
+++ * a default value of 0 is returned.
+++ * <p>
+++ * @return the status from the break rule that determined the most recently
+++ * returned break position.
+++ * @see RuleBaseBreakIterator::getRuleStatus()
+++ * @see UWordBreak
+++ */
+++ virtual int32_t getRuleStatus() const;
+++
+++ /**
++ * Create BreakIterator for word-breaks using the given locale.
++ * Returns an instance of a BreakIterator implementing word breaks.
++ * WordBreak is useful for word selection (ex. double click)
++--
++1.7.12.4 (Apple Git-37)
++
+Index: source/common/brkiter.cpp
+diff --git a/source/common/brkiter.cpp b/source/common/brkiter.cpp
+index 26f7b6a82e8b8981dce42a08d8fca6a2a42e81cc..41da826748370ad5caff57191e8c0f2f0da12c3e 100644
+--- a/source/common/brkiter.cpp
++++ b/source/common/brkiter.cpp
+@@ -436,6 +436,13 @@ BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
+ return locBased.getLocaleID(type, status);
+ }
+
++// This implementation of getRuleStatus is a do-nothing stub, here to
++// provide a default implementation for any derived BreakIterator classes that
++// do not implement it themselves.
++int32_t BreakIterator::getRuleStatus() const {
++ return 0;
++}
++
+ U_NAMESPACE_END
+
+ #endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+Index: source/common/unicode/brkiter.h
+diff --git a/source/common/unicode/brkiter.h b/source/common/unicode/brkiter.h
+index bdd3cc700f46e62e56f1fa84bfe0a6dcf18406da..180033661b12fa135782f23a6fa72ff8efb07878 100644
+--- a/source/common/unicode/brkiter.h
++++ b/source/common/unicode/brkiter.h
+@@ -284,6 +284,21 @@ public:
+ virtual int32_t next(int32_t n) = 0;
+
+ /**
++ * For RuleBasedBreakIterators, return the status tag from the
++ * break rule that determined the most recently
++ * returned break position.
++ * <p>
++ * For break iterator types that do not support a rule status,
++ * a default value of 0 is returned.
++ * <p>
++ * @return the status from the break rule that determined the most recently
++ * returned break position.
++ * @see RuleBaseBreakIterator::getRuleStatus()
++ * @see UWordBreak
++ */
++ virtual int32_t getRuleStatus() const;
++
++ /**
+ * Create BreakIterator for word-breaks using the given locale.
+ * Returns an instance of a BreakIterator implementing word breaks.
+ * WordBreak is useful for word selection (ex. double click)
diff --git a/source/common/brkiter.cpp b/source/common/brkiter.cpp
index 26f7b6a..41da826 100644
--- a/source/common/brkiter.cpp
+++ b/source/common/brkiter.cpp
@@ -436,6 +436,13 @@
return locBased.getLocaleID(type, status);
}
+// This implementation of getRuleStatus is a do-nothing stub, here to
+// provide a default implementation for any derived BreakIterator classes that
+// do not implement it themselves.
+int32_t BreakIterator::getRuleStatus() const {
+ return 0;
+}
+
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
diff --git a/source/common/unicode/brkiter.h b/source/common/unicode/brkiter.h
index bdd3cc7..1800336 100644
--- a/source/common/unicode/brkiter.h
+++ b/source/common/unicode/brkiter.h
@@ -284,6 +284,21 @@
virtual int32_t next(int32_t n) = 0;
/**
+ * For RuleBasedBreakIterators, return the status tag from the
+ * break rule that determined the most recently
+ * returned break position.
+ * <p>
+ * For break iterator types that do not support a rule status,
+ * a default value of 0 is returned.
+ * <p>
+ * @return the status from the break rule that determined the most recently
+ * returned break position.
+ * @see RuleBaseBreakIterator::getRuleStatus()
+ * @see UWordBreak
+ */
+ virtual int32_t getRuleStatus() const;
+
+ /**
* Create BreakIterator for word-breaks using the given locale.
* Returns an instance of a BreakIterator implementing word breaks.
* WordBreak is useful for word selection (ex. double click)