C12Adapter Opensource C++ Interface
MTimeRecurrentYearly Class Reference

Yearly recurrent date. More...

Inheritance diagram for MTimeRecurrentYearly:

Public Types

enum  OffsetType {
  OffsetNo = 0,
  OffsetWeekdayBefore = 1,
  OffsetWeekdayFirstAfter = 2,
  OffsetWeekdaySecondAfter = 3,
  OffsetWeekdayThirdAfter = 4,
  OffsetWeekdayFourthAfter = 5,
  OffsetWeekdayLastAfter = 6,
  OffsetObserveOnThisAndFollowingDate = 7,
  OffsetMondayIfSunday = 8,
  OffsetFridayIfSunday = 9,
  OffsetMondayIfSaturday = 10,
  OffsetFridayIfSaturday = 11,
  OffsetMondayIfSaturdayOrSunday = 12,
  OffsetFridayIfSaturdayOrSunday = 13,
  OffsetMondayIfSundayFridayIfSaturday = 14,
  OffsetObserveOnFollowingDate = 15
}
 Type of the offset, which needs to be applied to modify anchor event. More...
 

Public Member Functions

 MTimeRecurrentYearly ()
 Default constructor, recurrent time, which is midnight of the New Year. More...
 
 MTimeRecurrentYearly (OffsetType offsetType, MTime::MonthType month, int dayOfMonth=1, int hour=0, int minute=0)
 Constructor for day-based yearly time. More...
 
 MTimeRecurrentYearly (OffsetType offsetType, MTime::MonthType month, int dayOfMonth, int hour, int minute, MTime::DayOfWeekType weekday)
 Constructor for weekday-based yearly time. More...
 
 MTimeRecurrentYearly (const MTimeRecurrentYearly &other)
 Copy constructor, creates the current timezone from a copy given. More...
 
virtual ~MTimeRecurrentYearly ()
 Object destructor.
 
MTimeRecurrentYearlyoperator= (const MTimeRecurrentYearly &other)
 Assignment operator, assigns recurrent time to another.
 
bool operator== (const MTimeRecurrentYearly &other) const
 Equality test binary operator. More...
 
bool operator!= (const MTimeRecurrentYearly &other) const
 Inequality test binary operator. More...
 
bool IsDayOfWeekIgnored () const
 Returns whether the recurrent time will ignore the day of week property due to offset type.
 
void SetOnDay (OffsetType offsetType, MTime::MonthType month, int dayOfMonth, int hour=0, int minute=0)
 Set all the parameters of the recurrent day in a single call. More...
 
void SetOnWeekday (OffsetType offsetType, MTime::MonthType month, int dayOfMonth, int hour, int minute, MTime::DayOfWeekType weekday)
 Set all the parameters of the recurrent day into weekday-based yearly time. More...
 
void SetUnchecked (OffsetType offsetType, MTime::MonthType month, int day, int hours=0, int minutes=0, int seconds=0, MTime::DayOfWeekType weekday=MTime::WeekdaySunday)
 Set all the parameters of the recurrent yearly time in a single call. More...
 
virtual MTime GetPertinent (const MTime &) const
 Get the time event pertinent to a given time period. More...
 
MTime GetPertinentForYear (int year) const
 Get the time event pertinent to a given year. More...
 
virtual void CheckIsValid () const
 Checks whether the recurrent date is valid, and whether all its values are within their proper range. More...
 
virtual void SetToNull ()
 Set this recurring time to null value, signifying that there is no recurrence defined. More...
 
virtual bool IsNull () const
 Returns whether this recurring time is a null time, a special value, which tells that the recurring time is not initialized. More...
 
virtual MVariant NewClone () const
 Create a reflection-enabled clone of the recurring date. More...
 
virtual unsigned GetEmbeddedSizeof () const
 Recurrent time is an embedded object type, therefore return its size in bytes. More...
 
OffsetType GetOffsetType () const
 
void SetOffsetType (OffsetType type)
 
MTime::MonthType GetMonth () const
 
void SetMonth (MTime::MonthType month)
 
int GetDayOfMonth () const
 
void SetDayOfMonth (int day)
 
