IConstTextIterator

This class provides a forward iterator for const IText. It provides read-only sequential access to the characters in an IText, and can be used as a pointer to an individual character in an IText. This class conforms to the protocol for an STL-compatible random-access iterator.

Do not derive from this class.


IConstTextIterator - Member Functions and Data by Group

Constructors & Destructor

Use the constructors and destructor in this group to create and destroy objects of class IConstTextIterator.


[view class]
~IConstTextIterator
public:
~IConstTextIterator()
Destroys the IConstTextIterator object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IConstTextIterator
Constructs an object of class IConstTextIterator.


Overload 1
public:
IConstTextIterator(const IConstTextIterator& that)
Use this constructor to create an IConstTextIterator that is copied from the given one.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IConstTextIterator()
Use this constructor to create an IConstTextIterator object that leaves the iterator in an undefined state. You must call the assignment operator before you can use a default-constructed iterator.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Assignment Operator

Use the assignment operator in this group to replace the current IConstTextIterator with the given one.


[view class]
operator =
public:
IConstTextIterator& operator =( const IConstTextIterator& that )
Points the current IConstTextIterator to the same character position in the same IText pointed to by the given one specified as the that parameter.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Comparing Two IConstTextIterators for Equality or Inequality

Use the functions in this group to determine if the two IConstTextIterator objects refer to the same character.


[view class]
operator !=
public:
bool operator !=(const IConstTextIterator& that) const
Returns true if the iterators refer to different character positions in the same IText.
that
The IConstTextIterator object to be compared with this one.

Exception

IInvalidParameter If both iterators do not refer to the same IText object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator ==
public:
bool operator ==(const IConstTextIterator& that) const
Returns true if both iterators refer to the same character position in the same IText.
that
The IConstTextIterator object to be compared with this one.

Exception

IInvalidParameter If both iterators do not refer to the same IText object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Creating an ITextIterator Object Copied from the Current IConstTextIterator

Use the function in this group to copy the current IConstTextIterator into a created ITextIterator object.


[view class]
operator ITextIterator
public:
operator ITextIterator() const
Returns an ITextIterator that refers to the same character in the same IText as the character referred to by this, the current, ITextIterator.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Determining the Character the Iterator Refers To

Use the operators and functions in this group to identify the character or character position the iterator refers to.


[view class]
operator *
public:
UniChar 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 <
public:
bool operator <(const IConstTextIterator& that) const
Returns true if the current IConstTextIterator object refers to a character with a lower offset than the given one does.
that
An IConstTextIterator object containing the character to be tested.

Exception

IInvalidParameter If both iterators do not refer to the same IText object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator <=
public:
bool operator <=(const IConstTextIterator& that) const
Returns true if the current IConstTextIterator object refers to the same character as the given one does, or to one with a lower offset.
that
An IConstTextIterator object containing the character to be tested.

Exception

IInvalidParameter If both iterators do not refer to the same IText object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator >
public:
bool operator >(const IConstTextIterator& that) const
Returns true if the current IConstTextIterator object refers to a character with a higher offset than the given one does.
that
An IConstTextIterator object containing the character to be tested.

Exception

IInvalidParameter If both iterators do not refer to the same IText object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator >=
public:
bool operator >=(const IConstTextIterator& that) const
Returns true if the current IConstTextIterator object refers to the same character as the given one does, or to one with a higher offset.
that
An IConstTextIterator object containing the character to be tested.

Exception

IInvalidParameter If both iterators do not refer to the same IText object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator []
public:
UniChar operator [](long offset) const
Returns the character that is the specified number of offsets, or positions, away from the one the iterator refers to. For example, if iter points to position 2 in a function, iter[3] will return the character at position 5 in that function, not the character at position 3. The iterator itself is left unchanged by this operation.
long
The number of offsets.

Exception

IInvalidParameter If the desired character offset is out of range.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Identifying the IText Object of the Iterator

Use the function in this group to identify the IText object to which the iterator belongs and acts on.


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

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Incrementing or Decrementing the Iterator

Use the operators in this group to move the iterator, traversing characters.


[view class]
operator ++
Advances the iterator to the next character position, that is, the position with the next highest offset. This function performs no error checking; rather, it depends on operator*() for error checking.


Overload 1
public:
IConstTextIterator& operator ++()
Returns a reference to this.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IConstTextIterator operator ++(int)
Returns a copy of the iterator before it was advanced.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator +=
public:
IConstTextIterator& operator +=(long distance)
Advances the iterator the number of character positions specified by distance. It advances the iterator toward the end of the text, that is, toward higher character offsets. This function performs no error checking; it depends on operator*() for error checking. Returns a reference to this.
distance
The number of character positions to advance the text.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator -
public:
IConstTextIterator operator -(long distance) const
Returns an iterator that refers to the character position that is the number of character positions, specified by the distance parameter, before the one referred to by the current iterator. This function produces the same effect as offset() - that.offset().
distance
The number of character positions before the one specified by the current IConstTextIterator object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator --
Advances the iterator to the previous character position, that is, the one with the next-lower offset. This routine performs no error checking; it depends on operator*() for error checking.


Overload 1
public:
IConstTextIterator operator --(int)
Returns a copy of the iterator before it was advanced.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IConstTextIterator& operator --()
Returns a reference to this.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator -=
public:
IConstTextIterator& operator -=(long distance)
Advances the iterator by the distance of character positions toward the beginning of the text, that is, toward lower character offsets. Returns a reference to this. This routine performs no error checking; it depends on operator*() for error checking.
distance
The number of character positions to advance the text.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Obtaining Information About the Characters Referred To

Use these functions to obtain the number of characters in the range marked by the iterators or to obtain the offset of the character referred to.


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

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator -
public:
long operator -(const IConstTextIterator& that) const
Returns the number of character positions between the two iterators. This has the same effect as offset() - that.offset().
that
The given iterator used with this one to mark the text range.

Exception

IInvalidParameter If the iterators refer to different IText objects.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IConstTextIterator - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data