ICU 73.2  73.2
Public Types | Public Member Functions | Protected Member Functions | Static Protected Attributes
icu::BasicTimeZone Class Reference

BasicTimeZone is an abstract class extending TimeZone. More...

#include <basictz.h>

Inheritance diagram for icu::BasicTimeZone:
icu::TimeZone icu::UObject icu::UMemory icu::RuleBasedTimeZone icu::SimpleTimeZone icu::VTimeZone

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 BasicTimeZoneclone () const override=0
 Clones this object polymorphically.
virtual UBool getNextTransition (UDate base, UBool inclusive, TimeZoneTransition &result) const =0
 Gets the first time zone transition after the base time.
virtual UBool getPreviousTransition (UDate base, UBool inclusive, TimeZoneTransition &result) const =0
 Gets the most recent time zone transition before the base time.
virtual UBool hasEquivalentTransitions (const BasicTimeZone &tz, UDate start, UDate end, UBool ignoreDstAmount, UErrorCode &ec) const
 Checks if the time zone has equivalent transitions in the time range.
virtual int32_t countTransitionRules (UErrorCode &status) const =0
 Returns the number of TimeZoneRules which represents time transitions, for this time zone, that is, all TimeZoneRules for this time zone except InitialTimeZoneRule.
virtual void getTimeZoneRules (const InitialTimeZoneRule *&initial, const TimeZoneRule *trsrules[], int32_t &trscount, UErrorCode &status) const =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) const
 Gets the set of time zone rules valid at the specified time.
virtual void getOffsetFromLocal (UDate date, UTimeZoneLocalOption nonExistingTimeOpt, UTimeZoneLocalOption duplicatedTimeOpt, int32_t &rawOffset, int32_t &dstOffset, UErrorCode &status) const
 Get time zone offsets from local wall time.
void getOffsetFromLocal (UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, int32_t &rawOffset, int32_t &dstOffset, UErrorCode &status) const
 Get time zone offsets from local wall time.

Protected Member Functions

 BasicTimeZone ()
 Default constructor.
 BasicTimeZone (const UnicodeString &id)
 Construct a timezone with a given ID.
 BasicTimeZone (const BasicTimeZone &source)
 Copy constructor.
BasicTimeZoneoperator= (const BasicTimeZone &)
 Copy assignment.
void getTimeZoneRulesAfter (UDate start, InitialTimeZoneRule *&initial, UVector *&transitionRules, UErrorCode &status) const
 Gets the set of TimeZoneRule instances applicable to the specified time and after.

Static Protected Attributes

static constexpr int32_t kStdDstMask = kDaylight
 A time type option bit mask used by getOffsetFromLocal.
static constexpr int32_t kFormerLatterMask = kLatter
 A time type option bit mask used by getOffsetFromLocal.

Detailed Description

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.

Stable:
ICU 3.8

Definition at line 38 of file basictz.h.


Member Enumeration Documentation

anonymous enum

The time type option bit flags used by getOffsetFromLocal.

Internal:
Do not use.

This API is for internal use only.

Definition at line 170 of file basictz.h.


Constructor & Destructor Documentation

virtual icu::BasicTimeZone::~BasicTimeZone ( ) [virtual]

Destructor.

Stable:
ICU 3.8

Default constructor.

Stable:
ICU 3.8
icu::BasicTimeZone::BasicTimeZone ( const UnicodeString id) [protected]

Construct a timezone with a given ID.

Parameters:
ida system time zone ID
Stable:
ICU 3.8
icu::BasicTimeZone::BasicTimeZone ( const BasicTimeZone source) [protected]

Copy constructor.

Parameters:
sourcethe object to be copied.
Stable:
ICU 3.8

Member Function Documentation

virtual BasicTimeZone* icu::BasicTimeZone::clone ( ) const [override, pure virtual]

Clones this object polymorphically.

The caller owns the result and should delete it when done.

Returns:
clone, or nullptr if an error occurred
Stable:
ICU 3.8

Implements icu::TimeZone.

Implemented in icu::SimpleTimeZone, icu::VTimeZone, and icu::RuleBasedTimeZone.

virtual int32_t icu::BasicTimeZone::countTransitionRules ( UErrorCode status) const [pure virtual]

Returns the number of TimeZoneRules which represents time transitions, for this time zone, that is, all TimeZoneRules for this time zone except InitialTimeZoneRule.

The return value range is 0 or any positive value.

Parameters:
statusReceives error status code.
Returns:
The number of TimeZoneRules representing time transitions.
Stable:
ICU 3.8

Implemented in icu::SimpleTimeZone, icu::VTimeZone, and icu::RuleBasedTimeZone.

virtual UBool icu::BasicTimeZone::getNextTransition ( UDate  base,
UBool  inclusive,
TimeZoneTransition result 
) const [pure virtual]

Gets the first time zone transition after the base time.