MTime::DayOfWeekType GetDayOfWeek () const
 
void SetDayOfWeek (MTime::DayOfWeekType weekday)
 
int GetHours () const
 
void SetHours (int hours)
 
int GetMinutes () const
 
void SetMinutes (int minutes)
 
int GetSeconds () const
 
void SetSeconds (int seconds)
 
- Public Member Functions inherited from MTimeRecurrent
virtual ~MTimeRecurrent ()
 Class destructor.
 
MTimeRecurrentoperator= (const MTimeRecurrent &)
 Assignment operator.
 
bool IsValid () const
 Tells whether the recurrent date is valid, whether it has a proper range of all its values.
 
void CheckIfNotNull () const
 Throw an exception if the recurrent time is null.
 
- Public Member Functions inherited from MObject
virtual ~MObject ()
 Object destructor.
 
virtual const MClassGetClass () const =0
 Get the final class of the object. More...
 
bool IsEmbeddedObject () const
 Tell if the object is of embedded kind. More...
 
SHOW_INTERNAL MVariant Call (const MStdString &name, const MVariant &params)
 Call the object service with parameters, given as variant. More...
 
MVariant Call0 (const MStdString &name)
 Call the object service with no parameters. More...
 
MVariant Call1 (const MStdString &name, const MVariant &p1)
 Call the object service with one parameter. More...
 
MVariant Call2 (const MStdString &name, const MVariant &p1, const MVariant &p2)
 Call the object service with two parameter. More...
 
MVariant Call3 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3)
 Call the object service with three parameter. More...
 
MVariant Call4 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4)
 Call the object service with four parameter. More...
 
MVariant Call5 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5)
 Call the object service with five parameter. More...
 
MVariant Call6 (const MStdString &name, const MVariant &p1, const MVariant &p2, const MVariant &p3, const MVariant &p4, const MVariant &p5, const MVariant &p6)
 Call the object service with six parameter. More...
 
virtual MVariant CallV (const MStdString &name, const MVariant::VariantVector &params)
 Call the object service with parameters, given as variant vector. More...
 
virtual bool IsPropertyPresent (const MStdString &name) const
 Tell if the property with the given name exists.
 
virtual bool IsServicePresent (const MStdString &name) const
 Tell if the service with the given name exists.
 
virtual MVariant GetProperty (const MStdString &name) const
 Get the property value using name of the property. More...
 
virtual void SetProperty (const MStdString &name, const MVariant &value)
 Set the property using name of the property, and value. More...
 
virtual MStdStringVector GetAllPropertyNames () const
 Return the list of publicly available properties, persistent or not. More...
 
virtual MStdStringVector GetAllPersistentPropertyNames () const
 Return the list of persistent properties. More...
 
virtual void SetPersistentPropertiesToDefault ()
 Set the persistent properties of the object to their default values. More...
 
virtual MVariant GetPersistentPropertyDefaultValue (const MStdString &name) const
 Get the default value of persistent property with the name given. More...
 
virtual void SetPersistentPropertyToDefault (const MStdString &name)
 Set the persistent property with the name given to default value. More...
 
virtual const char * GetType () const
 Get the name of the type for the object (could be the same as class name).
 
virtual void SetType (const MStdString &)
 Intentionally, it will set the name of the type for the object, but the service will not allow setting the name to anything other than the current name. More...
 
virtual void Validate ()
 Validate internal structures of the object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from MObject
static const MClassGetStaticClass ()
 Get the declared class of this particular object. More...
 
static bool IsClassPresent (const MStdString &name)
 Tells if the given class name is available. More...
 
- Static Public Attributes inherited from MObject
static const MClass s_class
 Class of MObject.
 
- Protected Member Functions inherited from MTimeRecurrent
 MTimeRecurrent ()
 Default constructor. More...
 
 MTimeRecurrent (const MTimeRecurrent &)
 Copy constructor, creates the current timezone from a copy given. More...
 
- Protected Member Functions inherited from MObject
 MObject ()
 Object constructor, protected as the class is abstract.
 
void DoSetPersistentPropertiesToDefault (const MClass *staticClass)
 Set the persistent properties to their default values for one object provided the class for that object. More...
 

