Class: TPatternBasedDateTimeFormatter

Declaration: DateTime.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TDateTimeFormatter

Inherited By:

TGregorianDateTimeFormatter

Purpose:

Derived from TDateTimeFormatter, this class provides the abstract protocol for date/time formatters that use patterns for scanning and formatting. The pattern is specified using a set of TFormatter objects.

Instantiation:

Abstract class; do not allocate.

Deriving Classes:

Derived classes of TPatternBasedDateTimeFormatter must override the GetCalendar function to return the calendar used by the derived class.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TPatternBasedDateTimeFormatter::~TPatternBasedDateTimeFormatter

virtual ~ TPatternBasedDateTimeFormatter ()

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: TPatternBasedDateTimeFormatter::AdoptPattern

virtual void AdoptPattern (TDateTimePattern * pattern, bool perfectPattern =true)

Interface Category:

API.

Purpose:

Adopts the TDateTimePattern used by this formatter.

Calling Context:

Called to attach a pattern to the formatter.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPatternBasedDateTimeFormatter::GetPattern

virtual void GetPattern (TDateTimePattern & pattern) const

Interface Category:

API.

Purpose:

Returns the TDateTimePattern for this formatter.

Calling Context:

Called to retrieve the pattern.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPatternBasedDateTimeFormatter::operator=

TPatternBasedDateTimeFormatter & operator =(const TPatternBasedDateTimeFormatter & format)

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: TPatternBasedDateTimeFormatter::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 no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPatternBasedDateTimeFormatter::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: TPatternBasedDateTimeFormatter::TPatternBasedDateTimeFormatter

  1. TPatternBasedDateTimeFormatter ()
  2. TPatternBasedDateTimeFormatter (const TPatternBasedDateTimeFormatter & format)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators.
  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: TPatternBasedDateTimeFormatter::TimeToText

virtual void TimeToText (TCalendar & calendar, TText & text, TFormatResult & result) const

Interface Category:

API.

Purpose:

Converts the time as represented in the calendar to a textual form. It also returns the format accuracy result.

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: TPatternBasedDateTimeFormatter::TextToTime

virtual void TextToTime (const TText & text, const TTextRange & inputRange, TCalendar & calendar, TScanResult & result) const

Interface Category:

API.

Purpose:

Scans a text object and attempts to parse it into date/time information, setting the fields of a calendar accordingly. It also returns the scan accuracy result.

Calling Context:

Called during the scanning operation.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPatternBasedDateTimeFormatter::GetCalendar

virtual TCalendar * GetCalendar () const

Interface Category:

API.

Purpose:

A given formatter only works in conjunction with a particular calendar. Hence, this pure virtual function is overridden by the derived class to provide an appropriate calendar.

Calling Context:

Called by Format and Scan.

Parameters:

Return Value:

Returns the appropriate TCalendar derived class.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TPatternBasedDateTimeFormatter::SetCalendar

virtual void SetCalendar (const TCalendar & calendar)

Interface Category:

API.

Purpose:

Sets the calendar for the formatter.

Calling Context:

Called to set the calendar for the formatter.

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.