From c9f5e38fb9c0e8a46ac1b555a1beaaf7b40733da Mon Sep 17 00:00:00 2001 From: Claire Ho Date: Wed, 8 Aug 2007 01:07:23 +0000 Subject: [PATCH] ICU-5787 Added operator!= . X-SVN-Rev: 22313 --- icu4c/source/i18n/dtptngen.cpp | 5 +++++ icu4c/source/i18n/unicode/dtptngen.h | 9 +++++++++ icu4c/source/test/intltest/dtptngts.cpp | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/icu4c/source/i18n/dtptngen.cpp b/icu4c/source/i18n/dtptngen.cpp index 5a17ef9be6d..058f9af1df2 100644 --- a/icu4c/source/i18n/dtptngen.cpp +++ b/icu4c/source/i18n/dtptngen.cpp @@ -219,6 +219,11 @@ DateTimePatternGenerator::operator==(const DateTimePatternGenerator& other) cons } } +UBool +DateTimePatternGenerator::operator!=(const DateTimePatternGenerator& other) const { + return !operator==(other); +} + DateTimePatternGenerator::~DateTimePatternGenerator() { if (fAvailableFormatKeyHash!=NULL) { delete fAvailableFormatKeyHash; diff --git a/icu4c/source/i18n/unicode/dtptngen.h b/icu4c/source/i18n/unicode/dtptngen.h index 346057af693..3ae82faa907 100644 --- a/icu4c/source/i18n/unicode/dtptngen.h +++ b/icu4c/source/i18n/unicode/dtptngen.h @@ -86,6 +86,15 @@ public: * @draft ICU 3.8 */ UBool operator==(const DateTimePatternGenerator& other) const; + + /** + * Return true if another object is semantically unequal to this one. + * + * @param other the DateTimePatternGenerator object to be compared with. + * @return true if other is semantically unequal to this. + * @draft ICU 3.8 + */ + UBool operator!=(const DateTimePatternGenerator& other) const; /** * Utility to return a unique skeleton from a given pattern. For example, diff --git a/icu4c/source/test/intltest/dtptngts.cpp b/icu4c/source/test/intltest/dtptngts.cpp index bc21fa6e855..ac8abc29206 100644 --- a/icu4c/source/test/intltest/dtptngts.cpp +++ b/icu4c/source/test/intltest/dtptngts.cpp @@ -162,11 +162,11 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/) if ( !(*cloneDTPatternGen == *instFromLocale) ) { errln("ERROR: inconsistency is found in cloned object."); } - /* + if ( *cloneDTPatternGen != *instFromLocale ) { errln("ERROR: inconsistency is found in cloned object."); } - */ + delete instFromLocale; delete cloneDTPatternGen;