Chromium Code Reviews

Unified Diff: source/i18n/tznames.cpp

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « source/i18n/tzgnames.cpp ('k') | source/i18n/tznames_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/tznames.cpp
diff --git a/source/i18n/tznames.cpp b/source/i18n/tznames.cpp
index db1ce0ddeec0cc0541fd426e9b1a506808a9e511..6aefd13b536fc03bae1b238afe35b92db85bb414 100644
--- a/source/i18n/tznames.cpp
+++ b/source/i18n/tznames.cpp
@@ -1,3 +1,5 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2011-2015, International Business Machines Corporation and *
@@ -116,6 +118,9 @@ public:
UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const;
+ void loadAllDisplayNames(UErrorCode& status);
+ void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const;
+
MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const;
private:
TimeZoneNamesDelegate();
@@ -278,6 +283,16 @@ TimeZoneNamesDelegate::getExemplarLocationName(const UnicodeString& tzID, Unicod
return fTZnamesCacheEntry->names->getExemplarLocationName(tzID, name);
}
+void
+TimeZoneNamesDelegate::loadAllDisplayNames(UErrorCode& status) {
+ fTZnamesCacheEntry->names->loadAllDisplayNames(status);
+}
+
+void
+TimeZoneNamesDelegate::getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const {
+ fTZnamesCacheEntry->names->getDisplayNames(tzID, types, numTypes, date, dest, status);
+}
+
TimeZoneNames::MatchInfoCollection*
TimeZoneNamesDelegate::find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const {
return fTZnamesCacheEntry->names->find(text, start, types, status);
@@ -330,6 +345,29 @@ TimeZoneNames::getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type,
return name;
}
+// Empty default implementation, to be overriden in tznames_impl.cpp.
+void
+TimeZoneNames::loadAllDisplayNames(UErrorCode& /*status*/) {
+}
+
+// A default, lightweight implementation of getDisplayNames.
+// Overridden in tznames_impl.cpp.
+void
+TimeZoneNames::getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const {
+ if (U_FAILURE(status)) { return; }
+ if (tzID.isEmpty()) { return; }
+ UnicodeString mzID;
+ for (int i = 0; i < numTypes; i++) {
+ getTimeZoneDisplayName(tzID, types[i], dest[i]);
+ if (dest[i].isEmpty()) {
+ if (mzID.isEmpty()) {
+ getMetaZoneID(tzID, date, mzID);
+ }
+ getMetaZoneDisplayName(mzID, types[i], dest[i]);
+ }
+ }
+}
+
struct MatchInfo : UMemory {
UTimeZoneNameType nameType;
« no previous file with comments | « source/i18n/tzgnames.cpp ('k') | source/i18n/tznames_impl.h » ('j') | no next file with comments »

Powered by Google App Engine