ICU 49.1.1  49.1.1
ustring.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 1998-2010, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 *
7 * File ustring.h
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 12/07/98 bertrand Creation.
13 ******************************************************************************
14 */
15 
16 #ifndef USTRING_H
17 #define USTRING_H
18 
19 #include "unicode/utypes.h"
20 #include "unicode/putil.h"
21 #include "unicode/uiter.h"
22 
24 #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
25 # define UBRK_TYPEDEF_UBREAK_ITERATOR
26  typedef struct UBreakIterator UBreakIterator;
27 #endif
28 
85 U_STABLE int32_t U_EXPORT2
86 u_strlen(const UChar *s);
102 U_STABLE int32_t U_EXPORT2
103 u_countChar32(const UChar *s, int32_t length);
104 
123 U_STABLE UBool U_EXPORT2
124 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
125 
136 U_STABLE UChar* U_EXPORT2
137 u_strcat(UChar *dst,
138  const UChar *src);
139 
154 U_STABLE UChar* U_EXPORT2
155 u_strncat(UChar *dst,
156  const UChar *src,
157  int32_t n);
158 
179 U_STABLE UChar * U_EXPORT2
180 u_strstr(const UChar *s, const UChar *substring);
181 
203 U_STABLE UChar * U_EXPORT2
204 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
205 
223 U_STABLE UChar * U_EXPORT2
224 u_strchr(const UChar *s, UChar c);
225 
243 U_STABLE UChar * U_EXPORT2
244 u_strchr32(const UChar *s, UChar32 c);
245 
266 U_STABLE UChar * U_EXPORT2
267 u_strrstr(const UChar *s, const UChar *substring);
268 
290 U_STABLE UChar * U_EXPORT2
291 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength);
292 
310 U_STABLE UChar * U_EXPORT2
311 u_strrchr(const UChar *s, UChar c);
312 
330 U_STABLE UChar * U_EXPORT2
331 u_strrchr32(const UChar *s, UChar32 c);
332 
345 U_STABLE UChar * U_EXPORT2
346 u_strpbrk(const UChar *string, const UChar *matchSet);
347 
361 U_STABLE int32_t U_EXPORT2
362 u_strcspn(const UChar *string, const UChar *matchSet);
363 
377 U_STABLE int32_t U_EXPORT2
378 u_strspn(const UChar *string, const UChar *matchSet);
379 
405 U_STABLE UChar * U_EXPORT2
406 u_strtok_r(UChar *src,
407  const UChar *delim,
408  UChar **saveState);
409 
420 U_STABLE int32_t U_EXPORT2
421 u_strcmp(const UChar *s1,
422  const UChar *s2);
423 
435 U_STABLE int32_t U_EXPORT2
436 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2);
437 
465 U_STABLE int32_t U_EXPORT2
466 u_strCompare(const UChar *s1, int32_t length1,
467  const UChar *s2, int32_t length2,
468  UBool codePointOrder);
469 
490 U_STABLE int32_t U_EXPORT2
491 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder);
492 
493 #ifndef U_COMPARE_CODE_POINT_ORDER
494 /* see also unistr.h and unorm.h */
500 #define U_COMPARE_CODE_POINT_ORDER 0x8000
501 #endif
502 
543 U_STABLE int32_t U_EXPORT2
544 u_strCaseCompare(const UChar *s1, int32_t length1,
545  const UChar *s2, int32_t length2,
546  uint32_t options,
547  UErrorCode *pErrorCode);
548 
561 U_STABLE int32_t U_EXPORT2
562 u_strncmp(const UChar *ucs1,
563  const UChar *ucs2,
564  int32_t n);
565 
579 U_STABLE int32_t U_EXPORT2
580 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n);
581 
601 U_STABLE int32_t U_EXPORT2
602 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options);
603 
625 U_STABLE int32_t U_EXPORT2
626 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options);
627 
649 U_STABLE int32_t U_EXPORT2
650 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options);
651 
660 U_STABLE UChar* U_EXPORT2
661 u_strcpy(UChar *dst,
662  const UChar *src);
663 
675 U_STABLE UChar* U_EXPORT2
676 u_strncpy(UChar *dst,
677  const UChar *src,
678  int32_t n);
679 
680 #if !UCONFIG_NO_CONVERSION
681 
692 U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst,
693  const char *src );
694 
707 U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst,
708  const char *src,
709  int32_t n);
710 
721 U_STABLE char* U_EXPORT2 u_austrcpy(char *dst,
722  const UChar *src );
723 
736 U_STABLE char* U_EXPORT2 u_austrncpy(char *dst,
737  const UChar *src,
738  int32_t n );
739 
740 #endif
741 
750 U_STABLE UChar* U_EXPORT2
751 u_memcpy(UChar *dest, const UChar *src, int32_t count);
752 
761 U_STABLE UChar* U_EXPORT2
762 u_memmove(UChar *dest, const UChar *src, int32_t count);
763 
773 U_STABLE UChar* U_EXPORT2
774 u_memset(UChar *dest, UChar c, int32_t count);
775 
787 U_STABLE int32_t U_EXPORT2
788 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count);
789 
803 U_STABLE int32_t U_EXPORT2
804 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count);
805 
823 U_STABLE UChar* U_EXPORT2
824 u_memchr(const UChar *s, UChar c, int32_t count);
825 
843 U_STABLE UChar* U_EXPORT2
844 u_memchr32(const UChar *s, UChar32 c, int32_t count);
845 
863 U_STABLE UChar* U_EXPORT2
864 u_memrchr(const UChar *s, UChar c, int32_t count);
865 
883 U_STABLE UChar* U_EXPORT2
884 u_memrchr32(const UChar *s, UChar32 c, int32_t count);
885 
936 #if defined(U_DECLARE_UTF16)
937 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs)
938 
939 # define U_STRING_INIT(var, cs, length)
940 #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
941 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
942 
943 # define U_STRING_INIT(var, cs, length)
944 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
945 # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs
946 
947 # define U_STRING_INIT(var, cs, length)
948 #else
949 # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
950 
951 # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1)
952 #endif
953 
1001 U_STABLE int32_t U_EXPORT2
1002 u_unescape(const char *src,
1003  UChar *dest, int32_t destCapacity);
1004 
1018 typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context);
1020 
1049 U_STABLE UChar32 U_EXPORT2
1051  int32_t *offset,
1052  int32_t length,
1053  void *context);
1054 
1075 U_STABLE int32_t U_EXPORT2
1076 u_strToUpper(UChar *dest, int32_t destCapacity,
1077  const UChar *src, int32_t srcLength,
1078  const char *locale,
1079  UErrorCode *pErrorCode);
1080 
1101 U_STABLE int32_t U_EXPORT2
1102 u_strToLower(UChar *dest, int32_t destCapacity,
1103  const UChar *src, int32_t srcLength,
1104  const char *locale,
1105  UErrorCode *pErrorCode);
1106 
1107 #if !UCONFIG_NO_BREAK_ITERATION
1108 
1147 U_STABLE int32_t U_EXPORT2
1148 u_strToTitle(UChar *dest, int32_t destCapacity,
1149  const UChar *src, int32_t srcLength,
1150  UBreakIterator *titleIter,
1151  const char *locale,
1152  UErrorCode *pErrorCode);
1153 
1154 #endif
1155 
1178 U_STABLE int32_t U_EXPORT2
1179 u_strFoldCase(UChar *dest, int32_t destCapacity,
1180  const UChar *src, int32_t srcLength,
1181  uint32_t options,
1182  UErrorCode *pErrorCode);
1183 
1184 #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION
1185 
1207 U_STABLE wchar_t* U_EXPORT2
1208 u_strToWCS(wchar_t *dest,
1209  int32_t destCapacity,
1210  int32_t *pDestLength,
1211  const UChar *src,
1212  int32_t srcLength,
1213  UErrorCode *pErrorCode);
1236 U_STABLE UChar* U_EXPORT2
1237 u_strFromWCS(UChar *dest,
1238  int32_t destCapacity,
1239  int32_t *pDestLength,
1240  const wchar_t *src,
1241  int32_t srcLength,
1242  UErrorCode *pErrorCode);
1243 #endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */
1244 
1267 U_STABLE char* U_EXPORT2
1268 u_strToUTF8(char *dest,
1269  int32_t destCapacity,
1270  int32_t *pDestLength,
1271  const UChar *src,
1272  int32_t srcLength,
1273  UErrorCode *pErrorCode);
1274 
1297 U_STABLE UChar* U_EXPORT2
1298 u_strFromUTF8(UChar *dest,
1299  int32_t destCapacity,
1300  int32_t *pDestLength,
1301  const char *src,
1302  int32_t srcLength,
1303  UErrorCode *pErrorCode);
1304 
1341 U_STABLE char* U_EXPORT2
1342 u_strToUTF8WithSub(char *dest,
1343  int32_t destCapacity,
1344  int32_t *pDestLength,
1345  const UChar *src,
1346  int32_t srcLength,
1347  UChar32 subchar, int32_t *pNumSubstitutions,
1348  UErrorCode *pErrorCode);
1349 
1387 U_STABLE UChar* U_EXPORT2
1389  int32_t destCapacity,
1390  int32_t *pDestLength,
1391  const char *src,
1392  int32_t srcLength,
1393  UChar32 subchar, int32_t *pNumSubstitutions,
1394  UErrorCode *pErrorCode);
1395 
1447 U_STABLE UChar * U_EXPORT2
1449  int32_t destCapacity,
1450  int32_t *pDestLength,
1451  const char *src,
1452  int32_t srcLength,
1453  UErrorCode *pErrorCode);
1454 
1477 U_STABLE UChar32* U_EXPORT2
1478 u_strToUTF32(UChar32 *dest,
1479  int32_t destCapacity,
1480  int32_t *pDestLength,
1481  const UChar *src,
1482  int32_t srcLength,
1483  UErrorCode *pErrorCode);
1484 
1507 U_STABLE UChar* U_EXPORT2
1508 u_strFromUTF32(UChar *dest,
1509  int32_t destCapacity,
1510  int32_t *pDestLength,
1511  const UChar32 *src,
1512  int32_t srcLength,
1513  UErrorCode *pErrorCode);
1514 
1551 U_STABLE UChar32* U_EXPORT2
1553  int32_t destCapacity,
1554  int32_t *pDestLength,
1555  const UChar *src,
1556  int32_t srcLength,
1557  UChar32 subchar, int32_t *pNumSubstitutions,
1558  UErrorCode *pErrorCode);
1559 
1596 U_STABLE UChar* U_EXPORT2
1598  int32_t destCapacity,
1599  int32_t *pDestLength,
1600  const UChar32 *src,
1601  int32_t srcLength,
1602  UChar32 subchar, int32_t *pNumSubstitutions,
1603  UErrorCode *pErrorCode);
1604 
1637 U_STABLE char* U_EXPORT2
1639  char *dest,
1640  int32_t destCapacity,
1641  int32_t *pDestLength,
1642  const UChar *src,
1643  int32_t srcLength,
1644  UErrorCode *pErrorCode);
1645 
1686 U_STABLE UChar* U_EXPORT2
1688  UChar *dest,
1689  int32_t destCapacity,
1690  int32_t *pDestLength,
1691  const char *src,
1692  int32_t srcLength,
1693  UChar32 subchar, int32_t *pNumSubstitutions,
1694  UErrorCode *pErrorCode);
1695 
1696 #endif