• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 2009-2010, International Business Machines Corporation and         *
6 * others. All Rights Reserved.                                                *
7 *******************************************************************************
8 */
9 
10 /**
11  * \file
12  * \brief C API: Time zone transition classes
13  */
14 
15 #include "unicode/utypes.h"
16 
17 #if !UCONFIG_NO_FORMATTING
18 
19 #include "unicode/uobject.h"
20 #include "ztrans.h"
21 #include "unicode/tztrans.h"
22 #include "cmemory.h"
23 #include "unicode/ustring.h"
24 #include "unicode/parsepos.h"
25 
26 U_NAMESPACE_USE
27 
28 U_CAPI ZTrans* U_EXPORT2
ztrans_open(UDate time,const void * from,const void * to)29 ztrans_open(UDate time, const void* from, const void* to){
30     return (ZTrans*) new TimeZoneTransition(time,*(TimeZoneRule*)from,*(TimeZoneRule*)to);
31 }
32 
33 U_CAPI ZTrans* U_EXPORT2
ztrans_openEmpty()34 ztrans_openEmpty() {
35     return (ZTrans*) new TimeZoneTransition();
36 }
37 
38 U_CAPI void U_EXPORT2
ztrans_close(ZTrans * trans)39 ztrans_close(ZTrans *trans) {
40     delete (TimeZoneTransition*)trans;
41 }
42 
43 U_CAPI ZTrans* U_EXPORT2
ztrans_clone(ZTrans * trans)44 ztrans_clone(ZTrans *trans) {
45     return (ZTrans*) (((TimeZoneTransition*)trans)->TimeZoneTransition::clone());
46 }
47 
48 U_CAPI UBool U_EXPORT2
ztrans_equals(const ZTrans * trans1,const ZTrans * trans2)49 ztrans_equals(const ZTrans* trans1, const ZTrans* trans2){
50     return *(const TimeZoneTransition*)trans1 == *(const TimeZoneTransition*)trans2;
51 }
52 
53 U_CAPI UDate U_EXPORT2
ztrans_getTime(ZTrans * trans)54 ztrans_getTime(ZTrans* trans) {
55     return ((TimeZoneTransition*)trans)->TimeZoneTransition::getTime();
56 }
57 
58 U_CAPI void U_EXPORT2
ztrans_setTime(ZTrans * trans,UDate time)59 ztrans_setTime(ZTrans* trans, UDate time) {
60     return ((TimeZoneTransition*)trans)->TimeZoneTransition::setTime(time);
61 }
62 
63 U_CAPI void* U_EXPORT2
ztrans_getFrom(ZTrans * & trans)64 ztrans_getFrom(ZTrans* & trans) {
65     return (void*) (((TimeZoneTransition*)trans)->TimeZoneTransition::getFrom());
66 }
67 
68 U_CAPI void U_EXPORT2
ztrans_setFrom(ZTrans * trans,const void * from)69 ztrans_setFrom(ZTrans* trans, const void* from) {
70     return ((TimeZoneTransition*)trans)->TimeZoneTransition::setFrom(*(TimeZoneRule*)from);
71 }
72 
73 U_CAPI void U_EXPORT2
ztrans_adoptFrom(ZTrans * trans,void * from)74 ztrans_adoptFrom(ZTrans* trans, void* from) {
75     return ((TimeZoneTransition*)trans)->TimeZoneTransition::adoptFrom((TimeZoneRule*)from);
76 }
77 
78 U_CAPI void* U_EXPORT2
ztrans_getTo(ZTrans * trans)79 ztrans_getTo(ZTrans* trans){
80     return (void*) (((TimeZoneTransition*)trans)->TimeZoneTransition::getTo());
81 }
82 
83 U_CAPI void U_EXPORT2
ztrans_setTo(ZTrans * trans,const void * to)84 ztrans_setTo(ZTrans* trans, const void* to) {
85     return ((TimeZoneTransition*)trans)->TimeZoneTransition::setTo(*(TimeZoneRule*)to);
86 }
87 
88 U_CAPI void U_EXPORT2
ztrans_adoptTo(ZTrans * trans,void * to)89 ztrans_adoptTo(ZTrans* trans, void* to) {
90     return ((TimeZoneTransition*)trans)->TimeZoneTransition::adoptTo((TimeZoneRule*)to);
91 }
92 
93 U_CAPI UClassID U_EXPORT2
ztrans_getStaticClassID(ZTrans * trans)94 ztrans_getStaticClassID(ZTrans* trans) {
95     return ((TimeZoneTransition*)trans)->TimeZoneTransition::getStaticClassID();
96 }
97 
98 U_CAPI UClassID U_EXPORT2
ztrans_getDynamicClassID(ZTrans * trans)99 ztrans_getDynamicClassID(ZTrans* trans){
100     return ((TimeZoneTransition*)trans)->TimeZoneTransition::getDynamicClassID();
101 }
102 
103 #endif
104