DateTimeRule
is a class representing a time in a year by a rule specified by month, day of month, day of week and time in the day.
More...
#include <dtrule.h>
Public Types | |
enum | DateRuleType { DOM = 0, DOW, DOW_GEQ_DOM, DOW_LEQ_DOM } |
Date rule type constants. More... | |
enum | TimeRuleType { WALL_TIME = 0, STANDARD_TIME, UTC_TIME } |
Time rule type constants. More... | |
Public Member Functions | |
DateTimeRule (int32_t month, int32_t dayOfMonth, int32_t millisInDay, TimeRuleType timeType) | |
Constructs a DateTimeRule by the day of month and the time rule. | |
DateTimeRule (int32_t month, int32_t weekInMonth, int32_t dayOfWeek, int32_t millisInDay, TimeRuleType timeType) | |
Constructs a DateTimeRule by the day of week and its oridinal number and the time rule. | |
DateTimeRule (int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, UBool after, int32_t millisInDay, TimeRuleType timeType) | |
Constructs a DateTimeRule by the first/last day of week on or after/before the day of month and the time rule. | |
DateTimeRule (const DateTimeRule &source) | |
Copy constructor. | |
~DateTimeRule () | |
Destructor. | |
DateTimeRule * | clone (void) const |
Clone this DateTimeRule object polymorphically. | |
DateTimeRule & | operator= (const DateTimeRule &right) |
Assignment operator. | |
UBool | operator== (const DateTimeRule &that) const |
Return true if the given DateTimeRule objects are semantically equal. | |
UBool | operator!= (const DateTimeRule &that) const |
Return true if the given DateTimeRule objects are semantically unequal. | |
DateRuleType | getDateRuleType (void) const |
Gets the date rule type, such as DOM . | |
TimeRuleType | getTimeRuleType (void) const |
Gets the time rule type. | |
int32_t | getRuleMonth (void) const |
Gets the rule month. | |
int32_t | getRuleDayOfMonth (void) const |
Gets the rule day of month. | |
int32_t | getRuleDayOfWeek (void) const |
Gets the rule day of week. | |
int32_t | getRuleWeekInMonth (void) const |
Gets the ordinal number of the occurence of the day of week in the month. | |
int32_t | getRuleMillisInDay (void) const |
Gets the rule time in the rule day. | |
virtual UClassID | getDynamicClassID (void) const |
Returns a unique class ID POLYMORPHICALLY. | |
Static Public Member Functions | |
static UClassID | getStaticClassID (void) |
Return the class ID for this class. |
DateTimeRule
is a class representing a time in a year by a rule specified by month, day of month, day of week and time in the day.
Definition at line 29 of file dtrule.h.
Date rule type constants.
DateTimeRule::DateTimeRule | ( | int32_t | month, | |
int32_t | dayOfMonth, | |||
int32_t | millisInDay, | |||
TimeRuleType | timeType | |||
) |
Constructs a DateTimeRule
by the day of month and the time rule.
The date rule type for an instance created by this constructor is DOM
.
month | The rule month, for example, Calendar::JANUARY | |
dayOfMonth | The day of month, 1-based. | |
millisInDay | The milliseconds in the rule date. | |
timeType | The time type, WALL_TIME or STANDARD_TIME or UTC_TIME . |
DateTimeRule::DateTimeRule | ( | int32_t | month, | |
int32_t | weekInMonth, | |||
int32_t | dayOfWeek, | |||
int32_t | millisInDay, | |||
TimeRuleType | timeType | |||
) |
Constructs a DateTimeRule
by the day of week and its oridinal number and the time rule.
The date rule type for an instance created by this constructor is DOW
.
month | The rule month, for example, Calendar::JANUARY . | |
weekInMonth | The ordinal number of the day of week. Negative number may be used for specifying a rule date counted from the end of the rule month. | |
dayOfWeek | The day of week, for example, Calendar::SUNDAY . | |
millisInDay | The milliseconds in the rule date. | |
timeType | The time type, WALL_TIME or STANDARD_TIME or UTC_TIME . |
DateTimeRule::DateTimeRule | ( | int32_t | month, | |
int32_t | dayOfMonth, | |||
int32_t | dayOfWeek, | |||
UBool | after, | |||
int32_t | millisInDay, | |||
TimeRuleType | timeType | |||
) |
Constructs a DateTimeRule
by the first/last day of week on or after/before the day of month and the time rule.
The date rule type for an instance created by this constructor is either DOM_GEQ_DOM
or DOM_LEQ_DOM
.
month | The rule month, for example, Calendar::JANUARY | |
dayOfMonth | The day of month, 1-based. | |
dayOfWeek | The day of week, for example, Calendar::SUNDAY . | |
after | true if the rule date is on or after the day of month. | |
millisInDay | The milliseconds in the rule date. | |
timeType | The time type, WALL_TIME or STANDARD_TIME or UTC_TIME . |
DateTimeRule::DateTimeRule | ( | const DateTimeRule & | source | ) |
DateTimeRule::~DateTimeRule | ( | ) |
DateTimeRule* DateTimeRule::clone | ( | void | ) | const |
Clone this DateTimeRule object polymorphically.
The caller owns the result and should delete it when done.
DateRuleType DateTimeRule::getDateRuleType | ( | void | ) | const |
virtual UClassID DateTimeRule::getDynamicClassID | ( | void | ) | const [virtual] |
Returns a unique class ID POLYMORPHICALLY.
Pure virtual override. This method is to implement a simple version of RTTI, since not all C++ compilers support genuine RTTI. Polymorphic operator==() and clone() methods call this method.
Implements UObject.
int32_t DateTimeRule::getRuleDayOfMonth | ( | void | ) | const |
Gets the rule day of month.
When the date rule type is DOW
, the value is always 0.
int32_t DateTimeRule::getRuleDayOfWeek | ( | void | ) | const |
Gets the rule day of week.
When the date rule type is DOM
, the value is always 0.
int32_t DateTimeRule::getRuleMillisInDay | ( | void | ) | const |
Gets the rule time in the rule day.
int32_t DateTimeRule::getRuleMonth | ( | void | ) | const |
int32_t DateTimeRule::getRuleWeekInMonth | ( | void | ) | const |
Gets the ordinal number of the occurence of the day of week in the month.
When the date rule type is not DOW
, the value is always 0.
static UClassID DateTimeRule::getStaticClassID | ( | void | ) | [static] |
Return the class ID for this class.
This is useful only for comparing to a return value from getDynamicClassID(). For example:
. Base* polymorphic_pointer = createPolymorphicObject(); . if (polymorphic_pointer->getDynamicClassID() == . erived::getStaticClassID()) ...
TimeRuleType DateTimeRule::getTimeRuleType | ( | void | ) | const |
Gets the time rule type.
WALL_TIME
or STANDARD_TIME
or UTC_TIME
. UBool DateTimeRule::operator!= | ( | const DateTimeRule & | that | ) | const |
Return true if the given DateTimeRule objects are semantically unequal.
Objects of different subclasses are considered unequal.
that | The object to be compared with. |
DateTimeRule& DateTimeRule::operator= | ( | const DateTimeRule & | right | ) |
UBool DateTimeRule::operator== | ( | const DateTimeRule & | that | ) | const |
Return true if the given DateTimeRule objects are semantically equal.
Objects of different subclasses are considered unequal.
that | The object to be compared with. |