ITextIterator

Forward iterator for IText. Provides read-write sequential access to the characters in an IText, and can be used as a pointer to an individual character in an IText. This class obeys the protocol for an STL-compatible random-access iterator.

Do not derive your own classes from this class.


ITextIterator - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class.


[view class]
~ITextIterator
public:
~ITextIterator()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ITextIterator


Overload 1
public:
ITextIterator(const ITextIterator& that)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
ITextIterator()
The default constructor leaves the iterator in an undefined state! The assignment operator must be called before a default-constructed iterator can be used!

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Assignment Operator


[view class]
operator =
public:
ITextIterator& operator =(const ITextIterator& that)
Points "this" to the same character position in the same IText as "that" points to.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Comparisons

Use these operators to obtain the number of character positions between the two iterators or to compare the positions of the given iterator and the current one.


[view class]
operator !=
public:
bool operator !=(const ITextIterator& that) const
Returns true if the iterators refer to different character positions in the same IText. This is a straight pointer comparison. No error checking is performed.

Exception

IInvalidParameter if both iterators don't refer to the same IText

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator -
Returns the number of character positions between the two iterators
public:
long operator -(const ITextIterator& that) const
(i.e., same effect as "offset() - that.offset()" ).

Exception

IInvalidParameter if the iterators refer to different ITexts

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator <
public:
bool operator <(const ITextIterator& that) const
Returns true if "this" refers to a character with a lower offset than "that" does.

Exception

IInvalidParameter if both iterators don't refer to the same IText

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator <=
public:
bool operator <=(const ITextIterator& that) const
Returns true if "this" refers to the same character as "that," or to one with a lower offset.

Exception

IInvalidParameter if both iterators don't refer to the same IText

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator ==
public:
bool operator ==(const ITextIterator& that) const
Returns true if both iterators refer to the same character position in the same IText. This is a straight pointer comparison. No error checking is performed.

Exception

IInvalidParameter if both iterators don't refer to the same IText

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator >
public:
bool operator >(const ITextIterator& that) const
Returns true if "this" refers to a character with a higher offset than "that" does.

Exception

IInvalidParameter if both iterators don't refer to the same IText

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator >=
public:
bool operator >=(const ITextIterator& that) const
Returns true if "this" refers to the same character as "that," or to one with a higher offset.

Exception

IInvalidParameter if both iterators don't refer to the same IText

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Incrementing and Decrementing


[view class]
operator ++
(i.e., with the next-higher offset) This routine performs no error checking; it depends on operator*() for that.


Overload 1
Advances the iterator to the next character position.
public:
ITextIterator& operator ++()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Advances the iterator to the next character position
public:
ITextIterator operator ++(int)

Return
A copy of the iterator before it was advanced.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator +=
Advances the iterator "distance" character positions toward the end of the text
public:
ITextIterator& operator +=(long distance)
(i.e., toward higher character offsets). This routine performs no error checking; it depends on operator*() for that.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator -
Returns an iterator that refers to the character "distance" positions before the one this iterator refers to
public:
ITextIterator operator -(long distance) const
(i.e., same effect as "offset() - that.offset()" ).

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator --
(i.e., with the next-lower offset). This routine performs no error checking; it depends on operator*() for that.


Overload 1
Advances the iterator to the previous character position
public:
ITextIterator operator --(int)

Return
A copy of the iterator before it was advanced.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
Advances the iterator to the previous character position
public:
ITextIterator& operator --()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator -=
Advances the iterator "distance" character positions toward the beginning of the text
public:
ITextIterator& operator -=(long distance)
(i.e., toward lower character offsets). This routine performs no error checking; it depends on operator*() for that.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining a Reference to a Character

Use these functions to obtain a reference to a character whose position the iterator refers to.


[view class]
operator *
public:
ICharacterReference operator *() const
Returns a reference to the character the iterator refers to.

Exception

IInvalidParameter if the iterator refers to an out-of-range character position on its IText.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator []
Returns a reference to the character "offset" positions away from the position the iterator refers to
public:
ICharacterReference operator [](long offset) const
(i.e., if "iter" points to position 2 in "foo," "iter[3]" will return the character at position 5 in "foo," not the character at position 3). The iterator itself is left unchanged by this operation.

Exception

IInvalidParameter if the desired character offset is out of range

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Miscellaneous Members


[view class]
offset
public:
size_t offset() const
Returns the character offset within its IText of the character the iterator refers to.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
text
public:
IText* text() const
Returns a pointer to the IText the iterator refers to.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ITextIterator - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data