OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * Copyright (C) 2011-2013, International Business Machines Corporation and * | 3 * Copyright (C) 2011-2014, International Business Machines Corporation and * |
4 * others. All Rights Reserved. * | 4 * others. All Rights Reserved. * |
5 ******************************************************************************* | 5 ******************************************************************************* |
6 */ | 6 */ |
7 | 7 |
8 #include "unicode/utypes.h" | 8 #include "unicode/utypes.h" |
9 | 9 |
10 #if !UCONFIG_NO_FORMATTING | 10 #if !UCONFIG_NO_FORMATTING |
11 | 11 |
12 #include "unicode/locid.h" | 12 #include "unicode/locid.h" |
13 #include "unicode/tznames.h" | 13 #include "unicode/tznames.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 284 } |
285 | 285 |
286 // --------------------------------------------------- | 286 // --------------------------------------------------- |
287 // TimeZoneNames base class | 287 // TimeZoneNames base class |
288 // --------------------------------------------------- | 288 // --------------------------------------------------- |
289 TimeZoneNames::~TimeZoneNames() { | 289 TimeZoneNames::~TimeZoneNames() { |
290 } | 290 } |
291 | 291 |
292 TimeZoneNames* | 292 TimeZoneNames* |
293 TimeZoneNames::createInstance(const Locale& locale, UErrorCode& status) { | 293 TimeZoneNames::createInstance(const Locale& locale, UErrorCode& status) { |
294 return new TimeZoneNamesDelegate(locale, status); | 294 TimeZoneNames *instance = NULL; |
| 295 if (U_SUCCESS(status)) { |
| 296 instance = new TimeZoneNamesDelegate(locale, status); |
| 297 if (instance == NULL && U_SUCCESS(status)) { |
| 298 status = U_MEMORY_ALLOCATION_ERROR; |
| 299 } |
| 300 } |
| 301 return instance; |
295 } | 302 } |
296 | 303 |
| 304 #ifndef U_HIDE_DRAFT_API |
| 305 TimeZoneNames* |
| 306 TimeZoneNames::createTZDBInstance(const Locale& locale, UErrorCode& status) { |
| 307 TimeZoneNames *instance = NULL; |
| 308 if (U_SUCCESS(status)) { |
| 309 instance = new TZDBTimeZoneNames(locale); |
| 310 if (instance == NULL && U_SUCCESS(status)) { |
| 311 status = U_MEMORY_ALLOCATION_ERROR; |
| 312 } |
| 313 } |
| 314 return instance; |
| 315 } |
| 316 #endif /* U_HIDE_DRAFT_API */ |
| 317 |
297 UnicodeString& | 318 UnicodeString& |
298 TimeZoneNames::getExemplarLocationName(const UnicodeString& tzID, UnicodeString&
name) const { | 319 TimeZoneNames::getExemplarLocationName(const UnicodeString& tzID, UnicodeString&
name) const { |
299 return TimeZoneNamesImpl::getDefaultExemplarLocationName(tzID, name); | 320 return TimeZoneNamesImpl::getDefaultExemplarLocationName(tzID, name); |
300 } | 321 } |
301 | 322 |
302 UnicodeString& | 323 UnicodeString& |
303 TimeZoneNames::getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type,
UDate date, UnicodeString& name) const { | 324 TimeZoneNames::getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type,
UDate date, UnicodeString& name) const { |
304 getTimeZoneDisplayName(tzID, type, name); | 325 getTimeZoneDisplayName(tzID, type, name); |
305 if (name.isEmpty()) { | 326 if (name.isEmpty()) { |
306 UnicodeString mzID; | 327 UnicodeString mzID; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } else if (U_FAILURE(status)) { | 467 } else if (U_FAILURE(status)) { |
447 delete fMatches; | 468 delete fMatches; |
448 fMatches = NULL; | 469 fMatches = NULL; |
449 } | 470 } |
450 return fMatches; | 471 return fMatches; |
451 } | 472 } |
452 | 473 |
453 | 474 |
454 U_NAMESPACE_END | 475 U_NAMESPACE_END |
455 #endif | 476 #endif |
OLD | NEW |