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/vzone.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/vzone.cpp')
-rw-r--r-- | intl/icu/source/i18n/vzone.cpp | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/intl/icu/source/i18n/vzone.cpp b/intl/icu/source/i18n/vzone.cpp new file mode 100644 index 000000000..8d2bef72a --- /dev/null +++ b/intl/icu/source/i18n/vzone.cpp @@ -0,0 +1,187 @@ +// Copyright (C) 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2009-2011, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ + +/** + * \file + * \brief C API: VTimeZone classes + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" +#include "vzone.h" +#include "unicode/vtzone.h" +#include "cmemory.h" +#include "unicode/ustring.h" +#include "unicode/parsepos.h" + +U_NAMESPACE_USE + +U_CAPI VZone* U_EXPORT2 +vzone_openID(const UChar* ID, int32_t idLength){ + UnicodeString s(idLength==-1, ID, idLength); + return (VZone*) (VTimeZone::createVTimeZoneByID(s)); +} + +U_CAPI VZone* U_EXPORT2 +vzone_openData(const UChar* vtzdata, int32_t vtzdataLength, UErrorCode& status) { + UnicodeString s(vtzdataLength==-1, vtzdata, vtzdataLength); + return (VZone*) (VTimeZone::createVTimeZone(s,status)); +} + +U_CAPI void U_EXPORT2 +vzone_close(VZone* zone) { + delete (VTimeZone*)zone; +} + +U_CAPI VZone* U_EXPORT2 +vzone_clone(const VZone *zone) { + return (VZone*) (((VTimeZone*)zone)->VTimeZone::clone()); +} + +U_CAPI UBool U_EXPORT2 +vzone_equals(const VZone* zone1, const VZone* zone2) { + return *(const VTimeZone*)zone1 == *(const VTimeZone*)zone2; +} + +U_CAPI UBool U_EXPORT2 +vzone_getTZURL(VZone* zone, UChar* & url, int32_t & urlLength) { + UnicodeString s; + UBool b = ((VTimeZone*)zone)->VTimeZone::getTZURL(s); + + urlLength = s.length(); + memcpy(url,s.getBuffer(),urlLength); + + return b; +} + +U_CAPI void U_EXPORT2 +vzone_setTZURL(VZone* zone, UChar* url, int32_t urlLength) { + UnicodeString s(urlLength==-1, url, urlLength); + ((VTimeZone*)zone)->VTimeZone::setTZURL(s); +} + +U_CAPI UBool U_EXPORT2 +vzone_getLastModified(VZone* zone, UDate& lastModified) { + return ((VTimeZone*)zone)->VTimeZone::getLastModified(lastModified); +} + +U_CAPI void U_EXPORT2 +vzone_setLastModified(VZone* zone, UDate lastModified) { + return ((VTimeZone*)zone)->VTimeZone::setLastModified(lastModified); +} + +U_CAPI void U_EXPORT2 +vzone_write(VZone* zone, UChar* & result, int32_t & resultLength, UErrorCode& status) { + UnicodeString s; + ((VTimeZone*)zone)->VTimeZone::write(s, status); + + resultLength = s.length(); + result = (UChar*)uprv_malloc(resultLength); + memcpy(result,s.getBuffer(),resultLength); + + return; +} + +U_CAPI void U_EXPORT2 +vzone_writeFromStart(VZone* zone, UDate start, UChar* & result, int32_t & resultLength, UErrorCode& status) { + UnicodeString s; + ((VTimeZone*)zone)->VTimeZone::write(start, s, status); + + resultLength = s.length(); + result = (UChar*)uprv_malloc(resultLength); + memcpy(result,s.getBuffer(),resultLength); + + return; +} + +U_CAPI void U_EXPORT2 +vzone_writeSimple(VZone* zone, UDate time, UChar* & result, int32_t & resultLength, UErrorCode& status) { + UnicodeString s; + ((VTimeZone*)zone)->VTimeZone::writeSimple(time, s, status); + + resultLength = s.length(); + result = (UChar*)uprv_malloc(resultLength); + memcpy(result,s.getBuffer(),resultLength); + + return; +} + +U_CAPI int32_t U_EXPORT2 +vzone_getOffset(VZone* zone, uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, UErrorCode& status) { + return ((VTimeZone*)zone)->VTimeZone::getOffset(era, year, month, day, dayOfWeek, millis, status); +} + +U_CAPI int32_t U_EXPORT2 +vzone_getOffset2(VZone* zone, uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, + int32_t monthLength, UErrorCode& status) { + return ((VTimeZone*)zone)->VTimeZone::getOffset(era, year, month, day, dayOfWeek, millis, monthLength, status); +} + +U_CAPI void U_EXPORT2 +vzone_getOffset3(VZone* zone, UDate date, UBool local, int32_t& rawOffset, + int32_t& dstOffset, UErrorCode& ec) { + return ((VTimeZone*)zone)->VTimeZone::getOffset(date, local, rawOffset, dstOffset, ec); +} + +U_CAPI void U_EXPORT2 +vzone_setRawOffset(VZone* zone, int32_t offsetMillis) { + return ((VTimeZone*)zone)->VTimeZone::setRawOffset(offsetMillis); +} + +U_CAPI int32_t U_EXPORT2 +vzone_getRawOffset(VZone* zone) { + return ((VTimeZone*)zone)->VTimeZone::getRawOffset(); +} + +U_CAPI UBool U_EXPORT2 +vzone_useDaylightTime(VZone* zone) { + return ((VTimeZone*)zone)->VTimeZone::useDaylightTime(); +} + +U_CAPI UBool U_EXPORT2 +vzone_inDaylightTime(VZone* zone, UDate date, UErrorCode& status) { + return ((VTimeZone*)zone)->VTimeZone::inDaylightTime(date, status); +} + +U_CAPI UBool U_EXPORT2 +vzone_hasSameRules(VZone* zone, const VZone* other) { + return ((VTimeZone*)zone)->VTimeZone::hasSameRules(*(VTimeZone*)other); +} + +U_CAPI UBool U_EXPORT2 +vzone_getNextTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result) { + return ((VTimeZone*)zone)->VTimeZone::getNextTransition(base, inclusive, *(TimeZoneTransition*)result); +} + +U_CAPI UBool U_EXPORT2 +vzone_getPreviousTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result) { + return ((VTimeZone*)zone)->VTimeZone::getPreviousTransition(base, inclusive, *(TimeZoneTransition*)result); +} + +U_CAPI int32_t U_EXPORT2 +vzone_countTransitionRules(VZone* zone, UErrorCode& status) { + return ((VTimeZone*)zone)->VTimeZone::countTransitionRules(status); +} + +U_CAPI UClassID U_EXPORT2 +vzone_getStaticClassID(VZone* zone) { + return ((VTimeZone*)zone)->VTimeZone::getStaticClassID(); +} + +U_CAPI UClassID U_EXPORT2 +vzone_getDynamicClassID(VZone* zone) { + return ((VTimeZone*)zone)->VTimeZone::getDynamicClassID(); +} + +#endif |