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 
00299 U_CAPI UConverter* U_EXPORT2 
00300 ucnv_open(const char *converterName, UErrorCode *err);
00301 
00302 
00326 U_CAPI UConverter* U_EXPORT2 
00327 ucnv_openU(const UChar *name,
00328            UErrorCode *err);
00329 
00394 U_CAPI UConverter* U_EXPORT2
00395 ucnv_openCCSID(int32_t codepage,
00396                UConverterPlatform platform,
00397                UErrorCode * err);
00398 
00426 U_CAPI UConverter* U_EXPORT2 
00427 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00428 
00445 U_CAPI UConverter * U_EXPORT2 
00446 ucnv_safeClone(const UConverter *cnv, 
00447                void             *stackBuffer,
00448                int32_t          *pBufferSize, 
00449                UErrorCode       *status);
00450 
00452 #define U_CNV_SAFECLONE_BUFFERSIZE  3072
00453 
00465 U_CAPI void  U_EXPORT2
00466 ucnv_close(UConverter * converter);
00467 
00482 U_CAPI void U_EXPORT2
00483 ucnv_getSubstChars(const UConverter *converter,
00484                    char *subChars,
00485                    int8_t *len,
00486                    UErrorCode *err);
00487 
00500 U_CAPI void U_EXPORT2
00501 ucnv_setSubstChars(UConverter *converter,
00502                    const char *subChars,
00503                    int8_t len,
00504                    UErrorCode *err);
00505 
00519 U_CAPI void U_EXPORT2
00520 ucnv_getInvalidChars(const UConverter *converter,
00521                      char *errBytes,
00522                      int8_t *len,
00523                      UErrorCode *err);
00524 
00538 U_CAPI void U_EXPORT2
00539 ucnv_getInvalidUChars(const UConverter *converter,
00540                       UChar *errUChars,
00541                       int8_t *len,
00542                       UErrorCode *err);
00543 
00551 U_CAPI void U_EXPORT2
00552 ucnv_reset(UConverter *converter);
00553 
00562 U_CAPI void U_EXPORT2 
00563 ucnv_resetToUnicode(UConverter *converter);
00564 
00573 U_CAPI void U_EXPORT2 
00574 ucnv_resetFromUnicode(UConverter *converter);
00575 
00584 U_CAPI int8_t U_EXPORT2
00585 ucnv_getMaxCharSize(const UConverter *converter);
00586 
00595 U_CAPI int8_t U_EXPORT2
00596 ucnv_getMinCharSize(const UConverter *converter);
00597 
00612 U_CAPI int32_t U_EXPORT2
00613 ucnv_getDisplayName(const UConverter *converter,
00614                     const char *displayLocale,
00615                     UChar *displayName,
00616                     int32_t displayNameCapacity,
00617                     UErrorCode *err);
00618 
00629 U_CAPI const char * U_EXPORT2 
00630 ucnv_getName(const UConverter *converter, UErrorCode *err);
00631 
00655 U_CAPI int32_t U_EXPORT2
00656 ucnv_getCCSID(const UConverter *converter,
00657               UErrorCode *err);
00658 
00669 U_CAPI UConverterPlatform U_EXPORT2
00670 ucnv_getPlatform(const UConverter *converter,
00671                  UErrorCode *err);
00672 
00681 U_CAPI UConverterType U_EXPORT2
00682 ucnv_getType(const UConverter * converter);
00683 
00699 U_CAPI void U_EXPORT2
00700 ucnv_getStarters(const UConverter* converter, 
00701                  UBool starters[256],
00702                  UErrorCode* err);
00703 
00709 typedef enum UConverterUnicodeSet {
00711     UCNV_ROUNDTRIP_SET,
00713     UCNV_SET_COUNT
00714 } UConverterUnicodeSet;
00715 
00750 U_CAPI void U_EXPORT2
00751 ucnv_getUnicodeSet(const UConverter *cnv,
00752                    USet *set,
00753                    UConverterUnicodeSet which,
00754                    UErrorCode *pErrorCode);
00755 
00767 U_CAPI void U_EXPORT2
00768 ucnv_getToUCallBack (const UConverter * converter,
00769                      UConverterToUCallback *action,
00770                      const void **context);
00771 
00783 U_CAPI void U_EXPORT2
00784 ucnv_getFromUCallBack (const UConverter * converter,
00785                        UConverterFromUCallback *action,
00786                        const void **context);
00787 
00803 U_CAPI void U_EXPORT2
00804 ucnv_setToUCallBack (UConverter * converter,
00805                      UConverterToUCallback newAction,
00806                      const void* newContext,
00807                      UConverterToUCallback *oldAction,
00808                      const void** oldContext,
00809                      UErrorCode * err);
00810 
00826 U_CAPI void U_EXPORT2
00827 ucnv_setFromUCallBack (UConverter * converter,
00828                        UConverterFromUCallback newAction,
00829                        const void *newContext,
00830                        UConverterFromUCallback *oldAction,
00831                        const void **oldContext,
00832                        UErrorCode * err);
00833 
00886 U_CAPI void U_EXPORT2 
00887 ucnv_fromUnicode (UConverter * converter,
00888                   char **target,
00889                   const char *targetLimit,
00890                   const UChar ** source,
00891                   const UChar * sourceLimit,
00892                   int32_t* offsets,
00893                   UBool flush,
00894                   UErrorCode * err);
00895 
00949 U_CAPI void U_EXPORT2 
00950 ucnv_toUnicode(UConverter *converter,
00951                UChar **target,
00952                const UChar *targetLimit,
00953                const char **source,
00954                const char *sourceLimit,
00955                int32_t *offsets,
00956                UBool flush,
00957                UErrorCode *err);
00958 
00985 U_CAPI int32_t U_EXPORT2
00986 ucnv_fromUChars(UConverter *cnv,
00987                 char *dest, int32_t destCapacity,
00988                 const UChar *src, int32_t srcLength,
00989                 UErrorCode *pErrorCode);
00990 
01017 U_CAPI int32_t U_EXPORT2
01018 ucnv_toUChars(UConverter *cnv,
01019               UChar *dest, int32_t destCapacity,
01020               const char *src, int32_t srcLength,
01021               UErrorCode *pErrorCode);
01022 
01065 U_CAPI UChar32 U_EXPORT2
01066 ucnv_getNextUChar(UConverter * converter,
01067                   const char **source,
01068                   const char * sourceLimit,
01069                   UErrorCode * err);
01070 
01199 U_CAPI void U_EXPORT2
01200 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01201                char **target, const char *targetLimit,
01202                const char **source, const char *sourceLimit,
01203                UChar *pivotStart, UChar **pivotSource,
01204                UChar **pivotTarget, const UChar *pivotLimit,
01205                UBool reset, UBool flush,
01206                UErrorCode *pErrorCode);
01207 
01263 U_CAPI int32_t U_EXPORT2
01264 ucnv_convert(const char *toConverterName,
01265              const char *fromConverterName,
01266              char *target,
01267              int32_t targetCapacity,
01268              const char *source,
01269              int32_t sourceLength,
01270              UErrorCode *pErrorCode);
01271 
01317 U_CAPI int32_t U_EXPORT2
01318 ucnv_toAlgorithmic(UConverterType algorithmicType,
01319                    UConverter *cnv,
01320                    char *target, int32_t targetCapacity,
01321                    const char *source, int32_t sourceLength,
01322                    UErrorCode *pErrorCode);
01323 
01369 U_CAPI int32_t U_EXPORT2
01370 ucnv_fromAlgorithmic(UConverter *cnv,
01371                      UConverterType algorithmicType,
01372                      char *target, int32_t targetCapacity,
01373                      const char *source, int32_t sourceLength,
01374                      UErrorCode *pErrorCode);
01375 
01383 U_CAPI int32_t U_EXPORT2
01384 ucnv_flushCache(void);
01385 
01393 U_CAPI int32_t U_EXPORT2
01394 ucnv_countAvailable(void);
01395 
01406 U_CAPI const char* U_EXPORT2
01407 ucnv_getAvailableName(int32_t n);
01408 
01421 U_CAPI UEnumeration * U_EXPORT2
01422 ucnv_openAllNames(UErrorCode *pErrorCode);
01423 
01434 U_CAPI uint16_t U_EXPORT2 
01435 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01436 
01449 U_CAPI const char * U_EXPORT2 
01450 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01451 
01465 U_CAPI void U_EXPORT2 
01466 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01467 
01491 U_CAPI UEnumeration * U_EXPORT2
01492 ucnv_openStandardNames(const char *convName,
01493                        const char *standard,
01494                        UErrorCode *pErrorCode);
01495 
01501 U_CAPI uint16_t U_EXPORT2
01502 ucnv_countStandards(void);
01503 
01511 U_CAPI const char * U_EXPORT2
01512 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01513 
01533 U_CAPI const char * U_EXPORT2
01534 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01535 
01555 U_CAPI const char * U_EXPORT2
01556 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01557 
01568 U_CAPI const char * U_EXPORT2
01569 ucnv_getDefaultName(void);
01570 
01579 U_CAPI void U_EXPORT2
01580 ucnv_setDefaultName(const char *name);
01581 
01599 U_CAPI void U_EXPORT2
01600 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01601 
01610 U_CAPI UBool U_EXPORT2
01611 ucnv_isAmbiguous(const UConverter *cnv);
01612 
01620 U_CAPI void U_EXPORT2 
01621 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01622 
01629 U_CAPI UBool U_EXPORT2 
01630 ucnv_usesFallback(const UConverter *cnv);
01631 
01689 U_CAPI const char* U_EXPORT2
01690 ucnv_detectUnicodeSignature(const char* source,
01691                             int32_t sourceLength,
01692                             int32_t *signatureLength,
01693                             UErrorCode *pErrorCode);
01694 
01695 #endif
01696 /*_UCNV*/
01697 

Generated on Thu Jun 12 13:09:18 2003 for ICU 2.6 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001