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-2002, 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 
00041 #ifndef UCNV_H
00042 #define UCNV_H
00043 
00045 struct UConverter;
00046 
00048 typedef struct UConverter UConverter;
00049 
00050 #include "unicode/utypes.h"
00051 #include "unicode/ucnv_err.h"
00052 #include "unicode/uenum.h"
00053 
00054 U_CDECL_BEGIN
00055 
00057 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00058 
00059 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00060 
00062 #define  UCNV_SI 0x0F
00063 
00064 #define  UCNV_SO 0x0E
00065 
00071 typedef enum {
00072     UCNV_UNSUPPORTED_CONVERTER = -1,
00073     UCNV_SBCS = 0,
00074     UCNV_DBCS = 1,
00075     UCNV_MBCS = 2,
00076     UCNV_LATIN_1 = 3,
00077     UCNV_UTF8 = 4,
00078     UCNV_UTF16_BigEndian = 5,
00079     UCNV_UTF16_LittleEndian = 6,
00080     UCNV_UTF32_BigEndian = 7,
00081     UCNV_UTF32_LittleEndian = 8,
00082     UCNV_EBCDIC_STATEFUL = 9,
00083     UCNV_ISO_2022 = 10,
00084 
00085     UCNV_LMBCS_1 = 11,
00086     UCNV_LMBCS_2, 
00087     UCNV_LMBCS_3,
00088     UCNV_LMBCS_4,
00089     UCNV_LMBCS_5,
00090     UCNV_LMBCS_6,
00091     UCNV_LMBCS_8,
00092     UCNV_LMBCS_11,
00093     UCNV_LMBCS_16,
00094     UCNV_LMBCS_17,
00095     UCNV_LMBCS_18,
00096     UCNV_LMBCS_19,
00097     UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00098     UCNV_HZ,
00099     UCNV_SCSU,
00100     UCNV_ISCII,
00101     UCNV_US_ASCII,
00102     UCNV_UTF7,
00103     UCNV_BOCU1,
00104     UCNV_UTF16,
00105     UCNV_UTF32,
00106     UCNV_CESU8,
00107     UCNV_IMAP_MAILBOX,
00108 
00109     /* Number of converter types for which we have conversion routines. */
00110     UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00111    
00112 } UConverterType;
00113 
00123 typedef enum {
00124     UCNV_UNKNOWN = -1,
00125     UCNV_IBM = 0
00126 } UConverterPlatform;
00127 
00140 typedef void (U_EXPORT2 *UConverterToUCallback) (
00141                   const void* context,
00142                   UConverterToUnicodeArgs *args,
00143                   const char *codePoints,
00144                   int32_t length,
00145                   UConverterCallbackReason reason,
00146                   UErrorCode *);
00147 
00160 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00161                     const void* context,
00162                     UConverterFromUnicodeArgs *args,
00163                     const UChar* codeUnits,
00164                     int32_t length,
00165                     UChar32 codePoint,
00166                     UConverterCallbackReason reason,
00167                     UErrorCode *);
00168 
00169 U_CDECL_END
00170 
00176 #define UCNV_OPTION_SEP_CHAR ','
00177 
00183 #define UCNV_OPTION_SEP_STRING ","
00184 
00190 #define UCNV_VALUE_SEP_CHAR '='
00191 
00197 #define UCNV_VALUE_SEP_STRING "="
00198 
00207 #define UCNV_LOCALE_OPTION_STRING ",locale="
00208 
00217 #define UCNV_VERSION_OPTION_STRING ",version="
00218 
00229 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00230 
00244 U_CAPI int U_EXPORT2
00245 ucnv_compareNames(const char *name1, const char *name2);
00246 
00247 
00277 U_CAPI UConverter* U_EXPORT2 
00278 ucnv_open   (const char *converterName, UErrorCode * err);
00279 
00280 
00304 U_CAPI UConverter* U_EXPORT2 
00305 ucnv_openU (const UChar * name,
00306             UErrorCode * err);
00307 
00372 U_CAPI UConverter* U_EXPORT2
00373 ucnv_openCCSID (int32_t codepage,
00374                 UConverterPlatform platform,
00375                 UErrorCode * err);
00376 
00404 U_CAPI UConverter* U_EXPORT2 
00405 ucnv_openPackage   (const char *packageName, const char *converterName, UErrorCode * err);
00406 
00423 U_CAPI UConverter * U_EXPORT2 
00424 ucnv_safeClone(const UConverter *cnv, 
00425                void             *stackBuffer,
00426                int32_t          *pBufferSize, 
00427                UErrorCode       *status);
00428 
00430 #define U_CNV_SAFECLONE_BUFFERSIZE  3072
00431 
00443 U_CAPI void  U_EXPORT2
00444 ucnv_close (UConverter * converter);
00445 
00460 U_CAPI void U_EXPORT2
00461 ucnv_getSubstChars (const UConverter * converter,
00462                     char *subChars,
00463                     int8_t * len,
00464                     UErrorCode * err);
00465 
00478 U_CAPI void U_EXPORT2
00479 ucnv_setSubstChars (UConverter * converter,
00480                     const char *subChars,
00481                     int8_t len,
00482                     UErrorCode * err);
00483 
00497 U_CAPI void U_EXPORT2
00498 ucnv_getInvalidChars (const UConverter * converter,
00499                       char *errBytes,
00500                       int8_t * len,
00501                       UErrorCode * err);
00502 
00516 U_CAPI void U_EXPORT2
00517 ucnv_getInvalidUChars (const UConverter * converter,
00518                        UChar *errUChars,
00519                        int8_t * len,
00520                        UErrorCode * err);
00521 
00529 U_CAPI void U_EXPORT2
00530 ucnv_reset (UConverter * converter);
00531 
00540 U_CAPI void U_EXPORT2 
00541 ucnv_resetToUnicode(UConverter *converter);
00542 
00551 U_CAPI void U_EXPORT2 
00552 ucnv_resetFromUnicode(UConverter *converter);
00553 
00562 U_CAPI int8_t U_EXPORT2
00563 ucnv_getMaxCharSize (const UConverter * converter);
00564 
00565 
00574 U_CAPI int8_t U_EXPORT2
00575 ucnv_getMinCharSize (const UConverter * converter);
00576 
00591 U_CAPI int32_t U_EXPORT2
00592 ucnv_getDisplayName (const UConverter * converter,
00593                      const char *displayLocale,
00594                      UChar * displayName,
00595                      int32_t displayNameCapacity,
00596                      UErrorCode * err);
00597 
00608 U_CAPI const char * U_EXPORT2 
00609 ucnv_getName (const UConverter * converter, UErrorCode * err);
00610 
00611 
00635 U_CAPI int32_t U_EXPORT2
00636 ucnv_getCCSID (const UConverter * converter,
00637                UErrorCode * err);
00638 
00649 U_CAPI UConverterPlatform U_EXPORT2
00650 ucnv_getPlatform (const UConverter * converter,
00651                   UErrorCode * err);
00652 
00661 U_CAPI UConverterType U_EXPORT2
00662 ucnv_getType (const UConverter * converter);
00663 
00679 U_CAPI void U_EXPORT2 ucnv_getStarters(const UConverter* converter, 
00680                                        UBool starters[256],
00681                                        UErrorCode* err);
00682 
00683 
00695 U_CAPI void U_EXPORT2
00696 ucnv_getToUCallBack (const UConverter * converter,
00697                      UConverterToUCallback *action,
00698                      const void **context);
00699 
00711 U_CAPI void U_EXPORT2
00712 ucnv_getFromUCallBack (const UConverter * converter,
00713                        UConverterFromUCallback *action,
00714                        const void **context);
00715 
00730 U_CAPI void U_EXPORT2
00731 ucnv_setToUCallBack (UConverter * converter,
00732                      UConverterToUCallback newAction,
00733                      const void* newContext,
00734                      UConverterToUCallback *oldAction,
00735                      const void** oldContext,
00736                      UErrorCode * err);
00737 
00752 U_CAPI void U_EXPORT2
00753 ucnv_setFromUCallBack (UConverter * converter,
00754                        UConverterFromUCallback newAction,
00755                        const void *newContext,
00756                        UConverterFromUCallback *oldAction,
00757                        const void **oldContext,
00758                        UErrorCode * err);
00759 
00812 U_CAPI void U_EXPORT2 
00813 ucnv_fromUnicode (UConverter * converter,
00814                   char **target,
00815                   const char *targetLimit,
00816                   const UChar ** source,
00817                   const UChar * sourceLimit,
00818                   int32_t* offsets,
00819                   UBool flush,
00820                   UErrorCode * err);
00821 
00875 U_CAPI void U_EXPORT2 
00876 ucnv_toUnicode (UConverter * converter,
00877                 UChar ** target,
00878                 const UChar * targetLimit,
00879                 const char **source,
00880                 const char *sourceLimit,
00881                 int32_t* offsets,
00882                 UBool flush,
00883                 UErrorCode * err);
00884 
00885 
00912 U_CAPI int32_t U_EXPORT2
00913 ucnv_fromUChars(UConverter *cnv,
00914                 char *dest, int32_t destCapacity,
00915                 const UChar *src, int32_t srcLength,
00916                 UErrorCode *pErrorCode);
00917 
00918 
00945 U_CAPI int32_t U_EXPORT2
00946 ucnv_toUChars(UConverter *cnv,
00947               UChar *dest, int32_t destCapacity,
00948               const char *src, int32_t srcLength,
00949               UErrorCode *pErrorCode);
00950 
00993 U_CAPI UChar32 U_EXPORT2
00994 ucnv_getNextUChar (UConverter * converter,
00995                    const char **source,
00996                    const char * sourceLimit,
00997                    UErrorCode * err);
00998 
00999 
01022 U_CAPI int32_t U_EXPORT2
01023 ucnv_convert (const char *toConverterName,
01024               const char *fromConverterName,
01025               char *target,
01026               int32_t targetCapacity,
01027               const char *source,
01028               int32_t sourceLength,
01029               UErrorCode * err);
01030 
01038 U_CAPI int32_t U_EXPORT2
01039 ucnv_flushCache (void);
01040 
01041 
01049 U_CAPI int32_t U_EXPORT2
01050 ucnv_countAvailable (void);
01051 
01060 U_CAPI const char* U_EXPORT2
01061 ucnv_getAvailableName (int32_t n);
01062 
01075 U_CAPI UEnumeration * U_EXPORT2
01076 ucnv_openAllNames(UErrorCode *pErrorCode);
01077 
01088 U_CAPI uint16_t U_EXPORT2 
01089 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01090 
01103 U_CAPI const char * U_EXPORT2 
01104 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01105 
01119 U_CAPI void U_EXPORT2 
01120 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01121 
01145 U_CAPI UEnumeration *
01146 ucnv_openStandardNames(const char *convName,
01147                        const char *standard,
01148                        UErrorCode *pErrorCode);
01149 
01150 
01156 U_CAPI uint16_t U_EXPORT2
01157 ucnv_countStandards(void);
01158 
01166 U_CAPI const char * U_EXPORT2
01167 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01168 
01180 U_CAPI const char * U_EXPORT2
01181 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01182 
01195 U_CAPI const char * U_EXPORT2
01196 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01197 
01208 U_CAPI const char * U_EXPORT2
01209 ucnv_getDefaultName (void);
01210 
01219 U_CAPI void U_EXPORT2
01220 ucnv_setDefaultName (const char *name);
01221 
01239 U_CAPI void U_EXPORT2
01240 ucnv_fixFileSeparator(const UConverter *cnv, UChar* source, int32_t sourceLen);
01241 
01250 U_CAPI UBool U_EXPORT2
01251 ucnv_isAmbiguous(const UConverter *cnv);
01252 
01260 U_CAPI void U_EXPORT2 
01261 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01262 
01269 U_CAPI UBool U_EXPORT2 
01270 ucnv_usesFallback(const UConverter *cnv);
01271 
01329 U_CAPI const char* U_EXPORT2
01330 ucnv_detectUnicodeSignature( const char* source,
01331                              int32_t sourceLength,
01332                              int32_t* signatureLength,
01333                              UErrorCode* pErrorCode);
01334 
01335 #endif
01336 /*_UCNV*/
01337 

Generated on Wed Dec 18 16:49:53 2002 for ICU 2.4 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001