ucnv.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1999-2006, 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 
00050 #include "unicode/ucnv_err.h"
00051 #include "unicode/uenum.h"
00052 
00053 #ifndef __USET_H__
00054 
00064 struct USet;
00066 typedef struct USet USet;
00067 
00068 #endif
00069 
00070 #if !UCONFIG_NO_CONVERSION
00071 
00072 U_CDECL_BEGIN
00073 
00075 #define UCNV_MAX_CONVERTER_NAME_LENGTH 60
00076 
00077 #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH)
00078 
00080 #define  UCNV_SI 0x0F
00081 
00082 #define  UCNV_SO 0x0E
00083 
00089 typedef enum {
00090     UCNV_UNSUPPORTED_CONVERTER = -1,
00091     UCNV_SBCS = 0,
00092     UCNV_DBCS = 1,
00093     UCNV_MBCS = 2,
00094     UCNV_LATIN_1 = 3,
00095     UCNV_UTF8 = 4,
00096     UCNV_UTF16_BigEndian = 5,
00097     UCNV_UTF16_LittleEndian = 6,
00098     UCNV_UTF32_BigEndian = 7,
00099     UCNV_UTF32_LittleEndian = 8,
00100     UCNV_EBCDIC_STATEFUL = 9,
00101     UCNV_ISO_2022 = 10,
00102 
00103     UCNV_LMBCS_1 = 11,
00104     UCNV_LMBCS_2, 
00105     UCNV_LMBCS_3,
00106     UCNV_LMBCS_4,
00107     UCNV_LMBCS_5,
00108     UCNV_LMBCS_6,
00109     UCNV_LMBCS_8,
00110     UCNV_LMBCS_11,
00111     UCNV_LMBCS_16,
00112     UCNV_LMBCS_17,
00113     UCNV_LMBCS_18,
00114     UCNV_LMBCS_19,
00115     UCNV_LMBCS_LAST = UCNV_LMBCS_19,
00116     UCNV_HZ,
00117     UCNV_SCSU,
00118     UCNV_ISCII,
00119     UCNV_US_ASCII,
00120     UCNV_UTF7,
00121     UCNV_BOCU1,
00122     UCNV_UTF16,
00123     UCNV_UTF32,
00124     UCNV_CESU8,
00125     UCNV_IMAP_MAILBOX,
00126 
00127     /* Number of converter types for which we have conversion routines. */
00128     UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES
00129 
00130 } UConverterType;
00131 
00141 typedef enum {
00142     UCNV_UNKNOWN = -1,
00143     UCNV_IBM = 0
00144 } UConverterPlatform;
00145 
00161 typedef void (U_EXPORT2 *UConverterToUCallback) (
00162                   const void* context,
00163                   UConverterToUnicodeArgs *args,
00164                   const char *codeUnits,
00165                   int32_t length,
00166                   UConverterCallbackReason reason,
00167                   UErrorCode *pErrorCode);
00168 
00184 typedef void (U_EXPORT2 *UConverterFromUCallback) (
00185                     const void* context,
00186                     UConverterFromUnicodeArgs *args,
00187                     const UChar* codeUnits,
00188                     int32_t length,
00189                     UChar32 codePoint,
00190                     UConverterCallbackReason reason,
00191                     UErrorCode *pErrorCode);
00192 
00193 U_CDECL_END
00194 
00200 #define UCNV_OPTION_SEP_CHAR ','
00201 
00207 #define UCNV_OPTION_SEP_STRING ","
00208 
00214 #define UCNV_VALUE_SEP_CHAR '='
00215 
00221 #define UCNV_VALUE_SEP_STRING "="
00222 
00231 #define UCNV_LOCALE_OPTION_STRING ",locale="
00232 
00241 #define UCNV_VERSION_OPTION_STRING ",version="
00242 
00253 #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl"
00254 
00270 U_STABLE int U_EXPORT2
00271 ucnv_compareNames(const char *name1, const char *name2);
00272 
00273 
00322 U_STABLE UConverter* U_EXPORT2 
00323 ucnv_open(const char *converterName, UErrorCode *err);
00324 
00325 
00352 U_STABLE UConverter* U_EXPORT2 
00353 ucnv_openU(const UChar *name,
00354            UErrorCode *err);
00355 
00420 U_STABLE UConverter* U_EXPORT2
00421 ucnv_openCCSID(int32_t codepage,
00422                UConverterPlatform platform,
00423                UErrorCode * err);
00424 
00455 U_STABLE UConverter* U_EXPORT2 
00456 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err);
00457 
00495 U_STABLE UConverter * U_EXPORT2 
00496 ucnv_safeClone(const UConverter *cnv, 
00497                void             *stackBuffer,
00498                int32_t          *pBufferSize, 
00499                UErrorCode       *status);
00500 
00507 #define U_CNV_SAFECLONE_BUFFERSIZE  1024
00508 
00520 U_STABLE void  U_EXPORT2
00521 ucnv_close(UConverter * converter);
00522 
00540 U_STABLE void U_EXPORT2
00541 ucnv_getSubstChars(const UConverter *converter,
00542                    char *subChars,
00543                    int8_t *len,
00544                    UErrorCode *err);
00545 
00565 U_STABLE void U_EXPORT2
00566 ucnv_setSubstChars(UConverter *converter,
00567                    const char *subChars,
00568                    int8_t len,
00569                    UErrorCode *err);
00570 
00598 U_DRAFT void U_EXPORT2
00599 ucnv_setSubstString(UConverter *cnv,
00600                     const UChar *s,
00601                     int32_t length,
00602                     UErrorCode *err);
00603 
00617 U_STABLE void U_EXPORT2
00618 ucnv_getInvalidChars(const UConverter *converter,
00619                      char *errBytes,
00620                      int8_t *len,
00621                      UErrorCode *err);
00622 
00636 U_STABLE void U_EXPORT2
00637 ucnv_getInvalidUChars(const UConverter *converter,
00638                       UChar *errUChars,
00639                       int8_t *len,
00640                       UErrorCode *err);
00641 
00649 U_STABLE void U_EXPORT2
00650 ucnv_reset(UConverter *converter);
00651 
00660 U_STABLE void U_EXPORT2 
00661 ucnv_resetToUnicode(UConverter *converter);
00662 
00671 U_STABLE void U_EXPORT2 
00672 ucnv_resetFromUnicode(UConverter *converter);
00673 
00722 U_STABLE int8_t U_EXPORT2
00723 ucnv_getMaxCharSize(const UConverter *converter);
00724 
00744 #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \
00745      (((int32_t)(length)+10)*(int32_t)(maxCharSize))
00746 
00755 U_STABLE int8_t U_EXPORT2
00756 ucnv_getMinCharSize(const UConverter *converter);
00757 
00772 U_STABLE int32_t U_EXPORT2
00773 ucnv_getDisplayName(const UConverter *converter,
00774                     const char *displayLocale,
00775                     UChar *displayName,
00776                     int32_t displayNameCapacity,
00777                     UErrorCode *err);
00778 
00789 U_STABLE const char * U_EXPORT2 
00790 ucnv_getName(const UConverter *converter, UErrorCode *err);
00791 
00815 U_STABLE int32_t U_EXPORT2
00816 ucnv_getCCSID(const UConverter *converter,
00817               UErrorCode *err);
00818 
00829 U_STABLE UConverterPlatform U_EXPORT2
00830 ucnv_getPlatform(const UConverter *converter,
00831                  UErrorCode *err);
00832 
00841 U_STABLE UConverterType U_EXPORT2
00842 ucnv_getType(const UConverter * converter);
00843 
00859 U_STABLE void U_EXPORT2
00860 ucnv_getStarters(const UConverter* converter, 
00861                  UBool starters[256],
00862                  UErrorCode* err);
00863 
00864 
00870 typedef enum UConverterUnicodeSet {
00872     UCNV_ROUNDTRIP_SET,
00874     UCNV_SET_COUNT
00875 } UConverterUnicodeSet;
00876 
00877 
00912 U_STABLE void U_EXPORT2
00913 ucnv_getUnicodeSet(const UConverter *cnv,
00914                    USet *setFillIn,
00915                    UConverterUnicodeSet whichSet,
00916                    UErrorCode *pErrorCode);
00917 
00929 U_STABLE void U_EXPORT2
00930 ucnv_getToUCallBack (const UConverter * converter,
00931                      UConverterToUCallback *action,
00932                      const void **context);
00933 
00945 U_STABLE void U_EXPORT2
00946 ucnv_getFromUCallBack (const UConverter * converter,
00947                        UConverterFromUCallback *action,
00948                        const void **context);
00949 
00965 U_STABLE void U_EXPORT2
00966 ucnv_setToUCallBack (UConverter * converter,
00967                      UConverterToUCallback newAction,
00968                      const void* newContext,
00969                      UConverterToUCallback *oldAction,
00970                      const void** oldContext,
00971                      UErrorCode * err);
00972 
00988 U_STABLE void U_EXPORT2
00989 ucnv_setFromUCallBack (UConverter * converter,
00990                        UConverterFromUCallback newAction,
00991                        const void *newContext,
00992                        UConverterFromUCallback *oldAction,
00993                        const void **oldContext,
00994                        UErrorCode * err);
00995 
01054 U_STABLE void U_EXPORT2 
01055 ucnv_fromUnicode (UConverter * converter,
01056                   char **target,
01057                   const char *targetLimit,
01058                   const UChar ** source,
01059                   const UChar * sourceLimit,
01060                   int32_t* offsets,
01061                   UBool flush,
01062                   UErrorCode * err);
01063 
01123 U_STABLE void U_EXPORT2 
01124 ucnv_toUnicode(UConverter *converter,
01125                UChar **target,
01126                const UChar *targetLimit,
01127                const char **source,
01128                const char *sourceLimit,
01129                int32_t *offsets,
01130                UBool flush,
01131                UErrorCode *err);
01132 
01160 U_STABLE int32_t U_EXPORT2
01161 ucnv_fromUChars(UConverter *cnv,
01162                 char *dest, int32_t destCapacity,
01163                 const UChar *src, int32_t srcLength,
01164                 UErrorCode *pErrorCode);
01165 
01192 U_STABLE int32_t U_EXPORT2
01193 ucnv_toUChars(UConverter *cnv,
01194               UChar *dest, int32_t destCapacity,
01195               const char *src, int32_t srcLength,
01196               UErrorCode *pErrorCode);
01197 
01268 U_STABLE UChar32 U_EXPORT2
01269 ucnv_getNextUChar(UConverter * converter,
01270                   const char **source,
01271                   const char * sourceLimit,
01272                   UErrorCode * err);
01273 
01409 U_STABLE void U_EXPORT2
01410 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01411                char **target, const char *targetLimit,
01412                const char **source, const char *sourceLimit,
01413                UChar *pivotStart, UChar **pivotSource,
01414                UChar **pivotTarget, const UChar *pivotLimit,
01415                UBool reset, UBool flush,
01416                UErrorCode *pErrorCode);
01417 
01473 U_STABLE int32_t U_EXPORT2
01474 ucnv_convert(const char *toConverterName,
01475              const char *fromConverterName,
01476              char *target,
01477              int32_t targetCapacity,
01478              const char *source,
01479              int32_t sourceLength,
01480              UErrorCode *pErrorCode);
01481 
01527 U_STABLE int32_t U_EXPORT2
01528 ucnv_toAlgorithmic(UConverterType algorithmicType,
01529                    UConverter *cnv,
01530                    char *target, int32_t targetCapacity,
01531                    const char *source, int32_t sourceLength,
01532                    UErrorCode *pErrorCode);
01533 
01579 U_STABLE int32_t U_EXPORT2
01580 ucnv_fromAlgorithmic(UConverter *cnv,
01581                      UConverterType algorithmicType,
01582                      char *target, int32_t targetCapacity,
01583                      const char *source, int32_t sourceLength,
01584                      UErrorCode *pErrorCode);
01585 
01593 U_STABLE int32_t U_EXPORT2
01594 ucnv_flushCache(void);
01595 
01603 U_STABLE int32_t U_EXPORT2
01604 ucnv_countAvailable(void);
01605 
01616 U_STABLE const char* U_EXPORT2
01617 ucnv_getAvailableName(int32_t n);
01618 
01631 U_STABLE UEnumeration * U_EXPORT2
01632 ucnv_openAllNames(UErrorCode *pErrorCode);
01633 
01644 U_STABLE uint16_t U_EXPORT2 
01645 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01646 
01659 U_STABLE const char * U_EXPORT2 
01660 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01661 
01675 U_STABLE void U_EXPORT2 
01676 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01677 
01701 U_STABLE UEnumeration * U_EXPORT2
01702 ucnv_openStandardNames(const char *convName,
01703                        const char *standard,
01704                        UErrorCode *pErrorCode);
01705 
01711 U_STABLE uint16_t U_EXPORT2
01712 ucnv_countStandards(void);
01713 
01721 U_STABLE const char * U_EXPORT2
01722 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01723 
01743 U_STABLE const char * U_EXPORT2
01744 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01745 
01765 U_STABLE const char * U_EXPORT2
01766 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01767 
01778 U_STABLE const char * U_EXPORT2
01779 ucnv_getDefaultName(void);
01780 
01792 U_STABLE void U_EXPORT2
01793 ucnv_setDefaultName(const char *name);
01794 
01812 U_STABLE void U_EXPORT2
01813 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01814 
01823 U_STABLE UBool U_EXPORT2
01824 ucnv_isAmbiguous(const UConverter *cnv);
01825 
01833 U_STABLE void U_EXPORT2 
01834 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01835 
01842 U_STABLE UBool U_EXPORT2 
01843 ucnv_usesFallback(const UConverter *cnv);
01844 
01901 U_STABLE const char* U_EXPORT2
01902 ucnv_detectUnicodeSignature(const char* source,
01903                             int32_t sourceLength,
01904                             int32_t *signatureLength,
01905                             UErrorCode *pErrorCode);
01906 
01918 U_DRAFT int32_t U_EXPORT2
01919 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
01920 
01932 U_DRAFT int32_t U_EXPORT2
01933 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
01934 
01935 #endif
01936 
01937 #endif
01938 /*_UCNV*/

Generated on Mon Aug 13 07:17:24 2007 for ICU 3.6 by  doxygen 1.5.2