Unicode Text Framework provides a set of iterators for accessing the character data in an IText object. These iterators all have the properties of a random-access iterator as described by most recent version of the C++ standard.
The iterators use the class
ICharacterReference to return non-const references
to UniChar values. This ensures that both the
reference-counting mechanism used for IText storage and the
paragraph style propagation are not disturbed.
This figure shows the basic protocol for the text iterators. Only ITextIterator is shown:
const
functions on the IText under iteration while the
IFastTextIterator is in effect. false
if you want to use the iterator for read-only access of
characters. The framework provides an additional iterator, ITextStyleRunIterator, that lets you iterate over the style runs in a styled IText object. A style run is a range of characters with identical styling information--that is, the same set of style objects with the same values. For example, the text string shown here has four style runs:
This figure shows the ITextStyleRunIterator interface:
When you construct the iterator, it points to the first style run.
![]()
Iterating
through Characters in an IText Object
Iterating through
Style Runs in an IText Object
Querying and
Modifying Styles in an IText Object