Detailed Description

Yearly recurrent date.

The date is set by an anchor date in a year, denoted by Month and Day in that month, time of the event, determined as an hour, a minute and a second.

The holiday schedule is not taken into consideration in date transformation. Also, possibility of overlapping dates, their possible merges or rearrangements is not defined. All calculations are performed in either standard time or in UTC, depending on the context. The user shall account for possible DST shift by oneself.

There is also an offset type, which determines what to do with the anchor date, whether it has to be modified at some condition.

There is a subtype of offset type, which also requires setting of a day in a week. One type sets the date of occurrence by a day in a month, like first day in month. Another type sets a certain weekday after the , like second Wednesday in January. For both major subtypes one can set modifiers, all determined by OffsetType. The type itself is wholly determined by a modifier.

When a type changes between day-of-the-month-based and day-of-the-week-based by modifying the value of OffsetType, the Day or Weekday properties morph into each other. Because of it, it is safe to set Day and Weekday properties explicitly after assignment to OffsetType. It is not correct to access a weekday property of a day of the month recurring time, or access a day property of a weekday-based recurring time.

Member Enumeration Documentation

Type of the offset, which needs to be applied to modify anchor event.

This is used only for Yearly and Monthly anchor types.

Enumerator
OffsetNo 

No offset from anchor, the date is set explicitly.

OffsetWeekdayBefore 

The anchor date is the given weekday before the anchor, or the anchor itself if the weekday matched.

OffsetWeekdayFirstAfter 

First weekday on, or after the anchor.

OffsetWeekdaySecondAfter 

Second weekday on, or after the anchor.

OffsetWeekdayThirdAfter 

Third weekday on, or after the anchor.

OffsetWeekdayFourthAfter 

Fourth weekday on, or after the anchor.

OffsetWeekdayLastAfter 

Last weekday on, or after the anchor.

OffsetObserveOnThisAndFollowingDate 

Observe on date entered as well as on day following date entered.

OffsetMondayIfSunday 

Shift to Monday if the day is Sunday.

OffsetFridayIfSunday 

Shift to Friday if the day is Sunday.

OffsetMondayIfSaturday 

Shift to Monday if the day is Saturday.

OffsetFridayIfSaturday 

Shift to Friday if the day is Saturday.

OffsetMondayIfSaturdayOrSunday 

Shift to Monday if Sunday or Saturday.

OffsetFridayIfSaturdayOrSunday 

Shift to Friday if Sunday or Saturday.

OffsetMondayIfSundayFridayIfSaturday 

Postpone to Monday if Sunday, advance to Friday if Saturday.

OffsetObserveOnFollowingDate 

Do not observe date entered. Observe on day following date entered.

Constructor & Destructor Documentation

MTimeRecurrentYearly::MTimeRecurrentYearly ( )
inline

Default constructor, recurrent time, which is midnight of the New Year.

All fields of such object are zero, which corresponds to yearly recurrent event at January 1, 00:00.

MTimeRecurrentYearly::MTimeRecurrentYearly ( OffsetType  offsetType,
MTime::MonthType  month,
int  dayOfMonth = 1,
int  hour = 0,
int  minute = 0 
)
inline

Constructor for day-based yearly time.

A weekday parameter can be ignored for some recurring offset types.

Parameters
offsetTypeCorrespondent enumeration value.
monthMonth of the recurring date.
dayOfMonthDay of the recurring date in the month.
hourHour of the recurring date.
minuteMinute of the recurring date.
Precondition
The given value shall comprise of a valid yearly recurrent date-based time, or an exception is thrown.
MTimeRecurrentYearly::MTimeRecurrentYearly ( OffsetType  offsetType,
MTime::MonthType  month,
int  dayOfMonth,
int  hour,
int  minute,
MTime::DayOfWeekType  weekday 
)
inline

Constructor for weekday-based yearly time.

Parameters
offsetTypeCorrespondent enumeration value.
monthMonth of the recurring date.
dayOfMonthDay of the recurring date in the month.
hourHour of the recurring date.
minuteMinute of the recurring date.
weekdayWeek day enumeration.
Precondition
The given value shall comprise of a valid yearly recurrent date-based time, or an exception is thrown.
MTimeRecurrentYearly::MTimeRecurrentYearly ( const MTimeRecurrentYearly other)
inline

