Main Page   Class Hierarchy   Compound List   File List   Header Files   Sources   Compound Members   File Members  

ucnv_err.h

00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1999, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 **********************************************************************
00006  *
00007  *
00008  *   ucnv_err.h:
00009  *   defines error behaviour functions called by T_UConverter_{from,to}Unicode
00010  *
00011  *   These Functions, although public, should NEVER be called directly, they should be used as parameters to
00012  *   the T_UConverter_setMissing{Char,Unicode}Action API, to set the behaviour of a converter
00013  *   when it encounters ILLEGAL/UNMAPPED/INVALID sequences.
00014  *
00015  *   usage example:
00016  *
00017  *        ...
00018  *        UErrorCode err = U_ZERO_ERROR;
00019  *        UConverter* myConverter = T_UConverter_create("ibm-949", &err);
00020  *
00021  *        if (U_SUCCESS(err))
00022  *        {
00023  *       T_UConverter_setMissingUnicodeAction(myConverter, (MissingUnicodeAction)UCNV_FROM_U_CALLBACK_STOP, &err);
00024  *       T_UConverter_setMissingCharAction(myConverter, (MissingCharAction)UCNV_TO_U_CALLBACK_SUBSTITUTE, &err);
00025  *        }
00026  *        ...
00027  *
00028  *   The code above tells "myConverter" to stop when it encounters a ILLEGAL/TRUNCATED/INVALID sequences when it is used to
00029  *   convert from Unicode -> Codepage.
00030  *   and to substitute with a codepage specific substitutions sequence when converting from Codepage -> Unicode
00031  */
00032 
00033 /* This file isn't designed to be included by itself. */
00034 #ifndef UCNV_H
00035 # include "unicode/ucnv.h"
00036  /* and the rest of this file will be ignored. */
00037 #endif
00038 
00039 #ifndef UCNV_ERR_H
00040 #define UCNV_ERR_H
00041 
00042 #include "unicode/utypes.h"
00043 
00055 typedef enum {
00056     UCNV_UNASSIGNED = 0,
00057     UCNV_ILLEGAL = 1,
00058     UCNV_IRREGULAR = 2,
00059     UCNV_RESET = 3,
00060     UCNV_CLOSE = 4
00061 } UConverterCallbackReason;
00062 
00063 
00067 typedef struct {
00068         uint16_t size;
00069         UBool flush;
00070         UConverter *converter;
00071         const UChar *source;
00072         const UChar *sourceLimit;
00073         char *target;
00074         const char *targetLimit;
00075         int32_t *offsets;  /* *offset = blah ; offset++; */
00076 } UConverterFromUnicodeArgs;
00077 
00078 
00082 typedef struct {
00083         uint16_t size;
00084         UBool flush;
00085         UConverter *converter;
00086         const char *source;
00087         const char *sourceLimit;
00088         UChar *target;
00089         const UChar *targetLimit;
00090         int32_t *offsets;
00091 } UConverterToUnicodeArgs;
00092 
00093 
00098 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP (
00099                   void *context,
00100                   UConverterFromUnicodeArgs *fromUArgs,
00101                   const UChar* codeUnits,
00102                   int32_t length,
00103                   UChar32 codePoint,
00104                   UConverterCallbackReason reason,
00105                                   UErrorCode * err);
00106 
00107 
00108 
00113 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
00114                   void *context,
00115                   UConverterToUnicodeArgs *fromUArgs,
00116                   const char* codeUnits,
00117                   int32_t length,
00118                   UConverterCallbackReason reason,
00119                                   UErrorCode * err);
00120 
00125 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
00126                   void *context,
00127                   UConverterFromUnicodeArgs *fromUArgs,
00128                   const UChar* codeUnits,
00129                   int32_t length,
00130                   UChar32 codePoint,
00131                   UConverterCallbackReason reason,
00132                                   UErrorCode * err);
00133 
00142 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
00143                   void *context,
00144                   UConverterFromUnicodeArgs *fromUArgs,
00145                   const UChar* codeUnits,
00146                   int32_t length,
00147                   UChar32 codePoint,
00148                   UConverterCallbackReason reason,
00149                                   UErrorCode * err);
00150 
00162 U_CAPI void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
00163                   void *context,
00164                   UConverterFromUnicodeArgs *fromUArgs,
00165                   const UChar* codeUnits,
00166                   int32_t length,
00167                   UChar32 codePoint,
00168                   UConverterCallbackReason reason,
00169                                   UErrorCode * err);
00170 
00171 
00176 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
00177                   void *context,
00178                   UConverterToUnicodeArgs *fromUArgs,
00179                   const char* codeUnits,
00180                   int32_t length,
00181                   UConverterCallbackReason reason,
00182                                   UErrorCode * err);
00183 
00191 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE (
00192                   void *context,
00193                   UConverterToUnicodeArgs *fromUArgs,
00194                   const char* codeUnits,
00195                   int32_t length,
00196                   UConverterCallbackReason reason,
00197                                   UErrorCode * err);
00198 
00208 U_CAPI void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
00209                   void *context,
00210                   UConverterToUnicodeArgs *fromUArgs,
00211                   const char* codeUnits,
00212                   int32_t length,
00213                   UConverterCallbackReason reason,
00214                                   UErrorCode * err);
00215 
00216 #endif/*UCNV_ERR_H*/ 

Generated at Wed Aug 16 16:05:36 2000 for ICU1.6 by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999