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
00028 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
00029 # define UBRK_TYPEDEF_UBREAK_ITERATOR
00030
00031 typedef struct UBreakIterator UBreakIterator;
00032 #endif
00033
00090 U_STABLE int32_t U_EXPORT2
00091 u_strlen(const UChar *s);
00107 U_STABLE int32_t U_EXPORT2
00108 u_countChar32(const UChar *s, int32_t length);
00109
00128 U_STABLE UBool U_EXPORT2
00129 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
00130
00141 U_STABLE UChar* U_EXPORT2
00142 u_strcat(UChar *dst,
00143 const UChar *src);
00144
00159 U_STABLE UChar* U_EXPORT2
00160 u_strncat(UChar *dst,
00161 const UChar *src,
00162 int32_t n);
00163
00184 U_STABLE UChar * U_EXPORT2
00185 u_strstr(const UChar *s, const UChar *substring);
00186
00208 U_STABLE UChar * U_EXPORT2
00209 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00210
00228 U_STABLE UChar * U_EXPORT2
00229 u_strchr(const UChar *s, UChar c);
00230
00248 U_STABLE UChar * U_EXPORT2
00249 u_strchr32(const UChar *s, UChar32 c);
00250
00271 U_STABLE UChar * U_EXPORT2
00272 u_strrstr(const UChar *s, const UChar *substring);
00273
00295 U_STABLE UChar * U_EXPORT2
00296 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00297
00315 U_STABLE UChar * U_EXPORT2
00316 u_strrchr(const UChar *s, UChar c);
00317
00335 U_STABLE UChar * U_EXPORT2
00336 u_strrchr32(const UChar *s, UChar32 c);
00337
00350 U_STABLE UChar * U_EXPORT2
00351 u_strpbrk(const UChar *string, const UChar *matchSet);
00352
00366 U_STABLE int32_t U_EXPORT2
00367 u_strcspn(const UChar *string, const UChar *matchSet);
00368
00382 U_STABLE int32_t U_EXPORT2
00383 u_strspn(const UChar *string, const UChar *matchSet);
00384
00410 U_STABLE UChar * U_EXPORT2
00411 u_strtok_r(UChar *src,
00412 const UChar *delim,
00413 UChar **saveState);
00414
00425 U_STABLE int32_t U_EXPORT2
00426 u_strcmp(const UChar *s1,
00427 const UChar *s2);
00428
00440 U_STABLE int32_t U_EXPORT2
00441 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
00442
00470 U_STABLE int32_t U_EXPORT2
00471 u_strCompare(const UChar *s1, int32_t length1,
00472 const UChar *s2, int32_t length2,
00473 UBool codePointOrder);
00474
00495 U_STABLE int32_t U_EXPORT2
00496 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
00497
00498 #ifndef U_COMPARE_CODE_POINT_ORDER
00499
00505 #define U_COMPARE_CODE_POINT_ORDER 0x8000
00506 #endif
00507
00548 U_STABLE int32_t U_EXPORT2
00549 u_strCaseCompare(const UChar *s1, int32_t length1,
00550 const UChar *s2, int32_t length2,
00551 uint32_t options,
00552 UErrorCode *pErrorCode);
00553
00566 U_STABLE int32_t U_EXPORT2
00567 u_strncmp(const UChar *ucs1,
00568 const UChar *ucs2,
00569 int32_t n);
00570
00584 U_STABLE int32_t U_EXPORT2
00585 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
00586
00606 U_STABLE int32_t U_EXPORT2
00607 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
00608
00630 U_STABLE int32_t U_EXPORT2
00631 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
00632
00654 U_STABLE int32_t U_EXPORT2
00655 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
00656
00665 U_STABLE UChar* U_EXPORT2
00666 u_strcpy(UChar *dst,
00667 const UChar *src);
00668
00680 U_STABLE UChar* U_EXPORT2
00681 u_strncpy(UChar *dst,
00682 const UChar *src,
00683 int32_t n);
00684
00685 #if !UCONFIG_NO_CONVERSION
00686
00697 U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
00698 const char *src );
00699
00712 U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
00713 const char *src,
00714 int32_t n);
00715
00726 U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
00727 const UChar *src );
00728
00741 U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
00742 const UChar *src,
00743 int32_t n );
00744
00745 #endif
00746
00755 U_STABLE UChar* U_EXPORT2
00756 u_memcpy(UChar *dest, const UChar *src, int32_t count);
00757
00766 U_STABLE UChar* U_EXPORT2
00767 u_memmove(UChar *dest, const UChar *src, int32_t count);
00768
00778 U_STABLE UChar* U_EXPORT2
00779 u_memset(UChar *dest, UChar c, int32_t count);
00780
00792 U_STABLE int32_t U_EXPORT2
00793 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
00794
00808 U_STABLE int32_t U_EXPORT2
00809 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
00810
00828 U_STABLE UChar* U_EXPORT2
00829 u_memchr(const UChar *s, UChar c, int32_t count);
00830
00848 U_STABLE UChar* U_EXPORT2
00849 u_memchr32(const UChar *s, UChar32 c, int32_t count);
00850
00868 U_STABLE UChar* U_EXPORT2
00869 u_memrchr(const UChar *s, UChar c, int32_t count);
00870
00888 U_STABLE UChar* U_EXPORT2
00889 u_memrchr32(const UChar *s, UChar32 c, int32_t count);
00890
00941 #if defined(U_DECLARE_UTF16)
00942 # define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs)
00943
00944 # define U_STRING_INIT(var, cs, length)
00945 #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
00946 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
00947
00948 # define U_STRING_INIT(var, cs, length)
00949 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
00950 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs
00951
00952 # define U_STRING_INIT(var, cs, length)
00953 #else
00954 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
00955
00956 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
00957 #endif
00958
01006 U_STABLE int32_t U_EXPORT2
01007 u_unescape(const char *src,
01008 UChar *dest, int32_t destCapacity);
01009
01010 U_CDECL_BEGIN
01023 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
01024 U_CDECL_END
01025
01054 U_STABLE UChar32 U_EXPORT2
01055 u_unescapeAt(UNESCAPE_CHAR_AT charAt,
01056 int32_t *offset,
01057 int32_t length,
01058 void *context);
01059
01080 U_STABLE int32_t U_EXPORT2
01081 u_strToUpper(UChar *dest, int32_t destCapacity,
01082 const UChar *src, int32_t srcLength,
01083 const char *locale,
01084 UErrorCode *pErrorCode);
01085
01106 U_STABLE int32_t U_EXPORT2
01107 u_strToLower(UChar *dest, int32_t destCapacity,
01108 const UChar *src, int32_t srcLength,
01109 const char *locale,
01110 UErrorCode *pErrorCode);
01111
01112 #if !UCONFIG_NO_BREAK_ITERATION
01113
01152 U_STABLE int32_t U_EXPORT2
01153 u_strToTitle(UChar *dest, int32_t destCapacity,
01154 const UChar *src, int32_t srcLength,
01155 UBreakIterator *titleIter,
01156 const char *locale,
01157 UErrorCode *pErrorCode);
01158
01159 #endif
01160
01185 U_STABLE int32_t U_EXPORT2
01186 u_strFoldCase(UChar *dest, int32_t destCapacity,
01187 const UChar *src, int32_t srcLength,
01188 uint32_t options,
01189 UErrorCode *pErrorCode);
01190
01191 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
01192
01214 U_STABLE wchar_t* U_EXPORT2
01215 u_strToWCS(wchar_t *dest,
01216 int32_t destCapacity,
01217 int32_t *pDestLength,
01218 const UChar *src,
01219 int32_t srcLength,
01220 UErrorCode *pErrorCode);
01243 U_STABLE UChar* U_EXPORT2
01244 u_strFromWCS(UChar *dest,
01245 int32_t destCapacity,
01246 int32_t *pDestLength,
01247 const wchar_t *src,
01248 int32_t srcLength,
01249 UErrorCode *pErrorCode);
01250 #endif
01251
01274 U_STABLE char* U_EXPORT2
01275 u_strToUTF8(char *dest,
01276 int32_t destCapacity,
01277 int32_t *pDestLength,
01278 const UChar *src,
01279 int32_t srcLength,
01280 UErrorCode *pErrorCode);
01281
01304 U_STABLE UChar* U_EXPORT2
01305 u_strFromUTF8(UChar *dest,
01306 int32_t destCapacity,
01307 int32_t *pDestLength,
01308 const char *src,
01309 int32_t srcLength,
01310 UErrorCode *pErrorCode);
01311
01348 U_STABLE char* U_EXPORT2
01349 u_strToUTF8WithSub(char *dest,
01350 int32_t destCapacity,
01351 int32_t *pDestLength,
01352 const UChar *src,
01353 int32_t srcLength,
01354 UChar32 subchar, int32_t *pNumSubstitutions,
01355 UErrorCode *pErrorCode);
01356
01394 U_STABLE UChar* U_EXPORT2
01395 u_strFromUTF8WithSub(UChar *dest,
01396 int32_t destCapacity,
01397 int32_t *pDestLength,
01398 const char *src,
01399 int32_t srcLength,
01400 UChar32 subchar, int32_t *pNumSubstitutions,
01401 UErrorCode *pErrorCode);
01402
01454 U_STABLE UChar * U_EXPORT2
01455 u_strFromUTF8Lenient(UChar *dest,
01456 int32_t destCapacity,
01457 int32_t *pDestLength,
01458 const char *src,
01459 int32_t srcLength,
01460 UErrorCode *pErrorCode);
01461
01484 U_STABLE UChar32* U_EXPORT2
01485 u_strToUTF32(UChar32 *dest,
01486 int32_t destCapacity,
01487 int32_t *pDestLength,
01488 const UChar *src,
01489 int32_t srcLength,
01490 UErrorCode *pErrorCode);
01491
01514 U_STABLE UChar* U_EXPORT2
01515 u_strFromUTF32(UChar *dest,
01516 int32_t destCapacity,
01517 int32_t *pDestLength,
01518 const UChar32 *src,
01519 int32_t srcLength,
01520 UErrorCode *pErrorCode);
01521
01558 U_STABLE UChar32* U_EXPORT2
01559 u_strToUTF32WithSub(UChar32 *dest,
01560 int32_t destCapacity,
01561 int32_t *pDestLength,
01562 const UChar *src,
01563 int32_t srcLength,
01564 UChar32 subchar, int32_t *pNumSubstitutions,
01565 UErrorCode *pErrorCode);
01566
01603 U_STABLE UChar* U_EXPORT2
01604 u_strFromUTF32WithSub(UChar *dest,
01605 int32_t destCapacity,
01606 int32_t *pDestLength,
01607 const UChar32 *src,
01608 int32_t srcLength,
01609 UChar32 subchar, int32_t *pNumSubstitutions,
01610 UErrorCode *pErrorCode);
01611
01644 U_STABLE char* U_EXPORT2
01645 u_strToJavaModifiedUTF8(
01646 char *dest,
01647 int32_t destCapacity,
01648 int32_t *pDestLength,
01649 const UChar *src,
01650 int32_t srcLength,
01651 UErrorCode *pErrorCode);
01652
01693 U_STABLE UChar* U_EXPORT2
01694 u_strFromJavaModifiedUTF8WithSub(
01695 UChar *dest,
01696 int32_t destCapacity,
01697 int32_t *pDestLength,
01698 const char *src,
01699 int32_t srcLength,
01700 UChar32 subchar, int32_t *pNumSubstitutions,
01701 UErrorCode *pErrorCode);
01702
01703 #endif