Class: TAdditiveNumberFormatter

Declaration: AdditiveNumberFormat.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TNumberFormatter

Inherited By:

THebrewNumberFormatter THybridNumberFormatter TRomanNumberFormatter

Purpose:

This class, derived from TNumberFormatter, handles simple numbers represented by an additive system in which the total value of a numeral is determined by adding together all the digits.

Instantiation:

Always allocate on the heap.

Deriving Classes:

Derived classes override TextToCanonicalNumber and CanonicalNumberToText. Do not override the inherited Scan and Format functions.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TAdditiveNumberFormatter::TAdditiveNumberFormatter

  1. TAdditiveNumberFormatter (const THybridNumerals &)
  2. TAdditiveNumberFormatter (const TAdditiveNumberFormatter & format)
  3. TAdditiveNumberFormatter ()

Interface Category:

API.

Purpose:

  1. Creates a number formatter that uses a specific TNumerals instance to map characters to numeric values. The number formatter created by this constructor has the other characteristics of the formatter created by the default constructor.
  2. Copy constructor.
  3. Default constructor. Creates a number formatter with these characteristics: range of negative infinity to positive infinity, preceding minus sign used to indicate a negative number, no prefix or suffix displayed to indicate a positive number, and an instance of TUnicodeDecimalNumerals used to map characters to numeric values.

Calling Context:

  1. Call directly to create a number formatter using a TNumerals instance other than TUnicodeDecimalNumerals.
  2. Called to copy an object.
  3. Call directly to instantiate this class.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAdditiveNumberFormatter::~TAdditiveNumberFormatter

virtual ~ TAdditiveNumberFormatter ()

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: TAdditiveNumberFormatter::TextToCanonicalNumber

virtual void TextToCanonicalNumber (const TText &, TCanonicalNumber &, TNumberScanResult &, const TTextRange &)

Interface Category:

API.

Purpose:

During a scanning operation, converts a text string into an instance of TCanonicalNumber. The scanning function then uses a TCanonicalNumberConverter to convert the canonical number to a binary number.

Calling Context:

Called by the Scan member function when converting a text string into a numeral.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAdditiveNumberFormatter::CanonicalNumberToText

virtual void CanonicalNumberToText (const TCanonicalNumber &, TText &, TNumberFormatResult &)

Interface Category:

API.

Purpose:

During a formatting operation, converts an instance of TCanonicalNumber into a text string. The formatting function first uses a TCanonicalNumberConverter to convert the binary number into the canonical number.

Calling Context:

Called by the Format function when converting a numeral into a text string.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAdditiveNumberFormatter::operator=

TAdditiveNumberFormatter & operator =(const TAdditiveNumberFormatter &)

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: TAdditiveNumberFormatter::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: TAdditiveNumberFormatter::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 a TStandardException if the version of the formatter cannot be used on the current system.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAdditiveNumberFormatter::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Generates a hash value.

Calling Context:

Same as for base class.

Parameters:

Return Value:

The numeric value of the hash.

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.