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_CAPI int32_t U_EXPORT2
00093 u_strlen(const UChar *s);
00109 U_CAPI int32_t U_EXPORT2
00110 u_countChar32(const UChar *s, int32_t length);
00111
00130 U_CAPI UBool U_EXPORT2
00131 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
00132
00143 U_CAPI UChar* U_EXPORT2
00144 u_strcat(UChar *dst,
00145 const UChar *src);
00146
00161 U_CAPI UChar* U_EXPORT2
00162 u_strncat(UChar *dst,
00163 const UChar *src,
00164 int32_t n);
00165
00186 U_CAPI UChar * U_EXPORT2
00187 u_strstr(const UChar *s, const UChar *substring);
00188
00210 U_CAPI UChar * U_EXPORT2
00211 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00212
00230 U_CAPI UChar * U_EXPORT2
00231 u_strchr(const UChar *s, UChar c);
00232
00250 U_CAPI UChar * U_EXPORT2
00251 u_strchr32(const UChar *s, UChar32 c);
00252
00273 U_CAPI UChar * U_EXPORT2
00274 u_strrstr(const UChar *s, const UChar *substring);
00275
00297 U_CAPI UChar * U_EXPORT2
00298 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00299
00317 U_CAPI UChar * U_EXPORT2
00318 u_strrchr(const UChar *s, UChar c);
00319
00337 U_CAPI UChar * U_EXPORT2
00338 u_strrchr32(const UChar *s, UChar32 c);
00339
00352 U_CAPI UChar * U_EXPORT2
00353 u_strpbrk(const UChar *string, const UChar *matchSet);
00354
00368 U_CAPI int32_t U_EXPORT2
00369 u_strcspn(const UChar *string, const UChar *matchSet);
00370
00384 U_CAPI int32_t U_EXPORT2
00385 u_strspn(const UChar *string, const UChar *matchSet);
00386
00412 U_CAPI UChar * U_EXPORT2
00413 u_strtok_r(UChar *src,
00414 const UChar *delim,
00415 UChar **saveState);
00416
00427 U_CAPI int32_t U_EXPORT2
00428 u_strcmp(const UChar *s1,
00429 const UChar *s2);
00430
00442 U_CAPI int32_t U_EXPORT2
00443 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
00444
00472 U_CAPI 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_CAPI int32_t U_EXPORT2
00498 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
00499
00540 U_CAPI 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_CAPI int32_t U_EXPORT2
00559 u_strncmp(const UChar *ucs1,
00560 const UChar *ucs2,
00561 int32_t n);
00562
00576 U_CAPI int32_t U_EXPORT2
00577 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
00578
00598 U_CAPI int32_t U_EXPORT2
00599 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
00600
00622 U_CAPI int32_t U_EXPORT2
00623 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
00624
00646 U_CAPI int32_t U_EXPORT2
00647 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
00648
00657 U_CAPI UChar* U_EXPORT2
00658 u_strcpy(UChar *dst,
00659 const UChar *src);
00660
00672 U_CAPI 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_CAPI UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
00690 const char *src );
00691
00704 U_CAPI UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
00705 const char *src,
00706 int32_t n);
00707
00718 U_CAPI char* U_EXPORT2 u_austrcpy(char *dst,
00719 const UChar *src );
00720
00733 U_CAPI char* U_EXPORT2 u_austrncpy(char *dst,
00734 const UChar *src,
00735 int32_t n );
00736
00737 #endif
00738
00747 U_CAPI UChar* U_EXPORT2
00748 u_memcpy(UChar *dest, const UChar *src, int32_t count);
00749
00758 U_CAPI UChar* U_EXPORT2
00759 u_memmove(UChar *dest, const UChar *src, int32_t count);
00760
00770 U_CAPI UChar* U_EXPORT2
00771 u_memset(UChar *dest, UChar c, int32_t count);
00772
00784 U_CAPI int32_t U_EXPORT2
00785 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
00786
00800 U_CAPI int32_t U_EXPORT2
00801 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
00802
00820 U_CAPI UChar* U_EXPORT2
00821 u_memchr(const UChar *s, UChar c, int32_t count);
00822
00840 U_CAPI UChar* U_EXPORT2
00841 u_memchr32(const UChar *s, UChar32 c, int32_t count);
00842
00860 U_CAPI UChar* U_EXPORT2
00861 u_memrchr(const UChar *s, UChar c, int32_t count);
00862
00880 U_CAPI 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 || 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 #else
00939 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
00940
00941 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
00942 #endif
00943
00991 U_CAPI int32_t U_EXPORT2
00992 u_unescape(const char *src,
00993 UChar *dest, int32_t destCapacity);
00994
00995 U_CDECL_BEGIN
01008 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
01009 U_CDECL_END
01010
01039 U_CAPI UChar32 U_EXPORT2
01040 u_unescapeAt(UNESCAPE_CHAR_AT charAt,
01041 int32_t *offset,
01042 int32_t length,
01043 void *context);
01044
01065 U_CAPI int32_t U_EXPORT2
01066 u_strToUpper(UChar *dest, int32_t destCapacity,
01067 const UChar *src, int32_t srcLength,
01068 const char *locale,
01069 UErrorCode *pErrorCode);
01070
01091 U_CAPI int32_t U_EXPORT2
01092 u_strToLower(UChar *dest, int32_t destCapacity,
01093 const UChar *src, int32_t srcLength,
01094 const char *locale,
01095 UErrorCode *pErrorCode);
01096
01097 #if !UCONFIG_NO_BREAK_ITERATION
01098
01137 U_CAPI int32_t U_EXPORT2
01138 u_strToTitle(UChar *dest, int32_t destCapacity,
01139 const UChar *src, int32_t srcLength,
01140 UBreakIterator *titleIter,
01141 const char *locale,
01142 UErrorCode *pErrorCode);
01143
01144 #endif
01145
01170 U_CAPI int32_t U_EXPORT2
01171 u_strFoldCase(UChar *dest, int32_t destCapacity,
01172 const UChar *src, int32_t srcLength,
01173 uint32_t options,
01174 UErrorCode *pErrorCode);
01175
01176 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
01177
01199 U_CAPI wchar_t* U_EXPORT2
01200 u_strToWCS(wchar_t *dest,
01201 int32_t destCapacity,
01202 int32_t *pDestLength,
01203 const UChar *src,
01204 int32_t srcLength,
01205 UErrorCode *pErrorCode);
01228 U_CAPI UChar* U_EXPORT2
01229 u_strFromWCS(UChar *dest,
01230 int32_t destCapacity,
01231 int32_t *pDestLength,
01232 const wchar_t *src,
01233 int32_t srcLength,
01234 UErrorCode *pErrorCode);
01235 #endif
01236
01259 U_CAPI char* U_EXPORT2
01260 u_strToUTF8(char *dest,
01261 int32_t destCapacity,
01262 int32_t *pDestLength,
01263 const UChar *src,
01264 int32_t srcLength,
01265 UErrorCode *pErrorCode);
01266
01289 U_CAPI UChar* U_EXPORT2
01290 u_strFromUTF8(UChar *dest,
01291 int32_t destCapacity,
01292 int32_t *pDestLength,
01293 const char *src,
01294 int32_t srcLength,
01295 UErrorCode *pErrorCode);
01296
01332 U_CAPI char* U_EXPORT2
01333 u_strToUTF8WithSub(char *dest,
01334 int32_t destCapacity,
01335 int32_t *pDestLength,
01336 const UChar *src,
01337 int32_t srcLength,
01338 UChar32 subchar, int32_t *pNumSubstitutions,
01339 UErrorCode *pErrorCode);
01340
01377 U_CAPI UChar* U_EXPORT2
01378 u_strFromUTF8WithSub(UChar *dest,
01379 int32_t destCapacity,
01380 int32_t *pDestLength,
01381 const char *src,
01382 int32_t srcLength,
01383 UChar32 subchar, int32_t *pNumSubstitutions,
01384 UErrorCode *pErrorCode);
01385
01437 U_CAPI UChar * U_EXPORT2
01438 u_strFromUTF8Lenient(UChar *dest,
01439 int32_t destCapacity,
01440 int32_t *pDestLength,
01441 const char *src,
01442 int32_t srcLength,
01443 UErrorCode *pErrorCode);
01444
01467 U_CAPI UChar32* U_EXPORT2
01468 u_strToUTF32(UChar32 *dest,
01469 int32_t destCapacity,
01470 int32_t *pDestLength,
01471 const UChar *src,
01472 int32_t srcLength,
01473 UErrorCode *pErrorCode);
01474
01497 U_CAPI UChar* U_EXPORT2
01498 u_strFromUTF32(UChar *dest,
01499 int32_t destCapacity,
01500 int32_t *pDestLength,
01501 const UChar32 *src,
01502 int32_t srcLength,
01503 UErrorCode *pErrorCode);
01504
01540 U_CAPI UChar32* U_EXPORT2
01541 u_strToUTF32WithSub(UChar32 *dest,
01542 int32_t destCapacity,
01543 int32_t *pDestLength,
01544 const UChar *src,
01545 int32_t srcLength,
01546 UChar32 subchar, int32_t *pNumSubstitutions,
01547 UErrorCode *pErrorCode);
01548
01584 U_CAPI UChar* U_EXPORT2
01585 u_strFromUTF32WithSub(UChar *dest,
01586 int32_t destCapacity,
01587 int32_t *pDestLength,
01588 const UChar32 *src,
01589 int32_t srcLength,
01590 UChar32 subchar, int32_t *pNumSubstitutions,
01591 UErrorCode *pErrorCode);
01592
01625 U_CAPI char* U_EXPORT2
01626 u_strToJavaModifiedUTF8(
01627 char *dest,
01628 int32_t destCapacity,
01629 int32_t *pDestLength,
01630 const UChar *src,
01631 int32_t srcLength,
01632 UErrorCode *pErrorCode);
01633
01675 U_CAPI UChar* U_EXPORT2
01676 u_strFromJavaModifiedUTF8WithSub(
01677 UChar *dest,
01678 int32_t destCapacity,
01679 int32_t *pDestLength,
01680 const char *src,
01681 int32_t srcLength,
01682 UChar32 subchar, int32_t *pNumSubstitutions,
01683 UErrorCode *pErrorCode);
01684
01685 #endif