1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2003, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
12 #include "unicode/chariter.h"
15 class SimpleFwdCharIterator : public ForwardCharacterIterator {
17 // not used -- SimpleFwdCharIterator(const UnicodeString& s);
18 SimpleFwdCharIterator(UChar *s, int32_t len, UBool adopt = FALSE);
20 virtual ~SimpleFwdCharIterator();
23 * Returns true when both iterators refer to the same
24 * character in the same character-storage object.
26 // not used -- virtual UBool operator==(const ForwardCharacterIterator& that) const;
29 * Generates a hash code for this iterator.
31 virtual int32_t hashCode(void) const;
34 * Returns a UClassID for this ForwardCharacterIterator ("poor man's
35 * RTTI").<P> Despite the fact that this function is public,
36 * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!
38 virtual UClassID getDynamicClassID(void) const;
41 * Gets the current code unit for returning and advances to the next code unit
42 * in the iteration range
43 * (toward endIndex()). If there are
44 * no more code units to return, returns DONE.
46 virtual UChar nextPostInc(void);
49 * Gets the current code point for returning and advances to the next code point
50 * in the iteration range
51 * (toward endIndex()). If there are
52 * no more code points to return, returns DONE.
54 virtual UChar32 next32PostInc(void);
57 * Returns FALSE if there are no more code units or code points
58 * at or after the current position in the iteration range.
59 * This is used with nextPostInc() or next32PostInc() in forward
62 virtual UBool hasNext();
65 SimpleFwdCharIterator() {}
66 SimpleFwdCharIterator(const SimpleFwdCharIterator &other)
67 : ForwardCharacterIterator(other) {}
68 SimpleFwdCharIterator &operator=(const SimpleFwdCharIterator&) { return *this; }
70 static const int32_t kInvalidHashCode;
71 static const int32_t kEmptyHashCode;
73 UChar *fStart, *fEnd, *fCurrent;