00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00047 #ifndef UCNV_H
00048 #define UCNV_H
00049
00050 #include "unicode/ucnv_err.h"
00051 #include "unicode/uenum.h"
00052
00053 #ifndef __USET_H__
00054
00064 struct USet;
00066 typedef struct USet USet;
00067
00068 #endif
00069
00070 #if !UCONFIG_NO_CONVERSION
00071
00072 U_CDECL_BEGIN
00073
00075 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00076
00077 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00078
00080 #define UCNV_SI 0x0F
00081
00082 #define UCNV_SO 0x0E
00083
00089 typedef enum {
00090 UCNV_UNSUPPORTED_CONVERTER = -1,
00091 UCNV_SBCS = 0,
00092 UCNV_DBCS = 1,
00093 UCNV_MBCS = 2,
00094 UCNV_LATIN_1 = 3,
00095 UCNV_UTF8 = 4,
00096 UCNV_UTF16_BigEndian = 5,
00097 UCNV_UTF16_LittleEndian = 6,
00098 UCNV_UTF32_BigEndian = 7,
00099 UCNV_UTF32_LittleEndian = 8,
00100 UCNV_EBCDIC_STATEFUL = 9,
00101 UCNV_ISO_2022 = 10,
00102
00103 UCNV_LMBCS_1 = 11,
00104 UCNV_LMBCS_2,
00105 UCNV_LMBCS_3,
00106 UCNV_LMBCS_4,
00107 UCNV_LMBCS_5,
00108 UCNV_LMBCS_6,
00109 UCNV_LMBCS_8,
00110 UCNV_LMBCS_11,
00111 UCNV_LMBCS_16,
00112 UCNV_LMBCS_17,
00113 UCNV_LMBCS_18,
00114 UCNV_LMBCS_19,
00115 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00116 UCNV_HZ,
00117 UCNV_SCSU,
00118 UCNV_ISCII,
00119 UCNV_US_ASCII,
00120 UCNV_UTF7,
00121 UCNV_BOCU1,
00122 UCNV_UTF16,
00123 UCNV_UTF32,
00124 UCNV_CESU8,
00125 UCNV_IMAP_MAILBOX,
00126
00127
00128 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00129
00130 } UConverterType;
00131
00141 typedef enum {
00142 UCNV_UNKNOWN = -1,
00143 UCNV_IBM = 0
00144 } UConverterPlatform;
00145
00158 typedef void (U_EXPORT2 *UConverterToUCallback) (
00159 const void* context,
00160 UConverterToUnicodeArgs *args,
00161 const char *codeUnits,
00162 int32_t length,
00163 UConverterCallbackReason reason,
00164 UErrorCode *);
00165
00178 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00179 const void* context,
00180 UConverterFromUnicodeArgs *args,
00181 const UChar* codeUnits,
00182 int32_t length,
00183 UChar32 codePoint,
00184 UConverterCallbackReason reason,
00185 UErrorCode *);
00186
00187 U_CDECL_END
00188
00194 #define UCNV_OPTION_SEP_CHAR ','
00195
00201 #define UCNV_OPTION_SEP_STRING ","
00202
00208 #define UCNV_VALUE_SEP_CHAR '='
00209
00215 #define UCNV_VALUE_SEP_STRING "="
00216
00225 #define UCNV_LOCALE_OPTION_STRING ",locale="
00226
00235 #define UCNV_VERSION_OPTION_STRING ",version="
00236
00247 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00248
00262 U_STABLE int U_EXPORT2
00263 ucnv_compareNames(const char *name1, const char *name2);
00264
00265
00301 U_STABLE UConverter* U_EXPORT2
00302 ucnv_open(const char *converterName, UErrorCode *err);
00303
00304
00328 U_STABLE UConverter* U_EXPORT2
00329 ucnv_openU(const UChar *name,
00330 UErrorCode *err);
00331
00396 U_STABLE UConverter* U_EXPORT2
00397 ucnv_openCCSID(int32_t codepage,
00398 UConverterPlatform platform,
00399 UErrorCode * err);
00400
00431 U_STABLE UConverter* U_EXPORT2
00432 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00433
00450 U_STABLE UConverter * U_EXPORT2
00451 ucnv_safeClone(const UConverter *cnv,
00452 void *stackBuffer,
00453 int32_t *pBufferSize,
00454 UErrorCode *status);
00455
00462 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
00463
00475 U_STABLE void U_EXPORT2
00476 ucnv_close(UConverter * converter);
00477
00492 U_STABLE void U_EXPORT2
00493 ucnv_getSubstChars(const UConverter *converter,
00494 char *subChars,
00495 int8_t *len,
00496 UErrorCode *err);
00497
00510 U_STABLE void U_EXPORT2
00511 ucnv_setSubstChars(UConverter *converter,
00512 const char *subChars,
00513 int8_t len,
00514 UErrorCode *err);
00515
00529 U_STABLE void U_EXPORT2
00530 ucnv_getInvalidChars(const UConverter *converter,
00531 char *errBytes,
00532 int8_t *len,
00533 UErrorCode *err);
00534
00548 U_STABLE void U_EXPORT2
00549 ucnv_getInvalidUChars(const UConverter *converter,
00550 UChar *errUChars,
00551 int8_t *len,
00552 UErrorCode *err);
00553
00561 U_STABLE void U_EXPORT2
00562 ucnv_reset(UConverter *converter);
00563
00572 U_STABLE void U_EXPORT2
00573 ucnv_resetToUnicode(UConverter *converter);
00574
00583 U_STABLE void U_EXPORT2
00584 ucnv_resetFromUnicode(UConverter *converter);
00585
00634 U_STABLE int8_t U_EXPORT2
00635 ucnv_getMaxCharSize(const UConverter *converter);
00636
00637 #ifndef U_HIDE_DRAFT_API
00638
00658 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00659 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00660
00661 #endif
00662
00671 U_STABLE int8_t U_EXPORT2
00672 ucnv_getMinCharSize(const UConverter *converter);
00673
00688 U_STABLE int32_t U_EXPORT2
00689 ucnv_getDisplayName(const UConverter *converter,
00690 const char *displayLocale,
00691 UChar *displayName,
00692 int32_t displayNameCapacity,
00693 UErrorCode *err);
00694
00705 U_STABLE const char * U_EXPORT2
00706 ucnv_getName(const UConverter *converter, UErrorCode *err);
00707
00731 U_STABLE int32_t U_EXPORT2
00732 ucnv_getCCSID(const UConverter *converter,
00733 UErrorCode *err);
00734
00745 U_STABLE UConverterPlatform U_EXPORT2
00746 ucnv_getPlatform(const UConverter *converter,
00747 UErrorCode *err);
00748
00757 U_STABLE UConverterType U_EXPORT2
00758 ucnv_getType(const UConverter * converter);
00759
00775 U_STABLE void U_EXPORT2
00776 ucnv_getStarters(const UConverter* converter,
00777 UBool starters[256],
00778 UErrorCode* err);
00779
00780
00786 typedef enum UConverterUnicodeSet {
00788 UCNV_ROUNDTRIP_SET,
00790 UCNV_SET_COUNT
00791 } UConverterUnicodeSet;
00792
00793
00828 U_STABLE void U_EXPORT2
00829 ucnv_getUnicodeSet(const UConverter *cnv,
00830 USet *setFillIn,
00831 UConverterUnicodeSet whichSet,
00832 UErrorCode *pErrorCode);
00833
00845 U_STABLE void U_EXPORT2
00846 ucnv_getToUCallBack (const UConverter * converter,
00847 UConverterToUCallback *action,
00848 const void **context);
00849
00861 U_STABLE void U_EXPORT2
00862 ucnv_getFromUCallBack (const UConverter * converter,
00863 UConverterFromUCallback *action,
00864 const void **context);
00865
00881 U_STABLE void U_EXPORT2
00882 ucnv_setToUCallBack (UConverter * converter,
00883 UConverterToUCallback newAction,
00884 const void* newContext,
00885 UConverterToUCallback *oldAction,
00886 const void** oldContext,
00887 UErrorCode * err);
00888
00904 U_STABLE void U_EXPORT2
00905 ucnv_setFromUCallBack (UConverter * converter,
00906 UConverterFromUCallback newAction,
00907 const void *newContext,
00908 UConverterFromUCallback *oldAction,
00909 const void **oldContext,
00910 UErrorCode * err);
00911
00970 U_STABLE void U_EXPORT2
00971 ucnv_fromUnicode (UConverter * converter,
00972 char **target,
00973 const char *targetLimit,
00974 const UChar ** source,
00975 const UChar * sourceLimit,
00976 int32_t* offsets,
00977 UBool flush,
00978 UErrorCode * err);
00979
01039 U_STABLE void U_EXPORT2
01040 ucnv_toUnicode(UConverter *converter,
01041 UChar **target,
01042 const UChar *targetLimit,
01043 const char **source,
01044 const char *sourceLimit,
01045 int32_t *offsets,
01046 UBool flush,
01047 UErrorCode *err);
01048
01076 U_STABLE int32_t U_EXPORT2
01077 ucnv_fromUChars(UConverter *cnv,
01078 char *dest, int32_t destCapacity,
01079 const UChar *src, int32_t srcLength,
01080 UErrorCode *pErrorCode);
01081
01108 U_STABLE int32_t U_EXPORT2
01109 ucnv_toUChars(UConverter *cnv,
01110 UChar *dest, int32_t destCapacity,
01111 const char *src, int32_t srcLength,
01112 UErrorCode *pErrorCode);
01113
01184 U_STABLE UChar32 U_EXPORT2
01185 ucnv_getNextUChar(UConverter * converter,
01186 const char **source,
01187 const char * sourceLimit,
01188 UErrorCode * err);
01189
01318 U_STABLE void U_EXPORT2
01319 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01320 char **target, const char *targetLimit,
01321 const char **source, const char *sourceLimit,
01322 UChar *pivotStart, UChar **pivotSource,
01323 UChar **pivotTarget, const UChar *pivotLimit,
01324 UBool reset, UBool flush,
01325 UErrorCode *pErrorCode);
01326
01382 U_STABLE int32_t U_EXPORT2
01383 ucnv_convert(const char *toConverterName,
01384 const char *fromConverterName,
01385 char *target,
01386 int32_t targetCapacity,
01387 const char *source,
01388 int32_t sourceLength,
01389 UErrorCode *pErrorCode);
01390
01436 U_STABLE int32_t U_EXPORT2
01437 ucnv_toAlgorithmic(UConverterType algorithmicType,
01438 UConverter *cnv,
01439 char *target, int32_t targetCapacity,
01440 const char *source, int32_t sourceLength,
01441 UErrorCode *pErrorCode);
01442
01488 U_STABLE int32_t U_EXPORT2
01489 ucnv_fromAlgorithmic(UConverter *cnv,
01490 UConverterType algorithmicType,
01491 char *target, int32_t targetCapacity,
01492 const char *source, int32_t sourceLength,
01493 UErrorCode *pErrorCode);
01494
01502 U_STABLE int32_t U_EXPORT2
01503 ucnv_flushCache(void);
01504
01512 U_STABLE int32_t U_EXPORT2
01513 ucnv_countAvailable(void);
01514
01525 U_STABLE const char* U_EXPORT2
01526 ucnv_getAvailableName(int32_t n);
01527
01540 U_STABLE UEnumeration * U_EXPORT2
01541 ucnv_openAllNames(UErrorCode *pErrorCode);
01542
01553 U_STABLE uint16_t U_EXPORT2
01554 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01555
01568 U_STABLE const char * U_EXPORT2
01569 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01570
01584 U_STABLE void U_EXPORT2
01585 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01586
01610 U_STABLE UEnumeration * U_EXPORT2
01611 ucnv_openStandardNames(const char *convName,
01612 const char *standard,
01613 UErrorCode *pErrorCode);
01614
01620 U_STABLE uint16_t U_EXPORT2
01621 ucnv_countStandards(void);
01622
01630 U_STABLE const char * U_EXPORT2
01631 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01632
01652 U_STABLE const char * U_EXPORT2
01653 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01654
01674 U_STABLE const char * U_EXPORT2
01675 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01676
01687 U_STABLE const char * U_EXPORT2
01688 ucnv_getDefaultName(void);
01689
01698 U_STABLE void U_EXPORT2
01699 ucnv_setDefaultName(const char *name);
01700
01718 U_STABLE void U_EXPORT2
01719 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01720
01729 U_STABLE UBool U_EXPORT2
01730 ucnv_isAmbiguous(const UConverter *cnv);
01731
01739 U_STABLE void U_EXPORT2
01740 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01741
01748 U_STABLE UBool U_EXPORT2
01749 ucnv_usesFallback(const UConverter *cnv);
01750
01808 U_STABLE const char* U_EXPORT2
01809 ucnv_detectUnicodeSignature(const char* source,
01810 int32_t sourceLength,
01811 int32_t *signatureLength,
01812 UErrorCode *pErrorCode);
01813
01814 #endif
01815
01816 #endif
01817