]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/tztrans.cpp
2 *******************************************************************************
3 * Copyright (C) 2007-2012, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 *******************************************************************************
8 #include "utypeinfo.h" // for 'typeid' to work
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
14 #include "unicode/tzrule.h"
15 #include "unicode/tztrans.h"
19 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeZoneTransition
)
21 TimeZoneTransition::TimeZoneTransition(UDate time
, const TimeZoneRule
& from
, const TimeZoneRule
& to
)
22 : UObject(), fTime(time
), fFrom(from
.clone()), fTo(to
.clone()) {
25 TimeZoneTransition::TimeZoneTransition()
26 : UObject(), fTime(0), fFrom(NULL
), fTo(NULL
) {
29 TimeZoneTransition::TimeZoneTransition(const TimeZoneTransition
& source
)
30 : UObject(), fTime(source
.fTime
), fFrom(NULL
), fTo(NULL
) {
31 if (source
.fFrom
!= NULL
) {
32 fFrom
= source
.fFrom
->clone();
35 if (source
.fTo
!= NULL
) {
36 fTo
= source
.fTo
->clone();
40 TimeZoneTransition::~TimeZoneTransition() {
50 TimeZoneTransition::clone(void) const {
51 return new TimeZoneTransition(*this);
55 TimeZoneTransition::operator=(const TimeZoneTransition
& right
) {
58 setFrom(*right
.fFrom
);
65 TimeZoneTransition::operator==(const TimeZoneTransition
& that
) const {
69 if (typeid(*this) != typeid(that
)) {
72 if (fTime
!= that
.fTime
) {
75 if ((fFrom
== NULL
&& that
.fFrom
== NULL
)
76 || (fFrom
!= NULL
&& that
.fFrom
!= NULL
&& *fFrom
== *(that
.fFrom
))) {
77 if ((fTo
== NULL
&& that
.fTo
== NULL
)
78 || (fTo
!= NULL
&& that
.fTo
!= NULL
&& *fTo
== *(that
.fTo
))) {
86 TimeZoneTransition::operator!=(const TimeZoneTransition
& that
) const {
87 return !operator==(that
);
91 TimeZoneTransition::setTime(UDate time
) {
96 TimeZoneTransition::setFrom(const TimeZoneRule
& from
) {
100 fFrom
= from
.clone();
104 TimeZoneTransition::adoptFrom(TimeZoneRule
* from
) {
112 TimeZoneTransition::setTo(const TimeZoneRule
& to
) {
120 TimeZoneTransition::adoptTo(TimeZoneRule
* to
) {
128 TimeZoneTransition::getTime(void) const {
133 TimeZoneTransition::getTo(void) const {
138 TimeZoneTransition::getFrom(void) const {