Class: TGregorianCalendar

Declaration: DateTime.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TCalendar

Inherited By:

None.

Purpose:

A concrete derived class of TCalendar. It is the default calendar used in most of the world.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

TGregorianCalendar is a concrete class designed to be used directly.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TGregorianCalendar::TGregorianCalendar

  1. TGregorianCalendar ()
  2. TGregorianCalendar (const TGregorianCalendar & GCal)

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: TGregorianCalendar::~TGregorianCalendar

~ TGregorianCalendar ()

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: TGregorianCalendar::GetLimits

virtual void GetLimits (DateTimeFieldType whichField, DateTimeFieldValue & minValue, DateTimeFieldValue & maxValue, DateTimeFieldValue & smallestMaxValue) const

Interface Category:

API.

Purpose:

Returns the range of valid values for a given field. Also returns the smallest maximal value possible. For example, for the month field, the valid range is (1,31); the smallest maximal value is 28.

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: TGregorianCalendar::operator=

TGregorianCalendar & operator =(const TGregorianCalendar & calendar)

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: TGregorianCalendar::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: TGregorianCalendar::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: TGregorianCalendar::DaysToDate

virtual void DaysToDate (DateTimeFieldValue days)

Interface Category:

API.

Purpose:

Converts the number of days into era, year, month, and day, and sets these fields in this calendar.

Calling Context:

Called internally by SetTime.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGregorianCalendar::DateToDays

virtual DateTimeFieldValue DateToDays () const

Interface Category:

API.

Purpose:

Converts the era, year, month, and day fields into a number of days, and returns this value.

Calling Context:

Called internally by GetTime.

Parameters:

Return Value:

Returns an integral number of days.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGregorianCalendar::IsValidDate

virtual bool IsValidDate (DateTimeFieldType & badField) const

Interface Category:

API.

Purpose:

Determines if the fields in the calendar are consistent with each other. Returns the first invalid field found.

Calling Context:

Called internally by SetField.

Parameters:

Return Value:

Returns true if all fields are valid.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGregorianCalendar::ClearConflictingFields

virtual void ClearConflictingFields (DateTimeFieldType whichField)

Interface Category:

API.

Purpose:

Clears fields that are in conflict with the field just set. For example, when trying to set kDayInYear in a Gregorian calendar, the conflicting fields to clear are: kDayInMonth, kMonthInYear, kWeekInYear, and kDayInWeek, because just kDayInYear is good enough to uniquely specify a day.

Calling Context:

Called internally by SetField and RollField.

Parameters:

Return Value:

None.

Exceptions:

Throws an exception if whichField is out of bounds.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGregorianCalendar::BoundFieldToLimit

virtual void BoundFieldToLimit (DateTimeFieldType whichField)

Interface Category:

API.

Purpose:

This function binds the value in a particular field to its closest limit. For example, if the field value is greater than the maximum allowed, it is changed to the maximal value.

Calling Context:

Called internally by the field-changing public functions SetField, RollField, and ShiftField.

Parameters:

Return Value:

None.

Exceptions:

Throws an exception if whichField is out of bounds.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGregorianCalendar::ResolveConflictingFields

virtual void ResolveConflictingFields ()

Interface Category:

API.

Purpose:

Called by the public field manipulation functions to resolve conflicting values. For example, the user might have set the month to 4 and the day to 31. The resolution scheme it provides is based on field priority (see GetFieldPriority).

Calling Context:

Called internally by SetField, RollField, and ShiftField.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGregorianCalendar::GetFieldPriority

virtual DateTimeFieldPriority GetFieldPriority (DateTimeFieldType whichField) const

Interface Category:

API.

Purpose:

Returns the priority for a given field where the highest priority has a value of zero. The priority is used in resolving conflicting fields.

Calling Context:

Called internally by SetField and RollField.

Parameters:

Return Value:

The field priority.

Exceptions:

Throws an exception if whichField is out of bounds.

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.