Parameters:
baseThe base time.
inclusiveWhether the base time is inclusive or not.
resultReceives the first transition after the base time.
Returns:
true if the transition is found.
Stable:
ICU 3.8

Implemented in icu::SimpleTimeZone, icu::VTimeZone, and icu::RuleBasedTimeZone.

virtual void icu::BasicTimeZone::getOffsetFromLocal ( UDate  date,
UTimeZoneLocalOption  nonExistingTimeOpt,
UTimeZoneLocalOption  duplicatedTimeOpt,
int32_t &  rawOffset,
int32_t &  dstOffset,
UErrorCode status 
) const [virtual]

Get time zone offsets from local wall time.

Stable:
ICU 69

Reimplemented in icu::SimpleTimeZone, icu::RuleBasedTimeZone, and icu::VTimeZone.

void icu::BasicTimeZone::getOffsetFromLocal ( UDate  date,
int32_t  nonExistingTimeOpt,
int32_t  duplicatedTimeOpt,
int32_t &  rawOffset,
int32_t &  dstOffset,
UErrorCode status 
) const

Get time zone offsets from local wall time.

Internal:
Do not use. This API is for internal use only.
virtual UBool icu::BasicTimeZone::getPreviousTransition ( UDate  base,
UBool  inclusive,
TimeZoneTransition result 
) const [pure virtual]

Gets the most recent time zone transition before the base time.

Parameters:
baseThe base time.
inclusiveWhether the base time is inclusive or not.
resultReceives the most recent transition before the base time.
Returns:
true if the transition is found.
Stable:
ICU 3.8

Implemented in icu::SimpleTimeZone, icu::VTimeZone, and icu::RuleBasedTimeZone.

virtual void icu::BasicTimeZone::getSimpleRulesNear ( UDate  date,
InitialTimeZoneRule *&  initial,
AnnualTimeZoneRule *&  std,
AnnualTimeZoneRule *&  dst,
UErrorCode status 
) const [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.

Parameters:
dateThe date used for extracting time zone rules.
initialReceives the InitialTimeZone, always not nullptr.
stdReceives the AnnualTimeZoneRule for standard time transitions. When this time time zone does not observe daylight saving times around the specified date, nullptr is set.
dstReceives the AnnualTimeZoneRule for daylight saving time transitions. When this time zone does not observer daylight saving times around the specified date, nullptr is set.
statusReceives error status code.
Stable:
ICU 3.8
virtual void icu::BasicTimeZone::getTimeZoneRules ( const InitialTimeZoneRule *&  initial,
const TimeZoneRule trsrules[],
int32_t &  trscount,
UErrorCode status 
) const [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-nullptr 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.

Parameters:
initialReceives the initial timezone rule
trsrulesReceives the timezone transition rules
trscountOn 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.
statusReceives error status code.
Stable:
ICU 3.8

Implemented in icu::SimpleTimeZone, icu::VTimeZone, and icu::RuleBasedTimeZone.

void icu::BasicTimeZone::getTimeZoneRulesAfter ( UDate  start,
InitialTimeZoneRule *&  initial,
UVector *&  transitionRules,
UErrorCode status 
) const [protected]

Gets the set of TimeZoneRule instances applicable to the specified time and after.

Parameters:
startThe start date used for extracting time zone rules
initialOutput parameter, receives the InitialTimeZone. Always not nullptr (except in case of error)
transitionRulesOutput parameter, a UVector of transition rules. May be nullptr, if there are no transition rules. The caller owns the returned vector; the UVector owns the rules.
statusReceives error status code
virtual UBool icu::BasicTimeZone::hasEquivalentTransitions ( const BasicTimeZone tz,
UDate  start,
UDate  end,
UBool  ignoreDstAmount,
UErrorCode ec 
) const [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.

Parameters:
tzThe BasicTimeZone object to be compared with.
startThe start time of the evaluated time range (inclusive)
endThe end time of the evaluated time range (inclusive)
ignoreDstAmountWhen 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 transition from rawoffset 2:00/dstsavings 1:00 to rawoffset 3:00/dstsavings 0:00 is included.
ecOutput param to filled in with a success or an error.
Returns:
true if the other time zone has the equivalent transitions in the time range.
Stable:
ICU 3.8
BasicTimeZone& icu::BasicTimeZone::operator= ( const BasicTimeZone ) [protected]

Copy assignment.

Stable:
ICU 3.8

Field Documentation

constexpr int32_t icu::BasicTimeZone::kFormerLatterMask = kLatter [static, protected]

A time type option bit mask used by getOffsetFromLocal.

Internal:
Do not use. This API is for internal use only.

Definition at line 197 of file basictz.h.

constexpr int32_t icu::BasicTimeZone::kStdDstMask = kDaylight [static, protected]

A time type option bit mask used by getOffsetFromLocal.

Internal:
Do not use. This API is for internal use only.

Definition at line 192 of file basictz.h.


The documentation for this class was generated from the following file: