⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ucnv.h

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 H
📖 第 1 页 / 共 5 页
字号:
 * @return The maximum number of bytes per UChar that are output by ucnv_fromUnicode(), *         to be used together with UCNV_GET_MAX_BYTES_FOR_STRING for buffer allocation. * * @see UCNV_GET_MAX_BYTES_FOR_STRING * @see ucnv_getMinCharSize * @stable ICU 2.0 */U_STABLE int8_t U_EXPORT2ucnv_getMaxCharSize(const UConverter *converter);#ifndef U_HIDE_DRAFT_API/** * Calculates the size of a buffer for conversion from Unicode to a charset. * The calculated size is guaranteed to be sufficient for this conversion. * * It takes into account initial and final non-character bytes that are output * by some converters. * It does not take into account callbacks which output more than one charset * character sequence per call, like escape callbacks. * The default (substitution) callback only outputs one charset character sequence. * * @param length Number of UChars to be converted. * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter *                    that will be used. * @return Size of a buffer that will be large enough to hold the output bytes of *         converting length UChars with the converter that returned the maxCharSize. * * @see ucnv_getMaxCharSize * @draft ICU 2.8 */#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \     (((int32_t)(length)+10)*(int32_t)(maxCharSize))#endif /*U_HIDE_DRAFT_API*//** * Returns the minimum byte length for characters in this codepage.  * This is usually either 1 or 2. * @param converter the Unicode converter * @return the minimum number of bytes allowed by this particular converter * @see ucnv_getMaxCharSize * @stable ICU 2.0 */U_STABLE int8_t U_EXPORT2ucnv_getMinCharSize(const UConverter *converter);/** * Returns the display name of the converter passed in based on the Locale  * passed in. If the locale contains no display name, the internal ASCII * name will be filled in. * * @param converter the Unicode converter. * @param displayLocale is the specific Locale we want to localised for * @param displayName user provided buffer to be filled in * @param displayNameCapacity size of displayName Buffer * @param err error status code * @return displayNameLength number of UChar needed in displayName * @see ucnv_getName * @stable ICU 2.0 */U_STABLE int32_t U_EXPORT2ucnv_getDisplayName(const UConverter *converter,                    const char *displayLocale,                    UChar *displayName,                    int32_t displayNameCapacity,                    UErrorCode *err);/** * Gets the internal, canonical name of the converter (zero-terminated). * The lifetime of the returned string will be that of the converter  * passed to this function. * @param converter the Unicode converter * @param err UErrorCode status * @return the internal name of the converter * @see ucnv_getDisplayName * @stable ICU 2.0 */U_STABLE const char * U_EXPORT2 ucnv_getName(const UConverter *converter, UErrorCode *err);/** * Gets a codepage number associated with the converter. This is not guaranteed * to be the one used to create the converter. Some converters do not represent * platform registered codepages and return zero for the codepage number. * The error code fill-in parameter indicates if the codepage number * is available. * Does not check if the converter is <TT>NULL</TT> or if converter's data * table is <TT>NULL</TT>. * * Important: The use of CCSIDs is not recommended because it is limited * to only two platforms in principle and only one (UCNV_IBM) in the current * ICU converter API. * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely. * For more details see ucnv_openCCSID(). * * @param converter the Unicode converter * @param err the error status code. * @return If any error occurrs, -1 will be returned otherwise, the codepage number * will be returned * @see ucnv_openCCSID * @see ucnv_getPlatform * @stable ICU 2.0 */U_STABLE int32_t U_EXPORT2ucnv_getCCSID(const UConverter *converter,              UErrorCode *err);/** * Gets a codepage platform associated with the converter. Currently,  * only <TT>UCNV_IBM</TT> will be returned. * Does not test if the converter is <TT>NULL</TT> or if converter's data  * table is <TT>NULL</TT>.  * @param converter the Unicode converter * @param err the error status code. * @return The codepage platform * @stable ICU 2.0 */U_STABLE UConverterPlatform U_EXPORT2ucnv_getPlatform(const UConverter *converter,                 UErrorCode *err);/** * Gets the type of the converter * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022,  * EBCDIC_STATEFUL, LATIN_1 * @param converter a valid, opened converter * @return the type of the converter * @stable ICU 2.0 */U_STABLE UConverterType U_EXPORT2ucnv_getType(const UConverter * converter);/** * Gets the "starter" (lead) bytes for converters of type MBCS. * Will fill in an <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if converter passed in * is not MBCS. Fills in an array of type UBool, with the value of the byte  * as offset to the array. For example, if (starters[0x20] == TRUE) at return, * it means that the byte 0x20 is a starter byte in this converter. * Context pointers are always owned by the caller. *  * @param converter a valid, opened converter of type MBCS * @param starters an array of size 256 to be filled in * @param err error status, <TT>U_ILLEGAL_ARGUMENT_ERROR</TT> if the  * converter is not a type which can return starters. * @see ucnv_getType * @stable ICU 2.0 */U_STABLE void U_EXPORT2ucnv_getStarters(const UConverter* converter,                  UBool starters[256],                 UErrorCode* err);/** * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet(). * @see ucnv_getUnicodeSet * @stable ICU 2.6 */typedef enum UConverterUnicodeSet {    /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */    UCNV_ROUNDTRIP_SET,    /** Number of UConverterUnicodeSet selectors. @stable ICU 2.6 */    UCNV_SET_COUNT} UConverterUnicodeSet;/** * Returns the set of Unicode code points that can be converted by an ICU converter. * * The current implementation returns only one kind of set (UCNV_ROUNDTRIP_SET): * The set of all Unicode code points that can be roundtrip-converted * (converted without any data loss) with the converter. * This set will not include code points that have fallback mappings * or are only the result of reverse fallback mappings. * See UTR #22 "Character Mapping Markup Language" * at http://www.unicode.org/reports/tr22/ * * This is useful for example for * - checking that a string or document can be roundtrip-converted with a converter, *   without/before actually performing the conversion * - testing if a converter can be used for text for typical text for a certain locale, *   by comparing its roundtrip set with the set of ExemplarCharacters from *   ICU's locale data or other sources * * In the future, there may be more UConverterUnicodeSet choices to select * sets with different properties. * * @param cnv The converter for which a set is requested. * @param setFillIn A valid USet *. It will be cleared by this function before *            the converter's specific set is filled into the USet. * @param whichSet A UConverterUnicodeSet selector; *              currently UCNV_ROUNDTRIP_SET is the only supported value. * @param pErrorCode ICU error code in/out parameter. *                   Must fulfill U_SUCCESS before the function call. * * @see UConverterUnicodeSet * @see uset_open * @see uset_close * @stable ICU 2.6 */U_STABLE void U_EXPORT2ucnv_getUnicodeSet(const UConverter *cnv,                   USet *setFillIn,                   UConverterUnicodeSet whichSet,                   UErrorCode *pErrorCode);/** * Gets the current calback function used by the converter when an illegal *  or invalid codepage sequence is found.  * Context pointers are always owned by the caller. * * @param converter the unicode converter * @param action fillin: returns the callback function pointer * @param context fillin: returns the callback's private void* context * @see ucnv_setToUCallBack * @stable ICU 2.0 */U_STABLE void U_EXPORT2ucnv_getToUCallBack (const UConverter * converter,                     UConverterToUCallback *action,                     const void **context);/** * Gets the current callback function used by the converter when illegal  * or invalid Unicode sequence is found. * Context pointers are always owned by the caller. * * @param converter the unicode converter * @param action fillin: returns the callback function pointer * @param context fillin: returns the callback's private void* context * @see ucnv_setFromUCallBack * @stable ICU 2.0 */U_STABLE void U_EXPORT2ucnv_getFromUCallBack (const UConverter * converter,                       UConverterFromUCallback *action,                       const void **context);/** * Changes the callback function used by the converter when * an illegal or invalid sequence is found. * Context pointers are always owned by the caller. * Predefined actions and contexts can be found in the ucnv_err.h header. * * @param converter the unicode converter * @param newAction the new callback function * @param newContext the new toUnicode callback context pointer. This can be NULL. * @param oldAction fillin: returns the old callback function pointer. This can be NULL. * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. * @param err The error code status * @see ucnv_getToUCallBack * @stable ICU 2.0 */U_STABLE void U_EXPORT2ucnv_setToUCallBack (UConverter * converter,                     UConverterToUCallback newAction,                     const void* newContext,                     UConverterToUCallback *oldAction,                     const void** oldContext,                     UErrorCode * err);/** * Changes the current callback function used by the converter when * an illegal or invalid sequence is found. * Context pointers are always owned by the caller. * Predefined actions and contexts can be found in the ucnv_err.h header. * * @param converter the unicode converter * @param newAction the new callback function * @param newContext the new fromUnicode callback context pointer. This can be NULL. * @param oldAction fillin: returns the old callback function pointer. This can be NULL. * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. * @param err The error code status * @see ucnv_getFromUCallBack * @stable ICU 2.0 */U_STABLE void U_EXPORT2ucnv_setFromUCallBack (UConverter * converter,                       UConverterFromUCallback newAction,                       const void *newContext,                       UConverterFromUCallback *oldAction,                       const void **oldContext,                       UErrorCode * err);/** * Converts an array of unicode characters to an array of codepage * characters. This function is optimized for converting a continuous * stream of data in buffer-sized chunks, where the entire source and * target does not fit in available buffers. *  * The source pointer is an in/out parameter. It starts out pointing where the  * conversion is to begin, and ends up pointing after the last UChar consumed.  *  * Target similarly starts out pointer at the first available byte in the output * buffer, and ends up pointing after the last byte written to the output. *  * The converter always attempts to consume the entire source buffer, unless  * (1.) the target buffer is full, or (2.) a failing error is returned from the * current callback function.  When a successful error status has been * returned, it means that all of the source buffer has been *  consumed. At that point, the caller should reset the source and *  sourceLimit pointers to point to the next chunk. *  * At the end of the stream (flush==TRUE), the input is completely consumed * when *source==sourceLimit and no error code is set. * The converter object is then automatically reset by this function. * (This means that a converter need not be reset explicitly between data * streams if it finishes the previous stream without errors.) *  * This is a <I>stateful</I> conversion. Additionally, even when all source data has * been consumed, some data may be in the converters' internal state. * Call this function repeatedly, updating the target pointers with

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -