Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ucnv.h

Go to the documentation of this file.
00001 /* 00002 ********************************************************************** 00003 * Copyright (C) 1999-2001, International Business Machines 00004 * Corporation and others. All Rights Reserved. 00005 ********************************************************************** 00006 * ucnv.h: 00007 * External APIs for the ICU's codeset conversion library 00008 * Bertrand A. Damiba 00009 * 00010 * Modification History: 00011 * 00012 * Date Name Description 00013 * 04/04/99 helena Fixed internal header inclusion. 00014 * 05/11/00 helena Added setFallback and usesFallback APIs. 00015 * 06/29/2000 helena Major rewrite of the callback APIs. 00016 * 12/07/2000 srl Update of documentation 00017 */ 00018 00027 #ifndef UCNV_H 00028 #define UCNV_H 00029 00031 struct UConverter; 00032 00034 typedef struct UConverter UConverter; 00035 00036 #include "unicode/utypes.h" 00037 #include "unicode/ucnv_err.h" 00038 00039 U_CDECL_BEGIN 00040 00041 /* maximum length of the converter names */ 00042 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60 00043 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH) 00044 00045 #define UCNV_SI 0x0F /*Shift in for EBDCDIC_STATEFUL and iso2022 states */ 00046 #define UCNV_SO 0x0E /*Shift out for EBDCDIC_STATEFUL and iso2022 states */ 00047 00053 typedef enum { 00054 UCNV_UNSUPPORTED_CONVERTER = -1, 00055 UCNV_SBCS = 0, 00056 UCNV_DBCS = 1, 00057 UCNV_MBCS = 2, 00058 UCNV_LATIN_1 = 3, 00059 UCNV_UTF8 = 4, 00060 UCNV_UTF16_BigEndian = 5, 00061 UCNV_UTF16_LittleEndian = 6, 00062 UCNV_UTF32_BigEndian = 7, 00063 UCNV_UTF32_LittleEndian = 8, 00064 UCNV_EBCDIC_STATEFUL = 9, 00065 UCNV_ISO_2022 = 10, 00066 00067 UCNV_LMBCS_1 = 11, 00068 UCNV_LMBCS_2, 00069 UCNV_LMBCS_3, 00070 UCNV_LMBCS_4, 00071 UCNV_LMBCS_5, 00072 UCNV_LMBCS_6, 00073 UCNV_LMBCS_8, 00074 UCNV_LMBCS_11, 00075 UCNV_LMBCS_16, 00076 UCNV_LMBCS_17, 00077 UCNV_LMBCS_18, 00078 UCNV_LMBCS_19, 00079 UCNV_LMBCS_LAST = UCNV_LMBCS_19, 00080 UCNV_HZ, 00081 UCNV_SCSU, 00082 UCNV_ISCII, 00083 UCNV_US_ASCII, 00084 UCNV_UTF7, 00085 00086 /* Number of converter types for which we have conversion routines. */ 00087 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES 00088 00089 } UConverterType; 00090 00100 typedef enum { 00101 UCNV_UNKNOWN = -1, 00102 UCNV_IBM = 0 00103 } UConverterPlatform; 00104 00117 typedef void (U_EXPORT2 *UConverterToUCallback) ( 00118 const void* context, 00119 UConverterToUnicodeArgs *args, 00120 const char *codePoints, 00121 int32_t length, 00122 UConverterCallbackReason reason, 00123 UErrorCode *); 00124 00137 typedef void (U_EXPORT2 *UConverterFromUCallback) ( 00138 const void* context, 00139 UConverterFromUnicodeArgs *args, 00140 const UChar* codeUnits, 00141 int32_t length, 00142 UChar32 codePoint, 00143 UConverterCallbackReason reason, 00144 UErrorCode *); 00145 00146 U_CDECL_END 00147 00153 #define UCNV_OPTION_SEP_CHAR ',' 00154 00160 #define UCNV_OPTION_SEP_STRING "," 00161 00167 #define UCNV_VALUE_SEP_CHAR '=' 00168 00174 #define UCNV_VALUE_SEP_STRING "=" 00175 00181 #define UCNV_LOCALE_OPTION_STRING ",locale=" 00182 00196 U_CAPI int U_EXPORT2 00197 ucnv_compareNames(const char *name1, const char *name2); 00198 00199 00227 U_CAPI UConverter* U_EXPORT2 00228 ucnv_open (const char *converterName, UErrorCode * err); 00229 00230 00252 U_CAPI UConverter* U_EXPORT2 00253 ucnv_openU (const UChar * name, 00254 UErrorCode * err); 00255 00316 U_CAPI UConverter* U_EXPORT2 00317 ucnv_openCCSID (int32_t codepage, 00318 UConverterPlatform platform, 00319 UErrorCode * err); 00320 00337 U_CAPI UConverter * U_EXPORT2 00338 ucnv_safeClone(const UConverter *cnv, 00339 void *stackBuffer, 00340 int32_t *pBufferSize, 00341 UErrorCode *status); 00342 00344 #define U_CNV_SAFECLONE_BUFFERSIZE 512 00345 00357 U_CAPI void U_EXPORT2 00358 ucnv_close (UConverter * converter); 00359 00374 U_CAPI void U_EXPORT2 00375 ucnv_getSubstChars (const UConverter * converter, 00376 char *subChars, 00377 int8_t * len, 00378 UErrorCode * err); 00379 00392 U_CAPI void U_EXPORT2 00393 ucnv_setSubstChars (UConverter * converter, 00394 const char *subChars, 00395 int8_t len, 00396 UErrorCode * err); 00397 00411 U_CAPI void U_EXPORT2 00412 ucnv_getInvalidChars (const UConverter * converter, 00413 char *errBytes, 00414 int8_t * len, 00415 UErrorCode * err); 00416 00430 U_CAPI void U_EXPORT2 00431 ucnv_getInvalidUChars (const UConverter * converter, 00432 UChar *errUChars, 00433 int8_t * len, 00434 UErrorCode * err); 00435 00443 U_CAPI void U_EXPORT2 00444 ucnv_reset (UConverter * converter); 00445 00454 U_CAPI void U_EXPORT2 00455 ucnv_resetToUnicode(UConverter *converter); 00456 00465 U_CAPI void U_EXPORT2 00466 ucnv_resetFromUnicode(UConverter *converter); 00467 00476 U_CAPI int8_t U_EXPORT2 00477 ucnv_getMaxCharSize (const UConverter * converter); 00478 00479 00488 U_CAPI int8_t U_EXPORT2 00489 ucnv_getMinCharSize (const UConverter * converter); 00490 00505 U_CAPI int32_t U_EXPORT2 00506 ucnv_getDisplayName (const UConverter * converter, 00507 const char *displayLocale, 00508 UChar * displayName, 00509 int32_t displayNameCapacity, 00510 UErrorCode * err); 00511 00522 U_CAPI const char * U_EXPORT2 00523 ucnv_getName (const UConverter * converter, UErrorCode * err); 00524 00525 00549 U_CAPI int32_t U_EXPORT2 00550 ucnv_getCCSID (const UConverter * converter, 00551 UErrorCode * err); 00552 00563 U_CAPI UConverterPlatform U_EXPORT2 00564 ucnv_getPlatform (const UConverter * converter, 00565 UErrorCode * err); 00566 00575 U_CAPI UConverterType U_EXPORT2 00576 ucnv_getType (const UConverter * converter); 00577 00593 U_CAPI void U_EXPORT2 ucnv_getStarters(const UConverter* converter, 00594 UBool starters[256], 00595 UErrorCode* err); 00596 00597 00609 U_CAPI void U_EXPORT2 00610 ucnv_getToUCallBack (const UConverter * converter, 00611 UConverterToUCallback *action, 00612 const void **context); 00613 00625 U_CAPI void U_EXPORT2 00626 ucnv_getFromUCallBack (const UConverter * converter, 00627 UConverterFromUCallback *action, 00628 const void **context); 00629 00644 U_CAPI void U_EXPORT2 00645 ucnv_setToUCallBack (UConverter * converter, 00646 UConverterToUCallback newAction, 00647 const void* newContext, 00648 UConverterToUCallback *oldAction, 00649 const void** oldContext, 00650 UErrorCode * err); 00651 00666 U_CAPI void U_EXPORT2 00667 ucnv_setFromUCallBack (UConverter * converter, 00668 UConverterFromUCallback newAction, 00669 const void *newContext, 00670 UConverterFromUCallback *oldAction, 00671 const void **oldContext, 00672 UErrorCode * err); 00673 00726 U_CAPI void U_EXPORT2 00727 ucnv_fromUnicode (UConverter * converter, 00728 char **target, 00729 const char *targetLimit, 00730 const UChar ** source, 00731 const UChar * sourceLimit, 00732 int32_t* offsets, 00733 UBool flush, 00734 UErrorCode * err); 00735 00789 U_CAPI void U_EXPORT2 00790 ucnv_toUnicode (UConverter * converter, 00791 UChar ** target, 00792 const UChar * targetLimit, 00793 const char **source, 00794 const char *sourceLimit, 00795 int32_t* offsets, 00796 UBool flush, 00797 UErrorCode * err); 00798 00799 00826 U_CAPI int32_t U_EXPORT2 00827 ucnv_fromUChars(UConverter *cnv, 00828 char *dest, int32_t destCapacity, 00829 const UChar *src, int32_t srcLength, 00830 UErrorCode *pErrorCode); 00831 00832 00859 U_CAPI int32_t U_EXPORT2 00860 ucnv_toUChars(UConverter *cnv, 00861 UChar *dest, int32_t destCapacity, 00862 const char *src, int32_t srcLength, 00863 UErrorCode *pErrorCode); 00864 00907 U_CAPI UChar32 U_EXPORT2 00908 ucnv_getNextUChar (UConverter * converter, 00909 const char **source, 00910 const char * sourceLimit, 00911 UErrorCode * err); 00912 00913 00936 U_CAPI int32_t U_EXPORT2 00937 ucnv_convert (const char *toConverterName, 00938 const char *fromConverterName, 00939 char *target, 00940 int32_t targetCapacity, 00941 const char *source, 00942 int32_t sourceLength, 00943 UErrorCode * err); 00944 00952 U_CAPI int32_t U_EXPORT2 00953 ucnv_flushCache (void); 00954 00955 00963 U_CAPI int32_t U_EXPORT2 00964 ucnv_countAvailable (void); 00965 00974 U_CAPI const char* U_EXPORT2 00975 ucnv_getAvailableName (int32_t n); 00976 00986 U_CAPI uint16_t U_EXPORT2 00987 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); 00988 01000 U_CAPI const char * U_EXPORT2 01001 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); 01002 01015 U_CAPI void U_EXPORT2 01016 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode); 01017 01023 U_CAPI uint16_t U_EXPORT2 01024 ucnv_countStandards(void); 01025 01033 U_CAPI const char * U_EXPORT2 01034 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode); 01035 01047 U_CAPI const char * U_EXPORT2 01048 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode); 01049 01060 U_CAPI const char * U_EXPORT2 01061 ucnv_getDefaultName (void); 01062 01071 U_CAPI void U_EXPORT2 01072 ucnv_setDefaultName (const char *name); 01073 01091 U_CAPI void U_EXPORT2 01092 ucnv_fixFileSeparator(const UConverter *cnv, UChar* source, int32_t sourceLen); 01093 01101 U_CAPI UBool U_EXPORT2 01102 ucnv_isAmbiguous(const UConverter *cnv); 01103 01111 U_CAPI void U_EXPORT2 01112 ucnv_setFallback(UConverter *cnv, UBool usesFallback); 01113 01119 U_CAPI UBool U_EXPORT2 01120 ucnv_usesFallback(const UConverter *cnv); 01121 01156 U_CAPI const char* U_EXPORT2 01157 ucnv_detectUnicodeSignature( const char* source, 01158 int32_t sourceLength, 01159 int32_t* signatureLength, 01160 UErrorCode* pErrorCode); 01161 01162 #endif 01163 /*_UCNV*/ 01164

Generated on Wed Jul 28 05:45:13 2004 for ICU 2.1 by doxygen 1.3.7