annotate modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/unicode/basictz.h @ 11038:20a8447c71c6

8207159: Update ICU to version 62.1 Reviewed-by: mbilla, kcr, ghb
author arajkumar
date Fri, 24 Aug 2018 15:06:40 +0530
parents fee4ef5c87df
children
rev   line source
arajkumar@11038 1 // © 2016 and later: Unicode, Inc. and others.
arajkumar@11038 2 // License & terms of use: http://www.unicode.org/copyright.html
ghb@10550 3 /*
ghb@10550 4 *******************************************************************************
ghb@10550 5 * Copyright (C) 2007-2013, International Business Machines Corporation and
ghb@10550 6 * others. All Rights Reserved.
ghb@10550 7 *******************************************************************************
ghb@10550 8 */
ghb@10550 9 #ifndef BASICTZ_H
ghb@10550 10 #define BASICTZ_H
ghb@10550 11
ghb@10550 12 /**
ghb@10550 13 * \file
ghb@10550 14 * \brief C++ API: ICU TimeZone base class
ghb@10550 15 */
ghb@10550 16
ghb@10550 17 #include "unicode/utypes.h"
ghb@10550 18
ghb@10550 19 #if !UCONFIG_NO_FORMATTING
ghb@10550 20
ghb@10550 21 #include "unicode/timezone.h"
ghb@10550 22 #include "unicode/tzrule.h"
ghb@10550 23 #include "unicode/tztrans.h"
ghb@10550 24
ghb@10550 25 U_NAMESPACE_BEGIN
ghb@10550 26
ghb@10550 27 // forward declarations
ghb@10550 28 class UVector;
ghb@10550 29
ghb@10550 30 /**
ghb@10550 31 * <code>BasicTimeZone</code> is an abstract class extending <code>TimeZone</code>.
ghb@10550 32 * This class provides some additional methods to access time zone transitions and rules.
ghb@10550 33 * All ICU <code>TimeZone</code> concrete subclasses extend this class.
ghb@10550 34 * @stable ICU 3.8
ghb@10550 35 */
ghb@10550 36 class U_I18N_API BasicTimeZone: public TimeZone {
ghb@10550 37 public:
ghb@10550 38 /**
ghb@10550 39 * Destructor.
ghb@10550 40 * @stable ICU 3.8
ghb@10550 41 */
ghb@10550 42 virtual ~BasicTimeZone();
ghb@10550 43
ghb@10550 44 /**
ghb@10550 45 * Gets the first time zone transition after the base time.
ghb@10550 46 * @param base The base time.
ghb@10550 47 * @param inclusive Whether the base time is inclusive or not.
ghb@10550 48 * @param result Receives the first transition after the base time.
ghb@10550 49 * @return TRUE if the transition is found.
ghb@10550 50 * @stable ICU 3.8
ghb@10550 51 */
ghb@10550 52 virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
ghb@10550 53
ghb@10550 54 /**
ghb@10550 55 * Gets the most recent time zone transition before the base time.
ghb@10550 56 * @param base The base time.
ghb@10550 57 * @param inclusive Whether the base time is inclusive or not.
ghb@10550 58 * @param result Receives the most recent transition before the base time.
ghb@10550 59 * @return TRUE if the transition is found.
ghb@10550 60 * @stable ICU 3.8
ghb@10550 61 */
ghb@10550 62 virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
ghb@10550 63
ghb@10550 64 /**
ghb@10550 65 * Checks if the time zone has equivalent transitions in the time range.
ghb@10550 66 * This method returns true when all of transition times, from/to standard
ghb@10550 67 * offsets and DST savings used by this time zone match the other in the
ghb@10550 68 * time range.
ghb@10550 69 * @param tz The <code>BasicTimeZone</code> object to be compared with.
ghb@10550 70 * @param start The start time of the evaluated time range (inclusive)
ghb@10550 71 * @param end The end time of the evaluated time range (inclusive)
ghb@10550 72 * @param ignoreDstAmount
ghb@10550 73 * When true, any transitions with only daylight saving amount
ghb@10550 74 * changes will be ignored, except either of them is zero.
ghb@10550 75 * For example, a transition from rawoffset 3:00/dstsavings 1:00
ghb@10550 76 * to rawoffset 2:00/dstsavings 2:00 is excluded from the comparison,
ghb@10550 77 * but a transtion from rawoffset 2:00/dstsavings 1:00 to
ghb@10550 78 * rawoffset 3:00/dstsavings 0:00 is included.
ghb@10550 79 * @param ec Output param to filled in with a success or an error.
ghb@10550 80 * @return true if the other time zone has the equivalent transitions in the
ghb@10550 81 * time range.
ghb@10550 82 * @stable ICU 3.8
ghb@10550 83 */
ghb@10550 84 virtual UBool hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UDate end,
ghb@10550 85 UBool ignoreDstAmount, UErrorCode& ec) const;
ghb@10550 86
ghb@10550 87 /**
ghb@10550 88 * Returns the number of <code>TimeZoneRule</code>s which represents time transitions,
ghb@10550 89 * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except
ghb@10550 90 * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value.
ghb@10550 91 * @param status Receives error status code.
ghb@10550 92 * @return The number of <code>TimeZoneRule</code>s representing time transitions.
ghb@10550 93 * @stable ICU 3.8
ghb@10550 94 */
ghb@10550 95 virtual int32_t countTransitionRules(UErrorCode& status) const = 0;
ghb@10550 96
ghb@10550 97 /**
ghb@10550 98 * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
ghb@10550 99 * which represent time transitions for this time zone. On successful return,
ghb@10550 100 * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
ghb@10550 101 * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
ghb@10550 102 * instances up to the size specified by trscount. The results are referencing the
ghb@10550 103 * rule instance held by this time zone instance. Therefore, after this time zone
ghb@10550 104 * is destructed, they are no longer available.
ghb@10550 105 * @param initial Receives the initial timezone rule
ghb@10550 106 * @param trsrules Receives the timezone transition rules
ghb@10550 107 * @param trscount On input, specify the size of the array 'transitions' receiving
ghb@10550 108 * the timezone transition rules. On output, actual number of
ghb@10550 109 * rules filled in the array will be set.
ghb@10550 110 * @param status Receives error status code.
ghb@10550 111 * @stable ICU 3.8
ghb@10550 112 */
ghb@10550 113 virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
ghb@10550 114 const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const = 0;
ghb@10550 115
ghb@10550 116 /**
ghb@10550 117 * Gets the set of time zone rules valid at the specified time. Some known external time zone
ghb@10550 118 * implementations are not capable to handle historic time zone rule changes. Also some
ghb@10550 119 * implementations can only handle certain type of rule definitions.
ghb@10550 120 * If this time zone does not use any daylight saving time within about 1 year from the specified
ghb@10550 121 * time, only the <code>InitialTimeZone</code> is returned. Otherwise, the rule for standard
ghb@10550 122 * time and daylight saving time transitions are returned in addition to the
ghb@10550 123 * <code>InitialTimeZoneRule</code>. The standard and daylight saving time transition rules are
ghb@10550 124 * represented by <code>AnnualTimeZoneRule</code> with <code>DateTimeRule::DOW</code> for its date
ghb@10550 125 * rule and <code>DateTimeRule::WALL_TIME</code> for its time rule. Because daylight saving time
ghb@10550 126 * rule is changing time to time in many time zones and also mapping a transition time rule to
ghb@10550 127 * different type is lossy transformation, the set of rules returned by this method may be valid
ghb@10550 128 * for short period of time.
ghb@10550 129 * The time zone rule objects returned by this method is owned by the caller, so the caller is
ghb@10550 130 * responsible for deleting them after use.
ghb@10550 131 * @param date The date used for extracting time zone rules.
ghb@10550 132 * @param initial Receives the <code>InitialTimeZone</code>, always not NULL.
ghb@10550 133 * @param std Receives the <code>AnnualTimeZoneRule</code> for standard time transitions.
ghb@10550 134 * When this time time zone does not observe daylight saving times around the
ghb@10550 135 * specified date, NULL is set.
ghb@10550 136 * @param dst Receives the <code>AnnualTimeZoneRule</code> for daylight saving time
ghb@10550 137 * transitions. When this time zone does not observer daylight saving times
ghb@10550 138 * around the specified date, NULL is set.
ghb@10550 139 * @param status Receives error status code.
ghb@10550 140 * @stable ICU 3.8
ghb@10550 141 */
ghb@10550 142 virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
ghb@10550 143 AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const;
ghb@10550 144
ghb@10550 145
ghb@10550 146 #ifndef U_HIDE_INTERNAL_API
ghb@10550 147 /**
ghb@10550 148 * The time type option bit flags used by getOffsetFromLocal
ghb@10550 149 * @internal
ghb@10550 150 */
ghb@10550 151 enum {
ghb@10550 152 kStandard = 0x01,
ghb@10550 153 kDaylight = 0x03,
ghb@10550 154 kFormer = 0x04,
ghb@10550 155 kLatter = 0x0C
ghb@10550 156 };
ghb@10550 157 #endif /* U_HIDE_INTERNAL_API */
ghb@10550 158
ghb@10550 159 /**
ghb@10550 160 * Get time zone offsets from local wall time.
ghb@10550 161 * @internal
ghb@10550 162 */
ghb@10550 163 virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
ghb@10550 164 int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const;
ghb@10550 165
ghb@10550 166 protected:
ghb@10550 167
ghb@10550 168 #ifndef U_HIDE_INTERNAL_API
ghb@10550 169 /**
ghb@10550 170 * The time type option bit masks used by getOffsetFromLocal
ghb@10550 171 * @internal
ghb@10550 172 */
ghb@10550 173 enum {
ghb@10550 174 kStdDstMask = kDaylight,
ghb@10550 175 kFormerLatterMask = kLatter
ghb@10550 176 };
ghb@10550 177 #endif /* U_HIDE_INTERNAL_API */
ghb@10550 178
ghb@10550 179 /**
ghb@10550 180 * Default constructor.
ghb@10550 181 * @stable ICU 3.8
ghb@10550 182 */
ghb@10550 183 BasicTimeZone();
ghb@10550 184
ghb@10550 185 /**
ghb@10550 186 * Construct a timezone with a given ID.
ghb@10550 187 * @param id a system time zone ID
ghb@10550 188 * @stable ICU 3.8
ghb@10550 189 */
ghb@10550 190 BasicTimeZone(const UnicodeString &id);
ghb@10550 191
ghb@10550 192 /**
ghb@10550 193 * Copy constructor.
ghb@10550 194 * @param source the object to be copied.
ghb@10550 195 * @stable ICU 3.8
ghb@10550 196 */
ghb@10550 197 BasicTimeZone(const BasicTimeZone& source);
ghb@10550 198
ghb@10550 199 /**
ghb@10550 200 * Gets the set of TimeZoneRule instances applicable to the specified time and after.
ghb@10550 201 * @param start The start date used for extracting time zone rules
ghb@10550 202 * @param initial Receives the InitialTimeZone, always not NULL
ghb@10550 203 * @param transitionRules Receives the transition rules, could be NULL
ghb@10550 204 * @param status Receives error status code
ghb@10550 205 */
ghb@10550 206 void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules,
ghb@10550 207 UErrorCode& status) const;
ghb@10550 208 };
ghb@10550 209
ghb@10550 210 U_NAMESPACE_END
ghb@10550 211
ghb@10550 212 #endif /* #if !UCONFIG_NO_FORMATTING */
ghb@10550 213
ghb@10550 214 #endif // BASICTZ_H
ghb@10550 215
ghb@10550 216 //eof