diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-12-08 13:41:38 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-12-08 13:41:38 -0800 |
commit | e6c0e99334bc2f47e5d36db253ac8f166047c03b (patch) | |
tree | 67a2ab651f0bb32587d2b074e45a7095630fb07d /include/utils | |
parent | 1270e2e22b0b3f0705cee2b82788d8dc3fb03cdb (diff) | |
parent | 19138468caf7050d482dc15f35a344eab11bb756 (diff) | |
download | frameworks_base-e6c0e99334bc2f47e5d36db253ac8f166047c03b.zip frameworks_base-e6c0e99334bc2f47e5d36db253ac8f166047c03b.tar.gz frameworks_base-e6c0e99334bc2f47e5d36db253ac8f166047c03b.tar.bz2 |
Merge change I129483f8 into eclair-mr2
* changes:
Optional use of UTF-8 strings in resource bundles
Diffstat (limited to 'include/utils')
-rw-r--r-- | include/utils/ResourceTypes.h | 9 | ||||
-rw-r--r-- | include/utils/String16.h | 5 | ||||
-rw-r--r-- | include/utils/String8.h | 8 |
3 files changed, 20 insertions, 2 deletions
diff --git a/include/utils/ResourceTypes.h b/include/utils/ResourceTypes.h index 49145e8..a845908 100644 --- a/include/utils/ResourceTypes.h +++ b/include/utils/ResourceTypes.h @@ -393,7 +393,10 @@ struct ResStringPool_header enum { // If set, the string index is sorted by the string values (based // on strcmp16()). - SORTED_FLAG = 1<<0 + SORTED_FLAG = 1<<0, + + // String pool is encoded in UTF-8 + UTF8_FLAG = 1<<8 }; uint32_t flags; @@ -456,9 +459,11 @@ private: void* mOwnedData; const ResStringPool_header* mHeader; size_t mSize; + mutable Mutex mDecodeLock; const uint32_t* mEntries; const uint32_t* mEntryStyles; - const char16_t* mStrings; + const void* mStrings; + char16_t** mCache; uint32_t mStringPoolSize; // number of uint16_t const uint32_t* mStyles; uint32_t mStylePoolSize; // number of uint32_t diff --git a/include/utils/String16.h b/include/utils/String16.h index a2d22ee..07a0c11 100644 --- a/include/utils/String16.h +++ b/include/utils/String16.h @@ -49,12 +49,17 @@ int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2); // Version of strzcmp16 for comparing strings in different endianness. int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2); +// Convert UTF-8 to UTF-16 including surrogate pairs +void utf8_to_utf16(const uint8_t *src, size_t srcLen, char16_t* dst, const size_t dstLen); + } // --------------------------------------------------------------------------- namespace android { +// --------------------------------------------------------------------------- + class String8; class TextOutput; diff --git a/include/utils/String8.h b/include/utils/String8.h index ecc5774..c4b18a4 100644 --- a/include/utils/String8.h +++ b/include/utils/String8.h @@ -60,6 +60,11 @@ size_t utf32_length(const char *src, size_t src_len); /* * Returns the UTF-8 length of "src". */ +size_t utf8_length_from_utf16(const char16_t *src, size_t src_len); + +/* + * Returns the UTF-8 length of "src". + */ size_t utf8_length_from_utf32(const char32_t *src, size_t src_len); /* @@ -120,6 +125,9 @@ size_t utf8_to_utf32(const char* src, size_t src_len, size_t utf32_to_utf8(const char32_t* src, size_t src_len, char* dst, size_t dst_len); +size_t utf16_to_utf8(const char16_t* src, size_t src_len, + char* dst, size_t dst_len); + } // --------------------------------------------------------------------------- |