ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / ztrans.h
0 / 174 (  0%)
CommitLineData
1/*
2*******************************************************************************
3* Copyright (C) 2009-2016, International Business Machines Corporation and
4* others. All Rights Reserved.
5*******************************************************************************
6*/
7#ifndef __ZTRANS_H
8#define __ZTRANS_H
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
21#ifndef UCNV_H
22
23/**
24 * A TimeZoneTransition. Use the ztrans_* API to manipulate. Create with
25 * ztrans_open*, and destroy with ztrans_close.
26 */
27struct ZTrans;
28typedef struct ZTrans ZTrans;
29
30#endif
31
32/**
33 * Constructs a time zone transition with the time and the rules before/after
34 * the transition.
35 *
36 * @param time The time of transition in milliseconds since the base time.
37 * @param from The time zone rule used before the transition.
38 * @param to The time zone rule used after the transition.
39 */
40U_CAPI ZTrans* U_EXPORT2
41ztrans_open(UDate time, const void* from, const void* to);
42
43/**
44 * Constructs an empty <code>TimeZoneTransition</code>
45 */
46U_CAPI ZTrans* U_EXPORT2
47ztrans_openEmpty();
48
49/**
50 * Disposes of the storage used by a ZTrans object. This function should
51 * be called exactly once for objects returned by ztrans_open*.
52 * @param trans the object to dispose of
53 */
54U_CAPI void U_EXPORT2
55ztrans_close(ZTrans *trans);
56
57/**
58 * Returns a copy of this object.
59 * @param rule the original ZRule
60 * @return the newly allocated copy of the ZRule
61 */
62U_CAPI ZTrans* U_EXPORT2
63ztrans_clone(ZTrans *trans);
64
65/**
66 * Returns true if trans1 is identical to trans2
67 * and vis versa.
68 * @param trans1 to be checked for containment
69 * @param trans2 to be checked for containment
70 * @return true if the test condition is met
71 */
72U_CAPI UBool U_EXPORT2
73ztrans_equals(const ZTrans* trans1, const ZTrans* trans2);
74
75/**
76 * Returns the time of transition in milliseconds.
77 * param trans, the transition to use
78 * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
79 */
80U_CAPI UDate U_EXPORT2
81ztrans_getTime(ZTrans* trans);
82
83/**
84 * Sets the time of transition in milliseconds.
85 * param trans, the transition to use
86 * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
87 */
88U_CAPI void U_EXPORT2
89ztrans_setTime(ZTrans* trans, UDate time);
90
91/**
92 * Returns the rule used before the transition.
93 * param trans, the transition to use
94 * @return The time zone rule used after the transition.
95 */
96U_CAPI void* U_EXPORT2
97ztrans_getFrom(ZTrans* & trans);
98
99/**
100 * Sets the rule used before the transition. The caller remains
101 * responsible for deleting the TimeZoneRule object.
102 * param trans, the transition to use
103 * param trans, the transition to use
104 * @param from The time zone rule used before the transition.
105 */
106U_CAPI void U_EXPORT2
107ztrans_setFrom(ZTrans* trans, const void* from);
108
109/**
110 * Adopts the rule used before the transition. The caller must
111 * not delete the TimeZoneRule object passed in.
112 * param trans, the transition to use
113 * @param from The time zone rule used before the transition.
114 */
115U_CAPI void U_EXPORT2
116ztrans_adoptFrom(ZTrans* trans, void* from);
117
118/**
119 * Returns the rule used after the transition.
120 * param trans, the transition to use
121 * @return The time zone rule used after the transition.
122 */
123U_CAPI void* U_EXPORT2
124ztrans_getTo(ZTrans* trans);
125
126/**
127 * Sets the rule used after the transition. The caller remains
128 * responsible for deleting the TimeZoneRule object.
129 * param trans, the transition to use
130 * @param to The time zone rule used after the transition.
131 */
132U_CAPI void U_EXPORT2
133ztrans_setTo(ZTrans* trans, const void* to);
134
135/**
136 * Adopts the rule used after the transition. The caller must
137 * not delete the TimeZoneRule object passed in.
138 * param trans, the transition to use
139 * @param to The time zone rule used after the transition.
140 */
141U_CAPI void U_EXPORT2
142ztrans_adoptTo(ZTrans* trans, void* to);
143
144/**
145 * Return the class ID for this class. This is useful only for comparing to
146 * a return value from getDynamicClassID(). For example:
147 * <pre>
148 * . Base* polymorphic_pointer = createPolymorphicObject();
149 * . if (polymorphic_pointer->getDynamicClassID() ==
150 * . erived::getStaticClassID()) ...
151 * </pre>
152 * param trans, the transition to use
153 * @return The class ID for all objects of this class.
154 */
155U_CAPI UClassID U_EXPORT2
156ztrans_getStaticClassID(ZTrans* trans);
157
158/**
159 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
160 * method is to implement a simple version of RTTI, since not all C++
161 * compilers support genuine RTTI. Polymorphic operator==() and clone()
162 * methods call this method.
163 *
164 * param trans, the transition to use
165 * @return The class ID for this object. All objects of a
166 * given class have the same class ID. Objects of
167 * other classes have different class IDs.
168 */
169U_CAPI UClassID U_EXPORT2
170ztrans_getDynamicClassID(ZTrans* trans);
171
172#endif
173
174#endif