Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * Copyright (C) 2007-2008, International Business Machines Corporation and * |
michael@0 | 4 | * others. All Rights Reserved. * |
michael@0 | 5 | ******************************************************************************* |
michael@0 | 6 | */ |
michael@0 | 7 | #ifndef TZRULE_H |
michael@0 | 8 | #define TZRULE_H |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * \file |
michael@0 | 12 | * \brief C++ API: Time zone rule classes |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | #include "unicode/utypes.h" |
michael@0 | 16 | |
michael@0 | 17 | #if !UCONFIG_NO_FORMATTING |
michael@0 | 18 | |
michael@0 | 19 | #include "unicode/uobject.h" |
michael@0 | 20 | #include "unicode/unistr.h" |
michael@0 | 21 | #include "unicode/dtrule.h" |
michael@0 | 22 | |
michael@0 | 23 | U_NAMESPACE_BEGIN |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * <code>TimeZoneRule</code> is a class representing a rule for time zone. |
michael@0 | 27 | * <code>TimeZoneRule</code> has a set of time zone attributes, such as zone name, |
michael@0 | 28 | * raw offset (UTC offset for standard time) and daylight saving time offset. |
michael@0 | 29 | * |
michael@0 | 30 | * @stable ICU 3.8 |
michael@0 | 31 | */ |
michael@0 | 32 | class U_I18N_API TimeZoneRule : public UObject { |
michael@0 | 33 | public: |
michael@0 | 34 | /** |
michael@0 | 35 | * Destructor. |
michael@0 | 36 | * @stable ICU 3.8 |
michael@0 | 37 | */ |
michael@0 | 38 | virtual ~TimeZoneRule(); |
michael@0 | 39 | |
michael@0 | 40 | /** |
michael@0 | 41 | * Clone this TimeZoneRule object polymorphically. The caller owns the result and |
michael@0 | 42 | * should delete it when done. |
michael@0 | 43 | * @return A copy of the object. |
michael@0 | 44 | * @stable ICU 3.8 |
michael@0 | 45 | */ |
michael@0 | 46 | virtual TimeZoneRule* clone(void) const = 0; |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects |
michael@0 | 50 | * of different subclasses are considered unequal. |
michael@0 | 51 | * @param that The object to be compared with. |
michael@0 | 52 | * @return true if the given <code>TimeZoneRule</code> objects are semantically equal. |
michael@0 | 53 | * @stable ICU 3.8 |
michael@0 | 54 | */ |
michael@0 | 55 | virtual UBool operator==(const TimeZoneRule& that) const; |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects |
michael@0 | 59 | * of different subclasses are considered unequal. |
michael@0 | 60 | * @param that The object to be compared with. |
michael@0 | 61 | * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal. |
michael@0 | 62 | * @stable ICU 3.8 |
michael@0 | 63 | */ |
michael@0 | 64 | virtual UBool operator!=(const TimeZoneRule& that) const; |
michael@0 | 65 | |
michael@0 | 66 | /** |
michael@0 | 67 | * Fills in "name" with the name of this time zone. |
michael@0 | 68 | * @param name Receives the name of this time zone. |
michael@0 | 69 | * @return A reference to "name" |
michael@0 | 70 | * @stable ICU 3.8 |
michael@0 | 71 | */ |
michael@0 | 72 | UnicodeString& getName(UnicodeString& name) const; |
michael@0 | 73 | |
michael@0 | 74 | /** |
michael@0 | 75 | * Gets the standard time offset. |
michael@0 | 76 | * @return The standard time offset from UTC in milliseconds. |
michael@0 | 77 | * @stable ICU 3.8 |
michael@0 | 78 | */ |
michael@0 | 79 | int32_t getRawOffset(void) const; |
michael@0 | 80 | |
michael@0 | 81 | /** |
michael@0 | 82 | * Gets the amount of daylight saving delta time from the standard time. |
michael@0 | 83 | * @return The amount of daylight saving offset used by this rule |
michael@0 | 84 | * in milliseconds. |
michael@0 | 85 | * @stable ICU 3.8 |
michael@0 | 86 | */ |
michael@0 | 87 | int32_t getDSTSavings(void) const; |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Returns if this rule represents the same rule and offsets as another. |
michael@0 | 91 | * When two <code>TimeZoneRule</code> objects differ only its names, this method |
michael@0 | 92 | * returns true. |
michael@0 | 93 | * @param other The <code>TimeZoneRule</code> object to be compared with. |
michael@0 | 94 | * @return true if the other <code>TimeZoneRule</code> is the same as this one. |
michael@0 | 95 | * @stable ICU 3.8 |
michael@0 | 96 | */ |
michael@0 | 97 | virtual UBool isEquivalentTo(const TimeZoneRule& other) const; |
michael@0 | 98 | |
michael@0 | 99 | /** |
michael@0 | 100 | * Gets the very first time when this rule takes effect. |
michael@0 | 101 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 102 | * takes effect in milliseconds. |
michael@0 | 103 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 104 | * standard time. |
michael@0 | 105 | * @param result Receives the very first time when this rule takes effect. |
michael@0 | 106 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 107 | * "result" is unchanged. |
michael@0 | 108 | * @stable ICU 3.8 |
michael@0 | 109 | */ |
michael@0 | 110 | virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0; |
michael@0 | 111 | |
michael@0 | 112 | /** |
michael@0 | 113 | * Gets the final time when this rule takes effect. |
michael@0 | 114 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 115 | * takes effect in milliseconds. |
michael@0 | 116 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 117 | * standard time. |
michael@0 | 118 | * @param result Receives the final time when this rule takes effect. |
michael@0 | 119 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 120 | * "result" is unchanged. |
michael@0 | 121 | * @stable ICU 3.8 |
michael@0 | 122 | */ |
michael@0 | 123 | virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0; |
michael@0 | 124 | |
michael@0 | 125 | /** |
michael@0 | 126 | * Gets the first time when this rule takes effect after the specified time. |
michael@0 | 127 | * @param base The first start time after this base time will be returned. |
michael@0 | 128 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 129 | * takes effect in milliseconds. |
michael@0 | 130 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 131 | * standard time. |
michael@0 | 132 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 133 | * @param result Receives The first time when this rule takes effect after |
michael@0 | 134 | * the specified base time. |
michael@0 | 135 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 136 | * "result" is unchanged. |
michael@0 | 137 | * @stable ICU 3.8 |
michael@0 | 138 | */ |
michael@0 | 139 | virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 140 | UBool inclusive, UDate& result) const = 0; |
michael@0 | 141 | |
michael@0 | 142 | /** |
michael@0 | 143 | * Gets the most recent time when this rule takes effect before the specified time. |
michael@0 | 144 | * @param base The most recent time before this base time will be returned. |
michael@0 | 145 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 146 | * takes effect in milliseconds. |
michael@0 | 147 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 148 | * standard time. |
michael@0 | 149 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 150 | * @param result Receives The most recent time when this rule takes effect before |
michael@0 | 151 | * the specified base time. |
michael@0 | 152 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 153 | * "result" is unchanged. |
michael@0 | 154 | * @stable ICU 3.8 |
michael@0 | 155 | */ |
michael@0 | 156 | virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 157 | UBool inclusive, UDate& result) const = 0; |
michael@0 | 158 | |
michael@0 | 159 | protected: |
michael@0 | 160 | |
michael@0 | 161 | /** |
michael@0 | 162 | * Constructs a <code>TimeZoneRule</code> with the name, the GMT offset of its |
michael@0 | 163 | * standard time and the amount of daylight saving offset adjustment. |
michael@0 | 164 | * @param name The time zone name. |
michael@0 | 165 | * @param rawOffset The UTC offset of its standard time in milliseconds. |
michael@0 | 166 | * @param dstSavings The amount of daylight saving offset adjustment in milliseconds. |
michael@0 | 167 | * If this ia a rule for standard time, the value of this argument is 0. |
michael@0 | 168 | * @stable ICU 3.8 |
michael@0 | 169 | */ |
michael@0 | 170 | TimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings); |
michael@0 | 171 | |
michael@0 | 172 | /** |
michael@0 | 173 | * Copy constructor. |
michael@0 | 174 | * @param source The TimeZoneRule object to be copied. |
michael@0 | 175 | * @stable ICU 3.8 |
michael@0 | 176 | */ |
michael@0 | 177 | TimeZoneRule(const TimeZoneRule& source); |
michael@0 | 178 | |
michael@0 | 179 | /** |
michael@0 | 180 | * Assignment operator. |
michael@0 | 181 | * @param right The object to be copied. |
michael@0 | 182 | * @stable ICU 3.8 |
michael@0 | 183 | */ |
michael@0 | 184 | TimeZoneRule& operator=(const TimeZoneRule& right); |
michael@0 | 185 | |
michael@0 | 186 | private: |
michael@0 | 187 | UnicodeString fName; // time name |
michael@0 | 188 | int32_t fRawOffset; // UTC offset of the standard time in milliseconds |
michael@0 | 189 | int32_t fDSTSavings; // DST saving amount in milliseconds |
michael@0 | 190 | }; |
michael@0 | 191 | |
michael@0 | 192 | /** |
michael@0 | 193 | * <code>InitialTimeZoneRule</code> represents a time zone rule |
michael@0 | 194 | * representing a time zone effective from the beginning and |
michael@0 | 195 | * has no actual start times. |
michael@0 | 196 | * @stable ICU 3.8 |
michael@0 | 197 | */ |
michael@0 | 198 | class U_I18N_API InitialTimeZoneRule : public TimeZoneRule { |
michael@0 | 199 | public: |
michael@0 | 200 | /** |
michael@0 | 201 | * Constructs an <code>InitialTimeZoneRule</code> with the name, the GMT offset of its |
michael@0 | 202 | * standard time and the amount of daylight saving offset adjustment. |
michael@0 | 203 | * @param name The time zone name. |
michael@0 | 204 | * @param rawOffset The UTC offset of its standard time in milliseconds. |
michael@0 | 205 | * @param dstSavings The amount of daylight saving offset adjustment in milliseconds. |
michael@0 | 206 | * If this ia a rule for standard time, the value of this argument is 0. |
michael@0 | 207 | * @stable ICU 3.8 |
michael@0 | 208 | */ |
michael@0 | 209 | InitialTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings); |
michael@0 | 210 | |
michael@0 | 211 | /** |
michael@0 | 212 | * Copy constructor. |
michael@0 | 213 | * @param source The InitialTimeZoneRule object to be copied. |
michael@0 | 214 | * @stable ICU 3.8 |
michael@0 | 215 | */ |
michael@0 | 216 | InitialTimeZoneRule(const InitialTimeZoneRule& source); |
michael@0 | 217 | |
michael@0 | 218 | /** |
michael@0 | 219 | * Destructor. |
michael@0 | 220 | * @stable ICU 3.8 |
michael@0 | 221 | */ |
michael@0 | 222 | virtual ~InitialTimeZoneRule(); |
michael@0 | 223 | |
michael@0 | 224 | /** |
michael@0 | 225 | * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and |
michael@0 | 226 | * should delete it when done. |
michael@0 | 227 | * @return A copy of the object. |
michael@0 | 228 | * @stable ICU 3.8 |
michael@0 | 229 | */ |
michael@0 | 230 | virtual InitialTimeZoneRule* clone(void) const; |
michael@0 | 231 | |
michael@0 | 232 | /** |
michael@0 | 233 | * Assignment operator. |
michael@0 | 234 | * @param right The object to be copied. |
michael@0 | 235 | * @stable ICU 3.8 |
michael@0 | 236 | */ |
michael@0 | 237 | InitialTimeZoneRule& operator=(const InitialTimeZoneRule& right); |
michael@0 | 238 | |
michael@0 | 239 | /** |
michael@0 | 240 | * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects |
michael@0 | 241 | * of different subclasses are considered unequal. |
michael@0 | 242 | * @param that The object to be compared with. |
michael@0 | 243 | * @return true if the given <code>TimeZoneRule</code> objects are semantically equal. |
michael@0 | 244 | * @stable ICU 3.8 |
michael@0 | 245 | */ |
michael@0 | 246 | virtual UBool operator==(const TimeZoneRule& that) const; |
michael@0 | 247 | |
michael@0 | 248 | /** |
michael@0 | 249 | * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects |
michael@0 | 250 | * of different subclasses are considered unequal. |
michael@0 | 251 | * @param that The object to be compared with. |
michael@0 | 252 | * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal. |
michael@0 | 253 | * @stable ICU 3.8 |
michael@0 | 254 | */ |
michael@0 | 255 | virtual UBool operator!=(const TimeZoneRule& that) const; |
michael@0 | 256 | |
michael@0 | 257 | /** |
michael@0 | 258 | * Gets the time when this rule takes effect in the given year. |
michael@0 | 259 | * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc. |
michael@0 | 260 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 261 | * takes effect in milliseconds. |
michael@0 | 262 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 263 | * standard time. |
michael@0 | 264 | * @param result Receives the start time in the year. |
michael@0 | 265 | * @return true if this rule takes effect in the year and the result is set to |
michael@0 | 266 | * "result". |
michael@0 | 267 | * @stable ICU 3.8 |
michael@0 | 268 | */ |
michael@0 | 269 | UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 270 | |
michael@0 | 271 | /** |
michael@0 | 272 | * Returns if this rule represents the same rule and offsets as another. |
michael@0 | 273 | * When two <code>TimeZoneRule</code> objects differ only its names, this method |
michael@0 | 274 | * returns true. |
michael@0 | 275 | * @param that The <code>TimeZoneRule</code> object to be compared with. |
michael@0 | 276 | * @return true if the other <code>TimeZoneRule</code> is equivalent to this one. |
michael@0 | 277 | * @stable ICU 3.8 |
michael@0 | 278 | */ |
michael@0 | 279 | virtual UBool isEquivalentTo(const TimeZoneRule& that) const; |
michael@0 | 280 | |
michael@0 | 281 | /** |
michael@0 | 282 | * Gets the very first time when this rule takes effect. |
michael@0 | 283 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 284 | * takes effect in milliseconds. |
michael@0 | 285 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 286 | * standard time. |
michael@0 | 287 | * @param result Receives the very first time when this rule takes effect. |
michael@0 | 288 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 289 | * "result" is unchanged. |
michael@0 | 290 | * @stable ICU 3.8 |
michael@0 | 291 | */ |
michael@0 | 292 | virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 293 | |
michael@0 | 294 | /** |
michael@0 | 295 | * Gets the final time when this rule takes effect. |
michael@0 | 296 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 297 | * takes effect in milliseconds. |
michael@0 | 298 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 299 | * standard time. |
michael@0 | 300 | * @param result Receives the final time when this rule takes effect. |
michael@0 | 301 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 302 | * "result" is unchanged. |
michael@0 | 303 | * @stable ICU 3.8 |
michael@0 | 304 | */ |
michael@0 | 305 | virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 306 | |
michael@0 | 307 | /** |
michael@0 | 308 | * Gets the first time when this rule takes effect after the specified time. |
michael@0 | 309 | * @param base The first start time after this base time will be returned. |
michael@0 | 310 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 311 | * takes effect in milliseconds. |
michael@0 | 312 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 313 | * standard time. |
michael@0 | 314 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 315 | * @param result Receives The first time when this rule takes effect after |
michael@0 | 316 | * the specified base time. |
michael@0 | 317 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 318 | * "result" is unchanged. |
michael@0 | 319 | * @stable ICU 3.8 |
michael@0 | 320 | */ |
michael@0 | 321 | virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 322 | UBool inclusive, UDate& result) const; |
michael@0 | 323 | |
michael@0 | 324 | /** |
michael@0 | 325 | * Gets the most recent time when this rule takes effect before the specified time. |
michael@0 | 326 | * @param base The most recent time before this base time will be returned. |
michael@0 | 327 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 328 | * takes effect in milliseconds. |
michael@0 | 329 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 330 | * standard time. |
michael@0 | 331 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 332 | * @param result Receives The most recent time when this rule takes effect before |
michael@0 | 333 | * the specified base time. |
michael@0 | 334 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 335 | * "result" is unchanged. |
michael@0 | 336 | * @stable ICU 3.8 |
michael@0 | 337 | */ |
michael@0 | 338 | virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 339 | UBool inclusive, UDate& result) const; |
michael@0 | 340 | |
michael@0 | 341 | public: |
michael@0 | 342 | /** |
michael@0 | 343 | * Return the class ID for this class. This is useful only for comparing to |
michael@0 | 344 | * a return value from getDynamicClassID(). For example: |
michael@0 | 345 | * <pre> |
michael@0 | 346 | * . Base* polymorphic_pointer = createPolymorphicObject(); |
michael@0 | 347 | * . if (polymorphic_pointer->getDynamicClassID() == |
michael@0 | 348 | * . erived::getStaticClassID()) ... |
michael@0 | 349 | * </pre> |
michael@0 | 350 | * @return The class ID for all objects of this class. |
michael@0 | 351 | * @stable ICU 3.8 |
michael@0 | 352 | */ |
michael@0 | 353 | static UClassID U_EXPORT2 getStaticClassID(void); |
michael@0 | 354 | |
michael@0 | 355 | /** |
michael@0 | 356 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This |
michael@0 | 357 | * method is to implement a simple version of RTTI, since not all C++ |
michael@0 | 358 | * compilers support genuine RTTI. Polymorphic operator==() and clone() |
michael@0 | 359 | * methods call this method. |
michael@0 | 360 | * |
michael@0 | 361 | * @return The class ID for this object. All objects of a |
michael@0 | 362 | * given class have the same class ID. Objects of |
michael@0 | 363 | * other classes have different class IDs. |
michael@0 | 364 | * @stable ICU 3.8 |
michael@0 | 365 | */ |
michael@0 | 366 | virtual UClassID getDynamicClassID(void) const; |
michael@0 | 367 | }; |
michael@0 | 368 | |
michael@0 | 369 | /** |
michael@0 | 370 | * <code>AnnualTimeZoneRule</code> is a class used for representing a time zone |
michael@0 | 371 | * rule which takes effect annually. The calenday system used for the rule is |
michael@0 | 372 | * is based on Gregorian calendar |
michael@0 | 373 | * |
michael@0 | 374 | * @stable ICU 3.8 |
michael@0 | 375 | */ |
michael@0 | 376 | class U_I18N_API AnnualTimeZoneRule : public TimeZoneRule { |
michael@0 | 377 | public: |
michael@0 | 378 | /** |
michael@0 | 379 | * The constant representing the maximum year used for designating |
michael@0 | 380 | * a rule is permanent. |
michael@0 | 381 | */ |
michael@0 | 382 | static const int32_t MAX_YEAR; |
michael@0 | 383 | |
michael@0 | 384 | /** |
michael@0 | 385 | * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its |
michael@0 | 386 | * standard time, the amount of daylight saving offset adjustment, the annual start |
michael@0 | 387 | * time rule and the start/until years. The input DateTimeRule is copied by this |
michael@0 | 388 | * constructor, so the caller remains responsible for deleting the object. |
michael@0 | 389 | * @param name The time zone name. |
michael@0 | 390 | * @param rawOffset The GMT offset of its standard time in milliseconds. |
michael@0 | 391 | * @param dstSavings The amount of daylight saving offset adjustment in |
michael@0 | 392 | * milliseconds. If this ia a rule for standard time, |
michael@0 | 393 | * the value of this argument is 0. |
michael@0 | 394 | * @param dateTimeRule The start date/time rule repeated annually. |
michael@0 | 395 | * @param startYear The first year when this rule takes effect. |
michael@0 | 396 | * @param endYear The last year when this rule takes effect. If this |
michael@0 | 397 | * rule is effective forever in future, specify MAX_YEAR. |
michael@0 | 398 | * @stable ICU 3.8 |
michael@0 | 399 | */ |
michael@0 | 400 | AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings, |
michael@0 | 401 | const DateTimeRule& dateTimeRule, int32_t startYear, int32_t endYear); |
michael@0 | 402 | |
michael@0 | 403 | /** |
michael@0 | 404 | * Constructs a <code>AnnualTimeZoneRule</code> with the name, the GMT offset of its |
michael@0 | 405 | * standard time, the amount of daylight saving offset adjustment, the annual start |
michael@0 | 406 | * time rule and the start/until years. The input DateTimeRule object is adopted |
michael@0 | 407 | * by this object, therefore, the caller must not delete the object. |
michael@0 | 408 | * @param name The time zone name. |
michael@0 | 409 | * @param rawOffset The GMT offset of its standard time in milliseconds. |
michael@0 | 410 | * @param dstSavings The amount of daylight saving offset adjustment in |
michael@0 | 411 | * milliseconds. If this ia a rule for standard time, |
michael@0 | 412 | * the value of this argument is 0. |
michael@0 | 413 | * @param dateTimeRule The start date/time rule repeated annually. |
michael@0 | 414 | * @param startYear The first year when this rule takes effect. |
michael@0 | 415 | * @param endYear The last year when this rule takes effect. If this |
michael@0 | 416 | * rule is effective forever in future, specify MAX_YEAR. |
michael@0 | 417 | * @stable ICU 3.8 |
michael@0 | 418 | */ |
michael@0 | 419 | AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings, |
michael@0 | 420 | DateTimeRule* dateTimeRule, int32_t startYear, int32_t endYear); |
michael@0 | 421 | |
michael@0 | 422 | /** |
michael@0 | 423 | * Copy constructor. |
michael@0 | 424 | * @param source The AnnualTimeZoneRule object to be copied. |
michael@0 | 425 | * @stable ICU 3.8 |
michael@0 | 426 | */ |
michael@0 | 427 | AnnualTimeZoneRule(const AnnualTimeZoneRule& source); |
michael@0 | 428 | |
michael@0 | 429 | /** |
michael@0 | 430 | * Destructor. |
michael@0 | 431 | * @stable ICU 3.8 |
michael@0 | 432 | */ |
michael@0 | 433 | virtual ~AnnualTimeZoneRule(); |
michael@0 | 434 | |
michael@0 | 435 | /** |
michael@0 | 436 | * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and |
michael@0 | 437 | * should delete it when done. |
michael@0 | 438 | * @return A copy of the object. |
michael@0 | 439 | * @stable ICU 3.8 |
michael@0 | 440 | */ |
michael@0 | 441 | virtual AnnualTimeZoneRule* clone(void) const; |
michael@0 | 442 | |
michael@0 | 443 | /** |
michael@0 | 444 | * Assignment operator. |
michael@0 | 445 | * @param right The object to be copied. |
michael@0 | 446 | * @stable ICU 3.8 |
michael@0 | 447 | */ |
michael@0 | 448 | AnnualTimeZoneRule& operator=(const AnnualTimeZoneRule& right); |
michael@0 | 449 | |
michael@0 | 450 | /** |
michael@0 | 451 | * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects |
michael@0 | 452 | * of different subclasses are considered unequal. |
michael@0 | 453 | * @param that The object to be compared with. |
michael@0 | 454 | * @return true if the given <code>TimeZoneRule</code> objects are semantically equal. |
michael@0 | 455 | * @stable ICU 3.8 |
michael@0 | 456 | */ |
michael@0 | 457 | virtual UBool operator==(const TimeZoneRule& that) const; |
michael@0 | 458 | |
michael@0 | 459 | /** |
michael@0 | 460 | * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects |
michael@0 | 461 | * of different subclasses are considered unequal. |
michael@0 | 462 | * @param that The object to be compared with. |
michael@0 | 463 | * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal. |
michael@0 | 464 | * @stable ICU 3.8 |
michael@0 | 465 | */ |
michael@0 | 466 | virtual UBool operator!=(const TimeZoneRule& that) const; |
michael@0 | 467 | |
michael@0 | 468 | /** |
michael@0 | 469 | * Gets the start date/time rule used by this rule. |
michael@0 | 470 | * @return The <code>AnnualDateTimeRule</code> which represents the start date/time |
michael@0 | 471 | * rule used by this time zone rule. |
michael@0 | 472 | * @stable ICU 3.8 |
michael@0 | 473 | */ |
michael@0 | 474 | const DateTimeRule* getRule(void) const; |
michael@0 | 475 | |
michael@0 | 476 | /** |
michael@0 | 477 | * Gets the first year when this rule takes effect. |
michael@0 | 478 | * @return The start year of this rule. The year is in Gregorian calendar |
michael@0 | 479 | * with 0 == 1 BCE, -1 == 2 BCE, etc. |
michael@0 | 480 | * @stable ICU 3.8 |
michael@0 | 481 | */ |
michael@0 | 482 | int32_t getStartYear(void) const; |
michael@0 | 483 | |
michael@0 | 484 | /** |
michael@0 | 485 | * Gets the end year when this rule takes effect. |
michael@0 | 486 | * @return The end year of this rule (inclusive). The year is in Gregorian calendar |
michael@0 | 487 | * with 0 == 1 BCE, -1 == 2 BCE, etc. |
michael@0 | 488 | * @stable ICU 3.8 |
michael@0 | 489 | */ |
michael@0 | 490 | int32_t getEndYear(void) const; |
michael@0 | 491 | |
michael@0 | 492 | /** |
michael@0 | 493 | * Gets the time when this rule takes effect in the given year. |
michael@0 | 494 | * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc. |
michael@0 | 495 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 496 | * takes effect in milliseconds. |
michael@0 | 497 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 498 | * standard time. |
michael@0 | 499 | * @param result Receives the start time in the year. |
michael@0 | 500 | * @return true if this rule takes effect in the year and the result is set to |
michael@0 | 501 | * "result". |
michael@0 | 502 | * @stable ICU 3.8 |
michael@0 | 503 | */ |
michael@0 | 504 | UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 505 | |
michael@0 | 506 | /** |
michael@0 | 507 | * Returns if this rule represents the same rule and offsets as another. |
michael@0 | 508 | * When two <code>TimeZoneRule</code> objects differ only its names, this method |
michael@0 | 509 | * returns true. |
michael@0 | 510 | * @param that The <code>TimeZoneRule</code> object to be compared with. |
michael@0 | 511 | * @return true if the other <code>TimeZoneRule</code> is equivalent to this one. |
michael@0 | 512 | * @stable ICU 3.8 |
michael@0 | 513 | */ |
michael@0 | 514 | virtual UBool isEquivalentTo(const TimeZoneRule& that) const; |
michael@0 | 515 | |
michael@0 | 516 | /** |
michael@0 | 517 | * Gets the very first time when this rule takes effect. |
michael@0 | 518 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 519 | * takes effect in milliseconds. |
michael@0 | 520 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 521 | * standard time. |
michael@0 | 522 | * @param result Receives the very first time when this rule takes effect. |
michael@0 | 523 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 524 | * "result" is unchanged. |
michael@0 | 525 | * @stable ICU 3.8 |
michael@0 | 526 | */ |
michael@0 | 527 | virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 528 | |
michael@0 | 529 | /** |
michael@0 | 530 | * Gets the final time when this rule takes effect. |
michael@0 | 531 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 532 | * takes effect in milliseconds. |
michael@0 | 533 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 534 | * standard time. |
michael@0 | 535 | * @param result Receives the final time when this rule takes effect. |
michael@0 | 536 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 537 | * "result" is unchanged. |
michael@0 | 538 | * @stable ICU 3.8 |
michael@0 | 539 | */ |
michael@0 | 540 | virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 541 | |
michael@0 | 542 | /** |
michael@0 | 543 | * Gets the first time when this rule takes effect after the specified time. |
michael@0 | 544 | * @param base The first start time after this base time will be returned. |
michael@0 | 545 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 546 | * takes effect in milliseconds. |
michael@0 | 547 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 548 | * standard time. |
michael@0 | 549 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 550 | * @param result Receives The first time when this rule takes effect after |
michael@0 | 551 | * the specified base time. |
michael@0 | 552 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 553 | * "result" is unchanged. |
michael@0 | 554 | * @stable ICU 3.8 |
michael@0 | 555 | */ |
michael@0 | 556 | virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 557 | UBool inclusive, UDate& result) const; |
michael@0 | 558 | |
michael@0 | 559 | /** |
michael@0 | 560 | * Gets the most recent time when this rule takes effect before the specified time. |
michael@0 | 561 | * @param base The most recent time before this base time will be returned. |
michael@0 | 562 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 563 | * takes effect in milliseconds. |
michael@0 | 564 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 565 | * standard time. |
michael@0 | 566 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 567 | * @param result Receives The most recent time when this rule takes effect before |
michael@0 | 568 | * the specified base time. |
michael@0 | 569 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 570 | * "result" is unchanged. |
michael@0 | 571 | * @stable ICU 3.8 |
michael@0 | 572 | */ |
michael@0 | 573 | virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 574 | UBool inclusive, UDate& result) const; |
michael@0 | 575 | |
michael@0 | 576 | |
michael@0 | 577 | private: |
michael@0 | 578 | DateTimeRule* fDateTimeRule; |
michael@0 | 579 | int32_t fStartYear; |
michael@0 | 580 | int32_t fEndYear; |
michael@0 | 581 | |
michael@0 | 582 | public: |
michael@0 | 583 | /** |
michael@0 | 584 | * Return the class ID for this class. This is useful only for comparing to |
michael@0 | 585 | * a return value from getDynamicClassID(). For example: |
michael@0 | 586 | * <pre> |
michael@0 | 587 | * . Base* polymorphic_pointer = createPolymorphicObject(); |
michael@0 | 588 | * . if (polymorphic_pointer->getDynamicClassID() == |
michael@0 | 589 | * . erived::getStaticClassID()) ... |
michael@0 | 590 | * </pre> |
michael@0 | 591 | * @return The class ID for all objects of this class. |
michael@0 | 592 | * @stable ICU 3.8 |
michael@0 | 593 | */ |
michael@0 | 594 | static UClassID U_EXPORT2 getStaticClassID(void); |
michael@0 | 595 | |
michael@0 | 596 | /** |
michael@0 | 597 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This |
michael@0 | 598 | * method is to implement a simple version of RTTI, since not all C++ |
michael@0 | 599 | * compilers support genuine RTTI. Polymorphic operator==() and clone() |
michael@0 | 600 | * methods call this method. |
michael@0 | 601 | * |
michael@0 | 602 | * @return The class ID for this object. All objects of a |
michael@0 | 603 | * given class have the same class ID. Objects of |
michael@0 | 604 | * other classes have different class IDs. |
michael@0 | 605 | * @stable ICU 3.8 |
michael@0 | 606 | */ |
michael@0 | 607 | virtual UClassID getDynamicClassID(void) const; |
michael@0 | 608 | }; |
michael@0 | 609 | |
michael@0 | 610 | /** |
michael@0 | 611 | * <code>TimeArrayTimeZoneRule</code> represents a time zone rule whose start times are |
michael@0 | 612 | * defined by an array of milliseconds since the standard base time. |
michael@0 | 613 | * |
michael@0 | 614 | * @stable ICU 3.8 |
michael@0 | 615 | */ |
michael@0 | 616 | class U_I18N_API TimeArrayTimeZoneRule : public TimeZoneRule { |
michael@0 | 617 | public: |
michael@0 | 618 | /** |
michael@0 | 619 | * Constructs a <code>TimeArrayTimeZoneRule</code> with the name, the GMT offset of its |
michael@0 | 620 | * standard time, the amount of daylight saving offset adjustment and |
michael@0 | 621 | * the array of times when this rule takes effect. |
michael@0 | 622 | * @param name The time zone name. |
michael@0 | 623 | * @param rawOffset The UTC offset of its standard time in milliseconds. |
michael@0 | 624 | * @param dstSavings The amount of daylight saving offset adjustment in |
michael@0 | 625 | * milliseconds. If this ia a rule for standard time, |
michael@0 | 626 | * the value of this argument is 0. |
michael@0 | 627 | * @param startTimes The array start times in milliseconds since the base time |
michael@0 | 628 | * (January 1, 1970, 00:00:00). |
michael@0 | 629 | * @param numStartTimes The number of elements in the parameter "startTimes" |
michael@0 | 630 | * @param timeRuleType The time type of the start times, which is one of |
michael@0 | 631 | * <code>DataTimeRule::WALL_TIME</code>, <code>STANDARD_TIME</code> |
michael@0 | 632 | * and <code>UTC_TIME</code>. |
michael@0 | 633 | * @stable ICU 3.8 |
michael@0 | 634 | */ |
michael@0 | 635 | TimeArrayTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings, |
michael@0 | 636 | const UDate* startTimes, int32_t numStartTimes, DateTimeRule::TimeRuleType timeRuleType); |
michael@0 | 637 | |
michael@0 | 638 | /** |
michael@0 | 639 | * Copy constructor. |
michael@0 | 640 | * @param source The TimeArrayTimeZoneRule object to be copied. |
michael@0 | 641 | * @stable ICU 3.8 |
michael@0 | 642 | */ |
michael@0 | 643 | TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source); |
michael@0 | 644 | |
michael@0 | 645 | /** |
michael@0 | 646 | * Destructor. |
michael@0 | 647 | * @stable ICU 3.8 |
michael@0 | 648 | */ |
michael@0 | 649 | virtual ~TimeArrayTimeZoneRule(); |
michael@0 | 650 | |
michael@0 | 651 | /** |
michael@0 | 652 | * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and |
michael@0 | 653 | * should delete it when done. |
michael@0 | 654 | * @return A copy of the object. |
michael@0 | 655 | * @stable ICU 3.8 |
michael@0 | 656 | */ |
michael@0 | 657 | virtual TimeArrayTimeZoneRule* clone(void) const; |
michael@0 | 658 | |
michael@0 | 659 | /** |
michael@0 | 660 | * Assignment operator. |
michael@0 | 661 | * @param right The object to be copied. |
michael@0 | 662 | * @stable ICU 3.8 |
michael@0 | 663 | */ |
michael@0 | 664 | TimeArrayTimeZoneRule& operator=(const TimeArrayTimeZoneRule& right); |
michael@0 | 665 | |
michael@0 | 666 | /** |
michael@0 | 667 | * Return true if the given <code>TimeZoneRule</code> objects are semantically equal. Objects |
michael@0 | 668 | * of different subclasses are considered unequal. |
michael@0 | 669 | * @param that The object to be compared with. |
michael@0 | 670 | * @return true if the given <code>TimeZoneRule</code> objects are semantically equal. |
michael@0 | 671 | * @stable ICU 3.8 |
michael@0 | 672 | */ |
michael@0 | 673 | virtual UBool operator==(const TimeZoneRule& that) const; |
michael@0 | 674 | |
michael@0 | 675 | /** |
michael@0 | 676 | * Return true if the given <code>TimeZoneRule</code> objects are semantically unequal. Objects |
michael@0 | 677 | * of different subclasses are considered unequal. |
michael@0 | 678 | * @param that The object to be compared with. |
michael@0 | 679 | * @return true if the given <code>TimeZoneRule</code> objects are semantically unequal. |
michael@0 | 680 | * @stable ICU 3.8 |
michael@0 | 681 | */ |
michael@0 | 682 | virtual UBool operator!=(const TimeZoneRule& that) const; |
michael@0 | 683 | |
michael@0 | 684 | /** |
michael@0 | 685 | * Gets the time type of the start times used by this rule. The return value |
michael@0 | 686 | * is either <code>DateTimeRule::WALL_TIME</code> or <code>STANDARD_TIME</code> |
michael@0 | 687 | * or <code>UTC_TIME</code>. |
michael@0 | 688 | * |
michael@0 | 689 | * @return The time type used of the start times used by this rule. |
michael@0 | 690 | * @stable ICU 3.8 |
michael@0 | 691 | */ |
michael@0 | 692 | DateTimeRule::TimeRuleType getTimeType(void) const; |
michael@0 | 693 | |
michael@0 | 694 | /** |
michael@0 | 695 | * Gets a start time at the index stored in this rule. |
michael@0 | 696 | * @param index The index of start times |
michael@0 | 697 | * @param result Receives the start time at the index |
michael@0 | 698 | * @return true if the index is within the valid range and |
michael@0 | 699 | * and the result is set. When false, the output |
michael@0 | 700 | * parameger "result" is unchanged. |
michael@0 | 701 | * @stable ICU 3.8 |
michael@0 | 702 | */ |
michael@0 | 703 | UBool getStartTimeAt(int32_t index, UDate& result) const; |
michael@0 | 704 | |
michael@0 | 705 | /** |
michael@0 | 706 | * Returns the number of start times stored in this rule |
michael@0 | 707 | * @return The number of start times. |
michael@0 | 708 | * @stable ICU 3.8 |
michael@0 | 709 | */ |
michael@0 | 710 | int32_t countStartTimes(void) const; |
michael@0 | 711 | |
michael@0 | 712 | /** |
michael@0 | 713 | * Returns if this rule represents the same rule and offsets as another. |
michael@0 | 714 | * When two <code>TimeZoneRule</code> objects differ only its names, this method |
michael@0 | 715 | * returns true. |
michael@0 | 716 | * @param that The <code>TimeZoneRule</code> object to be compared with. |
michael@0 | 717 | * @return true if the other <code>TimeZoneRule</code> is equivalent to this one. |
michael@0 | 718 | * @stable ICU 3.8 |
michael@0 | 719 | */ |
michael@0 | 720 | virtual UBool isEquivalentTo(const TimeZoneRule& that) const; |
michael@0 | 721 | |
michael@0 | 722 | /** |
michael@0 | 723 | * Gets the very first time when this rule takes effect. |
michael@0 | 724 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 725 | * takes effect in milliseconds. |
michael@0 | 726 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 727 | * standard time. |
michael@0 | 728 | * @param result Receives the very first time when this rule takes effect. |
michael@0 | 729 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 730 | * "result" is unchanged. |
michael@0 | 731 | * @stable ICU 3.8 |
michael@0 | 732 | */ |
michael@0 | 733 | virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 734 | |
michael@0 | 735 | /** |
michael@0 | 736 | * Gets the final time when this rule takes effect. |
michael@0 | 737 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 738 | * takes effect in milliseconds. |
michael@0 | 739 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 740 | * standard time. |
michael@0 | 741 | * @param result Receives the final time when this rule takes effect. |
michael@0 | 742 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 743 | * "result" is unchanged. |
michael@0 | 744 | * @stable ICU 3.8 |
michael@0 | 745 | */ |
michael@0 | 746 | virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; |
michael@0 | 747 | |
michael@0 | 748 | /** |
michael@0 | 749 | * Gets the first time when this rule takes effect after the specified time. |
michael@0 | 750 | * @param base The first start time after this base time will be returned. |
michael@0 | 751 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 752 | * takes effect in milliseconds. |
michael@0 | 753 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 754 | * standard time. |
michael@0 | 755 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 756 | * @param result Receives The first time when this rule takes effect after |
michael@0 | 757 | * the specified base time. |
michael@0 | 758 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 759 | * "result" is unchanged. |
michael@0 | 760 | * @stable ICU 3.8 |
michael@0 | 761 | */ |
michael@0 | 762 | virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 763 | UBool inclusive, UDate& result) const; |
michael@0 | 764 | |
michael@0 | 765 | /** |
michael@0 | 766 | * Gets the most recent time when this rule takes effect before the specified time. |
michael@0 | 767 | * @param base The most recent time before this base time will be returned. |
michael@0 | 768 | * @param prevRawOffset The standard time offset from UTC before this rule |
michael@0 | 769 | * takes effect in milliseconds. |
michael@0 | 770 | * @param prevDSTSavings The amount of daylight saving offset from the |
michael@0 | 771 | * standard time. |
michael@0 | 772 | * @param inclusive Whether the base time is inclusive or not. |
michael@0 | 773 | * @param result Receives The most recent time when this rule takes effect before |
michael@0 | 774 | * the specified base time. |
michael@0 | 775 | * @return true if the start time is available. When false is returned, output parameter |
michael@0 | 776 | * "result" is unchanged. |
michael@0 | 777 | * @stable ICU 3.8 |
michael@0 | 778 | */ |
michael@0 | 779 | virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, |
michael@0 | 780 | UBool inclusive, UDate& result) const; |
michael@0 | 781 | |
michael@0 | 782 | |
michael@0 | 783 | private: |
michael@0 | 784 | enum { TIMEARRAY_STACK_BUFFER_SIZE = 32 }; |
michael@0 | 785 | UBool initStartTimes(const UDate source[], int32_t size, UErrorCode& ec); |
michael@0 | 786 | UDate getUTC(UDate time, int32_t raw, int32_t dst) const; |
michael@0 | 787 | |
michael@0 | 788 | DateTimeRule::TimeRuleType fTimeRuleType; |
michael@0 | 789 | int32_t fNumStartTimes; |
michael@0 | 790 | UDate* fStartTimes; |
michael@0 | 791 | UDate fLocalStartTimes[TIMEARRAY_STACK_BUFFER_SIZE]; |
michael@0 | 792 | |
michael@0 | 793 | public: |
michael@0 | 794 | /** |
michael@0 | 795 | * Return the class ID for this class. This is useful only for comparing to |
michael@0 | 796 | * a return value from getDynamicClassID(). For example: |
michael@0 | 797 | * <pre> |
michael@0 | 798 | * . Base* polymorphic_pointer = createPolymorphicObject(); |
michael@0 | 799 | * . if (polymorphic_pointer->getDynamicClassID() == |
michael@0 | 800 | * . erived::getStaticClassID()) ... |
michael@0 | 801 | * </pre> |
michael@0 | 802 | * @return The class ID for all objects of this class. |
michael@0 | 803 | * @stable ICU 3.8 |
michael@0 | 804 | */ |
michael@0 | 805 | static UClassID U_EXPORT2 getStaticClassID(void); |
michael@0 | 806 | |
michael@0 | 807 | /** |
michael@0 | 808 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This |
michael@0 | 809 | * method is to implement a simple version of RTTI, since not all C++ |
michael@0 | 810 | * compilers support genuine RTTI. Polymorphic operator==() and clone() |
michael@0 | 811 | * methods call this method. |
michael@0 | 812 | * |
michael@0 | 813 | * @return The class ID for this object. All objects of a |
michael@0 | 814 | * given class have the same class ID. Objects of |
michael@0 | 815 | * other classes have different class IDs. |
michael@0 | 816 | * @stable ICU 3.8 |
michael@0 | 817 | */ |
michael@0 | 818 | virtual UClassID getDynamicClassID(void) const; |
michael@0 | 819 | }; |
michael@0 | 820 | |
michael@0 | 821 | |
michael@0 | 822 | U_NAMESPACE_END |
michael@0 | 823 | |
michael@0 | 824 | #endif /* #if !UCONFIG_NO_FORMATTING */ |
michael@0 | 825 | |
michael@0 | 826 | #endif // TZRULE_H |
michael@0 | 827 | |
michael@0 | 828 | //eof |