]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/dtrule.cpp
2 *******************************************************************************
3 * Copyright (C) 2007, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
8 #include "unicode/utypes.h"
10 #if !UCONFIG_NO_FORMATTING
12 #include "unicode/dtrule.h"
16 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateTimeRule
)
18 DateTimeRule::DateTimeRule(int32_t month
,
21 TimeRuleType timeType
)
22 : fMonth(month
), fDayOfMonth(dayOfMonth
), fDayOfWeek(0), fWeekInMonth(0), fMillisInDay(millisInDay
),
23 fDateRuleType(DateTimeRule::DOM
), fTimeRuleType(timeType
) {
26 DateTimeRule::DateTimeRule(int32_t month
,
30 TimeRuleType timeType
)
31 : fMonth(month
), fDayOfMonth(0), fDayOfWeek(dayOfWeek
), fWeekInMonth(weekInMonth
), fMillisInDay(millisInDay
),
32 fDateRuleType(DateTimeRule::DOW
), fTimeRuleType(timeType
) {
35 DateTimeRule::DateTimeRule(int32_t month
,
40 TimeRuleType timeType
)
42 fMonth(month
), fDayOfMonth(dayOfMonth
), fDayOfWeek(dayOfWeek
), fWeekInMonth(0), fMillisInDay(millisInDay
),
43 fTimeRuleType(timeType
) {
45 fDateRuleType
= DateTimeRule::DOW_GEQ_DOM
;
47 fDateRuleType
= DateTimeRule::DOW_LEQ_DOM
;
51 DateTimeRule::DateTimeRule(const DateTimeRule
& source
)
53 fMonth(source
.fMonth
), fDayOfMonth(source
.fDayOfMonth
), fDayOfWeek(source
.fDayOfWeek
),
54 fWeekInMonth(source
.fWeekInMonth
), fMillisInDay(source
.fMillisInDay
),
55 fDateRuleType(source
.fDateRuleType
), fTimeRuleType(source
.fTimeRuleType
) {
58 DateTimeRule::~DateTimeRule() {
62 DateTimeRule::clone() const {
63 return new DateTimeRule(*this);
67 DateTimeRule::operator=(const DateTimeRule
& right
) {
69 fMonth
= right
.fMonth
;
70 fDayOfMonth
= right
.fDayOfMonth
;
71 fDayOfWeek
= right
.fDayOfWeek
;
72 fWeekInMonth
= right
.fWeekInMonth
;
73 fMillisInDay
= right
.fMillisInDay
;
74 fDateRuleType
= right
.fDateRuleType
;
75 fTimeRuleType
= right
.fTimeRuleType
;
81 DateTimeRule::operator==(const DateTimeRule
& that
) const {
82 return ((this == &that
) ||
83 (getDynamicClassID() == that
.getDynamicClassID() &&
84 fMonth
== that
.fMonth
&&
85 fDayOfMonth
== that
.fDayOfMonth
&&
86 fDayOfWeek
== that
.fDayOfWeek
&&
87 fWeekInMonth
== that
.fWeekInMonth
&&
88 fMillisInDay
== that
.fMillisInDay
&&
89 fDateRuleType
== that
.fDateRuleType
&&
90 fTimeRuleType
== that
.fTimeRuleType
));
94 DateTimeRule::operator!=(const DateTimeRule
& that
) const {
95 return !operator==(that
);
98 DateTimeRule::DateRuleType
99 DateTimeRule::getDateRuleType(void) const {
100 return fDateRuleType
;
103 DateTimeRule::TimeRuleType
104 DateTimeRule::getTimeRuleType(void) const {
105 return fTimeRuleType
;
109 DateTimeRule::getRuleMonth(void) const {
114 DateTimeRule::getRuleDayOfMonth(void) const {
119 DateTimeRule::getRuleDayOfWeek(void) const {
124 DateTimeRule::getRuleWeekInMonth(void) const {
129 DateTimeRule::getRuleMillisInDay(void) const {
135 #endif /* #if !UCONFIG_NO_FORMATTING */