Copy constructor, creates the current timezone from a copy given.

If a copy of the current timezone is made, it will no longer be automatically updated from the computer. Instead, it will stay the same as it was during time the constructor was called.

Member Function Documentation

virtual void MTimeRecurrentYearly::CheckIsValid ( ) const
virtual

Checks whether the recurrent date is valid, and whether all its values are within their proper range.

Precondition
An error is thrown if the given recurring date is invalid.

Implements MTimeRecurrent.

int MTimeRecurrentYearly::GetDayOfMonth ( ) const

Set the anchor day of the month parameter for the recurring time. For many recurring date types this is 1, first day in the month of interest.

Precondition
The given value shall be in range 1 to 31. The month is not checked whether the date exists for such month. This is done to allow setting the date prior to month.
MTime::DayOfWeekType MTimeRecurrentYearly::GetDayOfWeek ( ) const

The anchor day of the month parameter for the recurring time. For many recurring date types this is 1, first day in the month of interest.

Precondition
The property value shall be in range 1 to 31. The month is not checked whether the date exists for such month. This is done to allow setting the date prior to month. The current event shall be the day of the month time. Otherwise an exception is thrown.
virtual unsigned MTimeRecurrentYearly::GetEmbeddedSizeof ( ) const
virtual

Recurrent time is an embedded object type, therefore return its size in bytes.

Returns
size of MTimeRecurrentYearly in bytes.

Reimplemented from MObject.

int MTimeRecurrentYearly::GetHours ( ) const

Hours within the day when the recurring event shall happen. Zero will mean the beginning of the day, midnight.

Precondition
The given value shall be in range 0 to 23.
int MTimeRecurrentYearly::GetMinutes ( ) const

Minute within the day when the recurring event shall happen. Zero will mean the beginning of the hour.

Precondition
The given value shall be in range 0 to 59.
MTime::MonthType MTimeRecurrentYearly::GetMonth ( ) const

Month parameter for the recurring time.

Precondition
The given value shall be in range 1 to 12, defined by MDate::Month, or an exception is thrown.
OffsetType MTimeRecurrentYearly::GetOffsetType ( ) const

The offset type for this yearly recurring event. The offset type tells what to do with the event if it falls to a holiday, etc. Look at OffsetType enumeration for features.

virtual MTime MTimeRecurrentYearly::GetPertinent ( const MTime ) const
virtual

Get the time event pertinent to a given time period.

The returned time will use a given time as a hint to return the moment, which represents this recurrent event. The time given is expected to be in UTC or Standard, and the the recurring moment will be in the correspondent UTC or standard time.

For example, in case of a yearly recurring event, a given time is used to extract a year, for which the event shall be returned.

See also
GetPertinentForYear - method more specific for yearly recurrent time that only takes a year

Implements MTimeRecurrent.

MTime MTimeRecurrentYearly::GetPertinentForYear ( int  year) const

Get the time event pertinent to a given year.

The time given is expected to be in UTC or Standard, and the the recurring moment will be in the correspondent UTC or standard time.

See also
GetPertinent - generic method that fits behaviors of all recurrent time types
int MTimeRecurrentYearly::GetSeconds ( ) const

Seconds within the day when the recurring event shall happen. Zero will mean the beginning of the minute.

Precondition
The given value shall be in range 0 to 59.
virtual bool MTimeRecurrentYearly::IsNull ( ) const
virtual

Returns whether this recurring time is a null time, a special value, which tells that the recurring time is not initialized.

This implementation overrides the pure virtual defined in the base class.

Precondition
The object has to be valid, or an exception is thrown.

Implements MTimeRecurrent.

virtual MVariant MTimeRecurrentYearly::NewClone ( ) const
virtual

Create a reflection-enabled clone of the recurring date.

Variant returned has a recurring date embedded it it, one which shall not be deleted because it does not allocate memory outside of variant.

Implements MTimeRecurrent.

bool MTimeRecurrentYearly::operator!= ( const MTimeRecurrentYearly other) const
inline

