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
00161 typedef void (U_EXPORT2 *UConverterToUCallback) (
00162 const void* context,
00163 UConverterToUnicodeArgs *args,
00164 const char *codeUnits,
00165 int32_t length,
00166 UConverterCallbackReason reason,
00167 UErrorCode *pErrorCode);
00168
00184 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00185 const void* context,
00186 UConverterFromUnicodeArgs *args,
00187 const UChar* codeUnits,
00188 int32_t length,
00189 UChar32 codePoint,
00190 UConverterCallbackReason reason,
00191 UErrorCode *pErrorCode);
00192
00193 U_CDECL_END
00194
00200 #define UCNV_OPTION_SEP_CHAR ','
00201
00207 #define UCNV_OPTION_SEP_STRING ","
00208
00214 #define UCNV_VALUE_SEP_CHAR '='
00215
00221 #define UCNV_VALUE_SEP_STRING "="
00222
00231 #define UCNV_LOCALE_OPTION_STRING ",locale="
00232
00241 #define UCNV_VERSION_OPTION_STRING ",version="
00242
00253 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00254
00268 U_STABLE int U_EXPORT2
00269 ucnv_compareNames(const char *name1, const char *name2);
00270
00271
00307 U_STABLE UConverter* U_EXPORT2
00308 ucnv_open(const char *converterName, UErrorCode *err);
00309
00310
00334 U_STABLE UConverter* U_EXPORT2
00335 ucnv_openU(const UChar *name,
00336 UErrorCode *err);
00337
00402 U_STABLE UConverter* U_EXPORT2
00403 ucnv_openCCSID(int32_t codepage,
00404 UConverterPlatform platform,
00405 UErrorCode * err);
00406
00437 U_STABLE UConverter* U_EXPORT2
00438 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00439
00477 U_STABLE UConverter * U_EXPORT2
00478 ucnv_safeClone(const UConverter *cnv,
00479 void *stackBuffer,
00480 int32_t *pBufferSize,
00481 UErrorCode *status);
00482
00489 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
00490
00502 U_STABLE void U_EXPORT2
00503 ucnv_close(UConverter * converter);
00504
00519 U_STABLE void U_EXPORT2
00520 ucnv_getSubstChars(const UConverter *converter,
00521 char *subChars,
00522 int8_t *len,
00523 UErrorCode *err);
00524
00537 U_STABLE void U_EXPORT2
00538 ucnv_setSubstChars(UConverter *converter,
00539 const char *subChars,
00540 int8_t len,
00541 UErrorCode *err);
00542
00556 U_STABLE void U_EXPORT2
00557 ucnv_getInvalidChars(const UConverter *converter,
00558 char *errBytes,
00559 int8_t *len,
00560 UErrorCode *err);
00561
00575 U_STABLE void U_EXPORT2
00576 ucnv_getInvalidUChars(const UConverter *converter,
00577 UChar *errUChars,
00578 int8_t *len,
00579 UErrorCode *err);
00580
00588 U_STABLE void U_EXPORT2
00589 ucnv_reset(UConverter *converter);
00590
00599 U_STABLE void U_EXPORT2
00600 ucnv_resetToUnicode(UConverter *converter);
00601
00610 U_STABLE void U_EXPORT2
00611 ucnv_resetFromUnicode(UConverter *converter);
00612
00661 U_STABLE int8_t U_EXPORT2
00662 ucnv_getMaxCharSize(const UConverter *converter);
00663
00664 #ifndef U_HIDE_DRAFT_API
00665
00685 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00686 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00687
00688 #endif
00689
00698 U_STABLE int8_t U_EXPORT2
00699 ucnv_getMinCharSize(const UConverter *converter);
00700
00715 U_STABLE int32_t U_EXPORT2
00716 ucnv_getDisplayName(const UConverter *converter,
00717 const char *displayLocale,
00718 UChar *displayName,
00719 int32_t displayNameCapacity,
00720 UErrorCode *err);
00721
00732 U_STABLE const char * U_EXPORT2
00733 ucnv_getName(const UConverter *converter, UErrorCode *err);
00734
00758 U_STABLE int32_t U_EXPORT2
00759 ucnv_getCCSID(const UConverter *converter,
00760 UErrorCode *err);
00761
00772 U_STABLE UConverterPlatform U_EXPORT2
00773 ucnv_getPlatform(const UConverter *converter,
00774 UErrorCode *err);
00775
00784 U_STABLE UConverterType U_EXPORT2
00785 ucnv_getType(const UConverter * converter);
00786
00802 U_STABLE void U_EXPORT2
00803 ucnv_getStarters(const UConverter* converter,
00804 UBool starters[256],
00805 UErrorCode* err);
00806
00807
00813 typedef enum UConverterUnicodeSet {
00815 UCNV_ROUNDTRIP_SET,
00817 UCNV_SET_COUNT
00818 } UConverterUnicodeSet;
00819
00820
00855 U_STABLE void U_EXPORT2
00856 ucnv_getUnicodeSet(const UConverter *cnv,
00857 USet *setFillIn,
00858 UConverterUnicodeSet whichSet,
00859 UErrorCode *pErrorCode);
00860
00872 U_STABLE void U_EXPORT2
00873 ucnv_getToUCallBack (const UConverter * converter,
00874 UConverterToUCallback *action,
00875 const void **context);
00876
00888 U_STABLE void U_EXPORT2
00889 ucnv_getFromUCallBack (const UConverter * converter,
00890 UConverterFromUCallback *action,
00891 const void **context);
00892
00908 U_STABLE void U_EXPORT2
00909 ucnv_setToUCallBack (UConverter * converter,
00910 UConverterToUCallback newAction,
00911 const void* newContext,
00912 UConverterToUCallback *oldAction,
00913 const void** oldContext,
00914 UErrorCode * err);
00915
00931 U_STABLE void U_EXPORT2
00932 ucnv_setFromUCallBack (UConverter * converter,
00933 UConverterFromUCallback newAction,
00934 const void *newContext,
00935 UConverterFromUCallback *oldAction,
00936 const void **oldContext,
00937 UErrorCode * err);
00938
00997 U_STABLE void U_EXPORT2
00998 ucnv_fromUnicode (UConverter * converter,
00999 char **target,
01000 const char *targetLimit,
01001 const UChar ** source,
01002 const UChar * sourceLimit,
01003 int32_t* offsets,
01004 UBool flush,
01005 UErrorCode * err);
01006
01066 U_STABLE void U_EXPORT2
01067 ucnv_toUnicode(UConverter *converter,
01068 UChar **target,
01069 const UChar *targetLimit,
01070 const char **source,
01071 const char *sourceLimit,
01072 int32_t *offsets,
01073 UBool flush,
01074 UErrorCode *err);
01075
01103 U_STABLE int32_t U_EXPORT2
01104 ucnv_fromUChars(UConverter *cnv,
01105 char *dest, int32_t destCapacity,
01106 const UChar *src, int32_t srcLength,
01107 UErrorCode *pErrorCode);
01108
01135 U_STABLE int32_t U_EXPORT2
01136 ucnv_toUChars(UConverter *cnv,
01137 UChar *dest, int32_t destCapacity,
01138 const char *src, int32_t srcLength,
01139 UErrorCode *pErrorCode);
01140
01211 U_STABLE UChar32 U_EXPORT2
01212 ucnv_getNextUChar(UConverter * converter,
01213 const char **source,
01214 const char * sourceLimit,
01215 UErrorCode * err);
01216
01345 U_STABLE void U_EXPORT2
01346 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01347 char **target, const char *targetLimit,
01348 const char **source, const char *sourceLimit,
01349 UChar *pivotStart, UChar **pivotSource,
01350 UChar **pivotTarget, const UChar *pivotLimit,
01351 UBool reset, UBool flush,
01352 UErrorCode *pErrorCode);
01353
01409 U_STABLE int32_t U_EXPORT2
01410 ucnv_convert(const char *toConverterName,
01411 const char *fromConverterName,
01412 char *target,
01413 int32_t targetCapacity,
01414 const char *source,
01415 int32_t sourceLength,
01416 UErrorCode *pErrorCode);
01417
01463 U_STABLE int32_t U_EXPORT2
01464 ucnv_toAlgorithmic(UConverterType algorithmicType,
01465 UConverter *cnv,
01466 char *target, int32_t targetCapacity,
01467 const char *source, int32_t sourceLength,
01468 UErrorCode *pErrorCode);
01469
01515 U_STABLE int32_t U_EXPORT2
01516 ucnv_fromAlgorithmic(UConverter *cnv,
01517 UConverterType algorithmicType,
01518 char *target, int32_t targetCapacity,
01519 const char *source, int32_t sourceLength,
01520 UErrorCode *pErrorCode);
01521
01529 U_STABLE int32_t U_EXPORT2
01530 ucnv_flushCache(void);
01531
01539 U_STABLE int32_t U_EXPORT2
01540 ucnv_countAvailable(void);
01541
01552 U_STABLE const char* U_EXPORT2
01553 ucnv_getAvailableName(int32_t n);
01554
01567 U_STABLE UEnumeration * U_EXPORT2
01568 ucnv_openAllNames(UErrorCode *pErrorCode);
01569
01580 U_STABLE uint16_t U_EXPORT2
01581 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01582
01595 U_STABLE const char * U_EXPORT2
01596 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01597
01611 U_STABLE void U_EXPORT2
01612 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01613
01637 U_STABLE UEnumeration * U_EXPORT2
01638 ucnv_openStandardNames(const char *convName,
01639 const char *standard,
01640 UErrorCode *pErrorCode);
01641
01647 U_STABLE uint16_t U_EXPORT2
01648 ucnv_countStandards(void);
01649
01657 U_STABLE const char * U_EXPORT2
01658 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01659
01679 U_STABLE const char * U_EXPORT2
01680 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01681
01701 U_STABLE const char * U_EXPORT2
01702 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01703
01714 U_STABLE const char * U_EXPORT2
01715 ucnv_getDefaultName(void);
01716
01725 U_STABLE void U_EXPORT2
01726 ucnv_setDefaultName(const char *name);
01727
01745 U_STABLE void U_EXPORT2
01746 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01747
01756 U_STABLE UBool U_EXPORT2
01757 ucnv_isAmbiguous(const UConverter *cnv);
01758
01766 U_STABLE void U_EXPORT2
01767 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01768
01775 U_STABLE UBool U_EXPORT2
01776 ucnv_usesFallback(const UConverter *cnv);
01777
01834 U_STABLE const char* U_EXPORT2
01835 ucnv_detectUnicodeSignature(const char* source,
01836 int32_t sourceLength,
01837 int32_t *signatureLength,
01838 UErrorCode *pErrorCode);
01839
01851 U_DRAFT int32_t U_EXPORT2
01852 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
01853
01865 U_DRAFT int32_t U_EXPORT2
01866 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
01867
01868 #endif
01869
01870 #endif
01871