]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/ztrans.h
ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / ztrans.h
CommitLineData
729e4ab9
A
1/*
2*******************************************************************************
2ca993e8 3* Copyright (C) 2009-2016, International Business Machines Corporation and
4388f060 4* others. All Rights Reserved.
729e4ab9
A
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
2ca993e8
A
19#include "unicode/uobject.h"
20
729e4ab9
A
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.
729e4ab9
A
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.
729e4ab9 39 */
4388f060 40U_CAPI ZTrans* U_EXPORT2
729e4ab9
A
41ztrans_open(UDate time, const void* from, const void* to);
42
43/**
44 * Constructs an empty <code>TimeZoneTransition</code>
729e4ab9 45 */
4388f060 46U_CAPI ZTrans* U_EXPORT2
729e4ab9
A
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
729e4ab9 53 */
4388f060 54U_CAPI void U_EXPORT2
729e4ab9
A
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
729e4ab9 61 */
4388f060 62U_CAPI ZTrans* U_EXPORT2
729e4ab9
A
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
729e4ab9 71 */
4388f060 72U_CAPI UBool U_EXPORT2
729e4ab9
A
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.
729e4ab9 79 */
4388f060 80U_CAPI UDate U_EXPORT2
729e4ab9
A
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.
729e4ab9 87 */
4388f060 88U_CAPI void U_EXPORT2
729e4ab9
A
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.
729e4ab9 95 */
4388f060 96U_CAPI void* U_EXPORT2
729e4ab9
A
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.
729e4ab9 105 */
4388f060 106U_CAPI void U_EXPORT2
729e4ab9
A
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.
729e4ab9 114 */
4388f060 115U_CAPI void U_EXPORT2
729e4ab9
A
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.
729e4ab9 122 */
4388f060 123U_CAPI void* U_EXPORT2
729e4ab9
A
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.
729e4ab9 131 */
4388f060 132U_CAPI void U_EXPORT2
729e4ab9
A
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.
729e4ab9 140 */
4388f060 141U_CAPI void U_EXPORT2
729e4ab9
A
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.
729e4ab9 154 */
4388f060 155U_CAPI UClassID U_EXPORT2
729e4ab9
A
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.
729e4ab9 168 */
4388f060 169U_CAPI UClassID U_EXPORT2
729e4ab9
A
170ztrans_getDynamicClassID(ZTrans* trans);
171
172#endif
173
174#endif