00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 #include "unicode/uenum.h"
00039
00040 U_CDECL_BEGIN
00041
00043 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00044
00045 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00046
00048 #define UCNV_SI 0x0F
00049
00050 #define UCNV_SO 0x0E
00051
00057 typedef enum {
00058 UCNV_UNSUPPORTED_CONVERTER = -1,
00059 UCNV_SBCS = 0,
00060 UCNV_DBCS = 1,
00061 UCNV_MBCS = 2,
00062 UCNV_LATIN_1 = 3,
00063 UCNV_UTF8 = 4,
00064 UCNV_UTF16_BigEndian = 5,
00065 UCNV_UTF16_LittleEndian = 6,
00066 UCNV_UTF32_BigEndian = 7,
00067 UCNV_UTF32_LittleEndian = 8,
00068 UCNV_EBCDIC_STATEFUL = 9,
00069 UCNV_ISO_2022 = 10,
00070
00071 UCNV_LMBCS_1 = 11,
00072 UCNV_LMBCS_2,
00073 UCNV_LMBCS_3,
00074 UCNV_LMBCS_4,
00075 UCNV_LMBCS_5,
00076 UCNV_LMBCS_6,
00077 UCNV_LMBCS_8,
00078 UCNV_LMBCS_11,
00079 UCNV_LMBCS_16,
00080 UCNV_LMBCS_17,
00081 UCNV_LMBCS_18,
00082 UCNV_LMBCS_19,
00083 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00084 UCNV_HZ,
00085 UCNV_SCSU,
00086 UCNV_ISCII,
00087 UCNV_US_ASCII,
00088 UCNV_UTF7,
00089 UCNV_BOCU1,
00090 UCNV_UTF16,
00091 UCNV_UTF32,
00092 UCNV_CESU8,
00093
00094
00095 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00096
00097 } UConverterType;
00098
00108 typedef enum {
00109 UCNV_UNKNOWN = -1,
00110 UCNV_IBM = 0
00111 } UConverterPlatform;
00112
00125 typedef void (U_EXPORT2 *UConverterToUCallback) (
00126 const void* context,
00127 UConverterToUnicodeArgs *args,
00128 const char *codePoints,
00129 int32_t length,
00130 UConverterCallbackReason reason,
00131 UErrorCode *);
00132
00145 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00146 const void* context,
00147 UConverterFromUnicodeArgs *args,
00148 const UChar* codeUnits,
00149 int32_t length,
00150 UChar32 codePoint,
00151 UConverterCallbackReason reason,
00152 UErrorCode *);
00153
00154 U_CDECL_END
00155
00161 #define UCNV_OPTION_SEP_CHAR ','
00162
00168 #define UCNV_OPTION_SEP_STRING ","
00169
00175 #define UCNV_VALUE_SEP_CHAR '='
00176
00182 #define UCNV_VALUE_SEP_STRING "="
00183
00189 #define UCNV_LOCALE_OPTION_STRING ",locale="
00190
00204 U_CAPI int U_EXPORT2
00205 ucnv_compareNames(const char *name1, const char *name2);
00206
00207
00237 U_CAPI UConverter* U_EXPORT2
00238 ucnv_open (const char *converterName, UErrorCode * err);
00239
00240
00264 U_CAPI UConverter* U_EXPORT2
00265 ucnv_openU (const UChar * name,
00266 UErrorCode * err);
00267
00331 U_CAPI UConverter* U_EXPORT2
00332 ucnv_openCCSID (int32_t codepage,
00333 UConverterPlatform platform,
00334 UErrorCode * err);
00335
00363 U_CAPI UConverter* U_EXPORT2
00364 ucnv_openPackage (const char *packageName, const char *converterName, UErrorCode * err);
00365
00382 U_CAPI UConverter * U_EXPORT2
00383 ucnv_safeClone(const UConverter *cnv,
00384 void *stackBuffer,
00385 int32_t *pBufferSize,
00386 UErrorCode *status);
00387
00389 #define U_CNV_SAFECLONE_BUFFERSIZE 3072
00390
00402 U_CAPI void U_EXPORT2
00403 ucnv_close (UConverter * converter);
00404
00419 U_CAPI void U_EXPORT2
00420 ucnv_getSubstChars (const UConverter * converter,
00421 char *subChars,
00422 int8_t * len,
00423 UErrorCode * err);
00424
00437 U_CAPI void U_EXPORT2
00438 ucnv_setSubstChars (UConverter * converter,
00439 const char *subChars,
00440 int8_t len,
00441 UErrorCode * err);
00442
00456 U_CAPI void U_EXPORT2
00457 ucnv_getInvalidChars (const UConverter * converter,
00458 char *errBytes,
00459 int8_t * len,
00460 UErrorCode * err);
00461
00475 U_CAPI void U_EXPORT2
00476 ucnv_getInvalidUChars (const UConverter * converter,
00477 UChar *errUChars,
00478 int8_t * len,
00479 UErrorCode * err);
00480
00488 U_CAPI void U_EXPORT2
00489 ucnv_reset (UConverter * converter);
00490
00499 U_CAPI void U_EXPORT2
00500 ucnv_resetToUnicode(UConverter *converter);
00501
00510 U_CAPI void U_EXPORT2
00511 ucnv_resetFromUnicode(UConverter *converter);
00512
00521 U_CAPI int8_t U_EXPORT2
00522 ucnv_getMaxCharSize (const UConverter * converter);
00523
00524
00533 U_CAPI int8_t U_EXPORT2
00534 ucnv_getMinCharSize (const UConverter * converter);
00535
00550 U_CAPI int32_t U_EXPORT2
00551 ucnv_getDisplayName (const UConverter * converter,
00552 const char *displayLocale,
00553 UChar * displayName,
00554 int32_t displayNameCapacity,
00555 UErrorCode * err);
00556
00567 U_CAPI const char * U_EXPORT2
00568 ucnv_getName (const UConverter * converter, UErrorCode * err);
00569
00570
00594 U_CAPI int32_t U_EXPORT2
00595 ucnv_getCCSID (const UConverter * converter,
00596 UErrorCode * err);
00597
00608 U_CAPI UConverterPlatform U_EXPORT2
00609 ucnv_getPlatform (const UConverter * converter,
00610 UErrorCode * err);
00611
00620 U_CAPI UConverterType U_EXPORT2
00621 ucnv_getType (const UConverter * converter);
00622
00638 U_CAPI void U_EXPORT2 ucnv_getStarters(const UConverter* converter,
00639 UBool starters[256],
00640 UErrorCode* err);
00641
00642
00654 U_CAPI void U_EXPORT2
00655 ucnv_getToUCallBack (const UConverter * converter,
00656 UConverterToUCallback *action,
00657 const void **context);
00658
00670 U_CAPI void U_EXPORT2
00671 ucnv_getFromUCallBack (const UConverter * converter,
00672 UConverterFromUCallback *action,
00673 const void **context);
00674
00689 U_CAPI void U_EXPORT2
00690 ucnv_setToUCallBack (UConverter * converter,
00691 UConverterToUCallback newAction,
00692 const void* newContext,
00693 UConverterToUCallback *oldAction,
00694 const void** oldContext,
00695 UErrorCode * err);
00696
00711 U_CAPI void U_EXPORT2
00712 ucnv_setFromUCallBack (UConverter * converter,
00713 UConverterFromUCallback newAction,
00714 const void *newContext,
00715 UConverterFromUCallback *oldAction,
00716 const void **oldContext,
00717 UErrorCode * err);
00718
00771 U_CAPI void U_EXPORT2
00772 ucnv_fromUnicode (UConverter * converter,
00773 char **target,
00774 const char *targetLimit,
00775 const UChar ** source,
00776 const UChar * sourceLimit,
00777 int32_t* offsets,
00778 UBool flush,
00779 UErrorCode * err);
00780
00834 U_CAPI void U_EXPORT2
00835 ucnv_toUnicode (UConverter * converter,
00836 UChar ** target,
00837 const UChar * targetLimit,
00838 const char **source,
00839 const char *sourceLimit,
00840 int32_t* offsets,
00841 UBool flush,
00842 UErrorCode * err);
00843
00844
00871 U_CAPI int32_t U_EXPORT2
00872 ucnv_fromUChars(UConverter *cnv,
00873 char *dest, int32_t destCapacity,
00874 const UChar *src, int32_t srcLength,
00875 UErrorCode *pErrorCode);
00876
00877
00904 U_CAPI int32_t U_EXPORT2
00905 ucnv_toUChars(UConverter *cnv,
00906 UChar *dest, int32_t destCapacity,
00907 const char *src, int32_t srcLength,
00908 UErrorCode *pErrorCode);
00909
00952 U_CAPI UChar32 U_EXPORT2
00953 ucnv_getNextUChar (UConverter * converter,
00954 const char **source,
00955 const char * sourceLimit,
00956 UErrorCode * err);
00957
00958
00981 U_CAPI int32_t U_EXPORT2
00982 ucnv_convert (const char *toConverterName,
00983 const char *fromConverterName,
00984 char *target,
00985 int32_t targetCapacity,
00986 const char *source,
00987 int32_t sourceLength,
00988 UErrorCode * err);
00989
00997 U_CAPI int32_t U_EXPORT2
00998 ucnv_flushCache (void);
00999
01000
01008 U_CAPI int32_t U_EXPORT2
01009 ucnv_countAvailable (void);
01010
01019 U_CAPI const char* U_EXPORT2
01020 ucnv_getAvailableName (int32_t n);
01021
01032 U_CAPI uint16_t U_EXPORT2
01033 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01034
01047 U_CAPI const char * U_EXPORT2
01048 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01049
01063 U_CAPI void U_EXPORT2
01064 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01065
01089 U_CAPI UEnumeration *
01090 ucnv_openStandardNames(const char *convName,
01091 const char *standard,
01092 UErrorCode *pErrorCode);
01093
01094
01100 U_CAPI uint16_t U_EXPORT2
01101 ucnv_countStandards(void);
01102
01110 U_CAPI const char * U_EXPORT2
01111 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01112
01124 U_CAPI const char * U_EXPORT2
01125 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01126
01137 U_CAPI const char * U_EXPORT2
01138 ucnv_getDefaultName (void);
01139
01148 U_CAPI void U_EXPORT2
01149 ucnv_setDefaultName (const char *name);
01150
01168 U_CAPI void U_EXPORT2
01169 ucnv_fixFileSeparator(const UConverter *cnv, UChar* source, int32_t sourceLen);
01170
01179 U_CAPI UBool U_EXPORT2
01180 ucnv_isAmbiguous(const UConverter *cnv);
01181
01189 U_CAPI void U_EXPORT2
01190 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01191
01198 U_CAPI UBool U_EXPORT2
01199 ucnv_usesFallback(const UConverter *cnv);
01200
01235 U_CAPI const char* U_EXPORT2
01236 ucnv_detectUnicodeSignature( const char* source,
01237 int32_t sourceLength,
01238 int32_t* signatureLength,
01239 UErrorCode* pErrorCode);
01240
01241 #endif
01242
01243