xref: /aosp_15_r20/external/icu/libicu/cts_headers/unicode/uchriter.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) 1998-2005, International Business Machines
6*0e209d39SAndroid Build Coastguard Worker *   Corporation and others.  All Rights Reserved.
7*0e209d39SAndroid Build Coastguard Worker **********************************************************************
8*0e209d39SAndroid Build Coastguard Worker */
9*0e209d39SAndroid Build Coastguard Worker 
10*0e209d39SAndroid Build Coastguard Worker #ifndef UCHRITER_H
11*0e209d39SAndroid Build Coastguard Worker #define UCHRITER_H
12*0e209d39SAndroid Build Coastguard Worker 
13*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
14*0e209d39SAndroid Build Coastguard Worker 
15*0e209d39SAndroid Build Coastguard Worker #if U_SHOW_CPLUSPLUS_API
16*0e209d39SAndroid Build Coastguard Worker 
17*0e209d39SAndroid Build Coastguard Worker #include "unicode/chariter.h"
18*0e209d39SAndroid Build Coastguard Worker 
19*0e209d39SAndroid Build Coastguard Worker /**
20*0e209d39SAndroid Build Coastguard Worker  * \file
21*0e209d39SAndroid Build Coastguard Worker  * \brief C++ API: char16_t Character Iterator
22*0e209d39SAndroid Build Coastguard Worker  */
23*0e209d39SAndroid Build Coastguard Worker 
24*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
25*0e209d39SAndroid Build Coastguard Worker 
26*0e209d39SAndroid Build Coastguard Worker /**
27*0e209d39SAndroid Build Coastguard Worker  * A concrete subclass of CharacterIterator that iterates over the
28*0e209d39SAndroid Build Coastguard Worker  * characters (code units or code points) in a char16_t array.
29*0e209d39SAndroid Build Coastguard Worker  * It's possible not only to create an
30*0e209d39SAndroid Build Coastguard Worker  * iterator that iterates over an entire char16_t array, but also to
31*0e209d39SAndroid Build Coastguard Worker  * create one that iterates over only a subrange of a char16_t array
32*0e209d39SAndroid Build Coastguard Worker  * (iterators over different subranges of the same char16_t array don't
33*0e209d39SAndroid Build Coastguard Worker  * compare equal).
34*0e209d39SAndroid Build Coastguard Worker  * @see CharacterIterator
35*0e209d39SAndroid Build Coastguard Worker  * @see ForwardCharacterIterator
36*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
37*0e209d39SAndroid Build Coastguard Worker  */
38*0e209d39SAndroid Build Coastguard Worker class U_COMMON_API UCharCharacterIterator : public CharacterIterator {
39*0e209d39SAndroid Build Coastguard Worker public:
40*0e209d39SAndroid Build Coastguard Worker   /**
41*0e209d39SAndroid Build Coastguard Worker    * Create an iterator over the char16_t array referred to by "textPtr".
42*0e209d39SAndroid Build Coastguard Worker    * The iteration range is 0 to <code>length-1</code>.
43*0e209d39SAndroid Build Coastguard Worker    * text is only aliased, not adopted (the
44*0e209d39SAndroid Build Coastguard Worker    * destructor will not delete it).
45*0e209d39SAndroid Build Coastguard Worker    * @param textPtr The char16_t array to be iterated over
46*0e209d39SAndroid Build Coastguard Worker    * @param length The length of the char16_t array
47*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
48*0e209d39SAndroid Build Coastguard Worker    */
49*0e209d39SAndroid Build Coastguard Worker   UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length);
50*0e209d39SAndroid Build Coastguard Worker 
51*0e209d39SAndroid Build Coastguard Worker   /**
52*0e209d39SAndroid Build Coastguard Worker    * Create an iterator over the char16_t array referred to by "textPtr".
53*0e209d39SAndroid Build Coastguard Worker    * The iteration range is 0 to <code>length-1</code>.
54*0e209d39SAndroid Build Coastguard Worker    * text is only aliased, not adopted (the
55*0e209d39SAndroid Build Coastguard Worker    * destructor will not delete it).
56*0e209d39SAndroid Build Coastguard Worker    * The starting
57*0e209d39SAndroid Build Coastguard Worker    * position is specified by "position". If "position" is outside the valid
58*0e209d39SAndroid Build Coastguard Worker    * iteration range, the behavior of this object is undefined.
59*0e209d39SAndroid Build Coastguard Worker    * @param textPtr The char16_t array to be iterated over
60*0e209d39SAndroid Build Coastguard Worker    * @param length The length of the char16_t array
61*0e209d39SAndroid Build Coastguard Worker    * @param position The starting position of the iteration
62*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
63*0e209d39SAndroid Build Coastguard Worker    */
64*0e209d39SAndroid Build Coastguard Worker   UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length,
65*0e209d39SAndroid Build Coastguard Worker                          int32_t position);
66*0e209d39SAndroid Build Coastguard Worker 
67*0e209d39SAndroid Build Coastguard Worker   /**
68*0e209d39SAndroid Build Coastguard Worker    * Create an iterator over the char16_t array referred to by "textPtr".
69*0e209d39SAndroid Build Coastguard Worker    * The iteration range is 0 to <code>end-1</code>.
70*0e209d39SAndroid Build Coastguard Worker    * text is only aliased, not adopted (the
71*0e209d39SAndroid Build Coastguard Worker    * destructor will not delete it).
72*0e209d39SAndroid Build Coastguard Worker    * The starting
73*0e209d39SAndroid Build Coastguard Worker    * position is specified by "position". If begin and end do not
74*0e209d39SAndroid Build Coastguard Worker    * form a valid iteration range or "position" is outside the valid
75*0e209d39SAndroid Build Coastguard Worker    * iteration range, the behavior of this object is undefined.
76*0e209d39SAndroid Build Coastguard Worker    * @param textPtr The char16_t array to be iterated over
77*0e209d39SAndroid Build Coastguard Worker    * @param length The length of the char16_t array
78*0e209d39SAndroid Build Coastguard Worker    * @param textBegin  The begin position of the iteration range
79*0e209d39SAndroid Build Coastguard Worker    * @param textEnd    The end position of the iteration range
80*0e209d39SAndroid Build Coastguard Worker    * @param position    The starting position of the iteration
81*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
82*0e209d39SAndroid Build Coastguard Worker    */
83*0e209d39SAndroid Build Coastguard Worker   UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length,
84*0e209d39SAndroid Build Coastguard Worker                          int32_t textBegin,
85*0e209d39SAndroid Build Coastguard Worker                          int32_t textEnd,
86*0e209d39SAndroid Build Coastguard Worker                          int32_t position);
87*0e209d39SAndroid Build Coastguard Worker 
88*0e209d39SAndroid Build Coastguard Worker   /**
89*0e209d39SAndroid Build Coastguard Worker    * Copy constructor.  The new iterator iterates over the same range
90*0e209d39SAndroid Build Coastguard Worker    * of the same string as "that", and its initial position is the
91*0e209d39SAndroid Build Coastguard Worker    * same as "that"'s current position.
92*0e209d39SAndroid Build Coastguard Worker    * @param that The UCharCharacterIterator to be copied
93*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
94*0e209d39SAndroid Build Coastguard Worker    */
95*0e209d39SAndroid Build Coastguard Worker   UCharCharacterIterator(const UCharCharacterIterator&  that);
96*0e209d39SAndroid Build Coastguard Worker 
97*0e209d39SAndroid Build Coastguard Worker   /**
98*0e209d39SAndroid Build Coastguard Worker    * Destructor.
99*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
100*0e209d39SAndroid Build Coastguard Worker    */
101*0e209d39SAndroid Build Coastguard Worker   virtual ~UCharCharacterIterator();
102*0e209d39SAndroid Build Coastguard Worker 
103*0e209d39SAndroid Build Coastguard Worker   /**
104*0e209d39SAndroid Build Coastguard Worker    * Assignment operator.  *this is altered to iterate over the sane
105*0e209d39SAndroid Build Coastguard Worker    * range of the same string as "that", and refers to the same
106*0e209d39SAndroid Build Coastguard Worker    * character within that string as "that" does.
107*0e209d39SAndroid Build Coastguard Worker    * @param that The object to be copied
108*0e209d39SAndroid Build Coastguard Worker    * @return the newly created object
109*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
110*0e209d39SAndroid Build Coastguard Worker    */
111*0e209d39SAndroid Build Coastguard Worker   UCharCharacterIterator&
112*0e209d39SAndroid Build Coastguard Worker   operator=(const UCharCharacterIterator&    that);
113*0e209d39SAndroid Build Coastguard Worker 
114*0e209d39SAndroid Build Coastguard Worker   /**
115*0e209d39SAndroid Build Coastguard Worker    * Returns true if the iterators iterate over the same range of the
116*0e209d39SAndroid Build Coastguard Worker    * same string and are pointing at the same character.
117*0e209d39SAndroid Build Coastguard Worker    * @param that The ForwardCharacterIterator used to be compared for equality
118*0e209d39SAndroid Build Coastguard Worker    * @return true if the iterators iterate over the same range of the
119*0e209d39SAndroid Build Coastguard Worker    * same string and are pointing at the same character.
120*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
121*0e209d39SAndroid Build Coastguard Worker    */
122*0e209d39SAndroid Build Coastguard Worker   virtual bool           operator==(const ForwardCharacterIterator& that) const override;
123*0e209d39SAndroid Build Coastguard Worker 
124*0e209d39SAndroid Build Coastguard Worker   /**
125*0e209d39SAndroid Build Coastguard Worker    * Generates a hash code for this iterator.
126*0e209d39SAndroid Build Coastguard Worker    * @return the hash code.
127*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
128*0e209d39SAndroid Build Coastguard Worker    */
129*0e209d39SAndroid Build Coastguard Worker   virtual int32_t hashCode() const override;
130*0e209d39SAndroid Build Coastguard Worker 
131*0e209d39SAndroid Build Coastguard Worker   /**
132*0e209d39SAndroid Build Coastguard Worker    * Returns a new UCharCharacterIterator referring to the same
133*0e209d39SAndroid Build Coastguard Worker    * character in the same range of the same string as this one.  The
134*0e209d39SAndroid Build Coastguard Worker    * caller must delete the new iterator.
135*0e209d39SAndroid Build Coastguard Worker    * @return the CharacterIterator newly created
136*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
137*0e209d39SAndroid Build Coastguard Worker    */
138*0e209d39SAndroid Build Coastguard Worker   virtual UCharCharacterIterator* clone() const override;
139*0e209d39SAndroid Build Coastguard Worker 
140*0e209d39SAndroid Build Coastguard Worker   /**
141*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the first code unit in its
142*0e209d39SAndroid Build Coastguard Worker    * iteration range, and returns that code unit.
143*0e209d39SAndroid Build Coastguard Worker    * This can be used to begin an iteration with next().
144*0e209d39SAndroid Build Coastguard Worker    * @return the first code unit in its iteration range.
145*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
146*0e209d39SAndroid Build Coastguard Worker    */
147*0e209d39SAndroid Build Coastguard Worker   virtual char16_t first() override;
148*0e209d39SAndroid Build Coastguard Worker 
149*0e209d39SAndroid Build Coastguard Worker   /**
150*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the first code unit in its
151*0e209d39SAndroid Build Coastguard Worker    * iteration range, returns that code unit, and moves the position
152*0e209d39SAndroid Build Coastguard Worker    * to the second code unit. This is an alternative to setToStart()
153*0e209d39SAndroid Build Coastguard Worker    * for forward iteration with nextPostInc().
154*0e209d39SAndroid Build Coastguard Worker    * @return the first code unit in its iteration range
155*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
156*0e209d39SAndroid Build Coastguard Worker    */
157*0e209d39SAndroid Build Coastguard Worker   virtual char16_t firstPostInc() override;
158*0e209d39SAndroid Build Coastguard Worker 
159*0e209d39SAndroid Build Coastguard Worker   /**
160*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the first code point in its
161*0e209d39SAndroid Build Coastguard Worker    * iteration range, and returns that code unit,
162*0e209d39SAndroid Build Coastguard Worker    * This can be used to begin an iteration with next32().
163*0e209d39SAndroid Build Coastguard Worker    * Note that an iteration with next32PostInc(), beginning with,
164*0e209d39SAndroid Build Coastguard Worker    * e.g., setToStart() or firstPostInc(), is more efficient.
165*0e209d39SAndroid Build Coastguard Worker    * @return the first code point in its iteration range
166*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
167*0e209d39SAndroid Build Coastguard Worker    */
168*0e209d39SAndroid Build Coastguard Worker   virtual UChar32 first32() override;
169*0e209d39SAndroid Build Coastguard Worker 
170*0e209d39SAndroid Build Coastguard Worker   /**
171*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the first code point in its
172*0e209d39SAndroid Build Coastguard Worker    * iteration range, returns that code point, and moves the position
173*0e209d39SAndroid Build Coastguard Worker    * to the second code point. This is an alternative to setToStart()
174*0e209d39SAndroid Build Coastguard Worker    * for forward iteration with next32PostInc().
175*0e209d39SAndroid Build Coastguard Worker    * @return the first code point in its iteration range.
176*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
177*0e209d39SAndroid Build Coastguard Worker    */
178*0e209d39SAndroid Build Coastguard Worker   virtual UChar32 first32PostInc() override;
179*0e209d39SAndroid Build Coastguard Worker 
180*0e209d39SAndroid Build Coastguard Worker   /**
181*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the last code unit in its
182*0e209d39SAndroid Build Coastguard Worker    * iteration range, and returns that code unit.
183*0e209d39SAndroid Build Coastguard Worker    * This can be used to begin an iteration with previous().
184*0e209d39SAndroid Build Coastguard Worker    * @return the last code unit in its iteration range.
185*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
186*0e209d39SAndroid Build Coastguard Worker    */
187*0e209d39SAndroid Build Coastguard Worker   virtual char16_t last() override;
188*0e209d39SAndroid Build Coastguard Worker 
189*0e209d39SAndroid Build Coastguard Worker   /**
190*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the last code point in its
191*0e209d39SAndroid Build Coastguard Worker    * iteration range, and returns that code unit.
192*0e209d39SAndroid Build Coastguard Worker    * This can be used to begin an iteration with previous32().
193*0e209d39SAndroid Build Coastguard Worker    * @return the last code point in its iteration range.
194*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
195*0e209d39SAndroid Build Coastguard Worker    */
196*0e209d39SAndroid Build Coastguard Worker   virtual UChar32 last32() override;
197*0e209d39SAndroid Build Coastguard Worker 
198*0e209d39SAndroid Build Coastguard Worker   /**
199*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the "position"-th code unit
200*0e209d39SAndroid Build Coastguard Worker    * in the text-storage object the iterator refers to, and
201*0e209d39SAndroid Build Coastguard Worker    * returns that code unit.
202*0e209d39SAndroid Build Coastguard Worker    * @param position the position within the text-storage object
203*0e209d39SAndroid Build Coastguard Worker    * @return the code unit
204*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
205*0e209d39SAndroid Build Coastguard Worker    */
206*0e209d39SAndroid Build Coastguard Worker   virtual char16_t         setIndex(int32_t position) override;
207*0e209d39SAndroid Build Coastguard Worker 
208*0e209d39SAndroid Build Coastguard Worker   /**
209*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to refer to the beginning of the code point
210*0e209d39SAndroid Build Coastguard Worker    * that contains the "position"-th code unit
211*0e209d39SAndroid Build Coastguard Worker    * in the text-storage object the iterator refers to, and
212*0e209d39SAndroid Build Coastguard Worker    * returns that code point.
213*0e209d39SAndroid Build Coastguard Worker    * The current position is adjusted to the beginning of the code point
214*0e209d39SAndroid Build Coastguard Worker    * (its first code unit).
215*0e209d39SAndroid Build Coastguard Worker    * @param position the position within the text-storage object
216*0e209d39SAndroid Build Coastguard Worker    * @return the code unit
217*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
218*0e209d39SAndroid Build Coastguard Worker    */
219*0e209d39SAndroid Build Coastguard Worker   virtual UChar32       setIndex32(int32_t position) override;
220*0e209d39SAndroid Build Coastguard Worker 
221*0e209d39SAndroid Build Coastguard Worker   /**
222*0e209d39SAndroid Build Coastguard Worker    * Returns the code unit the iterator currently refers to.
223*0e209d39SAndroid Build Coastguard Worker    * @return the code unit the iterator currently refers to.
224*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
225*0e209d39SAndroid Build Coastguard Worker    */
226*0e209d39SAndroid Build Coastguard Worker   virtual char16_t current() const override;
227*0e209d39SAndroid Build Coastguard Worker 
228*0e209d39SAndroid Build Coastguard Worker   /**
229*0e209d39SAndroid Build Coastguard Worker    * Returns the code point the iterator currently refers to.
230*0e209d39SAndroid Build Coastguard Worker    * @return the code point the iterator currently refers to.
231*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
232*0e209d39SAndroid Build Coastguard Worker    */
233*0e209d39SAndroid Build Coastguard Worker   virtual UChar32 current32() const override;
234*0e209d39SAndroid Build Coastguard Worker 
235*0e209d39SAndroid Build Coastguard Worker   /**
236*0e209d39SAndroid Build Coastguard Worker    * Advances to the next code unit in the iteration range (toward
237*0e209d39SAndroid Build Coastguard Worker    * endIndex()), and returns that code unit.  If there are no more
238*0e209d39SAndroid Build Coastguard Worker    * code units to return, returns DONE.
239*0e209d39SAndroid Build Coastguard Worker    * @return the next code unit in the iteration range.
240*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
241*0e209d39SAndroid Build Coastguard Worker    */
242*0e209d39SAndroid Build Coastguard Worker   virtual char16_t next() override;
243*0e209d39SAndroid Build Coastguard Worker 
244*0e209d39SAndroid Build Coastguard Worker   /**
245*0e209d39SAndroid Build Coastguard Worker    * Gets the current code unit for returning and advances to the next code unit
246*0e209d39SAndroid Build Coastguard Worker    * in the iteration range
247*0e209d39SAndroid Build Coastguard Worker    * (toward endIndex()).  If there are
248*0e209d39SAndroid Build Coastguard Worker    * no more code units to return, returns DONE.
249*0e209d39SAndroid Build Coastguard Worker    * @return the current code unit.
250*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
251*0e209d39SAndroid Build Coastguard Worker    */
252*0e209d39SAndroid Build Coastguard Worker   virtual char16_t nextPostInc() override;
253*0e209d39SAndroid Build Coastguard Worker 
254*0e209d39SAndroid Build Coastguard Worker   /**
255*0e209d39SAndroid Build Coastguard Worker    * Advances to the next code point in the iteration range (toward
256*0e209d39SAndroid Build Coastguard Worker    * endIndex()), and returns that code point.  If there are no more
257*0e209d39SAndroid Build Coastguard Worker    * code points to return, returns DONE.
258*0e209d39SAndroid Build Coastguard Worker    * Note that iteration with "pre-increment" semantics is less
259*0e209d39SAndroid Build Coastguard Worker    * efficient than iteration with "post-increment" semantics
260*0e209d39SAndroid Build Coastguard Worker    * that is provided by next32PostInc().
261*0e209d39SAndroid Build Coastguard Worker    * @return the next code point in the iteration range.
262*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
263*0e209d39SAndroid Build Coastguard Worker    */
264*0e209d39SAndroid Build Coastguard Worker   virtual UChar32 next32() override;
265*0e209d39SAndroid Build Coastguard Worker 
266*0e209d39SAndroid Build Coastguard Worker   /**
267*0e209d39SAndroid Build Coastguard Worker    * Gets the current code point for returning and advances to the next code point
268*0e209d39SAndroid Build Coastguard Worker    * in the iteration range
269*0e209d39SAndroid Build Coastguard Worker    * (toward endIndex()).  If there are
270*0e209d39SAndroid Build Coastguard Worker    * no more code points to return, returns DONE.
271*0e209d39SAndroid Build Coastguard Worker    * @return the current point.
272*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
273*0e209d39SAndroid Build Coastguard Worker    */
274*0e209d39SAndroid Build Coastguard Worker   virtual UChar32 next32PostInc() override;
275*0e209d39SAndroid Build Coastguard Worker 
276*0e209d39SAndroid Build Coastguard Worker   /**
277*0e209d39SAndroid Build Coastguard Worker    * Returns false if there are no more code units or code points
278*0e209d39SAndroid Build Coastguard Worker    * at or after the current position in the iteration range.
279*0e209d39SAndroid Build Coastguard Worker    * This is used with nextPostInc() or next32PostInc() in forward
280*0e209d39SAndroid Build Coastguard Worker    * iteration.
281*0e209d39SAndroid Build Coastguard Worker    * @return false if there are no more code units or code points
282*0e209d39SAndroid Build Coastguard Worker    * at or after the current position in the iteration range.
283*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
284*0e209d39SAndroid Build Coastguard Worker    */
285*0e209d39SAndroid Build Coastguard Worker   virtual UBool        hasNext() override;
286*0e209d39SAndroid Build Coastguard Worker 
287*0e209d39SAndroid Build Coastguard Worker   /**
288*0e209d39SAndroid Build Coastguard Worker    * Advances to the previous code unit in the iteration range (toward
289*0e209d39SAndroid Build Coastguard Worker    * startIndex()), and returns that code unit.  If there are no more
290*0e209d39SAndroid Build Coastguard Worker    * code units to return, returns DONE.
291*0e209d39SAndroid Build Coastguard Worker    * @return the previous code unit in the iteration range.
292*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
293*0e209d39SAndroid Build Coastguard Worker    */
294*0e209d39SAndroid Build Coastguard Worker   virtual char16_t previous() override;
295*0e209d39SAndroid Build Coastguard Worker 
296*0e209d39SAndroid Build Coastguard Worker   /**
297*0e209d39SAndroid Build Coastguard Worker    * Advances to the previous code point in the iteration range (toward
298*0e209d39SAndroid Build Coastguard Worker    * startIndex()), and returns that code point.  If there are no more
299*0e209d39SAndroid Build Coastguard Worker    * code points to return, returns DONE.
300*0e209d39SAndroid Build Coastguard Worker    * @return the previous code point in the iteration range.
301*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
302*0e209d39SAndroid Build Coastguard Worker    */
303*0e209d39SAndroid Build Coastguard Worker   virtual UChar32 previous32() override;
304*0e209d39SAndroid Build Coastguard Worker 
305*0e209d39SAndroid Build Coastguard Worker   /**
306*0e209d39SAndroid Build Coastguard Worker    * Returns false if there are no more code units or code points
307*0e209d39SAndroid Build Coastguard Worker    * before the current position in the iteration range.
308*0e209d39SAndroid Build Coastguard Worker    * This is used with previous() or previous32() in backward
309*0e209d39SAndroid Build Coastguard Worker    * iteration.
310*0e209d39SAndroid Build Coastguard Worker    * @return false if there are no more code units or code points
311*0e209d39SAndroid Build Coastguard Worker    * before the current position in the iteration range.
312*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
313*0e209d39SAndroid Build Coastguard Worker    */
314*0e209d39SAndroid Build Coastguard Worker   virtual UBool        hasPrevious() override;
315*0e209d39SAndroid Build Coastguard Worker 
316*0e209d39SAndroid Build Coastguard Worker   /**
317*0e209d39SAndroid Build Coastguard Worker    * Moves the current position relative to the start or end of the
318*0e209d39SAndroid Build Coastguard Worker    * iteration range, or relative to the current position itself.
319*0e209d39SAndroid Build Coastguard Worker    * The movement is expressed in numbers of code units forward
320*0e209d39SAndroid Build Coastguard Worker    * or backward by specifying a positive or negative delta.
321*0e209d39SAndroid Build Coastguard Worker    * @param delta the position relative to origin. A positive delta means forward;
322*0e209d39SAndroid Build Coastguard Worker    * a negative delta means backward.
323*0e209d39SAndroid Build Coastguard Worker    * @param origin Origin enumeration {kStart, kCurrent, kEnd}
324*0e209d39SAndroid Build Coastguard Worker    * @return the new position
325*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
326*0e209d39SAndroid Build Coastguard Worker    */
327*0e209d39SAndroid Build Coastguard Worker   virtual int32_t      move(int32_t delta, EOrigin origin) override;
328*0e209d39SAndroid Build Coastguard Worker 
329*0e209d39SAndroid Build Coastguard Worker   /**
330*0e209d39SAndroid Build Coastguard Worker    * Moves the current position relative to the start or end of the
331*0e209d39SAndroid Build Coastguard Worker    * iteration range, or relative to the current position itself.
332*0e209d39SAndroid Build Coastguard Worker    * The movement is expressed in numbers of code points forward
333*0e209d39SAndroid Build Coastguard Worker    * or backward by specifying a positive or negative delta.
334*0e209d39SAndroid Build Coastguard Worker    * @param delta the position relative to origin. A positive delta means forward;
335*0e209d39SAndroid Build Coastguard Worker    * a negative delta means backward.
336*0e209d39SAndroid Build Coastguard Worker    * @param origin Origin enumeration {kStart, kCurrent, kEnd}
337*0e209d39SAndroid Build Coastguard Worker    * @return the new position
338*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
339*0e209d39SAndroid Build Coastguard Worker    */
340*0e209d39SAndroid Build Coastguard Worker #ifdef move32
341*0e209d39SAndroid Build Coastguard Worker    // One of the system headers right now is sometimes defining a conflicting macro we don't use
342*0e209d39SAndroid Build Coastguard Worker #undef move32
343*0e209d39SAndroid Build Coastguard Worker #endif
344*0e209d39SAndroid Build Coastguard Worker   virtual int32_t      move32(int32_t delta, EOrigin origin) override;
345*0e209d39SAndroid Build Coastguard Worker 
346*0e209d39SAndroid Build Coastguard Worker   /**
347*0e209d39SAndroid Build Coastguard Worker    * Sets the iterator to iterate over a new range of text
348*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
349*0e209d39SAndroid Build Coastguard Worker    */
350*0e209d39SAndroid Build Coastguard Worker   void setText(ConstChar16Ptr newText, int32_t newTextLength);
351*0e209d39SAndroid Build Coastguard Worker 
352*0e209d39SAndroid Build Coastguard Worker   /**
353*0e209d39SAndroid Build Coastguard Worker    * Copies the char16_t array under iteration into the UnicodeString
354*0e209d39SAndroid Build Coastguard Worker    * referred to by "result".  Even if this iterator iterates across
355*0e209d39SAndroid Build Coastguard Worker    * only a part of this string, the whole string is copied.
356*0e209d39SAndroid Build Coastguard Worker    * @param result Receives a copy of the text under iteration.
357*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
358*0e209d39SAndroid Build Coastguard Worker    */
359*0e209d39SAndroid Build Coastguard Worker   virtual void            getText(UnicodeString& result) override;
360*0e209d39SAndroid Build Coastguard Worker 
361*0e209d39SAndroid Build Coastguard Worker   /**
362*0e209d39SAndroid Build Coastguard Worker    * Return a class ID for this class (not really public)
363*0e209d39SAndroid Build Coastguard Worker    * @return a class ID for this class
364*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
365*0e209d39SAndroid Build Coastguard Worker    */
366*0e209d39SAndroid Build Coastguard Worker   static UClassID U_EXPORT2 getStaticClassID();
367*0e209d39SAndroid Build Coastguard Worker 
368*0e209d39SAndroid Build Coastguard Worker   /**
369*0e209d39SAndroid Build Coastguard Worker    * Return a class ID for this object (not really public)
370*0e209d39SAndroid Build Coastguard Worker    * @return a class ID for this object.
371*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
372*0e209d39SAndroid Build Coastguard Worker    */
373*0e209d39SAndroid Build Coastguard Worker   virtual UClassID getDynamicClassID() const override;
374*0e209d39SAndroid Build Coastguard Worker 
375*0e209d39SAndroid Build Coastguard Worker protected:
376*0e209d39SAndroid Build Coastguard Worker   /**
377*0e209d39SAndroid Build Coastguard Worker    * Protected constructor
378*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
379*0e209d39SAndroid Build Coastguard Worker    */
380*0e209d39SAndroid Build Coastguard Worker   UCharCharacterIterator();
381*0e209d39SAndroid Build Coastguard Worker   /**
382*0e209d39SAndroid Build Coastguard Worker    * Protected member text
383*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.0
384*0e209d39SAndroid Build Coastguard Worker    */
385*0e209d39SAndroid Build Coastguard Worker   const char16_t*            text;
386*0e209d39SAndroid Build Coastguard Worker 
387*0e209d39SAndroid Build Coastguard Worker };
388*0e209d39SAndroid Build Coastguard Worker 
389*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
390*0e209d39SAndroid Build Coastguard Worker 
391*0e209d39SAndroid Build Coastguard Worker #endif /* U_SHOW_CPLUSPLUS_API */
392*0e209d39SAndroid Build Coastguard Worker 
393*0e209d39SAndroid Build Coastguard Worker #endif
394