Class: TNumerals

Declaration: Numerals.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

THybridNumerals TUnicodeDecimalNumerals

Purpose:

An abstract class that is used by number formatters to perform the mappings between individual characters and numeric values.

Instantiation:

Abstract class; do not allocate.

Deriving Classes:

The system provides the derived classes TUnicodeDecimalNumerals, which provides the mappings for the standard decimal numbering system used in the Western world, and THybridNumerals. Derived classes must implement the pure virtual functions NumeralToValue and ValueToNumeral.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TNumerals::~TNumerals

virtual ~ TNumerals ()

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: TNumerals::NumeralToValue

virtual bool NumeralToValue (UniChar ch, long & value)

Interface Category:

API.

Purpose:

A pure virtual function. Converts a character into a numeric value.

Calling Context:

Called during the scanning operation.

Parameters:

Return Value:

Returns true if the character can be converted into a numeric value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TNumerals::ValueToNumeral

virtual bool ValueToNumeral (long value, UniChar & ch)

Interface Category:

API.

Purpose:

A pure virtual function that converts a numeric value into a character representation.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

Returns true if the number can be converted into a character.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TNumerals::operator=

TNumerals & operator =(const TNumerals &)

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

virtual long Hash () const

Interface Category:

API.

Purpose:

Generates a hash value.

Calling Context:

Called to generate a hash value.

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: TNumerals::GetBase

virtual short GetBase () const

Interface Category:

API.

Purpose:

Returns the base number of the numbering system handled by this TNumerals.

Calling Context:

Called by a number formatter when it sets up a TCanonicalNumberConverter.

Parameters:

Return Value:

The base number for this object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TNumerals::GetMinBase

virtual short GetMinBase () const

Interface Category:

API.

Purpose:

Gets the minimum base number this TNumerals can support. The default is 2.

Calling Context:

Called when setting a new base to verify the new value.

Parameters:

Return Value:

The minimum base number this TNumerals can support.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TNumerals::GetMaxBase

virtual short GetMaxBase () const

Interface Category:

API.

Purpose:

Gets the maximum base number this TNumerals can support. The default is 10.

Calling Context:

Called when setting a new base to verify the new value.

Parameters:

Return Value:

The maximum base number this TNumerals can support.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TNumerals::SetBase

virtual void SetBase (const short)

Interface Category:

API.

Purpose:

Sets a new base number for this TNumerals object.

Calling Context:

Called by the TNumberFormat::SetBase function and directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TStandardException if the specified base is not between the minimum and maximum base numbers for this TNumerals.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TNumerals::TNumerals

  1. TNumerals ()
  2. TNumerals (const TNumerals &)

Interface Category:

API.

Purpose:

  1. Default constructor. Sets the base number to 10 and the range of possible bases to between 2 and 10.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and by derived class constructors.
  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: TNumerals::SetMinBase

virtual void SetMinBase (const short)

Interface Category:

API.

Purpose:

Sets the minimum base number this TNumerals can handle.

Calling Context:

Called by derived class constructors to override the default setting.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TNumerals::SetMaxBase

virtual void SetMaxBase (const short)

Interface Category:

API.

Purpose:

Sets the maximum base number this TNumerals can handle.

Calling Context:

Called by derived class constructors to override the default setting.

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.