1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/tools/genrb/ustr.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +/* 1.5 +******************************************************************************* 1.6 +* 1.7 +* Copyright (C) 1998-2012, International Business Machines 1.8 +* Corporation and others. All Rights Reserved. 1.9 +* 1.10 +******************************************************************************* 1.11 +* 1.12 +* File ustr.h 1.13 +* 1.14 +* Modification History: 1.15 +* 1.16 +* Date Name Description 1.17 +* 05/28/99 stephen Creation. 1.18 +******************************************************************************* 1.19 +*/ 1.20 + 1.21 +#ifndef USTR_H 1.22 +#define USTR_H 1 1.23 + 1.24 +#include "unicode/utypes.h" 1.25 + 1.26 +#define U_APPEND_CHAR32(c,target,len) { \ 1.27 + if (c <= 0xffff) \ 1.28 + { \ 1.29 + *(target)++ = (UChar) c; \ 1.30 + len=1; \ 1.31 + } \ 1.32 + else \ 1.33 + { \ 1.34 + target[0] = U16_LEAD(c); \ 1.35 + target[1] = U16_TRAIL(c); \ 1.36 + len=2; \ 1.37 + target +=2; \ 1.38 + } \ 1.39 +} 1.40 + 1.41 +#define U_APPEND_CHAR32_ONLY(c,target) { \ 1.42 + if (c <= 0xffff) \ 1.43 + { \ 1.44 + *(target)++ = (UChar) c; \ 1.45 + } \ 1.46 + else \ 1.47 + { \ 1.48 + target[0] = U16_LEAD(c); \ 1.49 + target[1] = U16_TRAIL(c); \ 1.50 + target +=2; \ 1.51 + } \ 1.52 +} 1.53 + 1.54 +/* A C representation of a string "object" (to avoid realloc all the time) */ 1.55 +struct UString { 1.56 + UChar *fChars; 1.57 + int32_t fLength; 1.58 + int32_t fCapacity; 1.59 +}; 1.60 + 1.61 +U_CFUNC void ustr_init(struct UString *s); 1.62 + 1.63 +U_CFUNC void 1.64 +ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status); 1.65 + 1.66 +U_CFUNC void ustr_deinit(struct UString *s); 1.67 + 1.68 +U_CFUNC void ustr_setlen(struct UString *s, int32_t len, UErrorCode *status); 1.69 + 1.70 +U_CFUNC void ustr_cpy(struct UString *dst, const struct UString *src, 1.71 + UErrorCode *status); 1.72 + 1.73 +U_CFUNC void ustr_cat(struct UString *dst, const struct UString *src, 1.74 + UErrorCode *status); 1.75 + 1.76 +U_CFUNC void ustr_ncat(struct UString *dst, const struct UString *src, 1.77 + int32_t n, UErrorCode *status); 1.78 + 1.79 +U_CFUNC void ustr_ucat(struct UString *dst, UChar c, UErrorCode *status); 1.80 +U_CFUNC void ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status); 1.81 +U_CFUNC void ustr_uscat(struct UString *dst, const UChar* src,int len,UErrorCode *status); 1.82 +#endif