ICU 4.8.1.1  4.8.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ucnv.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 1999-2011, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6  * ucnv.h:
7  * External APIs for the ICU's codeset conversion library
8  * Bertrand A. Damiba
9  *
10  * Modification History:
11  *
12  * Date Name Description
13  * 04/04/99 helena Fixed internal header inclusion.
14  * 05/11/00 helena Added setFallback and usesFallback APIs.
15  * 06/29/2000 helena Major rewrite of the callback APIs.
16  * 12/07/2000 srl Update of documentation
17  */
18 
47 #ifndef UCNV_H
48 #define UCNV_H
49 
50 #include "unicode/ucnv_err.h"
51 #include "unicode/uenum.h"
52 #include "unicode/localpointer.h"
53 
54 #ifndef __USET_H__
55 
65 struct USet;
67 typedef struct USet USet;
68 
69 #endif
70 
71 #if !UCONFIG_NO_CONVERSION
72 
74 
76 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
77 
78 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
79 
81 #define UCNV_SI 0x0F
82 
83 #define UCNV_SO 0x0E
84 
90 typedef enum {
94  UCNV_SBCS = 0,
96  UCNV_DBCS = 1,
98  UCNV_MBCS = 2,
115 
164 
165  /* Number of converter types for which we have conversion routines. */
166  UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
168 
178 typedef enum {
179  UCNV_UNKNOWN = -1,
180  UCNV_IBM = 0
182 
199  const void* context,
201  const char *codeUnits,
202  int32_t length,
204  UErrorCode *pErrorCode);
205 
222  const void* context,
224  const UChar* codeUnits,
225  int32_t length,
226  UChar32 codePoint,
228  UErrorCode *pErrorCode);
229 
231 
237 #define UCNV_OPTION_SEP_CHAR ','
238 
244 #define UCNV_OPTION_SEP_STRING ","
245 
251 #define UCNV_VALUE_SEP_CHAR '='
252 
258 #define UCNV_VALUE_SEP_STRING "="
259 
268 #define UCNV_LOCALE_OPTION_STRING ",locale="
269 
281 #define UCNV_VERSION_OPTION_STRING ",version="
282 
293 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
294 
311 ucnv_compareNames(const char *name1, const char *name2);
312 
313 
363 ucnv_open(const char *converterName, UErrorCode *err);
364 
365 
393 ucnv_openU(const UChar *name,
394  UErrorCode *err);
395 
461 ucnv_openCCSID(int32_t codepage,
462  UConverterPlatform platform,
463  UErrorCode * err);
464 
496 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
497 
536 ucnv_safeClone(const UConverter *cnv,
537  void *stackBuffer,
538  int32_t *pBufferSize,
539  UErrorCode *status);
540 
547 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
548 
560 U_STABLE void U_EXPORT2
561 ucnv_close(UConverter * converter);
562 
563 #if U_SHOW_CPLUSPLUS_API
564 
566 
576 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
577 
579 
580 #endif
581 
599 U_STABLE void U_EXPORT2
600 ucnv_getSubstChars(const UConverter *converter,
601  char *subChars,
602  int8_t *len,
603  UErrorCode *err);
604 
624 U_STABLE void U_EXPORT2
625 ucnv_setSubstChars(UConverter *converter,
626  const char *subChars,
627  int8_t len,
628  UErrorCode *err);
629 
657 U_STABLE void U_EXPORT2
659  const UChar *s,
660  int32_t length,
661  UErrorCode *err);
662 
676 U_STABLE void U_EXPORT2
677 ucnv_getInvalidChars(const UConverter *converter,
678  char *errBytes,
679  int8_t *len,
680  UErrorCode *err);
681 
695 U_STABLE void U_EXPORT2
696 ucnv_getInvalidUChars(const UConverter *converter,
697  UChar *errUChars,
698  int8_t *len,
699  UErrorCode *err);
700 
708 U_STABLE void U_EXPORT2
709 ucnv_reset(UConverter *converter);
710 
719 U_STABLE void U_EXPORT2
720 ucnv_resetToUnicode(UConverter *converter);
721 
730 U_STABLE void U_EXPORT2
732 
781 U_STABLE int8_t U_EXPORT2
782 ucnv_getMaxCharSize(const UConverter *converter);
783 
803 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
804  (((int32_t)(length)+10)*(int32_t)(maxCharSize))
805 
814 U_STABLE int8_t U_EXPORT2
815 ucnv_getMinCharSize(const UConverter *converter);
816 
831 U_STABLE int32_t U_EXPORT2
832 ucnv_getDisplayName(const UConverter *converter,
833  const char *displayLocale,
834  UChar *displayName,
835  int32_t displayNameCapacity,
836  UErrorCode *err);
837 
848 U_STABLE const char * U_EXPORT2
849 ucnv_getName(const UConverter *converter, UErrorCode *err);
850 
874 U_STABLE int32_t U_EXPORT2
875 ucnv_getCCSID(const UConverter *converter,
876  UErrorCode *err);
877 
889 ucnv_getPlatform(const UConverter *converter,
890  UErrorCode *err);
891 
901 ucnv_getType(const UConverter * converter);
902 
918 U_STABLE void U_EXPORT2
919 ucnv_getStarters(const UConverter* converter,
920  UBool starters[256],
921  UErrorCode* err);
922 
923 
929 typedef enum UConverterUnicodeSet {
937 
938 
984 U_STABLE void U_EXPORT2
985 ucnv_getUnicodeSet(const UConverter *cnv,
986  USet *setFillIn,
987  UConverterUnicodeSet whichSet,
988  UErrorCode *pErrorCode);
989 
1001 U_STABLE void U_EXPORT2
1002 ucnv_getToUCallBack (const UConverter * converter,
1003  UConverterToUCallback *action,
1004  const void **context);
1005 
1017 U_STABLE void U_EXPORT2
1018 ucnv_getFromUCallBack (const UConverter * converter,
1019  UConverterFromUCallback *action,
1020  const void **context);
1021 
1037 U_STABLE void U_EXPORT2
1038 ucnv_setToUCallBack (UConverter * converter,
1039  UConverterToUCallback newAction,
1040  const void* newContext,
1041  UConverterToUCallback *oldAction,
1042  const void** oldContext,
1043  UErrorCode * err);
1044 
1060 U_STABLE void U_EXPORT2
1061 ucnv_setFromUCallBack (UConverter * converter,
1062  UConverterFromUCallback newAction,
1063  const void *newContext,
1064  UConverterFromUCallback *oldAction,
1065  const void **oldContext,
1066  UErrorCode * err);
1067 
1126 U_STABLE void U_EXPORT2
1127 ucnv_fromUnicode (UConverter * converter,
1128  char **target,
1129  const char *targetLimit,
1130  const UChar ** source,
1131  const UChar * sourceLimit,
1132  int32_t* offsets,
1133  UBool flush,
1134  UErrorCode * err);
1135 
1195 U_STABLE void U_EXPORT2
1196 ucnv_toUnicode(UConverter *converter,
1197  UChar **target,
1198  const UChar *targetLimit,
1199  const char **source,
1200  const char *sourceLimit,
1201  int32_t *offsets,
1202  UBool flush,
1203  UErrorCode *err);
1204 
1232 U_STABLE int32_t U_EXPORT2
1234  char *dest, int32_t destCapacity,
1235  const UChar *src, int32_t srcLength,
1236  UErrorCode *pErrorCode);
1237 
1264 U_STABLE int32_t U_EXPORT2
1266  UChar *dest, int32_t destCapacity,
1267  const char *src, int32_t srcLength,
1268  UErrorCode *pErrorCode);
1269 
1341 ucnv_getNextUChar(UConverter * converter,
1342  const char **source,
1343  const char * sourceLimit,
1344  UErrorCode * err);
1345 
1484 U_STABLE void U_EXPORT2
1485 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
1486  char **target, const char *targetLimit,
1487  const char **source, const char *sourceLimit,
1488  UChar *pivotStart, UChar **pivotSource,
1489  UChar **pivotTarget, const UChar *pivotLimit,
1490  UBool reset, UBool flush,
1491  UErrorCode *pErrorCode);
1492 
1548 U_STABLE int32_t U_EXPORT2
1549 ucnv_convert(const char *toConverterName,
1550  const char *fromConverterName,
1551  char *target,
1552  int32_t targetCapacity,
1553  const char *source,
1554  int32_t sourceLength,
1555  UErrorCode *pErrorCode);
1556 
1602 U_STABLE int32_t U_EXPORT2
1603 ucnv_toAlgorithmic(UConverterType algorithmicType,
1604  UConverter *cnv,
1605  char *target, int32_t targetCapacity,
1606  const char *source, int32_t sourceLength,
1607  UErrorCode *pErrorCode);
1608 
1654 U_STABLE int32_t U_EXPORT2
1656  UConverterType algorithmicType,
1657  char *target, int32_t targetCapacity,
1658  const char *source, int32_t sourceLength,
1659  UErrorCode *pErrorCode);
1660 
1668 U_STABLE int32_t U_EXPORT2
1669 ucnv_flushCache(void);
1670 
1678 U_STABLE int32_t U_EXPORT2
1679 ucnv_countAvailable(void);
1680 
1691 U_STABLE const char* U_EXPORT2
1692 ucnv_getAvailableName(int32_t n);
1693 
1707 ucnv_openAllNames(UErrorCode *pErrorCode);
1708 
1719 U_STABLE uint16_t U_EXPORT2
1720 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
1721 
1734 U_STABLE const char * U_EXPORT2
1735 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
1736 
1750 U_STABLE void U_EXPORT2
1751 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
1752 
1777 ucnv_openStandardNames(const char *convName,
1778  const char *standard,
1779  UErrorCode *pErrorCode);
1780 
1786 U_STABLE uint16_t U_EXPORT2
1787 ucnv_countStandards(void);
1788 
1796 U_STABLE const char * U_EXPORT2
1797 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
1798 
1818 U_STABLE const char * U_EXPORT2
1819 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
1820 
1840 U_STABLE const char * U_EXPORT2
1841 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
1842 
1857 U_STABLE const char * U_EXPORT2
1858 ucnv_getDefaultName(void);
1859 
1876 U_STABLE void U_EXPORT2
1877 ucnv_setDefaultName(const char *name);
1878 
1896 U_STABLE void U_EXPORT2
1897 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
1898 
1908 ucnv_isAmbiguous(const UConverter *cnv);
1909 
1925 U_STABLE void U_EXPORT2
1926 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
1927 
1938 ucnv_usesFallback(const UConverter *cnv);
1939 
1996 U_STABLE const char* U_EXPORT2
1997 ucnv_detectUnicodeSignature(const char* source,
1998  int32_t sourceLength,
1999  int32_t *signatureLength,
2000  UErrorCode *pErrorCode);
2001 
2013 U_STABLE int32_t U_EXPORT2
2014 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
2015 
2027 U_STABLE int32_t U_EXPORT2
2028 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
2029 
2046 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status);
2047 
2048 #endif
2049 
2050 #endif
2051 /*_UCNV*/