Class: TFloatingPointNumberFormatter

Declaration: NumberFormat.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TPositionalNumberFormatter

Inherited By:

TUniversalNumberFormatter

Purpose:

This class, derived from TPositionalNumberFormatter, handles floating point numbers.

Instantiation:

Always allocate on the heap.

Deriving Classes:

Derived classes must override the TextToCanonicalNumber and CanonicalNumberToText functions. The system provides derived class TUniversalNumberFormatter.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TFloatingPointNumberFormatter::TFloatingPointNumberFormatter

  1. TFloatingPointNumberFormatter ()
  2. TFloatingPointNumberFormatter (EMantissaType mantissaType, EShowBaseType showBase =kDontShowBase)
  3. TFloatingPointNumberFormatter (const TFloatingPointNumberFormatter & format)

Interface Category:

API.

Purpose:

  1. Default constructor. Creates a formatter with these characteristics: uses a TGeneralPunctuation::kFullStop as the decimal separator and a TLatin::KCapitalLetterE as the exponent separator; formats numbers less than 1E-6 or greater than 1E+6 using scientific notation and number within that range using decimal notation; displays a minimum of 0 and a maximum of 6 digits within the fractional part of the value; does not display the decimal separator with an integer value; does not display the digit group separator within the fractional part of the value, displays an unstyled exponent; and uses a TUnicodeDecimalNumerals object for mapping characters to values.
  2. Constructs a number formatter with the specified mantissa type and base display.
  3. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and directly to instantiate this class.
  2. Called to construct a number formatter with the specified mantissa type and base display.
  3. 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: TFloatingPointNumberFormatter::~TFloatingPointNumberFormatter

virtual ~ TFloatingPointNumberFormatter ()

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: TFloatingPointNumberFormatter::SetUpCanonicalNumberConverter

virtual void SetUpCanonicalNumberConverter ()

Interface Category:

API.

Purpose:

Sets up the canonical number converter for use in converting between binary numbers and text.

Calling Context:

Called by conversion functions.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::TextToCanonicalNumber

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

Interface Category:

API.

Purpose:

During a scanning operation, converts a text string into a TCanonicalNumber object. 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: TFloatingPointNumberFormatter::CanonicalNumberToText

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

Interface Category:

API.

Purpose:

During a formatting operation, converts a TCanonicalNumber object 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: TFloatingPointNumberFormatter::CanonicalNumberToExponentText

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

Interface Category:

API.

Purpose:

Converts a canonical number into a text string using exponential notation.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::CanonicalNumberToDecimalText

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

Interface Category:

API.

Purpose:

Converts a canonical number into a text string using exponential notation.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetNumberOfDecimalPlacesToShow

TDigitCount GetNumberOfDecimalPlacesToShow (double d)

Interface Category:

API.

Purpose:

Gets the number of decimal places to display.

Calling Context:

Calling during the formatting operation.

Parameters:

Return Value:

The number of decimal places to display.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetDecimalSeparator

virtual void GetDecimalSeparator (TText &) const

Interface Category:

API.

Purpose:

Gets the text string used to separate the left (integer) value from the right (fractional) value.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetDecimalSeparator

virtual void SetDecimalSeparator (const TText &)

Interface Category:

API.

Purpose:

Sets the text string used to separate the left (integer) value from the right (fractional) value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetDecimalWithInteger

virtual bool GetDecimalWithInteger () const

Interface Category:

API.

Purpose:

Queries whether this formatter is set to display the decimal separator when the number is an integer value.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

Returns true if the decimal separator should be displayed when the number is an integer value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetDecimalWithInteger

virtual void SetDecimalWithInteger (bool)

Interface Category:

API.

Purpose:

Specifies whether this formatter should display the decimal separator when the number is an integer value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetFractionSeparator

virtual bool GetFractionSeparator () const

Interface Category:

API.

Purpose:

Queries whether this number formatter is set to display the digit group separator within the fractional part of the value.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

Returns true if this number formatter is set to display the digit group separator within the fractional part of the value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetFractionSeparator

virtual void SetFractionSeparator (bool)

Interface Category:

API.

Purpose:

Specifies whether the digit group separator should be displayed within the fractional part of the value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetExponentSeparatorText

virtual void GetExponentSeparatorText (TText &) const

Interface Category:

API.

Purpose:

Gets the text string used to separate the mantissa value from the exponent value.

Calling Context:

Called during the formatting and scanning operation.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetExponentSeparatorText

virtual void SetExponentSeparatorText (const TText &)

Interface Category:

API.

Purpose:

Sets the text string used to separate the mantissa value from the exponent value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetMinFractionDigits

virtual TDigitCount GetMinFractionDigits () const

Interface Category:

API.

Purpose:

Gets the minimum number of digits to display in the fractional part of the value.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

Returns TDigitCount (unsigned short), which specifies the minimum number of digits to display in the fractional part of the value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetMinFractionDigits

virtual void SetMinFractionDigits (TDigitCount)

Interface Category:

API.

Purpose:

Sets the minimum number of digits to display in the fractional part of the value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetMaxFractionDigits

virtual TDigitCount GetMaxFractionDigits () const

Interface Category:

API.

Purpose:

Gets the maximum number of digits to display in the fractional part of the value.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

The maximum number of digits to display in the fractional part of the value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetMaxFractionDigits

virtual void SetMaxFractionDigits (TDigitCount)

Interface Category:

API.

Purpose:

Sets the maximum number of digits to display in the fractional part of the value.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetExponentPhase

virtual TDigitCount GetExponentPhase () const

Interface Category:

API.

Purpose:

Gets the number of digits to display to the left of the decimal separator when using exponential notation; for example, this is equal to 1 for standard scientific notation.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

The number of digits to display to the left of the decimal separator when using exponential notation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetExponentPhase

virtual void SetExponentPhase (TDigitCount)

Interface Category:

API.

Purpose:

Sets the number of digits to display to the left of the decimal separator when using exponential notation.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetUpperExponentThreshold

virtual double GetUpperExponentThreshold () const

Interface Category:

API.

Purpose:

Gets the upper limit of the range within which numbers are formatted using decimal notation; above this limit exponential notation is used.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

The upper limit of the range within which numbers are formatted using decimal notation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetUpperExponentThreshold

virtual void SetUpperExponentThreshold (double)

Interface Category:

API.

Purpose:

Sets the upper limit of the range within which numbers are formatted using decimal notation; above this limit exponential notation is used.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetLowerExponentThreshold

virtual double GetLowerExponentThreshold () const

Interface Category:

API.

Purpose:

Gets the lower limit of the range within which numbers are formatted using decimal notation; below this limit exponential notation is used.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

The lower limit of the range within which numbers are formatted using decimal notation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetLowerExponentThreshold

virtual void SetLowerExponentThreshold (double)

Interface Category:

API.

Purpose:

Sets the lower limit of the range within which numbers are formatted using decimal notation; below this limit exponential notation is used.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetShowBaseType

virtual EShowBaseType GetShowBaseType () const

Interface Category:

API.

Purpose:

Queries whether the formatter is set to include the base number when formatting using exponential notation.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

Returns an EShowBaseType value indicating whether the formatter is set to include the base number when formatting using exponential notation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetShowBaseType

virtual void SetShowBaseType (EShowBaseType)

Interface Category:

API.

Purpose:

Specifies whether the formatter should include the base number when formatting using exponential notation.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetExponentStyle

virtual void GetExponentStyle (TStyleSet &) const

Interface Category:

API.

Purpose:

Gets the style set used when formatting the exponent value into a text string.

Calling Context:

Called during the formatting operation.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetExponentStyle

virtual void SetExponentStyle (const TStyleSet &)

Interface Category:

API.

Purpose:

Sets the style set to use when formatting the exponent value into a text string.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::operator=

TFloatingPointNumberFormatter & operator =(const TFloatingPointNumberFormatter &)

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: TFloatingPointNumberFormatter::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: TFloatingPointNumberFormatter::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: TFloatingPointNumberFormatter::IsEqual

virtual bool IsEqual (const MCollectible * obj) const

Interface Category:

API.

Purpose:

Compares two objects for equality.

Calling Context:

Called to compare compatible objects.

Parameters:

Return Value:

Returns true if the objects match.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::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: TFloatingPointNumberFormatter::GetDecimalSeparatorIterator

TTextIterator * GetDecimalSeparatorIterator () const

Interface Category:

API.

Purpose:

Gets the text iterator of the text string used to separate the left (integer) value from the right (fractional) value.

Calling Context:

Called during the scanning operation.

Parameters:

Return Value:

The pointer to the text iterator of the text string used to separate the left (integer) value from the right (fractional) value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetExponentSeparatorIterator

TTextIterator * GetExponentSeparatorIterator () const

Interface Category:

API.

Purpose:

Gets the text iterator of the text string used to separate the numeral value from the exponent value.

Calling Context:

Called during the scanning operation.

Parameters:

Return Value:

The pointer to the text iterator of the text string used to separate the numeral value from the exponent value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::SetMantissaType

virtual void SetMantissaType (EMantissaType)

Interface Category:

API.

Purpose:

Sets the mantissa type of the formatter.

Calling Context:

Called by client.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TFloatingPointNumberFormatter::GetMantissaType

virtual EMantissaType GetMantissaType () const

Interface Category:

API.

Purpose:

Gets the mantissa type of the formatter.

Calling Context:

Called by client.

Parameters:

Return Value:

The enum value specifying the mantissa type.

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.