webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Protected Member Functions | List of all members
ForwardCharacterIterator Class Referenceabstract

#include <chariter.h>

Inheritance diagram for ForwardCharacterIterator:
UObject UObject UMemory UMemory UMemory UMemory UMemory UMemory CharacterIterator CharacterIterator

Public Types

enum  { DONE = 0xffff }
 
enum  { DONE = 0xffff }
 

Public Member Functions

virtual ~ForwardCharacterIterator ()
 
virtual UBool operator== (const ForwardCharacterIterator &that) const =0
 
UBool operator!= (const ForwardCharacterIterator &that) const
 
virtual int32_t hashCode (void) const =0
 
virtual UClassID getDynamicClassID (void) const =0
 
virtual UChar nextPostInc (void)=0
 
virtual UChar32 next32PostInc (void)=0
 
virtual UBool hasNext ()=0
 
virtual ~ForwardCharacterIterator ()
 
virtual UBool operator== (const ForwardCharacterIterator &that) const =0
 
UBool operator!= (const ForwardCharacterIterator &that) const
 
virtual int32_t hashCode (void) const =0
 
virtual UClassID getDynamicClassID (void) const =0
 
virtual UChar nextPostInc (void)=0
 
virtual UChar32 next32PostInc (void)=0
 
virtual UBool hasNext ()=0
 
- Public Member Functions inherited from UObject
virtual ~UObject ()
 
virtual ~UObject ()
 
virtual ~UObject ()
 

Protected Member Functions

 ForwardCharacterIterator ()
 
 ForwardCharacterIterator (const ForwardCharacterIterator &other)
 
ForwardCharacterIteratoroperator= (const ForwardCharacterIterator &)
 
 ForwardCharacterIterator ()
 
 ForwardCharacterIterator (const ForwardCharacterIterator &other)
 
ForwardCharacterIteratoroperator= (const ForwardCharacterIterator &)
 

Detailed Description

Abstract class that defines an API for forward-only iteration on text objects. This is a minimal interface for iteration without random access or backwards iteration. It is especially useful for wrapping streams with converters into an object for collation or normalization.

Characters can be accessed in two ways: as code units or as code points. Unicode code points are 21-bit integers and are the scalar values of Unicode characters. ICU uses the type UChar32 for them. Unicode code units are the storage units of a given Unicode/UCS Transformation Format (a character encoding scheme). With UTF-16, all code points can be represented with either one or two code units ("surrogates"). String storage is typically based on code units, while properties of characters are typically determined using code point values. Some processes may be designed to work with sequences of code units, or it may be known that all characters that are important to an algorithm can be represented with single code units. Other processes will need to use the code point access functions.

ForwardCharacterIterator provides nextPostInc() to access a code unit and advance an internal position into the text object, similar to a return text[position++].
It provides next32PostInc() to access a code point and advance an internal position.

next32PostInc() assumes that the current position is that of the beginning of a code point, i.e., of its first code unit. After next32PostInc(), this will be true again. In general, access to code units and code points in the same iteration loop should not be mixed. In UTF-16, if the current position is on a second code unit (Low Surrogate), then only that code unit is returned even by next32PostInc().

For iteration with either function, there are two ways to check for the end of the iteration. When there are no more characters in the text object:

Example:

void function1(ForwardCharacterIterator &it) {
while(it.hasNext()) {
c=it.next32PostInc();
// use c
}
}
void function1(ForwardCharacterIterator &it) {
// use c
}
}

ICU 2.0

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Value returned by most of ForwardCharacterIterator's functions when the iterator has reached the limits of its iteration. ICU 2.0

Enumerator
DONE 

◆ anonymous enum

anonymous enum

Value returned by most of ForwardCharacterIterator's functions when the iterator has reached the limits of its iteration. ICU 2.0

Enumerator
DONE 

Constructor & Destructor Documentation

◆ ~ForwardCharacterIterator() [1/2]

virtual ForwardCharacterIterator::~ForwardCharacterIterator ( )
virtual

Destructor. ICU 2.0

◆ ForwardCharacterIterator() [1/4]

ForwardCharacterIterator::ForwardCharacterIterator ( )
protected

Default constructor to be overridden in the implementing class. ICU 2.0

◆ ForwardCharacterIterator() [2/4]

ForwardCharacterIterator::ForwardCharacterIterator ( const ForwardCharacterIterator other)
protected

Copy constructor to be overridden in the implementing class. ICU 2.0

◆ ~ForwardCharacterIterator() [2/2]

virtual ForwardCharacterIterator::~ForwardCharacterIterator ( )
virtual

Destructor. ICU 2.0

◆ ForwardCharacterIterator() [3/4]

ForwardCharacterIterator::ForwardCharacterIterator ( )
protected

