1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /******************************************************************** 4 * COPYRIGHT: 5 * Copyright (c) 1997-2003, International Business Machines Corporation and 6 * others. All Rights Reserved. 7 ********************************************************************/ 8 9 #ifndef SFDWCHIT_H 10 #define SFDWCHIT_H 11 12 #include "unicode/chariter.h" 13 #include "intltest.h" 14 15 class SimpleFwdCharIterator : public ForwardCharacterIterator { 16 public: 17 // not used -- SimpleFwdCharIterator(const UnicodeString& s); 18 SimpleFwdCharIterator(UChar *s, int32_t len, UBool adopt = FALSE); 19 20 virtual ~SimpleFwdCharIterator(); 21 22 /** 23 * Returns true when both iterators refer to the same 24 * character in the same character-storage object. 25 */ 26 // not used -- virtual UBool operator==(const ForwardCharacterIterator& that) const; 27 28 /** 29 * Generates a hash code for this iterator. 30 */ 31 virtual int32_t hashCode(void) const; 32 33 /** 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! 37 */ 38 virtual UClassID getDynamicClassID(void) const; 39 40 /** 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. 45 */ 46 virtual UChar nextPostInc(void); 47 48 /** 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. 53 */ 54 virtual UChar32 next32PostInc(void); 55 56 /** 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 60 * iteration. 61 */ 62 virtual UBool hasNext(); 63 64 protected: SimpleFwdCharIterator()65 SimpleFwdCharIterator() {} SimpleFwdCharIterator(const SimpleFwdCharIterator & other)66 SimpleFwdCharIterator(const SimpleFwdCharIterator &other) 67 : ForwardCharacterIterator(other) {} 68 SimpleFwdCharIterator &operator=(const SimpleFwdCharIterator&) { return *this; } 69 private: 70 static const int32_t kInvalidHashCode; 71 static const int32_t kEmptyHashCode; 72 73 UChar *fStart, *fEnd, *fCurrent; 74 int32_t fLen; 75 UBool fBogus; 76 int32_t fHashCode; 77 }; 78 79 #endif 80