Inequality test binary operator.

Two recurrent times are not equal if any of their rules are not equal.

bool MTimeRecurrentYearly::operator== ( const MTimeRecurrentYearly other) const
inline

Equality test binary operator.

Two recurrent times are equal if all their rules are equal.

void MTimeRecurrentYearly::SetDayOfMonth ( int  day)

Set the anchor day of the month parameter for the recurring time. For many recurring date types this is 1, first day in the month of interest.

Precondition
The given value shall be in range 1 to 31. The month is not checked whether the date exists for such month. This is done to allow setting the date prior to month.
void MTimeRecurrentYearly::SetDayOfWeek ( MTime::DayOfWeekType  weekday)

The anchor day of the month parameter for the recurring time. For many recurring date types this is 1, first day in the month of interest.

Precondition
The property value shall be in range 1 to 31. The month is not checked whether the date exists for such month. This is done to allow setting the date prior to month. The current event shall be the day of the month time. Otherwise an exception is thrown.
void MTimeRecurrentYearly::SetHours ( int  hours)

Hours within the day when the recurring event shall happen. Zero will mean the beginning of the day, midnight.

Precondition
The given value shall be in range 0 to 23.
void MTimeRecurrentYearly::SetMinutes ( int  minutes)

Minute within the day when the recurring event shall happen. Zero will mean the beginning of the hour.

Precondition
The given value shall be in range 0 to 59.
void MTimeRecurrentYearly::SetMonth ( MTime::MonthType  month)

Month parameter for the recurring time.

Precondition
The given value shall be in range 1 to 12, defined by MDate::Month, or an exception is thrown.
void MTimeRecurrentYearly::SetOffsetType ( OffsetType  type)

The offset type for this yearly recurring event. The offset type tells what to do with the event if it falls to a holiday, etc. Look at OffsetType enumeration for features.

void MTimeRecurrentYearly::SetOnDay ( OffsetType  offsetType,
MTime::MonthType  month,
int  dayOfMonth,
int  hour = 0,
int  minute = 0 
)

Set all the parameters of the recurrent day in a single call.

Parameters
offsetTypeCorrespondent enumeration value.
monthMonth of the recurring date.
dayOfMonthDay of the recurring date in the month.
hourHour of the recurring date.
minuteMinute of the recurring date.
Precondition
The given value shall comprise of a valid yearly recurrent time, or an exception is thrown. The algorithm is written in such a way that no modification to any field of the class is made if any of the given parameters are invalid.
void MTimeRecurrentYearly::SetOnWeekday ( OffsetType  offsetType,
MTime::MonthType  month,
int  dayOfMonth,
int  hour,
int  minute,
MTime::DayOfWeekType  weekday 
)

Set all the parameters of the recurrent day into weekday-based yearly time.

Parameters
offsetTypeCorrespondent enumeration value.
monthMonth of the recurring date.
dayOfMonthDay of the recurring date in the month.
hourHour of the recurring date.
minuteMinute of the recurring date.
weekdayWeek day enumeration.
Precondition
The given value shall comprise of a valid yearly recurrent date-based time, or an exception is thrown.
void MTimeRecurrentYearly::SetSeconds ( int  seconds)

Seconds within the day when the recurring event shall happen. Zero will mean the beginning of the minute.

Precondition
The given value shall be in range 0 to 59.
virtual void MTimeRecurrentYearly::SetToNull ( )
virtual

Set this recurring time to null value, signifying that there is no recurrence defined.

This implementation overrides the pure virtual defined in the base class.

Implements MTimeRecurrent.

void MTimeRecurrentYearly::SetUnchecked ( OffsetType  offsetType,
MTime::MonthType  month,
int  day,
int  hours = 0,
int  minutes = 0,
int  seconds = 0,
MTime::DayOfWeekType  weekday = MTime::WeekdaySunday 
)
inline

Set all the parameters of the recurrent yearly time in a single call.

Precondition
The given value shall comprise of a valid yearly recurrent date-based time, however no checking is done.
See also
SetOnDay and SetOnWeekday for a safe error-checked versions of SetUnchecked.