diff options
Diffstat (limited to 'Source/JavaScriptCore/icu/unicode/ucnv.h')
-rw-r--r-- | Source/JavaScriptCore/icu/unicode/ucnv.h | 103 |
1 files changed, 70 insertions, 33 deletions
diff --git a/Source/JavaScriptCore/icu/unicode/ucnv.h b/Source/JavaScriptCore/icu/unicode/ucnv.h index 98da8ff69..c5fc2dc78 100644 --- a/Source/JavaScriptCore/icu/unicode/ucnv.h +++ b/Source/JavaScriptCore/icu/unicode/ucnv.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2013, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * ucnv.h: @@ -88,46 +88,82 @@ U_CDECL_BEGIN * @stable ICU 2.0 */ typedef enum { + /** @stable ICU 2.0 */ UCNV_UNSUPPORTED_CONVERTER = -1, + /** @stable ICU 2.0 */ UCNV_SBCS = 0, + /** @stable ICU 2.0 */ UCNV_DBCS = 1, + /** @stable ICU 2.0 */ UCNV_MBCS = 2, + /** @stable ICU 2.0 */ UCNV_LATIN_1 = 3, + /** @stable ICU 2.0 */ UCNV_UTF8 = 4, + /** @stable ICU 2.0 */ UCNV_UTF16_BigEndian = 5, + /** @stable ICU 2.0 */ UCNV_UTF16_LittleEndian = 6, + /** @stable ICU 2.0 */ UCNV_UTF32_BigEndian = 7, + /** @stable ICU 2.0 */ UCNV_UTF32_LittleEndian = 8, + /** @stable ICU 2.0 */ UCNV_EBCDIC_STATEFUL = 9, + /** @stable ICU 2.0 */ UCNV_ISO_2022 = 10, + /** @stable ICU 2.0 */ UCNV_LMBCS_1 = 11, + /** @stable ICU 2.0 */ UCNV_LMBCS_2, + /** @stable ICU 2.0 */ UCNV_LMBCS_3, + /** @stable ICU 2.0 */ UCNV_LMBCS_4, + /** @stable ICU 2.0 */ UCNV_LMBCS_5, + /** @stable ICU 2.0 */ UCNV_LMBCS_6, + /** @stable ICU 2.0 */ UCNV_LMBCS_8, + /** @stable ICU 2.0 */ UCNV_LMBCS_11, + /** @stable ICU 2.0 */ UCNV_LMBCS_16, + /** @stable ICU 2.0 */ UCNV_LMBCS_17, + /** @stable ICU 2.0 */ UCNV_LMBCS_18, + /** @stable ICU 2.0 */ UCNV_LMBCS_19, + /** @stable ICU 2.0 */ UCNV_LMBCS_LAST = UCNV_LMBCS_19, + /** @stable ICU 2.0 */ UCNV_HZ, + /** @stable ICU 2.0 */ UCNV_SCSU, + /** @stable ICU 2.0 */ UCNV_ISCII, + /** @stable ICU 2.0 */ UCNV_US_ASCII, + /** @stable ICU 2.0 */ UCNV_UTF7, + /** @stable ICU 2.2 */ UCNV_BOCU1, + /** @stable ICU 2.2 */ UCNV_UTF16, + /** @stable ICU 2.2 */ UCNV_UTF32, + /** @stable ICU 2.2 */ UCNV_CESU8, + /** @stable ICU 2.4 */ UCNV_IMAP_MAILBOX, + /** @stable ICU 4.8 */ + UCNV_COMPOUND_TEXT, /* Number of converter types for which we have conversion routines. */ UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES - } UConverterType; /** @@ -305,6 +341,8 @@ ucnv_compareNames(const char *name1, const char *name2); * other than its an alias starting with the letters "cp". Please do not * associate any meaning to these aliases.</p> * + * \snippet samples/ucnv/convsamp.cpp ucnv_open + * * @param converterName Name of the coded character set table. * This may have options appended to the string. * IANA alias character set names, IBM CCSIDs starting with "ibm-", @@ -483,10 +521,12 @@ ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode * adjusted pointer and use an accordingly smaller buffer size. * * @param cnv converter to be cloned - * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. + * @param stackBuffer <em>Deprecated functionality as of ICU 52, use NULL.</em><br> + * user allocated space for the new clone. If NULL new memory will be allocated. * If buffer is not large enough, new memory will be allocated. * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations. - * @param pBufferSize pointer to size of allocated space. pBufferSize must not be NULL. + * @param pBufferSize <em>Deprecated functionality as of ICU 52, use NULL or 1.</em><br> + * pointer to size of allocated space. * @param status to indicate whether the operation went on smoothly or there were errors * An informational status value, U_SAFECLONE_ALLOCATED_WARNING, * is used if any allocations were necessary. @@ -502,14 +542,18 @@ ucnv_safeClone(const UConverter *cnv, int32_t *pBufferSize, UErrorCode *status); +#ifndef U_HIDE_DEPRECATED_API + /** * \def U_CNV_SAFECLONE_BUFFERSIZE * Definition of a buffer size that is designed to be large enough for * converters to be cloned with ucnv_safeClone(). - * @stable ICU 2.0 + * @deprecated ICU 52. Do not rely on ucnv_safeClone() cloning into any provided buffer. */ #define U_CNV_SAFECLONE_BUFFERSIZE 1024 +#endif /* U_HIDE_DEPRECATED_API */ + /** * Deletes the unicode converter and releases resources associated * with just this instance. @@ -1821,6 +1865,7 @@ ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErro U_STABLE const char * U_EXPORT2 ucnv_getDefaultName(void); +#ifndef U_HIDE_SYSTEM_API /** * This function is not thread safe. DO NOT call this function when ANY ICU * function is being used from more than one thread! This function sets the @@ -1839,6 +1884,7 @@ ucnv_getDefaultName(void); */ U_STABLE void U_EXPORT2 ucnv_setDefaultName(const char *name); +#endif /* U_HIDE_SYSTEM_API */ /** * Fixes the backslash character mismapping. For example, in SJIS, the backslash @@ -1918,34 +1964,7 @@ ucnv_usesFallback(const UConverter *cnv); * instead of the input signature bytes. * <p> * Usage: - * @code - * UErrorCode err = U_ZERO_ERROR; - * char input[] = { '\xEF','\xBB', '\xBF','\x41','\x42','\x43' }; - * int32_t signatureLength = 0; - * char *encoding = ucnv_detectUnicodeSignature(input,sizeof(input),&signatureLength,&err); - * UConverter *conv = NULL; - * UChar output[100]; - * UChar *target = output, *out; - * char *source = input; - * if(encoding!=NULL && U_SUCCESS(err)){ - * // should signature be discarded ? - * conv = ucnv_open(encoding, &err); - * // do the conversion - * ucnv_toUnicode(conv, - * target, output + sizeof(output)/U_SIZEOF_UCHAR, - * source, input + sizeof(input), - * NULL, TRUE, &err); - * out = output; - * if (discardSignature){ - * ++out; // ignore initial U+FEFF - * } - * while(out != target) { - * printf("%04x ", *out++); - * } - * puts(""); - * } - * - * @endcode + * \snippet samples/ucnv/convsamp.cpp ucnv_detectUnicodeSignature * * @param source The source string in which the signature should be detected. * @param sourceLength Length of the input string, or -1 if terminated with a NUL byte. @@ -1991,6 +2010,24 @@ ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); U_STABLE int32_t U_EXPORT2 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); +/** + * Returns whether or not the charset of the converter has a fixed number of bytes + * per charset character. + * An example of this are converters that are of the type UCNV_SBCS or UCNV_DBCS. + * Another example is UTF-32 which is always 4 bytes per character. + * A Unicode code point may be represented by more than one UTF-8 or UTF-16 code unit + * but a UTF-32 converter encodes each code point with 4 bytes. + * Note: This method is not intended to be used to determine whether the charset has a + * fixed ratio of bytes to Unicode codes <i>units</i> for any particular Unicode encoding form. + * FALSE is returned with the UErrorCode if error occurs or cnv is NULL. + * @param cnv The converter to be tested + * @param status ICU error code in/out paramter + * @return TRUE if the converter is fixed-width + * @stable ICU 4.8 + */ +U_STABLE UBool U_EXPORT2 +ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status); + #endif #endif |