xref: /aosp_15_r20/external/icu/libandroidicu/include/unicode/stringoptions.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2017 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 // stringoptions.h
5*0e209d39SAndroid Build Coastguard Worker // created: 2017jun08 Markus W. Scherer
6*0e209d39SAndroid Build Coastguard Worker 
7*0e209d39SAndroid Build Coastguard Worker #ifndef __STRINGOPTIONS_H__
8*0e209d39SAndroid Build Coastguard Worker #define __STRINGOPTIONS_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 /**
13*0e209d39SAndroid Build Coastguard Worker  * \file
14*0e209d39SAndroid Build Coastguard Worker  * \brief C API: Bit set option bit constants for various string and character processing functions.
15*0e209d39SAndroid Build Coastguard Worker  */
16*0e209d39SAndroid Build Coastguard Worker 
17*0e209d39SAndroid Build Coastguard Worker /**
18*0e209d39SAndroid Build Coastguard Worker  * Option value for case folding: Use default mappings defined in CaseFolding.txt.
19*0e209d39SAndroid Build Coastguard Worker  *
20*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
21*0e209d39SAndroid Build Coastguard Worker  */
22*0e209d39SAndroid Build Coastguard Worker #define U_FOLD_CASE_DEFAULT 0
23*0e209d39SAndroid Build Coastguard Worker 
24*0e209d39SAndroid Build Coastguard Worker /**
25*0e209d39SAndroid Build Coastguard Worker  * Option value for case folding:
26*0e209d39SAndroid Build Coastguard Worker  *
27*0e209d39SAndroid Build Coastguard Worker  * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
28*0e209d39SAndroid Build Coastguard Worker  * and dotless i appropriately for Turkic languages (tr, az).
29*0e209d39SAndroid Build Coastguard Worker  *
30*0e209d39SAndroid Build Coastguard Worker  * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that
31*0e209d39SAndroid Build Coastguard Worker  * are to be included for default mappings and
32*0e209d39SAndroid Build Coastguard Worker  * excluded for the Turkic-specific mappings.
33*0e209d39SAndroid Build Coastguard Worker  *
34*0e209d39SAndroid Build Coastguard Worker  * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that
35*0e209d39SAndroid Build Coastguard Worker  * are to be excluded for default mappings and
36*0e209d39SAndroid Build Coastguard Worker  * included for the Turkic-specific mappings.
37*0e209d39SAndroid Build Coastguard Worker  *
38*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
39*0e209d39SAndroid Build Coastguard Worker  */
40*0e209d39SAndroid Build Coastguard Worker #define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1
41*0e209d39SAndroid Build Coastguard Worker 
42*0e209d39SAndroid Build Coastguard Worker /**
43*0e209d39SAndroid Build Coastguard Worker  * Titlecase the string as a whole rather than each word.
44*0e209d39SAndroid Build Coastguard Worker  * (Titlecase only the character at index 0, possibly adjusted.)
45*0e209d39SAndroid Build Coastguard Worker  * Option bits value for titlecasing APIs that take an options bit set.
46*0e209d39SAndroid Build Coastguard Worker  *
47*0e209d39SAndroid Build Coastguard Worker  * It is an error to specify multiple titlecasing iterator options together,
48*0e209d39SAndroid Build Coastguard Worker  * including both an options bit and an explicit BreakIterator.
49*0e209d39SAndroid Build Coastguard Worker  *
50*0e209d39SAndroid Build Coastguard Worker  * @see U_TITLECASE_ADJUST_TO_CASED
51*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 60
52*0e209d39SAndroid Build Coastguard Worker  */
53*0e209d39SAndroid Build Coastguard Worker #define U_TITLECASE_WHOLE_STRING 0x20
54*0e209d39SAndroid Build Coastguard Worker 
55*0e209d39SAndroid Build Coastguard Worker /**
56*0e209d39SAndroid Build Coastguard Worker  * Titlecase sentences rather than words.
57*0e209d39SAndroid Build Coastguard Worker  * (Titlecase only the first character of each sentence, possibly adjusted.)
58*0e209d39SAndroid Build Coastguard Worker  * Option bits value for titlecasing APIs that take an options bit set.
59*0e209d39SAndroid Build Coastguard Worker  *
60*0e209d39SAndroid Build Coastguard Worker  * It is an error to specify multiple titlecasing iterator options together,
61*0e209d39SAndroid Build Coastguard Worker  * including both an options bit and an explicit BreakIterator.
62*0e209d39SAndroid Build Coastguard Worker  *
63*0e209d39SAndroid Build Coastguard Worker  * @see U_TITLECASE_ADJUST_TO_CASED
64*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 60
65*0e209d39SAndroid Build Coastguard Worker  */
66*0e209d39SAndroid Build Coastguard Worker #define U_TITLECASE_SENTENCES 0x40
67*0e209d39SAndroid Build Coastguard Worker 
68*0e209d39SAndroid Build Coastguard Worker /**
69*0e209d39SAndroid Build Coastguard Worker  * Do not lowercase non-initial parts of words when titlecasing.
70*0e209d39SAndroid Build Coastguard Worker  * Option bit for titlecasing APIs that take an options bit set.
71*0e209d39SAndroid Build Coastguard Worker  *
72*0e209d39SAndroid Build Coastguard Worker  * By default, titlecasing will titlecase the character at each
73*0e209d39SAndroid Build Coastguard Worker  * (possibly adjusted) BreakIterator index and
74*0e209d39SAndroid Build Coastguard Worker  * lowercase all other characters up to the next iterator index.
75*0e209d39SAndroid Build Coastguard Worker  * With this option, the other characters will not be modified.
76*0e209d39SAndroid Build Coastguard Worker  *
77*0e209d39SAndroid Build Coastguard Worker  * @see U_TITLECASE_ADJUST_TO_CASED
78*0e209d39SAndroid Build Coastguard Worker  * @see UnicodeString::toTitle
79*0e209d39SAndroid Build Coastguard Worker  * @see CaseMap::toTitle
80*0e209d39SAndroid Build Coastguard Worker  * @see ucasemap_setOptions
81*0e209d39SAndroid Build Coastguard Worker  * @see ucasemap_toTitle
82*0e209d39SAndroid Build Coastguard Worker  * @see ucasemap_utf8ToTitle
83*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.8
84*0e209d39SAndroid Build Coastguard Worker  */
85*0e209d39SAndroid Build Coastguard Worker #define U_TITLECASE_NO_LOWERCASE 0x100
86*0e209d39SAndroid Build Coastguard Worker 
87*0e209d39SAndroid Build Coastguard Worker /**
88*0e209d39SAndroid Build Coastguard Worker  * Do not adjust the titlecasing BreakIterator indexes;
89*0e209d39SAndroid Build Coastguard Worker  * titlecase exactly the characters at breaks from the iterator.
90*0e209d39SAndroid Build Coastguard Worker  * Option bit for titlecasing APIs that take an options bit set.
91*0e209d39SAndroid Build Coastguard Worker  *
92*0e209d39SAndroid Build Coastguard Worker  * By default, titlecasing will take each break iterator index,
93*0e209d39SAndroid Build Coastguard Worker  * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED),
94*0e209d39SAndroid Build Coastguard Worker  * and titlecase that one.
95*0e209d39SAndroid Build Coastguard Worker  *
96*0e209d39SAndroid Build Coastguard Worker  * Other characters are lowercased.
97*0e209d39SAndroid Build Coastguard Worker  *
98*0e209d39SAndroid Build Coastguard Worker  * It is an error to specify multiple titlecasing adjustment options together.
99*0e209d39SAndroid Build Coastguard Worker  *
100*0e209d39SAndroid Build Coastguard Worker  * @see U_TITLECASE_ADJUST_TO_CASED
101*0e209d39SAndroid Build Coastguard Worker  * @see U_TITLECASE_NO_LOWERCASE
102*0e209d39SAndroid Build Coastguard Worker  * @see UnicodeString::toTitle
103*0e209d39SAndroid Build Coastguard Worker  * @see CaseMap::toTitle
104*0e209d39SAndroid Build Coastguard Worker  * @see ucasemap_setOptions
105*0e209d39SAndroid Build Coastguard Worker  * @see ucasemap_toTitle
106*0e209d39SAndroid Build Coastguard Worker  * @see ucasemap_utf8ToTitle
107*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.8
108*0e209d39SAndroid Build Coastguard Worker  */
109*0e209d39SAndroid Build Coastguard Worker #define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200
110*0e209d39SAndroid Build Coastguard Worker 
111*0e209d39SAndroid Build Coastguard Worker /**
112*0e209d39SAndroid Build Coastguard Worker  * Adjust each titlecasing BreakIterator index to the next cased character.
113*0e209d39SAndroid Build Coastguard Worker  * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).)
114*0e209d39SAndroid Build Coastguard Worker  * Option bit for titlecasing APIs that take an options bit set.
115*0e209d39SAndroid Build Coastguard Worker  *
116*0e209d39SAndroid Build Coastguard Worker  * This used to be the default index adjustment in ICU.
117*0e209d39SAndroid Build Coastguard Worker  * Since ICU 60, the default index adjustment is to the next character that is
118*0e209d39SAndroid Build Coastguard Worker  * a letter, number, symbol, or private use code point.
119*0e209d39SAndroid Build Coastguard Worker  * (Uncased modifier letters are skipped.)
120*0e209d39SAndroid Build Coastguard Worker  * The difference in behavior is small for word titlecasing,
121*0e209d39SAndroid Build Coastguard Worker  * but the new adjustment is much better for whole-string and sentence titlecasing:
122*0e209d39SAndroid Build Coastguard Worker  * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»".
123*0e209d39SAndroid Build Coastguard Worker  *
124*0e209d39SAndroid Build Coastguard Worker  * It is an error to specify multiple titlecasing adjustment options together.
125*0e209d39SAndroid Build Coastguard Worker  *
126*0e209d39SAndroid Build Coastguard Worker  * @see U_TITLECASE_NO_BREAK_ADJUSTMENT
127*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 60
128*0e209d39SAndroid Build Coastguard Worker  */
129*0e209d39SAndroid Build Coastguard Worker #define U_TITLECASE_ADJUST_TO_CASED 0x400
130*0e209d39SAndroid Build Coastguard Worker 
131*0e209d39SAndroid Build Coastguard Worker /**
132*0e209d39SAndroid Build Coastguard Worker  * Option for string transformation functions to not first reset the Edits object.
133*0e209d39SAndroid Build Coastguard Worker  * Used for example in some case-mapping and normalization functions.
134*0e209d39SAndroid Build Coastguard Worker  *
135*0e209d39SAndroid Build Coastguard Worker  * @see CaseMap
136*0e209d39SAndroid Build Coastguard Worker  * @see Edits
137*0e209d39SAndroid Build Coastguard Worker  * @see Normalizer2
138*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 60
139*0e209d39SAndroid Build Coastguard Worker  */
140*0e209d39SAndroid Build Coastguard Worker #define U_EDITS_NO_RESET 0x2000
141*0e209d39SAndroid Build Coastguard Worker 
142*0e209d39SAndroid Build Coastguard Worker /**
143*0e209d39SAndroid Build Coastguard Worker  * Omit unchanged text when recording how source substrings
144*0e209d39SAndroid Build Coastguard Worker  * relate to changed and unchanged result substrings.
145*0e209d39SAndroid Build Coastguard Worker  * Used for example in some case-mapping and normalization functions.
146*0e209d39SAndroid Build Coastguard Worker  *
147*0e209d39SAndroid Build Coastguard Worker  * @see CaseMap
148*0e209d39SAndroid Build Coastguard Worker  * @see Edits
149*0e209d39SAndroid Build Coastguard Worker  * @see Normalizer2
150*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 60
151*0e209d39SAndroid Build Coastguard Worker  */
152*0e209d39SAndroid Build Coastguard Worker #define U_OMIT_UNCHANGED_TEXT 0x4000
153*0e209d39SAndroid Build Coastguard Worker 
154*0e209d39SAndroid Build Coastguard Worker /**
155*0e209d39SAndroid Build Coastguard Worker  * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
156*0e209d39SAndroid Build Coastguard Worker  * Compare strings in code point order instead of code unit order.
157*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.2
158*0e209d39SAndroid Build Coastguard Worker  */
159*0e209d39SAndroid Build Coastguard Worker #define U_COMPARE_CODE_POINT_ORDER  0x8000
160*0e209d39SAndroid Build Coastguard Worker 
161*0e209d39SAndroid Build Coastguard Worker /**
162*0e209d39SAndroid Build Coastguard Worker  * Option bit for unorm_compare:
163*0e209d39SAndroid Build Coastguard Worker  * Perform case-insensitive comparison.
164*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.2
165*0e209d39SAndroid Build Coastguard Worker  */
166*0e209d39SAndroid Build Coastguard Worker #define U_COMPARE_IGNORE_CASE       0x10000
167*0e209d39SAndroid Build Coastguard Worker 
168*0e209d39SAndroid Build Coastguard Worker /**
169*0e209d39SAndroid Build Coastguard Worker  * Option bit for unorm_compare:
170*0e209d39SAndroid Build Coastguard Worker  * Both input strings are assumed to fulfill FCD conditions.
171*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.2
172*0e209d39SAndroid Build Coastguard Worker  */
173*0e209d39SAndroid Build Coastguard Worker #define UNORM_INPUT_IS_FCD          0x20000
174*0e209d39SAndroid Build Coastguard Worker 
175*0e209d39SAndroid Build Coastguard Worker // Related definitions elsewhere.
176*0e209d39SAndroid Build Coastguard Worker // Options that are not meaningful in the same functions
177*0e209d39SAndroid Build Coastguard Worker // can share the same bits.
178*0e209d39SAndroid Build Coastguard Worker //
179*0e209d39SAndroid Build Coastguard Worker // Public:
180*0e209d39SAndroid Build Coastguard Worker // unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
181*0e209d39SAndroid Build Coastguard Worker //
182*0e209d39SAndroid Build Coastguard Worker // Internal: (may change or be removed)
183*0e209d39SAndroid Build Coastguard Worker // ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff
184*0e209d39SAndroid Build Coastguard Worker // ucase.h #define _FOLD_CASE_OPTIONS_MASK 7
185*0e209d39SAndroid Build Coastguard Worker // ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0
186*0e209d39SAndroid Build Coastguard Worker // ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600
187*0e209d39SAndroid Build Coastguard Worker // ustr_imp.h #define _STRNCMP_STYLE 0x1000
188*0e209d39SAndroid Build Coastguard Worker // unormcmp.cpp #define _COMPARE_EQUIV 0x80000
189*0e209d39SAndroid Build Coastguard Worker 
190*0e209d39SAndroid Build Coastguard Worker #endif  // __STRINGOPTIONS_H__
191