xref: /aosp_15_r20/external/icu/libandroidicu/include/unicode/utrans.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 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 *******************************************************************************
5*0e209d39SAndroid Build Coastguard Worker *   Copyright (C) 1997-2011,2014-2015 International Business Machines
6*0e209d39SAndroid Build Coastguard Worker *   Corporation and others.  All Rights Reserved.
7*0e209d39SAndroid Build Coastguard Worker *******************************************************************************
8*0e209d39SAndroid Build Coastguard Worker *   Date        Name        Description
9*0e209d39SAndroid Build Coastguard Worker *   06/21/00    aliu        Creation.
10*0e209d39SAndroid Build Coastguard Worker *******************************************************************************
11*0e209d39SAndroid Build Coastguard Worker */
12*0e209d39SAndroid Build Coastguard Worker 
13*0e209d39SAndroid Build Coastguard Worker #ifndef UTRANS_H
14*0e209d39SAndroid Build Coastguard Worker #define UTRANS_H
15*0e209d39SAndroid Build Coastguard Worker 
16*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
17*0e209d39SAndroid Build Coastguard Worker 
18*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_TRANSLITERATION
19*0e209d39SAndroid Build Coastguard Worker 
20*0e209d39SAndroid Build Coastguard Worker #include "unicode/urep.h"
21*0e209d39SAndroid Build Coastguard Worker #include "unicode/parseerr.h"
22*0e209d39SAndroid Build Coastguard Worker #include "unicode/uenum.h"
23*0e209d39SAndroid Build Coastguard Worker #include "unicode/uset.h"
24*0e209d39SAndroid Build Coastguard Worker 
25*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API
26*0e209d39SAndroid Build Coastguard Worker #include "unicode/localpointer.h"
27*0e209d39SAndroid Build Coastguard Worker #endif   // U_SHOW_CPLUSPLUS_API
28*0e209d39SAndroid Build Coastguard Worker 
29*0e209d39SAndroid Build Coastguard Worker /********************************************************************
30*0e209d39SAndroid Build Coastguard Worker  * General Notes
31*0e209d39SAndroid Build Coastguard Worker  ********************************************************************
32*0e209d39SAndroid Build Coastguard Worker  */
33*0e209d39SAndroid Build Coastguard Worker /**
34*0e209d39SAndroid Build Coastguard Worker  * \file
35*0e209d39SAndroid Build Coastguard Worker  * \brief C API: Transliterator
36*0e209d39SAndroid Build Coastguard Worker  *
37*0e209d39SAndroid Build Coastguard Worker  * <h2> Transliteration </h2>
38*0e209d39SAndroid Build Coastguard Worker  * The data structures and functions described in this header provide
39*0e209d39SAndroid Build Coastguard Worker  * transliteration services.  Transliteration services are implemented
40*0e209d39SAndroid Build Coastguard Worker  * as C++ classes.  The comments and documentation in this header
41*0e209d39SAndroid Build Coastguard Worker  * assume the reader is familiar with the C++ headers translit.h and
42*0e209d39SAndroid Build Coastguard Worker  * associated documentation.
43*0e209d39SAndroid Build Coastguard Worker  *
44*0e209d39SAndroid Build Coastguard Worker  * A significant but incomplete subset of the C++ transliteration
45*0e209d39SAndroid Build Coastguard Worker  * services are available to C code through this header.  In order to
46*0e209d39SAndroid Build Coastguard Worker  * access more complex transliteration services, refer to the C++
47*0e209d39SAndroid Build Coastguard Worker  * headers and documentation.
48*0e209d39SAndroid Build Coastguard Worker  *
49*0e209d39SAndroid Build Coastguard Worker  * There are two sets of functions for working with transliterator IDs:
50*0e209d39SAndroid Build Coastguard Worker  *
51*0e209d39SAndroid Build Coastguard Worker  * An old, deprecated set uses char * IDs, which works for true and pure
52*0e209d39SAndroid Build Coastguard Worker  * identifiers that these APIs were designed for,
53*0e209d39SAndroid Build Coastguard Worker  * for example "Cyrillic-Latin".
54*0e209d39SAndroid Build Coastguard Worker  * It does not work when the ID contains filters ("[:Script=Cyrl:]")
55*0e209d39SAndroid Build Coastguard Worker  * or even a complete set of rules because then the ID string contains more
56*0e209d39SAndroid Build Coastguard Worker  * than just "invariant" characters (see utypes.h).
57*0e209d39SAndroid Build Coastguard Worker  *
58*0e209d39SAndroid Build Coastguard Worker  * A new set of functions replaces the old ones and uses UChar * IDs,
59*0e209d39SAndroid Build Coastguard Worker  * paralleling the UnicodeString IDs in the C++ API. (New in ICU 2.8.)
60*0e209d39SAndroid Build Coastguard Worker  */
61*0e209d39SAndroid Build Coastguard Worker 
62*0e209d39SAndroid Build Coastguard Worker /********************************************************************
63*0e209d39SAndroid Build Coastguard Worker  * Data Structures
64*0e209d39SAndroid Build Coastguard Worker  ********************************************************************/
65*0e209d39SAndroid Build Coastguard Worker 
66*0e209d39SAndroid Build Coastguard Worker /**
67*0e209d39SAndroid Build Coastguard Worker  * An opaque transliterator for use in C.  Open with utrans_openxxx()
68*0e209d39SAndroid Build Coastguard Worker  * and close with utrans_close() when done.  Equivalent to the C++ class
69*0e209d39SAndroid Build Coastguard Worker  * Transliterator and its subclasses.
70*0e209d39SAndroid Build Coastguard Worker  * @see Transliterator
71*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
72*0e209d39SAndroid Build Coastguard Worker  */
73*0e209d39SAndroid Build Coastguard Worker typedef void* UTransliterator;
74*0e209d39SAndroid Build Coastguard Worker 
75*0e209d39SAndroid Build Coastguard Worker /**
76*0e209d39SAndroid Build Coastguard Worker  * Direction constant indicating the direction in a transliterator,
77*0e209d39SAndroid Build Coastguard Worker  * e.g., the forward or reverse rules of a RuleBasedTransliterator.
78*0e209d39SAndroid Build Coastguard Worker  * Specified when a transliterator is opened.  An "A-B" transliterator
79*0e209d39SAndroid Build Coastguard Worker  * transliterates A to B when operating in the forward direction, and
80*0e209d39SAndroid Build Coastguard Worker  * B to A when operating in the reverse direction.
81*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
82*0e209d39SAndroid Build Coastguard Worker  */
83*0e209d39SAndroid Build Coastguard Worker typedef enum UTransDirection {
84*0e209d39SAndroid Build Coastguard Worker 
85*0e209d39SAndroid Build Coastguard Worker     /**
86*0e209d39SAndroid Build Coastguard Worker      * UTRANS_FORWARD means from &lt;source&gt; to &lt;target&gt; for a
87*0e209d39SAndroid Build Coastguard Worker      * transliterator with ID &lt;source&gt;-&lt;target&gt;.  For a transliterator
88*0e209d39SAndroid Build Coastguard Worker      * opened using a rule, it means forward direction rules, e.g.,
89*0e209d39SAndroid Build Coastguard Worker      * "A > B".
90*0e209d39SAndroid Build Coastguard Worker      */
91*0e209d39SAndroid Build Coastguard Worker     UTRANS_FORWARD,
92*0e209d39SAndroid Build Coastguard Worker 
93*0e209d39SAndroid Build Coastguard Worker     /**
94*0e209d39SAndroid Build Coastguard Worker      * UTRANS_REVERSE means from &lt;target&gt; to &lt;source&gt; for a
95*0e209d39SAndroid Build Coastguard Worker      * transliterator with ID &lt;source&gt;-&lt;target&gt;.  For a transliterator
96*0e209d39SAndroid Build Coastguard Worker      * opened using a rule, it means reverse direction rules, e.g.,
97*0e209d39SAndroid Build Coastguard Worker      * "A < B".
98*0e209d39SAndroid Build Coastguard Worker      */
99*0e209d39SAndroid Build Coastguard Worker     UTRANS_REVERSE
100*0e209d39SAndroid Build Coastguard Worker 
101*0e209d39SAndroid Build Coastguard Worker } UTransDirection;
102*0e209d39SAndroid Build Coastguard Worker 
103*0e209d39SAndroid Build Coastguard Worker /**
104*0e209d39SAndroid Build Coastguard Worker  * Position structure for utrans_transIncremental() incremental
105*0e209d39SAndroid Build Coastguard Worker  * transliteration.  This structure defines two substrings of the text
106*0e209d39SAndroid Build Coastguard Worker  * being transliterated.  The first region, [contextStart,
107*0e209d39SAndroid Build Coastguard Worker  * contextLimit), defines what characters the transliterator will read
108*0e209d39SAndroid Build Coastguard Worker  * as context.  The second region, [start, limit), defines what
109*0e209d39SAndroid Build Coastguard Worker  * characters will actually be transliterated.  The second region
110*0e209d39SAndroid Build Coastguard Worker  * should be a subset of the first.
111*0e209d39SAndroid Build Coastguard Worker  *
112*0e209d39SAndroid Build Coastguard Worker  * <p>After a transliteration operation, some of the indices in this
113*0e209d39SAndroid Build Coastguard Worker  * structure will be modified.  See the field descriptions for
114*0e209d39SAndroid Build Coastguard Worker  * details.
115*0e209d39SAndroid Build Coastguard Worker  *
116*0e209d39SAndroid Build Coastguard Worker  * <p>contextStart <= start <= limit <= contextLimit
117*0e209d39SAndroid Build Coastguard Worker  *
118*0e209d39SAndroid Build Coastguard Worker  * <p>Note: All index values in this structure must be at code point
119*0e209d39SAndroid Build Coastguard Worker  * boundaries.  That is, none of them may occur between two code units
120*0e209d39SAndroid Build Coastguard Worker  * of a surrogate pair.  If any index does split a surrogate pair,
121*0e209d39SAndroid Build Coastguard Worker  * results are unspecified.
122*0e209d39SAndroid Build Coastguard Worker  *
123*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
124*0e209d39SAndroid Build Coastguard Worker  */
125*0e209d39SAndroid Build Coastguard Worker typedef struct UTransPosition {
126*0e209d39SAndroid Build Coastguard Worker 
127*0e209d39SAndroid Build Coastguard Worker     /**
128*0e209d39SAndroid Build Coastguard Worker      * Beginning index, inclusive, of the context to be considered for
129*0e209d39SAndroid Build Coastguard Worker      * a transliteration operation.  The transliterator will ignore
130*0e209d39SAndroid Build Coastguard Worker      * anything before this index.  INPUT/OUTPUT parameter: This parameter
131*0e209d39SAndroid Build Coastguard Worker      * is updated by a transliteration operation to reflect the maximum
132*0e209d39SAndroid Build Coastguard Worker      * amount of antecontext needed by a transliterator.
133*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.4
134*0e209d39SAndroid Build Coastguard Worker      */
135*0e209d39SAndroid Build Coastguard Worker     int32_t contextStart;
136*0e209d39SAndroid Build Coastguard Worker 
137*0e209d39SAndroid Build Coastguard Worker     /**
138*0e209d39SAndroid Build Coastguard Worker      * Ending index, exclusive, of the context to be considered for a
139*0e209d39SAndroid Build Coastguard Worker      * transliteration operation.  The transliterator will ignore
140*0e209d39SAndroid Build Coastguard Worker      * anything at or after this index.  INPUT/OUTPUT parameter: This
141*0e209d39SAndroid Build Coastguard Worker      * parameter is updated to reflect changes in the length of the
142*0e209d39SAndroid Build Coastguard Worker      * text, but points to the same logical position in the text.
143*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.4
144*0e209d39SAndroid Build Coastguard Worker      */
145*0e209d39SAndroid Build Coastguard Worker     int32_t contextLimit;
146*0e209d39SAndroid Build Coastguard Worker 
147*0e209d39SAndroid Build Coastguard Worker     /**
148*0e209d39SAndroid Build Coastguard Worker      * Beginning index, inclusive, of the text to be transliterated.
149*0e209d39SAndroid Build Coastguard Worker      * INPUT/OUTPUT parameter: This parameter is advanced past
150*0e209d39SAndroid Build Coastguard Worker      * characters that have already been transliterated by a
151*0e209d39SAndroid Build Coastguard Worker      * transliteration operation.
152*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.4
153*0e209d39SAndroid Build Coastguard Worker      */
154*0e209d39SAndroid Build Coastguard Worker     int32_t start;
155*0e209d39SAndroid Build Coastguard Worker 
156*0e209d39SAndroid Build Coastguard Worker     /**
157*0e209d39SAndroid Build Coastguard Worker      * Ending index, exclusive, of the text to be transliterated.
158*0e209d39SAndroid Build Coastguard Worker      * INPUT/OUTPUT parameter: This parameter is updated to reflect
159*0e209d39SAndroid Build Coastguard Worker      * changes in the length of the text, but points to the same
160*0e209d39SAndroid Build Coastguard Worker      * logical position in the text.
161*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 2.4
162*0e209d39SAndroid Build Coastguard Worker      */
163*0e209d39SAndroid Build Coastguard Worker     int32_t limit;
164*0e209d39SAndroid Build Coastguard Worker 
165*0e209d39SAndroid Build Coastguard Worker } UTransPosition;
166*0e209d39SAndroid Build Coastguard Worker 
167*0e209d39SAndroid Build Coastguard Worker /********************************************************************
168*0e209d39SAndroid Build Coastguard Worker  * General API
169*0e209d39SAndroid Build Coastguard Worker  ********************************************************************/
170*0e209d39SAndroid Build Coastguard Worker 
171*0e209d39SAndroid Build Coastguard Worker /**
172*0e209d39SAndroid Build Coastguard Worker  * Open a custom transliterator, given a custom rules string
173*0e209d39SAndroid Build Coastguard Worker  * OR
174*0e209d39SAndroid Build Coastguard Worker  * a system transliterator, given its ID.
175*0e209d39SAndroid Build Coastguard Worker  * Any non-NULL result from this function should later be closed with
176*0e209d39SAndroid Build Coastguard Worker  * utrans_close().
177*0e209d39SAndroid Build Coastguard Worker  *
178*0e209d39SAndroid Build Coastguard Worker  * @param id a valid transliterator ID
179*0e209d39SAndroid Build Coastguard Worker  * @param idLength the length of the ID string, or -1 if NUL-terminated
180*0e209d39SAndroid Build Coastguard Worker  * @param dir the desired direction
181*0e209d39SAndroid Build Coastguard Worker  * @param rules the transliterator rules.  See the C++ header rbt.h for
182*0e209d39SAndroid Build Coastguard Worker  *              rules syntax. If NULL then a system transliterator matching
183*0e209d39SAndroid Build Coastguard Worker  *              the ID is returned.
184*0e209d39SAndroid Build Coastguard Worker  * @param rulesLength the length of the rules, or -1 if the rules
185*0e209d39SAndroid Build Coastguard Worker  *                    are NUL-terminated.
186*0e209d39SAndroid Build Coastguard Worker  * @param parseError a pointer to a UParseError struct to receive the details
187*0e209d39SAndroid Build Coastguard Worker  *                   of any parsing errors. This parameter may be NULL if no
188*0e209d39SAndroid Build Coastguard Worker  *                   parsing error details are desired.
189*0e209d39SAndroid Build Coastguard Worker  * @param pErrorCode a pointer to the UErrorCode
190*0e209d39SAndroid Build Coastguard Worker  * @return a transliterator pointer that may be passed to other
191*0e209d39SAndroid Build Coastguard Worker  *         utrans_xxx() functions, or NULL if the open call fails.
192*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
193*0e209d39SAndroid Build Coastguard Worker  */
194*0e209d39SAndroid Build Coastguard Worker U_CAPI UTransliterator* U_EXPORT2
195*0e209d39SAndroid Build Coastguard Worker utrans_openU(const UChar *id,
196*0e209d39SAndroid Build Coastguard Worker              int32_t idLength,
197*0e209d39SAndroid Build Coastguard Worker              UTransDirection dir,
198*0e209d39SAndroid Build Coastguard Worker              const UChar *rules,
199*0e209d39SAndroid Build Coastguard Worker              int32_t rulesLength,
200*0e209d39SAndroid Build Coastguard Worker              UParseError *parseError,
201*0e209d39SAndroid Build Coastguard Worker              UErrorCode *pErrorCode);
202*0e209d39SAndroid Build Coastguard Worker 
203*0e209d39SAndroid Build Coastguard Worker /**
204*0e209d39SAndroid Build Coastguard Worker  * Open an inverse of an existing transliterator.  For this to work,
205*0e209d39SAndroid Build Coastguard Worker  * the inverse must be registered with the system.  For example, if
206*0e209d39SAndroid Build Coastguard Worker  * the Transliterator "A-B" is opened, and then its inverse is opened,
207*0e209d39SAndroid Build Coastguard Worker  * the result is the Transliterator "B-A", if such a transliterator is
208*0e209d39SAndroid Build Coastguard Worker  * registered with the system.  Otherwise the result is NULL and a
209*0e209d39SAndroid Build Coastguard Worker  * failing UErrorCode is set.  Any non-NULL result from this function
210*0e209d39SAndroid Build Coastguard Worker  * should later be closed with utrans_close().
211*0e209d39SAndroid Build Coastguard Worker  *
212*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator to open the inverse of.
213*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
214*0e209d39SAndroid Build Coastguard Worker  * @return a pointer to a newly-opened transliterator that is the
215*0e209d39SAndroid Build Coastguard Worker  * inverse of trans, or NULL if the open call fails.
216*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
217*0e209d39SAndroid Build Coastguard Worker  */
218*0e209d39SAndroid Build Coastguard Worker U_CAPI UTransliterator* U_EXPORT2
219*0e209d39SAndroid Build Coastguard Worker utrans_openInverse(const UTransliterator* trans,
220*0e209d39SAndroid Build Coastguard Worker                    UErrorCode* status);
221*0e209d39SAndroid Build Coastguard Worker 
222*0e209d39SAndroid Build Coastguard Worker /**
223*0e209d39SAndroid Build Coastguard Worker  * Create a copy of a transliterator.  Any non-NULL result from this
224*0e209d39SAndroid Build Coastguard Worker  * function should later be closed with utrans_close().
225*0e209d39SAndroid Build Coastguard Worker  *
226*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator to be copied.
227*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
228*0e209d39SAndroid Build Coastguard Worker  * @return a transliterator pointer that may be passed to other
229*0e209d39SAndroid Build Coastguard Worker  * utrans_xxx() functions, or NULL if the clone call fails.
230*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
231*0e209d39SAndroid Build Coastguard Worker  */
232*0e209d39SAndroid Build Coastguard Worker U_CAPI UTransliterator* U_EXPORT2
233*0e209d39SAndroid Build Coastguard Worker utrans_clone(const UTransliterator* trans,
234*0e209d39SAndroid Build Coastguard Worker              UErrorCode* status);
235*0e209d39SAndroid Build Coastguard Worker 
236*0e209d39SAndroid Build Coastguard Worker /**
237*0e209d39SAndroid Build Coastguard Worker  * Close a transliterator.  Any non-NULL pointer returned by
238*0e209d39SAndroid Build Coastguard Worker  * utrans_openXxx() or utrans_clone() should eventually be closed.
239*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator to be closed.
240*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
241*0e209d39SAndroid Build Coastguard Worker  */
242*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
243*0e209d39SAndroid Build Coastguard Worker utrans_close(UTransliterator* trans);
244*0e209d39SAndroid Build Coastguard Worker 
245*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API
246*0e209d39SAndroid Build Coastguard Worker 
247*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
248*0e209d39SAndroid Build Coastguard Worker 
249*0e209d39SAndroid Build Coastguard Worker /**
250*0e209d39SAndroid Build Coastguard Worker  * \class LocalUTransliteratorPointer
251*0e209d39SAndroid Build Coastguard Worker  * "Smart pointer" class, closes a UTransliterator via utrans_close().
252*0e209d39SAndroid Build Coastguard Worker  * For most methods see the LocalPointerBase base class.
253*0e209d39SAndroid Build Coastguard Worker  *
254*0e209d39SAndroid Build Coastguard Worker  * @see LocalPointerBase
255*0e209d39SAndroid Build Coastguard Worker  * @see LocalPointer
256*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.4
257*0e209d39SAndroid Build Coastguard Worker  */
258*0e209d39SAndroid Build Coastguard Worker U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
259*0e209d39SAndroid Build Coastguard Worker 
260*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
261*0e209d39SAndroid Build Coastguard Worker 
262*0e209d39SAndroid Build Coastguard Worker #endif
263*0e209d39SAndroid Build Coastguard Worker 
264*0e209d39SAndroid Build Coastguard Worker /**
265*0e209d39SAndroid Build Coastguard Worker  * Return the programmatic identifier for this transliterator.
266*0e209d39SAndroid Build Coastguard Worker  * If this identifier is passed to utrans_openU(), it will open
267*0e209d39SAndroid Build Coastguard Worker  * a transliterator equivalent to this one, if the ID has been
268*0e209d39SAndroid Build Coastguard Worker  * registered.
269*0e209d39SAndroid Build Coastguard Worker  *
270*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator to return the ID of.
271*0e209d39SAndroid Build Coastguard Worker  * @param resultLength pointer to an output variable receiving the length
272*0e209d39SAndroid Build Coastguard Worker  *        of the ID string; can be NULL
273*0e209d39SAndroid Build Coastguard Worker  * @return the NUL-terminated ID string. This pointer remains
274*0e209d39SAndroid Build Coastguard Worker  * valid until utrans_close() is called on this transliterator.
275*0e209d39SAndroid Build Coastguard Worker  *
276*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
277*0e209d39SAndroid Build Coastguard Worker  */
278*0e209d39SAndroid Build Coastguard Worker U_CAPI const UChar * U_EXPORT2
279*0e209d39SAndroid Build Coastguard Worker utrans_getUnicodeID(const UTransliterator *trans,
280*0e209d39SAndroid Build Coastguard Worker                     int32_t *resultLength);
281*0e209d39SAndroid Build Coastguard Worker 
282*0e209d39SAndroid Build Coastguard Worker /**
283*0e209d39SAndroid Build Coastguard Worker  * Register an open transliterator with the system.  When
284*0e209d39SAndroid Build Coastguard Worker  * utrans_open() is called with an ID string that is equal to that
285*0e209d39SAndroid Build Coastguard Worker  * returned by utrans_getID(adoptedTrans,...), then
286*0e209d39SAndroid Build Coastguard Worker  * utrans_clone(adoptedTrans,...) is returned.
287*0e209d39SAndroid Build Coastguard Worker  *
288*0e209d39SAndroid Build Coastguard Worker  * <p>NOTE: After this call the system owns the adoptedTrans and will
289*0e209d39SAndroid Build Coastguard Worker  * close it.  The user must not call utrans_close() on adoptedTrans.
290*0e209d39SAndroid Build Coastguard Worker  *
291*0e209d39SAndroid Build Coastguard Worker  * @param adoptedTrans a transliterator, typically the result of
292*0e209d39SAndroid Build Coastguard Worker  * utrans_openRules(), to be registered with the system.
293*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
294*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
295*0e209d39SAndroid Build Coastguard Worker  */
296*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
297*0e209d39SAndroid Build Coastguard Worker utrans_register(UTransliterator* adoptedTrans,
298*0e209d39SAndroid Build Coastguard Worker                 UErrorCode* status);
299*0e209d39SAndroid Build Coastguard Worker 
300*0e209d39SAndroid Build Coastguard Worker /**
301*0e209d39SAndroid Build Coastguard Worker  * Unregister a transliterator from the system.  After this call the
302*0e209d39SAndroid Build Coastguard Worker  * system will no longer recognize the given ID when passed to
303*0e209d39SAndroid Build Coastguard Worker  * utrans_open(). If the ID is invalid then nothing is done.
304*0e209d39SAndroid Build Coastguard Worker  *
305*0e209d39SAndroid Build Coastguard Worker  * @param id an ID to unregister
306*0e209d39SAndroid Build Coastguard Worker  * @param idLength the length of id, or -1 if id is zero-terminated
307*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
308*0e209d39SAndroid Build Coastguard Worker  */
309*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
310*0e209d39SAndroid Build Coastguard Worker utrans_unregisterID(const UChar* id, int32_t idLength);
311*0e209d39SAndroid Build Coastguard Worker 
312*0e209d39SAndroid Build Coastguard Worker /**
313*0e209d39SAndroid Build Coastguard Worker  * Set the filter used by a transliterator.  A filter can be used to
314*0e209d39SAndroid Build Coastguard Worker  * make the transliterator pass certain characters through untouched.
315*0e209d39SAndroid Build Coastguard Worker  * The filter is expressed using a UnicodeSet pattern.  If the
316*0e209d39SAndroid Build Coastguard Worker  * filterPattern is NULL or the empty string, then the transliterator
317*0e209d39SAndroid Build Coastguard Worker  * will be reset to use no filter.
318*0e209d39SAndroid Build Coastguard Worker  *
319*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator
320*0e209d39SAndroid Build Coastguard Worker  * @param filterPattern a pattern string, in the form accepted by
321*0e209d39SAndroid Build Coastguard Worker  * UnicodeSet, specifying which characters to apply the
322*0e209d39SAndroid Build Coastguard Worker  * transliteration to.  May be NULL or the empty string to indicate no
323*0e209d39SAndroid Build Coastguard Worker  * filter.
324*0e209d39SAndroid Build Coastguard Worker  * @param filterPatternLen the length of filterPattern, or -1 if
325*0e209d39SAndroid Build Coastguard Worker  * filterPattern is zero-terminated
326*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
327*0e209d39SAndroid Build Coastguard Worker  * @see UnicodeSet
328*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
329*0e209d39SAndroid Build Coastguard Worker  */
330*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
331*0e209d39SAndroid Build Coastguard Worker utrans_setFilter(UTransliterator* trans,
332*0e209d39SAndroid Build Coastguard Worker                  const UChar* filterPattern,
333*0e209d39SAndroid Build Coastguard Worker                  int32_t filterPatternLen,
334*0e209d39SAndroid Build Coastguard Worker                  UErrorCode* status);
335*0e209d39SAndroid Build Coastguard Worker 
336*0e209d39SAndroid Build Coastguard Worker /**
337*0e209d39SAndroid Build Coastguard Worker  * Return the number of system transliterators.
338*0e209d39SAndroid Build Coastguard Worker  * It is recommended to use utrans_openIDs() instead.
339*0e209d39SAndroid Build Coastguard Worker  *
340*0e209d39SAndroid Build Coastguard Worker  * @return the number of system transliterators.
341*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
342*0e209d39SAndroid Build Coastguard Worker  */
343*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
344*0e209d39SAndroid Build Coastguard Worker utrans_countAvailableIDs(void);
345*0e209d39SAndroid Build Coastguard Worker 
346*0e209d39SAndroid Build Coastguard Worker /**
347*0e209d39SAndroid Build Coastguard Worker  * Return a UEnumeration for the available transliterators.
348*0e209d39SAndroid Build Coastguard Worker  *
349*0e209d39SAndroid Build Coastguard Worker  * @param pErrorCode Pointer to the UErrorCode in/out parameter.
350*0e209d39SAndroid Build Coastguard Worker  * @return UEnumeration for the available transliterators.
351*0e209d39SAndroid Build Coastguard Worker  *         Close with uenum_close().
352*0e209d39SAndroid Build Coastguard Worker  *
353*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
354*0e209d39SAndroid Build Coastguard Worker  */
355*0e209d39SAndroid Build Coastguard Worker U_CAPI UEnumeration * U_EXPORT2
356*0e209d39SAndroid Build Coastguard Worker utrans_openIDs(UErrorCode *pErrorCode);
357*0e209d39SAndroid Build Coastguard Worker 
358*0e209d39SAndroid Build Coastguard Worker /********************************************************************
359*0e209d39SAndroid Build Coastguard Worker  * Transliteration API
360*0e209d39SAndroid Build Coastguard Worker  ********************************************************************/
361*0e209d39SAndroid Build Coastguard Worker 
362*0e209d39SAndroid Build Coastguard Worker /**
363*0e209d39SAndroid Build Coastguard Worker  * Transliterate a segment of a UReplaceable string.  The string is
364*0e209d39SAndroid Build Coastguard Worker  * passed in as a UReplaceable pointer rep and a UReplaceableCallbacks
365*0e209d39SAndroid Build Coastguard Worker  * function pointer struct repFunc.  Functions in the repFunc struct
366*0e209d39SAndroid Build Coastguard Worker  * will be called in order to modify the rep string.
367*0e209d39SAndroid Build Coastguard Worker  *
368*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator
369*0e209d39SAndroid Build Coastguard Worker  * @param rep a pointer to the string.  This will be passed to the
370*0e209d39SAndroid Build Coastguard Worker  * repFunc functions.
371*0e209d39SAndroid Build Coastguard Worker  * @param repFunc a set of function pointers that will be used to
372*0e209d39SAndroid Build Coastguard Worker  * modify the string pointed to by rep.
373*0e209d39SAndroid Build Coastguard Worker  * @param start the beginning index, inclusive; <code>0 <= start <=
374*0e209d39SAndroid Build Coastguard Worker  * limit</code>.
375*0e209d39SAndroid Build Coastguard Worker  * @param limit pointer to the ending index, exclusive; <code>start <=
376*0e209d39SAndroid Build Coastguard Worker  * limit <= repFunc->length(rep)</code>.  Upon return, *limit will
377*0e209d39SAndroid Build Coastguard Worker  * contain the new limit index.  The text previously occupying
378*0e209d39SAndroid Build Coastguard Worker  * <code>[start, limit)</code> has been transliterated, possibly to a
379*0e209d39SAndroid Build Coastguard Worker  * string of a different length, at <code>[start,
380*0e209d39SAndroid Build Coastguard Worker  * </code><em>new-limit</em><code>)</code>, where <em>new-limit</em>
381*0e209d39SAndroid Build Coastguard Worker  * is the return value.
382*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
383*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
384*0e209d39SAndroid Build Coastguard Worker  */
385*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
386*0e209d39SAndroid Build Coastguard Worker utrans_trans(const UTransliterator* trans,
387*0e209d39SAndroid Build Coastguard Worker              UReplaceable* rep,
388*0e209d39SAndroid Build Coastguard Worker              const UReplaceableCallbacks* repFunc,
389*0e209d39SAndroid Build Coastguard Worker              int32_t start,
390*0e209d39SAndroid Build Coastguard Worker              int32_t* limit,
391*0e209d39SAndroid Build Coastguard Worker              UErrorCode* status);
392*0e209d39SAndroid Build Coastguard Worker 
393*0e209d39SAndroid Build Coastguard Worker /**
394*0e209d39SAndroid Build Coastguard Worker  * Transliterate the portion of the UReplaceable text buffer that can
395*0e209d39SAndroid Build Coastguard Worker  * be transliterated unambiguously.  This method is typically called
396*0e209d39SAndroid Build Coastguard Worker  * after new text has been inserted, e.g. as a result of a keyboard
397*0e209d39SAndroid Build Coastguard Worker  * event.  The transliterator will try to transliterate characters of
398*0e209d39SAndroid Build Coastguard Worker  * <code>rep</code> between <code>index.cursor</code> and
399*0e209d39SAndroid Build Coastguard Worker  * <code>index.limit</code>.  Characters before
400*0e209d39SAndroid Build Coastguard Worker  * <code>index.cursor</code> will not be changed.
401*0e209d39SAndroid Build Coastguard Worker  *
402*0e209d39SAndroid Build Coastguard Worker  * <p>Upon return, values in <code>index</code> will be updated.
403*0e209d39SAndroid Build Coastguard Worker  * <code>index.start</code> will be advanced to the first
404*0e209d39SAndroid Build Coastguard Worker  * character that future calls to this method will read.
405*0e209d39SAndroid Build Coastguard Worker  * <code>index.cursor</code> and <code>index.limit</code> will
406*0e209d39SAndroid Build Coastguard Worker  * be adjusted to delimit the range of text that future calls to
407*0e209d39SAndroid Build Coastguard Worker  * this method may change.
408*0e209d39SAndroid Build Coastguard Worker  *
409*0e209d39SAndroid Build Coastguard Worker  * <p>Typical usage of this method begins with an initial call
410*0e209d39SAndroid Build Coastguard Worker  * with <code>index.start</code> and <code>index.limit</code>
411*0e209d39SAndroid Build Coastguard Worker  * set to indicate the portion of <code>text</code> to be
412*0e209d39SAndroid Build Coastguard Worker  * transliterated, and <code>index.cursor == index.start</code>.
413*0e209d39SAndroid Build Coastguard Worker  * Thereafter, <code>index</code> can be used without
414*0e209d39SAndroid Build Coastguard Worker  * modification in future calls, provided that all changes to
415*0e209d39SAndroid Build Coastguard Worker  * <code>text</code> are made via this method.
416*0e209d39SAndroid Build Coastguard Worker  *
417*0e209d39SAndroid Build Coastguard Worker  * <p>This method assumes that future calls may be made that will
418*0e209d39SAndroid Build Coastguard Worker  * insert new text into the buffer.  As a result, it only performs
419*0e209d39SAndroid Build Coastguard Worker  * unambiguous transliterations.  After the last call to this method,
420*0e209d39SAndroid Build Coastguard Worker  * there may be untransliterated text that is waiting for more input
421*0e209d39SAndroid Build Coastguard Worker  * to resolve an ambiguity.  In order to perform these pending
422*0e209d39SAndroid Build Coastguard Worker  * transliterations, clients should call utrans_trans() with a start
423*0e209d39SAndroid Build Coastguard Worker  * of index.start and a limit of index.end after the last call to this
424*0e209d39SAndroid Build Coastguard Worker  * method has been made.
425*0e209d39SAndroid Build Coastguard Worker  *
426*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator
427*0e209d39SAndroid Build Coastguard Worker  * @param rep a pointer to the string.  This will be passed to the
428*0e209d39SAndroid Build Coastguard Worker  * repFunc functions.
429*0e209d39SAndroid Build Coastguard Worker  * @param repFunc a set of function pointers that will be used to
430*0e209d39SAndroid Build Coastguard Worker  * modify the string pointed to by rep.
431*0e209d39SAndroid Build Coastguard Worker  * @param pos a struct containing the start and limit indices of the
432*0e209d39SAndroid Build Coastguard Worker  * text to be read and the text to be transliterated
433*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
434*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
435*0e209d39SAndroid Build Coastguard Worker  */
436*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
437*0e209d39SAndroid Build Coastguard Worker utrans_transIncremental(const UTransliterator* trans,
438*0e209d39SAndroid Build Coastguard Worker                         UReplaceable* rep,
439*0e209d39SAndroid Build Coastguard Worker                         const UReplaceableCallbacks* repFunc,
440*0e209d39SAndroid Build Coastguard Worker                         UTransPosition* pos,
441*0e209d39SAndroid Build Coastguard Worker                         UErrorCode* status);
442*0e209d39SAndroid Build Coastguard Worker 
443*0e209d39SAndroid Build Coastguard Worker /**
444*0e209d39SAndroid Build Coastguard Worker  * Transliterate a segment of a UChar* string.  The string is passed
445*0e209d39SAndroid Build Coastguard Worker  * in in a UChar* buffer.  The string is modified in place.  If the
446*0e209d39SAndroid Build Coastguard Worker  * result is longer than textCapacity, it is truncated.  The actual
447*0e209d39SAndroid Build Coastguard Worker  * length of the result is returned in *textLength, if textLength is
448*0e209d39SAndroid Build Coastguard Worker  * non-NULL. *textLength may be greater than textCapacity, but only
449*0e209d39SAndroid Build Coastguard Worker  * textCapacity UChars will be written to *text, including the zero
450*0e209d39SAndroid Build Coastguard Worker  * terminator.
451*0e209d39SAndroid Build Coastguard Worker  *
452*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator
453*0e209d39SAndroid Build Coastguard Worker  * @param text a pointer to a buffer containing the text to be
454*0e209d39SAndroid Build Coastguard Worker  * transliterated on input and the result text on output.
455*0e209d39SAndroid Build Coastguard Worker  * @param textLength a pointer to the length of the string in text.
456*0e209d39SAndroid Build Coastguard Worker  * If the length is -1 then the string is assumed to be
457*0e209d39SAndroid Build Coastguard Worker  * zero-terminated.  Upon return, the new length is stored in
458*0e209d39SAndroid Build Coastguard Worker  * *textLength.  If textLength is NULL then the string is assumed to
459*0e209d39SAndroid Build Coastguard Worker  * be zero-terminated.
460*0e209d39SAndroid Build Coastguard Worker  * @param textCapacity the length of the text buffer
461*0e209d39SAndroid Build Coastguard Worker  * @param start the beginning index, inclusive; <code>0 <= start <=
462*0e209d39SAndroid Build Coastguard Worker  * limit</code>.
463*0e209d39SAndroid Build Coastguard Worker  * @param limit pointer to the ending index, exclusive; <code>start <=
464*0e209d39SAndroid Build Coastguard Worker  * limit <= repFunc->length(rep)</code>.  Upon return, *limit will
465*0e209d39SAndroid Build Coastguard Worker  * contain the new limit index.  The text previously occupying
466*0e209d39SAndroid Build Coastguard Worker  * <code>[start, limit)</code> has been transliterated, possibly to a
467*0e209d39SAndroid Build Coastguard Worker  * string of a different length, at <code>[start,
468*0e209d39SAndroid Build Coastguard Worker  * </code><em>new-limit</em><code>)</code>, where <em>new-limit</em>
469*0e209d39SAndroid Build Coastguard Worker  * is the return value.
470*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
471*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
472*0e209d39SAndroid Build Coastguard Worker  */
473*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
474*0e209d39SAndroid Build Coastguard Worker utrans_transUChars(const UTransliterator* trans,
475*0e209d39SAndroid Build Coastguard Worker                    UChar* text,
476*0e209d39SAndroid Build Coastguard Worker                    int32_t* textLength,
477*0e209d39SAndroid Build Coastguard Worker                    int32_t textCapacity,
478*0e209d39SAndroid Build Coastguard Worker                    int32_t start,
479*0e209d39SAndroid Build Coastguard Worker                    int32_t* limit,
480*0e209d39SAndroid Build Coastguard Worker                    UErrorCode* status);
481*0e209d39SAndroid Build Coastguard Worker 
482*0e209d39SAndroid Build Coastguard Worker /**
483*0e209d39SAndroid Build Coastguard Worker  * Transliterate the portion of the UChar* text buffer that can be
484*0e209d39SAndroid Build Coastguard Worker  * transliterated unambiguously.  See utrans_transIncremental().  The
485*0e209d39SAndroid Build Coastguard Worker  * string is passed in in a UChar* buffer.  The string is modified in
486*0e209d39SAndroid Build Coastguard Worker  * place.  If the result is longer than textCapacity, it is truncated.
487*0e209d39SAndroid Build Coastguard Worker  * The actual length of the result is returned in *textLength, if
488*0e209d39SAndroid Build Coastguard Worker  * textLength is non-NULL. *textLength may be greater than
489*0e209d39SAndroid Build Coastguard Worker  * textCapacity, but only textCapacity UChars will be written to
490*0e209d39SAndroid Build Coastguard Worker  * *text, including the zero terminator.  See utrans_transIncremental()
491*0e209d39SAndroid Build Coastguard Worker  * for usage details.
492*0e209d39SAndroid Build Coastguard Worker  *
493*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator
494*0e209d39SAndroid Build Coastguard Worker  * @param text a pointer to a buffer containing the text to be
495*0e209d39SAndroid Build Coastguard Worker  * transliterated on input and the result text on output.
496*0e209d39SAndroid Build Coastguard Worker  * @param textLength a pointer to the length of the string in text.
497*0e209d39SAndroid Build Coastguard Worker  * If the length is -1 then the string is assumed to be
498*0e209d39SAndroid Build Coastguard Worker  * zero-terminated.  Upon return, the new length is stored in
499*0e209d39SAndroid Build Coastguard Worker  * *textLength.  If textLength is NULL then the string is assumed to
500*0e209d39SAndroid Build Coastguard Worker  * be zero-terminated.
501*0e209d39SAndroid Build Coastguard Worker  * @param textCapacity the length of the text buffer
502*0e209d39SAndroid Build Coastguard Worker  * @param pos a struct containing the start and limit indices of the
503*0e209d39SAndroid Build Coastguard Worker  * text to be read and the text to be transliterated
504*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
505*0e209d39SAndroid Build Coastguard Worker  * @see utrans_transIncremental
506*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
507*0e209d39SAndroid Build Coastguard Worker  */
508*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
509*0e209d39SAndroid Build Coastguard Worker utrans_transIncrementalUChars(const UTransliterator* trans,
510*0e209d39SAndroid Build Coastguard Worker                               UChar* text,
511*0e209d39SAndroid Build Coastguard Worker                               int32_t* textLength,
512*0e209d39SAndroid Build Coastguard Worker                               int32_t textCapacity,
513*0e209d39SAndroid Build Coastguard Worker                               UTransPosition* pos,
514*0e209d39SAndroid Build Coastguard Worker                               UErrorCode* status);
515*0e209d39SAndroid Build Coastguard Worker 
516*0e209d39SAndroid Build Coastguard Worker /**
517*0e209d39SAndroid Build Coastguard Worker  * Create a rule string that can be passed to utrans_openU to recreate this
518*0e209d39SAndroid Build Coastguard Worker  * transliterator.
519*0e209d39SAndroid Build Coastguard Worker  *
520*0e209d39SAndroid Build Coastguard Worker  * @param trans     The transliterator
521*0e209d39SAndroid Build Coastguard Worker  * @param escapeUnprintable if true then convert unprintable characters to their
522*0e209d39SAndroid Build Coastguard Worker  *                  hex escape representations, \\uxxxx or \\Uxxxxxxxx.
523*0e209d39SAndroid Build Coastguard Worker  *                  Unprintable characters are those other than
524*0e209d39SAndroid Build Coastguard Worker  *                  U+000A, U+0020..U+007E.
525*0e209d39SAndroid Build Coastguard Worker  * @param result    A pointer to a buffer to receive the rules.
526*0e209d39SAndroid Build Coastguard Worker  * @param resultLength The maximum size of result.
527*0e209d39SAndroid Build Coastguard Worker  * @param status    A pointer to the UErrorCode. In case of error status, the
528*0e209d39SAndroid Build Coastguard Worker  *                  contents of result are undefined.
529*0e209d39SAndroid Build Coastguard Worker  * @return int32_t   The length of the rule string (may be greater than resultLength,
530*0e209d39SAndroid Build Coastguard Worker  *                  in which case an error is returned).
531*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 53
532*0e209d39SAndroid Build Coastguard Worker  */
533*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
534*0e209d39SAndroid Build Coastguard Worker utrans_toRules(     const UTransliterator* trans,
535*0e209d39SAndroid Build Coastguard Worker                     UBool escapeUnprintable,
536*0e209d39SAndroid Build Coastguard Worker                     UChar* result, int32_t resultLength,
537*0e209d39SAndroid Build Coastguard Worker                     UErrorCode* status);
538*0e209d39SAndroid Build Coastguard Worker 
539*0e209d39SAndroid Build Coastguard Worker /**
540*0e209d39SAndroid Build Coastguard Worker  * Returns the set of all characters that may be modified in the input text by
541*0e209d39SAndroid Build Coastguard Worker  * this UTransliterator, optionally ignoring the transliterator's current filter.
542*0e209d39SAndroid Build Coastguard Worker  * @param trans     The transliterator.
543*0e209d39SAndroid Build Coastguard Worker  * @param ignoreFilter If false, the returned set incorporates the
544*0e209d39SAndroid Build Coastguard Worker  *                  UTransliterator's current filter; if the filter is changed,
545*0e209d39SAndroid Build Coastguard Worker  *                  the return value of this function will change. If true, the
546*0e209d39SAndroid Build Coastguard Worker  *                  returned set ignores the effect of the UTransliterator's
547*0e209d39SAndroid Build Coastguard Worker  *                  current filter.
548*0e209d39SAndroid Build Coastguard Worker  * @param fillIn    Pointer to a USet object to receive the modifiable characters
549*0e209d39SAndroid Build Coastguard Worker  *                  set. Previous contents of fillIn are lost. <em>If fillIn is
550*0e209d39SAndroid Build Coastguard Worker  *                  NULL, then a new USet is created and returned. The caller
551*0e209d39SAndroid Build Coastguard Worker  *                  owns the result and must dispose of it by calling uset_close.</em>
552*0e209d39SAndroid Build Coastguard Worker  * @param status    A pointer to the UErrorCode.
553*0e209d39SAndroid Build Coastguard Worker  * @return USet*    Either fillIn, or if fillIn is NULL, a pointer to a
554*0e209d39SAndroid Build Coastguard Worker  *                  newly-allocated USet that the user must close. In case of
555*0e209d39SAndroid Build Coastguard Worker  *                  error, NULL is returned.
556*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 53
557*0e209d39SAndroid Build Coastguard Worker  */
558*0e209d39SAndroid Build Coastguard Worker U_CAPI USet* U_EXPORT2
559*0e209d39SAndroid Build Coastguard Worker utrans_getSourceSet(const UTransliterator* trans,
560*0e209d39SAndroid Build Coastguard Worker                     UBool ignoreFilter,
561*0e209d39SAndroid Build Coastguard Worker                     USet* fillIn,
562*0e209d39SAndroid Build Coastguard Worker                     UErrorCode* status);
563*0e209d39SAndroid Build Coastguard Worker 
564*0e209d39SAndroid Build Coastguard Worker /* deprecated API ----------------------------------------------------------- */
565*0e209d39SAndroid Build Coastguard Worker 
566*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_DEPRECATED_API
567*0e209d39SAndroid Build Coastguard Worker 
568*0e209d39SAndroid Build Coastguard Worker /* see utrans.h documentation for why these functions are deprecated */
569*0e209d39SAndroid Build Coastguard Worker 
570*0e209d39SAndroid Build Coastguard Worker /**
571*0e209d39SAndroid Build Coastguard Worker  * Deprecated, use utrans_openU() instead.
572*0e209d39SAndroid Build Coastguard Worker  * Open a custom transliterator, given a custom rules string
573*0e209d39SAndroid Build Coastguard Worker  * OR
574*0e209d39SAndroid Build Coastguard Worker  * a system transliterator, given its ID.
575*0e209d39SAndroid Build Coastguard Worker  * Any non-NULL result from this function should later be closed with
576*0e209d39SAndroid Build Coastguard Worker  * utrans_close().
577*0e209d39SAndroid Build Coastguard Worker  *
578*0e209d39SAndroid Build Coastguard Worker  * @param id a valid ID, as returned by utrans_getAvailableID()
579*0e209d39SAndroid Build Coastguard Worker  * @param dir the desired direction
580*0e209d39SAndroid Build Coastguard Worker  * @param rules the transliterator rules.  See the C++ header rbt.h
581*0e209d39SAndroid Build Coastguard Worker  * for rules syntax. If NULL then a system transliterator matching
582*0e209d39SAndroid Build Coastguard Worker  * the ID is returned.
583*0e209d39SAndroid Build Coastguard Worker  * @param rulesLength the length of the rules, or -1 if the rules
584*0e209d39SAndroid Build Coastguard Worker  * are zero-terminated.
585*0e209d39SAndroid Build Coastguard Worker  * @param parseError a pointer to a UParseError struct to receive the
586*0e209d39SAndroid Build Coastguard Worker  * details of any parsing errors. This parameter may be NULL if no
587*0e209d39SAndroid Build Coastguard Worker  * parsing error details are desired.
588*0e209d39SAndroid Build Coastguard Worker  * @param status a pointer to the UErrorCode
589*0e209d39SAndroid Build Coastguard Worker  * @return a transliterator pointer that may be passed to other
590*0e209d39SAndroid Build Coastguard Worker  * utrans_xxx() functions, or NULL if the open call fails.
591*0e209d39SAndroid Build Coastguard Worker  * @deprecated ICU 2.8 Use utrans_openU() instead, see utrans.h
592*0e209d39SAndroid Build Coastguard Worker  */
593*0e209d39SAndroid Build Coastguard Worker U_DEPRECATED UTransliterator* U_EXPORT2
594*0e209d39SAndroid Build Coastguard Worker utrans_open(const char* id,
595*0e209d39SAndroid Build Coastguard Worker             UTransDirection dir,
596*0e209d39SAndroid Build Coastguard Worker             const UChar* rules,         /* may be Null */
597*0e209d39SAndroid Build Coastguard Worker             int32_t rulesLength,        /* -1 if null-terminated */
598*0e209d39SAndroid Build Coastguard Worker             UParseError* parseError,    /* may be Null */
599*0e209d39SAndroid Build Coastguard Worker             UErrorCode* status);
600*0e209d39SAndroid Build Coastguard Worker 
601*0e209d39SAndroid Build Coastguard Worker /**
602*0e209d39SAndroid Build Coastguard Worker  * Deprecated, use utrans_getUnicodeID() instead.
603*0e209d39SAndroid Build Coastguard Worker  * Return the programmatic identifier for this transliterator.
604*0e209d39SAndroid Build Coastguard Worker  * If this identifier is passed to utrans_open(), it will open
605*0e209d39SAndroid Build Coastguard Worker  * a transliterator equivalent to this one, if the ID has been
606*0e209d39SAndroid Build Coastguard Worker  * registered.
607*0e209d39SAndroid Build Coastguard Worker  * @param trans the transliterator to return the ID of.
608*0e209d39SAndroid Build Coastguard Worker  * @param buf the buffer in which to receive the ID.  This may be
609*0e209d39SAndroid Build Coastguard Worker  * NULL, in which case no characters are copied.
610*0e209d39SAndroid Build Coastguard Worker  * @param bufCapacity the capacity of the buffer.  Ignored if buf is
611*0e209d39SAndroid Build Coastguard Worker  * NULL.
612*0e209d39SAndroid Build Coastguard Worker  * @return the actual length of the ID, not including
613*0e209d39SAndroid Build Coastguard Worker  * zero-termination.  This may be greater than bufCapacity.
614*0e209d39SAndroid Build Coastguard Worker  * @deprecated ICU 2.8 Use utrans_getUnicodeID() instead, see utrans.h
615*0e209d39SAndroid Build Coastguard Worker  */
616*0e209d39SAndroid Build Coastguard Worker U_DEPRECATED int32_t U_EXPORT2
617*0e209d39SAndroid Build Coastguard Worker utrans_getID(const UTransliterator* trans,
618*0e209d39SAndroid Build Coastguard Worker              char* buf,
619*0e209d39SAndroid Build Coastguard Worker              int32_t bufCapacity);
620*0e209d39SAndroid Build Coastguard Worker 
621*0e209d39SAndroid Build Coastguard Worker /**
622*0e209d39SAndroid Build Coastguard Worker  * Deprecated, use utrans_unregisterID() instead.
623*0e209d39SAndroid Build Coastguard Worker  * Unregister a transliterator from the system.  After this call the
624*0e209d39SAndroid Build Coastguard Worker  * system will no longer recognize the given ID when passed to
625*0e209d39SAndroid Build Coastguard Worker  * utrans_open().  If the id is invalid then nothing is done.
626*0e209d39SAndroid Build Coastguard Worker  *
627*0e209d39SAndroid Build Coastguard Worker  * @param id a zero-terminated ID
628*0e209d39SAndroid Build Coastguard Worker  * @deprecated ICU 2.8 Use utrans_unregisterID() instead, see utrans.h
629*0e209d39SAndroid Build Coastguard Worker  */
630*0e209d39SAndroid Build Coastguard Worker U_DEPRECATED void U_EXPORT2
631*0e209d39SAndroid Build Coastguard Worker utrans_unregister(const char* id);
632*0e209d39SAndroid Build Coastguard Worker 
633*0e209d39SAndroid Build Coastguard Worker /**
634*0e209d39SAndroid Build Coastguard Worker  * Deprecated, use utrans_openIDs() instead.
635*0e209d39SAndroid Build Coastguard Worker  * Return the ID of the index-th system transliterator.  The result
636*0e209d39SAndroid Build Coastguard Worker  * is placed in the given buffer.  If the given buffer is too small,
637*0e209d39SAndroid Build Coastguard Worker  * the initial substring is copied to buf.  The result in buf is
638*0e209d39SAndroid Build Coastguard Worker  * always zero-terminated.
639*0e209d39SAndroid Build Coastguard Worker  *
640*0e209d39SAndroid Build Coastguard Worker  * @param index the number of the transliterator to return.  Must
641*0e209d39SAndroid Build Coastguard Worker  * satisfy 0 <= index < utrans_countAvailableIDs().  If index is out
642*0e209d39SAndroid Build Coastguard Worker  * of range then it is treated as if it were 0.
643*0e209d39SAndroid Build Coastguard Worker  * @param buf the buffer in which to receive the ID.  This may be
644*0e209d39SAndroid Build Coastguard Worker  * NULL, in which case no characters are copied.
645*0e209d39SAndroid Build Coastguard Worker  * @param bufCapacity the capacity of the buffer.  Ignored if buf is
646*0e209d39SAndroid Build Coastguard Worker  * NULL.
647*0e209d39SAndroid Build Coastguard Worker  * @return the actual length of the index-th ID, not including
648*0e209d39SAndroid Build Coastguard Worker  * zero-termination.  This may be greater than bufCapacity.
649*0e209d39SAndroid Build Coastguard Worker  * @deprecated ICU 2.8 Use utrans_openIDs() instead, see utrans.h
650*0e209d39SAndroid Build Coastguard Worker  */
651*0e209d39SAndroid Build Coastguard Worker U_DEPRECATED int32_t U_EXPORT2
652*0e209d39SAndroid Build Coastguard Worker utrans_getAvailableID(int32_t index,
653*0e209d39SAndroid Build Coastguard Worker                       char* buf,
654*0e209d39SAndroid Build Coastguard Worker                       int32_t bufCapacity);
655*0e209d39SAndroid Build Coastguard Worker 
656*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_DEPRECATED_API */
657*0e209d39SAndroid Build Coastguard Worker 
658*0e209d39SAndroid Build Coastguard Worker #endif /* #if !UCONFIG_NO_TRANSLITERATION */
659*0e209d39SAndroid Build Coastguard Worker 
660*0e209d39SAndroid Build Coastguard Worker #endif
661