Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1212)

Side by Side Diff: public/i18n/unicode/basictz.h

Issue 19417002: Move ICU header part 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/icu46/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « icu.gyp ('k') | public/i18n/unicode/bms.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 *******************************************************************************
3 * Copyright (C) 2007-2008, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
6 */
7 #ifndef BASICTZ_H
8 #define BASICTZ_H
9
10 /**
11 * \file
12 * \brief C++ API: ICU TimeZone base class
13 */
14
15 #include "unicode/utypes.h"
16
17 #if !UCONFIG_NO_FORMATTING
18
19 #include "unicode/timezone.h"
20 #include "unicode/tzrule.h"
21 #include "unicode/tztrans.h"
22
23 U_NAMESPACE_BEGIN
24
25 // forward declarations
26 class UVector;
27
28 /**
29 * <code>BasicTimeZone</code> is an abstract class extending <code>TimeZone</cod e>.
30 * This class provides some additional methods to access time zone transitions a nd rules.
31 * All ICU <code>TimeZone</code> concrete subclasses extend this class.
32 * @stable ICU 3.8
33 */
34 class U_I18N_API BasicTimeZone: public TimeZone {
35 public:
36 /**
37 * Destructor.
38 * @stable ICU 3.8
39 */
40 virtual ~BasicTimeZone();
41
42 /**
43 * Gets the first time zone transition after the base time.
44 * @param base The base time.
45 * @param inclusive Whether the base time is inclusive or not.
46 * @param result Receives the first transition after the base time.
47 * @return TRUE if the transition is found.
48 * @stable ICU 3.8
49 */
50 virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransit ion& result) /*const*/ = 0;
51
52 /**
53 * Gets the most recent time zone transition before the base time.
54 * @param base The base time.
55 * @param inclusive Whether the base time is inclusive or not.
56 * @param result Receives the most recent transition before the base time .
57 * @return TRUE if the transition is found.
58 * @stable ICU 3.8
59 */
60 virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTra nsition& result) /*const*/ = 0;
61
62 /**
63 * Checks if the time zone has equivalent transitions in the time range.
64 * This method returns true when all of transition times, from/to standard
65 * offsets and DST savings used by this time zone match the other in the
66 * time range.
67 * @param tz The <code>BasicTimeZone</code> object to be compared with.
68 * @param start The start time of the evaluated time range (inclusive)
69 * @param end The end time of the evaluated time range (inclusive)
70 * @param ignoreDstAmount
71 * When true, any transitions with only daylight saving amount
72 * changes will be ignored, except either of them is zero.
73 * For example, a transition from rawoffset 3:00/dstsavings 1:0 0
74 * to rawoffset 2:00/dstsavings 2:00 is excluded from the compa rison,
75 * but a transtion from rawoffset 2:00/dstsavings 1:00 to
76 * rawoffset 3:00/dstsavings 0:00 is included.
77 * @param ec Output param to filled in with a success or an error.
78 * @return true if the other time zone has the equivalent transitions i n the
79 * time range.
80 * @stable ICU 3.8
81 */
82 virtual UBool hasEquivalentTransitions(/*const*/ BasicTimeZone& tz, UDate st art, UDate end,
83 UBool ignoreDstAmount, UErrorCode& ec) /*const*/;
84
85 /**
86 * Returns the number of <code>TimeZoneRule</code>s which represents time tr ansitions,
87 * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
88 * <code>InitialTimeZoneRule</code>. The return value range is 0 or any pos itive value.
89 * @param status Receives error status code.
90 * @return The number of <code>TimeZoneRule</code>s representing time transi tions.
91 * @stable ICU 3.8
92 */
93 virtual int32_t countTransitionRules(UErrorCode& status) /*const*/ = 0;
94
95 /**
96 * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRu le</code>
97 * which represent time transitions for this time zone. On successful retur n,
98 * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
99 * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
100 * instances up to the size specified by trscount. The results are referenc ing the
101 * rule instance held by this time zone instance. Therefore, after this tim e zone
102 * is destructed, they are no longer available.
103 * @param initial Receives the initial timezone rule
104 * @param trsrules Receives the timezone transition rules
105 * @param trscount On input, specify the size of the array 'transitions ' receiving
106 * the timezone transition rules. On output, actual nu mber of
107 * rules filled in the array will be set.
108 * @param status Receives error status code.
109 * @stable ICU 3.8
110 */
111 virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
112 const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) / *const*/ = 0;
113
114 /**
115 * Gets the set of time zone rules valid at the specified time. Some known external time zone
116 * implementations are not capable to handle historic time zone rule changes . Also some
117 * implementations can only handle certain type of rule definitions.
118 * If this time zone does not use any daylight saving time within about 1 ye ar from the specified
119 * time, only the <code>InitialTimeZone</code> is returned. Otherwise, the rule for standard
120 * time and daylight saving time transitions are returned in addition to the
121 * <code>InitialTimeZoneRule</code>. The standard and daylight saving time transition rules are
122 * represented by <code>AnnualTimeZoneRule</code> with <code>DateTimeRule::D OW</code> for its date
123 * rule and <code>DateTimeRule::WALL_TIME</code> for its time rule. Because daylight saving time
124 * rule is changing time to time in many time zones and also mapping a trans ition time rule to
125 * different type is lossy transformation, the set of rules returned by this method may be valid
126 * for short period of time.
127 * The time zone rule objects returned by this method is owned by the caller , so the caller is
128 * responsible for deleting them after use.
129 * @param date The date used for extracting time zone rules.
130 * @param initial Receives the <code>InitialTimeZone</code>, always not NU LL.
131 * @param std Receives the <code>AnnualTimeZoneRule</code> for standar d time transitions.
132 * When this time time zone does not observe daylight savin g times around the
133 * specified date, NULL is set.
134 * @param dst Receives the <code>AnnualTimeZoneRule</code> for dayligh t saving time
135 * transitions. When this time zone does not observer dayl ight saving times
136 * around the specified date, NULL is set.
137 * @param status Receives error status code.
138 * @stable ICU 3.8
139 */
140 virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
141 AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) /*const*/;
142
143
144 /**
145 * The time type option bit flags used by getOffsetFromLocal
146 * @internal
147 */
148 enum {
149 kStandard = 0x01,
150 kDaylight = 0x03,
151 kFormer = 0x04,
152 kLatter = 0x0C
153 };
154
155 /**
156 * Get time zone offsets from local wall time.
157 * @internal
158 */
159 virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int3 2_t duplicatedTimeOpt,
160 int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) /*const*/;
161
162 protected:
163
164 /**
165 * The time type option bit masks used by getOffsetFromLocal
166 * @internal
167 */
168 enum {
169 kStdDstMask = kDaylight,
170 kFormerLatterMask = kLatter
171 };
172
173 /**
174 * Default constructor.
175 * @stable ICU 3.8
176 */
177 BasicTimeZone();
178
179 /**
180 * Construct a timezone with a given ID.
181 * @param id a system time zone ID
182 * @stable ICU 3.8
183 */
184 BasicTimeZone(const UnicodeString &id);
185
186 /**
187 * Copy constructor.
188 * @param source the object to be copied.
189 * @stable ICU 3.8
190 */
191 BasicTimeZone(const BasicTimeZone& source);
192
193 /**
194 * Gets the set of TimeZoneRule instances applicable to the specified time a nd after.
195 * @param start The start date used for extracting time zone rules
196 * @param initial Receives the InitialTimeZone, always not NULL
197 * @param transitionRules Receives the transition rules, could be NULL
198 * @param status Receives error status code
199 */
200 void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVect or*& transitionRules,
201 UErrorCode& status) /*const*/;
202 };
203
204 U_NAMESPACE_END
205
206 #endif /* #if !UCONFIG_NO_FORMATTING */
207
208 #endif // BASICTZ_H
209
210 //eof
OLDNEW
« no previous file with comments | « icu.gyp ('k') | public/i18n/unicode/bms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698