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 U_SHOW_CPLUSPLUS_API
21 #if !UCONFIG_NO_FORMATTING
23 #include "unicode/uobject.h"
24 #include "unicode/unistr.h"
25 #include "unicode/dtrule.h"
30 * <code>TimeZoneRule</code> is a class representing a rule for time zone.
31 * <code>TimeZoneRule</code> has a set of time zone attributes, such as zone name,
32 * raw offset (UTC offset for standard time) and daylight saving time offset.
36 class U_I18N_API TimeZoneRule
: public UObject
{
42 virtual ~TimeZoneRule();
45 * Clone this TimeZoneRule object polymorphically. The caller owns the result and
46 * should delete it when done.
47 * @return A copy of the object.
50 virtual TimeZoneRule
* clone() const = 0;
53 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
54 * of different subclasses are considered unequal.
55 * @param that The object to be compared with.
56 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
59 virtual UBool
operator==(const TimeZoneRule
& that
) const;
62 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
63 * of different subclasses are considered unequal.
64 * @param that The object to be compared with.
65 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
68 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
71 * Fills in "name" with the name of this time zone.
72 * @param name Receives the name of this time zone.
73 * @return A reference to "name"
76 UnicodeString
& getName(UnicodeString
& name
) const;
79 * Gets the standard time offset.
80 * @return The standard time offset from UTC in milliseconds.
83 int32_t getRawOffset(void) const;
86 * Gets the amount of daylight saving delta time from the standard time.
87 * @return The amount of daylight saving offset used by this rule
91 int32_t getDSTSavings(void) const;
94 * Returns if this rule represents the same rule and offsets as another.
95 * When two <code>TimeZoneRule</code> objects differ only its names, this method
97 * @param other The <code>TimeZoneRule</code> object to be compared with.
98 * @return true if the other <code>TimeZoneRule</code> is the same as this one.
101 virtual UBool
isEquivalentTo(const TimeZoneRule
& other
) const;
104 * Gets the very first time when this rule takes effect.
105 * @param prevRawOffset The standard time offset from UTC before this rule
106 * takes effect in milliseconds.
107 * @param prevDSTSavings The amount of daylight saving offset from the
109 * @param result Receives the very first time when this rule takes effect.
110 * @return true if the start time is available. When false is returned, output parameter
111 * "result" is unchanged.
114 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const = 0;
117 * Gets the final time when this rule takes effect.
118 * @param prevRawOffset The standard time offset from UTC before this rule
119 * takes effect in milliseconds.
120 * @param prevDSTSavings The amount of daylight saving offset from the
122 * @param result Receives the final time when this rule takes effect.
123 * @return true if the start time is available. When false is returned, output parameter
124 * "result" is unchanged.
127 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const = 0;
130 * Gets the first time when this rule takes effect after the specified time.
131 * @param base The first start time after this base time will be returned.
132 * @param prevRawOffset The standard time offset from UTC before this rule
133 * takes effect in milliseconds.
134 * @param prevDSTSavings The amount of daylight saving offset from the
136 * @param inclusive Whether the base time is inclusive or not.
137 * @param result Receives The first time when this rule takes effect after
138 * the specified base time.
139 * @return true if the start time is available. When false is returned, output parameter
140 * "result" is unchanged.
143 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
144 UBool inclusive
, UDate
& result
) const = 0;
147 * Gets the most recent time when this rule takes effect before the specified time.
148 * @param base The most recent time before this base time will be returned.
149 * @param prevRawOffset The standard time offset from UTC before this rule
150 * takes effect in milliseconds.
151 * @param prevDSTSavings The amount of daylight saving offset from the
153 * @param inclusive Whether the base time is inclusive or not.
154 * @param result Receives The most recent time when this rule takes effect before
155 * the specified base time.
156 * @return true if the start time is available. When false is returned, output parameter
157 * "result" is unchanged.
160 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
161 UBool inclusive
, UDate
& result
) const = 0;
166 * Constructs a <code>TimeZoneRule</code> with the name, the GMT offset of its
167 * standard time and the amount of daylight saving offset adjustment.
168 * @param name The time zone name.
169 * @param rawOffset The UTC offset of its standard time in milliseconds.
170 * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
171 * If this ia a rule for standard time, the value of this argument is 0.
174 TimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
);
178 * @param source The TimeZoneRule object to be copied.
181 TimeZoneRule(const TimeZoneRule
& source
);
184 * Assignment operator.
185 * @param right The object to be copied.
188 TimeZoneRule
& operator=(const TimeZoneRule
& right
);
191 UnicodeString fName
; // time name
192 int32_t fRawOffset
; // UTC offset of the standard time in milliseconds
193 int32_t fDSTSavings
; // DST saving amount in milliseconds
197 * <code>InitialTimeZoneRule</code> represents a time zone rule
198 * representing a time zone effective from the beginning and
199 * has no actual start times.
202 class U_I18N_API InitialTimeZoneRule
: public TimeZoneRule
{
205 * Constructs an <code>InitialTimeZoneRule</code> with the name, the GMT offset of its
206 * standard time and the amount of daylight saving offset adjustment.
207 * @param name The time zone name.
208 * @param rawOffset The UTC offset of its standard time in milliseconds.
209 * @param dstSavings The amount of daylight saving offset adjustment in milliseconds.
210 * If this ia a rule for standard time, the value of this argument is 0.
213 InitialTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
);
217 * @param source The InitialTimeZoneRule object to be copied.
220 InitialTimeZoneRule(const InitialTimeZoneRule
& source
);
226 virtual ~InitialTimeZoneRule();
229 * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and
230 * should delete it when done.
231 * @return A copy of the object.
234 virtual InitialTimeZoneRule
* clone() const;
237 * Assignment operator.
238 * @param right The object to be copied.
241 InitialTimeZoneRule
& operator=(const InitialTimeZoneRule
& right
);
244 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
245 * of different subclasses are considered unequal.
246 * @param that The object to be compared with.
247 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
250 virtual UBool
operator==(const TimeZoneRule
& that
) const;
253 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
254 * of different subclasses are considered unequal.
255 * @param that The object to be compared with.
256 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
259 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
262 * Gets the time when this rule takes effect in the given year.
263 * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
264 * @param prevRawOffset The standard time offset from UTC before this rule
265 * takes effect in milliseconds.
266 * @param prevDSTSavings The amount of daylight saving offset from the
268 * @param result Receives the start time in the year.
269 * @return true if this rule takes effect in the year and the result is set to
273 UBool
getStartInYear(int32_t year
, int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
276 * Returns if this rule represents the same rule and offsets as another.
277 * When two <code>TimeZoneRule</code> objects differ only its names, this method
279 * @param that The <code>TimeZoneRule</code> object to be compared with.
280 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
283 virtual UBool
isEquivalentTo(const TimeZoneRule
& that
) const;
286 * Gets the very first time when this rule takes effect.
287 * @param prevRawOffset The standard time offset from UTC before this rule
288 * takes effect in milliseconds.
289 * @param prevDSTSavings The amount of daylight saving offset from the
291 * @param result Receives the very first time when this rule takes effect.
292 * @return true if the start time is available. When false is returned, output parameter
293 * "result" is unchanged.
296 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
299 * Gets the final time when this rule takes effect.
300 * @param prevRawOffset The standard time offset from UTC before this rule
301 * takes effect in milliseconds.
302 * @param prevDSTSavings The amount of daylight saving offset from the
304 * @param result Receives the final time when this rule takes effect.
305 * @return true if the start time is available. When false is returned, output parameter
306 * "result" is unchanged.
309 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
312 * Gets the first time when this rule takes effect after the specified time.
313 * @param base The first start time after this base time will be returned.
314 * @param prevRawOffset The standard time offset from UTC before this rule
315 * takes effect in milliseconds.
316 * @param prevDSTSavings The amount of daylight saving offset from the
318 * @param inclusive Whether the base time is inclusive or not.
319 * @param result Receives The first time when this rule takes effect after
320 * the specified base time.
321 * @return true if the start time is available. When false is returned, output parameter
322 * "result" is unchanged.
325 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
326 UBool inclusive
, UDate
& result
) const;
329 * Gets the most recent time when this rule takes effect before the specified time.
330 * @param base The most recent time before this base time will be returned.
331 * @param prevRawOffset The standard time offset from UTC before this rule
332 * takes effect in milliseconds.
333 * @param prevDSTSavings The amount of daylight saving offset from the
335 * @param inclusive Whether the base time is inclusive or not.
336 * @param result Receives The most recent time when this rule takes effect before
337 * the specified base time.
338 * @return true if the start time is available. When false is returned, output parameter
339 * "result" is unchanged.
342 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
343 UBool inclusive
, UDate
& result
) const;
347 * Return the class ID for this class. This is useful only for comparing to
348 * a return value from getDynamicClassID(). For example:
350 * . Base* polymorphic_pointer = createPolymorphicObject();
351 * . if (polymorphic_pointer->getDynamicClassID() ==
352 * . erived::getStaticClassID()) ...
354 * @return The class ID for all objects of this class.
357 static UClassID U_EXPORT2
getStaticClassID(void);
360 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
361 * method is to implement a simple version of RTTI, since not all C++
362 * compilers support genuine RTTI. Polymorphic operator==() and clone()
363 * methods call this method.
365 * @return The class ID for this object. All objects of a
366 * given class have the same class ID. Objects of
367 * other classes have different class IDs.
370 virtual UClassID
getDynamicClassID(void) const;
374 * <code>AnnualTimeZoneRule</code> is a class used for representing a time zone
375 * rule which takes effect annually. The calenday system used for the rule is
376 * is based on Gregorian calendar
380 class U_I18N_API AnnualTimeZoneRule
: public TimeZoneRule
{
383 * The constant representing the maximum year used for designating
384 * a rule is permanent.
386 static const int32_t MAX_YEAR
;
389 * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
390 * standard time, the amount of daylight saving offset adjustment, the annual start
391 * time rule and the start/until years. The input DateTimeRule is copied by this
392 * constructor, so the caller remains responsible for deleting the object.
393 * @param name The time zone name.
394 * @param rawOffset The GMT offset of its standard time in milliseconds.
395 * @param dstSavings The amount of daylight saving offset adjustment in
396 * milliseconds. If this ia a rule for standard time,
397 * the value of this argument is 0.
398 * @param dateTimeRule The start date/time rule repeated annually.
399 * @param startYear The first year when this rule takes effect.
400 * @param endYear The last year when this rule takes effect. If this
401 * rule is effective forever in future, specify MAX_YEAR.
404 AnnualTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
,
405 const DateTimeRule
& dateTimeRule
, int32_t startYear
, int32_t endYear
);
408 * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its
409 * standard time, the amount of daylight saving offset adjustment, the annual start
410 * time rule and the start/until years. The input DateTimeRule object is adopted
411 * by this object, therefore, the caller must not delete the object.
412 * @param name The time zone name.
413 * @param rawOffset The GMT offset of its standard time in milliseconds.
414 * @param dstSavings The amount of daylight saving offset adjustment in
415 * milliseconds. If this ia a rule for standard time,
416 * the value of this argument is 0.
417 * @param dateTimeRule The start date/time rule repeated annually.
418 * @param startYear The first year when this rule takes effect.
419 * @param endYear The last year when this rule takes effect. If this
420 * rule is effective forever in future, specify MAX_YEAR.
423 AnnualTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
,
424 DateTimeRule
* dateTimeRule
, int32_t startYear
, int32_t endYear
);
428 * @param source The AnnualTimeZoneRule object to be copied.
431 AnnualTimeZoneRule(const AnnualTimeZoneRule
& source
);
437 virtual ~AnnualTimeZoneRule();
440 * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and
441 * should delete it when done.
442 * @return A copy of the object.
445 virtual AnnualTimeZoneRule
* clone() const;
448 * Assignment operator.
449 * @param right The object to be copied.
452 AnnualTimeZoneRule
& operator=(const AnnualTimeZoneRule
& right
);
455 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
456 * of different subclasses are considered unequal.
457 * @param that The object to be compared with.
458 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
461 virtual UBool
operator==(const TimeZoneRule
& that
) const;
464 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
465 * of different subclasses are considered unequal.
466 * @param that The object to be compared with.
467 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
470 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
473 * Gets the start date/time rule used by this rule.
474 * @return The <code>AnnualDateTimeRule</code> which represents the start date/time
475 * rule used by this time zone rule.
478 const DateTimeRule
* getRule(void) const;
481 * Gets the first year when this rule takes effect.
482 * @return The start year of this rule. The year is in Gregorian calendar
483 * with 0 == 1 BCE, -1 == 2 BCE, etc.
486 int32_t getStartYear(void) const;
489 * Gets the end year when this rule takes effect.
490 * @return The end year of this rule (inclusive). The year is in Gregorian calendar
491 * with 0 == 1 BCE, -1 == 2 BCE, etc.
494 int32_t getEndYear(void) const;
497 * Gets the time when this rule takes effect in the given year.
498 * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
499 * @param prevRawOffset The standard time offset from UTC before this rule
500 * takes effect in milliseconds.
501 * @param prevDSTSavings The amount of daylight saving offset from the
503 * @param result Receives the start time in the year.
504 * @return true if this rule takes effect in the year and the result is set to
508 UBool
getStartInYear(int32_t year
, int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
511 * Returns if this rule represents the same rule and offsets as another.
512 * When two <code>TimeZoneRule</code> objects differ only its names, this method
514 * @param that The <code>TimeZoneRule</code> object to be compared with.
515 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
518 virtual UBool
isEquivalentTo(const TimeZoneRule
& that
) const;
521 * Gets the very first time when this rule takes effect.
522 * @param prevRawOffset The standard time offset from UTC before this rule
523 * takes effect in milliseconds.
524 * @param prevDSTSavings The amount of daylight saving offset from the
526 * @param result Receives the very first time when this rule takes effect.
527 * @return true if the start time is available. When false is returned, output parameter
528 * "result" is unchanged.
531 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
534 * Gets the final time when this rule takes effect.
535 * @param prevRawOffset The standard time offset from UTC before this rule
536 * takes effect in milliseconds.
537 * @param prevDSTSavings The amount of daylight saving offset from the
539 * @param result Receives the final time when this rule takes effect.
540 * @return true if the start time is available. When false is returned, output parameter
541 * "result" is unchanged.
544 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
547 * Gets the first time when this rule takes effect after the specified time.
548 * @param base The first start time after this base time will be returned.
549 * @param prevRawOffset The standard time offset from UTC before this rule
550 * takes effect in milliseconds.
551 * @param prevDSTSavings The amount of daylight saving offset from the
553 * @param inclusive Whether the base time is inclusive or not.
554 * @param result Receives The first time when this rule takes effect after
555 * the specified base time.
556 * @return true if the start time is available. When false is returned, output parameter
557 * "result" is unchanged.
560 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
561 UBool inclusive
, UDate
& result
) const;
564 * Gets the most recent time when this rule takes effect before the specified time.
565 * @param base The most recent time before this base time will be returned.
566 * @param prevRawOffset The standard time offset from UTC before this rule
567 * takes effect in milliseconds.
568 * @param prevDSTSavings The amount of daylight saving offset from the
570 * @param inclusive Whether the base time is inclusive or not.
571 * @param result Receives The most recent time when this rule takes effect before
572 * the specified base time.
573 * @return true if the start time is available. When false is returned, output parameter
574 * "result" is unchanged.
577 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
578 UBool inclusive
, UDate
& result
) const;
582 DateTimeRule
* fDateTimeRule
;
588 * Return the class ID for this class. This is useful only for comparing to
589 * a return value from getDynamicClassID(). For example:
591 * . Base* polymorphic_pointer = createPolymorphicObject();
592 * . if (polymorphic_pointer->getDynamicClassID() ==
593 * . erived::getStaticClassID()) ...
595 * @return The class ID for all objects of this class.
598 static UClassID U_EXPORT2
getStaticClassID(void);
601 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
602 * method is to implement a simple version of RTTI, since not all C++
603 * compilers support genuine RTTI. Polymorphic operator==() and clone()
604 * methods call this method.
606 * @return The class ID for this object. All objects of a
607 * given class have the same class ID. Objects of
608 * other classes have different class IDs.
611 virtual UClassID
getDynamicClassID(void) const;
615 * <code>TimeArrayTimeZoneRule</code> represents a time zone rule whose start times are
616 * defined by an array of milliseconds since the standard base time.
620 class U_I18N_API TimeArrayTimeZoneRule
: public TimeZoneRule
{
623 * Constructs a <code>TimeArrayTimeZoneRule</code> with the name, the GMT offset of its
624 * standard time, the amount of daylight saving offset adjustment and
625 * the array of times when this rule takes effect.
626 * @param name The time zone name.
627 * @param rawOffset The UTC offset of its standard time in milliseconds.
628 * @param dstSavings The amount of daylight saving offset adjustment in
629 * milliseconds. If this ia a rule for standard time,
630 * the value of this argument is 0.
631 * @param startTimes The array start times in milliseconds since the base time
632 * (January 1, 1970, 00:00:00).
633 * @param numStartTimes The number of elements in the parameter "startTimes"
634 * @param timeRuleType The time type of the start times, which is one of
635 * <code>DataTimeRule::WALL_TIME</code>, <code>STANDARD_TIME</code>
636 * and <code>UTC_TIME</code>.
639 TimeArrayTimeZoneRule(const UnicodeString
& name
, int32_t rawOffset
, int32_t dstSavings
,
640 const UDate
* startTimes
, int32_t numStartTimes
, DateTimeRule::TimeRuleType timeRuleType
);
644 * @param source The TimeArrayTimeZoneRule object to be copied.
647 TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule
& source
);
653 virtual ~TimeArrayTimeZoneRule();
656 * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and
657 * should delete it when done.
658 * @return A copy of the object.
661 virtual TimeArrayTimeZoneRule
* clone() const;
664 * Assignment operator.
665 * @param right The object to be copied.
668 TimeArrayTimeZoneRule
& operator=(const TimeArrayTimeZoneRule
& right
);
671 * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects
672 * of different subclasses are considered unequal.
673 * @param that The object to be compared with.
674 * @return true if the given <code>TimeZoneRule</code> objects are semantically equal.
677 virtual UBool
operator==(const TimeZoneRule
& that
) const;
680 * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects
681 * of different subclasses are considered unequal.
682 * @param that The object to be compared with.
683 * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal.
686 virtual UBool
operator!=(const TimeZoneRule
& that
) const;
689 * Gets the time type of the start times used by this rule. The return value
690 * is either <code>DateTimeRule::WALL_TIME</code> or <code>STANDARD_TIME</code>
691 * or <code>UTC_TIME</code>.
693 * @return The time type used of the start times used by this rule.
696 DateTimeRule::TimeRuleType
getTimeType(void) const;
699 * Gets a start time at the index stored in this rule.
700 * @param index The index of start times
701 * @param result Receives the start time at the index
702 * @return true if the index is within the valid range and
703 * and the result is set. When false, the output
704 * parameger "result" is unchanged.
707 UBool
getStartTimeAt(int32_t index
, UDate
& result
) const;
710 * Returns the number of start times stored in this rule
711 * @return The number of start times.
714 int32_t countStartTimes(void) const;
717 * Returns if this rule represents the same rule and offsets as another.
718 * When two <code>TimeZoneRule</code> objects differ only its names, this method
720 * @param that The <code>TimeZoneRule</code> object to be compared with.
721 * @return true if the other <code>TimeZoneRule</code> is equivalent to this one.
724 virtual UBool
isEquivalentTo(const TimeZoneRule
& that
) const;
727 * Gets the very first time when this rule takes effect.
728 * @param prevRawOffset The standard time offset from UTC before this rule
729 * takes effect in milliseconds.
730 * @param prevDSTSavings The amount of daylight saving offset from the
732 * @param result Receives the very first time when this rule takes effect.
733 * @return true if the start time is available. When false is returned, output parameter
734 * "result" is unchanged.
737 virtual UBool
getFirstStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
740 * Gets the final time when this rule takes effect.
741 * @param prevRawOffset The standard time offset from UTC before this rule
742 * takes effect in milliseconds.
743 * @param prevDSTSavings The amount of daylight saving offset from the
745 * @param result Receives the final time when this rule takes effect.
746 * @return true if the start time is available. When false is returned, output parameter
747 * "result" is unchanged.
750 virtual UBool
getFinalStart(int32_t prevRawOffset
, int32_t prevDSTSavings
, UDate
& result
) const;
753 * Gets the first time when this rule takes effect after the specified time.
754 * @param base The first start time after this base time will be returned.
755 * @param prevRawOffset The standard time offset from UTC before this rule
756 * takes effect in milliseconds.
757 * @param prevDSTSavings The amount of daylight saving offset from the
759 * @param inclusive Whether the base time is inclusive or not.
760 * @param result Receives The first time when this rule takes effect after
761 * the specified base time.
762 * @return true if the start time is available. When false is returned, output parameter
763 * "result" is unchanged.
766 virtual UBool
getNextStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
767 UBool inclusive
, UDate
& result
) const;
770 * Gets the most recent time when this rule takes effect before the specified time.
771 * @param base The most recent time before this base time will be returned.
772 * @param prevRawOffset The standard time offset from UTC before this rule
773 * takes effect in milliseconds.
774 * @param prevDSTSavings The amount of daylight saving offset from the
776 * @param inclusive Whether the base time is inclusive or not.
777 * @param result Receives The most recent time when this rule takes effect before
778 * the specified base time.
779 * @return true if the start time is available. When false is returned, output parameter
780 * "result" is unchanged.
783 virtual UBool
getPreviousStart(UDate base
, int32_t prevRawOffset
, int32_t prevDSTSavings
,
784 UBool inclusive
, UDate
& result
) const;
788 enum { TIMEARRAY_STACK_BUFFER_SIZE
= 32 };
789 UBool
initStartTimes(const UDate source
[], int32_t size
, UErrorCode
& ec
);
790 UDate
getUTC(UDate time
, int32_t raw
, int32_t dst
) const;
792 DateTimeRule::TimeRuleType fTimeRuleType
;
793 int32_t fNumStartTimes
;
795 UDate fLocalStartTimes
[TIMEARRAY_STACK_BUFFER_SIZE
];
799 * Return the class ID for this class. This is useful only for comparing to
800 * a return value from getDynamicClassID(). For example:
802 * . Base* polymorphic_pointer = createPolymorphicObject();
803 * . if (polymorphic_pointer->getDynamicClassID() ==
804 * . erived::getStaticClassID()) ...
806 * @return The class ID for all objects of this class.
809 static UClassID U_EXPORT2
getStaticClassID(void);
812 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
813 * method is to implement a simple version of RTTI, since not all C++
814 * compilers support genuine RTTI. Polymorphic operator==() and clone()
815 * methods call this method.
817 * @return The class ID for this object. All objects of a
818 * given class have the same class ID. Objects of
819 * other classes have different class IDs.
822 virtual UClassID
getDynamicClassID(void) const;
828 #endif /* #if !UCONFIG_NO_FORMATTING */
830 #endif /* U_SHOW_CPLUSPLUS_API */