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