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 #include "unicode/localpointer.h"
00053
00054 #ifndef __USET_H__
00055
00065 struct USet;
00067 typedef struct USet USet;
00068
00069 #endif
00070
00071 #if !UCONFIG_NO_CONVERSION
00072
00073 U_CDECL_BEGIN
00074
00076 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00077
00078 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00079
00081 #define UCNV_SI 0x0F
00082
00083 #define UCNV_SO 0x0E
00084
00090 typedef enum {
00092 UCNV_UNSUPPORTED_CONVERTER = -1,
00094 UCNV_SBCS = 0,
00096 UCNV_DBCS = 1,
00098 UCNV_MBCS = 2,
00100 UCNV_LATIN_1 = 3,
00102 UCNV_UTF8 = 4,
00104 UCNV_UTF16_BigEndian = 5,
00106 UCNV_UTF16_LittleEndian = 6,
00108 UCNV_UTF32_BigEndian = 7,
00110 UCNV_UTF32_LittleEndian = 8,
00112 UCNV_EBCDIC_STATEFUL = 9,
00114 UCNV_ISO_2022 = 10,
00115
00117 UCNV_LMBCS_1 = 11,
00119 UCNV_LMBCS_2,
00121 UCNV_LMBCS_3,
00123 UCNV_LMBCS_4,
00125 UCNV_LMBCS_5,
00127 UCNV_LMBCS_6,
00129 UCNV_LMBCS_8,
00131 UCNV_LMBCS_11,
00133 UCNV_LMBCS_16,
00135 UCNV_LMBCS_17,
00137 UCNV_LMBCS_18,
00139 UCNV_LMBCS_19,
00141 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00143 UCNV_HZ,
00145 UCNV_SCSU,
00147 UCNV_ISCII,
00149 UCNV_US_ASCII,
00151 UCNV_UTF7,
00153 UCNV_BOCU1,
00155 UCNV_UTF16,
00157 UCNV_UTF32,
00159 UCNV_CESU8,
00161 UCNV_IMAP_MAILBOX,
00163 UCNV_COMPOUND_TEXT,
00164
00165
00166 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00167 } UConverterType;
00168
00178 typedef enum {
00179 UCNV_UNKNOWN = -1,
00180 UCNV_IBM = 0
00181 } UConverterPlatform;
00182
00198 typedef void (U_EXPORT2 *UConverterToUCallback) (
00199 const void* context,
00200 UConverterToUnicodeArgs *args,
00201 const char *codeUnits,
00202 int32_t length,
00203 UConverterCallbackReason reason,
00204 UErrorCode *pErrorCode);
00205
00221 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00222 const void* context,
00223 UConverterFromUnicodeArgs *args,
00224 const UChar* codeUnits,
00225 int32_t length,
00226 UChar32 codePoint,
00227 UConverterCallbackReason reason,
00228 UErrorCode *pErrorCode);
00229
00230 U_CDECL_END
00231
00237 #define UCNV_OPTION_SEP_CHAR ','
00238
00244 #define UCNV_OPTION_SEP_STRING ","
00245
00251 #define UCNV_VALUE_SEP_CHAR '='
00252
00258 #define UCNV_VALUE_SEP_STRING "="
00259
00268 #define UCNV_LOCALE_OPTION_STRING ",locale="
00269
00281 #define UCNV_VERSION_OPTION_STRING ",version="
00282
00293 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00294
00310 U_STABLE int U_EXPORT2
00311 ucnv_compareNames(const char *name1, const char *name2);
00312
00313
00364 U_STABLE UConverter* U_EXPORT2
00365 ucnv_open(const char *converterName, UErrorCode *err);
00366
00367
00394 U_STABLE UConverter* U_EXPORT2
00395 ucnv_openU(const UChar *name,
00396 UErrorCode *err);
00397
00462 U_STABLE UConverter* U_EXPORT2
00463 ucnv_openCCSID(int32_t codepage,
00464 UConverterPlatform platform,
00465 UErrorCode * err);
00466
00497 U_STABLE UConverter* U_EXPORT2
00498 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00499
00539 U_STABLE UConverter * U_EXPORT2
00540 ucnv_safeClone(const UConverter *cnv,
00541 void *stackBuffer,
00542 int32_t *pBufferSize,
00543 UErrorCode *status);
00544
00545 #ifndef U_HIDE_DEPRECATED_API
00546
00553 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
00554
00555 #endif
00556
00568 U_STABLE void U_EXPORT2
00569 ucnv_close(UConverter * converter);
00570
00571 #if U_SHOW_CPLUSPLUS_API
00572
00573 U_NAMESPACE_BEGIN
00574
00584 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
00585
00586 U_NAMESPACE_END
00587
00588 #endif
00589
00607 U_STABLE void U_EXPORT2
00608 ucnv_getSubstChars(const UConverter *converter,
00609 char *subChars,
00610 int8_t *len,
00611 UErrorCode *err);
00612
00632 U_STABLE void U_EXPORT2
00633 ucnv_setSubstChars(UConverter *converter,
00634 const char *subChars,
00635 int8_t len,
00636 UErrorCode *err);
00637
00665 U_STABLE void U_EXPORT2
00666 ucnv_setSubstString(UConverter *cnv,
00667 const UChar *s,
00668 int32_t length,
00669 UErrorCode *err);
00670
00684 U_STABLE void U_EXPORT2
00685 ucnv_getInvalidChars(const UConverter *converter,
00686 char *errBytes,
00687 int8_t *len,
00688 UErrorCode *err);
00689
00703 U_STABLE void U_EXPORT2
00704 ucnv_getInvalidUChars(const UConverter *converter,
00705 UChar *errUChars,
00706 int8_t *len,
00707 UErrorCode *err);
00708
00716 U_STABLE void U_EXPORT2
00717 ucnv_reset(UConverter *converter);
00718
00727 U_STABLE void U_EXPORT2
00728 ucnv_resetToUnicode(UConverter *converter);
00729
00738 U_STABLE void U_EXPORT2
00739 ucnv_resetFromUnicode(UConverter *converter);
00740
00791 U_STABLE int8_t U_EXPORT2
00792 ucnv_getMaxCharSize(const UConverter *converter);
00793
00813 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00814 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00815
00824 U_STABLE int8_t U_EXPORT2
00825 ucnv_getMinCharSize(const UConverter *converter);
00826
00841 U_STABLE int32_t U_EXPORT2
00842 ucnv_getDisplayName(const UConverter *converter,
00843 const char *displayLocale,
00844 UChar *displayName,
00845 int32_t displayNameCapacity,
00846 UErrorCode *err);
00847
00858 U_STABLE const char * U_EXPORT2
00859 ucnv_getName(const UConverter *converter, UErrorCode *err);
00860
00884 U_STABLE int32_t U_EXPORT2
00885 ucnv_getCCSID(const UConverter *converter,
00886 UErrorCode *err);
00887
00898 U_STABLE UConverterPlatform U_EXPORT2
00899 ucnv_getPlatform(const UConverter *converter,
00900 UErrorCode *err);
00901
00910 U_STABLE UConverterType U_EXPORT2
00911 ucnv_getType(const UConverter * converter);
00912
00928 U_STABLE void U_EXPORT2
00929 ucnv_getStarters(const UConverter* converter,
00930 UBool starters[256],
00931 UErrorCode* err);
00932
00933
00939 typedef enum UConverterUnicodeSet {
00941 UCNV_ROUNDTRIP_SET,
00943 UCNV_ROUNDTRIP_AND_FALLBACK_SET,
00945 UCNV_SET_COUNT
00946 } UConverterUnicodeSet;
00947
00948
00994 U_STABLE void U_EXPORT2
00995 ucnv_getUnicodeSet(const UConverter *cnv,
00996 USet *setFillIn,
00997 UConverterUnicodeSet whichSet,
00998 UErrorCode *pErrorCode);
00999
01011 U_STABLE void U_EXPORT2
01012 ucnv_getToUCallBack (const UConverter * converter,
01013 UConverterToUCallback *action,
01014 const void **context);
01015
01027 U_STABLE void U_EXPORT2
01028 ucnv_getFromUCallBack (const UConverter * converter,
01029 UConverterFromUCallback *action,
01030 const void **context);
01031
01047 U_STABLE void U_EXPORT2
01048 ucnv_setToUCallBack (UConverter * converter,
01049 UConverterToUCallback newAction,
01050 const void* newContext,
01051 UConverterToUCallback *oldAction,
01052 const void** oldContext,
01053 UErrorCode * err);
01054
01070 U_STABLE void U_EXPORT2
01071 ucnv_setFromUCallBack (UConverter * converter,
01072 UConverterFromUCallback newAction,
01073 const void *newContext,
01074 UConverterFromUCallback *oldAction,
01075 const void **oldContext,
01076 UErrorCode * err);
01077
01136 U_STABLE void U_EXPORT2
01137 ucnv_fromUnicode (UConverter * converter,
01138 char **target,
01139 const char *targetLimit,
01140 const UChar ** source,
01141 const UChar * sourceLimit,
01142 int32_t* offsets,
01143 UBool flush,
01144 UErrorCode * err);
01145
01205 U_STABLE void U_EXPORT2
01206 ucnv_toUnicode(UConverter *converter,
01207 UChar **target,
01208 const UChar *targetLimit,
01209 const char **source,
01210 const char *sourceLimit,
01211 int32_t *offsets,
01212 UBool flush,
01213 UErrorCode *err);
01214
01242 U_STABLE int32_t U_EXPORT2
01243 ucnv_fromUChars(UConverter *cnv,
01244 char *dest, int32_t destCapacity,
01245 const UChar *src, int32_t srcLength,
01246 UErrorCode *pErrorCode);
01247
01274 U_STABLE int32_t U_EXPORT2
01275 ucnv_toUChars(UConverter *cnv,
01276 UChar *dest, int32_t destCapacity,
01277 const char *src, int32_t srcLength,
01278 UErrorCode *pErrorCode);
01279
01350 U_STABLE UChar32 U_EXPORT2
01351 ucnv_getNextUChar(UConverter * converter,
01352 const char **source,
01353 const char * sourceLimit,
01354 UErrorCode * err);
01355
01494 U_STABLE void U_EXPORT2
01495 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01496 char **target, const char *targetLimit,
01497 const char **source, const char *sourceLimit,
01498 UChar *pivotStart, UChar **pivotSource,
01499 UChar **pivotTarget, const UChar *pivotLimit,
01500 UBool reset, UBool flush,
01501 UErrorCode *pErrorCode);
01502
01558 U_STABLE int32_t U_EXPORT2
01559 ucnv_convert(const char *toConverterName,
01560 const char *fromConverterName,
01561 char *target,
01562 int32_t targetCapacity,
01563 const char *source,
01564 int32_t sourceLength,
01565 UErrorCode *pErrorCode);
01566
01612 U_STABLE int32_t U_EXPORT2
01613 ucnv_toAlgorithmic(UConverterType algorithmicType,
01614 UConverter *cnv,
01615 char *target, int32_t targetCapacity,
01616 const char *source, int32_t sourceLength,
01617 UErrorCode *pErrorCode);
01618
01664 U_STABLE int32_t U_EXPORT2
01665 ucnv_fromAlgorithmic(UConverter *cnv,
01666 UConverterType algorithmicType,
01667 char *target, int32_t targetCapacity,
01668 const char *source, int32_t sourceLength,
01669 UErrorCode *pErrorCode);
01670
01678 U_STABLE int32_t U_EXPORT2
01679 ucnv_flushCache(void);
01680
01688 U_STABLE int32_t U_EXPORT2
01689 ucnv_countAvailable(void);
01690
01701 U_STABLE const char* U_EXPORT2
01702 ucnv_getAvailableName(int32_t n);
01703
01716 U_STABLE UEnumeration * U_EXPORT2
01717 ucnv_openAllNames(UErrorCode *pErrorCode);
01718
01729 U_STABLE uint16_t U_EXPORT2
01730 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01731
01744 U_STABLE const char * U_EXPORT2
01745 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01746
01760 U_STABLE void U_EXPORT2
01761 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01762
01786 U_STABLE UEnumeration * U_EXPORT2
01787 ucnv_openStandardNames(const char *convName,
01788 const char *standard,
01789 UErrorCode *pErrorCode);
01790
01796 U_STABLE uint16_t U_EXPORT2
01797 ucnv_countStandards(void);
01798
01806 U_STABLE const char * U_EXPORT2
01807 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01808
01828 U_STABLE const char * U_EXPORT2
01829 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01830
01850 U_STABLE const char * U_EXPORT2
01851 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01852
01867 U_STABLE const char * U_EXPORT2
01868 ucnv_getDefaultName(void);
01869
01870 #ifndef U_HIDE_SYSTEM_API
01871
01887 U_STABLE void U_EXPORT2
01888 ucnv_setDefaultName(const char *name);
01889 #endif
01890
01908 U_STABLE void U_EXPORT2
01909 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01910
01919 U_STABLE UBool U_EXPORT2
01920 ucnv_isAmbiguous(const UConverter *cnv);
01921
01937 U_STABLE void U_EXPORT2
01938 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01939
01949 U_STABLE UBool U_EXPORT2
01950 ucnv_usesFallback(const UConverter *cnv);
01951
01981 U_STABLE const char* U_EXPORT2
01982 ucnv_detectUnicodeSignature(const char* source,
01983 int32_t sourceLength,
01984 int32_t *signatureLength,
01985 UErrorCode *pErrorCode);
01986
01998 U_STABLE int32_t U_EXPORT2
01999 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
02000
02012 U_STABLE int32_t U_EXPORT2
02013 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
02014
02030 U_STABLE UBool U_EXPORT2
02031 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status);
02032
02033 #endif
02034
02035 #endif
02036