X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/3d1f044b704633e2e541231cd17ae9ecf9ad5c7a..340931cb2e044a2141d11567dd0f782524e32994:/icuSources/i18n/reldatefmt.cpp diff --git a/icuSources/i18n/reldatefmt.cpp b/icuSources/i18n/reldatefmt.cpp index 9d269100..fa3c27e1 100644 --- a/icuSources/i18n/reldatefmt.cpp +++ b/icuSources/i18n/reldatefmt.cpp @@ -43,7 +43,7 @@ #include "standardplural.h" #include "unifiedcache.h" #include "util.h" -#include "number_stringbuilder.h" +#include "formatted_string_builder.h" #include "number_utypes.h" #include "number_modifiers.h" #include "formattedval_impl.h" @@ -315,6 +315,10 @@ struct RelDateTimeFmtDataSink : public ResourceSink { return UDAT_ABSOLUTE_FRIDAY; case SATURDAY: return UDAT_ABSOLUTE_SATURDAY; + case HOUR: + return UDAT_ABSOLUTE_HOUR; + case MINUTE: + return UDAT_ABSOLUTE_MINUTE; default: return -1; } @@ -714,7 +718,7 @@ const RelativeDateTimeCacheData *LocaleCacheKey::crea return nullptr; } result->adoptCombinedDateAndTime( - new SimpleFormatter(dateTimePattern, 2, 2, status)); + new SimpleFormatter(dateTimePattern, 2, 2, TRUE, status)); if (U_FAILURE(status)) { return nullptr; } @@ -725,14 +729,14 @@ const RelativeDateTimeCacheData *LocaleCacheKey::crea static constexpr number::impl::Field kRDTNumericField - = number::impl::NumFieldUtils::compress(); + = StringBuilderFieldUtils::compress(); static constexpr number::impl::Field kRDTLiteralField - = number::impl::NumFieldUtils::compress(); + = StringBuilderFieldUtils::compress(); -class FormattedRelativeDateTimeData : public FormattedValueNumberStringBuilderImpl { +class FormattedRelativeDateTimeData : public FormattedValueStringBuilderImpl { public: - FormattedRelativeDateTimeData() : FormattedValueNumberStringBuilderImpl(kRDTNumericField) {} + FormattedRelativeDateTimeData() : FormattedValueStringBuilderImpl(kRDTNumericField) {} virtual ~FormattedRelativeDateTimeData(); }; @@ -1157,6 +1161,8 @@ void RelativeDateTimeFormatter::formatRelativeImpl( case UDAT_REL_UNIT_THURSDAY: absunit = UDAT_ABSOLUTE_THURSDAY; break; case UDAT_REL_UNIT_FRIDAY: absunit = UDAT_ABSOLUTE_FRIDAY; break; case UDAT_REL_UNIT_SATURDAY: absunit = UDAT_ABSOLUTE_SATURDAY; break; + case UDAT_REL_UNIT_HOUR: absunit = UDAT_ABSOLUTE_HOUR; break; + case UDAT_REL_UNIT_MINUTE: absunit = UDAT_ABSOLUTE_MINUTE; break; default: break; } if (direction != UDAT_DIRECTION_COUNT && absunit != UDAT_ABSOLUTE_UNIT_COUNT) { @@ -1184,8 +1190,8 @@ UnicodeString& RelativeDateTimeFormatter::adjustForContext(UnicodeString &str) c // Must guarantee that one thread at a time accesses the shared break // iterator. - static UMutex *gBrkIterMutex = STATIC_NEW(UMutex); - Mutex lock(gBrkIterMutex); + static UMutex gBrkIterMutex; + Mutex lock(&gBrkIterMutex); str.toTitle( fOptBreakIterator->get(), fLocale,