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

Unified Diff: source/i18n/tmunit.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/timezone.cpp ('k') | source/i18n/tmutfmt.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/tmunit.cpp
diff --git a/source/i18n/tmunit.cpp b/source/i18n/tmunit.cpp
index 121b81ce78c6056c621f92a9ab74729bc5e79e00..f938ee9a24a1138bcc27e84b99f9b3ea6afd8277 100644
--- a/source/i18n/tmunit.cpp
+++ b/source/i18n/tmunit.cpp
@@ -1,13 +1,12 @@
/*
*******************************************************************************
- * Copyright (C) 2008-2012, Google, International Business Machines Corporation and
+ * Copyright (C) 2008-2014, Google, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
-#include "utypeinfo.h" // for 'typeid' to work
-
#include "unicode/tmunit.h"
+#include "uassert.h"
#if !UCONFIG_NO_FORMATTING
@@ -70,44 +69,58 @@ TimeUnit::createInstance(TimeUnit::UTimeUnitFields timeUnitField,
TimeUnit::TimeUnit(TimeUnit::UTimeUnitFields timeUnitField) {
fTimeUnitField = timeUnitField;
+ switch (fTimeUnitField) {
+ case UTIMEUNIT_YEAR:
+ initTime("year");
+ break;
+ case UTIMEUNIT_MONTH:
+ initTime("month");
+ break;
+ case UTIMEUNIT_DAY:
+ initTime("day");
+ break;
+ case UTIMEUNIT_WEEK:
+ initTime("week");
+ break;
+ case UTIMEUNIT_HOUR:
+ initTime("hour");
+ break;
+ case UTIMEUNIT_MINUTE:
+ initTime("minute");
+ break;
+ case UTIMEUNIT_SECOND:
+ initTime("second");
+ break;
+ default:
+ U_ASSERT(false);
+ break;
+ }
}
-
TimeUnit::TimeUnit(const TimeUnit& other)
-: MeasureUnit(other) {
- *this = other;
+: MeasureUnit(other), fTimeUnitField(other.fTimeUnitField) {
}
-
UObject*
TimeUnit::clone() const {
return new TimeUnit(*this);
}
-
TimeUnit&
TimeUnit::operator=(const TimeUnit& other) {
if (this == &other) {
return *this;
}
+ MeasureUnit::operator=(other);
fTimeUnitField = other.fTimeUnitField;
return *this;
}
-
-UBool
-TimeUnit::operator==(const UObject& other) const {
- return (typeid(*this) == typeid(other)
- && fTimeUnitField == ((TimeUnit*)&other)->fTimeUnitField);
-}
-
-
TimeUnit::UTimeUnitFields
TimeUnit::getTimeUnitField() const {
return fTimeUnitField;
}
-
TimeUnit::~TimeUnit() {
}
« no previous file with comments | « source/i18n/timezone.cpp ('k') | source/i18n/tmutfmt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698