summaryrefslogtreecommitdiffstats
path: root/icu/src/main/native/ScopedJavaUnicodeString.h
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-04-12 18:32:50 -0700
committerElliott Hughes <enh@google.com>2010-04-13 10:56:37 -0700
commit9de899cc3ffd3aa3f8f827201cbe14120609018b (patch)
tree0c81bf39b8c8e1d393c31a9e7e68a4de7e4c9fe7 /icu/src/main/native/ScopedJavaUnicodeString.h
parent4a6cd08d55ec407dea29586cc917f8a423f5645f (diff)
downloadlibcore-9de899cc3ffd3aa3f8f827201cbe14120609018b.zip
libcore-9de899cc3ffd3aa3f8f827201cbe14120609018b.tar.gz
libcore-9de899cc3ffd3aa3f8f827201cbe14120609018b.tar.bz2
Fix String.toLowerCase and toUpperCase.
Rather than try to cope with Lithuanian, let's just hand that one to ICU4C. I've removed my hand-crafted Azeri/Turkish lowercasing too, in favor of ICU. Presence of a high surrogate (which implies a supplemental character) is a good reason to hand over to ICU too. On the uppercasing side, I've kept our existing hard-coded table and just added code to defer to ICU for Azeri, Lithuanian, and Turkish (plus supplemental characters). I don't like the tables, but I don't have proof that they're incorrect. Bug: 2340628 Change-Id: I36b556b0444623a5aacc1afc58ebb4d84211d3dc
Diffstat (limited to 'icu/src/main/native/ScopedJavaUnicodeString.h')
-rw-r--r--icu/src/main/native/ScopedJavaUnicodeString.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/icu/src/main/native/ScopedJavaUnicodeString.h b/icu/src/main/native/ScopedJavaUnicodeString.h
index 69726fb..b108a6b 100644
--- a/icu/src/main/native/ScopedJavaUnicodeString.h
+++ b/icu/src/main/native/ScopedJavaUnicodeString.h
@@ -22,9 +22,7 @@
// A smart pointer that provides access to an ICU UnicodeString given a JNI
// jstring. We give ICU a direct pointer to the characters on the Java heap.
-// It's clever enough to copy-on-write if necessary, but we only provide
-// const UnicodeString access anyway because attempted write access seems
-// likely to be an error.
+// It's clever enough to copy-on-write if necessary.
class ScopedJavaUnicodeString {
public:
ScopedJavaUnicodeString(JNIEnv* env, jstring s) : mEnv(env), mString(s) {
@@ -37,7 +35,11 @@ public:
mEnv->ReleaseStringChars(mString, mChars);
}
- const UnicodeString& unicodeString() {
+ const UnicodeString& unicodeString() const {
+ return mUnicodeString;
+ }
+
+ UnicodeString& unicodeString() {
return mUnicodeString;
}