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
00922 #if defined(U_DECLARE_UTF16)
00923 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs)
00924
00925 # define U_STRING_INIT(var, cs, length)
00926 #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
00927 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
00928
00929 # define U_STRING_INIT(var, cs, length)
00930 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
00931 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs
00932
00933 # define U_STRING_INIT(var, cs, length)
00934 #else
00935 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
00936
00937 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
00938 #endif
00939
00987 U_STABLE int32_t U_EXPORT2
00988 u_unescape(const char *src,
00989 UChar *dest, int32_t destCapacity);
00990
00991 U_CDECL_BEGIN
01004 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
01005 U_CDECL_END
01006
01035 U_STABLE UChar32 U_EXPORT2
01036 u_unescapeAt(UNESCAPE_CHAR_AT charAt,
01037 int32_t *offset,
01038 int32_t length,
01039 void *context);
01040
01061 U_STABLE int32_t U_EXPORT2
01062 u_strToUpper(UChar *dest, int32_t destCapacity,
01063 const UChar *src, int32_t srcLength,
01064 const char *locale,
01065 UErrorCode *pErrorCode);
01066
01087 U_STABLE int32_t U_EXPORT2
01088 u_strToLower(UChar *dest, int32_t destCapacity,
01089 const UChar *src, int32_t srcLength,
01090 const char *locale,
01091 UErrorCode *pErrorCode);
01092
01093 #if !UCONFIG_NO_BREAK_ITERATION
01094
01133 U_STABLE int32_t U_EXPORT2
01134 u_strToTitle(UChar *dest, int32_t destCapacity,
01135 const UChar *src, int32_t srcLength,
01136 UBreakIterator *titleIter,
01137 const char *locale,
01138 UErrorCode *pErrorCode);
01139
01140 #endif
01141
01164 U_STABLE int32_t U_EXPORT2
01165 u_strFoldCase(UChar *dest, int32_t destCapacity,
01166 const UChar *src, int32_t srcLength,
01167 uint32_t options,
01168 UErrorCode *pErrorCode);
01169
01170 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
01171
01190 U_STABLE wchar_t* U_EXPORT2
01191 u_strToWCS(wchar_t *dest,
01192 int32_t destCapacity,
01193 int32_t *pDestLength,
01194 const UChar *src,
01195 int32_t srcLength,
01196 UErrorCode *pErrorCode);
01216 U_STABLE UChar* U_EXPORT2
01217 u_strFromWCS(UChar *dest,
01218 int32_t destCapacity,
01219 int32_t *pDestLength,
01220 const wchar_t *src,
01221 int32_t srcLength,
01222 UErrorCode *pErrorCode);
01223 #endif
01224
01246 U_STABLE char* U_EXPORT2
01247 u_strToUTF8(char *dest,
01248 int32_t destCapacity,
01249 int32_t *pDestLength,
01250 const UChar *src,
01251 int32_t srcLength,
01252 UErrorCode *pErrorCode);
01253
01275 U_STABLE UChar* U_EXPORT2
01276 u_strFromUTF8(UChar *dest,
01277 int32_t destCapacity,
01278 int32_t *pDestLength,
01279 const char *src,
01280 int32_t srcLength,
01281 UErrorCode *pErrorCode);
01282
01317 U_STABLE char* U_EXPORT2
01318 u_strToUTF8WithSub(char *dest,
01319 int32_t destCapacity,
01320 int32_t *pDestLength,
01321 const UChar *src,
01322 int32_t srcLength,
01323 UChar32 subchar, int32_t *pNumSubstitutions,
01324 UErrorCode *pErrorCode);
01325
01361 U_STABLE UChar* U_EXPORT2
01362 u_strFromUTF8WithSub(UChar *dest,
01363 int32_t destCapacity,
01364 int32_t *pDestLength,
01365 const char *src,
01366 int32_t srcLength,
01367 UChar32 subchar, int32_t *pNumSubstitutions,
01368 UErrorCode *pErrorCode);
01369
01417 U_STABLE UChar * U_EXPORT2
01418 u_strFromUTF8Lenient(UChar *dest,
01419 int32_t destCapacity,
01420 int32_t *pDestLength,
01421 const char *src,
01422 int32_t srcLength,
01423 UErrorCode *pErrorCode);
01424
01444 U_STABLE UChar32* U_EXPORT2
01445 u_strToUTF32(UChar32 *dest,
01446 int32_t destCapacity,
01447 int32_t *pDestLength,
01448 const UChar *src,
01449 int32_t srcLength,
01450 UErrorCode *pErrorCode);
01451
01471 U_STABLE UChar* U_EXPORT2
01472 u_strFromUTF32(UChar *dest,
01473 int32_t destCapacity,
01474 int32_t *pDestLength,
01475 const UChar32 *src,
01476 int32_t srcLength,
01477 UErrorCode *pErrorCode);
01478
01479 #endif