1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others. 2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html 3*0e209d39SAndroid Build Coastguard Worker /* 4*0e209d39SAndroid Build Coastguard Worker ******************************************************************************* 5*0e209d39SAndroid Build Coastguard Worker * Copyright (C) 2009-2016, International Business Machines Corporation and 6*0e209d39SAndroid Build Coastguard Worker * others. All Rights Reserved. 7*0e209d39SAndroid Build Coastguard Worker ******************************************************************************* 8*0e209d39SAndroid Build Coastguard Worker */ 9*0e209d39SAndroid Build Coastguard Worker 10*0e209d39SAndroid Build Coastguard Worker /** 11*0e209d39SAndroid Build Coastguard Worker * \file 12*0e209d39SAndroid Build Coastguard Worker * \brief C API: RFC2445 VTIMEZONE support 13*0e209d39SAndroid Build Coastguard Worker * 14*0e209d39SAndroid Build Coastguard Worker * <p>This is a C wrapper around the C++ VTimeZone class.</p> 15*0e209d39SAndroid Build Coastguard Worker */ 16*0e209d39SAndroid Build Coastguard Worker 17*0e209d39SAndroid Build Coastguard Worker #ifndef __VZONE_H 18*0e209d39SAndroid Build Coastguard Worker #define __VZONE_H 19*0e209d39SAndroid Build Coastguard Worker 20*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h" 21*0e209d39SAndroid Build Coastguard Worker 22*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_FORMATTING 23*0e209d39SAndroid Build Coastguard Worker 24*0e209d39SAndroid Build Coastguard Worker #include "unicode/uobject.h" 25*0e209d39SAndroid Build Coastguard Worker #include "ztrans.h" 26*0e209d39SAndroid Build Coastguard Worker 27*0e209d39SAndroid Build Coastguard Worker struct VZone; 28*0e209d39SAndroid Build Coastguard Worker /** 29*0e209d39SAndroid Build Coastguard Worker * A UnicodeSet. Use the vzone_* API to manipulate. Create with 30*0e209d39SAndroid Build Coastguard Worker * vzone_open*, and destroy with vzone_close. 31*0e209d39SAndroid Build Coastguard Worker */ 32*0e209d39SAndroid Build Coastguard Worker typedef struct VZone VZone; 33*0e209d39SAndroid Build Coastguard Worker 34*0e209d39SAndroid Build Coastguard Worker /********************************************************************* 35*0e209d39SAndroid Build Coastguard Worker * VZone API 36*0e209d39SAndroid Build Coastguard Worker *********************************************************************/ 37*0e209d39SAndroid Build Coastguard Worker 38*0e209d39SAndroid Build Coastguard Worker /** 39*0e209d39SAndroid Build Coastguard Worker * Creates a vzone from the given time zone ID. 40*0e209d39SAndroid Build Coastguard Worker * @param ID The time zone ID, such as America/New_York 41*0e209d39SAndroid Build Coastguard Worker * @param idLength, length of the ID parameter 42*0e209d39SAndroid Build Coastguard Worker * @return A vzone object initialized by the time zone ID, 43*0e209d39SAndroid Build Coastguard Worker * or NULL when the ID is unknown. 44*0e209d39SAndroid Build Coastguard Worker */ 45*0e209d39SAndroid Build Coastguard Worker U_CAPI VZone* U_EXPORT2 46*0e209d39SAndroid Build Coastguard Worker vzone_openID(const UChar* ID, int32_t idLength); 47*0e209d39SAndroid Build Coastguard Worker 48*0e209d39SAndroid Build Coastguard Worker /** 49*0e209d39SAndroid Build Coastguard Worker * Create a vzone instance by RFC2445 VTIMEZONE data 50*0e209d39SAndroid Build Coastguard Worker * @param vtzdata The string including VTIMEZONE data block 51*0e209d39SAndroid Build Coastguard Worker * @param vtzdataLength, length of the vtzdata 52*0e209d39SAndroid Build Coastguard Worker * @param status Output param to filled in with a success or an error. 53*0e209d39SAndroid Build Coastguard Worker * @return A vzone initialized by the VTIMEZONE data or 54*0e209d39SAndroid Build Coastguard Worker * NULL if failed to load the rule from the VTIMEZONE data. 55*0e209d39SAndroid Build Coastguard Worker */ 56*0e209d39SAndroid Build Coastguard Worker U_CAPI VZone* U_EXPORT2 57*0e209d39SAndroid Build Coastguard Worker vzone_openData(const UChar* vtzdata, int32_t vtzdataLength, UErrorCode& status); 58*0e209d39SAndroid Build Coastguard Worker 59*0e209d39SAndroid Build Coastguard Worker /** 60*0e209d39SAndroid Build Coastguard Worker * Disposes of the storage used by a VZone object. This function should 61*0e209d39SAndroid Build Coastguard Worker * be called exactly once for objects returned by vzone_open*. 62*0e209d39SAndroid Build Coastguard Worker * @param set the object to dispose of 63*0e209d39SAndroid Build Coastguard Worker */ 64*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 65*0e209d39SAndroid Build Coastguard Worker vzone_close(VZone* zone); 66*0e209d39SAndroid Build Coastguard Worker 67*0e209d39SAndroid Build Coastguard Worker /** 68*0e209d39SAndroid Build Coastguard Worker * Returns a copy of this object. 69*0e209d39SAndroid Build Coastguard Worker * @param zone the original vzone 70*0e209d39SAndroid Build Coastguard Worker * @return the newly allocated copy of the vzone 71*0e209d39SAndroid Build Coastguard Worker */ 72*0e209d39SAndroid Build Coastguard Worker U_CAPI VZone* U_EXPORT2 73*0e209d39SAndroid Build Coastguard Worker vzone_clone(const VZone *zone); 74*0e209d39SAndroid Build Coastguard Worker 75*0e209d39SAndroid Build Coastguard Worker /** 76*0e209d39SAndroid Build Coastguard Worker * Returns true if zone1 is identical to zone2 77*0e209d39SAndroid Build Coastguard Worker * and vis versa. 78*0e209d39SAndroid Build Coastguard Worker * @param zone1 to be checked for containment 79*0e209d39SAndroid Build Coastguard Worker * @param zone2 to be checked for containment 80*0e209d39SAndroid Build Coastguard Worker * @return true if the test condition is met 81*0e209d39SAndroid Build Coastguard Worker */ 82*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 83*0e209d39SAndroid Build Coastguard Worker vzone_equals(const VZone* zone1, const VZone* zone2); 84*0e209d39SAndroid Build Coastguard Worker 85*0e209d39SAndroid Build Coastguard Worker /** 86*0e209d39SAndroid Build Coastguard Worker * Gets the RFC2445 TZURL property value. When a vzone instance was 87*0e209d39SAndroid Build Coastguard Worker * created from VTIMEZONE data, the initial value is set by the TZURL 88*0e209d39SAndroid Build Coastguard Worker * property value in the data. Otherwise, the initial value is not set. 89*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 90*0e209d39SAndroid Build Coastguard Worker * @param url Receives the RFC2445 TZURL property value. 91*0e209d39SAndroid Build Coastguard Worker * @param urlLength, length of the url 92*0e209d39SAndroid Build Coastguard Worker * @return true if TZURL attribute is available and value is set. 93*0e209d39SAndroid Build Coastguard Worker */ 94*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 95*0e209d39SAndroid Build Coastguard Worker vzone_getTZURL(VZone* zone, UChar* & url, int32_t & urlLength); 96*0e209d39SAndroid Build Coastguard Worker 97*0e209d39SAndroid Build Coastguard Worker /** 98*0e209d39SAndroid Build Coastguard Worker * Sets the RFC2445 TZURL property value. 99*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 100*0e209d39SAndroid Build Coastguard Worker * @param url The TZURL property value. 101*0e209d39SAndroid Build Coastguard Worker * @param urlLength, length of the url 102*0e209d39SAndroid Build Coastguard Worker */ 103*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 104*0e209d39SAndroid Build Coastguard Worker vzone_setTZURL(VZone* zone, UChar* url, int32_t urlLength); 105*0e209d39SAndroid Build Coastguard Worker 106*0e209d39SAndroid Build Coastguard Worker /** 107*0e209d39SAndroid Build Coastguard Worker * Gets the RFC2445 LAST-MODIFIED property value. When a vzone instance 108*0e209d39SAndroid Build Coastguard Worker * was created from VTIMEZONE data, the initial value is set by the 109*0e209d39SAndroid Build Coastguard Worker * LAST-MODIFIED property value in the data. Otherwise, the initial value 110*0e209d39SAndroid Build Coastguard Worker * is not set. 111*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 112*0e209d39SAndroid Build Coastguard Worker * @param lastModified Receives the last modified date. 113*0e209d39SAndroid Build Coastguard Worker * @return true if lastModified attribute is available and value is set. 114*0e209d39SAndroid Build Coastguard Worker */ 115*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 116*0e209d39SAndroid Build Coastguard Worker vzone_getLastModified(VZone* zone, UDate& lastModified); 117*0e209d39SAndroid Build Coastguard Worker 118*0e209d39SAndroid Build Coastguard Worker /** 119*0e209d39SAndroid Build Coastguard Worker * Sets the RFC2445 LAST-MODIFIED property value. 120*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 121*0e209d39SAndroid Build Coastguard Worker * @param lastModified The LAST-MODIFIED date. 122*0e209d39SAndroid Build Coastguard Worker */ 123*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 124*0e209d39SAndroid Build Coastguard Worker vzone_setLastModified(VZone* zone, UDate lastModified); 125*0e209d39SAndroid Build Coastguard Worker 126*0e209d39SAndroid Build Coastguard Worker /** 127*0e209d39SAndroid Build Coastguard Worker * Writes RFC2445 VTIMEZONE data for this time zone 128*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 129*0e209d39SAndroid Build Coastguard Worker * @param result Output param to filled in with the VTIMEZONE data. 130*0e209d39SAndroid Build Coastguard Worker * @param resultLength, length of the result output 131*0e209d39SAndroid Build Coastguard Worker * @param status Output param to filled in with a success or an error. 132*0e209d39SAndroid Build Coastguard Worker */ 133*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 134*0e209d39SAndroid Build Coastguard Worker vzone_write(VZone* zone, UChar* & result, int32_t & resultLength, UErrorCode& status); 135*0e209d39SAndroid Build Coastguard Worker 136*0e209d39SAndroid Build Coastguard Worker /** 137*0e209d39SAndroid Build Coastguard Worker * Writes RFC2445 VTIMEZONE data for this time zone applicable 138*0e209d39SAndroid Build Coastguard Worker * for dates after the specified start time. 139*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 140*0e209d39SAndroid Build Coastguard Worker * @param start The start date. 141*0e209d39SAndroid Build Coastguard Worker * @param result Output param to filled in with the VTIMEZONE data. 142*0e209d39SAndroid Build Coastguard Worker * @param resultLength, length of the result output 143*0e209d39SAndroid Build Coastguard Worker * @param status Output param to filled in with a success or an error. 144*0e209d39SAndroid Build Coastguard Worker */ 145*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 146*0e209d39SAndroid Build Coastguard Worker vzone_writeFromStart(VZone* zone, UDate start, UChar* & result, int32_t & resultLength, UErrorCode& status); 147*0e209d39SAndroid Build Coastguard Worker 148*0e209d39SAndroid Build Coastguard Worker /** 149*0e209d39SAndroid Build Coastguard Worker * Writes RFC2445 VTIMEZONE data applicable for the specified date. 150*0e209d39SAndroid Build Coastguard Worker * Some common iCalendar implementations can only handle a single time 151*0e209d39SAndroid Build Coastguard Worker * zone property or a pair of standard and daylight time properties using 152*0e209d39SAndroid Build Coastguard Worker * BYDAY rule with day of week (such as BYDAY=1SUN). This method produce 153*0e209d39SAndroid Build Coastguard Worker * the VTIMEZONE data which can be handled these implementations. The rules 154*0e209d39SAndroid Build Coastguard Worker * produced by this method can be used only for calculating time zone offset 155*0e209d39SAndroid Build Coastguard Worker * around the specified date. 156*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 157*0e209d39SAndroid Build Coastguard Worker * @param time The date used for rule extraction. 158*0e209d39SAndroid Build Coastguard Worker * @param result Output param to filled in with the VTIMEZONE data. 159*0e209d39SAndroid Build Coastguard Worker * @param status Output param to filled in with a success or an error. 160*0e209d39SAndroid Build Coastguard Worker */ 161*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 162*0e209d39SAndroid Build Coastguard Worker vzone_writeSimple(VZone* zone, UDate time, UChar* & result, int32_t & resultLength, UErrorCode& status); 163*0e209d39SAndroid Build Coastguard Worker 164*0e209d39SAndroid Build Coastguard Worker /** 165*0e209d39SAndroid Build Coastguard Worker * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add 166*0e209d39SAndroid Build Coastguard Worker * to GMT to get local time in this time zone, taking daylight savings time into 167*0e209d39SAndroid Build Coastguard Worker * account) as of a particular reference date. The reference date is used to determine 168*0e209d39SAndroid Build Coastguard Worker * whether daylight savings time is in effect and needs to be figured into the offset 169*0e209d39SAndroid Build Coastguard Worker * that is returned (in other words, what is the adjusted GMT offset in this time zone 170*0e209d39SAndroid Build Coastguard Worker * at this particular date and time?). For the time zones produced by createTimeZone(), 171*0e209d39SAndroid Build Coastguard Worker * the reference data is specified according to the Gregorian calendar, and the date 172*0e209d39SAndroid Build Coastguard Worker * and time fields are local standard time. 173*0e209d39SAndroid Build Coastguard Worker * 174*0e209d39SAndroid Build Coastguard Worker * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload, 175*0e209d39SAndroid Build Coastguard Worker * which returns both the raw and the DST offset for a given time. This method 176*0e209d39SAndroid Build Coastguard Worker * is retained only for backward compatibility. 177*0e209d39SAndroid Build Coastguard Worker * 178*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 179*0e209d39SAndroid Build Coastguard Worker * @param era The reference date's era 180*0e209d39SAndroid Build Coastguard Worker * @param year The reference date's year 181*0e209d39SAndroid Build Coastguard Worker * @param month The reference date's month (0-based; 0 is January) 182*0e209d39SAndroid Build Coastguard Worker * @param day The reference date's day-in-month (1-based) 183*0e209d39SAndroid Build Coastguard Worker * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) 184*0e209d39SAndroid Build Coastguard Worker * @param millis The reference date's milliseconds in day, local standard time 185*0e209d39SAndroid Build Coastguard Worker * @param status Output param to filled in with a success or an error. 186*0e209d39SAndroid Build Coastguard Worker * @return The offset in milliseconds to add to GMT to get local time. 187*0e209d39SAndroid Build Coastguard Worker */ 188*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2 189*0e209d39SAndroid Build Coastguard Worker vzone_getOffset(VZone* zone, uint8_t era, int32_t year, int32_t month, int32_t day, 190*0e209d39SAndroid Build Coastguard Worker uint8_t dayOfWeek, int32_t millis, UErrorCode& status); 191*0e209d39SAndroid Build Coastguard Worker 192*0e209d39SAndroid Build Coastguard Worker /** 193*0e209d39SAndroid Build Coastguard Worker * Gets the time zone offset, for current date, modified in case of 194*0e209d39SAndroid Build Coastguard Worker * daylight savings. This is the offset to add *to* UTC to get local time. 195*0e209d39SAndroid Build Coastguard Worker * 196*0e209d39SAndroid Build Coastguard Worker * <p>Note: Don't call this method. Instead, call the getOffset(UDate...) overload, 197*0e209d39SAndroid Build Coastguard Worker * which returns both the raw and the DST offset for a given time. This method 198*0e209d39SAndroid Build Coastguard Worker * is retained only for backward compatibility. 199*0e209d39SAndroid Build Coastguard Worker * 200*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 201*0e209d39SAndroid Build Coastguard Worker * @param era The reference date's era 202*0e209d39SAndroid Build Coastguard Worker * @param year The reference date's year 203*0e209d39SAndroid Build Coastguard Worker * @param month The reference date's month (0-based; 0 is January) 204*0e209d39SAndroid Build Coastguard Worker * @param day The reference date's day-in-month (1-based) 205*0e209d39SAndroid Build Coastguard Worker * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) 206*0e209d39SAndroid Build Coastguard Worker * @param millis The reference date's milliseconds in day, local standard time 207*0e209d39SAndroid Build Coastguard Worker * @param monthLength The length of the given month in days. 208*0e209d39SAndroid Build Coastguard Worker * @param status Output param to filled in with a success or an error. 209*0e209d39SAndroid Build Coastguard Worker * @return The offset in milliseconds to add to GMT to get local time. 210*0e209d39SAndroid Build Coastguard Worker */ 211*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2 212*0e209d39SAndroid Build Coastguard Worker vzone_getOffset2(VZone* zone, uint8_t era, int32_t year, int32_t month, int32_t day, 213*0e209d39SAndroid Build Coastguard Worker uint8_t dayOfWeek, int32_t millis, 214*0e209d39SAndroid Build Coastguard Worker int32_t monthLength, UErrorCode& status); 215*0e209d39SAndroid Build Coastguard Worker 216*0e209d39SAndroid Build Coastguard Worker /** 217*0e209d39SAndroid Build Coastguard Worker * Returns the time zone raw and GMT offset for the given moment 218*0e209d39SAndroid Build Coastguard Worker * in time. Upon return, local-millis = GMT-millis + rawOffset + 219*0e209d39SAndroid Build Coastguard Worker * dstOffset. All computations are performed in the proleptic 220*0e209d39SAndroid Build Coastguard Worker * Gregorian calendar. The default implementation in the TimeZone 221*0e209d39SAndroid Build Coastguard Worker * class delegates to the 8-argument getOffset(). 222*0e209d39SAndroid Build Coastguard Worker * 223*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 224*0e209d39SAndroid Build Coastguard Worker * @param date moment in time for which to return offsets, in 225*0e209d39SAndroid Build Coastguard Worker * units of milliseconds from January 1, 1970 0:00 GMT, either GMT 226*0e209d39SAndroid Build Coastguard Worker * time or local wall time, depending on `local'. 227*0e209d39SAndroid Build Coastguard Worker * @param local if true, `date' is local wall time; otherwise it 228*0e209d39SAndroid Build Coastguard Worker * is in GMT time. 229*0e209d39SAndroid Build Coastguard Worker * @param rawOffset output parameter to receive the raw offset, that 230*0e209d39SAndroid Build Coastguard Worker * is, the offset not including DST adjustments 231*0e209d39SAndroid Build Coastguard Worker * @param dstOffset output parameter to receive the DST offset, 232*0e209d39SAndroid Build Coastguard Worker * that is, the offset to be added to `rawOffset' to obtain the 233*0e209d39SAndroid Build Coastguard Worker * total offset between local and GMT time. If DST is not in 234*0e209d39SAndroid Build Coastguard Worker * effect, this value is zero; otherwise it is a positive value, 235*0e209d39SAndroid Build Coastguard Worker * typically one hour. 236*0e209d39SAndroid Build Coastguard Worker * @param ec input-output error code 237*0e209d39SAndroid Build Coastguard Worker */ 238*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 239*0e209d39SAndroid Build Coastguard Worker vzone_getOffset3(VZone* zone, UDate date, UBool local, int32_t& rawOffset, 240*0e209d39SAndroid Build Coastguard Worker int32_t& dstOffset, UErrorCode& ec); 241*0e209d39SAndroid Build Coastguard Worker 242*0e209d39SAndroid Build Coastguard Worker /** 243*0e209d39SAndroid Build Coastguard Worker * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add 244*0e209d39SAndroid Build Coastguard Worker * to GMT to get local time, before taking daylight savings time into account). 245*0e209d39SAndroid Build Coastguard Worker * 246*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 247*0e209d39SAndroid Build Coastguard Worker * @param offsetMillis The new raw GMT offset for this time zone. 248*0e209d39SAndroid Build Coastguard Worker */ 249*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2 250*0e209d39SAndroid Build Coastguard Worker vzone_setRawOffset(VZone* zone, int32_t offsetMillis); 251*0e209d39SAndroid Build Coastguard Worker 252*0e209d39SAndroid Build Coastguard Worker /** 253*0e209d39SAndroid Build Coastguard Worker * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add 254*0e209d39SAndroid Build Coastguard Worker * to GMT to get local time, before taking daylight savings time into account). 255*0e209d39SAndroid Build Coastguard Worker * 256*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 257*0e209d39SAndroid Build Coastguard Worker * @return The TimeZone's raw GMT offset. 258*0e209d39SAndroid Build Coastguard Worker */ 259*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2 260*0e209d39SAndroid Build Coastguard Worker vzone_getRawOffset(VZone* zone); 261*0e209d39SAndroid Build Coastguard Worker 262*0e209d39SAndroid Build Coastguard Worker /** 263*0e209d39SAndroid Build Coastguard Worker * Queries if this time zone uses daylight savings time. 264*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 265*0e209d39SAndroid Build Coastguard Worker * @return true if this time zone uses daylight savings time, 266*0e209d39SAndroid Build Coastguard Worker * false, otherwise. 267*0e209d39SAndroid Build Coastguard Worker */ 268*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 269*0e209d39SAndroid Build Coastguard Worker vzone_useDaylightTime(VZone* zone); 270*0e209d39SAndroid Build Coastguard Worker 271*0e209d39SAndroid Build Coastguard Worker /** 272*0e209d39SAndroid Build Coastguard Worker * Queries if the given date is in daylight savings time in 273*0e209d39SAndroid Build Coastguard Worker * this time zone. 274*0e209d39SAndroid Build Coastguard Worker * This method is wasteful since it creates a new GregorianCalendar and 275*0e209d39SAndroid Build Coastguard Worker * deletes it each time it is called. This is a deprecated method 276*0e209d39SAndroid Build Coastguard Worker * and provided only for Java compatibility. 277*0e209d39SAndroid Build Coastguard Worker * 278*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 279*0e209d39SAndroid Build Coastguard Worker * @param date the given UDate. 280*0e209d39SAndroid Build Coastguard Worker * @param status Output param filled in with success/error code. 281*0e209d39SAndroid Build Coastguard Worker * @return true if the given date is in daylight savings time, 282*0e209d39SAndroid Build Coastguard Worker * false, otherwise. 283*0e209d39SAndroid Build Coastguard Worker */ 284*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 285*0e209d39SAndroid Build Coastguard Worker vzone_inDaylightTime(VZone* zone, UDate date, UErrorCode& status); 286*0e209d39SAndroid Build Coastguard Worker 287*0e209d39SAndroid Build Coastguard Worker /** 288*0e209d39SAndroid Build Coastguard Worker * Returns true if this zone has the same rule and offset as another zone. 289*0e209d39SAndroid Build Coastguard Worker * That is, if this zone differs only in ID, if at all. 290*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 291*0e209d39SAndroid Build Coastguard Worker * @param other the <code>TimeZone</code> object to be compared with 292*0e209d39SAndroid Build Coastguard Worker * @return true if the given zone is the same as this one, 293*0e209d39SAndroid Build Coastguard Worker * with the possible exception of the ID 294*0e209d39SAndroid Build Coastguard Worker */ 295*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 296*0e209d39SAndroid Build Coastguard Worker vzone_hasSameRules(VZone* zone, const VZone* other); 297*0e209d39SAndroid Build Coastguard Worker 298*0e209d39SAndroid Build Coastguard Worker /** 299*0e209d39SAndroid Build Coastguard Worker * Gets the first time zone transition after the base time. 300*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 301*0e209d39SAndroid Build Coastguard Worker * @param base The base time. 302*0e209d39SAndroid Build Coastguard Worker * @param inclusive Whether the base time is inclusive or not. 303*0e209d39SAndroid Build Coastguard Worker * @param result Receives the first transition after the base time. 304*0e209d39SAndroid Build Coastguard Worker * @return true if the transition is found. 305*0e209d39SAndroid Build Coastguard Worker */ 306*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 307*0e209d39SAndroid Build Coastguard Worker vzone_getNextTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result); 308*0e209d39SAndroid Build Coastguard Worker 309*0e209d39SAndroid Build Coastguard Worker /** 310*0e209d39SAndroid Build Coastguard Worker * Gets the most recent time zone transition before the base time. 311*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 312*0e209d39SAndroid Build Coastguard Worker * @param base The base time. 313*0e209d39SAndroid Build Coastguard Worker * @param inclusive Whether the base time is inclusive or not. 314*0e209d39SAndroid Build Coastguard Worker * @param result Receives the most recent transition before the base time. 315*0e209d39SAndroid Build Coastguard Worker * @return true if the transition is found. 316*0e209d39SAndroid Build Coastguard Worker */ 317*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2 318*0e209d39SAndroid Build Coastguard Worker vzone_getPreviousTransition(VZone* zone, UDate base, UBool inclusive, ZTrans* result); 319*0e209d39SAndroid Build Coastguard Worker 320*0e209d39SAndroid Build Coastguard Worker /** 321*0e209d39SAndroid Build Coastguard Worker * Returns the number of <code>TimeZoneRule</code>s which represents time transitions, 322*0e209d39SAndroid Build Coastguard Worker * for this time zone, that is, all <code>TimeZoneRule</code>s for this time zone except 323*0e209d39SAndroid Build Coastguard Worker * <code>InitialTimeZoneRule</code>. The return value range is 0 or any positive value. 324*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 325*0e209d39SAndroid Build Coastguard Worker * @param status Receives error status code. 326*0e209d39SAndroid Build Coastguard Worker * @return The number of <code>TimeZoneRule</code>s representing time transitions. 327*0e209d39SAndroid Build Coastguard Worker */ 328*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2 329*0e209d39SAndroid Build Coastguard Worker vzone_countTransitionRules(VZone* zone, UErrorCode& status); 330*0e209d39SAndroid Build Coastguard Worker 331*0e209d39SAndroid Build Coastguard Worker /** 332*0e209d39SAndroid Build Coastguard Worker * Return the class ID for this class. This is useful only for comparing to 333*0e209d39SAndroid Build Coastguard Worker * a return value from getDynamicClassID(). For example: 334*0e209d39SAndroid Build Coastguard Worker * <pre> 335*0e209d39SAndroid Build Coastguard Worker * . Base* polymorphic_pointer = createPolymorphicObject(); 336*0e209d39SAndroid Build Coastguard Worker * . if (polymorphic_pointer->getDynamicClassID() == 337*0e209d39SAndroid Build Coastguard Worker * . erived::getStaticClassID()) ... 338*0e209d39SAndroid Build Coastguard Worker * </pre> 339*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 340*0e209d39SAndroid Build Coastguard Worker * @return The class ID for all objects of this class. 341*0e209d39SAndroid Build Coastguard Worker */ 342*0e209d39SAndroid Build Coastguard Worker U_CAPI UClassID U_EXPORT2 343*0e209d39SAndroid Build Coastguard Worker vzone_getStaticClassID(VZone* zone); 344*0e209d39SAndroid Build Coastguard Worker 345*0e209d39SAndroid Build Coastguard Worker /** 346*0e209d39SAndroid Build Coastguard Worker * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This 347*0e209d39SAndroid Build Coastguard Worker * method is to implement a simple version of RTTI, since not all C++ 348*0e209d39SAndroid Build Coastguard Worker * compilers support genuine RTTI. Polymorphic operator==() and clone() 349*0e209d39SAndroid Build Coastguard Worker * methods call this method. 350*0e209d39SAndroid Build Coastguard Worker * 351*0e209d39SAndroid Build Coastguard Worker * @param zone, the vzone to use 352*0e209d39SAndroid Build Coastguard Worker * @return The class ID for this object. All objects of a 353*0e209d39SAndroid Build Coastguard Worker * given class have the same class ID. Objects of 354*0e209d39SAndroid Build Coastguard Worker * other classes have different class IDs. 355*0e209d39SAndroid Build Coastguard Worker */ 356*0e209d39SAndroid Build Coastguard Worker U_CAPI UClassID U_EXPORT2 357*0e209d39SAndroid Build Coastguard Worker vzone_getDynamicClassID(VZone* zone); 358*0e209d39SAndroid Build Coastguard Worker 359*0e209d39SAndroid Build Coastguard Worker #endif // __VZONE_H 360*0e209d39SAndroid Build Coastguard Worker 361*0e209d39SAndroid Build Coastguard Worker #endif 362