00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef USTRING_H
00017 #define USTRING_H
00018
00019 #include "unicode/utypes.h"
00020 #include "unicode/putil.h"
00021 #include "unicode/uiter.h"
00022
00024 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
00025 # define UBRK_TYPEDEF_UBREAK_ITERATOR
00026 typedef void UBreakIterator;
00027 #endif
00028
00085 U_STABLE int32_t U_EXPORT2
00086 u_strlen(const UChar *s);
00102 U_STABLE int32_t U_EXPORT2
00103 u_countChar32(const UChar *s, int32_t length);
00104
00123 U_STABLE UBool U_EXPORT2
00124 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
00125
00136 U_STABLE UChar* U_EXPORT2
00137 u_strcat(UChar *dst,
00138 const UChar *src);
00139
00154 U_STABLE UChar* U_EXPORT2
00155 u_strncat(UChar *dst,
00156 const UChar *src,
00157 int32_t n);
00158
00179 U_STABLE UChar * U_EXPORT2
00180 u_strstr(const UChar *s, const UChar *substring);
00181
00203 U_STABLE UChar * U_EXPORT2
00204 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00205
00223 U_STABLE UChar * U_EXPORT2
00224 u_strchr(const UChar *s, UChar c);
00225
00243 U_STABLE UChar * U_EXPORT2
00244 u_strchr32(const UChar *s, UChar32 c);
00245
00266 U_STABLE UChar * U_EXPORT2
00267 u_strrstr(const UChar *s, const UChar *substring);
00268
00290 U_STABLE UChar * U_EXPORT2
00291 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00292
00310 U_STABLE UChar * U_EXPORT2
00311 u_strrchr(const UChar *s, UChar c);
00312
00330 U_STABLE UChar * U_EXPORT2
00331 u_strrchr32(const UChar *s, UChar32 c);
00332
00345 U_STABLE UChar * U_EXPORT2
00346 u_strpbrk(const UChar *string, const UChar *matchSet);
00347
00361 U_STABLE int32_t U_EXPORT2
00362 u_strcspn(const UChar *string, const UChar *matchSet);
00363
00377 U_STABLE int32_t U_EXPORT2
00378 u_strspn(const UChar *string, const UChar *matchSet);
00379
00405 U_STABLE UChar * U_EXPORT2
00406 u_strtok_r(UChar *src,
00407 const UChar *delim,
00408 UChar **saveState);
00409
00420 U_STABLE int32_t U_EXPORT2
00421 u_strcmp(const UChar *s1,
00422 const UChar *s2);
00423
00435 U_STABLE int32_t U_EXPORT2
00436 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
00437
00465 U_STABLE int32_t U_EXPORT2
00466 u_strCompare(const UChar *s1, int32_t length1,
00467 const UChar *s2, int32_t length2,
00468 UBool codePointOrder);
00469
00490 U_STABLE int32_t U_EXPORT2
00491 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
00492
00493 #ifndef U_COMPARE_CODE_POINT_ORDER
00494
00500 #define U_COMPARE_CODE_POINT_ORDER 0x8000
00501 #endif
00502
00543 U_STABLE int32_t U_EXPORT2
00544 u_strCaseCompare(const UChar *s1, int32_t length1,
00545 const UChar *s2, int32_t length2,
00546 uint32_t options,
00547 UErrorCode *pErrorCode);
00548
00561 U_STABLE int32_t U_EXPORT2
00562 u_strncmp(const UChar *ucs1,
00563 const UChar *ucs2,
00564 int32_t n);
00565
00579 U_STABLE int32_t U_EXPORT2
00580 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
00581
00601 U_STABLE int32_t U_EXPORT2
00602 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
00603
00625 U_STABLE int32_t U_EXPORT2
00626 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
00627
00649 U_STABLE int32_t U_EXPORT2
00650 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
00651
00660 U_STABLE UChar* U_EXPORT2
00661 u_strcpy(UChar *dst,
00662 const UChar *src);
00663
00675 U_STABLE UChar* U_EXPORT2
00676 u_strncpy(UChar *dst,
00677 const UChar *src,
00678 int32_t n);
00679
00680 #if !UCONFIG_NO_CONVERSION
00681
00692 U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
00693 const char *src );
00694
00707 U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
00708 const char *src,
00709 int32_t n);
00710
00721 U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
00722 const UChar *src );
00723
00736 U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
00737 const UChar *src,
00738 int32_t n );
00739
00740 #endif
00741
00750 U_STABLE UChar* U_EXPORT2
00751 u_memcpy(UChar *dest, const UChar *src, int32_t count);
00752
00761 U_STABLE UChar* U_EXPORT2
00762 u_memmove(UChar *dest, const UChar *src, int32_t count);
00763
00773 U_STABLE UChar* U_EXPORT2
00774 u_memset(UChar *dest, UChar c, int32_t count);
00775
00787 U_STABLE int32_t U_EXPORT2
00788 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
00789
00803 U_STABLE int32_t U_EXPORT2
00804 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
00805
00823 U_STABLE UChar* U_EXPORT2
00824 u_memchr(const UChar *s, UChar c, int32_t count);
00825
00843 U_STABLE UChar* U_EXPORT2
00844 u_memchr32(const UChar *s, UChar32 c, int32_t count);
00845
00863 U_STABLE UChar* U_EXPORT2
00864 u_memrchr(const UChar *s, UChar c, int32_t count);
00865
00883 U_STABLE UChar* U_EXPORT2
00884 u_memrchr32(const UChar *s, UChar32 c, int32_t count);
00885
00936 #if defined(U_DECLARE_UTF16)
00937 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs)
00938
00939 # define U_STRING_INIT(var, cs, length)
00940 #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
00941 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
00942
00943 # define U_STRING_INIT(var, cs, length)
00944 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
00945 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs
00946
00947 # define U_STRING_INIT(var, cs, length)
00948 #else
00949 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
00950
00951 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
00952 #endif
00953
01001 U_STABLE int32_t U_EXPORT2
01002 u_unescape(const char *src,
01003 UChar *dest, int32_t destCapacity);
01004
01005 U_CDECL_BEGIN
01018 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
01019 U_CDECL_END
01020
01049 U_STABLE UChar32 U_EXPORT2
01050 u_unescapeAt(UNESCAPE_CHAR_AT charAt,
01051 int32_t *offset,
01052 int32_t length,
01053 void *context);
01054
01075 U_STABLE int32_t U_EXPORT2
01076 u_strToUpper(UChar *dest, int32_t destCapacity,
01077 const UChar *src, int32_t srcLength,
01078 const char *locale,
01079 UErrorCode *pErrorCode);
01080
01101 U_STABLE int32_t U_EXPORT2
01102 u_strToLower(UChar *dest, int32_t destCapacity,
01103 const UChar *src, int32_t srcLength,
01104 const char *locale,
01105 UErrorCode *pErrorCode);
01106
01107 #if !UCONFIG_NO_BREAK_ITERATION
01108
01147 U_STABLE int32_t U_EXPORT2
01148 u_strToTitle(UChar *dest, int32_t destCapacity,
01149 const UChar *src, int32_t srcLength,
01150 UBreakIterator *titleIter,
01151 const char *locale,
01152 UErrorCode *pErrorCode);
01153
01154 #endif
01155
01178 U_STABLE int32_t U_EXPORT2
01179 u_strFoldCase(UChar *dest, int32_t destCapacity,
01180 const UChar *src, int32_t srcLength,
01181 uint32_t options,
01182 UErrorCode *pErrorCode);
01183
01184 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
01185
01207 U_STABLE wchar_t* U_EXPORT2
01208 u_strToWCS(wchar_t *dest,
01209 int32_t destCapacity,
01210 int32_t *pDestLength,
01211 const UChar *src,
01212 int32_t srcLength,
01213 UErrorCode *pErrorCode);
01236 U_STABLE UChar* U_EXPORT2
01237 u_strFromWCS(UChar *dest,
01238 int32_t destCapacity,
01239 int32_t *pDestLength,
01240 const wchar_t *src,
01241 int32_t srcLength,
01242 UErrorCode *pErrorCode);
01243 #endif
01244
01267 U_STABLE char* U_EXPORT2
01268 u_strToUTF8(char *dest,
01269 int32_t destCapacity,
01270 int32_t *pDestLength,
01271 const UChar *src,
01272 int32_t srcLength,
01273 UErrorCode *pErrorCode);
01274
01297 U_STABLE UChar* U_EXPORT2
01298 u_strFromUTF8(UChar *dest,
01299 int32_t destCapacity,
01300 int32_t *pDestLength,
01301 const char *src,
01302 int32_t srcLength,
01303 UErrorCode *pErrorCode);
01304
01341 U_STABLE char* U_EXPORT2
01342 u_strToUTF8WithSub(char *dest,
01343 int32_t destCapacity,
01344 int32_t *pDestLength,
01345 const UChar *src,
01346 int32_t srcLength,
01347 UChar32 subchar, int32_t *pNumSubstitutions,
01348 UErrorCode *pErrorCode);
01349
01387 U_STABLE UChar* U_EXPORT2
01388 u_strFromUTF8WithSub(UChar *dest,
01389 int32_t destCapacity,
01390 int32_t *pDestLength,
01391 const char *src,
01392 int32_t srcLength,
01393 UChar32 subchar, int32_t *pNumSubstitutions,
01394 UErrorCode *pErrorCode);
01395
01447 U_STABLE UChar * U_EXPORT2
01448 u_strFromUTF8Lenient(UChar *dest,
01449 int32_t destCapacity,
01450 int32_t *pDestLength,
01451 const char *src,
01452 int32_t srcLength,
01453 UErrorCode *pErrorCode);
01454
01477 U_STABLE UChar32* U_EXPORT2
01478 u_strToUTF32(UChar32 *dest,
01479 int32_t destCapacity,
01480 int32_t *pDestLength,
01481 const UChar *src,
01482 int32_t srcLength,
01483 UErrorCode *pErrorCode);
01484
01507 U_STABLE UChar* U_EXPORT2
01508 u_strFromUTF32(UChar *dest,
01509 int32_t destCapacity,
01510 int32_t *pDestLength,
01511 const UChar32 *src,
01512 int32_t srcLength,
01513 UErrorCode *pErrorCode);
01514
01551 U_DRAFT UChar32* U_EXPORT2
01552 u_strToUTF32WithSub(UChar32 *dest,
01553 int32_t destCapacity,
01554 int32_t *pDestLength,
01555 const UChar *src,
01556 int32_t srcLength,
01557 UChar32 subchar, int32_t *pNumSubstitutions,
01558 UErrorCode *pErrorCode);
01559
01596 U_DRAFT UChar* U_EXPORT2
01597 u_strFromUTF32WithSub(UChar *dest,
01598 int32_t destCapacity,
01599 int32_t *pDestLength,
01600 const UChar32 *src,
01601 int32_t srcLength,
01602 UChar32 subchar, int32_t *pNumSubstitutions,
01603 UErrorCode *pErrorCode);
01604
01605 #endif