]> git.saurik.com Git - apple/icu.git/blame - icuSources/i18n/ztrans.h
ICU-461.18.tar.gz
[apple/icu.git] / icuSources / i18n / ztrans.h
CommitLineData
729e4ab9
A
1/*
2*******************************************************************************
3* Copyright (C) 2009-2010, 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#ifndef UCNV_H
20
21/**
22 * A TimeZoneTransition. Use the ztrans_* API to manipulate. Create with
23 * ztrans_open*, and destroy with ztrans_close.
24 * @draft ICU 4.4
25 */
26struct ZTrans;
27typedef struct ZTrans ZTrans;
28
29#endif
30
31/**
32 * Constructs a time zone transition with the time and the rules before/after
33 * the transition.
34 *
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.
38 * @draft ICU 4.4
39 */
40U_DRAFT ZTrans* U_EXPORT2
41ztrans_open(UDate time, const void* from, const void* to);
42
43/**
44 * Constructs an empty <code>TimeZoneTransition</code>
45 * @draft ICU 4.4
46 */
47U_DRAFT ZTrans* U_EXPORT2
48ztrans_openEmpty();
49
50/**
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
54 * @draft ICU 4.4
55 */
56U_DRAFT void U_EXPORT2
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
63 * @draft ICU 4.4
64 */
65U_DRAFT ZTrans* U_EXPORT2
66ztrans_clone(ZTrans *trans);
67
68/**
69 * Returns true if trans1 is identical to trans2
70 * and vis versa.
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
74 * @draft ICU 4.4
75 */
76U_DRAFT UBool U_EXPORT2
77ztrans_equals(const ZTrans* trans1, const ZTrans* trans2);
78
79/**
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.
83 * @draft ICU 4.4
84 */
85U_DRAFT UDate U_EXPORT2
86ztrans_getTime(ZTrans* trans);
87
88/**
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.
92 * @draft ICU 4.4
93 */
94U_DRAFT void U_EXPORT2
95ztrans_setTime(ZTrans* trans, UDate time);
96
97/**
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.
101 * @draft ICU 4.4
102 */
103U_DRAFT void* U_EXPORT2
104ztrans_getFrom(ZTrans* & trans);
105
106/**
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.
112 * @draft ICU 4.4
113 */
114U_DRAFT void U_EXPORT2
115ztrans_setFrom(ZTrans* trans, const void* from);
116
117/**
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.
122 * @draft ICU 4.4
123 */
124U_DRAFT void U_EXPORT2
125ztrans_adoptFrom(ZTrans* trans, void* from);
126
127/**
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.
131 * @draft ICU 4.4
132 */
133U_DRAFT void* U_EXPORT2
134ztrans_getTo(ZTrans* trans);
135
136/**
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.
141 * @draft ICU 4.4
142 */
143U_DRAFT void U_EXPORT2
144ztrans_setTo(ZTrans* trans, const void* to);
145
146/**
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.
151 * @draft ICU 4.4
152 */
153U_DRAFT void U_EXPORT2
154ztrans_adoptTo(ZTrans* trans, void* to);
155
156/**
157 * Return the class ID for this class. This is useful only for comparing to
158 * a return value from getDynamicClassID(). For example:
159 * <pre>
160 * . Base* polymorphic_pointer = createPolymorphicObject();
161 * . if (polymorphic_pointer->getDynamicClassID() ==
162 * . erived::getStaticClassID()) ...
163 * </pre>
164 * param trans, the transition to use
165 * @return The class ID for all objects of this class.
166 * @draft ICU 4.4
167 */
168U_DRAFT UClassID U_EXPORT2
169ztrans_getStaticClassID(ZTrans* trans);
170
171/**
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.
176 *
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.
181 * @draft ICU 4.4
182 */
183U_DRAFT UClassID U_EXPORT2
184ztrans_getDynamicClassID(ZTrans* trans);
185
186#endif
187
188#endif