diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /intl/icu/source/i18n/tztrans.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'intl/icu/source/i18n/tztrans.cpp')
-rw-r--r-- | intl/icu/source/i18n/tztrans.cpp | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/intl/icu/source/i18n/tztrans.cpp b/intl/icu/source/i18n/tztrans.cpp new file mode 100644 index 000000000..76e259c5a --- /dev/null +++ b/intl/icu/source/i18n/tztrans.cpp @@ -0,0 +1,148 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2012, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ + +#include "utypeinfo.h" // for 'typeid' to work + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/tzrule.h" +#include "unicode/tztrans.h" + +U_NAMESPACE_BEGIN + +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeZoneTransition) + +TimeZoneTransition::TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to) +: UObject(), fTime(time), fFrom(from.clone()), fTo(to.clone()) { +} + +TimeZoneTransition::TimeZoneTransition() +: UObject(), fTime(0), fFrom(NULL), fTo(NULL) { +} + +TimeZoneTransition::TimeZoneTransition(const TimeZoneTransition& source) +: UObject(), fTime(source.fTime), fFrom(NULL), fTo(NULL) { + if (source.fFrom != NULL) { + fFrom = source.fFrom->clone(); + } + + if (source.fTo != NULL) { + fTo = source.fTo->clone(); + } +} + +TimeZoneTransition::~TimeZoneTransition() { + if (fFrom != NULL) { + delete fFrom; + } + if (fTo != NULL) { + delete fTo; + } +} + +TimeZoneTransition* +TimeZoneTransition::clone(void) const { + return new TimeZoneTransition(*this); +} + +TimeZoneTransition& +TimeZoneTransition::operator=(const TimeZoneTransition& right) { + if (this != &right) { + fTime = right.fTime; + setFrom(*right.fFrom); + setTo(*right.fTo); + } + return *this; +} + +UBool +TimeZoneTransition::operator==(const TimeZoneTransition& that) const { + if (this == &that) { + return TRUE; + } + if (typeid(*this) != typeid(that)) { + return FALSE; + } + if (fTime != that.fTime) { + return FALSE; + } + if ((fFrom == NULL && that.fFrom == NULL) + || (fFrom != NULL && that.fFrom != NULL && *fFrom == *(that.fFrom))) { + if ((fTo == NULL && that.fTo == NULL) + || (fTo != NULL && that.fTo != NULL && *fTo == *(that.fTo))) { + return TRUE; + } + } + return FALSE; +} + +UBool +TimeZoneTransition::operator!=(const TimeZoneTransition& that) const { + return !operator==(that); +} + +void +TimeZoneTransition::setTime(UDate time) { + fTime = time; +} + +void +TimeZoneTransition::setFrom(const TimeZoneRule& from) { + if (fFrom != NULL) { + delete fFrom; + } + fFrom = from.clone(); +} + +void +TimeZoneTransition::adoptFrom(TimeZoneRule* from) { + if (fFrom != NULL) { + delete fFrom; + } + fFrom = from; +} + +void +TimeZoneTransition::setTo(const TimeZoneRule& to) { + if (fTo != NULL) { + delete fTo; + } + fTo = to.clone(); +} + +void +TimeZoneTransition::adoptTo(TimeZoneRule* to) { + if (fTo != NULL) { + delete fTo; + } + fTo = to; +} + +UDate +TimeZoneTransition::getTime(void) const { + return fTime; +} + +const TimeZoneRule* +TimeZoneTransition::getTo(void) const { + return fTo; +} + +const TimeZoneRule* +TimeZoneTransition::getFrom(void) const { + return fFrom; +} + +U_NAMESPACE_END + +#endif + +//eof |