Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

ucnv.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1999-2003, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 **********************************************************************
00006  *  ucnv.h:
00007  *  External APIs for the ICU's codeset conversion library
00008  *  Bertrand A. Damiba
00009  *
00010  * Modification History:
00011  *
00012  *   Date        Name        Description
00013  *   04/04/99    helena      Fixed internal header inclusion.
00014  *   05/11/00    helena      Added setFallback and usesFallback APIs.
00015  *   06/29/2000  helena      Major rewrite of the callback APIs.
00016  *   12/07/2000  srl         Update of documentation
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     /* Number of converter types for which we have conversion routines. */
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 
00435 U_CAPI UConverter* U_EXPORT2 
00436 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00437 
00454 U_CAPI UConverter * U_EXPORT2 
00455 ucnv_safeClone(const UConverter *cnv, 
00456                void             *stackBuffer,
00457                int32_t          *pBufferSize, 
00458                UErrorCode       *status);
00459 
00461 #define U_CNV_SAFECLONE_BUFFERSIZE  4096
00462 
00474 U_CAPI void  U_EXPORT2
00475 ucnv_close(UConverter * converter);
00476 
00491 U_CAPI void U_EXPORT2
00492 ucnv_getSubstChars(const UConverter *converter,
00493                    char *subChars,
00494                    int8_t *len,
00495                    UErrorCode *err);
00496 
00509 U_CAPI void U_EXPORT2
00510 ucnv_setSubstChars(UConverter *converter,
00511                    const char *subChars,
00512                    int8_t len,
00513                    UErrorCode *err);
00514 
00528 U_CAPI void U_EXPORT2
00529 ucnv_getInvalidChars(const UConverter *converter,
00530                      char *errBytes,
00531                      int8_t *len,
00532                      UErrorCode *err);
00533 
00547 U_CAPI void U_EXPORT2
00548 ucnv_getInvalidUChars(const UConverter *converter,
00549                       UChar *errUChars,
00550                       int8_t *len,
00551                       UErrorCode *err);
00552 
00560 U_CAPI void U_EXPORT2
00561 ucnv_reset(UConverter *converter);
00562 
00571 U_CAPI void U_EXPORT2 
00572 ucnv_resetToUnicode(UConverter *converter);
00573 
00582 U_CAPI void U_EXPORT2 
00583 ucnv_resetFromUnicode(UConverter *converter);
00584 
00633 U_CAPI int8_t U_EXPORT2
00634 ucnv_getMaxCharSize(const UConverter *converter);
00635 
00655 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00656      (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00657 
00666 U_CAPI int8_t U_EXPORT2
00667 ucnv_getMinCharSize(const UConverter *converter);
00668 
00683 U_CAPI int32_t U_EXPORT2
00684 ucnv_getDisplayName(const UConverter *converter,
00685                     const char *displayLocale,
00686                     UChar *displayName,
00687                     int32_t displayNameCapacity,
00688                     UErrorCode *err);
00689 
00700 U_CAPI const char * U_EXPORT2 
00701 ucnv_getName(const UConverter *converter, UErrorCode *err);
00702 
00726 U_CAPI int32_t U_EXPORT2
00727 ucnv_getCCSID(const UConverter *converter,
00728               UErrorCode *err);
00729 
00740 U_CAPI UConverterPlatform U_EXPORT2
00741 ucnv_getPlatform(const UConverter *converter,
00742                  UErrorCode *err);
00743 
00752 U_CAPI UConverterType U_EXPORT2
00753 ucnv_getType(const UConverter * converter);
00754 
00770 U_CAPI void U_EXPORT2
00771 ucnv_getStarters(const UConverter* converter, 
00772                  UBool starters[256],
00773                  UErrorCode* err);
00774 
00780 typedef enum UConverterUnicodeSet {
00782     UCNV_ROUNDTRIP_SET,
00784     UCNV_SET_COUNT
00785 } UConverterUnicodeSet;
00786 
00821 U_CAPI void U_EXPORT2
00822 ucnv_getUnicodeSet(const UConverter *cnv,
00823                    USet *set,
00824                    UConverterUnicodeSet which,
00825                    UErrorCode *pErrorCode);
00826 
00838 U_CAPI void U_EXPORT2
00839 ucnv_getToUCallBack (const UConverter * converter,
00840                      UConverterToUCallback *action,
00841                      const void **context);
00842 
00854 U_CAPI void U_EXPORT2
00855 ucnv_getFromUCallBack (const UConverter * converter,
00856                        UConverterFromUCallback *action,
00857                        const void **context);
00858 
00874 U_CAPI void U_EXPORT2
00875 ucnv_setToUCallBack (UConverter * converter,
00876                      UConverterToUCallback newAction,
00877                      const void* newContext,
00878                      UConverterToUCallback *oldAction,
00879                      const void** oldContext,
00880                      UErrorCode * err);
00881 
00897 U_CAPI void U_EXPORT2
00898 ucnv_setFromUCallBack (UConverter * converter,
00899                        UConverterFromUCallback newAction,
00900                        const void *newContext,
00901                        UConverterFromUCallback *oldAction,
00902                        const void **oldContext,
00903                        UErrorCode * err);
00904 
00963 U_CAPI void U_EXPORT2 
00964 ucnv_fromUnicode (UConverter * converter,
00965                   char **target,
00966                   const char *targetLimit,
00967                   const UChar ** source,
00968                   const UChar * sourceLimit,
00969                   int32_t* offsets,
00970                   UBool flush,
00971                   UErrorCode * err);
00972 
01032 U_CAPI void U_EXPORT2 
01033 ucnv_toUnicode(UConverter *converter,
01034                UChar **target,
01035                const UChar *targetLimit,
01036                const char **source,
01037                const char *sourceLimit,
01038                int32_t *offsets,
01039                UBool flush,
01040                UErrorCode *err);
01041 
01069 U_CAPI int32_t U_EXPORT2
01070 ucnv_fromUChars(UConverter *cnv,
01071                 char *dest, int32_t destCapacity,
01072                 const UChar *src, int32_t srcLength,
01073                 UErrorCode *pErrorCode);
01074 
01101 U_CAPI int32_t U_EXPORT2
01102 ucnv_toUChars(UConverter *cnv,
01103               UChar *dest, int32_t destCapacity,
01104               const char *src, int32_t srcLength,
01105               UErrorCode *pErrorCode);
01106 
01177 U_CAPI UChar32 U_EXPORT2
01178 ucnv_getNextUChar(UConverter * converter,
01179                   const char **source,
01180                   const char * sourceLimit,
01181                   UErrorCode * err);
01182 
01311 U_CAPI void U_EXPORT2
01312 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01313                char **target, const char *targetLimit,
01314                const char **source, const char *sourceLimit,
01315                UChar *pivotStart, UChar **pivotSource,
01316                UChar **pivotTarget, const UChar *pivotLimit,
01317                UBool reset, UBool flush,
01318                UErrorCode *pErrorCode);
01319 
01375 U_CAPI int32_t U_EXPORT2
01376 ucnv_convert(const char *toConverterName,
01377              const char *fromConverterName,
01378              char *target,
01379              int32_t targetCapacity,
01380              const char *source,
01381              int32_t sourceLength,
01382              UErrorCode *pErrorCode);
01383 
01429 U_CAPI int32_t U_EXPORT2
01430 ucnv_toAlgorithmic(UConverterType algorithmicType,
01431                    UConverter *cnv,
01432                    char *target, int32_t targetCapacity,
01433                    const char *source, int32_t sourceLength,
01434                    UErrorCode *pErrorCode);
01435 
01481 U_CAPI int32_t U_EXPORT2
01482 ucnv_fromAlgorithmic(UConverter *cnv,
01483                      UConverterType algorithmicType,
01484                      char *target, int32_t targetCapacity,
01485                      const char *source, int32_t sourceLength,
01486                      UErrorCode *pErrorCode);
01487 
01495 U_CAPI int32_t U_EXPORT2
01496 ucnv_flushCache(void);
01497 
01505 U_CAPI int32_t U_EXPORT2
01506 ucnv_countAvailable(void);
01507 
01518 U_CAPI const char* U_EXPORT2
01519 ucnv_getAvailableName(int32_t n);
01520 
01533 U_CAPI UEnumeration * U_EXPORT2
01534 ucnv_openAllNames(UErrorCode *pErrorCode);
01535 
01546 U_CAPI uint16_t U_EXPORT2 
01547 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01548 
01561 U_CAPI const char * U_EXPORT2 
01562 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01563 
01577 U_CAPI void U_EXPORT2 
01578 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01579 
01603 U_CAPI UEnumeration * U_EXPORT2
01604 ucnv_openStandardNames(const char *convName,
01605                        const char *standard,
01606                        UErrorCode *pErrorCode);
01607 
01613 U_CAPI uint16_t U_EXPORT2
01614 ucnv_countStandards(void);
01615 
01623 U_CAPI const char * U_EXPORT2
01624 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01625 
01645 U_CAPI const char * U_EXPORT2
01646 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01647 
01667 U_CAPI const char * U_EXPORT2
01668 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01669 
01680 U_CAPI const char * U_EXPORT2
01681 ucnv_getDefaultName(void);
01682 
01691 U_CAPI void U_EXPORT2
01692 ucnv_setDefaultName(const char *name);
01693 
01711 U_CAPI void U_EXPORT2
01712 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01713 
01722 U_CAPI UBool U_EXPORT2
01723 ucnv_isAmbiguous(const UConverter *cnv);
01724 
01732 U_CAPI void U_EXPORT2 
01733 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01734 
01741 U_CAPI UBool U_EXPORT2 
01742 ucnv_usesFallback(const UConverter *cnv);
01743 
01801 U_CAPI const char* U_EXPORT2
01802 ucnv_detectUnicodeSignature(const char* source,
01803                             int32_t sourceLength,
01804                             int32_t *signatureLength,
01805                             UErrorCode *pErrorCode);
01806 
01807 #endif
01808 /*_UCNV*/
01809 

Generated on Mon Nov 24 14:35:40 2003 for ICU 2.8 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001