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
00244 #define UCNV_VERSION_OPTION_STRING ",version="
00245
00256 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00257
00273 U_STABLE int U_EXPORT2
00274 ucnv_compareNames(const char *name1, const char *name2);
00275
00276
00325 U_STABLE UConverter* U_EXPORT2
00326 ucnv_open(const char *converterName, UErrorCode *err);
00327
00328
00355 U_STABLE UConverter* U_EXPORT2
00356 ucnv_openU(const UChar *name,
00357 UErrorCode *err);
00358
00423 U_STABLE UConverter* U_EXPORT2
00424 ucnv_openCCSID(int32_t codepage,
00425 UConverterPlatform platform,
00426 UErrorCode * err);
00427
00458 U_STABLE UConverter* U_EXPORT2
00459 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00460
00498 U_STABLE UConverter * U_EXPORT2
00499 ucnv_safeClone(const UConverter *cnv,
00500 void *stackBuffer,
00501 int32_t *pBufferSize,
00502 UErrorCode *status);
00503
00510 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
00511
00523 U_STABLE void U_EXPORT2
00524 ucnv_close(UConverter * converter);
00525
00543 U_STABLE void U_EXPORT2
00544 ucnv_getSubstChars(const UConverter *converter,
00545 char *subChars,
00546 int8_t *len,
00547 UErrorCode *err);
00548
00568 U_STABLE void U_EXPORT2
00569 ucnv_setSubstChars(UConverter *converter,
00570 const char *subChars,
00571 int8_t len,
00572 UErrorCode *err);
00573
00601 U_STABLE void U_EXPORT2
00602 ucnv_setSubstString(UConverter *cnv,
00603 const UChar *s,
00604 int32_t length,
00605 UErrorCode *err);
00606
00620 U_STABLE void U_EXPORT2
00621 ucnv_getInvalidChars(const UConverter *converter,
00622 char *errBytes,
00623 int8_t *len,
00624 UErrorCode *err);
00625
00639 U_STABLE void U_EXPORT2
00640 ucnv_getInvalidUChars(const UConverter *converter,
00641 UChar *errUChars,
00642 int8_t *len,
00643 UErrorCode *err);
00644
00652 U_STABLE void U_EXPORT2
00653 ucnv_reset(UConverter *converter);
00654
00663 U_STABLE void U_EXPORT2
00664 ucnv_resetToUnicode(UConverter *converter);
00665
00674 U_STABLE void U_EXPORT2
00675 ucnv_resetFromUnicode(UConverter *converter);
00676
00725 U_STABLE int8_t U_EXPORT2
00726 ucnv_getMaxCharSize(const UConverter *converter);
00727
00747 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00748 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00749
00758 U_STABLE int8_t U_EXPORT2
00759 ucnv_getMinCharSize(const UConverter *converter);
00760
00775 U_STABLE int32_t U_EXPORT2
00776 ucnv_getDisplayName(const UConverter *converter,
00777 const char *displayLocale,
00778 UChar *displayName,
00779 int32_t displayNameCapacity,
00780 UErrorCode *err);
00781
00792 U_STABLE const char * U_EXPORT2
00793 ucnv_getName(const UConverter *converter, UErrorCode *err);
00794
00818 U_STABLE int32_t U_EXPORT2
00819 ucnv_getCCSID(const UConverter *converter,
00820 UErrorCode *err);
00821
00832 U_STABLE UConverterPlatform U_EXPORT2
00833 ucnv_getPlatform(const UConverter *converter,
00834 UErrorCode *err);
00835
00844 U_STABLE UConverterType U_EXPORT2
00845 ucnv_getType(const UConverter * converter);
00846
00862 U_STABLE void U_EXPORT2
00863 ucnv_getStarters(const UConverter* converter,
00864 UBool starters[256],
00865 UErrorCode* err);
00866
00867
00873 typedef enum UConverterUnicodeSet {
00875 UCNV_ROUNDTRIP_SET,
00877 UCNV_ROUNDTRIP_AND_FALLBACK_SET,
00879 UCNV_SET_COUNT
00880 } UConverterUnicodeSet;
00881
00882
00928 U_STABLE void U_EXPORT2
00929 ucnv_getUnicodeSet(const UConverter *cnv,
00930 USet *setFillIn,
00931 UConverterUnicodeSet whichSet,
00932 UErrorCode *pErrorCode);
00933
00945 U_STABLE void U_EXPORT2
00946 ucnv_getToUCallBack (const UConverter * converter,
00947 UConverterToUCallback *action,
00948 const void **context);
00949
00961 U_STABLE void U_EXPORT2
00962 ucnv_getFromUCallBack (const UConverter * converter,
00963 UConverterFromUCallback *action,
00964 const void **context);
00965
00981 U_STABLE void U_EXPORT2
00982 ucnv_setToUCallBack (UConverter * converter,
00983 UConverterToUCallback newAction,
00984 const void* newContext,
00985 UConverterToUCallback *oldAction,
00986 const void** oldContext,
00987 UErrorCode * err);
00988
01004 U_STABLE void U_EXPORT2
01005 ucnv_setFromUCallBack (UConverter * converter,
01006 UConverterFromUCallback newAction,
01007 const void *newContext,
01008 UConverterFromUCallback *oldAction,
01009 const void **oldContext,
01010 UErrorCode * err);
01011
01070 U_STABLE void U_EXPORT2
01071 ucnv_fromUnicode (UConverter * converter,
01072 char **target,
01073 const char *targetLimit,
01074 const UChar ** source,
01075 const UChar * sourceLimit,
01076 int32_t* offsets,
01077 UBool flush,
01078 UErrorCode * err);
01079
01139 U_STABLE void U_EXPORT2
01140 ucnv_toUnicode(UConverter *converter,
01141 UChar **target,
01142 const UChar *targetLimit,
01143 const char **source,
01144 const char *sourceLimit,
01145 int32_t *offsets,
01146 UBool flush,
01147 UErrorCode *err);
01148
01176 U_STABLE int32_t U_EXPORT2
01177 ucnv_fromUChars(UConverter *cnv,
01178 char *dest, int32_t destCapacity,
01179 const UChar *src, int32_t srcLength,
01180 UErrorCode *pErrorCode);
01181
01208 U_STABLE int32_t U_EXPORT2
01209 ucnv_toUChars(UConverter *cnv,
01210 UChar *dest, int32_t destCapacity,
01211 const char *src, int32_t srcLength,
01212 UErrorCode *pErrorCode);
01213
01284 U_STABLE UChar32 U_EXPORT2
01285 ucnv_getNextUChar(UConverter * converter,
01286 const char **source,
01287 const char * sourceLimit,
01288 UErrorCode * err);
01289
01428 U_STABLE void U_EXPORT2
01429 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01430 char **target, const char *targetLimit,
01431 const char **source, const char *sourceLimit,
01432 UChar *pivotStart, UChar **pivotSource,
01433 UChar **pivotTarget, const UChar *pivotLimit,
01434 UBool reset, UBool flush,
01435 UErrorCode *pErrorCode);
01436
01492 U_STABLE int32_t U_EXPORT2
01493 ucnv_convert(const char *toConverterName,
01494 const char *fromConverterName,
01495 char *target,
01496 int32_t targetCapacity,
01497 const char *source,
01498 int32_t sourceLength,
01499 UErrorCode *pErrorCode);
01500
01546 U_STABLE int32_t U_EXPORT2
01547 ucnv_toAlgorithmic(UConverterType algorithmicType,
01548 UConverter *cnv,
01549 char *target, int32_t targetCapacity,
01550 const char *source, int32_t sourceLength,
01551 UErrorCode *pErrorCode);
01552
01598 U_STABLE int32_t U_EXPORT2
01599 ucnv_fromAlgorithmic(UConverter *cnv,
01600 UConverterType algorithmicType,
01601 char *target, int32_t targetCapacity,
01602 const char *source, int32_t sourceLength,
01603 UErrorCode *pErrorCode);
01604
01612 U_STABLE int32_t U_EXPORT2
01613 ucnv_flushCache(void);
01614
01622 U_STABLE int32_t U_EXPORT2
01623 ucnv_countAvailable(void);
01624
01635 U_STABLE const char* U_EXPORT2
01636 ucnv_getAvailableName(int32_t n);
01637
01650 U_STABLE UEnumeration * U_EXPORT2
01651 ucnv_openAllNames(UErrorCode *pErrorCode);
01652
01663 U_STABLE uint16_t U_EXPORT2
01664 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01665
01678 U_STABLE const char * U_EXPORT2
01679 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01680
01694 U_STABLE void U_EXPORT2
01695 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01696
01720 U_STABLE UEnumeration * U_EXPORT2
01721 ucnv_openStandardNames(const char *convName,
01722 const char *standard,
01723 UErrorCode *pErrorCode);
01724
01730 U_STABLE uint16_t U_EXPORT2
01731 ucnv_countStandards(void);
01732
01740 U_STABLE const char * U_EXPORT2
01741 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01742
01762 U_STABLE const char * U_EXPORT2
01763 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01764
01784 U_STABLE const char * U_EXPORT2
01785 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01786
01801 U_STABLE const char * U_EXPORT2
01802 ucnv_getDefaultName(void);
01803
01820 U_STABLE void U_EXPORT2
01821 ucnv_setDefaultName(const char *name);
01822
01840 U_STABLE void U_EXPORT2
01841 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01842
01851 U_STABLE UBool U_EXPORT2
01852 ucnv_isAmbiguous(const UConverter *cnv);
01853
01869 U_STABLE void U_EXPORT2
01870 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01871
01881 U_STABLE UBool U_EXPORT2
01882 ucnv_usesFallback(const UConverter *cnv);
01883
01940 U_STABLE const char* U_EXPORT2
01941 ucnv_detectUnicodeSignature(const char* source,
01942 int32_t sourceLength,
01943 int32_t *signatureLength,
01944 UErrorCode *pErrorCode);
01945
01957 U_STABLE int32_t U_EXPORT2
01958 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
01959
01971 U_STABLE int32_t U_EXPORT2
01972 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
01973
01974 #endif
01975
01976 #endif
01977