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
00930 #if defined(U_DECLARE_UTF16)
00931 # define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs)
00932
00933 # define U_STRING_INIT(var, cs, length)
00934 #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
00935 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
00936
00937 # define U_STRING_INIT(var, cs, length)
00938 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
00939 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs
00940
00941 # define U_STRING_INIT(var, cs, length)
00942 #else
00943 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
00944
00945 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
00946 #endif
00947
00995 U_STABLE int32_t U_EXPORT2
00996 u_unescape(const char *src,
00997 UChar *dest, int32_t destCapacity);
00998
00999 U_CDECL_BEGIN
01012 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
01013 U_CDECL_END
01014
01043 U_STABLE UChar32 U_EXPORT2
01044 u_unescapeAt(UNESCAPE_CHAR_AT charAt,
01045 int32_t *offset,
01046 int32_t length,
01047 void *context);
01048
01069 U_STABLE int32_t U_EXPORT2
01070 u_strToUpper(UChar *dest, int32_t destCapacity,
01071 const UChar *src, int32_t srcLength,
01072 const char *locale,
01073 UErrorCode *pErrorCode);
01074
01095 U_STABLE int32_t U_EXPORT2
01096 u_strToLower(UChar *dest, int32_t destCapacity,
01097 const UChar *src, int32_t srcLength,
01098 const char *locale,
01099 UErrorCode *pErrorCode);
01100
01101 #if !UCONFIG_NO_BREAK_ITERATION
01102
01141 U_STABLE int32_t U_EXPORT2
01142 u_strToTitle(UChar *dest, int32_t destCapacity,
01143 const UChar *src, int32_t srcLength,
01144 UBreakIterator *titleIter,
01145 const char *locale,
01146 UErrorCode *pErrorCode);
01147
01148 #endif
01149
01174 U_STABLE int32_t U_EXPORT2
01175 u_strFoldCase(UChar *dest, int32_t destCapacity,
01176 const UChar *src, int32_t srcLength,
01177 uint32_t options,
01178 UErrorCode *pErrorCode);
01179
01180 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
01181
01203 U_STABLE wchar_t* U_EXPORT2
01204 u_strToWCS(wchar_t *dest,
01205 int32_t destCapacity,
01206 int32_t *pDestLength,
01207 const UChar *src,
01208 int32_t srcLength,
01209 UErrorCode *pErrorCode);
01232 U_STABLE UChar* U_EXPORT2
01233 u_strFromWCS(UChar *dest,
01234 int32_t destCapacity,
01235 int32_t *pDestLength,
01236 const wchar_t *src,
01237 int32_t srcLength,
01238 UErrorCode *pErrorCode);
01239 #endif
01240
01263 U_STABLE char* U_EXPORT2
01264 u_strToUTF8(char *dest,
01265 int32_t destCapacity,
01266 int32_t *pDestLength,
01267 const UChar *src,
01268 int32_t srcLength,
01269 UErrorCode *pErrorCode);
01270
01293 U_STABLE UChar* U_EXPORT2
01294 u_strFromUTF8(UChar *dest,
01295 int32_t destCapacity,
01296 int32_t *pDestLength,
01297 const char *src,
01298 int32_t srcLength,
01299 UErrorCode *pErrorCode);
01300
01336 U_STABLE char* U_EXPORT2
01337 u_strToUTF8WithSub(char *dest,
01338 int32_t destCapacity,
01339 int32_t *pDestLength,
01340 const UChar *src,
01341 int32_t srcLength,
01342 UChar32 subchar, int32_t *pNumSubstitutions,
01343 UErrorCode *pErrorCode);
01344
01381 U_STABLE UChar* U_EXPORT2
01382 u_strFromUTF8WithSub(UChar *dest,
01383 int32_t destCapacity,
01384 int32_t *pDestLength,
01385 const char *src,
01386 int32_t srcLength,
01387 UChar32 subchar, int32_t *pNumSubstitutions,
01388 UErrorCode *pErrorCode);
01389
01441 U_STABLE UChar * U_EXPORT2
01442 u_strFromUTF8Lenient(UChar *dest,
01443 int32_t destCapacity,
01444 int32_t *pDestLength,
01445 const char *src,
01446 int32_t srcLength,
01447 UErrorCode *pErrorCode);
01448
01471 U_STABLE UChar32* U_EXPORT2
01472 u_strToUTF32(UChar32 *dest,
01473 int32_t destCapacity,
01474 int32_t *pDestLength,
01475 const UChar *src,
01476 int32_t srcLength,
01477 UErrorCode *pErrorCode);
01478
01501 U_STABLE UChar* U_EXPORT2
01502 u_strFromUTF32(UChar *dest,
01503 int32_t destCapacity,
01504 int32_t *pDestLength,
01505 const UChar32 *src,
01506 int32_t srcLength,
01507 UErrorCode *pErrorCode);
01508
01544 U_STABLE UChar32* U_EXPORT2
01545 u_strToUTF32WithSub(UChar32 *dest,
01546 int32_t destCapacity,
01547 int32_t *pDestLength,
01548 const UChar *src,
01549 int32_t srcLength,
01550 UChar32 subchar, int32_t *pNumSubstitutions,
01551 UErrorCode *pErrorCode);
01552
01588 U_STABLE UChar* U_EXPORT2
01589 u_strFromUTF32WithSub(UChar *dest,
01590 int32_t destCapacity,
01591 int32_t *pDestLength,
01592 const UChar32 *src,
01593 int32_t srcLength,
01594 UChar32 subchar, int32_t *pNumSubstitutions,
01595 UErrorCode *pErrorCode);
01596
01629 U_STABLE char* U_EXPORT2
01630 u_strToJavaModifiedUTF8(
01631 char *dest,
01632 int32_t destCapacity,
01633 int32_t *pDestLength,
01634 const UChar *src,
01635 int32_t srcLength,
01636 UErrorCode *pErrorCode);
01637
01679 U_STABLE UChar* U_EXPORT2
01680 u_strFromJavaModifiedUTF8WithSub(
01681 UChar *dest,
01682 int32_t destCapacity,
01683 int32_t *pDestLength,
01684 const char *src,
01685 int32_t srcLength,
01686 UChar32 subchar, int32_t *pNumSubstitutions,
01687 UErrorCode *pErrorCode);
01688
01689 #endif