ICU 72.1 72.1
Public Member Functions | Static Public Member Functions | Static Public Attributes
icu::AnnualTimeZoneRule Class Reference

AnnualTimeZoneRule is a class used for representing a time zone rule which takes effect annually. More...

#include <tzrule.h>

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

Public Member Functions

 AnnualTimeZoneRule (const UnicodeString &name, int32_t rawOffset, int32_t dstSavings, const DateTimeRule &dateTimeRule, int32_t startYear, int32_t endYear)
 Constructs a AnnualTimeZoneRule with the name, the GMT offset of its standard time, the amount of daylight saving offset adjustment, the annual start time rule and the start/until years. More...
 
 AnnualTimeZoneRule (const UnicodeString &name, int32_t rawOffset, int32_t dstSavings, DateTimeRule *dateTimeRule, int32_t startYear, int32_t endYear)
 Constructs a AnnualTimeZoneRule with the name, the GMT offset of its standard time, the amount of daylight saving offset adjustment, the annual start time rule and the start/until years. More...
 
 AnnualTimeZoneRule (const AnnualTimeZoneRule &source)
 Copy constructor. More...
 
virtual ~AnnualTimeZoneRule ()
 Destructor. More...
 
virtual AnnualTimeZoneRuleclone () const override
 Clone this AnnualTimeZoneRule object polymorphically. More...
 
AnnualTimeZoneRuleoperator= (const AnnualTimeZoneRule &right)
 Assignment operator. More...
 
virtual bool operator== (const TimeZoneRule &that) const override
 Return true if the given TimeZoneRule objects are semantically equal. More...
 
virtual bool operator!= (const TimeZoneRule &that) const override
 Return true if the given TimeZoneRule objects are semantically unequal. More...
 
const DateTimeRulegetRule (void) const
 Gets the start date/time rule used by this rule. More...
 
int32_t getStartYear (void) const
 Gets the first year when this rule takes effect. More...
 
int32_t getEndYear (void) const
 Gets the end year when this rule takes effect. More...
 
UBool getStartInYear (int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate &result) const
 Gets the time when this rule takes effect in the given year. More...
 
virtual UBool isEquivalentTo (const TimeZoneRule &that) const override
 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 override
 Gets the very first time when this rule takes effect. More...
 
virtual UBool getFinalStart (int32_t prevRawOffset, int32_t prevDSTSavings, UDate &result) const override
 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 override
 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 override
 Gets the most recent time when this rule takes effect before the specified time. More...
 
virtual UClassID getDynamicClassID (void) const override
 Returns a unique class ID POLYMORPHICALLY. More...
 
- Public Member Functions inherited from icu::TimeZoneRule
virtual ~TimeZoneRule ()
 Destructor. More...
 
virtual TimeZoneRuleclone () const =0
 Clone this TimeZoneRule object polymorphically. More...
 
virtual bool operator== (const TimeZoneRule &that) const
 Return true if the given TimeZoneRule objects are semantically equal. More...
 
virtual bool 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...
 

Static Public Member Functions

static UClassID getStaticClassID (void)
 Return the class ID for this class. More...
 

Static Public Attributes

static const int32_t MAX_YEAR
 The constant representing the maximum year used for designating a rule is permanent. More...
 

Additional Inherited Members

- Protected Member Functions inherited from icu::TimeZoneRule
 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

AnnualTimeZoneRule is a class used for representing a time zone rule which takes effect annually.

The calendar system used for the rule is is based on Gregorian calendar

Stable:
ICU 3.8

Definition at line 366 of file tzrule.h.

Constructor & Destructor Documentation

◆ AnnualTimeZoneRule() [1/3]

icu::AnnualTimeZoneRule::AnnualTimeZoneRule ( const UnicodeString name,
int32_t  rawOffset,
int32_t  dstSavings,
const DateTimeRule dateTimeRule,
int32_t  startYear,
int32_t  endYear 
)

Constructs a AnnualTimeZoneRule with the name, the GMT offset of its standard time, the amount of daylight saving offset adjustment, the annual start time rule and the start/until years.

The input DateTimeRule is copied by this constructor, so the caller remains responsible for deleting the object.

Parameters
nameThe time zone name.
rawOffsetThe GMT 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.
dateTimeRuleThe start date/time rule repeated annually.
startYearThe first year when this rule takes effect.
endYearThe last year when this rule takes effect. If this rule is effective forever in future, specify MAX_YEAR.
Stable:
ICU 3.8

◆ AnnualTimeZoneRule() [2/3]

icu::AnnualTimeZoneRule::AnnualTimeZoneRule ( const UnicodeString name,
int32_t  rawOffset,
int32_t  dstSavings,
DateTimeRule dateTimeRule,
int32_t  startYear,
int32_t  endYear 
)

Constructs a AnnualTimeZoneRule with the name, the GMT offset of its standard time, the amount of daylight saving offset adjustment, the annual start time rule and the start/until years.

The input DateTimeRule object is adopted by this object, therefore, the caller must not delete the object.

