Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TAdditiveNumberFormatter
Inherited By:
None.
Purpose:
This class, derived from TAdditiveNumberFormatter, handles Roman numerals.
Instantiation:
Always allocate on the heap.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
TRomanNumberFormatter creates and stores THybridNumerals instances mapping numeric values to either upper or lowercase characters.
- TRomanNumberFormatter (ERomanNumeralCase theCase, ERomanNumeralType theType =kNormalShort4Long8)
- TRomanNumberFormatter ()
- TRomanNumberFormatter (const TRomanNumberFormatter & format)
Interface Category:
API.
Purpose:
- Creates a Roman number formatter that formats numbers into the case and type specified. The formatter created by this constructor has the other characteristics of the default Roman number formatter.
- Default constructor. Creates a formatter with these characteristics: formats the range of numbers from 0 to 10,000, formats into uppercase text, uses the kNormalShort4Long8 system, and does not terminate numerals with the character J.
- Copy constructor.
Calling Context:
- Call directly to instantiate this class to create a formatter that uses a different case or type than the default formatter.
- Call directly to instantiate this class.
- Called to copy an object.
Parameters:
- ERomanNumeralCase theCase -Specifies the case to convert numbers into during conversion to text.
- ERomanNumeralType theType =kNormalShort4Long8 -Specifies the variation of the Roman numbering system to use when formatting.
- Takes no parameters.
- const TRomanNumberFormatter & format -Specifies the object to copy.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
The Roman numbering system is typically only used to represent positive numbers.
virtual ~ TRomanNumberFormatter ()
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 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:
- 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 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:
- 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.
ERomanNumeralType GetRomanNumeralType () const
Interface Category:
API.
Purpose:
Queries which variation of the Roman numbering system is being used when converting numerals into text.
Calling Context:
Call directly to access this information. Called by formatting functions.
Parameters:
Return Value:
The ERomanNumeralType enum value identifying the variation of the Roman numbering system being used.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
void SetRomanNumeralType (ERomanNumeralType)
Interface Category:
API.
Purpose:
Sets which variation of the Roman numbering system the formatter uses when converting numerals into text.
Calling Context:
Call directly to change the current case setting.
Parameters:
- ERomanNumeralType -Enum value specifying the type of numeral to use.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
ERomanNumeralCase GetRomanNumeralCase () const
Interface Category:
API.
Purpose:
Queries which case, upper or lower, is being used when converting numerals into text.
Calling Context:
Call directly to access this information.
Parameters:
Return Value:
The ERomanNumeralCase enum value identifying the case being used.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
void SetRomanNumeralCase (ERomanNumeralCase)
Interface Category:
API.
Purpose:
Sets which case, upper or lower, is used when the formatter converts numbers into text.
Calling Context:
Call directly to change the current setting.
Parameters:
- ERomanNumeralCase -Enum value specifying whether to use upper or lowercase text.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
bool GetTerminatesWithJ () const
Interface Category:
API.
Purpose:
Queries whether the formatter is set to use the character I or J as the last character in a number during conversion to text.
Calling Context:
Call directly to access this information.
Parameters:
Return Value:
Returns true if the formatter is set to terminate numbers with the character J.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
void SetTerminatesWithJ (const bool)
Interface Category:
API.
Purpose:
Sets the formatter to either terminate numerals with the character J or with the character I.
Calling Context:
Call directly to change the current setting.
Parameters:
- const bool -Pass in true to set the formatter to terminate numerals with the character J, or false to terminate numerals with the character I.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
TRomanNumberFormatter & operator =(const TRomanNumberFormatter &)
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 streams itself 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 streams itself 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:
Sane as MCollectible function.
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:
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.