ICU-3399 move operator== class check into Format
X-SVN-Rev: 14507
This commit is contained in:
parent
135fc68633
commit
00035cd85c
@ -132,7 +132,6 @@ UBool
|
||||
ChoiceFormat::operator==(const Format& that) const
|
||||
{
|
||||
if (this == &that) return TRUE;
|
||||
if (this->getDynamicClassID() != that.getDynamicClassID()) return FALSE; // not the same class
|
||||
if (!NumberFormat::operator==(that)) return FALSE;
|
||||
ChoiceFormat& thatAlias = (ChoiceFormat&)that;
|
||||
if (fCount != thatAlias.fCount) return FALSE;
|
||||
|
@ -90,14 +90,13 @@ DateFormat::operator==(const Format& other) const
|
||||
// which have confirmed that the other object being compared against is
|
||||
// an instance of a sublcass of DateFormat. THIS IS IMPORTANT.
|
||||
|
||||
// We only dereference this pointer after we have confirmed below that
|
||||
// 'other' is a DateFormat subclass.
|
||||
// Format::operator== guarantees that this cast is safe
|
||||
DateFormat* fmt = (DateFormat*)&other;
|
||||
|
||||
return (this == fmt) ||
|
||||
((getDynamicClassID() == other.getDynamicClassID()) &&
|
||||
(Format::operator==(other) &&
|
||||
fCalendar&&(fCalendar->isEquivalentTo(*fmt->fCalendar)) &&
|
||||
(fNumberFormat&&(*fNumberFormat == *fmt->fNumberFormat)) );
|
||||
(fNumberFormat && *fNumberFormat == *fmt->fNumberFormat));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -132,10 +132,10 @@ Format::parseObject(const UnicodeString& source,
|
||||
// -------------------------------------
|
||||
|
||||
UBool
|
||||
Format::operator==(const Format& /*that*/) const
|
||||
Format::operator==(const Format& that) const
|
||||
{
|
||||
// Add this implementation to make linker happy.
|
||||
return TRUE;
|
||||
// Subclasses: Call this method and then add more specific checks.
|
||||
return getDynamicClassID() == that.getDynamicClassID();
|
||||
}
|
||||
//---------------------------------------
|
||||
|
||||
|
@ -392,7 +392,6 @@ MessageFormat::operator==(const Format& rhs) const
|
||||
|
||||
// Check class ID before checking MessageFormat members
|
||||
if (!Format::operator==(rhs) ||
|
||||
getDynamicClassID() != that.getDynamicClassID() ||
|
||||
fPattern != that.fPattern ||
|
||||
fLocale != that.fLocale) {
|
||||
return FALSE;
|
||||
|
@ -249,9 +249,8 @@ SimpleDateFormat::clone() const
|
||||
UBool
|
||||
SimpleDateFormat::operator==(const Format& other) const
|
||||
{
|
||||
if (DateFormat::operator==(other) &&
|
||||
other.getDynamicClassID() == getStaticClassID())
|
||||
{
|
||||
if (DateFormat::operator==(other)) {
|
||||
// DateFormat::operator== guarantees following cast is safe
|
||||
SimpleDateFormat* that = (SimpleDateFormat*)&other;
|
||||
return (fPattern == that->fPattern &&
|
||||
fSymbols != NULL && // Check for pathological object
|
||||
|
Loading…
Reference in New Issue
Block a user