aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/i18n/ztrans.h
blob: 60552df017f3e05f911e7f93900619ba1c84f573 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// © 2016 and later: Unicode, Inc. and others. 
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2009-2016, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
#ifndef __ZTRANS_H
#define __ZTRANS_H

/**
 * \file 
 * \brief C API: Time zone transition classes
 */

#include "unicode/utypes.h"

#if !UCONFIG_NO_FORMATTING

#include "unicode/uobject.h"

#ifndef UCNV_H

/**
 * A TimeZoneTransition.  Use the ztrans_* API to manipulate.  Create with
 * ztrans_open*, and destroy with ztrans_close.
 */
struct ZTrans;
typedef struct ZTrans ZTrans;

#endif

/**
 * Constructs a time zone transition with the time and the rules before/after
 * the transition.
 * 
 * @param time  The time of transition in milliseconds since the base time.
 * @param from  The time zone rule used before the transition.
 * @param to    The time zone rule used after the transition.
 */
U_CAPI ZTrans* U_EXPORT2
ztrans_open(UDate time, const void* from, const void* to);

/**
 * Constructs an empty <code>TimeZoneTransition</code>
 */
U_CAPI ZTrans* U_EXPORT2
ztrans_openEmpty();

/**
 * Disposes of the storage used by a ZTrans object.  This function should
 * be called exactly once for objects returned by ztrans_open*.
 * @param trans the object to dispose of
 */
U_CAPI void U_EXPORT2
ztrans_close(ZTrans *trans);

/**
 * Returns a copy of this object.
 * @param rule the original ZRule
 * @return the newly allocated copy of the ZRule
 */
U_CAPI ZTrans* U_EXPORT2
ztrans_clone(ZTrans *trans);

/**
 * Returns true if trans1 is identical to trans2
 * and vis versa.
 * @param trans1 to be checked for containment
 * @param trans2 to be checked for containment
 * @return true if the test condition is met
 */
U_CAPI UBool U_EXPORT2
ztrans_equals(const ZTrans* trans1, const ZTrans* trans2);

/**
 * Returns the time of transition in milliseconds.
 * param trans, the transition to use
 * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
 */
U_CAPI UDate U_EXPORT2
ztrans_getTime(ZTrans* trans);

/**
 * Sets the time of transition in milliseconds.
 * param trans, the transition to use
 * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time.
 */
U_CAPI void U_EXPORT2
ztrans_setTime(ZTrans* trans, UDate time);

/**
 * Returns the rule used before the transition.
 * param trans, the transition to use
 * @return The time zone rule used after the transition.
 */
U_CAPI void* U_EXPORT2
ztrans_getFrom(ZTrans* & trans);

/**
 * Sets the rule used before the transition.  The caller remains
 * responsible for deleting the TimeZoneRule object.
 * param trans, the transition to use
 * param trans, the transition to use
 * @param from The time zone rule used before the transition.
 */
U_CAPI void U_EXPORT2
ztrans_setFrom(ZTrans* trans, const void* from);

/**
 * Adopts the rule used before the transition.  The caller must
 * not delete the TimeZoneRule object passed in.
 * param trans, the transition to use
 * @param from The time zone rule used before the transition.
 */
U_CAPI void U_EXPORT2
ztrans_adoptFrom(ZTrans* trans, void* from);

/**
 * Returns the rule used after the transition.
 * param trans, the transition to use
 * @return The time zone rule used after the transition.
 */
U_CAPI void* U_EXPORT2
ztrans_getTo(ZTrans* trans);

/**
 * Sets the rule used after the transition.  The caller remains
 * responsible for deleting the TimeZoneRule object.
 * param trans, the transition to use
 * @param to The time zone rule used after the transition.
 */
U_CAPI void U_EXPORT2
ztrans_setTo(ZTrans* trans, const void* to);

/**
 * Adopts the rule used after the transition.  The caller must
 * not delete the TimeZoneRule object passed in.
 * param trans, the transition to use
 * @param to The time zone rule used after the transition.
 */
U_CAPI void U_EXPORT2
ztrans_adoptTo(ZTrans* trans, void* to);

/**
 * Return the class ID for this class. This is useful only for comparing to
 * a return value from getDynamicClassID(). For example:
 * <pre>
 * .   Base* polymorphic_pointer = createPolymorphicObject();
 * .   if (polymorphic_pointer->getDynamicClassID() ==
 * .       erived::getStaticClassID()) ...
 * </pre>
 * param trans, the transition to use
 * @return          The class ID for all objects of this class.
 */
U_CAPI UClassID U_EXPORT2
ztrans_getStaticClassID(ZTrans* trans);

/**
 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
 * method is to implement a simple version of RTTI, since not all C++
 * compilers support genuine RTTI. Polymorphic operator==() and clone()
 * methods call this method.
 *
 * param trans, the transition to use
 * @return          The class ID for this object. All objects of a
 *                  given class have the same class ID.  Objects of
 *                  other classes have different class IDs.
 */
U_CAPI UClassID U_EXPORT2
ztrans_getDynamicClassID(ZTrans* trans);

#endif

#endif