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 #ifndef __USET_H__
00057
00067 struct USet;
00069 typedef struct USet USet;
00070
00071 #endif
00072
00073 #if !UCONFIG_NO_CONVERSION
00074
00075 U_CDECL_BEGIN
00076
00078 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00079
00080 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00081
00083 #define UCNV_SI 0x0F
00084
00085 #define UCNV_SO 0x0E
00086
00092 typedef enum {
00094 UCNV_UNSUPPORTED_CONVERTER = -1,
00096 UCNV_SBCS = 0,
00098 UCNV_DBCS = 1,
00100 UCNV_MBCS = 2,
00102 UCNV_LATIN_1 = 3,
00104 UCNV_UTF8 = 4,
00106 UCNV_UTF16_BigEndian = 5,
00108 UCNV_UTF16_LittleEndian = 6,
00110 UCNV_UTF32_BigEndian = 7,
00112 UCNV_UTF32_LittleEndian = 8,
00114 UCNV_EBCDIC_STATEFUL = 9,
00116 UCNV_ISO_2022 = 10,
00117
00119 UCNV_LMBCS_1 = 11,
00121 UCNV_LMBCS_2,
00123 UCNV_LMBCS_3,
00125 UCNV_LMBCS_4,
00127 UCNV_LMBCS_5,
00129 UCNV_LMBCS_6,
00131 UCNV_LMBCS_8,
00133 UCNV_LMBCS_11,
00135 UCNV_LMBCS_16,
00137 UCNV_LMBCS_17,
00139 UCNV_LMBCS_18,
00141 UCNV_LMBCS_19,
00143 UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00145 UCNV_HZ,
00147 UCNV_SCSU,
00149 UCNV_ISCII,
00151 UCNV_US_ASCII,
00153 UCNV_UTF7,
00155 UCNV_BOCU1,
00157 UCNV_UTF16,
00159 UCNV_UTF32,
00161 UCNV_CESU8,
00163 UCNV_IMAP_MAILBOX,
00165 UCNV_COMPOUND_TEXT,
00166
00167
00168 UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00169 } UConverterType;
00170
00180 typedef enum {
00181 UCNV_UNKNOWN = -1,
00182 UCNV_IBM = 0
00183 } UConverterPlatform;
00184
00200 typedef void (U_EXPORT2 *UConverterToUCallback) (
00201 const void* context,
00202 UConverterToUnicodeArgs *args,
00203 const char *codeUnits,
00204 int32_t length,
00205 UConverterCallbackReason reason,
00206 UErrorCode *pErrorCode);
00207
00223 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00224 const void* context,
00225 UConverterFromUnicodeArgs *args,
00226 const UChar* codeUnits,
00227 int32_t length,
00228 UChar32 codePoint,
00229 UConverterCallbackReason reason,
00230 UErrorCode *pErrorCode);
00231
00232 U_CDECL_END
00233
00239 #define UCNV_OPTION_SEP_CHAR ','
00240
00246 #define UCNV_OPTION_SEP_STRING ","
00247
00253 #define UCNV_VALUE_SEP_CHAR '='
00254
00260 #define UCNV_VALUE_SEP_STRING "="
00261
00270 #define UCNV_LOCALE_OPTION_STRING ",locale="
00271
00283 #define UCNV_VERSION_OPTION_STRING ",version="
00284
00295 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00296
00312 U_STABLE int U_EXPORT2
00313 ucnv_compareNames(const char *name1, const char *name2);
00314
00315
00366 U_STABLE UConverter* U_EXPORT2
00367 ucnv_open(const char *converterName, UErrorCode *err);
00368
00369
00396 U_STABLE UConverter* U_EXPORT2
00397 ucnv_openU(const UChar *name,
00398 UErrorCode *err);
00399
00464 U_STABLE UConverter* U_EXPORT2
00465 ucnv_openCCSID(int32_t codepage,
00466 UConverterPlatform platform,
00467 UErrorCode * err);
00468
00499 U_STABLE UConverter* U_EXPORT2
00500 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00501
00541 U_STABLE UConverter * U_EXPORT2
00542 ucnv_safeClone(const UConverter *cnv,
00543 void *stackBuffer,
00544 int32_t *pBufferSize,
00545 UErrorCode *status);
00546
00547 #ifndef U_HIDE_DEPRECATED_API
00548
00555 #define U_CNV_SAFECLONE_BUFFERSIZE 1024
00556
00557 #endif
00558
00570 U_STABLE void U_EXPORT2
00571 ucnv_close(UConverter * converter);
00572
00573 #if U_SHOW_CPLUSPLUS_API
00574
00575 U_NAMESPACE_BEGIN
00576
00586 U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close);
00587
00588 U_NAMESPACE_END
00589
00590 #endif
00591
00609 U_STABLE void U_EXPORT2
00610 ucnv_getSubstChars(const UConverter *converter,
00611 char *subChars,
00612 int8_t *len,
00613 UErrorCode *err);
00614
00634 U_STABLE void U_EXPORT2
00635 ucnv_setSubstChars(UConverter *converter,
00636 const char *subChars,
00637 int8_t len,
00638 UErrorCode *err);
00639
00667 U_STABLE void U_EXPORT2
00668 ucnv_setSubstString(UConverter *cnv,
00669 const UChar *s,
00670 int32_t length,
00671 UErrorCode *err);
00672
00686 U_STABLE void U_EXPORT2
00687 ucnv_getInvalidChars(const UConverter *converter,
00688 char *errBytes,
00689 int8_t *len,
00690 UErrorCode *err);
00691
00705 U_STABLE void U_EXPORT2
00706 ucnv_getInvalidUChars(const UConverter *converter,
00707 UChar *errUChars,
00708 int8_t *len,
00709 UErrorCode *err);
00710
00718 U_STABLE void U_EXPORT2
00719 ucnv_reset(UConverter *converter);
00720
00729 U_STABLE void U_EXPORT2
00730 ucnv_resetToUnicode(UConverter *converter);
00731
00740 U_STABLE void U_EXPORT2
00741 ucnv_resetFromUnicode(UConverter *converter);
00742
00793 U_STABLE int8_t U_EXPORT2
00794 ucnv_getMaxCharSize(const UConverter *converter);
00795
00815 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00816 (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00817
00826 U_STABLE int8_t U_EXPORT2
00827 ucnv_getMinCharSize(const UConverter *converter);
00828
00843 U_STABLE int32_t U_EXPORT2
00844 ucnv_getDisplayName(const UConverter *converter,
00845 const char *displayLocale,
00846 UChar *displayName,
00847 int32_t displayNameCapacity,
00848 UErrorCode *err);
00849
00860 U_STABLE const char * U_EXPORT2
00861 ucnv_getName(const UConverter *converter, UErrorCode *err);
00862
00886 U_STABLE int32_t U_EXPORT2
00887 ucnv_getCCSID(const UConverter *converter,
00888 UErrorCode *err);
00889
00900 U_STABLE UConverterPlatform U_EXPORT2
00901 ucnv_getPlatform(const UConverter *converter,
00902 UErrorCode *err);
00903
00912 U_STABLE UConverterType U_EXPORT2
00913 ucnv_getType(const UConverter * converter);
00914
00930 U_STABLE void U_EXPORT2
00931 ucnv_getStarters(const UConverter* converter,
00932 UBool starters[256],
00933 UErrorCode* err);
00934
00935
00941 typedef enum UConverterUnicodeSet {
00943 UCNV_ROUNDTRIP_SET,
00945 UCNV_ROUNDTRIP_AND_FALLBACK_SET,
00946 #ifndef U_HIDE_DEPRECATED_API
00947
00951 UCNV_SET_COUNT
00952 #endif // U_HIDE_DEPRECATED_API
00953 } UConverterUnicodeSet;
00954
00955
01001 U_STABLE void U_EXPORT2
01002 ucnv_getUnicodeSet(const UConverter *cnv,
01003 USet *setFillIn,
01004 UConverterUnicodeSet whichSet,
01005 UErrorCode *pErrorCode);
01006
01018 U_STABLE void U_EXPORT2
01019 ucnv_getToUCallBack (const UConverter * converter,
01020 UConverterToUCallback *action,
01021 const void **context);
01022
01034 U_STABLE void U_EXPORT2
01035 ucnv_getFromUCallBack (const UConverter * converter,
01036 UConverterFromUCallback *action,
01037 const void **context);
01038
01054 U_STABLE void U_EXPORT2
01055 ucnv_setToUCallBack (UConverter * converter,
01056 UConverterToUCallback newAction,
01057 const void* newContext,
01058 UConverterToUCallback *oldAction,
01059 const void** oldContext,
01060 UErrorCode * err);
01061
01077 U_STABLE void U_EXPORT2
01078 ucnv_setFromUCallBack (UConverter * converter,
01079 UConverterFromUCallback newAction,
01080 const void *newContext,
01081 UConverterFromUCallback *oldAction,
01082 const void **oldContext,
01083 UErrorCode * err);
01084
01143 U_STABLE void U_EXPORT2
01144 ucnv_fromUnicode (UConverter * converter,
01145 char **target,
01146 const char *targetLimit,
01147 const UChar ** source,
01148 const UChar * sourceLimit,
01149 int32_t* offsets,
01150 UBool flush,
01151 UErrorCode * err);
01152
01212 U_STABLE void U_EXPORT2
01213 ucnv_toUnicode(UConverter *converter,
01214 UChar **target,
01215 const UChar *targetLimit,
01216 const char **source,
01217 const char *sourceLimit,
01218 int32_t *offsets,
01219 UBool flush,
01220 UErrorCode *err);
01221
01249 U_STABLE int32_t U_EXPORT2
01250 ucnv_fromUChars(UConverter *cnv,
01251 char *dest, int32_t destCapacity,
01252 const UChar *src, int32_t srcLength,
01253 UErrorCode *pErrorCode);
01254
01281 U_STABLE int32_t U_EXPORT2
01282 ucnv_toUChars(UConverter *cnv,
01283 UChar *dest, int32_t destCapacity,
01284 const char *src, int32_t srcLength,
01285 UErrorCode *pErrorCode);
01286
01357 U_STABLE UChar32 U_EXPORT2
01358 ucnv_getNextUChar(UConverter * converter,
01359 const char **source,
01360 const char * sourceLimit,
01361 UErrorCode * err);
01362
01501 U_STABLE void U_EXPORT2
01502 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01503 char **target, const char *targetLimit,
01504 const char **source, const char *sourceLimit,
01505 UChar *pivotStart, UChar **pivotSource,
01506 UChar **pivotTarget, const UChar *pivotLimit,
01507 UBool reset, UBool flush,
01508 UErrorCode *pErrorCode);
01509
01565 U_STABLE int32_t U_EXPORT2
01566 ucnv_convert(const char *toConverterName,
01567 const char *fromConverterName,
01568 char *target,
01569 int32_t targetCapacity,
01570 const char *source,
01571 int32_t sourceLength,
01572 UErrorCode *pErrorCode);
01573
01619 U_STABLE int32_t U_EXPORT2
01620 ucnv_toAlgorithmic(UConverterType algorithmicType,
01621 UConverter *cnv,
01622 char *target, int32_t targetCapacity,
01623 const char *source, int32_t sourceLength,
01624 UErrorCode *pErrorCode);
01625
01671 U_STABLE int32_t U_EXPORT2
01672 ucnv_fromAlgorithmic(UConverter *cnv,
01673 UConverterType algorithmicType,
01674 char *target, int32_t targetCapacity,
01675 const char *source, int32_t sourceLength,
01676 UErrorCode *pErrorCode);
01677
01685 U_STABLE int32_t U_EXPORT2
01686 ucnv_flushCache(void);
01687
01695 U_STABLE int32_t U_EXPORT2
01696 ucnv_countAvailable(void);
01697
01708 U_STABLE const char* U_EXPORT2
01709 ucnv_getAvailableName(int32_t n);
01710
01723 U_STABLE UEnumeration * U_EXPORT2
01724 ucnv_openAllNames(UErrorCode *pErrorCode);
01725
01736 U_STABLE uint16_t U_EXPORT2
01737 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01738
01751 U_STABLE const char * U_EXPORT2
01752 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01753
01767 U_STABLE void U_EXPORT2
01768 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01769
01793 U_STABLE UEnumeration * U_EXPORT2
01794 ucnv_openStandardNames(const char *convName,
01795 const char *standard,
01796 UErrorCode *pErrorCode);
01797
01803 U_STABLE uint16_t U_EXPORT2
01804 ucnv_countStandards(void);
01805
01813 U_STABLE const char * U_EXPORT2
01814 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01815
01835 U_STABLE const char * U_EXPORT2
01836 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01837
01857 U_STABLE const char * U_EXPORT2
01858 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01859
01874 U_STABLE const char * U_EXPORT2
01875 ucnv_getDefaultName(void);
01876
01877 #ifndef U_HIDE_SYSTEM_API
01878
01894 U_STABLE void U_EXPORT2
01895 ucnv_setDefaultName(const char *name);
01896 #endif
01897
01915 U_STABLE void U_EXPORT2
01916 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01917
01926 U_STABLE UBool U_EXPORT2
01927 ucnv_isAmbiguous(const UConverter *cnv);
01928
01944 U_STABLE void U_EXPORT2
01945 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01946
01956 U_STABLE UBool U_EXPORT2
01957 ucnv_usesFallback(const UConverter *cnv);
01958
01988 U_STABLE const char* U_EXPORT2
01989 ucnv_detectUnicodeSignature(const char* source,
01990 int32_t sourceLength,
01991 int32_t *signatureLength,
01992 UErrorCode *pErrorCode);
01993
02005 U_STABLE int32_t U_EXPORT2
02006 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
02007
02019 U_STABLE int32_t U_EXPORT2
02020 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
02021
02037 U_STABLE UBool U_EXPORT2
02038 ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status);
02039
02040 #endif
02041
02042 #endif
02043