ICU 78.1: common/unicode/ucnv_err.h Source File

ICU 78.1 78.1

ucnv_err.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (C) 1999-2009, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 *
9 *
10 * ucnv_err.h:
11 */
12
85 #ifndef UCNV_ERR_H
86 #define UCNV_ERR_H
87
88 #include "unicode/utypes.h"
89
90 #if !UCONFIG_NO_CONVERSION
91
93 struct UConverter;
94
96 typedef struct UConverter UConverter;
97
102 #define UCNV_SUB_STOP_ON_ILLEGAL "i"
103
108 #define UCNV_SKIP_STOP_ON_ILLEGAL "i"
109
114 #define UCNV_ESCAPE_ICU NULL
119 #define UCNV_ESCAPE_JAVA "J"
125 #define UCNV_ESCAPE_C "C"
131 #define UCNV_ESCAPE_XML_DEC "D"
137 #define UCNV_ESCAPE_XML_HEX "X"
142 #define UCNV_ESCAPE_UNICODE "U"
143
149 #define UCNV_ESCAPE_CSS2 "S"
150
157 typedef enum {
158 UCNV_UNASSIGNED = 0,
160 UCNV_ILLEGAL = 1,
168 UCNV_IRREGULAR = 2,
173 UCNV_RESET = 3,
176 UCNV_CLOSE = 4,
178 UCNV_CLONE = 5
187 } UConverterCallbackReason;
188
189
194 typedef struct {
195 uint16_t size;
196 UBool flush;
197 UConverter *converter;
198 const UChar *source;
199 const UChar *sourceLimit;
200 char *target;
201 const char *targetLimit;
202 int32_t *offsets;
203 } UConverterFromUnicodeArgs;
204
205
210 typedef struct {
211 uint16_t size;
212 UBool flush;
213 UConverter *converter;
214 const char *source;
215 const char *sourceLimit;
216 UChar *target;
217 const UChar *targetLimit;
218 int32_t *offsets;
219 } UConverterToUnicodeArgs;
220
221
236 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
237 const void *context,
238 UConverterFromUnicodeArgs *fromUArgs,
239 const UChar* codeUnits,
240 int32_t length,
241 UChar32 codePoint,
242 UConverterCallbackReason reason,
243 UErrorCode * err);
244
245
246
260 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
261 const void *context,
262 UConverterToUnicodeArgs *toUArgs,
263 const char* codeUnits,
264 int32_t length,
265 UConverterCallbackReason reason,
266 UErrorCode * err);
267
287 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
288 const void *context,
289 UConverterFromUnicodeArgs *fromUArgs,
290 const UChar* codeUnits,
291 int32_t length,
292 UChar32 codePoint,
293 UConverterCallbackReason reason,
294 UErrorCode * err);
295
317 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
318 const void *context,
319 UConverterFromUnicodeArgs *fromUArgs,
320 const UChar* codeUnits,
321 int32_t length,
322 UChar32 codePoint,
323 UConverterCallbackReason reason,
324 UErrorCode * err);
325
373 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
374 const void *context,
375 UConverterFromUnicodeArgs *fromUArgs,
376 const UChar* codeUnits,
377 int32_t length,
378 UChar32 codePoint,
379 UConverterCallbackReason reason,
380 UErrorCode * err);
381
382
401 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
402 const void *context,
403 UConverterToUnicodeArgs *toUArgs,
404 const char* codeUnits,
405 int32_t length,
406 UConverterCallbackReason reason,
407 UErrorCode * err);
408
427 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
428 const void *context,
429 UConverterToUnicodeArgs *toUArgs,
430 const char* codeUnits,
431 int32_t length,
432 UConverterCallbackReason reason,
433 UErrorCode * err);
434
453 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
454 const void *context,
455 UConverterToUnicodeArgs *toUArgs,
456 const char* codeUnits,
457 int32_t length,
458 UConverterCallbackReason reason,
459 UErrorCode * err);
460
461 #endif
462
463 #endif
464
465 /*UCNV_ERR_H*/
UConverterFromUnicodeArgs
The structure for the fromUnicode callback function parameter.
Definition: ucnv_err.h:194
UConverterFromUnicodeArgs::targetLimit
const char * targetLimit
Pointer to the limit (end + 1) of target buffer.
Definition: ucnv_err.h:201
UConverterFromUnicodeArgs::flush
UBool flush
The internal state of converter will be reset and data flushed if set to true.
Definition: ucnv_err.h:196
UConverterFromUnicodeArgs::source
const UChar * source
Pointer to the source source buffer.
Definition: ucnv_err.h:198
UConverterFromUnicodeArgs::offsets
int32_t * offsets
Pointer to the buffer that receives the offsets.
Definition: ucnv_err.h:202
UConverterFromUnicodeArgs::sourceLimit
const UChar * sourceLimit
Pointer to the limit (end + 1) of source buffer.
Definition: ucnv_err.h:199
UConverterFromUnicodeArgs::size
uint16_t size
The size of this struct.
Definition: ucnv_err.h:195
UConverterFromUnicodeArgs::target
char * target
Pointer to the target buffer.
Definition: ucnv_err.h:200
UConverterFromUnicodeArgs::converter
UConverter * converter
Pointer to the converter that is opened and to which this struct is passed as an argument.
Definition: ucnv_err.h:197
UConverterToUnicodeArgs
The structure for the toUnicode callback function parameter.
Definition: ucnv_err.h:210
UConverterToUnicodeArgs::targetLimit
const UChar * targetLimit
Pointer to the limit (end + 1) of target buffer.
Definition: ucnv_err.h:217
UConverterToUnicodeArgs::flush
UBool flush
The internal state of converter will be reset and data flushed if set to true.
Definition: ucnv_err.h:212
UConverterToUnicodeArgs::size
uint16_t size
The size of this struct.
Definition: ucnv_err.h:211
UConverterToUnicodeArgs::target
UChar * target
Pointer to the target buffer.
Definition: ucnv_err.h:216
UConverterToUnicodeArgs::converter
UConverter * converter
Pointer to the converter that is opened and to which this struct is passed as an argument.
Definition: ucnv_err.h:213
UConverterToUnicodeArgs::offsets
int32_t * offsets
Pointer to the buffer that receives the offsets.
Definition: ucnv_err.h:218
UConverterToUnicodeArgs::sourceLimit
const char * sourceLimit
Pointer to the limit (end + 1) of source buffer.
Definition: ucnv_err.h:215
UConverterToUnicodeArgs::source
const char * source
Pointer to the source source buffer.
Definition: ucnv_err.h:214
UConverter
struct UConverter UConverter
Definition: ucnv_err.h:96
UCNV_FROM_U_CALLBACK_ESCAPE
U_CAPI void UCNV_FROM_U_CALLBACK_ESCAPE(const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar *codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This From Unicode callback will Substitute the ILLEGAL SEQUENCE w...
UConverterCallbackReason
UConverterCallbackReason
The process condition code to be used with the callbacks.
Definition: ucnv_err.h:157
UCNV_IRREGULAR
@ UCNV_IRREGULAR
The codepoint is not a regular sequence in the encoding.
Definition: ucnv_err.h:168
UCNV_ILLEGAL
@ UCNV_ILLEGAL
The code point is illegal.
Definition: ucnv_err.h:160
UCNV_RESET
@ UCNV_RESET
The callback is called with this reason when a 'reset' has occurred.
Definition: ucnv_err.h:173
UCNV_CLOSE
@ UCNV_CLOSE
Called when the converter is closed.
Definition: ucnv_err.h:176
UCNV_UNASSIGNED
@ UCNV_UNASSIGNED
The code point is unassigned.
Definition: ucnv_err.h:158
UCNV_CLONE
@ UCNV_CLONE
Called when ucnv_safeClone() is called on the converter.
Definition: ucnv_err.h:178
UCNV_TO_U_CALLBACK_SUBSTITUTE
U_CAPI void UCNV_TO_U_CALLBACK_SUBSTITUTE(const void *context, UConverterToUnicodeArgs *toUArgs, const char *codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This To Unicode callback will Substitute the ILLEGAL SEQUENCE,...
UCNV_FROM_U_CALLBACK_SKIP
U_CAPI void UCNV_FROM_U_CALLBACK_SKIP(const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar *codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This From Unicode callback skips any ILLEGAL_SEQUENCE,...
UCNV_FROM_U_CALLBACK_STOP
U_CAPI void UCNV_FROM_U_CALLBACK_STOP(const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar *codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This From Unicode callback STOPS at the ILLEGAL_SEQUENCE,...
UCNV_FROM_U_CALLBACK_SUBSTITUTE
U_CAPI void UCNV_FROM_U_CALLBACK_SUBSTITUTE(const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar *codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This From Unicode callback will Substitute the ILLEGAL SEQUENCE,...
UCNV_TO_U_CALLBACK_STOP
U_CAPI void UCNV_TO_U_CALLBACK_STOP(const void *context, UConverterToUnicodeArgs *toUArgs, const char *codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This To Unicode callback STOPS at the ILLEGAL_SEQUENCE,...
UCNV_TO_U_CALLBACK_SKIP
U_CAPI void UCNV_TO_U_CALLBACK_SKIP(const void *context, UConverterToUnicodeArgs *toUArgs, const char *codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This To Unicode callback skips any ILLEGAL_SEQUENCE,...
UCNV_TO_U_CALLBACK_ESCAPE
U_CAPI void UCNV_TO_U_CALLBACK_ESCAPE(const void *context, UConverterToUnicodeArgs *toUArgs, const char *codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode *err)
DO NOT CALL THIS FUNCTION DIRECTLY! This To Unicode callback will Substitute the ILLEGAL SEQUENCE wit...
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:449
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:400
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:509