1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 2007-2008, International Business Machines Corporation and *
6 * others. All Rights Reserved. *
7 *******************************************************************************
14 * \brief C++ API: Time zone rule classes
17 #include "unicode/utypes.h"
19 #if !UCONFIG_NO_FORMATTING
21 #include "unicode/uobject.h"
22 #include "unicode/unistr.h"
23 #include "unicode/dtrule.h"
25 #if U_SHOW_CPLUSPLUS_API
29 * <code>TimeZoneRule</code> is a class representing a rule for time zone.
30 * <code>TimeZoneRule</code> has a set of time zone attributes, such as zone name,
31 * raw offset (UTC offset for standard time) and daylight saving time offset.
35 class U_I18N_API TimeZoneRule
: public UObject
{
41 virtual ~TimeZoneRule();
44 * Clone this TimeZoneRule object polymorphically. The caller owns the result and
45 * should delete it when done.
46 * @return A copy of the object.
49 virtual TimeZoneRule
* clone(void) const = 0;
52 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
53 * of different subclasses are considered unequal.
54 * @param that The object to be compared with.
55 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
58 virtual UBool
operator==(const TimeZoneRule
& that
) const;
61 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
62 * of different subclasses are considered unequal.
63 * @param that The object to be compared with.
64 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
67 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
70 * Fills in "name" with the name of this time zone.
71 * @param name Receives the name of this time zone.
72 * @return A reference to "name"
75 UnicodeString
& getName(UnicodeString
& name
) const;
78 * Gets the standard time offset.
79 * @return The standard time offset from UTC in milliseconds.
82 int32_t getRawOffset(void) const;
85 * Gets the amount of daylight saving delta time from the standard time.
86 * @return The amount of daylight saving offset used by this rule
90 int32_t getDSTSavings(void) const;
93 * Returns if this rule represents the same rule and offsets as another.
94 * When two <code>TimeZoneRule</code> objects differ only its names, this method
96 * @param other The <code>TimeZoneRule</code> object to be compared with.
97 * @return true if the other <code>TimeZoneRule</code> is the same as this one.
100 virtual UBool
isEquivalentTo(const TimeZoneRule
& other
) const;
103 * Gets the very first time when this rule takes effect.
104 * @param prevRawOffset The standard time offset from UTC before this rule
105 * takes effect in milliseconds.
106 * @param prevDSTSavings The amount of daylight saving offset from the
108 * @param result Receives the very first time when this rule takes effect.
109 * @return true if the start time is available. When false is returned, output parameter
110 * "result" is unchanged.
113 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const = 0;
116 * Gets the final time when this rule takes effect.
117 * @param prevRawOffset The standard time offset from UTC before this rule
118 * takes effect in milliseconds.
119 * @param prevDSTSavings The amount of daylight saving offset from the
121 * @param result Receives the final time when this rule takes effect.
122 * @return true if the start time is available. When false is returned, output parameter
123 * "result" is unchanged.
126 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const = 0;
129 * Gets the first time when this rule takes effect after the specified time.
130 * @param base The first start time after this base time will be returned.
131 * @param prevRawOffset The standard time offset from UTC before this rule
132 * takes effect in milliseconds.
133 * @param prevDSTSavings The amount of daylight saving offset from the
135 * @param inclusive Whether the base time is inclusive or not.
136 * @param result Receives The first time when this rule takes effect after
137 * the specified base time.
138 * @return true if the start time is available. When false is returned, output parameter
139 * "result" is unchanged.
142 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
143 UBool inclusive
, UDate
& result
) const = 0;
146 * Gets the most recent time when this rule takes effect before the specified time.
147 * @param base The most recent time before this base time will be returned.
148 * @param prevRawOffset The standard time offset from UTC before this rule
149 * takes effect in milliseconds.
150 * @param prevDSTSavings The amount of daylight saving offset from the
152 * @param inclusive Whether the base time is inclusive or not.
153 * @param result Receives The most recent time when this rule takes effect before
154 * the specified base time.
155 * @return true if the start time is available. When false is returned, output parameter
156 * "result" is unchanged.
159 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
160 UBool inclusive
, UDate
& result
) const = 0;
165 * Constructs a <code>TimeZoneRule</code> with the name, the GMT offset of its
166 * standard time and the amount of daylight saving offset adjustment.
167 * @param name The time zone name.
168 * @param rawOffset The UTC offset of its standard time in milliseconds.
169 * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
170 * If this ia a rule for standard time, the value of this argument is 0.
173 TimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
);
177 * @param source The TimeZoneRule object to be copied.
180 TimeZoneRule(const TimeZoneRule
& source
);
183 * Assignment operator.
184 * @param right The object to be copied.
187 TimeZoneRule
& operator=(const TimeZoneRule
& right
);
190 UnicodeString fName
; // time name
191 int32_t fRawOffset
; // UTC offset of the standard time in milliseconds
192 int32_t fDSTSavings
; // DST saving amount in milliseconds
196 * <code>InitialTimeZoneRule</code> represents a time zone rule
197 * representing a time zone effective from the beginning and
198 * has no actual start times.
201 class U_I18N_API InitialTimeZoneRule
: public TimeZoneRule
{
204 * Constructs an <code>InitialTimeZoneRule</code> with the name, the GMT offset of its
205 * standard time and the amount of daylight saving offset adjustment.
206 * @param name The time zone name.
207 * @param rawOffset The UTC offset of its standard time in milliseconds.
208 * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
209 * If this ia a rule for standard time, the value of this argument is 0.
212 InitialTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
);
216 * @param source The InitialTimeZoneRule object to be copied.
219 InitialTimeZoneRule(const InitialTimeZoneRule
& source
);
225 virtual ~InitialTimeZoneRule();
228 * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and
229 * should delete it when done.
230 * @return A copy of the object.
233 virtual InitialTimeZoneRule
* clone(void) const;
236 * Assignment operator.
237 * @param right The object to be copied.
240 InitialTimeZoneRule
& operator=(const InitialTimeZoneRule
& right
);
243 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
244 * of different subclasses are considered unequal.
245 * @param that The object to be compared with.
246 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
249 virtual UBool
operator==(const TimeZoneRule
& that
) const;
252 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
253 * of different subclasses are considered unequal.
254 * @param that The object to be compared with.
255 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
258 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
261 * Gets the time when this rule takes effect in the given year.
262 * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
263 * @param prevRawOffset The standard time offset from UTC before this rule
264 * takes effect in milliseconds.
265 * @param prevDSTSavings The amount of daylight saving offset from the
267 * @param result Receives the start time in the year.
268 * @return true if this rule takes effect in the year and the result is set to
272 UBool
getStartInYear(int32_t year
, int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
275 * Returns if this rule represents the same rule and offsets as another.
276 * When two <code>TimeZoneRule</code> objects differ only its names, this method
278 * @param that The <code>TimeZoneRule</code> object to be compared with.
279 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
282 virtual UBool
isEquivalentTo(const TimeZoneRule
& that
) const;
285 * Gets the very first time when this rule takes effect.
286 * @param prevRawOffset The standard time offset from UTC before this rule
287 * takes effect in milliseconds.
288 * @param prevDSTSavings The amount of daylight saving offset from the
290 * @param result Receives the very first time when this rule takes effect.
291 * @return true if the start time is available. When false is returned, output parameter
292 * "result" is unchanged.
295 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
298 * Gets the final time when this rule takes effect.
299 * @param prevRawOffset The standard time offset from UTC before this rule
300 * takes effect in milliseconds.
301 * @param prevDSTSavings The amount of daylight saving offset from the
303 * @param result Receives the final time when this rule takes effect.
304 * @return true if the start time is available. When false is returned, output parameter
305 * "result" is unchanged.
308 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
311 * Gets the first time when this rule takes effect after the specified time.
312 * @param base The first start time after this base time will be returned.
313 * @param prevRawOffset The standard time offset from UTC before this rule
314 * takes effect in milliseconds.
315 * @param prevDSTSavings The amount of daylight saving offset from the
317 * @param inclusive Whether the base time is inclusive or not.
318 * @param result Receives The first time when this rule takes effect after
319 * the specified base time.
320 * @return true if the start time is available. When false is returned, output parameter
321 * "result" is unchanged.
324 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
325 UBool inclusive
, UDate
& result
) const;
328 * Gets the most recent time when this rule takes effect before the specified time.
329 * @param base The most recent time before this base time will be returned.
330 * @param prevRawOffset The standard time offset from UTC before this rule
331 * takes effect in milliseconds.
332 * @param prevDSTSavings The amount of daylight saving offset from the
334 * @param inclusive Whether the base time is inclusive or not.
335 * @param result Receives The most recent time when this rule takes effect before
336 * the specified base time.
337 * @return true if the start time is available. When false is returned, output parameter
338 * "result" is unchanged.
341 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
342 UBool inclusive
, UDate
& result
) const;
346 * Return the class ID for this class. This is useful only for comparing to
347 * a return value from getDynamicClassID(). For example:
349 * . Base* polymorphic_pointer = createPolymorphicObject();
350 * . if (polymorphic_pointer->getDynamicClassID() ==
351 * . erived::getStaticClassID()) ...
353 * @return The class ID for all objects of this class.
356 static UClassID U_EXPORT2
getStaticClassID(void);
359 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
360 * method is to implement a simple version of RTTI, since not all C++
361 * compilers support genuine RTTI. Polymorphic operator==() and clone()
362 * methods call this method.
364 * @return The class ID for this object. All objects of a
365 * given class have the same class ID. Objects of
366 * other classes have different class IDs.
369 virtual UClassID
getDynamicClassID(void) const;
373 * <code>AnnualTimeZoneRule</code> is a class used for representing a time zone
374 * rule which takes effect annually. The calenday system used for the rule is
375 * is based on Gregorian calendar
379 class U_I18N_API AnnualTimeZoneRule
: public TimeZoneRule
{
382 * The constant representing the maximum year used for designating
383 * a rule is permanent.
385 static const int32_t MAX_YEAR
;
388 * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
389 * standard time, the amount of daylight saving offset adjustment, the annual start
390 * time rule and the start/until years. The input DateTimeRule is copied by this
391 * constructor, so the caller remains responsible for deleting the object.
392 * @param name The time zone name.
393 * @param rawOffset The GMT offset of its standard time in milliseconds.
394 * @param dstSavings The amount of daylight saving offset adjustment in
395 * milliseconds. If this ia a rule for standard time,
396 * the value of this argument is 0.
397 * @param dateTimeRule The start date/time rule repeated annually.
398 * @param startYear The first year when this rule takes effect.
399 * @param endYear The last year when this rule takes effect. If this
400 * rule is effective forever in future, specify MAX_YEAR.
403 AnnualTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
,
404 const DateTimeRule
& dateTimeRule
, int32_t startYear
, int32_t endYear
);
407 * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
408 * standard time, the amount of daylight saving offset adjustment, the annual start
409 * time rule and the start/until years. The input DateTimeRule object is adopted
410 * by this object, therefore, the caller must not delete the object.
411 * @param name The time zone name.
412 * @param rawOffset The GMT offset of its standard time in milliseconds.
413 * @param dstSavings The amount of daylight saving offset adjustment in
414 * milliseconds. If this ia a rule for standard time,
415 * the value of this argument is 0.
416 * @param dateTimeRule The start date/time rule repeated annually.
417 * @param startYear The first year when this rule takes effect.
418 * @param endYear The last year when this rule takes effect. If this
419 * rule is effective forever in future, specify MAX_YEAR.
422 AnnualTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
,
423 DateTimeRule
* dateTimeRule
, int32_t startYear
, int32_t endYear
);
427 * @param source The AnnualTimeZoneRule object to be copied.
430 AnnualTimeZoneRule(const AnnualTimeZoneRule
& source
);
436 virtual ~AnnualTimeZoneRule();
439 * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and
440 * should delete it when done.
441 * @return A copy of the object.
444 virtual AnnualTimeZoneRule
* clone(void) const;
447 * Assignment operator.
448 * @param right The object to be copied.
451 AnnualTimeZoneRule
& operator=(const AnnualTimeZoneRule
& right
);
454 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
455 * of different subclasses are considered unequal.
456 * @param that The object to be compared with.
457 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
460 virtual UBool
operator==(const TimeZoneRule
& that
) const;
463 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
464 * of different subclasses are considered unequal.
465 * @param that The object to be compared with.
466 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
469 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
472 * Gets the start date/time rule used by this rule.
473 * @return The <code>AnnualDateTimeRule</code> which represents the start date/time
474 * rule used by this time zone rule.
477 const DateTimeRule
* getRule(void) const;
480 * Gets the first year when this rule takes effect.
481 * @return The start year of this rule. The year is in Gregorian calendar
482 * with 0 == 1 BCE, -1 == 2 BCE, etc.
485 int32_t getStartYear(void) const;
488 * Gets the end year when this rule takes effect.
489 * @return The end year of this rule (inclusive). The year is in Gregorian calendar
490 * with 0 == 1 BCE, -1 == 2 BCE, etc.
493 int32_t getEndYear(void) const;
496 * Gets the time when this rule takes effect in the given year.
497 * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
498 * @param prevRawOffset The standard time offset from UTC before this rule
499 * takes effect in milliseconds.
500 * @param prevDSTSavings The amount of daylight saving offset from the
502 * @param result Receives the start time in the year.
503 * @return true if this rule takes effect in the year and the result is set to
507 UBool
getStartInYear(int32_t year
, int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
510 * Returns if this rule represents the same rule and offsets as another.
511 * When two <code>TimeZoneRule</code> objects differ only its names, this method
513 * @param that The <code>TimeZoneRule</code> object to be compared with.
514 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
517 virtual UBool
isEquivalentTo(const TimeZoneRule
& that
) const;
520 * Gets the very first time when this rule takes effect.
521 * @param prevRawOffset The standard time offset from UTC before this rule
522 * takes effect in milliseconds.
523 * @param prevDSTSavings The amount of daylight saving offset from the
525 * @param result Receives the very first time when this rule takes effect.
526 * @return true if the start time is available. When false is returned, output parameter
527 * "result" is unchanged.
530 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
533 * Gets the final time when this rule takes effect.
534 * @param prevRawOffset The standard time offset from UTC before this rule
535 * takes effect in milliseconds.
536 * @param prevDSTSavings The amount of daylight saving offset from the
538 * @param result Receives the final time when this rule takes effect.
539 * @return true if the start time is available. When false is returned, output parameter
540 * "result" is unchanged.
543 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
546 * Gets the first time when this rule takes effect after the specified time.
547 * @param base The first start time after this base time will be returned.
548 * @param prevRawOffset The standard time offset from UTC before this rule
549 * takes effect in milliseconds.
550 * @param prevDSTSavings The amount of daylight saving offset from the
552 * @param inclusive Whether the base time is inclusive or not.
553 * @param result Receives The first time when this rule takes effect after
554 * the specified base time.
555 * @return true if the start time is available. When false is returned, output parameter
556 * "result" is unchanged.
559 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
560 UBool inclusive
, UDate
& result
) const;
563 * Gets the most recent time when this rule takes effect before the specified time.
564 * @param base The most recent time before this base time will be returned.
565 * @param prevRawOffset The standard time offset from UTC before this rule
566 * takes effect in milliseconds.
567 * @param prevDSTSavings The amount of daylight saving offset from the
569 * @param inclusive Whether the base time is inclusive or not.
570 * @param result Receives The most recent time when this rule takes effect before
571 * the specified base time.
572 * @return true if the start time is available. When false is returned, output parameter
573 * "result" is unchanged.
576 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
577 UBool inclusive
, UDate
& result
) const;
581 DateTimeRule
* fDateTimeRule
;
587 * Return the class ID for this class. This is useful only for comparing to
588 * a return value from getDynamicClassID(). For example:
590 * . Base* polymorphic_pointer = createPolymorphicObject();
591 * . if (polymorphic_pointer->getDynamicClassID() ==
592 * . erived::getStaticClassID()) ...
594 * @return The class ID for all objects of this class.
597 static UClassID U_EXPORT2
getStaticClassID(void);
600 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
601 * method is to implement a simple version of RTTI, since not all C++
602 * compilers support genuine RTTI. Polymorphic operator==() and clone()
603 * methods call this method.
605 * @return The class ID for this object. All objects of a
606 * given class have the same class ID. Objects of
607 * other classes have different class IDs.
610 virtual UClassID
getDynamicClassID(void) const;
614 * <code>TimeArrayTimeZoneRule</code> represents a time zone rule whose start times are
615 * defined by an array of milliseconds since the standard base time.
619 class U_I18N_API TimeArrayTimeZoneRule
: public TimeZoneRule
{
622 * Constructs a <code>TimeArrayTimeZoneRule</code> with the name, the GMT offset of its
623 * standard time, the amount of daylight saving offset adjustment and
624 * the array of times when this rule takes effect.
625 * @param name The time zone name.
626 * @param rawOffset The UTC offset of its standard time in milliseconds.
627 * @param dstSavings The amount of daylight saving offset adjustment in
628 * milliseconds. If this ia a rule for standard time,
629 * the value of this argument is 0.
630 * @param startTimes The array start times in milliseconds since the base time
631 * (January 1, 1970, 00:00:00).
632 * @param numStartTimes The number of elements in the parameter "startTimes"
633 * @param timeRuleType The time type of the start times, which is one of
634 * <code>DataTimeRule::WALL_TIME</code>, <code>STANDARD_TIME</code>
635 * and <code>UTC_TIME</code>.
638 TimeArrayTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
,
639 const UDate
* startTimes
, int32_t numStartTimes
, DateTimeRule::TimeRuleType timeRuleType
);
643 * @param source The TimeArrayTimeZoneRule object to be copied.
646 TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule
& source
);
652 virtual ~TimeArrayTimeZoneRule();
655 * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and
656 * should delete it when done.
657 * @return A copy of the object.
660 virtual TimeArrayTimeZoneRule
* clone(void) const;
663 * Assignment operator.
664 * @param right The object to be copied.
667 TimeArrayTimeZoneRule
& operator=(const TimeArrayTimeZoneRule
& right
);
670 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
671 * of different subclasses are considered unequal.
672 * @param that The object to be compared with.
673 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
676 virtual UBool
operator==(const TimeZoneRule
& that
) const;
679 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
680 * of different subclasses are considered unequal.
681 * @param that The object to be compared with.
682 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
685 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
688 * Gets the time type of the start times used by this rule. The return value
689 * is either <code>DateTimeRule::WALL_TIME</code> or <code>STANDARD_TIME</code>
690 * or <code>UTC_TIME</code>.
692 * @return The time type used of the start times used by this rule.
695 DateTimeRule::TimeRuleType
getTimeType(void) const;
698 * Gets a start time at the index stored in this rule.
699 * @param index The index of start times
700 * @param result Receives the start time at the index
701 * @return true if the index is within the valid range and
702 * and the result is set. When false, the output
703 * parameger "result" is unchanged.
706 UBool
getStartTimeAt(int32_t index
, UDate
& result
) const;
709 * Returns the number of start times stored in this rule
710 * @return The number of start times.
713 int32_t countStartTimes(void) const;
716 * Returns if this rule represents the same rule and offsets as another.
717 * When two <code>TimeZoneRule</code> objects differ only its names, this method
719 * @param that The <code>TimeZoneRule</code> object to be compared with.
720 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
723 virtual UBool
isEquivalentTo(const TimeZoneRule
& that
) const;
726 * Gets the very first time when this rule takes effect.
727 * @param prevRawOffset The standard time offset from UTC before this rule
728 * takes effect in milliseconds.
729 * @param prevDSTSavings The amount of daylight saving offset from the
731 * @param result Receives the very first time when this rule takes effect.
732 * @return true if the start time is available. When false is returned, output parameter
733 * "result" is unchanged.
736 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
739 * Gets the final time when this rule takes effect.
740 * @param prevRawOffset The standard time offset from UTC before this rule
741 * takes effect in milliseconds.
742 * @param prevDSTSavings The amount of daylight saving offset from the
744 * @param result Receives the final time when this rule takes effect.
745 * @return true if the start time is available. When false is returned, output parameter
746 * "result" is unchanged.
749 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
752 * Gets the first time when this rule takes effect after the specified time.
753 * @param base The first start time after this base time will be returned.
754 * @param prevRawOffset The standard time offset from UTC before this rule
755 * takes effect in milliseconds.
756 * @param prevDSTSavings The amount of daylight saving offset from the
758 * @param inclusive Whether the base time is inclusive or not.
759 * @param result Receives The first time when this rule takes effect after
760 * the specified base time.
761 * @return true if the start time is available. When false is returned, output parameter
762 * "result" is unchanged.
765 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
766 UBool inclusive
, UDate
& result
) const;
769 * Gets the most recent time when this rule takes effect before the specified time.
770 * @param base The most recent time before this base time will be returned.
771 * @param prevRawOffset The standard time offset from UTC before this rule
772 * takes effect in milliseconds.
773 * @param prevDSTSavings The amount of daylight saving offset from the
775 * @param inclusive Whether the base time is inclusive or not.
776 * @param result Receives The most recent time when this rule takes effect before
777 * the specified base time.
778 * @return true if the start time is available. When false is returned, output parameter
779 * "result" is unchanged.
782 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
783 UBool inclusive
, UDate
& result
) const;
787 enum { TIMEARRAY_STACK_BUFFER_SIZE
= 32 };
788 UBool
initStartTimes(const UDate source
[], int32_t size
, UErrorCode
& ec
);
789 UDate
getUTC(UDate time
, int32_t raw
, int32_t dst
) const;
791 DateTimeRule::TimeRuleType fTimeRuleType
;
792 int32_t fNumStartTimes
;
794 UDate fLocalStartTimes
[TIMEARRAY_STACK_BUFFER_SIZE
];
798 * Return the class ID for this class. This is useful only for comparing to
799 * a return value from getDynamicClassID(). For example:
801 * . Base* polymorphic_pointer = createPolymorphicObject();
802 * . if (polymorphic_pointer->getDynamicClassID() ==
803 * . erived::getStaticClassID()) ...
805 * @return The class ID for all objects of this class.
808 static UClassID U_EXPORT2
getStaticClassID(void);
811 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
812 * method is to implement a simple version of RTTI, since not all C++
813 * compilers support genuine RTTI. Polymorphic operator==() and clone()
814 * methods call this method.
816 * @return The class ID for this object. All objects of a
817 * given class have the same class ID. Objects of
818 * other classes have different class IDs.
821 virtual UClassID
getDynamicClassID(void) const;
826 #endif // U_SHOW_CPLUSPLUS_API
828 #endif /* #if !UCONFIG_NO_FORMATTING */