Using pattern iterators

To use any of these iterators, you:

  1. Instantiate an iterator, specifying the text object to search and a second text object containing the search pattern.
  2. Initialize the iterator by calling either the First or Last member function to set it to the first or the last occurrence of the pattern within the search target.
  3. Iterate either forward or backward through occurrences of the pattern in the text with the Next or Previous member function.
These iterators return the offset of the first character in the located pattern and the text range describing the located string. When no match is found, the iterator returns the offset TTextPatternIterator::kNotFoundOffset and the range returned by the member function TTextRange::GetEmptyRange.

These iterators maintain a pointer to the text object they iterate through. To iterate through a different text object, reset the iterator using the SetText member function. If the text object is deleted, make sure the iterator is also deleted.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker