+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
-* Copyright (C) 1999-2004, International Business Machines
+* Copyright (C) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
-* uconv_cnv.h:
-* defines all the low level conversion functions
-* T_UnicodeConverter_{to,from}Unicode_$ConversionType
+* ucnv_cnv.h:
+* Definitions for converter implementations.
*
* Modification History:
*
typedef struct {
int32_t size; /* sizeof(UConverterLoadArgs) */
int32_t nestedLoads; /* count nested ucnv_load() calls */
- int32_t reserved; /* reserved - for good alignment of the pointers */
+ UBool onlyTestIsLoadable; /* input: don't actually load */
+ UBool reserved0; /* reserved - for good alignment of the pointers */
+ int16_t reserved; /* reserved - for good alignment of the pointers */
uint32_t options;
- const char *pkg, *name;
+ const char *pkg, *name, *locale;
} UConverterLoadArgs;
+#define UCNV_LOAD_ARGS_INITIALIZER \
+ { (int32_t)sizeof(UConverterLoadArgs), 0, FALSE, FALSE, 0, 0, NULL, NULL, NULL }
+
typedef void (*UConverterLoad) (UConverterSharedData *sharedData,
UConverterLoadArgs *pArgs,
const uint8_t *raw, UErrorCode *pErrorCode);
typedef void (*UConverterUnload) (UConverterSharedData *sharedData);
-typedef void (*UConverterOpen) (UConverter *cnv, const char *name, const char *locale,uint32_t options, UErrorCode *pErrorCode);
+typedef void (*UConverterOpen) (UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *pErrorCode);
typedef void (*UConverterClose) (UConverter *cnv);
typedef enum UConverterResetChoice {
*/
typedef void (*UConverterFromUnicode) (UConverterFromUnicodeArgs *, UErrorCode *);
+/*
+ * Converter implementation function for ucnv_convertEx(), for direct conversion
+ * between two charsets without pivoting through UTF-16.
+ * The rules are the same as for UConverterToUnicode and UConverterFromUnicode.
+ * In addition,
+ * - The toUnicode side must behave and keep state exactly like the
+ * UConverterToUnicode implementation for the same source charset.
+ * - A U_USING_DEFAULT_WARNING can be set to request to temporarily fall back
+ * to pivoting. When this function is called, the conversion framework makes
+ * sure that this warning is not set on input.
+ * - Continuing a partial match and flushing the toUnicode replay buffer
+ * are handled by pivoting, using the toUnicode and fromUnicode functions.
+ */
+typedef void (*UConverterConvert) (UConverterFromUnicodeArgs *pFromUArgs,
+ UConverterToUnicodeArgs *pToUArgs,
+ UErrorCode *pErrorCode);
+
/*
* Converter implementation function for ucnv_getNextUChar().
* If the function pointer is NULL, then the toUnicode function will be used.
int32_t *pBufferSize,
UErrorCode *status);
+/**
+ * Filters for some ucnv_getUnicodeSet() implementation code.
+ */
+typedef enum UConverterSetFilter {
+ UCNV_SET_FILTER_NONE,
+ UCNV_SET_FILTER_DBCS_ONLY,
+ UCNV_SET_FILTER_2022_CN,
+ UCNV_SET_FILTER_SJIS,
+ UCNV_SET_FILTER_GR94DBCS,
+ UCNV_SET_FILTER_HZ,
+ UCNV_SET_FILTER_COUNT
+} UConverterSetFilter;
+
/**
* Fills the set of Unicode code points that can be converted by an ICU converter.
* The API function ucnv_getUnicodeSet() clears the USet before calling
* For more documentation, see ucnv_getUnicodeSet() in ucnv.h.
*/
typedef void (*UConverterGetUnicodeSet) (const UConverter *cnv,
- USetAdder *sa,
+ const USetAdder *sa,
UConverterUnicodeSet which,
UErrorCode *pErrorCode);
UConverterWriteSub writeSub;
UConverterSafeClone safeClone;
UConverterGetUnicodeSet getUnicodeSet;
+
+ UConverterConvert toUTF8;
+ UConverterConvert fromUTF8;
};
extern const UConverterSharedData
_LMBCSData1,_LMBCSData2, _LMBCSData3, _LMBCSData4, _LMBCSData5, _LMBCSData6,
_LMBCSData8,_LMBCSData11,_LMBCSData16,_LMBCSData17,_LMBCSData18,_LMBCSData19,
_HZData,_ISCIIData, _SCSUData, _ASCIIData,
- _UTF7Data, _Bocu1Data, _UTF16Data, _UTF32Data, _CESU8Data, _IMAPData;
+ _UTF7Data, _Bocu1Data, _UTF16Data, _UTF32Data, _CESU8Data, _IMAPData, _CompoundTextData;
U_CDECL_END
U_CFUNC void
ucnv_getCompleteUnicodeSet(const UConverter *cnv,
- USetAdder *sa,
+ const USetAdder *sa,
UConverterUnicodeSet which,
UErrorCode *pErrorCode);
U_CFUNC void
ucnv_getNonSurrogateUnicodeSet(const UConverter *cnv,
- USetAdder *sa,
+ const USetAdder *sa,
UConverterUnicodeSet which,
UErrorCode *pErrorCode);