ICU 64.2  64.2
Public Member Functions | Protected Member Functions
icu::TimeZoneRule Class Referenceabstract

TimeZoneRule is a class representing a rule for time zone. More...

#include <tzrule.h>

Inheritance diagram for icu::TimeZoneRule:
icu::UObject icu::UMemory icu::AnnualTimeZoneRule icu::InitialTimeZoneRule icu::TimeArrayTimeZoneRule

Public Member Functions

virtual ~TimeZoneRule ()
 Destructor. More...
 
virtual TimeZoneRuleclone (void) const =0
 Clone this TimeZoneRule object polymorphically. More...
 
virtual UBool operator== (const TimeZoneRule &that) const
 Return true if the given TimeZoneRule objects are semantically equal. More...
 
virtual UBool operator!= (const TimeZoneRule &that) const
 Return true if the given TimeZoneRule objects are semantically unequal. More...
 
UnicodeStringgetName (UnicodeString &name) const
 Fills in "name" with the name of this time zone. More...
 
int32_t getRawOffset (void) const
 Gets the standard time offset. More...
 
int32_t getDSTSavings (void) const
 Gets the amount of daylight saving delta time from the standard time. More...
 
virtual UBool isEquivalentTo (const TimeZoneRule &other) const
 Returns if this rule represents the same rule and offsets as another. More...
 
virtual UBool getFirstStart (int32_t prevRawOffset, int32_t prevDSTSavings, UDate &result) const =0
 Gets the very first time when this rule takes effect. More...
 
virtual UBool getFinalStart (int32_t prevRawOffset, int32_t prevDSTSavings, UDate &result) const =0
 Gets the final time when this rule takes effect. More...
 
virtual UBool getNextStart (UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, UBool inclusive, UDate &result) const =0
 Gets the first time when this rule takes effect after the specified time. More...
 
virtual UBool getPreviousStart (UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, UBool inclusive, UDate &result) const =0
 Gets the most recent time when this rule takes effect before the specified time. More...
 
- Public Member Functions inherited from icu::UObject
virtual ~UObject ()
 Destructor. More...
 
virtual UClassID getDynamicClassID () const
 ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More...
 

Protected Member Functions

 TimeZoneRule (const UnicodeString &name, int32_t rawOffset, int32_t dstSavings)
 Constructs a TimeZoneRule with the name, the GMT offset of its standard time and the amount of daylight saving offset adjustment. More...
 
 TimeZoneRule (const TimeZoneRule &source)
 Copy constructor. More...
 
TimeZoneRuleoperator= (const TimeZoneRule &right)
 Assignment operator. More...
 

Detailed Description

TimeZoneRule is a class representing a rule for time zone.

TimeZoneRule has a set of time zone attributes, such as zone name, raw offset (UTC offset for standard time) and daylight saving time offset.

Stable:
ICU 3.8

Definition at line 34 of file tzrule.h.

Constructor & Destructor Documentation

◆ ~TimeZoneRule()

virtual icu::TimeZoneRule::~TimeZoneRule ( )
virtual

Destructor.

Stable:
ICU 3.8

◆ TimeZoneRule() [1/2]

icu::TimeZoneRule::TimeZoneRule ( const UnicodeString name,
int32_t  rawOffset,
int32_t  dstSavings 
)
protected

Constructs a TimeZoneRule with the name, the GMT offset of its standard time and the amount of daylight saving offset adjustment.

Parameters
nameThe time zone name.
rawOffsetThe UTC offset of its standard time in milliseconds.
dstSavingsThe amount of daylight saving offset adjustment in milliseconds. If this ia a rule for standard time, the value of this argument is 0.
Stable:
ICU 3.8

◆ TimeZoneRule() [2/2]

icu::TimeZoneRule::TimeZoneRule ( const TimeZoneRule source)
protected

Copy constructor.

Parameters
sourceThe TimeZoneRule object to be copied.
Stable:
ICU 3.8

Member Function Documentation

◆ clone()

virtual TimeZoneRule* icu::TimeZoneRule::clone ( void  ) const
pure virtual

Clone this TimeZoneRule object polymorphically.

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

Returns
A copy of the object.
Stable:
ICU 3.8

Implemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.

◆ getDSTSavings()

int32_t icu::TimeZoneRule::getDSTSavings ( void  ) const

Gets the amount of daylight saving delta time from the standard time.

Returns
The amount of daylight saving offset used by this rule in milliseconds.
Stable:
ICU 3.8

◆ getFinalStart()

