Class: TTextPatternIterator

Declaration: TextComparison.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TStandardTextPatternIterator TExactTextPatternIterator TSpanTextPatternIterator

Purpose:

TTextPatternIterator is the abstract base class for all text pattern iterators. Concrete derived classes provide protocol for language-sensitive and language-insensitive pattern matching.

Instantiation:

TTextPatternIterator is an abstract class that cannot be directly instantiated.

Deriving Classes:

The system provides the following derived classes: TStandardTextPatternIterator performs language-sensitive matching, TExactTextPatternIterator performs language-insensitive matching, and TSpanTextPatternIterator performs string span functions.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TTextPatternIterator::~TTextPatternIterator

virtual ~ TTextPatternIterator ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::First

  1. virtual TTextOffset First ()
  2. virtual TTextOffset First (TTextRange & foundRange)

Interface Category:

API.

Purpose:

  1. Finds the first occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match.
  2. Finds the first occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match and the range defining the position of the match.

Calling Context:

Called by clients.

Parameters:

Return Value:

The offset of the first character of the located pattern within the text object. Returns kNotFoundOffset if the pattern is not found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::Last

  1. virtual TTextOffset Last ()
  2. virtual TTextOffset Last (TTextRange & foundRange)

Interface Category:

API.

Purpose:

  1. Finds the last occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match.
  2. Finds the last occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match and the range defining the position of the match.

Calling Context:

Called by clients.

Parameters:

Return Value:

The offset of the first character of the located pattern within the text object. Returns kNotFoundOffset if the pattern is not found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::Next

  1. virtual TTextOffset Next ()
  2. virtual TTextOffset Next (TTextRange & foundRange)

Interface Category:

API.

Purpose:

  1. Finds the next occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match.
  2. Finds the next occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match and the range defining the position of the match.

Calling Context:

Called by clients.

Parameters:

Return Value:

The offset of the first character of the located pattern within the text object. Returns kNotFoundOffset if the pattern is not found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You must initialize the iterator by calling First before calling this function.

Member Function: TTextPatternIterator::Previous

  1. virtual TTextOffset Previous ()
  2. virtual TTextOffset Previous (TTextRange & foundRange)

Interface Category:

API.

Purpose:

  1. Finds the previous occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match.
  2. Finds the previous occurrence of the text pattern within the text being iterated over. Returns the offset of the first character of the match and the range defining the position of the match.

Calling Context:

Called by clients.

Parameters:

Return Value:

The offset of the first character of the located pattern within the text object. Returns kNotFoundOffset if the pattern is not found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

You must initialize the iterator by calling Last before calling this function.

Member Function: TTextPatternIterator::SetPattern

virtual void SetPattern (const TText & pattern)

Interface Category:

API.

Purpose:

Specifies the pattern for the iterator to search for.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::GetPattern

void GetPattern (TStandardText & pattern) const

Interface Category:

API.

Purpose:

Gets the pattern the iterator is searching for.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::SetRange

virtual void SetRange (const TTextRange & searchRange)

Interface Category:

API.

Purpose:

Specifies the range of the text object the iterator should search through.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::GetRange

void GetRange (TTextRange & searchRange)

Interface Category:

API.

Purpose:

Gets the range of the text object the iterator is searching through.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::TTextPatternIterator

  1. TTextPatternIterator (const TText * text, const TText & pattern, const TTextRange & searchRange)
  2. TTextPatternIterator (const TTextPatternIterator & toCopy)

Interface Category:

API.

Purpose:

  1. Constructs an iterator for the specified text object, pattern, and range. This constructor is protected.
  2. Copy constructor. This constructor is protected.

Calling Context:

  1. Called to instantiate this class.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::operator=

TTextPatternIterator & operator =(const TTextPatternIterator & toCopy)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function is protected.

Member Function: TTextPatternIterator::FindForward

virtual bool FindForward (const TTextRange & searchRange, TTextRange & foundRange) const

Interface Category:

API.

Purpose:

Iterates forward through the text object to find the next occurrence.

Calling Context:

Called by the First and Next functions.

Parameters:

Return Value:

Returns true if the pattern is found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This is a protected pure virtual function and needs to be overridden.

Member Function: TTextPatternIterator::FindBackward

virtual bool FindBackward (const TTextRange & searchRange, TTextRange & foundRange) const

Interface Category:

API.

Purpose:

Iterates backward through the text object to find the previous occurrence.

Calling Context:

Called by the Last and Previous functions.

Parameters:

Return Value:

Returns true if the pattern is found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This is a protected pure virtual function and needs to be overridden.

Member Function: TTextPatternIterator::GetText

const TText * GetText () const

Interface Category:

API.

Purpose:

Returns the text on which a pattern search, if requested, will be performed.

Calling Context:

Called by clients.

Parameters:

Return Value:

The text on which a pattern search, if requested, will be performed.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextPatternIterator::SetText

virtual void SetText (const TText * text, const TTextRange & searchRange)

Interface Category:

API.

Purpose:

Sets the text on which a pattern search, if requested, will be performed.

Calling Context:

Called by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.