00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00049 #ifndef UCNV_H
00050 #define UCNV_H
00051
00052 #include "unicode/ucnv_err.h"
00053 #include "unicode/uenum.h"
00054 #include "unicode/localpointer.h"
00055
00056 #if !defined(USET_DEFINED) && !defined(U_IN_DOXYGEN)
00057
00058 #define USET_DEFINED
00059
00068 typedef struct USet USet;
00069
00070 #endif
00071
00072 #if !UCONFIG_NO_CONVERSION
00073
00074 U_CDECL_BEGIN
00075
00077 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00078
00079 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00080
00082 #define UCNV_SI 0x0F
00083
00084 #define UCNV_SO 0x0E
00085
00091 typedef enum {
00093 UCNV_UNSUPPORTED_CONVERTER = -1,
00095 UCNV_SBCS = 0,
00097 UCNV_DBCS = 1,
00099 UCNV_MBCS = 2,
00101 UCNV_LATIN_1 = 3,
00103 UCNV_UTF8 = 4,
00105 UCNV_UTF16_BigEndian = 5,
00107 UCNV_UTF16_LittleEndian = 6,
00109 UCNV_UTF32_BigEndian = 7,
00111 UCNV_UTF32_LittleEndian = 8,
00113 UCNV_EBCDIC_STATEFUL = 9,
00115 UCNV_ISO_2022 = 10,
00116
00118 UCNV_LMBCS_1 = 11,
00120 UCNV_LMBCS_2,
00122 UCNV_LMBCS_3,
00124 UCNV_LMBCS_4,
00126 UCNV_LMBCS_5,
00128 UCNV_LMBCS_6,
00130 UCNV_LMBCS_8,
00132 UCNV_LMBCS_11,
00134 UCNV_LMBCS_16,
00136 UCNV_LMBCS_17,
00138 UCNV_LMBCS_18,
00140 UCNV_LMBCS_19,
00142 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00144 UCNV_HZ,
00146 UCNV_SCSU,
00148 UCNV_ISCII,
00150 UCNV_US_ASCII,
00152 UCNV_UTF7,
00154 UCNV_BOCU1,
00156 UCNV_UTF16,
00158 UCNV_UTF32,
00160 UCNV_CESU8,
00162 UCNV_IMAP_MAILBOX,
00164 UCNV_COMPOUND_TEXT,
00165
00166
00167 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00168 } UConverterType;
00169
00179 typedef enum {
00180 UCNV_UNKNOWN = -1,
00181 UCNV_IBM = 0
00182 } UConverterPlatform;
00183
00199 typedef void (U_EXPORT2 *UConverterToUCallback) (
00200 const void* context,
00201 UConverterToUnicodeArgs *args,
00202 const char *codeUnits,
00203 int32_t length,
00204 UConverterCallbackReason reason,
00205 UErrorCode *pErrorCode);
00206
00222 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00223 const void* context,
00224 UConverterFromUnicodeArgs *args,
00225 const UChar* codeUnits,
00226 int32_t length,
00227 UChar32 codePoint,
00228 UConverterCallbackReason reason,
00229 UErrorCode *pErrorCode);
00230
00231 U_CDECL_END
00232
00238 #define UCNV_OPTION_SEP_CHAR ','
00239
00245 #define UCNV_OPTION_SEP_STRING ","
00246
00252 #define UCNV_VALUE_SEP_CHAR '='
00253
00259 #define UCNV_VALUE_SEP_STRING "="
00260
00269 #define UCNV_LOCALE_OPTION_STRING ",locale="
00270
00282 #define UCNV_VERSION_OPTION_STRING ",version="
00283
00294 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00295
00311 U_STABLE int U_EXPORT2
00312 ucnv_compareNames(const char *name1, const char *name2);
00313
00314
00365 U_STABLE UConverter* U_EXPORT2
00366 ucnv_open(const char *converterName, UErrorCode *err);
00367
00368
00395 U_STABLE UConverter* U_EXPORT2
00396 ucnv_openU(const UChar *name,
00397 UErrorCode *err);
00398
00463 U_STABLE UConverter* U_EXPORT2
00464 ucnv_openCCSID(int32_t codepage,
00465 UConverterPlatform platform,
00466 UErrorCode * err);
00467
00498 U_STABLE UConverter* U_EXPORT2
00499 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00500
00540 U_STABLE UConverter * U_EXPORT2
00541 ucnv_safeClone(const UConverter *cnv,
00542 void *stackBuffer,
00543 int32_t *pBufferSize,
00544 UErrorCode *status);
00545
00546 #ifndef U_HIDE_DEPRECATED_API
00547
00554 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
00555
00556 #endif
00557
00569 U_STABLE void U_EXPORT2
00570 ucnv_close(UConverter * converter);
00571
00572 #if U_SHOW_CPLUSPLUS_API
00573
00574 U_NAMESPACE_BEGIN
00575
00585 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
00586
00587 U_NAMESPACE_END
00588
00589 #endif
00590
00608 U_STABLE void U_EXPORT2
00609 ucnv_getSubstChars(const UConverter *converter,
00610 char *subChars,
00611 int8_t *len,
00612 UErrorCode *err);
00613
00633 U_STABLE void U_EXPORT2
00634 ucnv_setSubstChars(UConverter *converter,
00635 const char *subChars,
00636 int8_t len,
00637 UErrorCode *err);
00638
00666 U_STABLE void U_EXPORT2
00667 ucnv_setSubstString(UConverter *cnv,
00668 const UChar *s,
00669 int32_t length,
00670 UErrorCode *err);
00671
00685 U_STABLE void U_EXPORT2
00686 ucnv_getInvalidChars(const UConverter *converter,
00687 char *errBytes,
00688 int8_t *len,
00689 UErrorCode *err);
00690
00704 U_STABLE void U_EXPORT2
00705 ucnv_getInvalidUChars(const UConverter *converter,
00706 UChar *errUChars,
00707 int8_t *len,
00708 UErrorCode *err);
00709
00717 U_STABLE void U_EXPORT2
00718 ucnv_reset(UConverter *converter);
00719
00728 U_STABLE void U_EXPORT2
00729 ucnv_resetToUnicode(UConverter *converter);
00730
00739 U_STABLE void U_EXPORT2
00740 ucnv_resetFromUnicode(UConverter *converter);
00741
00792 U_STABLE int8_t U_EXPORT2
00793 ucnv_getMaxCharSize(const UConverter *converter);
00794
00814 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00815 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00816
00825 U_STABLE int8_t U_EXPORT2
00826 ucnv_getMinCharSize(const UConverter *converter);
00827
00842 U_STABLE int32_t U_EXPORT2
00843 ucnv_getDisplayName(const UConverter *converter,
00844 const char *displayLocale,
00845 UChar *displayName,
00846 int32_t displayNameCapacity,
00847 UErrorCode *err);
00848
00859 U_STABLE const char * U_EXPORT2
00860 ucnv_getName(const UConverter *converter, UErrorCode *err);
00861
00885 U_STABLE int32_t U_EXPORT2
00886 ucnv_getCCSID(const UConverter *converter,
00887 UErrorCode *err);
00888
00899 U_STABLE UConverterPlatform U_EXPORT2
00900 ucnv_getPlatform(const UConverter *converter,
00901 UErrorCode *err);
00902
00911 U_STABLE UConverterType U_EXPORT2
00912 ucnv_getType(const UConverter * converter);
00913
00929 U_STABLE void U_EXPORT2
00930 ucnv_getStarters(const UConverter* converter,
00931 UBool starters[256],
00932 UErrorCode* err);
00933
00934
00940 typedef enum UConverterUnicodeSet {
00942 UCNV_ROUNDTRIP_SET,
00944 UCNV_ROUNDTRIP_AND_FALLBACK_SET,
00945 #ifndef U_HIDE_DEPRECATED_API
00946
00950 UCNV_SET_COUNT
00951 #endif // U_HIDE_DEPRECATED_API
00952 } UConverterUnicodeSet;
00953
00954
01000 U_STABLE void U_EXPORT2
01001 ucnv_getUnicodeSet(const UConverter *cnv,
01002 USet *setFillIn,
01003 UConverterUnicodeSet whichSet,
01004 UErrorCode *pErrorCode);
01005
01017 U_STABLE void U_EXPORT2
01018 ucnv_getToUCallBack (const UConverter * converter,
01019 UConverterToUCallback *action,
01020 const void **context);
01021
01033 U_STABLE void U_EXPORT2
01034 ucnv_getFromUCallBack (const UConverter * converter,
01035 UConverterFromUCallback *action,
01036 const void **context);
01037
01053 U_STABLE void U_EXPORT2
01054 ucnv_setToUCallBack (UConverter * converter,
01055 UConverterToUCallback newAction,
01056 const void* newContext,
01057 UConverterToUCallback *oldAction,
01058 const void** oldContext,
01059 UErrorCode * err);
01060
01076 U_STABLE void U_EXPORT2
01077 ucnv_setFromUCallBack (UConverter * converter,
01078 UConverterFromUCallback newAction,
01079 const void *newContext,
01080 UConverterFromUCallback *oldAction,
01081 const void **oldContext,
01082 UErrorCode * err);
01083
01142 U_STABLE void U_EXPORT2
01143 ucnv_fromUnicode (UConverter * converter,
01144 char **target,
01145 const char *targetLimit,
01146 const UChar ** source,
01147 const UChar * sourceLimit,
01148 int32_t* offsets,
01149 UBool flush,
01150 UErrorCode * err);
01151
01211 U_STABLE void U_EXPORT2
01212 ucnv_toUnicode(UConverter *converter,
01213 UChar **target,
01214 const UChar *targetLimit,
01215 const char **source,
01216 const char *sourceLimit,
01217 int32_t *offsets,
01218 UBool flush,
01219 UErrorCode *err);
01220
01248 U_STABLE int32_t U_EXPORT2
01249 ucnv_fromUChars(UConverter *cnv,
01250 char *dest, int32_t destCapacity,
01251 const UChar *src, int32_t srcLength,
01252 UErrorCode *pErrorCode);
01253
01280 U_STABLE int32_t U_EXPORT2
01281 ucnv_toUChars(UConverter *cnv,
01282 UChar *dest, int32_t destCapacity,
01283 const char *src, int32_t srcLength,
01284 UErrorCode *pErrorCode);
01285
01356 U_STABLE UChar32 U_EXPORT2
01357 ucnv_getNextUChar(UConverter * converter,
01358 const char **source,
01359 const char * sourceLimit,
01360 UErrorCode * err);
01361
01500 U_STABLE void U_EXPORT2
01501 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01502 char **target, const char *targetLimit,
01503 const char **source, const char *sourceLimit,
01504 UChar *pivotStart, UChar **pivotSource,
01505 UChar **pivotTarget, const UChar *pivotLimit,
01506 UBool reset, UBool flush,
01507 UErrorCode *pErrorCode);
01508
01564 U_STABLE int32_t U_EXPORT2
01565 ucnv_convert(const char *toConverterName,
01566 const char *fromConverterName,
01567 char *target,
01568 int32_t targetCapacity,
01569 const char *source,
01570 int32_t sourceLength,
01571 UErrorCode *pErrorCode);
01572
01618 U_STABLE int32_t U_EXPORT2
01619 ucnv_toAlgorithmic(UConverterType algorithmicType,
01620 UConverter *cnv,
01621 char *target, int32_t targetCapacity,
01622 const char *source, int32_t sourceLength,
01623 UErrorCode *pErrorCode);
01624
01670 U_STABLE int32_t U_EXPORT2
01671 ucnv_fromAlgorithmic(UConverter *cnv,
01672 UConverterType algorithmicType,
01673 char *target, int32_t targetCapacity,
01674 const char *source, int32_t sourceLength,
01675 UErrorCode *pErrorCode);
01676
01684 U_STABLE int32_t U_EXPORT2
01685 ucnv_flushCache(void);
01686
01694 U_STABLE int32_t U_EXPORT2
01695 ucnv_countAvailable(void);
01696
01707 U_STABLE const char* U_EXPORT2
01708 ucnv_getAvailableName(int32_t n);
01709
01722 U_STABLE UEnumeration * U_EXPORT2
01723 ucnv_openAllNames(UErrorCode *pErrorCode);
01724
01735 U_STABLE uint16_t U_EXPORT2
01736 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01737
01750 U_STABLE const char * U_EXPORT2
01751 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01752
01766 U_STABLE void U_EXPORT2
01767 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01768
01792 U_STABLE UEnumeration * U_EXPORT2
01793 ucnv_openStandardNames(const char *convName,
01794 const char *standard,
01795 UErrorCode *pErrorCode);
01796
01802 U_STABLE uint16_t U_EXPORT2
01803 ucnv_countStandards(void);
01804
01812 U_STABLE const char * U_EXPORT2
01813 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01814
01834 U_STABLE const char * U_EXPORT2
01835 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01836
01856 U_STABLE const char * U_EXPORT2
01857 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01858
01873 U_STABLE const char * U_EXPORT2
01874 ucnv_getDefaultName(void);
01875
01876 #ifndef U_HIDE_SYSTEM_API
01877
01893 U_STABLE void U_EXPORT2
01894 ucnv_setDefaultName(const char *name);
01895 #endif
01896
01914 U_STABLE void U_EXPORT2
01915 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01916
01925 U_STABLE UBool U_EXPORT2
01926 ucnv_isAmbiguous(const UConverter *cnv);
01927
01943 U_STABLE void U_EXPORT2
01944 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01945
01955 U_STABLE UBool U_EXPORT2
01956 ucnv_usesFallback(const UConverter *cnv);
01957
01987 U_STABLE const char* U_EXPORT2
01988 ucnv_detectUnicodeSignature(const char* source,
01989 int32_t sourceLength,
01990 int32_t *signatureLength,
01991 UErrorCode *pErrorCode);
01992
02004 U_STABLE int32_t U_EXPORT2
02005 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
02006
02018 U_STABLE int32_t U_EXPORT2
02019 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
02020
02036 U_STABLE UBool U_EXPORT2
02037 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status);
02038
02039 #endif
02040
02041 #endif
02042