| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************************* | 2 ******************************************************************************* |
| 3 * | 3 * |
| 4 * Copyright (C) 1999-2004, International Business Machines | 4 * Copyright (C) 1999-2004, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
| 6 * | 6 * |
| 7 ******************************************************************************* | 7 ******************************************************************************* |
| 8 * file name: utf.h | 8 * file name: utf.h |
| 9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
| 10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
| 11 * indentation:4 | 11 * indentation:4 |
| 12 * | 12 * |
| 13 * created on: 1999sep09 | 13 * created on: 1999sep09 |
| 14 * created by: Markus W. Scherer | 14 * created by: Markus W. Scherer |
| 15 */ | 15 */ |
| 16 | 16 |
| 17 #ifndef BASE_THIRD_PARTY_ICU_ICU_UTF_H_ | 17 #ifndef BASE_THIRD_PARTY_ICU_ICU_UTF_H_ |
| 18 #define BASE_THIRD_PARTY_ICU_ICU_UTF_H_ | 18 #define BASE_THIRD_PARTY_ICU_ICU_UTF_H_ |
| 19 | 19 |
| 20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
| 21 | 21 |
| 22 namespace base_icu { | 22 namespace base_icu { |
| 23 | 23 |
| 24 typedef uint32 UChar32; | 24 typedef uint32 UChar32; |
| 25 typedef uint16 UChar; |
| 25 typedef int8 UBool; | 26 typedef int8 UBool; |
| 26 | 27 |
| 27 // General --------------------------------------------------------------------- | 28 // General --------------------------------------------------------------------- |
| 28 // from utf.h | 29 // from utf.h |
| 29 | 30 |
| 30 /** | 31 /** |
| 31 * This value is intended for sentinel values for APIs that | 32 * This value is intended for sentinel values for APIs that |
| 32 * (take or) return single code points (UChar32). | 33 * (take or) return single code points (UChar32). |
| 33 * It is outside of the Unicode code point range 0..0x10ffff. | 34 * It is outside of the Unicode code point range 0..0x10ffff. |
| 34 * | 35 * |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 (((base_icu::UChar32)(lead)<<10UL)+(base_icu::UChar32)(trail)-CBU16_SURROGAT
E_OFFSET) | 298 (((base_icu::UChar32)(lead)<<10UL)+(base_icu::UChar32)(trail)-CBU16_SURROGAT
E_OFFSET) |
| 298 | 299 |
| 299 | 300 |
| 300 /** | 301 /** |
| 301 * Get the lead surrogate (0xd800..0xdbff) for a | 302 * Get the lead surrogate (0xd800..0xdbff) for a |
| 302 * supplementary code point (0x10000..0x10ffff). | 303 * supplementary code point (0x10000..0x10ffff). |
| 303 * @param supplementary 32-bit code point (U+10000..U+10ffff) | 304 * @param supplementary 32-bit code point (U+10000..U+10ffff) |
| 304 * @return lead surrogate (U+d800..U+dbff) for supplementary | 305 * @return lead surrogate (U+d800..U+dbff) for supplementary |
| 305 * @stable ICU 2.4 | 306 * @stable ICU 2.4 |
| 306 */ | 307 */ |
| 307 #define CBU16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) | 308 #define CBU16_LEAD(supplementary) (base_icu::UChar)(((supplementary)>>10)+0xd7c0
) |
| 308 | 309 |
| 309 /** | 310 /** |
| 310 * Get the trail surrogate (0xdc00..0xdfff) for a | 311 * Get the trail surrogate (0xdc00..0xdfff) for a |
| 311 * supplementary code point (0x10000..0x10ffff). | 312 * supplementary code point (0x10000..0x10ffff). |
| 312 * @param supplementary 32-bit code point (U+10000..U+10ffff) | 313 * @param supplementary 32-bit code point (U+10000..U+10ffff) |
| 313 * @return trail surrogate (U+dc00..U+dfff) for supplementary | 314 * @return trail surrogate (U+dc00..U+dfff) for supplementary |
| 314 * @stable ICU 2.4 | 315 * @stable ICU 2.4 |
| 315 */ | 316 */ |
| 316 #define CBU16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) | 317 #define CBU16_TRAIL(supplementary) (base_icu::UChar)(((supplementary)&0x3ff)|0xd
c00) |
| 317 | 318 |
| 318 /** | 319 /** |
| 319 * How many 16-bit code units are used to encode this Unicode code point? (1 or
2) | 320 * How many 16-bit code units are used to encode this Unicode code point? (1 or
2) |
| 320 * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff)
. | 321 * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff)
. |
| 321 * @param c 32-bit code point | 322 * @param c 32-bit code point |
| 322 * @return 1 or 2 | 323 * @return 1 or 2 |
| 323 * @stable ICU 2.4 | 324 * @stable ICU 2.4 |
| 324 */ | 325 */ |
| 325 #define CBU16_LENGTH(c) ((uint32)(c)<=0xffff ? 1 : 2) | 326 #define CBU16_LENGTH(c) ((uint32)(c)<=0xffff ? 1 : 2) |
| 326 | 327 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 (s)[(i)++]=(uint16)(c); \ | 380 (s)[(i)++]=(uint16)(c); \ |
| 380 } else { \ | 381 } else { \ |
| 381 (s)[(i)++]=(uint16)(((c)>>10)+0xd7c0); \ | 382 (s)[(i)++]=(uint16)(((c)>>10)+0xd7c0); \ |
| 382 (s)[(i)++]=(uint16)(((c)&0x3ff)|0xdc00); \ | 383 (s)[(i)++]=(uint16)(((c)&0x3ff)|0xdc00); \ |
| 383 } \ | 384 } \ |
| 384 } | 385 } |
| 385 | 386 |
| 386 } // namesapce base_icu | 387 } // namesapce base_icu |
| 387 | 388 |
| 388 #endif // BASE_THIRD_PARTY_ICU_ICU_UTF_H_ | 389 #endif // BASE_THIRD_PARTY_ICU_ICU_UTF_H_ |
| OLD | NEW |