00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef USTRING_H
00019 #define USTRING_H
00020
00021 #include "unicode/utypes.h"
00022 #include "unicode/putil.h"
00023 #include "unicode/uiter.h"
00024
00030 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
00031 # define UBRK_TYPEDEF_UBREAK_ITERATOR
00032
00033 typedef struct UBreakIterator UBreakIterator;
00034 #endif
00035
00092 U_STABLE int32_t U_EXPORT2
00093 u_strlen(const UChar *s);
00109 U_STABLE int32_t U_EXPORT2
00110 u_countChar32(const UChar *s, int32_t length);
00111
00130 U_STABLE UBool U_EXPORT2
00131 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
00132
00143 U_STABLE UChar* U_EXPORT2
00144 u_strcat(UChar *dst,
00145 const UChar *src);
00146
00161 U_STABLE UChar* U_EXPORT2
00162 u_strncat(UChar *dst,
00163 const UChar *src,
00164 int32_t n);
00165
00186 U_STABLE UChar * U_EXPORT2
00187 u_strstr(const UChar *s, const UChar *substring);
00188
00210 U_STABLE UChar * U_EXPORT2
00211 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00212
00230 U_STABLE UChar * U_EXPORT2
00231 u_strchr(const UChar *s, UChar c);
00232
00250 U_STABLE UChar * U_EXPORT2
00251 u_strchr32(const UChar *s, UChar32 c);
00252
00273 U_STABLE UChar * U_EXPORT2
00274 u_strrstr(const UChar *s, const UChar *substring);
00275
00297 U_STABLE UChar * U_EXPORT2
00298 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00299
00317 U_STABLE UChar * U_EXPORT2
00318 u_strrchr(const UChar *s, UChar c);
00319
00337 U_STABLE UChar * U_EXPORT2
00338 u_strrchr32(const UChar *s, UChar32 c);
00339
00352 U_STABLE UChar * U_EXPORT2
00353 u_strpbrk(const UChar *string, const UChar *matchSet);
00354
00368 U_STABLE int32_t U_EXPORT2
00369 u_strcspn(const UChar *string, const UChar *matchSet);
00370
00384 U_STABLE int32_t U_EXPORT2
00385 u_strspn(const UChar *string, const UChar *matchSet);
00386
00412 U_STABLE UChar * U_EXPORT2
00413 u_strtok_r(UChar *src,
00414 const UChar *delim,
00415 UChar **saveState);
00416
00427 U_STABLE int32_t U_EXPORT2
00428 u_strcmp(const UChar *s1,
00429 const UChar *s2);
00430
00442 U_STABLE int32_t U_EXPORT2
00443 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
00444
00472 U_STABLE int32_t U_EXPORT2
00473 u_strCompare(const UChar *s1, int32_t length1,
00474 const UChar *s2, int32_t length2,
00475 UBool codePointOrder);
00476
00497 U_STABLE int32_t U_EXPORT2
00498 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
00499
00540 U_STABLE int32_t U_EXPORT2
00541 u_strCaseCompare(const UChar *s1, int32_t length1,
00542 const UChar *s2, int32_t length2,
00543 uint32_t options,
00544 UErrorCode *pErrorCode);
00545
00558 U_STABLE int32_t U_EXPORT2
00559 u_strncmp(const UChar *ucs1,
00560 const UChar *ucs2,
00561 int32_t n);
00562
00576 U_STABLE int32_t U_EXPORT2
00577 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
00578
00598 U_STABLE int32_t U_EXPORT2
00599 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
00600
00622 U_STABLE int32_t U_EXPORT2
00623 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
00624
00646 U_STABLE int32_t U_EXPORT2
00647 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
00648
00657 U_STABLE UChar* U_EXPORT2
00658 u_strcpy(UChar *dst,
00659 const UChar *src);
00660
00672 U_STABLE UChar* U_EXPORT2
00673 u_strncpy(UChar *dst,
00674 const UChar *src,
00675 int32_t n);
00676
00677 #if !UCONFIG_NO_CONVERSION
00678
00689 U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
00690 const char *src );
00691
00704 U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
00705 const char *src,
00706 int32_t n);
00707
00718 U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
00719 const UChar *src );
00720
00733 U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
00734 const UChar *src,
00735 int32_t n );
00736
00737 #endif
00738
00747 U_STABLE UChar* U_EXPORT2
00748 u_memcpy(UChar *dest, const UChar *src, int32_t count);
00749
00758 U_STABLE UChar* U_EXPORT2
00759 u_memmove(UChar *dest, const UChar *src, int32_t count);
00760
00770 U_STABLE UChar* U_EXPORT2
00771 u_memset(UChar *dest, UChar c, int32_t count);
00772
00784 U_STABLE int32_t U_EXPORT2
00785 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
00786
00800 U_STABLE int32_t U_EXPORT2
00801 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
00802
00820 U_STABLE UChar* U_EXPORT2
00821 u_memchr(const UChar *s, UChar c, int32_t count);
00822
00840 U_STABLE UChar* U_EXPORT2
00841 u_memchr32(const UChar *s, UChar32 c, int32_t count);
00842
00860 U_STABLE UChar* U_EXPORT2
00861 u_memrchr(const UChar *s, UChar c, int32_t count);
00862
00880 U_STABLE UChar* U_EXPORT2
00881 u_memrchr32(const UChar *s, UChar32 c, int32_t count);
00882
00933 #if defined(U_DECLARE_UTF16)
00934 # define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs)
00935
00936 # define U_STRING_INIT(var, cs, length)
00937 #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
00938 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
00939
00940 # define U_STRING_INIT(var, cs, length)
00941 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
00942 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs
00943
00944 # define U_STRING_INIT(var, cs, length)
00945 #else
00946 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
00947
00948 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
00949 #endif
00950
00998 U_STABLE int32_t U_EXPORT2
00999 u_unescape(const char *src,
01000 UChar *dest, int32_t destCapacity);
01001
01002 U_CDECL_BEGIN
01015 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
01016 U_CDECL_END
01017
01046 U_STABLE UChar32 U_EXPORT2
01047 u_unescapeAt(UNESCAPE_CHAR_AT charAt,
01048 int32_t *offset,
01049 int32_t length,
01050 void *context);
01051
01072 U_STABLE int32_t U_EXPORT2
01073 u_strToUpper(UChar *dest, int32_t destCapacity,
01074 const UChar *src, int32_t srcLength,
01075 const char *locale,
01076 UErrorCode *pErrorCode);
01077
01098 U_STABLE int32_t U_EXPORT2
01099 u_strToLower(UChar *dest, int32_t destCapacity,
01100 const UChar *src, int32_t srcLength,
01101 const char *locale,
01102 UErrorCode *pErrorCode);
01103
01104 #if !UCONFIG_NO_BREAK_ITERATION
01105
01144 U_STABLE int32_t U_EXPORT2
01145 u_strToTitle(UChar *dest, int32_t destCapacity,
01146 const UChar *src, int32_t srcLength,
01147 UBreakIterator *titleIter,
01148 const char *locale,
01149 UErrorCode *pErrorCode);
01150
01151 #endif
01152
01177 U_STABLE int32_t U_EXPORT2
01178 u_strFoldCase(UChar *dest, int32_t destCapacity,
01179 const UChar *src, int32_t srcLength,
01180 uint32_t options,
01181 UErrorCode *pErrorCode);
01182
01183 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
01184
01206 U_STABLE wchar_t* U_EXPORT2
01207 u_strToWCS(wchar_t *dest,
01208 int32_t destCapacity,
01209 int32_t *pDestLength,
01210 const UChar *src,
01211 int32_t srcLength,
01212 UErrorCode *pErrorCode);
01235 U_STABLE UChar* U_EXPORT2
01236 u_strFromWCS(UChar *dest,
01237 int32_t destCapacity,
01238 int32_t *pDestLength,
01239 const wchar_t *src,
01240 int32_t srcLength,
01241 UErrorCode *pErrorCode);
01242 #endif
01243
01266 U_STABLE char* U_EXPORT2
01267 u_strToUTF8(char *dest,
01268 int32_t destCapacity,
01269 int32_t *pDestLength,
01270 const UChar *src,
01271 int32_t srcLength,
01272 UErrorCode *pErrorCode);
01273
01296 U_STABLE UChar* U_EXPORT2
01297 u_strFromUTF8(UChar *dest,
01298 int32_t destCapacity,
01299 int32_t *pDestLength,
01300 const char *src,
01301 int32_t srcLength,
01302 UErrorCode *pErrorCode);
01303
01339 U_STABLE char* U_EXPORT2
01340 u_strToUTF8WithSub(char *dest,
01341 int32_t destCapacity,
01342 int32_t *pDestLength,
01343 const UChar *src,
01344 int32_t srcLength,
01345 UChar32 subchar, int32_t *pNumSubstitutions,
01346 UErrorCode *pErrorCode);
01347
01384 U_STABLE UChar* U_EXPORT2
01385 u_strFromUTF8WithSub(UChar *dest,
01386 int32_t destCapacity,
01387 int32_t *pDestLength,
01388 const char *src,
01389 int32_t srcLength,
01390 UChar32 subchar, int32_t *pNumSubstitutions,
01391 UErrorCode *pErrorCode);
01392
01444 U_STABLE UChar * U_EXPORT2
01445 u_strFromUTF8Lenient(UChar *dest,
01446 int32_t destCapacity,
01447 int32_t *pDestLength,
01448 const char *src,
01449 int32_t srcLength,
01450 UErrorCode *pErrorCode);
01451
01474 U_STABLE UChar32* U_EXPORT2
01475 u_strToUTF32(UChar32 *dest,
01476 int32_t destCapacity,
01477 int32_t *pDestLength,
01478 const UChar *src,
01479 int32_t srcLength,
01480 UErrorCode *pErrorCode);
01481
01504 U_STABLE UChar* U_EXPORT2
01505 u_strFromUTF32(UChar *dest,
01506 int32_t destCapacity,
01507 int32_t *pDestLength,
01508 const UChar32 *src,
01509 int32_t srcLength,
01510 UErrorCode *pErrorCode);
01511
01547 U_STABLE UChar32* U_EXPORT2
01548 u_strToUTF32WithSub(UChar32 *dest,
01549 int32_t destCapacity,
01550 int32_t *pDestLength,
01551 const UChar *src,
01552 int32_t srcLength,
01553 UChar32 subchar, int32_t *pNumSubstitutions,
01554 UErrorCode *pErrorCode);
01555
01591 U_STABLE UChar* U_EXPORT2
01592 u_strFromUTF32WithSub(UChar *dest,
01593 int32_t destCapacity,
01594 int32_t *pDestLength,
01595 const UChar32 *src,
01596 int32_t srcLength,
01597 UChar32 subchar, int32_t *pNumSubstitutions,
01598 UErrorCode *pErrorCode);
01599
01632 U_STABLE char* U_EXPORT2
01633 u_strToJavaModifiedUTF8(
01634 char *dest,
01635 int32_t destCapacity,
01636 int32_t *pDestLength,
01637 const UChar *src,
01638 int32_t srcLength,
01639 UErrorCode *pErrorCode);
01640
01682 U_STABLE UChar* U_EXPORT2
01683 u_strFromJavaModifiedUTF8WithSub(
01684 UChar *dest,
01685 int32_t destCapacity,
01686 int32_t *pDestLength,
01687 const char *src,
01688 int32_t srcLength,
01689 UChar32 subchar, int32_t *pNumSubstitutions,
01690 UErrorCode *pErrorCode);
01691
01692 #endif