ICU 4.8.1.1
4.8.1.1
|
BasicTimeZone
is an abstract class extending TimeZone
.
More...
#include <basictz.h>
Public Types | |
enum | { kStandard = 0x01, kDaylight = 0x03, kFormer = 0x04, kLatter = 0x0C } |
The time type option bit flags used by getOffsetFromLocal. More... | |
Public Member Functions | |
virtual | ~BasicTimeZone () |
Destructor. | |
virtual UBool | getNextTransition (UDate base, UBool inclusive, TimeZoneTransition &result)=0 |
Gets the first time zone transition after the base time. | |
virtual UBool | getPreviousTransition (UDate base, UBool inclusive, TimeZoneTransition &result)=0 |
Gets the most recent time zone transition before the base time. | |
virtual UBool | hasEquivalentTransitions (BasicTimeZone &tz, UDate start, UDate end, UBool ignoreDstAmount, UErrorCode &ec) |
Checks if the time zone has equivalent transitions in the time range. | |
virtual int32_t | countTransitionRules (UErrorCode &status)=0 |
Returns the number of TimeZoneRule s which represents time transitions, for this time zone, that is, all TimeZoneRule s for this time zone except InitialTimeZoneRule . | |
virtual void | getTimeZoneRules (const InitialTimeZoneRule *&initial, const TimeZoneRule *trsrules[], int32_t &trscount, UErrorCode &status)=0 |
Gets the InitialTimeZoneRule and the set of TimeZoneRule which represent time transitions for this time zone. | |
virtual void | getSimpleRulesNear (UDate date, InitialTimeZoneRule *&initial, AnnualTimeZoneRule *&std, AnnualTimeZoneRule *&dst, UErrorCode &status) |
Gets the set of time zone rules valid at the specified time. | |
virtual void | getOffsetFromLocal (UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, int32_t &rawOffset, int32_t &dstOffset, UErrorCode &status) |
Get time zone offsets from local wall time. | |
Protected Types | |
enum | { kStdDstMask = kDaylight, kFormerLatterMask = kLatter } |
The time type option bit masks used by getOffsetFromLocal. More... | |
Protected Member Functions | |
BasicTimeZone () | |
Default constructor. | |
BasicTimeZone (const UnicodeString &id) | |
Construct a timezone with a given ID. | |
BasicTimeZone (const BasicTimeZone &source) | |
Copy constructor. | |
void | getTimeZoneRulesAfter (UDate start, InitialTimeZoneRule *&initial, UVector *&transitionRules, UErrorCode &status) |
Gets the set of TimeZoneRule instances applicable to the specified time and after. |
BasicTimeZone
is an abstract class extending TimeZone
.
This class provides some additional methods to access time zone transitions and rules. All ICU TimeZone
concrete subclasses extend this class.
anonymous enum |
anonymous enum [protected] |
virtual BasicTimeZone::~BasicTimeZone | ( | ) | [virtual] |
Destructor.
BasicTimeZone::BasicTimeZone | ( | ) | [protected] |
Default constructor.
BasicTimeZone::BasicTimeZone | ( | const UnicodeString & | id | ) | [protected] |
BasicTimeZone::BasicTimeZone | ( | const BasicTimeZone & | source | ) | [protected] |
virtual int32_t BasicTimeZone::countTransitionRules | ( | UErrorCode & | status | ) | [pure virtual] |
Returns the number of TimeZoneRule
s which represents time transitions, for this time zone, that is, all TimeZoneRule
s for this time zone except InitialTimeZoneRule
.
The return value range is 0 or any positive value.
status | Receives error status code. |
TimeZoneRule
s representing time transitions. Implemented in SimpleTimeZone, VTimeZone, and RuleBasedTimeZone.
virtual UBool BasicTimeZone::getNextTransition | ( | UDate | base, |
UBool | inclusive, | ||
TimeZoneTransition & | result | ||
) | [pure virtual] |
Gets the first time zone transition after the base time.
base | The base time. |
inclusive | Whether the base time is inclusive or not. |
result | Receives the first transition after the base time. |
Implemented in SimpleTimeZone, VTimeZone, and RuleBasedTimeZone.
virtual void BasicTimeZone::getOffsetFromLocal | ( | UDate | date, |
int32_t | nonExistingTimeOpt, | ||
int32_t | duplicatedTimeOpt, | ||
int32_t & | rawOffset, | ||
int32_t & | dstOffset, | ||
UErrorCode & | status | ||
) | [virtual] |
Get time zone offsets from local wall time.
Reimplemented in SimpleTimeZone, and RuleBasedTimeZone.
virtual UBool BasicTimeZone::getPreviousTransition | ( | UDate | base, |
UBool | inclusive, | ||
TimeZoneTransition & | result | ||
) | [pure virtual] |
Gets the most recent time zone transition before the base time.
base | The base time. |
inclusive | Whether the base time is inclusive or not. |
result | Receives the most recent transition before the base time. |
Implemented in SimpleTimeZone, VTimeZone, and RuleBasedTimeZone.
virtual void BasicTimeZone::getSimpleRulesNear | ( | UDate | date, |
InitialTimeZoneRule *& | initial, | ||
AnnualTimeZoneRule *& | std, | ||
AnnualTimeZoneRule *& | dst, | ||
UErrorCode & | status | ||
) | [virtual] |
Gets the set of time zone rules valid at the specified time.
Some known external time zone implementations are not capable to handle historic time zone rule changes. Also some implementations can only handle certain type of rule definitions. If this time zone does not use any daylight saving time within about 1 year from the specified time, only the InitialTimeZone
is returned. Otherwise, the rule for standard time and daylight saving time transitions are returned in addition to the InitialTimeZoneRule
. The standard and daylight saving time transition rules are represented by AnnualTimeZoneRule
with DateTimeRule::DOW
for its date rule and DateTimeRule::WALL_TIME
for its time rule. Because daylight saving time rule is changing time to time in many time zones and also mapping a transition time rule to different type is lossy transformation, the set of rules returned by this method may be valid for short period of time. The time zone rule objects returned by this method is owned by the caller, so the caller is responsible for deleting them after use.
date | The date used for extracting time zone rules. |
initial | Receives the InitialTimeZone , always not NULL. |
std | Receives the AnnualTimeZoneRule for standard time transitions. When this time time zone does not observe daylight saving times around the specified date, NULL is set. |
dst | Receives the AnnualTimeZoneRule for daylight saving time transitions. When this time zone does not observer daylight saving times around the specified date, NULL is set. |
status | Receives error status code. |
virtual void BasicTimeZone::getTimeZoneRules | ( | const InitialTimeZoneRule *& | initial, |
const TimeZoneRule * | trsrules[], | ||
int32_t & | trscount, | ||
UErrorCode & | status | ||
) | [pure virtual] |
Gets the InitialTimeZoneRule
and the set of TimeZoneRule
which represent time transitions for this time zone.
On successful return, the argument initial points to non-NULL InitialTimeZoneRule
and the array trsrules is filled with 0 or multiple TimeZoneRule
instances up to the size specified by trscount. The results are referencing the rule instance held by this time zone instance. Therefore, after this time zone is destructed, they are no longer available.
initial | Receives the initial timezone rule |
trsrules | Receives the timezone transition rules |
trscount | On input, specify the size of the array 'transitions' receiving the timezone transition rules. On output, actual number of rules filled in the array will be set. |
status | Receives error status code. |
Implemented in SimpleTimeZone, VTimeZone, and RuleBasedTimeZone.
void BasicTimeZone::getTimeZoneRulesAfter | ( | UDate | start, |
InitialTimeZoneRule *& | initial, | ||
UVector *& | transitionRules, | ||
UErrorCode & | status | ||
) | [protected] |
Gets the set of TimeZoneRule instances applicable to the specified time and after.
start | The start date used for extracting time zone rules |
initial | Receives the InitialTimeZone, always not NULL |
transitionRules | Receives the transition rules, could be NULL |
status | Receives error status code |
virtual UBool BasicTimeZone::hasEquivalentTransitions | ( | BasicTimeZone & | tz, |
UDate | start, | ||
UDate | end, | ||
UBool | ignoreDstAmount, | ||
UErrorCode & | ec | ||
) | [virtual] |
Checks if the time zone has equivalent transitions in the time range.
This method returns true when all of transition times, from/to standard offsets and DST savings used by this time zone match the other in the time range.
tz | The BasicTimeZone object to be compared with. |
start | The start time of the evaluated time range (inclusive) |
end | The end time of the evaluated time range (inclusive) |
ignoreDstAmount | When true, any transitions with only daylight saving amount changes will be ignored, except either of them is zero. For example, a transition from rawoffset 3:00/dstsavings 1:00 to rawoffset 2:00/dstsavings 2:00 is excluded from the comparison, but a transtion from rawoffset 2:00/dstsavings 1:00 to rawoffset 3:00/dstsavings 0:00 is included. |
ec | Output param to filled in with a success or an error. |