X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..4f1e1a09ce4daed860e35d359ce2fceccb0764e8:/icuSources/i18n/unicode/simpletz.h diff --git a/icuSources/i18n/unicode/simpletz.h b/icuSources/i18n/unicode/simpletz.h index 5b85c8d7..f93d1063 100644 --- a/icuSources/i18n/unicode/simpletz.h +++ b/icuSources/i18n/unicode/simpletz.h @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************** - * Copyright (C) 1997-2008, International Business Machines * + * Copyright (C) 1997-2013, International Business Machines * * Corporation and others. All Rights Reserved. * ******************************************************************************** * @@ -35,6 +37,7 @@ #include "unicode/basictz.h" +#if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN // forward declaration @@ -49,9 +52,9 @@ class AnnualTimeZoneRule; *

* When specifying daylight-savings-time begin and end dates, use a negative value for * dayOfWeekInMonth to indicate that SimpleTimeZone should - * count from the end of the month backwards. For example, in the U.S., Daylight Savings - * Time ends at the last (dayOfWeekInMonth = -1) Sunday in October, at 2 AM in standard - * time. + * count from the end of the month backwards. For example, if Daylight Savings + * Time starts or ends at the last Sunday a month, use dayOfWeekInMonth = -1 + * along with dayOfWeek = UCAL_SUNDAY to specify the rule. * * @see Calendar * @see GregorianCalendar @@ -268,9 +271,9 @@ public: /** * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings - * Time starts at the first Sunday in April, at 2 AM in standard time. + * Time starts at the second Sunday in March, at 2 AM in standard time. * Therefore, you can set the start rule by calling: - * setStartRule(TimeFields.APRIL, 1, TimeFields.SUNDAY, 2*60*60*1000); + * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000); * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate * the exact starting date. Their exact meaning depend on their respective signs, * allowing various types of rules to be constructed, as follows: @@ -312,9 +315,9 @@ public: int32_t time, UErrorCode& status); /** * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings - * Time starts at the first Sunday in April, at 2 AM in standard time. + * Time starts at the second Sunday in March, at 2 AM in standard time. * Therefore, you can set the start rule by calling: - * setStartRule(TimeFields.APRIL, 1, TimeFields.SUNDAY, 2*60*60*1000); + * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000); * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate * the exact starting date. Their exact meaning depend on their respective signs, * allowing various types of rules to be constructed, as follows: @@ -426,11 +429,11 @@ public: int32_t time, TimeMode mode, UBool after, UErrorCode& status); /** - * Sets the daylight savings ending rule. For example, in the U.S., Daylight + * Sets the daylight savings ending rule. For example, if Daylight * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. * Therefore, you can set the end rule by calling: *

-     * .   setEndRule(TimeFields.OCTOBER, -1, TimeFields.SUNDAY, 2*60*60*1000);
+     *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
      * 
* Various other types of rules can be specified by manipulating the dayOfWeek * and dayOfWeekInMonth parameters. For complete details, see the documentation @@ -451,11 +454,11 @@ public: int32_t time, UErrorCode& status); /** - * Sets the daylight savings ending rule. For example, in the U.S., Daylight + * Sets the daylight savings ending rule. For example, if Daylight * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. * Therefore, you can set the end rule by calling: *
-     * .   setEndRule(TimeFields.OCTOBER, -1, TimeFields.SUNDAY, 2*60*60*1000);
+     *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
      * 
* Various other types of rules can be specified by manipulating the dayOfWeek * and dayOfWeekInMonth parameters. For complete details, see the documentation @@ -621,7 +624,7 @@ public: * @internal */ virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, - int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) /*const*/; + int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const; /** * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add @@ -645,7 +648,8 @@ public: * Sets the amount of time in ms that the clock is advanced during DST. * @param millisSavedDuringDST the number of milliseconds the time is * advanced with respect to standard time when the daylight savings rules - * are in effect. A positive number, typically one hour (3600000). + * are in effect. Typically one hour (+3600000). The amount could be negative, + * but not 0. * @param status An UErrorCode to receive the status. * @stable ICU 2.0 */ @@ -655,7 +659,8 @@ public: * Returns the amount of time in ms that the clock is advanced during DST. * @return the number of milliseconds the time is * advanced with respect to standard time when the daylight savings rules - * are in effect. A positive number, typically one hour (3600000). + * are in effect. Typically one hour (+3600000). The amount could be negative, + * but not 0. * @stable ICU 2.0 */ virtual int32_t getDSTSavings(void) const; @@ -707,9 +712,9 @@ public: * @param inclusive Whether the base time is inclusive or not. * @param result Receives the first transition after the base time. * @return TRUE if the transition is found. - * @stable ICU 4.0 + * @stable ICU 3.8 */ - virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/; + virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; /** * Gets the most recent time zone transition before the base time. @@ -717,9 +722,9 @@ public: * @param inclusive Whether the base time is inclusive or not. * @param result Receives the most recent transition before the base time. * @return TRUE if the transition is found. - * @stable ICU 4.0 + * @stable ICU 3.8 */ - virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) /*const*/; + virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; /** * Returns the number of TimeZoneRules which represents time transitions, @@ -727,9 +732,9 @@ public: * InitialTimeZoneRule. The return value range is 0 or any positive value. * @param status Receives error status code. * @return The number of TimeZoneRules representing time transitions. - * @stable ICU 4.0 + * @stable ICU 3.8 */ - virtual int32_t countTransitionRules(UErrorCode& status) /*const*/; + virtual int32_t countTransitionRules(UErrorCode& status) const; /** * Gets the InitialTimeZoneRule and the set of TimeZoneRule @@ -745,10 +750,10 @@ public: * the timezone transition rules. On output, actual number of * rules filled in the array will be set. * @param status Receives error status code. - * @stable ICU 4.0 + * @stable ICU 3.8 */ virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, - const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) /*const*/; + const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const; public: @@ -807,7 +812,7 @@ private: * @param endTime the time DST ends * @param endTimeMode Whether the end time is local wall time, local * standard time, or UTC time. Default is local wall time. - * @param savingsDST The number of milliseconds added to standard time + * @param dstSavings The number of milliseconds added to standard time * to get DST time. Default is one hour. * @param status An UErrorCode to receive the status. */ @@ -870,6 +875,7 @@ private: int32_t dstSavings; /* Private for BasicTimeZone implementation */ + void checkTransitionRules(UErrorCode& status) const; void initTransitionRules(UErrorCode& status); void clearTransitionRules(void); void deleteTransitionRules(void); @@ -921,6 +927,7 @@ SimpleTimeZone::getOffset(UDate date, UBool local, int32_t& rawOffsetRef, } U_NAMESPACE_END +#endif // U_SHOW_CPLUSPLUS_API #endif /* #if !UCONFIG_NO_FORMATTING */