1999-08-16 21:50:52 +00:00
|
|
|
/*
|
|
|
|
*******************************************************************************
|
1999-12-13 22:28:37 +00:00
|
|
|
*
|
2012-05-03 05:50:26 +00:00
|
|
|
* Copyright (C) 1998-2012, International Business Machines
|
1999-12-13 22:28:37 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
1999-08-16 21:50:52 +00:00
|
|
|
*******************************************************************************
|
|
|
|
*
|
|
|
|
* File ustr.h
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
|
|
|
* 05/28/99 stephen Creation.
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef USTR_H
|
|
|
|
#define USTR_H 1
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/utypes.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2002-04-23 22:25:44 +00:00
|
|
|
#define U_APPEND_CHAR32(c,target,len) { \
|
|
|
|
if (c <= 0xffff) \
|
|
|
|
{ \
|
|
|
|
*(target)++ = (UChar) c; \
|
|
|
|
len=1; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
2004-11-11 23:34:58 +00:00
|
|
|
target[0] = U16_LEAD(c); \
|
|
|
|
target[1] = U16_TRAIL(c); \
|
2002-04-23 22:25:44 +00:00
|
|
|
len=2; \
|
2004-11-11 23:34:58 +00:00
|
|
|
target +=2; \
|
2002-04-23 22:25:44 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2012-05-03 05:50:26 +00:00
|
|
|
#define U_APPEND_CHAR32_ONLY(c,target) { \
|
|
|
|
if (c <= 0xffff) \
|
|
|
|
{ \
|
|
|
|
*(target)++ = (UChar) c; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
target[0] = U16_LEAD(c); \
|
|
|
|
target[1] = U16_TRAIL(c); \
|
|
|
|
target +=2; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
/* A C representation of a string "object" (to avoid realloc all the time) */
|
|
|
|
struct UString {
|
|
|
|
UChar *fChars;
|
|
|
|
int32_t fLength;
|
|
|
|
int32_t fCapacity;
|
|
|
|
};
|
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void ustr_init(struct UString *s);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void
|
2000-07-14 22:31:35 +00:00
|
|
|
ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status);
|
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void ustr_deinit(struct UString *s);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void ustr_setlen(struct UString *s, int32_t len, UErrorCode *status);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void ustr_cpy(struct UString *dst, const struct UString *src,
|
|
|
|
UErrorCode *status);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void ustr_cat(struct UString *dst, const struct UString *src,
|
|
|
|
UErrorCode *status);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void ustr_ncat(struct UString *dst, const struct UString *src,
|
|
|
|
int32_t n, UErrorCode *status);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2011-05-26 20:05:39 +00:00
|
|
|
U_CFUNC void ustr_ucat(struct UString *dst, UChar c, UErrorCode *status);
|
|
|
|
U_CFUNC void ustr_u32cat(struct UString *dst, UChar32 c, UErrorCode *status);
|
|
|
|
U_CFUNC void ustr_uscat(struct UString *dst, const UChar* src,int len,UErrorCode *status);
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|