virtual UBool icu::TimeZoneRule::getFinalStart ( int32_t  prevRawOffset,
int32_t  prevDSTSavings,
UDate result 
) const
pure virtual

Gets the final time when this rule takes effect.

Parameters
prevRawOffsetThe standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavingsThe amount of daylight saving offset from the standard time.
resultReceives the final time when this rule takes effect.
Returns
true if the start time is available. When false is returned, output parameter "result" is unchanged.
Stable:
ICU 3.8

Implemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.

◆ getFirstStart()

virtual UBool icu::TimeZoneRule::getFirstStart ( int32_t  prevRawOffset,
int32_t  prevDSTSavings,
UDate result 
) const
pure virtual

Gets the very first time when this rule takes effect.

Parameters
prevRawOffsetThe standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavingsThe amount of daylight saving offset from the standard time.
resultReceives the very first time when this rule takes effect.
Returns
true if the start time is available. When false is returned, output parameter "result" is unchanged.
Stable:
ICU 3.8

Implemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.

◆ getName()

UnicodeString& icu::TimeZoneRule::getName ( UnicodeString name) const

Fills in "name" with the name of this time zone.

Parameters
nameReceives the name of this time zone.
Returns
A reference to "name"
Stable:
ICU 3.8

◆ getNextStart()

virtual UBool icu::TimeZoneRule::getNextStart ( UDate  base,
int32_t  prevRawOffset,
int32_t  prevDSTSavings,
UBool  inclusive,
UDate result 
) const
pure virtual

Gets the first time when this rule takes effect after the specified time.

Parameters
baseThe first start time after this base time will be returned.
prevRawOffsetThe standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavingsThe amount of daylight saving offset from the standard time.
inclusiveWhether the base time is inclusive or not.
resultReceives The first time when this rule takes effect after the specified base time.
Returns
true if the start time is available. When false is returned, output parameter "result" is unchanged.
Stable:
ICU 3.8

Implemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.

◆ getPreviousStart()

virtual UBool icu::TimeZoneRule::getPreviousStart ( UDate  base,
int32_t  prevRawOffset,
int32_t  prevDSTSavings,
UBool  inclusive,
UDate result 
) const
pure virtual

Gets the most recent time when this rule takes effect before the specified time.

Parameters
baseThe most recent time before this base time will be returned.
prevRawOffsetThe standard time offset from UTC before this rule takes effect in milliseconds.
prevDSTSavingsThe amount of daylight saving offset from the standard time.
inclusiveWhether the base time is inclusive or not.
resultReceives The most recent time when this rule takes effect before the specified base time.
Returns
true if the start time is available. When false is returned, output parameter "result" is unchanged.
Stable:
ICU 3.8

Implemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.

◆ getRawOffset()

int32_t icu::TimeZoneRule::getRawOffset ( void  ) const

Gets the standard time offset.

Returns
The standard time offset from UTC in milliseconds.
Stable:
ICU 3.8

◆ isEquivalentTo()

virtual UBool icu::TimeZoneRule::isEquivalentTo ( const TimeZoneRule other) const
virtual

Returns if this rule represents the same rule and offsets as another.

When two TimeZoneRule objects differ only its names, this method returns true.

Parameters
otherThe TimeZoneRule object to be compared with.
Returns
true if the other TimeZoneRule is the same as this one.
Stable:
ICU 3.8

Reimplemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.

◆ operator!=()

virtual UBool icu::TimeZoneRule::operator!= ( const TimeZoneRule that) const
virtual

Return true if the given TimeZoneRule objects are semantically unequal.

Objects of different subclasses are considered unequal.

Parameters
thatThe object to be compared with.
Returns
true if the given TimeZoneRule objects are semantically unequal.
Stable:
ICU 3.8

Reimplemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.

◆ operator=()

TimeZoneRule& icu::TimeZoneRule::operator= ( const TimeZoneRule right)
protected

Assignment operator.

Parameters
rightThe object to be copied.
Stable:
ICU 3.8

◆ operator==()

virtual UBool icu::TimeZoneRule::operator== ( const TimeZoneRule that) const
virtual

Return true if the given TimeZoneRule objects are semantically equal.

Objects of different subclasses are considered unequal.

Parameters
thatThe object to be compared with.
Returns
true if the given TimeZoneRule objects are semantically equal.
Stable:
ICU 3.8

Reimplemented in icu::TimeArrayTimeZoneRule, icu::AnnualTimeZoneRule, and icu::InitialTimeZoneRule.


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