Parameters
nameThe time zone name.
rawOffsetThe GMT 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.
dateTimeRuleThe start date/time rule repeated annually.
startYearThe first year when this rule takes effect.
endYearThe last year when this rule takes effect. If this rule is effective forever in future, specify MAX_YEAR.
Stable:
ICU 3.8

◆ AnnualTimeZoneRule() [3/3]

icu::AnnualTimeZoneRule::AnnualTimeZoneRule ( const AnnualTimeZoneRule source)

Copy constructor.

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

◆ ~AnnualTimeZoneRule()

virtual icu::AnnualTimeZoneRule::~AnnualTimeZoneRule ( )
virtual

Destructor.

Stable:
ICU 3.8

Member Function Documentation

◆ clone()

virtual AnnualTimeZoneRule * icu::AnnualTimeZoneRule::clone ( ) const
overridevirtual

Clone this AnnualTimeZoneRule object polymorphically.

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

Returns
A copy of the object.
Stable:
ICU 3.8

Implements icu::TimeZoneRule.

◆ getDynamicClassID()

virtual UClassID icu::AnnualTimeZoneRule::getDynamicClassID ( void  ) const
overridevirtual

Returns a unique class ID POLYMORPHICALLY.

Pure virtual override. This method is to implement a simple version of RTTI, since not all C++ compilers support genuine RTTI. Polymorphic operator==() and clone() methods call this method.

Returns
The class ID for this object. All objects of a given class have the same class ID. Objects of other classes have different class IDs.
Stable:
ICU 3.8

Reimplemented from icu::UObject.

◆ getEndYear()

int32_t icu::AnnualTimeZoneRule::getEndYear ( void  ) const

Gets the end year when this rule takes effect.

Returns
The end year of this rule (inclusive). The year is in Gregorian calendar with 0 == 1 BCE, -1 == 2 BCE, etc.
Stable:
ICU 3.8

◆ getFinalStart()

virtual UBool icu::AnnualTimeZoneRule::getFinalStart ( int32_t  prevRawOffset,
int32_t  prevDSTSavings,
UDate result 
) const
overridevirtual

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

Implements icu::TimeZoneRule.

◆ getFirstStart()

virtual UBool icu::AnnualTimeZoneRule::getFirstStart ( int32_t  prevRawOffset,
int32_t  prevDSTSavings,
UDate result 
) const
overridevirtual

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

Implements icu::TimeZoneRule.

◆ getNextStart()

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

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

Implements icu::TimeZoneRule.

◆ getPreviousStart()

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

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

Implements icu::TimeZoneRule.

◆ getRule()

const DateTimeRule * icu::AnnualTimeZoneRule::getRule ( void  ) const

Gets the start date/time rule used by this rule.

Returns
The AnnualDateTimeRule which represents the start date/time rule used by this time zone rule.
Stable:
ICU 3.8

◆ getStartInYear()

UBool icu::AnnualTimeZoneRule::getStartInYear ( int32_t  year,
int32_t  prevRawOffset,
int32_t  prevDSTSavings,
UDate result 
) const

Gets the time when this rule takes effect in the given year.

Parameters
yearThe Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
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 start time in the year.
Returns
true if this rule takes effect in the year and the result is set to "result".
Stable:
ICU 3.8

◆ getStartYear()

int32_t icu::AnnualTimeZoneRule::getStartYear ( void  ) const

Gets the first year when this rule takes effect.

Returns
The start year of this rule. The year is in Gregorian calendar with 0 == 1 BCE, -1 == 2 BCE, etc.
Stable:
ICU 3.8

◆ getStaticClassID()

static UClassID icu::AnnualTimeZoneRule::getStaticClassID ( void  )
static

Return the class ID for this class.

This is useful only for comparing to a return value from getDynamicClassID(). For example:

.   Base* polymorphic_pointer = createPolymorphicObject();
.   if (polymorphic_pointer->getDynamicClassID() ==
.       erived::getStaticClassID()) ...
Returns
The class ID for all objects of this class.
Stable:
ICU 3.8

◆ isEquivalentTo()

virtual UBool icu::AnnualTimeZoneRule::isEquivalentTo ( const TimeZoneRule that) const
overridevirtual

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
thatThe TimeZoneRule object to be compared with.
Returns
true if the other TimeZoneRule is equivalent to this one.
Stable:
ICU 3.8

Reimplemented from icu::TimeZoneRule.

◆ operator!=()

virtual bool icu::AnnualTimeZoneRule::operator!= ( const TimeZoneRule that) const
overridevirtual

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 from icu::TimeZoneRule.

◆ operator=()

AnnualTimeZoneRule & icu::AnnualTimeZoneRule::operator= ( const AnnualTimeZoneRule right)

Assignment operator.

Parameters
rightThe object to be copied.
Stable:
ICU 3.8

◆ operator==()

virtual bool icu::AnnualTimeZoneRule::operator== ( const TimeZoneRule that) const
overridevirtual

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 from icu::TimeZoneRule.

Field Documentation

◆ MAX_YEAR

const int32_t icu::AnnualTimeZoneRule::MAX_YEAR
static

The constant representing the maximum year used for designating a rule is permanent.

Definition at line 372 of file tzrule.h.


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