]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/tzrule.cpp
ICU-62141.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / tzrule.cpp
index 1326149053eb8b69bb0563c13ddb47accdd72c25..f4ede7cefc7f2241d1408c52b7dee68a132f1cd3 100644 (file)
@@ -1,10 +1,14 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
 *******************************************************************************
-* Copyright (C) 2007, International Business Machines Corporation and         *
-* others. All Rights Reserved.                                                *
+* Copyright (C) 2007-2012, International Business Machines Corporation and
+* others. All Rights Reserved.
 *******************************************************************************
 */
 
+#include "utypeinfo.h"  // for 'typeid' to work
+
 #include "unicode/utypes.h"
 
 #if !UCONFIG_NO_FORMATTING
@@ -52,7 +56,7 @@ TimeZoneRule::operator=(const TimeZoneRule& right) {
 UBool
 TimeZoneRule::operator==(const TimeZoneRule& that) const {
     return ((this == &that) ||
-            (getDynamicClassID() == that.getDynamicClassID() &&
+            (typeid(*this) == typeid(that) &&
             fName == that.fName &&
             fRawOffset == that.fRawOffset &&
             fDSTSavings == that.fDSTSavings));
@@ -82,7 +86,7 @@ TimeZoneRule::getDSTSavings(void) const {
 UBool
 TimeZoneRule::isEquivalentTo(const TimeZoneRule& other) const {
     return ((this == &other) ||
-            (getDynamicClassID() == other.getDynamicClassID() &&
+            (typeid(*this) == typeid(other) &&
             fRawOffset == other.fRawOffset &&
             fDSTSavings == other.fDSTSavings));
 }
@@ -119,7 +123,7 @@ InitialTimeZoneRule::operator=(const InitialTimeZoneRule& right) {
 UBool
 InitialTimeZoneRule::operator==(const TimeZoneRule& that) const {
     return ((this == &that) ||
-            (getDynamicClassID() == that.getDynamicClassID() &&
+            (typeid(*this) == typeid(that) &&
             TimeZoneRule::operator==(that)));
 }
 
@@ -133,8 +137,7 @@ InitialTimeZoneRule::isEquivalentTo(const TimeZoneRule& other) const {
     if (this == &other) {
         return TRUE;
     }
-    if (getDynamicClassID() != other.getDynamicClassID() ||
-        TimeZoneRule::isEquivalentTo(other) == FALSE) {
+    if (typeid(*this) != typeid(other) || TimeZoneRule::isEquivalentTo(other) == FALSE) {
         return FALSE;
     }
     return TRUE;
@@ -155,7 +158,7 @@ InitialTimeZoneRule::getFinalStart(int32_t /*prevRawOffset*/,
 }
 
 UBool
-InitialTimeZoneRule::getNextStart(const UDate /*base*/,
+InitialTimeZoneRule::getNextStart(UDate /*base*/,
                                  int32_t /*prevRawOffset*/,
                                  int32_t /*prevDSTSavings*/,
                                  UBool /*inclusive*/,
@@ -164,7 +167,7 @@ InitialTimeZoneRule::getNextStart(const UDate /*base*/,
 }
 
 UBool
-InitialTimeZoneRule::getPreviousStart(const UDate /*base*/,
+InitialTimeZoneRule::getPreviousStart(UDate /*base*/,
                                      int32_t /*prevRawOffset*/,
                                      int32_t /*prevDSTSavings*/,
                                      UBool /*inclusive*/,
@@ -228,7 +231,7 @@ AnnualTimeZoneRule::operator==(const TimeZoneRule& that) const {
     if (this == &that) {
         return TRUE;
     }
-    if (getDynamicClassID() != that.getDynamicClassID()) {
+    if (typeid(*this) != typeid(that)) {
         return FALSE;
     }
     AnnualTimeZoneRule *atzr = (AnnualTimeZoneRule*)&that;
@@ -320,8 +323,7 @@ AnnualTimeZoneRule::isEquivalentTo(const TimeZoneRule& other) const {
     if (this == &other) {
         return TRUE;
     }
-    if (getDynamicClassID() != other.getDynamicClassID() ||
-        TimeZoneRule::isEquivalentTo(other) == FALSE) {
+    if (typeid(*this) != typeid(other) || TimeZoneRule::isEquivalentTo(other) == FALSE) {
         return FALSE;
     }
     AnnualTimeZoneRule* that = (AnnualTimeZoneRule*)&other;
@@ -348,7 +350,7 @@ AnnualTimeZoneRule::getFinalStart(int32_t prevRawOffset,
 }
 
 UBool
-AnnualTimeZoneRule::getNextStart(const UDate base,
+AnnualTimeZoneRule::getNextStart(UDate base,
                                  int32_t prevRawOffset,
                                  int32_t prevDSTSavings,
                                  UBool inclusive,
@@ -372,7 +374,7 @@ AnnualTimeZoneRule::getNextStart(const UDate base,
 }
 
 UBool
-AnnualTimeZoneRule::getPreviousStart(const UDate base,
+AnnualTimeZoneRule::getPreviousStart(UDate base,
                                      int32_t prevRawOffset,
                                      int32_t prevDSTSavings,
                                      UBool inclusive,
@@ -448,8 +450,7 @@ TimeArrayTimeZoneRule::operator==(const TimeZoneRule& that) const {
     if (this == &that) {
         return TRUE;
     }
-    if (getDynamicClassID() != that.getDynamicClassID()
-        || TimeZoneRule::operator==(that) == FALSE) {
+    if (typeid(*this) != typeid(that) || TimeZoneRule::operator==(that) == FALSE) {
         return FALSE;
     }
     TimeArrayTimeZoneRule *tatzr = (TimeArrayTimeZoneRule*)&that;
@@ -497,8 +498,7 @@ TimeArrayTimeZoneRule::isEquivalentTo(const TimeZoneRule& other) const {
     if (this == &other) {
         return TRUE;
     }
-    if (getDynamicClassID() != other.getDynamicClassID()
-        || TimeZoneRule::isEquivalentTo(other) == FALSE) {
+    if (typeid(*this) != typeid(other) || TimeZoneRule::isEquivalentTo(other) == FALSE) {
         return FALSE;
     }
     TimeArrayTimeZoneRule* that = (TimeArrayTimeZoneRule*)&other;
@@ -540,7 +540,7 @@ TimeArrayTimeZoneRule::getFinalStart(int32_t prevRawOffset,
 }
 
 UBool
-TimeArrayTimeZoneRule::getNextStart(const UDate base,
+TimeArrayTimeZoneRule::getNextStart(UDate base,
                                     int32_t prevRawOffset,
                                     int32_t prevDSTSavings,
                                     UBool inclusive,
@@ -560,7 +560,7 @@ TimeArrayTimeZoneRule::getNextStart(const UDate base,
 }
 
 UBool
-TimeArrayTimeZoneRule::getPreviousStart(const UDate base,
+TimeArrayTimeZoneRule::getPreviousStart(UDate base,
                                         int32_t prevRawOffset,
                                         int32_t prevDSTSavings,
                                         UBool inclusive,