ucnv.h

Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1999-2008, 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_STABLE 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_ROUNDTRIP_AND_FALLBACK_SET,
00876     UCNV_SET_COUNT
00877 } UConverterUnicodeSet;
00878 
00879 
00925 U_STABLE void U_EXPORT2
00926 ucnv_getUnicodeSet(const UConverter *cnv,
00927                    USet *setFillIn,
00928                    UConverterUnicodeSet whichSet,
00929                    UErrorCode *pErrorCode);
00930 
00942 U_STABLE void U_EXPORT2
00943 ucnv_getToUCallBack (const UConverter * converter,
00944                      UConverterToUCallback *action,
00945                      const void **context);
00946 
00958 U_STABLE void U_EXPORT2
00959 ucnv_getFromUCallBack (const UConverter * converter,
00960                        UConverterFromUCallback *action,
00961                        const void **context);
00962 
00978 U_STABLE void U_EXPORT2
00979 ucnv_setToUCallBack (UConverter * converter,
00980                      UConverterToUCallback newAction,
00981                      const void* newContext,
00982                      UConverterToUCallback *oldAction,
00983                      const void** oldContext,
00984                      UErrorCode * err);
00985 
01001 U_STABLE void U_EXPORT2
01002 ucnv_setFromUCallBack (UConverter * converter,
01003                        UConverterFromUCallback newAction,
01004                        const void *newContext,
01005                        UConverterFromUCallback *oldAction,
01006                        const void **oldContext,
01007                        UErrorCode * err);
01008 
01067 U_STABLE void U_EXPORT2 
01068 ucnv_fromUnicode (UConverter * converter,
01069                   char **target,
01070                   const char *targetLimit,
01071                   const UChar ** source,
01072                   const UChar * sourceLimit,
01073                   int32_t* offsets,
01074                   UBool flush,
01075                   UErrorCode * err);
01076 
01136 U_STABLE void U_EXPORT2 
01137 ucnv_toUnicode(UConverter *converter,
01138                UChar **target,
01139                const UChar *targetLimit,
01140                const char **source,
01141                const char *sourceLimit,
01142                int32_t *offsets,
01143                UBool flush,
01144                UErrorCode *err);
01145 
01173 U_STABLE int32_t U_EXPORT2
01174 ucnv_fromUChars(UConverter *cnv,
01175                 char *dest, int32_t destCapacity,
01176                 const UChar *src, int32_t srcLength,
01177                 UErrorCode *pErrorCode);
01178 
01205 U_STABLE int32_t U_EXPORT2
01206 ucnv_toUChars(UConverter *cnv,
01207               UChar *dest, int32_t destCapacity,
01208               const char *src, int32_t srcLength,
01209               UErrorCode *pErrorCode);
01210 
01281 U_STABLE UChar32 U_EXPORT2
01282 ucnv_getNextUChar(UConverter * converter,
01283                   const char **source,
01284                   const char * sourceLimit,
01285                   UErrorCode * err);
01286 
01425 U_STABLE void U_EXPORT2
01426 ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
01427                char **target, const char *targetLimit,
01428                const char **source, const char *sourceLimit,
01429                UChar *pivotStart, UChar **pivotSource,
01430                UChar **pivotTarget, const UChar *pivotLimit,
01431                UBool reset, UBool flush,
01432                UErrorCode *pErrorCode);
01433 
01489 U_STABLE int32_t U_EXPORT2
01490 ucnv_convert(const char *toConverterName,
01491              const char *fromConverterName,
01492              char *target,
01493              int32_t targetCapacity,
01494              const char *source,
01495              int32_t sourceLength,
01496              UErrorCode *pErrorCode);
01497 
01543 U_STABLE int32_t U_EXPORT2
01544 ucnv_toAlgorithmic(UConverterType algorithmicType,
01545                    UConverter *cnv,
01546                    char *target, int32_t targetCapacity,
01547                    const char *source, int32_t sourceLength,
01548                    UErrorCode *pErrorCode);
01549 
01595 U_STABLE int32_t U_EXPORT2
01596 ucnv_fromAlgorithmic(UConverter *cnv,
01597                      UConverterType algorithmicType,
01598                      char *target, int32_t targetCapacity,
01599                      const char *source, int32_t sourceLength,
01600                      UErrorCode *pErrorCode);
01601 
01609 U_STABLE int32_t U_EXPORT2
01610 ucnv_flushCache(void);
01611 
01619 U_STABLE int32_t U_EXPORT2
01620 ucnv_countAvailable(void);
01621 
01632 U_STABLE const char* U_EXPORT2
01633 ucnv_getAvailableName(int32_t n);
01634 
01647 U_STABLE UEnumeration * U_EXPORT2
01648 ucnv_openAllNames(UErrorCode *pErrorCode);
01649 
01660 U_STABLE uint16_t U_EXPORT2 
01661 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode);
01662 
01675 U_STABLE const char * U_EXPORT2 
01676 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode);
01677 
01691 U_STABLE void U_EXPORT2 
01692 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode);
01693 
01717 U_STABLE UEnumeration * U_EXPORT2
01718 ucnv_openStandardNames(const char *convName,
01719                        const char *standard,
01720                        UErrorCode *pErrorCode);
01721 
01727 U_STABLE uint16_t U_EXPORT2
01728 ucnv_countStandards(void);
01729 
01737 U_STABLE const char * U_EXPORT2
01738 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode);
01739 
01759 U_STABLE const char * U_EXPORT2
01760 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode);
01761 
01781 U_STABLE const char * U_EXPORT2
01782 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode);
01783 
01795 U_STABLE const char * U_EXPORT2
01796 ucnv_getDefaultName(void);
01797 
01810 U_STABLE void U_EXPORT2
01811 ucnv_setDefaultName(const char *name);
01812 
01830 U_STABLE void U_EXPORT2
01831 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen);
01832 
01841 U_STABLE UBool U_EXPORT2
01842 ucnv_isAmbiguous(const UConverter *cnv);
01843 
01859 U_STABLE void U_EXPORT2 
01860 ucnv_setFallback(UConverter *cnv, UBool usesFallback);
01861 
01871 U_STABLE UBool U_EXPORT2 
01872 ucnv_usesFallback(const UConverter *cnv);
01873 
01930 U_STABLE const char* U_EXPORT2
01931 ucnv_detectUnicodeSignature(const char* source,
01932                             int32_t sourceLength,
01933                             int32_t *signatureLength,
01934                             UErrorCode *pErrorCode);
01935 
01947 U_STABLE int32_t U_EXPORT2
01948 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status);
01949 
01961 U_STABLE int32_t U_EXPORT2
01962 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status);
01963 
01964 #endif
01965 
01966 #endif
01967 /*_UCNV*/

Generated on Sun Aug 22 15:37:58 2010 for ICU 4.0.1 by  doxygen 1.3.9.1