Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: source/i18n/measure.cpp

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/i18n/measunit.cpp ('k') | source/i18n/msgfmt.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/measure.cpp
diff --git a/source/i18n/measure.cpp b/source/i18n/measure.cpp
index 639de3e6db17ac4aef8eb1e50d2fcb1c7d8dab92..eb610e6f8fde461ce669dab5f4314e78a96df3f4 100644
--- a/source/i18n/measure.cpp
+++ b/source/i18n/measure.cpp
@@ -1,6 +1,6 @@
/*
**********************************************************************
-* Copyright (c) 2004-2012, International Business Machines
+* Copyright (c) 2004-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@@ -19,6 +19,8 @@
U_NAMESPACE_BEGIN
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Measure)
+
Measure::Measure() {}
Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit,
@@ -44,24 +46,27 @@ Measure& Measure::operator=(const Measure& other) {
return *this;
}
+UObject *Measure::clone() const {
+ return new Measure(*this);
+}
+
Measure::~Measure() {
delete unit;
}
UBool Measure::operator==(const UObject& other) const {
- const Measure* m = (const Measure*) &other;
- return typeid(*this) == typeid(other) &&
- number == m->getNumber() &&
- (unit != NULL && *unit == m->getUnit());
+ if (this == &other) { // Same object, equal
+ return TRUE;
+ }
+ if (typeid(*this) != typeid(other)) { // Different types, not equal
+ return FALSE;
+ }
+ const Measure &m = static_cast<const Measure&>(other);
+ return number == m.number &&
+ ((unit == NULL) == (m.unit == NULL)) &&
+ (unit == NULL || *unit == *m.unit);
}
-//----------------------------------------------------------------------
-// MeasureUnit implementation
-
-MeasureUnit:: MeasureUnit() {}
-
-MeasureUnit::~MeasureUnit() {}
-
U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
« no previous file with comments | « source/i18n/measunit.cpp ('k') | source/i18n/msgfmt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698