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