Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/unicode/chariter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 ********************************************************************
0005 *
0006 *   Copyright (C) 1997-2011, International Business Machines
0007 *   Corporation and others.  All Rights Reserved.
0008 *
0009 ********************************************************************
0010 */
0011 
0012 #ifndef CHARITER_H
0013 #define CHARITER_H
0014 
0015 #include "unicode/utypes.h"
0016 
0017 #if U_SHOW_CPLUSPLUS_API
0018 
0019 #include "unicode/uobject.h"
0020 #include "unicode/unistr.h"
0021 /**
0022  * \file
0023  * \brief C++ API: Character Iterator
0024  */
0025  
0026 U_NAMESPACE_BEGIN
0027 /**
0028  * Abstract class that defines an API for forward-only iteration
0029  * on text objects.
0030  * This is a minimal interface for iteration without random access
0031  * or backwards iteration. It is especially useful for wrapping
0032  * streams with converters into an object for collation or
0033  * normalization.
0034  *
0035  * <p>Characters can be accessed in two ways: as code units or as
0036  * code points.
0037  * Unicode code points are 21-bit integers and are the scalar values
0038  * of Unicode characters. ICU uses the type UChar32 for them.
0039  * Unicode code units are the storage units of a given
0040  * Unicode/UCS Transformation Format (a character encoding scheme).
0041  * With UTF-16, all code points can be represented with either one
0042  * or two code units ("surrogates").
0043  * String storage is typically based on code units, while properties
0044  * of characters are typically determined using code point values.
0045  * Some processes may be designed to work with sequences of code units,
0046  * or it may be known that all characters that are important to an
0047  * algorithm can be represented with single code units.
0048  * Other processes will need to use the code point access functions.</p>
0049  *
0050  * <p>ForwardCharacterIterator provides nextPostInc() to access
0051  * a code unit and advance an internal position into the text object,
0052  * similar to a <code>return text[position++]</code>.<br>
0053  * It provides next32PostInc() to access a code point and advance an internal
0054  * position.</p>
0055  *
0056  * <p>next32PostInc() assumes that the current position is that of
0057  * the beginning of a code point, i.e., of its first code unit.
0058  * After next32PostInc(), this will be true again.
0059  * In general, access to code units and code points in the same
0060  * iteration loop should not be mixed. In UTF-16, if the current position
0061  * is on a second code unit (Low Surrogate), then only that code unit
0062  * is returned even by next32PostInc().</p>
0063  *
0064  * <p>For iteration with either function, there are two ways to
0065  * check for the end of the iteration. When there are no more
0066  * characters in the text object:
0067  * <ul>
0068  * <li>The hasNext() function returns false.</li>
0069  * <li>nextPostInc() and next32PostInc() return DONE
0070  *     when one attempts to read beyond the end of the text object.</li>
0071  * </ul>
0072  *
0073  * Example:
0074  * \code 
0075  * void function1(ForwardCharacterIterator &it) {
0076  *     UChar32 c;
0077  *     while(it.hasNext()) {
0078  *         c=it.next32PostInc();
0079  *         // use c
0080  *     }
0081  * }
0082  *
0083  * void function1(ForwardCharacterIterator &it) {
0084  *     char16_t c;
0085  *     while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) {
0086  *         // use c
0087  *      }
0088  *  }
0089  * \endcode
0090  * </p>
0091  *
0092  * @stable ICU 2.0
0093  */
0094 class U_COMMON_API ForwardCharacterIterator : public UObject {
0095 public:
0096     /**
0097      * Value returned by most of ForwardCharacterIterator's functions
0098      * when the iterator has reached the limits of its iteration.
0099      * @stable ICU 2.0
0100      */
0101     enum { DONE = 0xffff };
0102     
0103     /**
0104      * Destructor.  
0105      * @stable ICU 2.0
0106      */
0107     virtual ~ForwardCharacterIterator();
0108     
0109     /**
0110      * Returns true when both iterators refer to the same
0111      * character in the same character-storage object.  
0112      * @param that The ForwardCharacterIterator to be compared for equality
0113      * @return true when both iterators refer to the same
0114      * character in the same character-storage object
0115      * @stable ICU 2.0
0116      */
0117     virtual bool operator==(const ForwardCharacterIterator& that) const = 0;
0118     
0119     /**
0120      * Returns true when the iterators refer to different
0121      * text-storage objects, or to different characters in the
0122      * same text-storage object.  
0123      * @param that The ForwardCharacterIterator to be compared for inequality
0124      * @return true when the iterators refer to different
0125      * text-storage objects, or to different characters in the
0126      * same text-storage object
0127      * @stable ICU 2.0
0128      */
0129     inline bool operator!=(const ForwardCharacterIterator& that) const;
0130     
0131     /**
0132      * Generates a hash code for this iterator.  
0133      * @return the hash code.
0134      * @stable ICU 2.0
0135      */
0136     virtual int32_t hashCode(void) const = 0;
0137     
0138     /**
0139      * Returns a UClassID for this ForwardCharacterIterator ("poor man's
0140      * RTTI").<P> Despite the fact that this function is public,
0141      * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API! 
0142      * @return a UClassID for this ForwardCharacterIterator 
0143      * @stable ICU 2.0
0144      */
0145     virtual UClassID getDynamicClassID(void) const override = 0;
0146     
0147     /**
0148      * Gets the current code unit for returning and advances to the next code unit
0149      * in the iteration range
0150      * (toward endIndex()).  If there are
0151      * no more code units to return, returns DONE.
0152      * @return the current code unit.
0153      * @stable ICU 2.0
0154      */
0155     virtual char16_t         nextPostInc(void) = 0;
0156     
0157     /**
0158      * Gets the current code point for returning and advances to the next code point
0159      * in the iteration range
0160      * (toward endIndex()).  If there are
0161      * no more code points to return, returns DONE.
0162      * @return the current code point.
0163      * @stable ICU 2.0
0164      */
0165     virtual UChar32       next32PostInc(void) = 0;
0166     
0167     /**
0168      * Returns false if there are no more code units or code points
0169      * at or after the current position in the iteration range.
0170      * This is used with nextPostInc() or next32PostInc() in forward
0171      * iteration.
0172      * @returns false if there are no more code units or code points
0173      * at or after the current position in the iteration range.
0174      * @stable ICU 2.0
0175      */
0176     virtual UBool        hasNext() = 0;
0177     
0178 protected:
0179     /** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/
0180     ForwardCharacterIterator();
0181     
0182     /** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/
0183     ForwardCharacterIterator(const ForwardCharacterIterator &other);
0184     
0185     /**
0186      * Assignment operator to be overridden in the implementing class.
0187      * @stable ICU 2.0
0188      */
0189     ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; }
0190 };
0191 
0192 /**
0193  * Abstract class that defines an API for iteration
0194  * on text objects.
0195  * This is an interface for forward and backward iteration
0196  * and random access into a text object.
0197  *
0198  * <p>The API provides backward compatibility to the Java and older ICU
0199  * CharacterIterator classes but extends them significantly:
0200  * <ol>
0201  * <li>CharacterIterator is now a subclass of ForwardCharacterIterator.</li>
0202  * <li>While the old API functions provided forward iteration with
0203  *     "pre-increment" semantics, the new one also provides functions
0204  *     with "post-increment" semantics. They are more efficient and should
0205  *     be the preferred iterator functions for new implementations.
0206  *     The backward iteration always had "pre-decrement" semantics, which
0207  *     are efficient.</li>
0208  * <li>Just like ForwardCharacterIterator, it provides access to
0209  *     both code units and code points. Code point access versions are available
0210  *     for the old and the new iteration semantics.</li>
0211  * <li>There are new functions for setting and moving the current position
0212  *     without returning a character, for efficiency.</li>
0213  * </ol>
0214  *
0215  * See ForwardCharacterIterator for examples for using the new forward iteration
0216  * functions. For backward iteration, there is also a hasPrevious() function
0217  * that can be used analogously to hasNext().
0218  * The old functions work as before and are shown below.</p>
0219  *
0220  * <p>Examples for some of the new functions:</p>
0221  *
0222  * Forward iteration with hasNext():
0223  * \code
0224  * void forward1(CharacterIterator &it) {
0225  *     UChar32 c;
0226  *     for(it.setToStart(); it.hasNext();) {
0227  *         c=it.next32PostInc();
0228  *         // use c
0229  *     }
0230  *  }
0231  * \endcode
0232  * Forward iteration more similar to loops with the old forward iteration,
0233  * showing a way to convert simple for() loops:
0234  * \code
0235  * void forward2(CharacterIterator &it) {
0236  *     char16_t c;
0237  *     for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) {
0238  *          // use c
0239  *      }
0240  * }
0241  * \endcode
0242  * Backward iteration with setToEnd() and hasPrevious():
0243  * \code
0244  *  void backward1(CharacterIterator &it) {
0245  *      UChar32 c;
0246  *      for(it.setToEnd(); it.hasPrevious();) {
0247  *         c=it.previous32();
0248  *          // use c
0249  *      }
0250  *  }
0251  * \endcode
0252  * Backward iteration with a more traditional for() loop:
0253  * \code
0254  * void backward2(CharacterIterator &it) {
0255  *     char16_t c;
0256  *     for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) {
0257  *         // use c
0258  *      }
0259  *  }
0260  * \endcode
0261  *
0262  * Example for random access:
0263  * \code
0264  *  void random(CharacterIterator &it) {
0265  *      // set to the third code point from the beginning
0266  *      it.move32(3, CharacterIterator::kStart);
0267  *      // get a code point from here without moving the position
0268  *      UChar32 c=it.current32();
0269  *      // get the position
0270  *      int32_t pos=it.getIndex();
0271  *      // get the previous code unit
0272  *      char16_t u=it.previous();
0273  *      // move back one more code unit
0274  *      it.move(-1, CharacterIterator::kCurrent);
0275  *      // set the position back to where it was
0276  *      // and read the same code point c and move beyond it
0277  *      it.setIndex(pos);
0278  *      if(c!=it.next32PostInc()) {
0279  *          exit(1); // CharacterIterator inconsistent
0280  *      }
0281  *  }
0282  * \endcode
0283  *
0284  * <p>Examples, especially for the old API:</p>
0285  *
0286  * Function processing characters, in this example simple output
0287  * <pre>
0288  * \code
0289  *  void processChar( char16_t c )
0290  *  {
0291  *      cout << " " << c;
0292  *  }
0293  * \endcode
0294  * </pre>
0295  * Traverse the text from start to finish
0296  * <pre> 
0297  * \code
0298  *  void traverseForward(CharacterIterator& iter)
0299  *  {
0300  *      for(char16_t c = iter.first(); c != CharacterIterator::DONE; c = iter.next()) {
0301  *          processChar(c);
0302  *      }
0303  *  }
0304  * \endcode
0305  * </pre>
0306  * Traverse the text backwards, from end to start
0307  * <pre>
0308  * \code
0309  *  void traverseBackward(CharacterIterator& iter)
0310  *  {
0311  *      for(char16_t c = iter.last(); c != CharacterIterator::DONE; c = iter.previous()) {
0312  *          processChar(c);
0313  *      }
0314  *  }
0315  * \endcode
0316  * </pre>
0317  * Traverse both forward and backward from a given position in the text. 
0318  * Calls to notBoundary() in this example represents some additional stopping criteria.
0319  * <pre>
0320  * \code
0321  * void traverseOut(CharacterIterator& iter, int32_t pos)
0322  * {
0323  *      char16_t c;
0324  *      for (c = iter.setIndex(pos);
0325  *      c != CharacterIterator::DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
0326  *          c = iter.next()) {}
0327  *      int32_t end = iter.getIndex();
0328  *      for (c = iter.setIndex(pos);
0329  *          c != CharacterIterator::DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
0330  *          c = iter.previous()) {}
0331  *      int32_t start = iter.getIndex() + 1;
0332  *  
0333  *      cout << "start: " << start << " end: " << end << endl;
0334  *      for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) {
0335  *          processChar(c);
0336  *     }
0337  *  }
0338  * \endcode
0339  * </pre>
0340  * Creating a StringCharacterIterator and calling the test functions
0341  * <pre>
0342  * \code
0343  *  void CharacterIterator_Example( void )
0344  *   {
0345  *       cout << endl << "===== CharacterIterator_Example: =====" << endl;
0346  *       UnicodeString text("Ein kleiner Satz.");
0347  *       StringCharacterIterator iterator(text);
0348  *       cout << "----- traverseForward: -----------" << endl;
0349  *       traverseForward( iterator );
0350  *       cout << endl << endl << "----- traverseBackward: ----------" << endl;
0351  *       traverseBackward( iterator );
0352  *       cout << endl << endl << "----- traverseOut: ---------------" << endl;
0353  *       traverseOut( iterator, 7 );
0354  *       cout << endl << endl << "-----" << endl;
0355  *   }
0356  * \endcode
0357  * </pre>
0358  *
0359  * @stable ICU 2.0
0360  */
0361 class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
0362 public:
0363     /**
0364      * Origin enumeration for the move() and move32() functions.
0365      * @stable ICU 2.0
0366      */
0367     enum EOrigin { kStart, kCurrent, kEnd };
0368 
0369     /**
0370      * Destructor.
0371      * @stable ICU 2.0
0372      */
0373     virtual ~CharacterIterator();
0374 
0375     /**
0376      * Returns a pointer to a new CharacterIterator of the same
0377      * concrete class as this one, and referring to the same
0378      * character in the same text-storage object as this one.  The
0379      * caller is responsible for deleting the new clone.  
0380      * @return a pointer to a new CharacterIterator
0381      * @stable ICU 2.0
0382      */
0383     virtual CharacterIterator* clone() const = 0;
0384 
0385     /**
0386      * Sets the iterator to refer to the first code unit in its
0387      * iteration range, and returns that code unit.
0388      * This can be used to begin an iteration with next().
0389      * @return the first code unit in its iteration range.
0390      * @stable ICU 2.0
0391      */
0392     virtual char16_t         first(void) = 0;
0393 
0394     /**
0395      * Sets the iterator to refer to the first code unit in its
0396      * iteration range, returns that code unit, and moves the position
0397      * to the second code unit. This is an alternative to setToStart()
0398      * for forward iteration with nextPostInc().
0399      * @return the first code unit in its iteration range.
0400      * @stable ICU 2.0
0401      */
0402     virtual char16_t         firstPostInc(void);
0403 
0404     /**
0405      * Sets the iterator to refer to the first code point in its
0406      * iteration range, and returns that code unit,
0407      * This can be used to begin an iteration with next32().
0408      * Note that an iteration with next32PostInc(), beginning with,
0409      * e.g., setToStart() or firstPostInc(), is more efficient.
0410      * @return the first code point in its iteration range.
0411      * @stable ICU 2.0
0412      */
0413     virtual UChar32       first32(void) = 0;
0414 
0415     /**
0416      * Sets the iterator to refer to the first code point in its
0417      * iteration range, returns that code point, and moves the position
0418      * to the second code point. This is an alternative to setToStart()
0419      * for forward iteration with next32PostInc().
0420      * @return the first code point in its iteration range.
0421      * @stable ICU 2.0
0422      */
0423     virtual UChar32       first32PostInc(void);
0424 
0425     /**
0426      * Sets the iterator to refer to the first code unit or code point in its
0427      * iteration range. This can be used to begin a forward
0428      * iteration with nextPostInc() or next32PostInc().
0429      * @return the start position of the iteration range
0430      * @stable ICU 2.0
0431      */
0432     inline int32_t    setToStart();
0433 
0434     /**
0435      * Sets the iterator to refer to the last code unit in its
0436      * iteration range, and returns that code unit.
0437      * This can be used to begin an iteration with previous().
0438      * @return the last code unit.
0439      * @stable ICU 2.0
0440      */
0441     virtual char16_t         last(void) = 0;
0442         
0443     /**
0444      * Sets the iterator to refer to the last code point in its
0445      * iteration range, and returns that code unit.
0446      * This can be used to begin an iteration with previous32().
0447      * @return the last code point.
0448      * @stable ICU 2.0
0449      */
0450     virtual UChar32       last32(void) = 0;
0451 
0452     /**
0453      * Sets the iterator to the end of its iteration range, just behind
0454      * the last code unit or code point. This can be used to begin a backward
0455      * iteration with previous() or previous32().
0456      * @return the end position of the iteration range
0457      * @stable ICU 2.0
0458      */
0459     inline int32_t    setToEnd();
0460 
0461     /**
0462      * Sets the iterator to refer to the "position"-th code unit
0463      * in the text-storage object the iterator refers to, and
0464      * returns that code unit.  
0465      * @param position the "position"-th code unit in the text-storage object
0466      * @return the "position"-th code unit.
0467      * @stable ICU 2.0
0468      */
0469     virtual char16_t         setIndex(int32_t position) = 0;
0470 
0471     /**
0472      * Sets the iterator to refer to the beginning of the code point
0473      * that contains the "position"-th code unit
0474      * in the text-storage object the iterator refers to, and
0475      * returns that code point.
0476      * The current position is adjusted to the beginning of the code point
0477      * (its first code unit).
0478      * @param position the "position"-th code unit in the text-storage object
0479      * @return the "position"-th code point.
0480      * @stable ICU 2.0
0481      */
0482     virtual UChar32       setIndex32(int32_t position) = 0;
0483 
0484     /**
0485      * Returns the code unit the iterator currently refers to. 
0486      * @return the current code unit. 
0487      * @stable ICU 2.0
0488      */
0489     virtual char16_t         current(void) const = 0;
0490         
0491     /**
0492      * Returns the code point the iterator currently refers to.  
0493      * @return the current code point.
0494      * @stable ICU 2.0
0495      */
0496     virtual UChar32       current32(void) const = 0;
0497         
0498     /**
0499      * Advances to the next code unit in the iteration range
0500      * (toward endIndex()), and returns that code unit.  If there are
0501      * no more code units to return, returns DONE.
0502      * @return the next code unit.
0503      * @stable ICU 2.0
0504      */
0505     virtual char16_t         next(void) = 0;
0506         
0507     /**
0508      * Advances to the next code point in the iteration range
0509      * (toward endIndex()), and returns that code point.  If there are
0510      * no more code points to return, returns DONE.
0511      * Note that iteration with "pre-increment" semantics is less
0512      * efficient than iteration with "post-increment" semantics
0513      * that is provided by next32PostInc().
0514      * @return the next code point.
0515      * @stable ICU 2.0
0516      */
0517     virtual UChar32       next32(void) = 0;
0518         
0519     /**
0520      * Advances to the previous code unit in the iteration range
0521      * (toward startIndex()), and returns that code unit.  If there are
0522      * no more code units to return, returns DONE.  
0523      * @return the previous code unit.
0524      * @stable ICU 2.0
0525      */
0526     virtual char16_t         previous(void) = 0;
0527 
0528     /**
0529      * Advances to the previous code point in the iteration range
0530      * (toward startIndex()), and returns that code point.  If there are
0531      * no more code points to return, returns DONE. 
0532      * @return the previous code point. 
0533      * @stable ICU 2.0
0534      */
0535     virtual UChar32       previous32(void) = 0;
0536 
0537     /**
0538      * Returns false if there are no more code units or code points
0539      * before the current position in the iteration range.
0540      * This is used with previous() or previous32() in backward
0541      * iteration.
0542      * @return false if there are no more code units or code points
0543      * before the current position in the iteration range, return true otherwise.
0544      * @stable ICU 2.0
0545      */
0546     virtual UBool        hasPrevious() = 0;
0547 
0548     /**
0549      * Returns the numeric index in the underlying text-storage
0550      * object of the character returned by first().  Since it's
0551      * possible to create an iterator that iterates across only
0552      * part of a text-storage object, this number isn't
0553      * necessarily 0.  
0554      * @returns the numeric index in the underlying text-storage
0555      * object of the character returned by first().
0556      * @stable ICU 2.0
0557      */
0558     inline int32_t       startIndex(void) const;
0559         
0560     /**
0561      * Returns the numeric index in the underlying text-storage
0562      * object of the position immediately BEYOND the character
0563      * returned by last().  
0564      * @return the numeric index in the underlying text-storage
0565      * object of the position immediately BEYOND the character
0566      * returned by last().
0567      * @stable ICU 2.0
0568      */
0569     inline int32_t       endIndex(void) const;
0570         
0571     /**
0572      * Returns the numeric index in the underlying text-storage
0573      * object of the character the iterator currently refers to
0574      * (i.e., the character returned by current()).  
0575      * @return the numeric index in the text-storage object of 
0576      * the character the iterator currently refers to
0577      * @stable ICU 2.0
0578      */
0579     inline int32_t       getIndex(void) const;
0580 
0581     /**
0582      * Returns the length of the entire text in the underlying
0583      * text-storage object.
0584      * @return the length of the entire text in the text-storage object
0585      * @stable ICU 2.0
0586      */
0587     inline int32_t           getLength() const;
0588 
0589     /**
0590      * Moves the current position relative to the start or end of the
0591      * iteration range, or relative to the current position itself.
0592      * The movement is expressed in numbers of code units forward
0593      * or backward by specifying a positive or negative delta.
0594      * @param delta the position relative to origin. A positive delta means forward;
0595      * a negative delta means backward.
0596      * @param origin Origin enumeration {kStart, kCurrent, kEnd}
0597      * @return the new position
0598      * @stable ICU 2.0
0599      */
0600     virtual int32_t      move(int32_t delta, EOrigin origin) = 0;
0601 
0602     /**
0603      * Moves the current position relative to the start or end of the
0604      * iteration range, or relative to the current position itself.
0605      * The movement is expressed in numbers of code points forward
0606      * or backward by specifying a positive or negative delta.
0607      * @param delta the position relative to origin. A positive delta means forward;
0608      * a negative delta means backward.
0609      * @param origin Origin enumeration {kStart, kCurrent, kEnd}
0610      * @return the new position
0611      * @stable ICU 2.0
0612      */
0613 #ifdef move32
0614      // One of the system headers right now is sometimes defining a conflicting macro we don't use
0615 #undef move32
0616 #endif
0617     virtual int32_t      move32(int32_t delta, EOrigin origin) = 0;
0618 
0619     /**
0620      * Copies the text under iteration into the UnicodeString
0621      * referred to by "result".  
0622      * @param result Receives a copy of the text under iteration.  
0623      * @stable ICU 2.0
0624      */
0625     virtual void            getText(UnicodeString&  result) = 0;
0626 
0627 protected:
0628     /**
0629      * Empty constructor.
0630      * @stable ICU 2.0
0631      */
0632     CharacterIterator();
0633 
0634     /**
0635      * Constructor, just setting the length field in this base class.
0636      * @stable ICU 2.0
0637      */
0638     CharacterIterator(int32_t length);
0639 
0640     /**
0641      * Constructor, just setting the length and position fields in this base class.
0642      * @stable ICU 2.0
0643      */
0644     CharacterIterator(int32_t length, int32_t position);
0645 
0646     /**
0647      * Constructor, just setting the length, start, end, and position fields in this base class.
0648      * @stable ICU 2.0
0649      */
0650     CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position);
0651   
0652     /**
0653      * Copy constructor.
0654      *
0655      * @param that The CharacterIterator to be copied
0656      * @stable ICU 2.0
0657      */
0658     CharacterIterator(const CharacterIterator &that);
0659 
0660     /**
0661      * Assignment operator.  Sets this CharacterIterator to have the same behavior,
0662      * as the one passed in.
0663      * @param that The CharacterIterator passed in.
0664      * @return the newly set CharacterIterator.
0665      * @stable ICU 2.0
0666      */
0667     CharacterIterator &operator=(const CharacterIterator &that);
0668 
0669     /**
0670      * Base class text length field.
0671      * Necessary this for correct getText() and hashCode().
0672      * @stable ICU 2.0
0673      */
0674     int32_t textLength;
0675 
0676     /**
0677      * Base class field for the current position.
0678      * @stable ICU 2.0
0679      */
0680     int32_t  pos;
0681 
0682     /**
0683      * Base class field for the start of the iteration range.
0684      * @stable ICU 2.0
0685      */
0686     int32_t  begin;
0687 
0688     /**
0689      * Base class field for the end of the iteration range.
0690      * @stable ICU 2.0
0691      */
0692     int32_t  end;
0693 };
0694 
0695 inline bool
0696 ForwardCharacterIterator::operator!=(const ForwardCharacterIterator& that) const {
0697     return !operator==(that);
0698 }
0699 
0700 inline int32_t
0701 CharacterIterator::setToStart() {
0702     return move(0, kStart);
0703 }
0704 
0705 inline int32_t
0706 CharacterIterator::setToEnd() {
0707     return move(0, kEnd);
0708 }
0709 
0710 inline int32_t
0711 CharacterIterator::startIndex(void) const {
0712     return begin;
0713 }
0714 
0715 inline int32_t
0716 CharacterIterator::endIndex(void) const {
0717     return end;
0718 }
0719 
0720 inline int32_t
0721 CharacterIterator::getIndex(void) const {
0722     return pos;
0723 }
0724 
0725 inline int32_t
0726 CharacterIterator::getLength(void) const {
0727     return textLength;
0728 }
0729 
0730 U_NAMESPACE_END
0731 
0732 #endif /* U_SHOW_CPLUSPLUS_API */
0733 
0734 #endif