Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * |
michael@0 | 4 | * Copyright (C) 1998-2012, International Business Machines |
michael@0 | 5 | * Corporation and others. All Rights Reserved. |
michael@0 | 6 | * |
michael@0 | 7 | ******************************************************************************* |
michael@0 | 8 | * |
michael@0 | 9 | * File ustr.h |
michael@0 | 10 | * |
michael@0 | 11 | * Modification History: |
michael@0 | 12 | * |
michael@0 | 13 | * Date Name Description |
michael@0 | 14 | * 05/28/99 stephen Creation. |
michael@0 | 15 | ******************************************************************************* |
michael@0 | 16 | */ |
michael@0 | 17 | |
michael@0 | 18 | #ifndef USTR_H |
michael@0 | 19 | #define USTR_H 1 |
michael@0 | 20 | |
michael@0 | 21 | #include "unicode/utypes.h" |
michael@0 | 22 | |
michael@0 | 23 | #define U_APPEND_CHAR32(c,target,len) { \ |
michael@0 | 24 | if (c <= 0xffff) \ |
michael@0 | 25 | { \ |
michael@0 | 26 | *(target)++ = (UChar) c; \ |
michael@0 | 27 | len=1; \ |
michael@0 | 28 | } \ |
michael@0 | 29 | else \ |
michael@0 | 30 | { \ |
michael@0 | 31 | target[0] = U16_LEAD(c); \ |
michael@0 | 32 | target[1] = U16_TRAIL(c); \ |
michael@0 | 33 | len=2; \ |
michael@0 | 34 | target +=2; \ |
michael@0 | 35 | } \ |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | #define U_APPEND_CHAR32_ONLY(c,target) { \ |
michael@0 | 39 | if (c <= 0xffff) \ |
michael@0 | 40 | { \ |
michael@0 | 41 | *(target)++ = (UChar) c; \ |
michael@0 | 42 | } \ |
michael@0 | 43 | else \ |
michael@0 | 44 | { \ |
michael@0 | 45 | target[0] = U16_LEAD(c); \ |
michael@0 | 46 | target[1] = U16_TRAIL(c); \ |
michael@0 | 47 | target +=2; \ |
michael@0 | 48 | } \ |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | /* A C representation of a string "object" (to avoid realloc all the time) */ |
michael@0 | 52 | struct UString { |
michael@0 | 53 | UChar *fChars; |
michael@0 | 54 | int32_t fLength; |
michael@0 | 55 | int32_t fCapacity; |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | U_CFUNC void ustr_init(struct UString *s); |
michael@0 | 59 | |
michael@0 | 60 | U_CFUNC void |
michael@0 | 61 | ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status); |
michael@0 | 62 | |
michael@0 | 63 | U_CFUNC void ustr_deinit(struct UString *s); |
michael@0 | 64 | |
michael@0 | 65 | U_CFUNC void ustr_setlen(struct UString *s, int32_t len, UErrorCode *status); |
michael@0 | 66 | |
michael@0 | 67 | U_CFUNC void ustr_cpy(struct UString *dst, const struct UString *src, |
michael@0 | 68 | UErrorCode *status); |
michael@0 | 69 | |
michael@0 | 70 | U_CFUNC void ustr_cat(struct UString *dst, const struct UString *src, |
michael@0 | 71 | UErrorCode *status); |
michael@0 | 72 | |
michael@0 | 73 | U_CFUNC void ustr_ncat(struct UString *dst, const struct UString *src, |
michael@0 | 74 | int32_t n, UErrorCode *status); |
michael@0 | 75 | |
michael@0 | 76 | U_CFUNC void ustr_ucat(struct UString *dst, UChar c, UErrorCode *status); |
michael@0 | 77 | U_CFUNC void ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status); |
michael@0 | 78 | U_CFUNC void ustr_uscat(struct UString *dst, const UChar* src,int len,UErrorCode *status); |
michael@0 | 79 | #endif |