xref: /aosp_15_r20/external/icu/libicu/ndk_headers/unicode/ucpmap.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2018 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker 
4*0e209d39SAndroid Build Coastguard Worker // ucpmap.h
5*0e209d39SAndroid Build Coastguard Worker // created: 2018sep03 Markus W. Scherer
6*0e209d39SAndroid Build Coastguard Worker 
7*0e209d39SAndroid Build Coastguard Worker #ifndef __UCPMAP_H__
8*0e209d39SAndroid Build Coastguard Worker #define __UCPMAP_H__
9*0e209d39SAndroid Build Coastguard Worker 
10*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
11*0e209d39SAndroid Build Coastguard Worker 
12*0e209d39SAndroid Build Coastguard Worker U_CDECL_BEGIN
13*0e209d39SAndroid Build Coastguard Worker 
14*0e209d39SAndroid Build Coastguard Worker /**
15*0e209d39SAndroid Build Coastguard Worker  * @addtogroup icu4c ICU4C
16*0e209d39SAndroid Build Coastguard Worker  * @{
17*0e209d39SAndroid Build Coastguard Worker  * \file
18*0e209d39SAndroid Build Coastguard Worker  * \brief C API: This file defines an abstract map from Unicode code points to integer values.
19*0e209d39SAndroid Build Coastguard Worker  *
20*0e209d39SAndroid Build Coastguard Worker  * @see UCPMap
21*0e209d39SAndroid Build Coastguard Worker  * @see UCPTrie
22*0e209d39SAndroid Build Coastguard Worker  * @see UMutableCPTrie
23*0e209d39SAndroid Build Coastguard Worker  */
24*0e209d39SAndroid Build Coastguard Worker 
25*0e209d39SAndroid Build Coastguard Worker /**
26*0e209d39SAndroid Build Coastguard Worker  * Abstract map from Unicode code points (U+0000..U+10FFFF) to integer values.
27*0e209d39SAndroid Build Coastguard Worker  *
28*0e209d39SAndroid Build Coastguard Worker  * @see UCPTrie
29*0e209d39SAndroid Build Coastguard Worker  * @see UMutableCPTrie
30*0e209d39SAndroid Build Coastguard Worker  * \xrefitem stable "Stable" "Stable List" ICU 63
31*0e209d39SAndroid Build Coastguard Worker  */
32*0e209d39SAndroid Build Coastguard Worker typedef struct UCPMap UCPMap;
33*0e209d39SAndroid Build Coastguard Worker 
34*0e209d39SAndroid Build Coastguard Worker /**
35*0e209d39SAndroid Build Coastguard Worker  * Selectors for how ucpmap_getRange() etc. should report value ranges overlapping with surrogates.
36*0e209d39SAndroid Build Coastguard Worker  * Most users should use UCPMAP_RANGE_NORMAL.
37*0e209d39SAndroid Build Coastguard Worker  *
38*0e209d39SAndroid Build Coastguard Worker  * @see ucpmap_getRange
39*0e209d39SAndroid Build Coastguard Worker  * @see ucptrie_getRange
40*0e209d39SAndroid Build Coastguard Worker  * @see umutablecptrie_getRange
41*0e209d39SAndroid Build Coastguard Worker  * \xrefitem stable "Stable" "Stable List" ICU 63
42*0e209d39SAndroid Build Coastguard Worker  */
43*0e209d39SAndroid Build Coastguard Worker enum UCPMapRangeOption {
44*0e209d39SAndroid Build Coastguard Worker     /**
45*0e209d39SAndroid Build Coastguard Worker      * ucpmap_getRange() enumerates all same-value ranges as stored in the map.
46*0e209d39SAndroid Build Coastguard Worker      * Most users should use this option.
47*0e209d39SAndroid Build Coastguard Worker      * \xrefitem stable "Stable" "Stable List" ICU 63
48*0e209d39SAndroid Build Coastguard Worker      */
49*0e209d39SAndroid Build Coastguard Worker     UCPMAP_RANGE_NORMAL,
50*0e209d39SAndroid Build Coastguard Worker     /**
51*0e209d39SAndroid Build Coastguard Worker      * ucpmap_getRange() enumerates all same-value ranges as stored in the map,
52*0e209d39SAndroid Build Coastguard Worker      * except that lead surrogates (U+D800..U+DBFF) are treated as having the
53*0e209d39SAndroid Build Coastguard Worker      * surrogateValue, which is passed to getRange() as a separate parameter.
54*0e209d39SAndroid Build Coastguard Worker      * The surrogateValue is not transformed via filter().
55*0e209d39SAndroid Build Coastguard Worker      * See U_IS_LEAD(c).
56*0e209d39SAndroid Build Coastguard Worker      *
57*0e209d39SAndroid Build Coastguard Worker      * Most users should use UCPMAP_RANGE_NORMAL instead.
58*0e209d39SAndroid Build Coastguard Worker      *
59*0e209d39SAndroid Build Coastguard Worker      * This option is useful for maps that map surrogate code *units* to
60*0e209d39SAndroid Build Coastguard Worker      * special values optimized for UTF-16 string processing
61*0e209d39SAndroid Build Coastguard Worker      * or for special error behavior for unpaired surrogates,
62*0e209d39SAndroid Build Coastguard Worker      * but those values are not to be associated with the lead surrogate code *points*.
63*0e209d39SAndroid Build Coastguard Worker      * \xrefitem stable "Stable" "Stable List" ICU 63
64*0e209d39SAndroid Build Coastguard Worker      */
65*0e209d39SAndroid Build Coastguard Worker     UCPMAP_RANGE_FIXED_LEAD_SURROGATES,
66*0e209d39SAndroid Build Coastguard Worker     /**
67*0e209d39SAndroid Build Coastguard Worker      * ucpmap_getRange() enumerates all same-value ranges as stored in the map,
68*0e209d39SAndroid Build Coastguard Worker      * except that all surrogates (U+D800..U+DFFF) are treated as having the
69*0e209d39SAndroid Build Coastguard Worker      * surrogateValue, which is passed to getRange() as a separate parameter.
70*0e209d39SAndroid Build Coastguard Worker      * The surrogateValue is not transformed via filter().
71*0e209d39SAndroid Build Coastguard Worker      * See U_IS_SURROGATE(c).
72*0e209d39SAndroid Build Coastguard Worker      *
73*0e209d39SAndroid Build Coastguard Worker      * Most users should use UCPMAP_RANGE_NORMAL instead.
74*0e209d39SAndroid Build Coastguard Worker      *
75*0e209d39SAndroid Build Coastguard Worker      * This option is useful for maps that map surrogate code *units* to
76*0e209d39SAndroid Build Coastguard Worker      * special values optimized for UTF-16 string processing
77*0e209d39SAndroid Build Coastguard Worker      * or for special error behavior for unpaired surrogates,
78*0e209d39SAndroid Build Coastguard Worker      * but those values are not to be associated with the lead surrogate code *points*.
79*0e209d39SAndroid Build Coastguard Worker      * \xrefitem stable "Stable" "Stable List" ICU 63
80*0e209d39SAndroid Build Coastguard Worker      */
81*0e209d39SAndroid Build Coastguard Worker     UCPMAP_RANGE_FIXED_ALL_SURROGATES
82*0e209d39SAndroid Build Coastguard Worker };
83*0e209d39SAndroid Build Coastguard Worker #ifndef U_IN_DOXYGEN
84*0e209d39SAndroid Build Coastguard Worker typedef enum UCPMapRangeOption UCPMapRangeOption;
85*0e209d39SAndroid Build Coastguard Worker #endif
86*0e209d39SAndroid Build Coastguard Worker 
87*0e209d39SAndroid Build Coastguard Worker 
88*0e209d39SAndroid Build Coastguard Worker 
89*0e209d39SAndroid Build Coastguard Worker /**
90*0e209d39SAndroid Build Coastguard Worker  * Callback function type: Modifies a map value.
91*0e209d39SAndroid Build Coastguard Worker  * Optionally called by ucpmap_getRange()/ucptrie_getRange()/umutablecptrie_getRange().
92*0e209d39SAndroid Build Coastguard Worker  * The modified value will be returned by the getRange function.
93*0e209d39SAndroid Build Coastguard Worker  *
94*0e209d39SAndroid Build Coastguard Worker  * Can be used to ignore some of the value bits,
95*0e209d39SAndroid Build Coastguard Worker  * make a filter for one of several values,
96*0e209d39SAndroid Build Coastguard Worker  * return a value index computed from the map value, etc.
97*0e209d39SAndroid Build Coastguard Worker  *
98*0e209d39SAndroid Build Coastguard Worker  * @param context an opaque pointer, as passed into the getRange function
99*0e209d39SAndroid Build Coastguard Worker  * @param value a value from the map
100*0e209d39SAndroid Build Coastguard Worker  * @return the modified value
101*0e209d39SAndroid Build Coastguard Worker  * \xrefitem stable "Stable" "Stable List" ICU 63
102*0e209d39SAndroid Build Coastguard Worker  */
103*0e209d39SAndroid Build Coastguard Worker typedef uint32_t U_CALLCONV
104*0e209d39SAndroid Build Coastguard Worker UCPMapValueFilter(const void *context, uint32_t value);
105*0e209d39SAndroid Build Coastguard Worker 
106*0e209d39SAndroid Build Coastguard Worker 
107*0e209d39SAndroid Build Coastguard Worker 
108*0e209d39SAndroid Build Coastguard Worker U_CDECL_END
109*0e209d39SAndroid Build Coastguard Worker 
110*0e209d39SAndroid Build Coastguard Worker #endif
111*0e209d39SAndroid Build Coastguard Worker 
112*0e209d39SAndroid Build Coastguard Worker /** @} */ // addtogroup
113