00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00048 #ifndef UCNV_H
00049 #define UCNV_H
00050
00051 #include "unicode/ucnv_err.h"
00052 #include "unicode/uenum.h"
00053
00054 #if U_SHOW_CPLUSPLUS_API
00055 #include "unicode/localpointer.h"
00056 #endif // U_SHOW_CPLUSPLUS_API
00057
00058 #if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
00059
00060 #define USET_DEFINED
00061
00070 typedef struct USet USet;
00071
00072 #endif
00073
00074 #if !UCONFIG_NO_CONVERSION
00075
00076 U_CDECL_BEGIN
00077
00079 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00080
00081 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00082
00084 #define UCNV_SI 0x0F
00085
00086 #define UCNV_SO 0x0E
00087
00093 typedef enum {
00095 UCNV_UNSUPPORTED_CONVERTER = -1,
00097 UCNV_SBCS = 0,
00099 UCNV_DBCS = 1,
00101 UCNV_MBCS = 2,
00103 UCNV_LATIN_1 = 3,
00105 UCNV_UTF8 = 4,
00107 UCNV_UTF16_BigEndian = 5,
00109 UCNV_UTF16_LittleEndian = 6,
00111 UCNV_UTF32_BigEndian = 7,
00113 UCNV_UTF32_LittleEndian = 8,
00115 UCNV_EBCDIC_STATEFUL = 9,
00117 UCNV_ISO_2022 = 10,
00118
00120 UCNV_LMBCS_1 = 11,
00122 UCNV_LMBCS_2,
00124 UCNV_LMBCS_3,
00126 UCNV_LMBCS_4,
00128 UCNV_LMBCS_5,
00130 UCNV_LMBCS_6,
00132 UCNV_LMBCS_8,
00134 UCNV_LMBCS_11,
00136 UCNV_LMBCS_16,
00138 UCNV_LMBCS_17,
00140 UCNV_LMBCS_18,
00142 UCNV_LMBCS_19,
00144 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00146 UCNV_HZ,
00148 UCNV_SCSU,
00150 UCNV_ISCII,
00152 UCNV_US_ASCII,
00154 UCNV_UTF7,
00156 UCNV_BOCU1,
00158 UCNV_UTF16,
00160 UCNV_UTF32,
00162 UCNV_CESU8,
00164 UCNV_IMAP_MAILBOX,
00166 UCNV_COMPOUND_TEXT,
00167
00168
00169 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00170 } UConverterType;
00171
00181 typedef enum {
00182 UCNV_UNKNOWN = -1,
00183 UCNV_IBM = 0
00184 } UConverterPlatform;
00185
00201 typedef void (U_EXPORT2 *UConverterToUCallback) (
00202 const void* context,
00203 UConverterToUnicodeArgs *args,
00204 const char *codeUnits,
00205 int32_t length,
00206 UConverterCallbackReason reason,
00207 UErrorCode *pErrorCode);
00208
00224 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00225 const void* context,
00226 UConverterFromUnicodeArgs *args,
00227 const UChar* codeUnits,
00228 int32_t length,
00229 UChar32 codePoint,
00230 UConverterCallbackReason reason,
00231 UErrorCode *pErrorCode);
00232
00233 U_CDECL_END
00234
00240 #define UCNV_OPTION_SEP_CHAR ','
00241
00247 #define UCNV_OPTION_SEP_STRING ","
00248
00254 #define UCNV_VALUE_SEP_CHAR '='
00255
00261 #define UCNV_VALUE_SEP_STRING "="
00262
00271 #define UCNV_LOCALE_OPTION_STRING ",locale="
00272
00284 #define UCNV_VERSION_OPTION_STRING ",version="
00285
00296 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00297
00313 U_CAPI int U_EXPORT2
00314 ucnv_compareNames(const char *name1, const char *name2);
00315
00316
00367 U_CAPI UConverter* U_EXPORT2
00368 ucnv_open(const char *converterName, UErrorCode *err);
00369
00370
00397 U_CAPI UConverter* U_EXPORT2
00398 ucnv_openU(const UChar *name,
00399 UErrorCode *err);
00400
00465 U_CAPI UConverter* U_EXPORT2
00466 ucnv_openCCSID(int32_t codepage,
00467 UConverterPlatform platform,
00468 UErrorCode * err);
00469
00500 U_CAPI UConverter* U_EXPORT2
00501 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00502
00513 U_CAPI UConverter* U_EXPORT2 ucnv_clone(const UConverter *cnv, UErrorCode *status);
00514
00515 #ifndef U_HIDE_DEPRECATED_API
00516
00556 U_DEPRECATED UConverter * U_EXPORT2
00557 ucnv_safeClone(const UConverter *cnv,
00558 void *stackBuffer,
00559 int32_t *pBufferSize,
00560 UErrorCode *status);
00561
00568 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
00569
00570 #endif
00571
00583 U_CAPI void U_EXPORT2
00584 ucnv_close(UConverter * converter);
00585
00586 #if U_SHOW_CPLUSPLUS_API
00587
00588 U_NAMESPACE_BEGIN
00589
00599 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
00600
00601 U_NAMESPACE_END
00602
00603 #endif
00604
00622 U_CAPI void U_EXPORT2
00623 ucnv_getSubstChars(const UConverter *converter,
00624 char *subChars,
00625 int8_t *len,
00626 UErrorCode *err);
00627
00647 U_CAPI void U_EXPORT2
00648 ucnv_setSubstChars(UConverter *converter,
00649 const char *subChars,
00650 int8_t len,
00651 UErrorCode *err);
00652
00680 U_CAPI void U_EXPORT2
00681 ucnv_setSubstString(UConverter *cnv,
00682 const UChar *s,
00683 int32_t length,
00684 UErrorCode *err);
00685
00699 U_CAPI void U_EXPORT2
00700 ucnv_getInvalidChars(const UConverter *converter,
00701 char *errBytes,
00702 int8_t *len,
00703 UErrorCode *err);
00704
00718 U_CAPI void U_EXPORT2
00719 ucnv_getInvalidUChars(const UConverter *converter,
00720 UChar *errUChars,
00721 int8_t *len,
00722 UErrorCode *err);
00723
00731 U_CAPI void U_EXPORT2
00732 ucnv_reset(UConverter *converter);
00733
00742 U_CAPI void U_EXPORT2
00743 ucnv_resetToUnicode(UConverter *converter);
00744
00753 U_CAPI void U_EXPORT2
00754 ucnv_resetFromUnicode(UConverter *converter);
00755
00806 U_CAPI int8_t U_EXPORT2
00807 ucnv_getMaxCharSize(const UConverter *converter);
00808
00828 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00829 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00830
00839 U_CAPI int8_t U_EXPORT2
00840 ucnv_getMinCharSize(const UConverter *converter);
00841
00856 U_CAPI int32_t U_EXPORT2
00857 ucnv_getDisplayName(const UConverter *converter,
00858 const char *displayLocale,
00859 UChar *displayName,
00860 int32_t displayNameCapacity,
00861 UErrorCode *err);
00862
00873 U_CAPI const char * U_EXPORT2
00874 ucnv_getName(const UConverter *converter, UErrorCode *err);
00875
00899 U_CAPI int32_t U_EXPORT2
00900 ucnv_getCCSID(const UConverter *converter,
00901 UErrorCode *err);
00902
00913 U_CAPI UConverterPlatform U_EXPORT2
00914 ucnv_getPlatform(const UConverter *converter,
00915 UErrorCode *err);
00916
00925 U_CAPI UConverterType U_EXPORT2
00926 ucnv_getType(const UConverter * converter);
00927
00943 U_CAPI void U_EXPORT2
00944 ucnv_getStarters(const UConverter* converter,
00945 UBool starters[256],
00946 UErrorCode* err);
00947
00948
00954 typedef enum UConverterUnicodeSet {
00956 UCNV_ROUNDTRIP_SET,
00958 UCNV_ROUNDTRIP_AND_FALLBACK_SET,
00959 #ifndef U_HIDE_DEPRECATED_API
00960
00964 UCNV_SET_COUNT
00965 #endif // U_HIDE_DEPRECATED_API
00966 } UConverterUnicodeSet;
00967
00968
01014 U_CAPI void U_EXPORT2
01015 ucnv_getUnicodeSet(const UConverter *cnv,
01016 USet *setFillIn,
01017 UConverterUnicodeSet whichSet,
01018 UErrorCode *pErrorCode);
01019
01031 U_CAPI void U_EXPORT2
01032 ucnv_getToUCallBack (const UConverter * converter,
01033 UConverterToUCallback *action,
01034 const void **context);
01035
01047 U_CAPI void U_EXPORT2
01048 ucnv_getFromUCallBack (const UConverter * converter,
01049 UConverterFromUCallback *action,
01050 const void **context);
01051
01067 U_CAPI void U_EXPORT2
01068 ucnv_setToUCallBack (UConverter * converter,
01069 UConverterToUCallback newAction,
01070 const void* newContext,
01071 UConverterToUCallback *oldAction,
01072 const void** oldContext,
01073 UErrorCode * err);
01074
01090 U_CAPI void U_EXPORT2
01091 ucnv_setFromUCallBack (UConverter * converter,
01092 UConverterFromUCallback newAction,
01093 const void *newContext,
01094 UConverterFromUCallback *oldAction,
01095 const void **oldContext,
01096 UErrorCode * err);
01097
01156 U_CAPI void U_EXPORT2
01157 ucnv_fromUnicode (UConverter * converter,
01158 char **target,
01159 const char *targetLimit,
01160 const UChar ** source,
01161 const UChar * sourceLimit,
01162 int32_t* offsets,
01163 UBool flush,
01164 UErrorCode * err);
01165
01225 U_CAPI void U_EXPORT2
01226 ucnv_toUnicode(UConverter *converter,
01227 UChar **target,
01228 const UChar *targetLimit,
01229 const char **source,
01230 const char *sourceLimit,
01231 int32_t *offsets,
01232 UBool flush,
01233 UErrorCode *err);
01234
01262 U_CAPI int32_t U_EXPORT2
01263 ucnv_fromUChars(UConverter *cnv,
01264 char *dest, int32_t destCapacity,
01265 const UChar *src, int32_t srcLength,
01266 UErrorCode *pErrorCode);
01267
01294 U_CAPI int32_t U_EXPORT2
01295 ucnv_toUChars(UConverter *cnv,
01296 UChar *dest, int32_t destCapacity,
01297 const char *src, int32_t srcLength,
01298 UErrorCode *pErrorCode);
01299
01370 U_CAPI UChar32 U_EXPORT2
01371 ucnv_getNextUChar(UConverter * converter,
01372 const char **source,
01373 const char * sourceLimit,
01374 UErrorCode * err);
01375
01514 U_CAPI void U_EXPORT2
01515 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01516 char **target, const char *targetLimit,
01517 const char **source, const char *sourceLimit,
01518 UChar *pivotStart, UChar **pivotSource,
01519 UChar **pivotTarget, const UChar *pivotLimit,
01520 UBool reset, UBool flush,
01521 UErrorCode *pErrorCode);
01522
01578 U_CAPI int32_t U_EXPORT2
01579 ucnv_convert(const char *toConverterName,
01580 const char *fromConverterName,
01581 char *target,
01582 int32_t targetCapacity,
01583 const char *source,
01584 int32_t sourceLength,
01585 UErrorCode *pErrorCode);
01586
01632 U_CAPI int32_t U_EXPORT2
01633 ucnv_toAlgorithmic(UConverterType algorithmicType,
01634 UConverter *cnv,
01635 char *target, int32_t targetCapacity,
01636 const char *source, int32_t sourceLength,
01637 UErrorCode *pErrorCode);
01638
01684 U_CAPI int32_t U_EXPORT2
01685 ucnv_fromAlgorithmic(UConverter *cnv,
01686 UConverterType algorithmicType,
01687 char *target, int32_t targetCapacity,
01688 const char *source, int32_t sourceLength,
01689 UErrorCode *pErrorCode);
01690
01698 U_CAPI int32_t U_EXPORT2
01699 ucnv_flushCache(void);
01700
01708 U_CAPI int32_t U_EXPORT2
01709 ucnv_countAvailable(void);
01710
01721 U_CAPI const char* U_EXPORT2
01722 ucnv_getAvailableName(int32_t n);
01723
01736 U_CAPI UEnumeration * U_EXPORT2
01737 ucnv_openAllNames(UErrorCode *pErrorCode);
01738
01749 U_CAPI uint16_t U_EXPORT2
01750 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01751
01764 U_CAPI const char * U_EXPORT2
01765 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01766
01780 U_CAPI void U_EXPORT2
01781 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01782
01806 U_CAPI UEnumeration * U_EXPORT2
01807 ucnv_openStandardNames(const char *convName,
01808 const char *standard,
01809 UErrorCode *pErrorCode);
01810
01816 U_CAPI uint16_t U_EXPORT2
01817 ucnv_countStandards(void);
01818
01826 U_CAPI const char * U_EXPORT2
01827 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01828
01848 U_CAPI const char * U_EXPORT2
01849 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01850
01870 U_CAPI const char * U_EXPORT2
01871 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01872
01887 U_CAPI const char * U_EXPORT2
01888 ucnv_getDefaultName(void);
01889
01890 #ifndef U_HIDE_SYSTEM_API
01891
01907 U_CAPI void U_EXPORT2
01908 ucnv_setDefaultName(const char *name);
01909 #endif
01910
01928 U_CAPI void U_EXPORT2
01929 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01930
01939 U_CAPI UBool U_EXPORT2
01940 ucnv_isAmbiguous(const UConverter *cnv);
01941
01957 U_CAPI void U_EXPORT2
01958 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01959
01969 U_CAPI UBool U_EXPORT2
01970 ucnv_usesFallback(const UConverter *cnv);
01971
02001 U_CAPI const char* U_EXPORT2
02002 ucnv_detectUnicodeSignature(const char* source,
02003 int32_t sourceLength,
02004 int32_t *signatureLength,
02005 UErrorCode *pErrorCode);
02006
02018 U_CAPI int32_t U_EXPORT2
02019 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
02020
02032 U_CAPI int32_t U_EXPORT2
02033 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
02034
02050 U_CAPI UBool U_EXPORT2
02051 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status);
02052
02053 #endif
02054
02055 #endif
02056