1 // Copyright (C) 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"
28 * <code>TimeZoneRule</code> is a class representing a rule for time zone.
29 * <code>TimeZoneRule</code> has a set of time zone attributes, such as zone name,
30 * raw offset (UTC offset for standard time) and daylight saving time offset.
34 class U_I18N_API TimeZoneRule : public UObject {
40 virtual ~TimeZoneRule();
43 * Clone this TimeZoneRule object polymorphically. The caller owns the result and
44 * should delete it when done.
45 * @return A copy of the object.
48 virtual TimeZoneRule* clone(void) const = 0;
51 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
52 * of different subclasses are considered unequal.
53 * @param that The object to be compared with.
54 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
57 virtual UBool operator==(const TimeZoneRule& that) const;
60 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
61 * of different subclasses are considered unequal.
62 * @param that The object to be compared with.
63 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
66 virtual UBool operator!=(const TimeZoneRule& that) const;
69 * Fills in "name" with the name of this time zone.
70 * @param name Receives the name of this time zone.
71 * @return A reference to "name"
74 UnicodeString& getName(UnicodeString& name) const;
77 * Gets the standard time offset.
78 * @return The standard time offset from UTC in milliseconds.
81 int32_t getRawOffset(void) const;
84 * Gets the amount of daylight saving delta time from the standard time.
85 * @return The amount of daylight saving offset used by this rule
89 int32_t getDSTSavings(void) const;
92 * Returns if this rule represents the same rule and offsets as another.
93 * When two <code>TimeZoneRule</code> objects differ only its names, this method
95 * @param other The <code>TimeZoneRule</code> object to be compared with.
96 * @return true if the other <code>TimeZoneRule</code> is the same as this one.
99 virtual UBool isEquivalentTo(const TimeZoneRule& other) const;
102 * Gets the very first time when this rule takes effect.
103 * @param prevRawOffset The standard time offset from UTC before this rule
104 * takes effect in milliseconds.
105 * @param prevDSTSavings The amount of daylight saving offset from the
107 * @param result Receives the very first time when this rule takes effect.
108 * @return true if the start time is available. When false is returned, output parameter
109 * "result" is unchanged.
112 virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
115 * Gets the final time when this rule takes effect.
116 * @param prevRawOffset The standard time offset from UTC before this rule
117 * takes effect in milliseconds.
118 * @param prevDSTSavings The amount of daylight saving offset from the
120 * @param result Receives the final time when this rule takes effect.
121 * @return true if the start time is available. When false is returned, output parameter
122 * "result" is unchanged.
125 virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0;
128 * Gets the first time when this rule takes effect after the specified time.
129 * @param base The first start time after this base time will be returned.
130 * @param prevRawOffset The standard time offset from UTC before this rule
131 * takes effect in milliseconds.
132 * @param prevDSTSavings The amount of daylight saving offset from the
134 * @param inclusive Whether the base time is inclusive or not.
135 * @param result Receives The first time when this rule takes effect after
136 * the specified base time.
137 * @return true if the start time is available. When false is returned, output parameter
138 * "result" is unchanged.
141 virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
142 UBool inclusive, UDate& result) const = 0;
145 * Gets the most recent time when this rule takes effect before the specified time.
146 * @param base The most recent time before this base time will be returned.
147 * @param prevRawOffset The standard time offset from UTC before this rule
148 * takes effect in milliseconds.
149 * @param prevDSTSavings The amount of daylight saving offset from the
151 * @param inclusive Whether the base time is inclusive or not.
152 * @param result Receives The most recent time when this rule takes effect before
153 * the specified base time.
154 * @return true if the start time is available. When false is returned, output parameter
155 * "result" is unchanged.
158 virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
159 UBool inclusive, UDate& result) const = 0;
164 * Constructs a <code>TimeZoneRule</code> with the name, the GMT offset of its
165 * standard time and the amount of daylight saving offset adjustment.
166 * @param name The time zone name.
167 * @param rawOffset The UTC offset of its standard time in milliseconds.
168 * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
169 * If this ia a rule for standard time, the value of this argument is 0.
172 TimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
176 * @param source The TimeZoneRule object to be copied.
179 TimeZoneRule(const TimeZoneRule& source);
182 * Assignment operator.
183 * @param right The object to be copied.
186 TimeZoneRule& operator=(const TimeZoneRule& right);
189 UnicodeString fName; // time name
190 int32_t fRawOffset; // UTC offset of the standard time in milliseconds
191 int32_t fDSTSavings; // DST saving amount in milliseconds
195 * <code>InitialTimeZoneRule</code> represents a time zone rule
196 * representing a time zone effective from the beginning and
197 * has no actual start times.
200 class U_I18N_API InitialTimeZoneRule : public TimeZoneRule {
203 * Constructs an <code>InitialTimeZoneRule</code> with the name, the GMT offset of its
204 * standard time and the amount of daylight saving offset adjustment.
205 * @param name The time zone name.
206 * @param rawOffset The UTC offset of its standard time in milliseconds.
207 * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
208 * If this ia a rule for standard time, the value of this argument is 0.
211 InitialTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings);
215 * @param source The InitialTimeZoneRule object to be copied.
218 InitialTimeZoneRule(const InitialTimeZoneRule& source);
224 virtual ~InitialTimeZoneRule();
227 * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and
228 * should delete it when done.
229 * @return A copy of the object.
232 virtual InitialTimeZoneRule* clone(void) const;
235 * Assignment operator.
236 * @param right The object to be copied.
239 InitialTimeZoneRule& operator=(const InitialTimeZoneRule& right);
242 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
243 * of different subclasses are considered unequal.
244 * @param that The object to be compared with.
245 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
248 virtual UBool operator==(const TimeZoneRule& that) const;
251 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
252 * of different subclasses are considered unequal.
253 * @param that The object to be compared with.
254 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
257 virtual UBool operator!=(const TimeZoneRule& that) const;
260 * Gets the time when this rule takes effect in the given year.
261 * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
262 * @param prevRawOffset The standard time offset from UTC before this rule
263 * takes effect in milliseconds.
264 * @param prevDSTSavings The amount of daylight saving offset from the
266 * @param result Receives the start time in the year.
267 * @return true if this rule takes effect in the year and the result is set to
271 UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
274 * Returns if this rule represents the same rule and offsets as another.
275 * When two <code>TimeZoneRule</code> objects differ only its names, this method
277 * @param that The <code>TimeZoneRule</code> object to be compared with.
278 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
281 virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
284 * Gets the very first time when this rule takes effect.
285 * @param prevRawOffset The standard time offset from UTC before this rule
286 * takes effect in milliseconds.
287 * @param prevDSTSavings The amount of daylight saving offset from the
289 * @param result Receives the very first time when this rule takes effect.
290 * @return true if the start time is available. When false is returned, output parameter
291 * "result" is unchanged.
294 virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
297 * Gets the final time when this rule takes effect.
298 * @param prevRawOffset The standard time offset from UTC before this rule
299 * takes effect in milliseconds.
300 * @param prevDSTSavings The amount of daylight saving offset from the
302 * @param result Receives the final time when this rule takes effect.
303 * @return true if the start time is available. When false is returned, output parameter
304 * "result" is unchanged.
307 virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
310 * Gets the first time when this rule takes effect after the specified time.
311 * @param base The first start time after this base time will be returned.
312 * @param prevRawOffset The standard time offset from UTC before this rule
313 * takes effect in milliseconds.
314 * @param prevDSTSavings The amount of daylight saving offset from the
316 * @param inclusive Whether the base time is inclusive or not.
317 * @param result Receives The first time when this rule takes effect after
318 * the specified base time.
319 * @return true if the start time is available. When false is returned, output parameter
320 * "result" is unchanged.
323 virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
324 UBool inclusive, UDate& result) const;
327 * Gets the most recent time when this rule takes effect before the specified time.
328 * @param base The most recent time before this base time will be returned.
329 * @param prevRawOffset The standard time offset from UTC before this rule
330 * takes effect in milliseconds.
331 * @param prevDSTSavings The amount of daylight saving offset from the
333 * @param inclusive Whether the base time is inclusive or not.
334 * @param result Receives The most recent time when this rule takes effect before
335 * the specified base time.
336 * @return true if the start time is available. When false is returned, output parameter
337 * "result" is unchanged.
340 virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
341 UBool inclusive, UDate& result) const;
345 * Return the class ID for this class. This is useful only for comparing to
346 * a return value from getDynamicClassID(). For example:
348 * . Base* polymorphic_pointer = createPolymorphicObject();
349 * . if (polymorphic_pointer->getDynamicClassID() ==
350 * . erived::getStaticClassID()) ...
352 * @return The class ID for all objects of this class.
355 static UClassID U_EXPORT2 getStaticClassID(void);
358 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
359 * method is to implement a simple version of RTTI, since not all C++
360 * compilers support genuine RTTI. Polymorphic operator==() and clone()
361 * methods call this method.
363 * @return The class ID for this object. All objects of a
364 * given class have the same class ID. Objects of
365 * other classes have different class IDs.
368 virtual UClassID getDynamicClassID(void) const;
372 * <code>AnnualTimeZoneRule</code> is a class used for representing a time zone
373 * rule which takes effect annually. The calenday system used for the rule is
374 * is based on Gregorian calendar
378 class U_I18N_API AnnualTimeZoneRule : public TimeZoneRule {
381 * The constant representing the maximum year used for designating
382 * a rule is permanent.
384 static const int32_t MAX_YEAR;
387 * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
388 * standard time, the amount of daylight saving offset adjustment, the annual start
389 * time rule and the start/until years. The input DateTimeRule is copied by this
390 * constructor, so the caller remains responsible for deleting the object.
391 * @param name The time zone name.
392 * @param rawOffset The GMT offset of its standard time in milliseconds.
393 * @param dstSavings The amount of daylight saving offset adjustment in
394 * milliseconds. If this ia a rule for standard time,
395 * the value of this argument is 0.
396 * @param dateTimeRule The start date/time rule repeated annually.
397 * @param startYear The first year when this rule takes effect.
398 * @param endYear The last year when this rule takes effect. If this
399 * rule is effective forever in future, specify MAX_YEAR.
402 AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
403 const DateTimeRule& dateTimeRule, int32_t startYear, int32_t endYear);
406 * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
407 * standard time, the amount of daylight saving offset adjustment, the annual start
408 * time rule and the start/until years. The input DateTimeRule object is adopted
409 * by this object, therefore, the caller must not delete the object.
410 * @param name The time zone name.
411 * @param rawOffset The GMT offset of its standard time in milliseconds.
412 * @param dstSavings The amount of daylight saving offset adjustment in
413 * milliseconds. If this ia a rule for standard time,
414 * the value of this argument is 0.
415 * @param dateTimeRule The start date/time rule repeated annually.
416 * @param startYear The first year when this rule takes effect.
417 * @param endYear The last year when this rule takes effect. If this
418 * rule is effective forever in future, specify MAX_YEAR.
421 AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
422 DateTimeRule* dateTimeRule, int32_t startYear, int32_t endYear);
426 * @param source The AnnualTimeZoneRule object to be copied.
429 AnnualTimeZoneRule(const AnnualTimeZoneRule& source);
435 virtual ~AnnualTimeZoneRule();
438 * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and
439 * should delete it when done.
440 * @return A copy of the object.
443 virtual AnnualTimeZoneRule* clone(void) const;
446 * Assignment operator.
447 * @param right The object to be copied.
450 AnnualTimeZoneRule& operator=(const AnnualTimeZoneRule& right);
453 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
454 * of different subclasses are considered unequal.
455 * @param that The object to be compared with.
456 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
459 virtual UBool operator==(const TimeZoneRule& that) const;
462 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
463 * of different subclasses are considered unequal.
464 * @param that The object to be compared with.
465 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
468 virtual UBool operator!=(const TimeZoneRule& that) const;
471 * Gets the start date/time rule used by this rule.
472 * @return The <code>AnnualDateTimeRule</code> which represents the start date/time
473 * rule used by this time zone rule.
476 const DateTimeRule* getRule(void) const;
479 * Gets the first year when this rule takes effect.
480 * @return The start year of this rule. The year is in Gregorian calendar
481 * with 0 == 1 BCE, -1 == 2 BCE, etc.
484 int32_t getStartYear(void) const;
487 * Gets the end year when this rule takes effect.
488 * @return The end year of this rule (inclusive). The year is in Gregorian calendar
489 * with 0 == 1 BCE, -1 == 2 BCE, etc.
492 int32_t getEndYear(void) const;
495 * Gets the time when this rule takes effect in the given year.
496 * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
497 * @param prevRawOffset The standard time offset from UTC before this rule
498 * takes effect in milliseconds.
499 * @param prevDSTSavings The amount of daylight saving offset from the
501 * @param result Receives the start time in the year.
502 * @return true if this rule takes effect in the year and the result is set to
506 UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
509 * Returns if this rule represents the same rule and offsets as another.
510 * When two <code>TimeZoneRule</code> objects differ only its names, this method
512 * @param that The <code>TimeZoneRule</code> object to be compared with.
513 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
516 virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
519 * Gets the very first time when this rule takes effect.
520 * @param prevRawOffset The standard time offset from UTC before this rule
521 * takes effect in milliseconds.
522 * @param prevDSTSavings The amount of daylight saving offset from the
524 * @param result Receives the very first time when this rule takes effect.
525 * @return true if the start time is available. When false is returned, output parameter
526 * "result" is unchanged.
529 virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
532 * Gets the final time when this rule takes effect.
533 * @param prevRawOffset The standard time offset from UTC before this rule
534 * takes effect in milliseconds.
535 * @param prevDSTSavings The amount of daylight saving offset from the
537 * @param result Receives the final time when this rule takes effect.
538 * @return true if the start time is available. When false is returned, output parameter
539 * "result" is unchanged.
542 virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
545 * Gets the first time when this rule takes effect after the specified time.
546 * @param base The first start time after this base time will be returned.
547 * @param prevRawOffset The standard time offset from UTC before this rule
548 * takes effect in milliseconds.
549 * @param prevDSTSavings The amount of daylight saving offset from the
551 * @param inclusive Whether the base time is inclusive or not.
552 * @param result Receives The first time when this rule takes effect after
553 * the specified base time.
554 * @return true if the start time is available. When false is returned, output parameter
555 * "result" is unchanged.
558 virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
559 UBool inclusive, UDate& result) const;
562 * Gets the most recent time when this rule takes effect before the specified time.
563 * @param base The most recent time before this base time will be returned.
564 * @param prevRawOffset The standard time offset from UTC before this rule
565 * takes effect in milliseconds.
566 * @param prevDSTSavings The amount of daylight saving offset from the
568 * @param inclusive Whether the base time is inclusive or not.
569 * @param result Receives The most recent time when this rule takes effect before
570 * the specified base time.
571 * @return true if the start time is available. When false is returned, output parameter
572 * "result" is unchanged.
575 virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
576 UBool inclusive, UDate& result) const;
580 DateTimeRule* fDateTimeRule;
586 * Return the class ID for this class. This is useful only for comparing to
587 * a return value from getDynamicClassID(). For example:
589 * . Base* polymorphic_pointer = createPolymorphicObject();
590 * . if (polymorphic_pointer->getDynamicClassID() ==
591 * . erived::getStaticClassID()) ...
593 * @return The class ID for all objects of this class.
596 static UClassID U_EXPORT2 getStaticClassID(void);
599 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
600 * method is to implement a simple version of RTTI, since not all C++
601 * compilers support genuine RTTI. Polymorphic operator==() and clone()
602 * methods call this method.
604 * @return The class ID for this object. All objects of a
605 * given class have the same class ID. Objects of
606 * other classes have different class IDs.
609 virtual UClassID getDynamicClassID(void) const;
613 * <code>TimeArrayTimeZoneRule</code> represents a time zone rule whose start times are
614 * defined by an array of milliseconds since the standard base time.
618 class U_I18N_API TimeArrayTimeZoneRule : public TimeZoneRule {
621 * Constructs a <code>TimeArrayTimeZoneRule</code> with the name, the GMT offset of its
622 * standard time, the amount of daylight saving offset adjustment and
623 * the array of times when this rule takes effect.
624 * @param name The time zone name.
625 * @param rawOffset The UTC offset of its standard time in milliseconds.
626 * @param dstSavings The amount of daylight saving offset adjustment in
627 * milliseconds. If this ia a rule for standard time,
628 * the value of this argument is 0.
629 * @param startTimes The array start times in milliseconds since the base time
630 * (January 1, 1970, 00:00:00).
631 * @param numStartTimes The number of elements in the parameter "startTimes"
632 * @param timeRuleType The time type of the start times, which is one of
633 * <code>DataTimeRule::WALL_TIME</code>, <code>STANDARD_TIME</code>
634 * and <code>UTC_TIME</code>.
637 TimeArrayTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings,
638 const UDate* startTimes, int32_t numStartTimes, DateTimeRule::TimeRuleType timeRuleType);
642 * @param source The TimeArrayTimeZoneRule object to be copied.
645 TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source);
651 virtual ~TimeArrayTimeZoneRule();
654 * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and
655 * should delete it when done.
656 * @return A copy of the object.
659 virtual TimeArrayTimeZoneRule* clone(void) const;
662 * Assignment operator.
663 * @param right The object to be copied.
666 TimeArrayTimeZoneRule& operator=(const TimeArrayTimeZoneRule& right);
669 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
670 * of different subclasses are considered unequal.
671 * @param that The object to be compared with.
672 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
675 virtual UBool operator==(const TimeZoneRule& that) const;
678 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
679 * of different subclasses are considered unequal.
680 * @param that The object to be compared with.
681 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
684 virtual UBool operator!=(const TimeZoneRule& that) const;
687 * Gets the time type of the start times used by this rule. The return value
688 * is either <code>DateTimeRule::WALL_TIME</code> or <code>STANDARD_TIME</code>
689 * or <code>UTC_TIME</code>.
691 * @return The time type used of the start times used by this rule.
694 DateTimeRule::TimeRuleType getTimeType(void) const;
697 * Gets a start time at the index stored in this rule.
698 * @param index The index of start times
699 * @param result Receives the start time at the index
700 * @return true if the index is within the valid range and
701 * and the result is set. When false, the output
702 * parameger "result" is unchanged.
705 UBool getStartTimeAt(int32_t index, UDate& result) const;
708 * Returns the number of start times stored in this rule
709 * @return The number of start times.
712 int32_t countStartTimes(void) const;
715 * Returns if this rule represents the same rule and offsets as another.
716 * When two <code>TimeZoneRule</code> objects differ only its names, this method
718 * @param that The <code>TimeZoneRule</code> object to be compared with.
719 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
722 virtual UBool isEquivalentTo(const TimeZoneRule& that) const;
725 * Gets the very first time when this rule takes effect.
726 * @param prevRawOffset The standard time offset from UTC before this rule
727 * takes effect in milliseconds.
728 * @param prevDSTSavings The amount of daylight saving offset from the
730 * @param result Receives the very first time when this rule takes effect.
731 * @return true if the start time is available. When false is returned, output parameter
732 * "result" is unchanged.
735 virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
738 * Gets the final time when this rule takes effect.
739 * @param prevRawOffset The standard time offset from UTC before this rule
740 * takes effect in milliseconds.
741 * @param prevDSTSavings The amount of daylight saving offset from the
743 * @param result Receives the final time when this rule takes effect.
744 * @return true if the start time is available. When false is returned, output parameter
745 * "result" is unchanged.
748 virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const;
751 * Gets the first time when this rule takes effect after the specified time.
752 * @param base The first start time after this base time will be returned.
753 * @param prevRawOffset The standard time offset from UTC before this rule
754 * takes effect in milliseconds.
755 * @param prevDSTSavings The amount of daylight saving offset from the
757 * @param inclusive Whether the base time is inclusive or not.
758 * @param result Receives The first time when this rule takes effect after
759 * the specified base time.
760 * @return true if the start time is available. When false is returned, output parameter
761 * "result" is unchanged.
764 virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
765 UBool inclusive, UDate& result) const;
768 * Gets the most recent time when this rule takes effect before the specified time.
769 * @param base The most recent time before this base time will be returned.
770 * @param prevRawOffset The standard time offset from UTC before this rule
771 * takes effect in milliseconds.
772 * @param prevDSTSavings The amount of daylight saving offset from the
774 * @param inclusive Whether the base time is inclusive or not.
775 * @param result Receives The most recent time when this rule takes effect before
776 * the specified base time.
777 * @return true if the start time is available. When false is returned, output parameter
778 * "result" is unchanged.
781 virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings,
782 UBool inclusive, UDate& result) const;
786 enum { TIMEARRAY_STACK_BUFFER_SIZE = 32 };
787 UBool initStartTimes(const UDate source[], int32_t size, UErrorCode& ec);
788 UDate getUTC(UDate time, int32_t raw, int32_t dst) const;
790 DateTimeRule::TimeRuleType fTimeRuleType;
791 int32_t fNumStartTimes;
793 UDate fLocalStartTimes[TIMEARRAY_STACK_BUFFER_SIZE];
797 * Return the class ID for this class. This is useful only for comparing to
798 * a return value from getDynamicClassID(). For example:
800 * . Base* polymorphic_pointer = createPolymorphicObject();
801 * . if (polymorphic_pointer->getDynamicClassID() ==
802 * . erived::getStaticClassID()) ...
804 * @return The class ID for all objects of this class.
807 static UClassID U_EXPORT2 getStaticClassID(void);
810 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
811 * method is to implement a simple version of RTTI, since not all C++
812 * compilers support genuine RTTI. Polymorphic operator==() and clone()
813 * methods call this method.
815 * @return The class ID for this object. All objects of a
816 * given class have the same class ID. Objects of
817 * other classes have different class IDs.
820 virtual UClassID getDynamicClassID(void) const;
826 #endif /* #if !UCONFIG_NO_FORMATTING */