/* ********************************************************************** * Copyright (C) 1999, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * * ucnv_err.h: * defines error behaviour functions called by T_UConverter_{from,to}Unicode * * These Functions, although public, should NEVER be called directly, they should be used as parameters to * the T_UConverter_setMissing{Char,Unicode}Action API, to set the behaviour of a converter * when it encounters ILLEGAL/UNMAPPED/INVALID sequences. * * usage example: * * ... * UErrorCode err = U_ZERO_ERROR; * UConverter* myConverter = T_UConverter_create("ibm-949", &err); * * if (U_SUCCESS(err)) * { * T_UConverter_setMissingUnicodeAction(myConverter, (MissingUnicodeAction)UCNV_FROM_U_CALLBACK_STOP, &err); * T_UConverter_setMissingCharAction(myConverter, (MissingCharAction)UCNV_TO_U_CALLBACK_SUBSTITUTE, &err); * } * ... * * The code above tells "myConverter" to stop when it encounters a ILLEGAL/TRUNCATED/INVALID sequences when it is used to * convert from Unicode -> Codepage. * and to substitute with a codepage specific substitutions sequence when converting from Codepage -> Unicode */ /* This file isn't designed to be included by itself. */ #ifndef UCNV_H # include "unicode/ucnv.h" /* and the rest of this file will be ignored. */ #endif #ifndef UCNV_ERR_H #define UCNV_ERR_H #include "unicode/utypes.h" typedef enum { UCNV_UNASSIGNED = 0, UCNV_ILLEGAL = 1, UCNV_IRREGULAR = 2, UCNV_RESET = 3, UCNV_CLOSE = 4 } UConverterCallbackReason; typedef struct { uint16_t size; UBool flush; UConverter *converter; const UChar *source; const UChar *sourceLimit; char *target; const char *targetLimit; int32_t *offsets; /* *offset = blah ; offset++; */ } UConverterFromUnicodeArgs; typedef struct { uint16_t size; UBool flush; UConverter *converter; const char *source; const char *sourceLimit; UChar *target; const UChar *targetLimit; int32_t *offsets; } UConverterToUnicodeArgs; U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( void *context, UConverterToUnicodeArgs *fromUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( void *context, UConverterToUnicodeArgs *fromUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( void *context, UConverterToUnicodeArgs *fromUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( void *context, UConverterToUnicodeArgs *fromUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); #endif/*UCNV_ERR_H*/