2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2001-03-21 20:09:56 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 1997-2003, International Business Machines Corporation and
|
|
|
|
* others. All Rights Reserved.
|
2001-03-21 20:09:56 +00:00
|
|
|
********************************************************************/
|
|
|
|
|
2000-12-12 19:40:58 +00:00
|
|
|
#ifndef SFDWCHIT_H
|
|
|
|
#define SFDWCHIT_H
|
|
|
|
|
|
|
|
#include "unicode/chariter.h"
|
2001-10-08 23:26:58 +00:00
|
|
|
#include "intltest.h"
|
2000-12-12 19:40:58 +00:00
|
|
|
|
|
|
|
class SimpleFwdCharIterator : public ForwardCharacterIterator {
|
|
|
|
public:
|
2003-12-16 22:28:42 +00:00
|
|
|
// not used -- SimpleFwdCharIterator(const UnicodeString& s);
|
2000-12-12 19:40:58 +00:00
|
|
|
SimpleFwdCharIterator(UChar *s, int32_t len, UBool adopt = FALSE);
|
|
|
|
|
|
|
|
virtual ~SimpleFwdCharIterator();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true when both iterators refer to the same
|
|
|
|
* character in the same character-storage object.
|
|
|
|
*/
|
2003-12-16 22:28:42 +00:00
|
|
|
// not used -- virtual UBool operator==(const ForwardCharacterIterator& that) const;
|
2000-12-12 19:40:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates a hash code for this iterator.
|
|
|
|
*/
|
|
|
|
virtual int32_t hashCode(void) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a UClassID for this ForwardCharacterIterator ("poor man's
|
|
|
|
* RTTI").<P> Despite the fact that this function is public,
|
|
|
|
* DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!
|
|
|
|
*/
|
|
|
|
virtual UClassID getDynamicClassID(void) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the current code unit for returning and advances to the next code unit
|
|
|
|
* in the iteration range
|
|
|
|
* (toward endIndex()). If there are
|
|
|
|
* no more code units to return, returns DONE.
|
|
|
|
*/
|
|
|
|
virtual UChar nextPostInc(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the current code point for returning and advances to the next code point
|
|
|
|
* in the iteration range
|
|
|
|
* (toward endIndex()). If there are
|
|
|
|
* no more code points to return, returns DONE.
|
|
|
|
*/
|
|
|
|
virtual UChar32 next32PostInc(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns FALSE if there are no more code units or code points
|
|
|
|
* at or after the current position in the iteration range.
|
|
|
|
* This is used with nextPostInc() or next32PostInc() in forward
|
|
|
|
* iteration.
|
|
|
|
*/
|
|
|
|
virtual UBool hasNext();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
SimpleFwdCharIterator() {}
|
2000-12-20 22:33:23 +00:00
|
|
|
SimpleFwdCharIterator(const SimpleFwdCharIterator &other)
|
|
|
|
: ForwardCharacterIterator(other) {}
|
2000-12-12 19:40:58 +00:00
|
|
|
SimpleFwdCharIterator &operator=(const SimpleFwdCharIterator&) { return *this; }
|
|
|
|
private:
|
|
|
|
static const int32_t kInvalidHashCode;
|
|
|
|
static const int32_t kEmptyHashCode;
|
|
|
|
|
|
|
|
UChar *fStart, *fEnd, *fCurrent;
|
|
|
|
int32_t fLen;
|
|
|
|
UBool fBogus;
|
|
|
|
int32_t fHashCode;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|