Default constructor to be overridden in the implementing class. ICU 2.0

◆ ForwardCharacterIterator() [4/4]

ForwardCharacterIterator::ForwardCharacterIterator ( const ForwardCharacterIterator other)
protected

Copy constructor to be overridden in the implementing class. ICU 2.0

Member Function Documentation

◆ getDynamicClassID() [1/2]

virtual UClassID ForwardCharacterIterator::getDynamicClassID ( void  ) const
pure virtual

Returns a UClassID for this ForwardCharacterIterator ("poor man's RTTI").

Despite the fact that this function is public, DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!

Returns
a UClassID for this ForwardCharacterIterator ICU 2.0

Reimplemented from UObject.

◆ getDynamicClassID() [2/2]

virtual UClassID ForwardCharacterIterator::getDynamicClassID ( void  ) const
pure virtual

Returns a UClassID for this ForwardCharacterIterator ("poor man's RTTI").

Despite the fact that this function is public, DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!

Returns
a UClassID for this ForwardCharacterIterator ICU 2.0

Reimplemented from UObject.

◆ hashCode() [1/2]

virtual int32_t ForwardCharacterIterator::hashCode ( void  ) const
pure virtual

Generates a hash code for this iterator.

Returns
the hash code. ICU 2.0

◆ hashCode() [2/2]

virtual int32_t ForwardCharacterIterator::hashCode ( void  ) const
pure virtual

Generates a hash code for this iterator.

Returns
the hash code. ICU 2.0

◆ hasNext() [1/2]

virtual UBool ForwardCharacterIterator::hasNext ( )
pure virtual

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.

Returns
FALSE if there are no more code units or code points at or after the current position in the iteration range. ICU 2.0

◆ hasNext() [2/2]

virtual UBool ForwardCharacterIterator::hasNext ( )
pure virtual

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.

Returns
FALSE if there are no more code units or code points at or after the current position in the iteration range. ICU 2.0

◆ next32PostInc() [1/2]

virtual UChar32 ForwardCharacterIterator::next32PostInc ( void  )
pure virtual

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.

Returns
the current code point. ICU 2.0

◆ next32PostInc() [2/2]

virtual UChar32 ForwardCharacterIterator::next32PostInc ( void  )
pure virtual

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.

Returns
the current code point. ICU 2.0

◆ nextPostInc() [1/2]

virtual UChar ForwardCharacterIterator::nextPostInc ( void  )
pure virtual

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.

Returns
the current code unit. ICU 2.0

◆ nextPostInc() [2/2]

virtual UChar ForwardCharacterIterator::nextPostInc ( void  )
pure virtual

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.

Returns
the current code unit. ICU 2.0

◆ operator!=() [1/2]

UBool ForwardCharacterIterator::operator!= ( const ForwardCharacterIterator that) const
inline

Returns true when the iterators refer to different text-storage objects, or to different characters in the same text-storage object.

Parameters
thatThe ForwardCharacterIterator to be compared for inequality
Returns
true when the iterators refer to different text-storage objects, or to different characters in the same text-storage object ICU 2.0

◆ operator!=() [2/2]

UBool ForwardCharacterIterator::operator!= ( const ForwardCharacterIterator that) const
inline

Returns true when the iterators refer to different text-storage objects, or to different characters in the same text-storage object.

Parameters
thatThe ForwardCharacterIterator to be compared for inequality
Returns
true when the iterators refer to different text-storage objects, or to different characters in the same text-storage object ICU 2.0

◆ operator=() [1/2]

ForwardCharacterIterator& ForwardCharacterIterator::operator= ( const ForwardCharacterIterator )
inlineprotected

Assignment operator to be overridden in the implementing class. ICU 2.0

◆ operator=() [2/2]

ForwardCharacterIterator& ForwardCharacterIterator::operator= ( const ForwardCharacterIterator )
inlineprotected

Assignment operator to be overridden in the implementing class. ICU 2.0

◆ operator==() [1/2]

virtual UBool ForwardCharacterIterator::operator== ( const ForwardCharacterIterator that) const
pure virtual

Returns true when both iterators refer to the same character in the same character-storage object.

Parameters
thatThe ForwardCharacterIterator to be compared for equality
Returns
true when both iterators refer to the same character in the same character-storage object ICU 2.0

◆ operator==() [2/2]

virtual UBool ForwardCharacterIterator::operator== ( const ForwardCharacterIterator that) const
pure virtual

Returns true when both iterators refer to the same character in the same character-storage object.

Parameters
thatThe ForwardCharacterIterator to be compared for equality
Returns
true when both iterators refer to the same character in the same character-storage object ICU 2.0

The documentation for this class was generated from the following file: