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.
- TFloatingPointNumberFormatter ()
- TFloatingPointNumberFormatter (EMantissaType mantissaType, EShowBaseType showBase =kDontShowBase)
- TFloatingPointNumberFormatter (const TFloatingPointNumberFormatter & format)
Interface Category:
API.
Purpose:
- 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.
- Constructs a number formatter with the specified mantissa type and base display.
- Copy constructor.
Calling Context:
- Called by the stream-in operators and directly to instantiate this class.
- Called to construct a number formatter with the specified mantissa type and base display.
- Called to copy an object.
Parameters:
- Takes no parameters.
- EMantissaType mantissaType -The mantissa type for this formatter.
- EShowBaseType showBase =kDontShowBase -Whether or not to display the base for this formatter.
- const TFloatingPointNumberFormatter & format -The object to copy.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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.
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:
- const TText & -Contains the text string to scan.
- TCanonicalNumber & -Receives the canonical number produced by the conversion.
- TNumberScanResult & -Receives information about the result of the scanning operation.
- const TTextRange & -Specifies the range of the text string to scan.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- const TCanonicalNumber & -Specifies the canonical number to convert.
- TText & -Receives the text string produced by the conversion.
- TNumberFormatResult & -Receives information about the result of the formatting operation.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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.
TDigitCount GetNumberOfDecimalPlacesToShow (double d)
Interface Category:
API.
Purpose:
Gets the number of decimal places to display.
Calling Context:
Calling during the formatting operation.
Parameters:
- double d -The number to format.
Return Value:
The number of decimal places to display.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- TText & -The text string used to separate the left (integer) value from the right (fractional) value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- const TText & -The text string used to separate the left (integer) value from the right (fractional) value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- bool -Set to true to always display the decimal separator.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- bool -Set to true if the digit group separator should be displayed within the fractional part of the value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- TText & -Receives the text string used to separate the mantissa value from the exponent value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- const TText & -The text string to be used to separate the mantissa value from the exponent value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- TDigitCount -The minimum number of digits to display in the fractional part of the value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- TDigitCount -The maximum number of digits to display in the fractional part of the value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- TDigitCount -The number of digits to display to the left of the decimal separator when using exponential notation.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- double -The upper limit of the range within which numbers are formatted using decimal notation.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- double -The lower limit of the range within which numbers are formatted using decimal notation.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
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:
- EShowBaseType -Indicates kShowBase or kDontShowBase.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- TStyleSet & -The style set used when formatting the exponent value into a text string.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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:
- const TStyleSet & -The style set to use when formatting the exponent value into a text string.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
virtual TStream & operator >>=(TStream & toWhere) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & toWhere -The stream the object is streamed out to.
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.
virtual TStream & operator <<= (TStream & fromWhere)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & fromWhere -The stream the object is streamed in from.
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.
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.
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.
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.
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.
virtual void SetMantissaType (EMantissaType)
Interface Category:
API.
Purpose:
Sets the mantissa type of the formatter.
Calling Context:
Called by client.
Parameters:
- EMantissaType -Enum which specifies whether the mantissa is less than one (kLessThanOne) or less than ten (kLessThanTen).
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.