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
00084 U_STABLE int32_t U_EXPORT2
00085 u_strlen(const UChar *s);
00101 U_STABLE int32_t U_EXPORT2
00102 u_countChar32(const UChar *s, int32_t length);
00103
00122 U_STABLE UBool U_EXPORT2
00123 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
00124
00135 U_STABLE UChar* U_EXPORT2
00136 u_strcat(UChar *dst,
00137 const UChar *src);
00138
00153 U_STABLE UChar* U_EXPORT2
00154 u_strncat(UChar *dst,
00155 const UChar *src,
00156 int32_t n);
00157
00178 U_STABLE UChar * U_EXPORT2
00179 u_strstr(const UChar *s, const UChar *substring);
00180
00202 U_STABLE UChar * U_EXPORT2
00203 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00204
00222 U_STABLE UChar * U_EXPORT2
00223 u_strchr(const UChar *s, UChar c);
00224
00242 U_STABLE UChar * U_EXPORT2
00243 u_strchr32(const UChar *s, UChar32 c);
00244
00265 U_STABLE UChar * U_EXPORT2
00266 u_strrstr(const UChar *s, const UChar *substring);
00267
00289 U_STABLE UChar * U_EXPORT2
00290 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
00291
00309 U_STABLE UChar * U_EXPORT2
00310 u_strrchr(const UChar *s, UChar c);
00311
00329 U_STABLE UChar * U_EXPORT2
00330 u_strrchr32(const UChar *s, UChar32 c);
00331
00344 U_STABLE UChar * U_EXPORT2
00345 u_strpbrk(const UChar *string, const UChar *matchSet);
00346
00360 U_STABLE int32_t U_EXPORT2
00361 u_strcspn(const UChar *string, const UChar *matchSet);
00362
00376 U_STABLE int32_t U_EXPORT2
00377 u_strspn(const UChar *string, const UChar *matchSet);
00378
00404 U_STABLE UChar * U_EXPORT2
00405 u_strtok_r(UChar *src,
00406 const UChar *delim,
00407 UChar **saveState);
00408
00419 U_STABLE int32_t U_EXPORT2
00420 u_strcmp(const UChar *s1,
00421 const UChar *s2);
00422
00434 U_STABLE int32_t U_EXPORT2
00435 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
00436
00464 U_STABLE int32_t U_EXPORT2
00465 u_strCompare(const UChar *s1, int32_t length1,
00466 const UChar *s2, int32_t length2,
00467 UBool codePointOrder);
00468
00489 U_STABLE int32_t U_EXPORT2
00490 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
00491
00492 #ifndef U_COMPARE_CODE_POINT_ORDER
00493
00499 #define U_COMPARE_CODE_POINT_ORDER 0x8000
00500 #endif
00501
00542 U_STABLE int32_t U_EXPORT2
00543 u_strCaseCompare(const UChar *s1, int32_t length1,
00544 const UChar *s2, int32_t length2,
00545 uint32_t options,
00546 UErrorCode *pErrorCode);
00547
00560 U_STABLE int32_t U_EXPORT2
00561 u_strncmp(const UChar *ucs1,
00562 const UChar *ucs2,
00563 int32_t n);
00564
00578 U_STABLE int32_t U_EXPORT2
00579 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
00580
00600 U_STABLE int32_t U_EXPORT2
00601 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
00602
00624 U_STABLE int32_t U_EXPORT2
00625 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
00626
00648 U_STABLE int32_t U_EXPORT2
00649 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
00650
00659 U_STABLE UChar* U_EXPORT2
00660 u_strcpy(UChar *dst,
00661 const UChar *src);
00662
00674 U_STABLE UChar* U_EXPORT2
00675 u_strncpy(UChar *dst,
00676 const UChar *src,
00677 int32_t n);
00678
00679 #if !UCONFIG_NO_CONVERSION
00680
00691 U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
00692 const char *src );
00693
00706 U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
00707 const char *src,
00708 int32_t n);
00709
00720 U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
00721 const UChar *src );
00722
00735 U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
00736 const UChar *src,
00737 int32_t n );
00738
00739 #endif
00740
00749 U_STABLE UChar* U_EXPORT2
00750 u_memcpy(UChar *dest, const UChar *src, int32_t count);
00751
00760 U_STABLE UChar* U_EXPORT2
00761 u_memmove(UChar *dest, const UChar *src, int32_t count);
00762
00772 U_STABLE UChar* U_EXPORT2
00773 u_memset(UChar *dest, UChar c, int32_t count);
00774
00786 U_STABLE int32_t U_EXPORT2
00787 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
00788
00802 U_STABLE int32_t U_EXPORT2
00803 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
00804
00822 U_STABLE UChar* U_EXPORT2
00823 u_memchr(const UChar *s, UChar c, int32_t count);
00824
00842 U_STABLE UChar* U_EXPORT2
00843 u_memchr32(const UChar *s, UChar32 c, int32_t count);
00844
00862 U_STABLE UChar* U_EXPORT2
00863 u_memrchr(const UChar *s, UChar c, int32_t count);
00864
00882 U_STABLE UChar* U_EXPORT2
00883 u_memrchr32(const UChar *s, UChar32 c, int32_t count);
00884
00921 #if U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
00922 # define U_STRING_DECL(var, cs, length) static const wchar_t var[(length)+1]={ L ## cs }
00923
00924 # define U_STRING_INIT(var, cs, length)
00925 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
00926 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]={ (const UChar *)cs }
00927
00928 # define U_STRING_INIT(var, cs, length)
00929 #else
00930 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
00931
00932 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
00933 #endif
00934
00982 U_STABLE int32_t U_EXPORT2
00983 u_unescape(const char *src,
00984 UChar *dest, int32_t destCapacity);
00985
00986 U_CDECL_BEGIN
00999 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
01000 U_CDECL_END
01001
01030 U_STABLE UChar32 U_EXPORT2
01031 u_unescapeAt(UNESCAPE_CHAR_AT charAt,
01032 int32_t *offset,
01033 int32_t length,
01034 void *context);
01035
01056 U_STABLE int32_t U_EXPORT2
01057 u_strToUpper(UChar *dest, int32_t destCapacity,
01058 const UChar *src, int32_t srcLength,
01059 const char *locale,
01060 UErrorCode *pErrorCode);
01061
01082 U_STABLE int32_t U_EXPORT2
01083 u_strToLower(UChar *dest, int32_t destCapacity,
01084 const UChar *src, int32_t srcLength,
01085 const char *locale,
01086 UErrorCode *pErrorCode);
01087
01088 #if !UCONFIG_NO_BREAK_ITERATION
01089
01128 U_STABLE int32_t U_EXPORT2
01129 u_strToTitle(UChar *dest, int32_t destCapacity,
01130 const UChar *src, int32_t srcLength,
01131 UBreakIterator *titleIter,
01132 const char *locale,
01133 UErrorCode *pErrorCode);
01134
01135 #endif
01136
01159 U_STABLE int32_t U_EXPORT2
01160 u_strFoldCase(UChar *dest, int32_t destCapacity,
01161 const UChar *src, int32_t srcLength,
01162 uint32_t options,
01163 UErrorCode *pErrorCode);
01164
01165 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
01166
01185 U_STABLE wchar_t* U_EXPORT2
01186 u_strToWCS(wchar_t *dest,
01187 int32_t destCapacity,
01188 int32_t *pDestLength,
01189 const UChar *src,
01190 int32_t srcLength,
01191 UErrorCode *pErrorCode);
01211 U_STABLE UChar* U_EXPORT2
01212 u_strFromWCS(UChar *dest,
01213 int32_t destCapacity,
01214 int32_t *pDestLength,
01215 const wchar_t *src,
01216 int32_t srcLength,
01217 UErrorCode *pErrorCode);
01218 #endif
01219
01241 U_STABLE char* U_EXPORT2
01242 u_strToUTF8(char *dest,
01243 int32_t destCapacity,
01244 int32_t *pDestLength,
01245 const UChar *src,
01246 int32_t srcLength,
01247 UErrorCode *pErrorCode);
01248
01270 U_STABLE UChar* U_EXPORT2
01271 u_strFromUTF8(UChar *dest,
01272 int32_t destCapacity,
01273 int32_t *pDestLength,
01274 const char *src,
01275 int32_t srcLength,
01276 UErrorCode *pErrorCode);
01277
01312 U_DRAFT char* U_EXPORT2
01313 u_strToUTF8WithSub(char *dest,
01314 int32_t destCapacity,
01315 int32_t *pDestLength,
01316 const UChar *src,
01317 int32_t srcLength,
01318 UChar32 subchar, int32_t *pNumSubstitutions,
01319 UErrorCode *pErrorCode);
01320
01356 U_DRAFT UChar* U_EXPORT2
01357 u_strFromUTF8WithSub(UChar *dest,
01358 int32_t destCapacity,
01359 int32_t *pDestLength,
01360 const char *src,
01361 int32_t srcLength,
01362 UChar32 subchar, int32_t *pNumSubstitutions,
01363 UErrorCode *pErrorCode);
01364
01412 U_CAPI UChar * U_EXPORT2
01413 u_strFromUTF8Lenient(UChar *dest,
01414 int32_t destCapacity,
01415 int32_t *pDestLength,
01416 const char *src,
01417 int32_t srcLength,
01418 UErrorCode *pErrorCode);
01419
01439 U_STABLE UChar32* U_EXPORT2
01440 u_strToUTF32(UChar32 *dest,
01441 int32_t destCapacity,
01442 int32_t *pDestLength,
01443 const UChar *src,
01444 int32_t srcLength,
01445 UErrorCode *pErrorCode);
01446
01466 U_STABLE UChar* U_EXPORT2
01467 u_strFromUTF32(UChar *dest,
01468 int32_t destCapacity,
01469 int32_t *pDestLength,
01470 const UChar32 *src,
01471 int32_t srcLength,
01472 UErrorCode *pErrorCode);
01473
01474 #endif