Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
MCollectible
Inherited By:
TChoiceFormatter
TDateTimeFormatter
TNumberFormatter
TParameterFormatter
TSimpleTextFormatter
Purpose:
Abstract base class for formatters (objects that perform conversions between text and binary data). Each TFormatter can format the derived classes of a given TFormattable class.
A main usage of TFormatter is by TParameterFormatter, which can format text roughly like sprintf.
Instantiation:
Abstract class; do not allocate.
Deriving Classes:
This is the base class all other formatters should derive from. Derived classes must provide the following functions: Format, Scan, CreateFormattable, CreateScanResult, and CreateFormatResult.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
virtual ~ TFormatter ()
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: TFormatter::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: TFormatter::operator>>=
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.
Member Function: TFormatter::operator<<=
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 no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TFormatter::Format
virtual void Format (const TFormattable & value, TText & text, TFormatResult & conversionResult) const
Interface Category:
API.
Purpose:
Given a value, encapsulated by an object of a TFormattable class, returns formatted text.
Calling Context:
Call this function directly.
Parameters:
- const TFormattable & value -The value to format.
- TText & text -Receives the formatted text.
- TFormatResult & conversionResult -Receives information about the accuracy of the formatting operation.
Return Value:
None.
Exceptions:
TFormatter derived classes throw an exception if the wrong type of TFormattable is passed in.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TFormatter::Scan
virtual void Scan (const TText & text, const TTextRange & inputRange, TFormattable & value, TScanResult & conversionResult) const
Interface Category:
API.
Purpose:
Given a text object, scans and parses it to return a value.
Calling Context:
Call this function directly.
Parameters:
- const TText & text -The input text to scan.
- const TTextRange & inputRange -The range of text to scan.
- TFormattable & value -Receives the resulting time value.
- TScanResult & conversionResult -Receives information about the accuracy of the scanning operation.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TFormatter::CreateFormattable
virtual TFormattable * CreateFormattable () const
Interface Category:
API.
Purpose:
Creates the formattable used by this formatter.
Calling Context:
Called by the Scan function.
Parameters:
Return Value:
Returns a TFormattable object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TFormatter::CreateScanResult
virtual TScanResult * CreateScanResult () const
Interface Category:
API.
Purpose:
Creates an object of the TScanResult class used by this formatter.
Calling Context:
Called by the Scan function.
Parameters:
Return Value:
Returns a TScanResult object. The caller owns the storage.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TFormatter::CreateFormatResult
virtual TFormatResult * CreateFormatResult () const
Interface Category:
API.
Purpose:
Creates an object of the TFormatResult class used by this formatter.
Calling Context:
Called by the Format function.
Parameters:
Return Value:
Returns a TFormatResult object. The caller owns the storage.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
- TFormatter ()
- TFormatter (const TFormatter &)
Interface Category:
API.
Purpose:
- Default constructor.
- Copy constructor.
Calling Context:
- Called by the stream-in operators.
- Called to copy an object.
Parameters:
- Takes no parameters.
- const TFormatter & -The object to copy.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TFormatter::operator=
TFormatter & operator =(const TFormatter &)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
- const TFormatter & -The source object for the assignment.
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.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.