Imported Upstream version 58.1
[platform/upstream/icu.git] / source / samples / ucnv / flagcb.h
1 /* Copyright (C) 2016 and later: Unicode, Inc. and others.
2    License & terms of use: http://www.unicode.org/copyright.html#License
3
4    Copyright (c) 2000 IBM, Inc. and Others. 
5    FLAGCB.H - interface to 'flagging' callback which 
6    simply marks the fact that the callback was called. 
7 */
8
9 #ifndef _FLAGCB
10 #define _FLAGCB
11
12 #include "unicode/utypes.h"
13 #include "unicode/ucnv.h"
14
15 /* The structure of a FromU Flag context. 
16    (conceivably there could be a ToU Flag Context) */
17
18 typedef struct
19 {
20   UConverterFromUCallback  subCallback;
21   const void               *subContext;
22   UBool                    flag;
23 } FromUFLAGContext;
24
25 /**
26  * open the context 
27  */
28
29 U_CAPI FromUFLAGContext* U_EXPORT2  flagCB_fromU_openContext();
30
31 /**
32  * the actual callback 
33  */
34 U_CAPI void U_EXPORT2 flagCB_fromU(
35                   const void *context,
36                   UConverterFromUnicodeArgs *fromUArgs,
37                   const UChar* codeUnits,
38                   int32_t length,
39                   UChar32 codePoint,
40                   UConverterCallbackReason reason,
41                                   UErrorCode * err);
42
43
44
45 typedef struct
46 {
47     UConverterFromUCallback  subCallback;
48     const void               *subContext;
49     uint32_t       magic;      /* 0xC0FFEE to identify that the object is OK */
50     uint32_t       serial;     /* minted from nextSerial */
51 } debugCBContext;
52
53 U_CAPI void debugCB_fromU(const void *context,
54                    UConverterFromUnicodeArgs *fromUArgs,
55                    const UChar* codeUnits,
56                    int32_t length,
57                    UChar32 codePoint,
58                    UConverterCallbackReason reason,
59                    UErrorCode * err);
60
61 U_CAPI debugCBContext *debugCB_openContext();
62
63 #endif