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
00051 struct UConverter;
00052
00054 typedef struct UConverter UConverter;
00055
00056 #include "unicode/utypes.h"
00057 #include "unicode/ucnv_err.h"
00058 #include "unicode/uenum.h"
00059
00060 #ifndef __USET_H__
00061
00071 struct USet;
00072 typedef struct USet USet;
00073
00074 #endif
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 {
00094 UCNV_UNSUPPORTED_CONVERTER = -1,
00095 UCNV_SBCS = 0,
00096 UCNV_DBCS = 1,
00097 UCNV_MBCS = 2,
00098 UCNV_LATIN_1 = 3,
00099 UCNV_UTF8 = 4,
00100 UCNV_UTF16_BigEndian = 5,
00101 UCNV_UTF16_LittleEndian = 6,
00102 UCNV_UTF32_BigEndian = 7,
00103 UCNV_UTF32_LittleEndian = 8,
00104 UCNV_EBCDIC_STATEFUL = 9,
00105 UCNV_ISO_2022 = 10,
00106
00107 UCNV_LMBCS_1 = 11,
00108 UCNV_LMBCS_2,
00109 UCNV_LMBCS_3,
00110 UCNV_LMBCS_4,
00111 UCNV_LMBCS_5,
00112 UCNV_LMBCS_6,
00113 UCNV_LMBCS_8,
00114 UCNV_LMBCS_11,
00115 UCNV_LMBCS_16,
00116 UCNV_LMBCS_17,
00117 UCNV_LMBCS_18,
00118 UCNV_LMBCS_19,
00119 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00120 UCNV_HZ,
00121 UCNV_SCSU,
00122 UCNV_ISCII,
00123 UCNV_US_ASCII,
00124 UCNV_UTF7,
00125 UCNV_BOCU1,
00126 UCNV_UTF16,
00127 UCNV_UTF32,
00128 UCNV_CESU8,
00129 UCNV_IMAP_MAILBOX,
00130
00131
00132 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00133
00134 } UConverterType;
00135
00145 typedef enum {
00146 UCNV_UNKNOWN = -1,
00147 UCNV_IBM = 0
00148 } UConverterPlatform;
00149
00162 typedef void (U_EXPORT2 *UConverterToUCallback) (
00163 const void* context,
00164 UConverterToUnicodeArgs *args,
00165 const char *codeUnits,
00166 int32_t length,
00167 UConverterCallbackReason reason,
00168 UErrorCode *);
00169
00182 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00183 const void* context,
00184 UConverterFromUnicodeArgs *args,
00185 const UChar* codeUnits,
00186 int32_t length,
00187 UChar32 codePoint,
00188 UConverterCallbackReason reason,
00189 UErrorCode *);
00190
00191 U_CDECL_END
00192
00198 #define UCNV_OPTION_SEP_CHAR ','
00199
00205 #define UCNV_OPTION_SEP_STRING ","
00206
00212 #define UCNV_VALUE_SEP_CHAR '='
00213
00219 #define UCNV_VALUE_SEP_STRING "="
00220
00229 #define UCNV_LOCALE_OPTION_STRING ",locale="
00230
00239 #define UCNV_VERSION_OPTION_STRING ",version="
00240
00251 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00252
00266 U_CAPI int U_EXPORT2
00267 ucnv_compareNames(const char *name1, const char *name2);
00268
00269
00305 U_CAPI UConverter* U_EXPORT2
00306 ucnv_open(const char *converterName, UErrorCode *err);
00307
00308
00332 U_CAPI UConverter* U_EXPORT2
00333 ucnv_openU(const UChar *name,
00334 UErrorCode *err);
00335
00400 U_CAPI UConverter* U_EXPORT2
00401 ucnv_openCCSID(int32_t codepage,
00402 UConverterPlatform platform,
00403 UErrorCode * err);
00404
00432 U_CAPI UConverter* U_EXPORT2
00433 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00434
00451 U_CAPI UConverter * U_EXPORT2
00452 ucnv_safeClone(const UConverter *cnv,
00453 void *stackBuffer,
00454 int32_t *pBufferSize,
00455 UErrorCode *status);
00456
00458 #define U_CNV_SAFECLONE_BUFFERSIZE 3072
00459
00471 U_CAPI void U_EXPORT2
00472 ucnv_close(UConverter * converter);
00473
00488 U_CAPI void U_EXPORT2
00489 ucnv_getSubstChars(const UConverter *converter,
00490 char *subChars,
00491 int8_t *len,
00492 UErrorCode *err);
00493
00506 U_CAPI void U_EXPORT2
00507 ucnv_setSubstChars(UConverter *converter,
00508 const char *subChars,
00509 int8_t len,
00510 UErrorCode *err);
00511
00525 U_CAPI void U_EXPORT2
00526 ucnv_getInvalidChars(const UConverter *converter,
00527 char *errBytes,
00528 int8_t *len,
00529 UErrorCode *err);
00530
00544 U_CAPI void U_EXPORT2
00545 ucnv_getInvalidUChars(const UConverter *converter,
00546 UChar *errUChars,
00547 int8_t *len,
00548 UErrorCode *err);
00549
00557 U_CAPI void U_EXPORT2
00558 ucnv_reset(UConverter *converter);
00559
00568 U_CAPI void U_EXPORT2
00569 ucnv_resetToUnicode(UConverter *converter);
00570
00579 U_CAPI void U_EXPORT2
00580 ucnv_resetFromUnicode(UConverter *converter);
00581
00590 U_CAPI int8_t U_EXPORT2
00591 ucnv_getMaxCharSize(const UConverter *converter);
00592
00601 U_CAPI int8_t U_EXPORT2
00602 ucnv_getMinCharSize(const UConverter *converter);
00603
00618 U_CAPI int32_t U_EXPORT2
00619 ucnv_getDisplayName(const UConverter *converter,
00620 const char *displayLocale,
00621 UChar *displayName,
00622 int32_t displayNameCapacity,
00623 UErrorCode *err);
00624
00635 U_CAPI const char * U_EXPORT2
00636 ucnv_getName(const UConverter *converter, UErrorCode *err);
00637
00661 U_CAPI int32_t U_EXPORT2
00662 ucnv_getCCSID(const UConverter *converter,
00663 UErrorCode *err);
00664
00675 U_CAPI UConverterPlatform U_EXPORT2
00676 ucnv_getPlatform(const UConverter *converter,
00677 UErrorCode *err);
00678
00687 U_CAPI UConverterType U_EXPORT2
00688 ucnv_getType(const UConverter * converter);
00689
00705 U_CAPI void U_EXPORT2
00706 ucnv_getStarters(const UConverter* converter,
00707 UBool starters[256],
00708 UErrorCode* err);
00709
00715 typedef enum UConverterUnicodeSet {
00717 UCNV_ROUNDTRIP_SET,
00719 UCNV_SET_COUNT
00720 } UConverterUnicodeSet;
00721
00756 U_CAPI void U_EXPORT2
00757 ucnv_getUnicodeSet(const UConverter *cnv,
00758 USet *set,
00759 UConverterUnicodeSet which,
00760 UErrorCode *pErrorCode);
00761
00773 U_CAPI void U_EXPORT2
00774 ucnv_getToUCallBack (const UConverter * converter,
00775 UConverterToUCallback *action,
00776 const void **context);
00777
00789 U_CAPI void U_EXPORT2
00790 ucnv_getFromUCallBack (const UConverter * converter,
00791 UConverterFromUCallback *action,
00792 const void **context);
00793
00809 U_CAPI void U_EXPORT2
00810 ucnv_setToUCallBack (UConverter * converter,
00811 UConverterToUCallback newAction,
00812 const void* newContext,
00813 UConverterToUCallback *oldAction,
00814 const void** oldContext,
00815 UErrorCode * err);
00816
00832 U_CAPI void U_EXPORT2
00833 ucnv_setFromUCallBack (UConverter * converter,
00834 UConverterFromUCallback newAction,
00835 const void *newContext,
00836 UConverterFromUCallback *oldAction,
00837 const void **oldContext,
00838 UErrorCode * err);
00839
00892 U_CAPI void U_EXPORT2
00893 ucnv_fromUnicode (UConverter * converter,
00894 char **target,
00895 const char *targetLimit,
00896 const UChar ** source,
00897 const UChar * sourceLimit,
00898 int32_t* offsets,
00899 UBool flush,
00900 UErrorCode * err);
00901
00955 U_CAPI void U_EXPORT2
00956 ucnv_toUnicode(UConverter *converter,
00957 UChar **target,
00958 const UChar *targetLimit,
00959 const char **source,
00960 const char *sourceLimit,
00961 int32_t *offsets,
00962 UBool flush,
00963 UErrorCode *err);
00964
00991 U_CAPI int32_t U_EXPORT2
00992 ucnv_fromUChars(UConverter *cnv,
00993 char *dest, int32_t destCapacity,
00994 const UChar *src, int32_t srcLength,
00995 UErrorCode *pErrorCode);
00996
01023 U_CAPI int32_t U_EXPORT2
01024 ucnv_toUChars(UConverter *cnv,
01025 UChar *dest, int32_t destCapacity,
01026 const char *src, int32_t srcLength,
01027 UErrorCode *pErrorCode);
01028
01071 U_CAPI UChar32 U_EXPORT2
01072 ucnv_getNextUChar(UConverter * converter,
01073 const char **source,
01074 const char * sourceLimit,
01075 UErrorCode * err);
01076
01205 U_CAPI void U_EXPORT2
01206 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01207 char **target, const char *targetLimit,
01208 const char **source, const char *sourceLimit,
01209 UChar *pivotStart, UChar **pivotSource,
01210 UChar **pivotTarget, const UChar *pivotLimit,
01211 UBool reset, UBool flush,
01212 UErrorCode *pErrorCode);
01213
01269 U_CAPI int32_t U_EXPORT2
01270 ucnv_convert(const char *toConverterName,
01271 const char *fromConverterName,
01272 char *target,
01273 int32_t targetCapacity,
01274 const char *source,
01275 int32_t sourceLength,
01276 UErrorCode *pErrorCode);
01277
01323 U_CAPI int32_t U_EXPORT2
01324 ucnv_toAlgorithmic(UConverterType algorithmicType,
01325 UConverter *cnv,
01326 char *target, int32_t targetCapacity,
01327 const char *source, int32_t sourceLength,
01328 UErrorCode *pErrorCode);
01329
01375 U_CAPI int32_t U_EXPORT2
01376 ucnv_fromAlgorithmic(UConverter *cnv,
01377 UConverterType algorithmicType,
01378 char *target, int32_t targetCapacity,
01379 const char *source, int32_t sourceLength,
01380 UErrorCode *pErrorCode);
01381
01389 U_CAPI int32_t U_EXPORT2
01390 ucnv_flushCache(void);
01391
01399 U_CAPI int32_t U_EXPORT2
01400 ucnv_countAvailable(void);
01401
01412 U_CAPI const char* U_EXPORT2
01413 ucnv_getAvailableName(int32_t n);
01414
01427 U_CAPI UEnumeration * U_EXPORT2
01428 ucnv_openAllNames(UErrorCode *pErrorCode);
01429
01440 U_CAPI uint16_t U_EXPORT2
01441 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01442
01455 U_CAPI const char * U_EXPORT2
01456 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01457
01471 U_CAPI void U_EXPORT2
01472 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01473
01497 U_CAPI UEnumeration * U_EXPORT2
01498 ucnv_openStandardNames(const char *convName,
01499 const char *standard,
01500 UErrorCode *pErrorCode);
01501
01507 U_CAPI uint16_t U_EXPORT2
01508 ucnv_countStandards(void);
01509
01517 U_CAPI const char * U_EXPORT2
01518 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01519
01539 U_CAPI const char * U_EXPORT2
01540 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01541
01561 U_CAPI const char * U_EXPORT2
01562 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01563
01574 U_CAPI const char * U_EXPORT2
01575 ucnv_getDefaultName(void);
01576
01585 U_CAPI void U_EXPORT2
01586 ucnv_setDefaultName(const char *name);
01587
01605 U_CAPI void U_EXPORT2
01606 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01607
01616 U_CAPI UBool U_EXPORT2
01617 ucnv_isAmbiguous(const UConverter *cnv);
01618
01626 U_CAPI void U_EXPORT2
01627 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01628
01635 U_CAPI UBool U_EXPORT2
01636 ucnv_usesFallback(const UConverter *cnv);
01637
01695 U_CAPI const char* U_EXPORT2
01696 ucnv_detectUnicodeSignature(const char* source,
01697 int32_t sourceLength,
01698 int32_t *signatureLength,
01699 UErrorCode *pErrorCode);
01700
01701 #endif
01702
01703