Class: TTextOrder

Declaration: TextComparison.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TBitwiseTextOrder TLanguageTextOrder

Purpose:

TTextOrder is an abstract base class that provides the protocol for comparing two text objects. TTextOrder is used by pattern iterators for searching. Derived classes of TTextOrder encapsulate collation tables for particular sets of characters and provide the mechanism for language-sensitive text ordering. Typically a single text-ordering object encapsulates the collation table for a particular locale. The comparison functions do not consider style information when performing comparisons.

Instantiation:

TTextOrder is an abstract class that cannot be directly instantiated.

Deriving Classes:

Derived classes must implement the Compare functions and CreateTextPatternIterator. Language-insensitive text ordering is provided by the concrete derived class TBitwiseTextOrder. Protocol for language-sensitive text ordering is provided by the derived class TLanguageTextOrder. TTableBasedTextOrder provides a concrete implementation of TLanguageTextOrder.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TTextOrder::~TTextOrder

virtual ~ TTextOrder ()

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: TTextOrder::Compare

  1. virtual ETextComparisonResult Compare (const TText & sourceText, const TText & targetText) const
  2. virtual ETextComparisonResult Compare (const TText & sourceText, const TText & targetText, TTextCount & sourceCharactersMatched, TTextCount & targetCharactersMatched) const

Interface Category:

API.

Purpose:

  1. Compares two text objects and returns the result as an ETextComparisonResult value.
  2. Compares two text objects and returns the result as an ETextComparisonResult value. Also fills in the given TTextCounts with the number of characters matched in both the source and the target strings.

Calling Context:

  1. Called by clients.
  2. Called by clients.

Parameters:

Return Value:

The ETextComparisonResult value containing the results of the comparison.

Exceptions:

This function is pure virtual. Overrides might throw exceptions.

Concurrency:

Not multithread safe.

Other Considerations:

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

Member Function: TTextOrder::CreateTextPatternIterator

virtual TTextPatternIterator * CreateTextPatternIterator (const TText * text, const TText & pattern, const TTextRange & searchRange) const

Interface Category:

API.

Purpose:

Creates an object of the text pattern iterator class that uses this text ordering class for pattern iteration.

Calling Context:

Called by clients.

Parameters:

Return Value:

A TTextPatternIterator object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

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

Member Function: TTextOrder::TextIsEqual

virtual bool TextIsEqual (const TText & sourceText, const TText & targetText) const

Interface Category:

API.

Purpose:

Compares two TText objects, returning whether or not they are equal.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if the text strings are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function calls the Compare function. It will consider the strings equal if Compare returns kSourceEqual.

Member Function: TTextOrder::TextIsGreaterThan

virtual bool TextIsGreaterThan (const TText & sourceText, const TText & targetText) const

Interface Category:

API.

Purpose:

Compares two TText objects, returning whether or not the source text is greater than the target text.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if the source text is greater than the target text.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function calls the Compare function. It will consider the source string greater than the target string if Compare returns either kSourcePrimaryGreater, kSourceSecondaryGreater or kSourceTertiaryGreater.

Member Function: TTextOrder::TextIsLessThan

virtual bool TextIsLessThan (const TText & sourceText, const TText & targetText) const

Interface Category:

API.

Purpose:

Compares two TText objects, returning whether or not the source text is less than the target text.

Calling Context:

Called by clients.

Parameters:

Return Value:

Returns true if the source text is less than the target text.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This function calls the Compare function. It will consider the source string less than the target string if Compare returns either kSourcePrimaryLess, kSourceSecondaryLess or kSourceTertiaryLess.

Member Function: TTextOrder::GetName

virtual void GetName (TLocalizableName & name) const

Interface Category:

API.

Purpose:

Returns the localizable name for this object.

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: TTextOrder::SetName

virtual void SetName (const TLocalizableName & name)

Interface Category:

API.

Purpose:

Specifies the localizable name for this object.

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: TTextOrder::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Generates a hash value.

Calling Context:

Called by clients.

Parameters:

Return Value:

The numeric value of the hash.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextOrder::operator=

TTextOrder & operator =(const TTextOrder & order)

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:

None.

Member Function: TTextOrder::operator>>=

virtual TStream & operator >>=(TStream & toWhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextOrder::operator<<=

virtual TStream & operator <<= (TStream & fromWhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TTextOrder::TTextOrder

  1. TTextOrder ()
  2. TTextOrder (const TTextOrder & order)

Interface Category:

API.

Purpose:

  1. Default constructor. This constructor is protected.
  2. Copy constructor. This constructor is protected.

Calling Context:

  1. Called by the stream-in operators.
  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.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.