2 *******************************************************************************
3 * Copyright (C) 2009-2010, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
12 * \brief C API: Time zone transition classes
15 #include "unicode/utypes.h"
17 #if !UCONFIG_NO_FORMATTING
22 * A TimeZoneTransition. Use the ztrans_* API to manipulate. Create with
23 * ztrans_open*, and destroy with ztrans_close.
27 typedef struct ZTrans ZTrans
;
32 * Constructs a time zone transition with the time and the rules before/after
35 * @param time The time of transition in milliseconds since the base time.
36 * @param from The time zone rule used before the transition.
37 * @param to The time zone rule used after the transition.
40 U_DRAFT ZTrans
* U_EXPORT2
41 ztrans_open(UDate time
, const void* from
, const void* to
);
44 * Constructs an empty <code>TimeZoneTransition</code>
47 U_DRAFT ZTrans
* U_EXPORT2
51 * Disposes of the storage used by a ZTrans object. This function should
52 * be called exactly once for objects returned by ztrans_open*.
53 * @param trans the object to dispose of
56 U_DRAFT
void U_EXPORT2
57 ztrans_close(ZTrans
*trans
);
60 * Returns a copy of this object.
61 * @param rule the original ZRule
62 * @return the newly allocated copy of the ZRule
65 U_DRAFT ZTrans
* U_EXPORT2
66 ztrans_clone(ZTrans
*trans
);
69 * Returns true if trans1 is identical to trans2
71 * @param trans1 to be checked for containment
72 * @param trans2 to be checked for containment
73 * @return true if the test condition is met
76 U_DRAFT UBool U_EXPORT2
77 ztrans_equals(const ZTrans
* trans1
, const ZTrans
* trans2
);
80 * Returns the time of transition in milliseconds.
81 * param trans, the transition to use
82 * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
85 U_DRAFT UDate U_EXPORT2
86 ztrans_getTime(ZTrans
* trans
);
89 * Sets the time of transition in milliseconds.
90 * param trans, the transition to use
91 * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
94 U_DRAFT
void U_EXPORT2
95 ztrans_setTime(ZTrans
* trans
, UDate time
);
98 * Returns the rule used before the transition.
99 * param trans, the transition to use
100 * @return The time zone rule used after the transition.
103 U_DRAFT
void* U_EXPORT2
104 ztrans_getFrom(ZTrans
* & trans
);
107 * Sets the rule used before the transition. The caller remains
108 * responsible for deleting the TimeZoneRule object.
109 * param trans, the transition to use
110 * param trans, the transition to use
111 * @param from The time zone rule used before the transition.
114 U_DRAFT
void U_EXPORT2
115 ztrans_setFrom(ZTrans
* trans
, const void* from
);
118 * Adopts the rule used before the transition. The caller must
119 * not delete the TimeZoneRule object passed in.
120 * param trans, the transition to use
121 * @param from The time zone rule used before the transition.
124 U_DRAFT
void U_EXPORT2
125 ztrans_adoptFrom(ZTrans
* trans
, void* from
);
128 * Returns the rule used after the transition.
129 * param trans, the transition to use
130 * @return The time zone rule used after the transition.
133 U_DRAFT
void* U_EXPORT2
134 ztrans_getTo(ZTrans
* trans
);
137 * Sets the rule used after the transition. The caller remains
138 * responsible for deleting the TimeZoneRule object.
139 * param trans, the transition to use
140 * @param to The time zone rule used after the transition.
143 U_DRAFT
void U_EXPORT2
144 ztrans_setTo(ZTrans
* trans
, const void* to
);
147 * Adopts the rule used after the transition. The caller must
148 * not delete the TimeZoneRule object passed in.
149 * param trans, the transition to use
150 * @param to The time zone rule used after the transition.
153 U_DRAFT
void U_EXPORT2
154 ztrans_adoptTo(ZTrans
* trans
, void* to
);
157 * Return the class ID for this class. This is useful only for comparing to
158 * a return value from getDynamicClassID(). For example:
160 * . Base* polymorphic_pointer = createPolymorphicObject();
161 * . if (polymorphic_pointer->getDynamicClassID() ==
162 * . erived::getStaticClassID()) ...
164 * param trans, the transition to use
165 * @return The class ID for all objects of this class.
168 U_DRAFT UClassID U_EXPORT2
169 ztrans_getStaticClassID(ZTrans
* trans
);
172 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
173 * method is to implement a simple version of RTTI, since not all C++
174 * compilers support genuine RTTI. Polymorphic operator==() and clone()
175 * methods call this method.
177 * param trans, the transition to use
178 * @return The class ID for this object. All objects of a
179 * given class have the same class ID. Objects of
180 * other classes have different class IDs.
183 U_DRAFT UClassID U_EXPORT2
184 ztrans_getDynamicClassID(ZTrans
* trans
);