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;
00073
typedef struct USet USet;
00074
00075
#endif
00076
00077
U_CDECL_BEGIN
00078
00080
#define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00081
00082
#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00083
00085
#define UCNV_SI 0x0F
00086
00087 #define UCNV_SO 0x0E
00088
00094 typedef enum {
00095
UCNV_UNSUPPORTED_CONVERTER = -1,
00096
UCNV_SBCS = 0,
00097 UCNV_DBCS = 1,
00098
UCNV_MBCS = 2,
00099
UCNV_LATIN_1 = 3,
00100
UCNV_UTF8 = 4,
00101
UCNV_UTF16_BigEndian = 5,
00102
UCNV_UTF16_LittleEndian = 6,
00103
UCNV_UTF32_BigEndian = 7,
00104
UCNV_UTF32_LittleEndian = 8,
00105 UCNV_EBCDIC_STATEFUL = 9,
00106
UCNV_ISO_2022 = 10,
00107
00108
UCNV_LMBCS_1 = 11,
00109
UCNV_LMBCS_2,
00110
UCNV_LMBCS_3,
00111
UCNV_LMBCS_4,
00112
UCNV_LMBCS_5,
00113
UCNV_LMBCS_6,
00114
UCNV_LMBCS_8,
00115
UCNV_LMBCS_11,
00116
UCNV_LMBCS_16,
00117
UCNV_LMBCS_17,
00118
UCNV_LMBCS_18,
00119
UCNV_LMBCS_19,
00120
UCNV_LMBCS_LAST =
UCNV_LMBCS_19,
00121
UCNV_HZ,
00122
UCNV_SCSU,
00123
UCNV_ISCII,
00124
UCNV_US_ASCII,
00125
UCNV_UTF7,
00126
UCNV_BOCU1,
00127
UCNV_UTF16,
00128
UCNV_UTF32,
00129
UCNV_CESU8,
00130
UCNV_IMAP_MAILBOX,
00131
00132
00133
UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00134
00135 }
UConverterType;
00136
00146
typedef enum {
00147
UCNV_UNKNOWN = -1,
00148
UCNV_IBM = 0
00149 }
UConverterPlatform;
00150
00163
typedef void (U_EXPORT2 *UConverterToUCallback) (
00164
const void* context,
00165
UConverterToUnicodeArgs *
args,
00166
const char *
codeUnits,
00167
int32_t length,
00168
UConverterCallbackReason reason,
00169
UErrorCode *);
00170
00183
typedef void (U_EXPORT2 *UConverterFromUCallback) (
00184
const void* context,
00185
UConverterFromUnicodeArgs *
args,
00186
const UChar*
codeUnits,
00187
int32_t length,
00188
UChar32 codePoint,
00189
UConverterCallbackReason reason,
00190
UErrorCode *);
00191
00192
U_CDECL_END
00193
00199 #define UCNV_OPTION_SEP_CHAR ','
00200
00206
#define UCNV_OPTION_SEP_STRING ","
00207
00213
#define UCNV_VALUE_SEP_CHAR '='
00214
00220
#define UCNV_VALUE_SEP_STRING "="
00221
00230 #define UCNV_LOCALE_OPTION_STRING ",locale="
00231
00240
#define UCNV_VERSION_OPTION_STRING ",version="
00241
00252
#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00253
00267
U_STABLE int U_EXPORT2
00268
ucnv_compareNames(
const char *name1,
const char *name2);
00269
00270
00306
U_STABLE UConverter*
U_EXPORT2
00307
ucnv_open(
const char *converterName, UErrorCode *err);
00308
00309
00333
U_STABLE UConverter*
U_EXPORT2
00334
ucnv_openU(
const UChar *name,
00335 UErrorCode *err);
00336
00401
U_STABLE UConverter*
U_EXPORT2
00402
ucnv_openCCSID(int32_t codepage,
00403 UConverterPlatform platform,
00404 UErrorCode * err);
00405
00436
U_STABLE UConverter*
U_EXPORT2
00437
ucnv_openPackage(
const char *packageName,
const char *converterName, UErrorCode *err);
00438
00455
U_STABLE UConverter *
U_EXPORT2
00456
ucnv_safeClone(
const UConverter *cnv,
00457
void *stackBuffer,
00458 int32_t *pBufferSize,
00459 UErrorCode *status);
00460
00467
#define U_CNV_SAFECLONE_BUFFERSIZE 1024
00468
00480
U_STABLE void U_EXPORT2
00481
ucnv_close(UConverter * converter);
00482
00497
U_STABLE void U_EXPORT2
00498
ucnv_getSubstChars(
const UConverter *converter,
00499
char *subChars,
00500 int8_t *len,
00501 UErrorCode *err);
00502
00515
U_STABLE void U_EXPORT2
00516
ucnv_setSubstChars(UConverter *converter,
00517
const char *subChars,
00518 int8_t len,
00519 UErrorCode *err);
00520
00534
U_STABLE void U_EXPORT2
00535
ucnv_getInvalidChars(
const UConverter *converter,
00536
char *errBytes,
00537 int8_t *len,
00538 UErrorCode *err);
00539
00553
U_STABLE void U_EXPORT2
00554
ucnv_getInvalidUChars(
const UConverter *converter,
00555 UChar *errUChars,
00556 int8_t *len,
00557 UErrorCode *err);
00558
00566
U_STABLE void U_EXPORT2
00567
ucnv_reset(UConverter *converter);
00568
00577
U_STABLE void U_EXPORT2
00578
ucnv_resetToUnicode(UConverter *converter);
00579
00588
U_STABLE void U_EXPORT2
00589
ucnv_resetFromUnicode(UConverter *converter);
00590
00639
U_STABLE int8_t U_EXPORT2
00640
ucnv_getMaxCharSize(
const UConverter *converter);
00641
00642
#ifndef U_HIDE_DRAFT_API
00643
00663
#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00664
(((int32_t)(length)+10)*(int32_t)(maxCharSize))
00665
00666
#endif
00667
00676
U_STABLE int8_t U_EXPORT2
00677
ucnv_getMinCharSize(
const UConverter *converter);
00678
00693
U_STABLE int32_t U_EXPORT2
00694
ucnv_getDisplayName(
const UConverter *converter,
00695
const char *displayLocale,
00696 UChar *displayName,
00697 int32_t displayNameCapacity,
00698 UErrorCode *err);
00699
00710
U_STABLE const char *
U_EXPORT2
00711
ucnv_getName(
const UConverter *converter, UErrorCode *err);
00712
00736
U_STABLE int32_t U_EXPORT2
00737
ucnv_getCCSID(
const UConverter *converter,
00738 UErrorCode *err);
00739
00750
U_STABLE UConverterPlatform U_EXPORT2
00751
ucnv_getPlatform(
const UConverter *converter,
00752 UErrorCode *err);
00753
00762
U_STABLE UConverterType U_EXPORT2
00763
ucnv_getType(
const UConverter * converter);
00764
00780
U_STABLE void U_EXPORT2
00781
ucnv_getStarters(
const UConverter* converter,
00782 UBool starters[256],
00783 UErrorCode* err);
00784
00785
#ifndef U_HIDE_DRAFT_API
00786
00792
typedef enum UConverterUnicodeSet {
00794
UCNV_ROUNDTRIP_SET,
00796
UCNV_SET_COUNT
00797 }
UConverterUnicodeSet;
00798
00799
#endif
00800
00835
U_DRAFT void U_EXPORT2
00836
ucnv_getUnicodeSet(
const UConverter *cnv,
00837 USet *setFillIn,
00838 UConverterUnicodeSet whichSet,
00839 UErrorCode *pErrorCode);
00840
00852
U_STABLE void U_EXPORT2
00853
ucnv_getToUCallBack (
const UConverter * converter,
00854 UConverterToUCallback *action,
00855
const void **context);
00856
00868
U_STABLE void U_EXPORT2
00869
ucnv_getFromUCallBack (
const UConverter * converter,
00870 UConverterFromUCallback *action,
00871
const void **context);
00872
00888
U_STABLE void U_EXPORT2
00889
ucnv_setToUCallBack (UConverter * converter,
00890 UConverterToUCallback newAction,
00891
const void* newContext,
00892 UConverterToUCallback *oldAction,
00893
const void** oldContext,
00894 UErrorCode * err);
00895
00911
U_STABLE void U_EXPORT2
00912
ucnv_setFromUCallBack (UConverter * converter,
00913 UConverterFromUCallback newAction,
00914
const void *newContext,
00915 UConverterFromUCallback *oldAction,
00916
const void **oldContext,
00917 UErrorCode * err);
00918
00977
U_STABLE void U_EXPORT2
00978
ucnv_fromUnicode (UConverter * converter,
00979
char **target,
00980
const char *targetLimit,
00981
const UChar ** source,
00982
const UChar * sourceLimit,
00983 int32_t* offsets,
00984 UBool flush,
00985 UErrorCode * err);
00986
01046
U_STABLE void U_EXPORT2
01047
ucnv_toUnicode(UConverter *converter,
01048 UChar **target,
01049
const UChar *targetLimit,
01050
const char **source,
01051
const char *sourceLimit,
01052 int32_t *offsets,
01053 UBool flush,
01054 UErrorCode *err);
01055
01083
U_STABLE int32_t U_EXPORT2
01084
ucnv_fromUChars(UConverter *cnv,
01085
char *dest, int32_t destCapacity,
01086
const UChar *src, int32_t srcLength,
01087 UErrorCode *pErrorCode);
01088
01115
U_STABLE int32_t U_EXPORT2
01116
ucnv_toUChars(UConverter *cnv,
01117 UChar *dest, int32_t destCapacity,
01118
const char *src, int32_t srcLength,
01119 UErrorCode *pErrorCode);
01120
01191
U_STABLE UChar32 U_EXPORT2
01192
ucnv_getNextUChar(UConverter * converter,
01193
const char **source,
01194
const char * sourceLimit,
01195 UErrorCode * err);
01196
01325
U_DRAFT void U_EXPORT2
01326
ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01327
char **target,
const char *targetLimit,
01328
const char **source,
const char *sourceLimit,
01329 UChar *pivotStart, UChar **pivotSource,
01330 UChar **pivotTarget,
const UChar *pivotLimit,
01331 UBool reset, UBool flush,
01332 UErrorCode *pErrorCode);
01333
01389
U_STABLE int32_t U_EXPORT2
01390
ucnv_convert(
const char *toConverterName,
01391
const char *fromConverterName,
01392
char *target,
01393 int32_t targetCapacity,
01394
const char *source,
01395 int32_t sourceLength,
01396 UErrorCode *pErrorCode);
01397
01443
U_DRAFT int32_t U_EXPORT2
01444
ucnv_toAlgorithmic(UConverterType algorithmicType,
01445 UConverter *cnv,
01446
char *target, int32_t targetCapacity,
01447
const char *source, int32_t sourceLength,
01448 UErrorCode *pErrorCode);
01449
01495
U_DRAFT int32_t U_EXPORT2
01496
ucnv_fromAlgorithmic(UConverter *cnv,
01497 UConverterType algorithmicType,
01498
char *target, int32_t targetCapacity,
01499
const char *source, int32_t sourceLength,
01500 UErrorCode *pErrorCode);
01501
01509
U_STABLE int32_t U_EXPORT2
01510
ucnv_flushCache(
void);
01511
01519
U_STABLE int32_t U_EXPORT2
01520
ucnv_countAvailable(
void);
01521
01532
U_STABLE const char*
U_EXPORT2
01533
ucnv_getAvailableName(int32_t n);
01534
01547
U_STABLE UEnumeration *
U_EXPORT2
01548
ucnv_openAllNames(UErrorCode *pErrorCode);
01549
01560
U_STABLE uint16_t U_EXPORT2
01561
ucnv_countAliases(
const char *alias, UErrorCode *pErrorCode);
01562
01575
U_STABLE const char *
U_EXPORT2
01576
ucnv_getAlias(
const char *alias, uint16_t n, UErrorCode *pErrorCode);
01577
01591
U_STABLE void U_EXPORT2
01592
ucnv_getAliases(
const char *alias,
const char **aliases, UErrorCode *pErrorCode);
01593
01617
U_STABLE UEnumeration *
U_EXPORT2
01618
ucnv_openStandardNames(
const char *convName,
01619
const char *standard,
01620 UErrorCode *pErrorCode);
01621
01627
U_STABLE uint16_t U_EXPORT2
01628
ucnv_countStandards(
void);
01629
01637
U_STABLE const char *
U_EXPORT2
01638
ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01639
01659
U_STABLE const char *
U_EXPORT2
01660
ucnv_getStandardName(
const char *name,
const char *standard, UErrorCode *pErrorCode);
01661
01681
U_STABLE const char *
U_EXPORT2
01682
ucnv_getCanonicalName(
const char *alias,
const char *standard, UErrorCode *pErrorCode);
01683
01694
U_STABLE const char *
U_EXPORT2
01695
ucnv_getDefaultName(
void);
01696
01705
U_STABLE void U_EXPORT2
01706
ucnv_setDefaultName(
const char *name);
01707
01725
U_STABLE void U_EXPORT2
01726
ucnv_fixFileSeparator(
const UConverter *cnv, UChar *source, int32_t sourceLen);
01727
01736
U_STABLE UBool U_EXPORT2
01737
ucnv_isAmbiguous(
const UConverter *cnv);
01738
01746
U_STABLE void U_EXPORT2
01747
ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01748
01755
U_STABLE UBool U_EXPORT2
01756
ucnv_usesFallback(
const UConverter *cnv);
01757
01815
U_STABLE const char*
U_EXPORT2
01816
ucnv_detectUnicodeSignature(
const char* source,
01817 int32_t sourceLength,
01818 int32_t *signatureLength,
01819 UErrorCode *pErrorCode);
01820
01821
#endif
01822
01823