mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1767961 - Part 3: Remove no longer used TryCreateFromSkeleton() method. r=platform-i18n-reviewers,dminor
There aren't any callers left for `TryCreateFromSkeleton()` after part 2. Depends on D145581 Differential Revision: https://phabricator.services.mozilla.com/D145582
This commit is contained in:
parent
8459959c8f
commit
011e248afb
@ -89,23 +89,6 @@ TEST(IntlDateTimeFormat, Style_enUS_fallback_to_default_styles)
|
||||
ASSERT_TRUE(buffer.verboseMatches("Sep 23, 2002, 8:07:30 PM"));
|
||||
}
|
||||
|
||||
TEST(IntlDateTimeFormat, Skeleton_enUS_utf8_in)
|
||||
{
|
||||
UniquePtr<DateTimePatternGenerator> gen = nullptr;
|
||||
auto dateTimePatternGenerator =
|
||||
DateTimePatternGenerator::TryCreate("en").unwrap();
|
||||
|
||||
UniquePtr<DateTimeFormat> dtFormat =
|
||||
DateTimeFormat::TryCreateFromSkeleton(
|
||||
MakeStringSpan("en-US"), MakeStringSpan("yMdhhmmss"),
|
||||
dateTimePatternGenerator.get(), Some(MakeStringSpan("GMT+3")))
|
||||
.unwrap();
|
||||
TestBuffer<char> buffer;
|
||||
dtFormat->TryFormat(DATE, buffer).unwrap();
|
||||
|
||||
ASSERT_TRUE(buffer.verboseMatches("9/23/2002, 08:07:30 PM"));
|
||||
}
|
||||
|
||||
TEST(IntlDateTimeFormat, Skeleton_enUS_utf16_in)
|
||||
{
|
||||
UniquePtr<DateTimePatternGenerator> gen = nullptr;
|
||||
|
@ -596,40 +596,6 @@ DateTimeFormat::TryCreateFromSkeleton(
|
||||
return dateTimeFormat;
|
||||
}
|
||||
|
||||
/* static */
|
||||
Result<UniquePtr<DateTimeFormat>, ICUError>
|
||||
DateTimeFormat::TryCreateFromSkeleton(
|
||||
Span<const char> aLocale, Span<const char> aSkeleton,
|
||||
DateTimePatternGenerator* aDateTimePatternGenerator,
|
||||
Maybe<Span<const char>> aTimeZoneOverride) {
|
||||
// Convert the skeleton to UTF-16.
|
||||
DateTimeFormat::SkeletonVector skeletonUtf16Buffer;
|
||||
|
||||
if (!FillUTF16Vector(aSkeleton, skeletonUtf16Buffer)) {
|
||||
return Err(ICUError::OutOfMemory);
|
||||
}
|
||||
|
||||
// Convert the timezone to UTF-16 if it exists.
|
||||
DateTimeFormat::PatternVector tzUtf16Vec;
|
||||
Maybe<Span<const char16_t>> timeZone = Nothing{};
|
||||
if (aTimeZoneOverride) {
|
||||
if (!FillUTF16Vector(*aTimeZoneOverride, tzUtf16Vec)) {
|
||||
return Err(ICUError::OutOfMemory);
|
||||
};
|
||||
timeZone =
|
||||
Some(Span<const char16_t>(tzUtf16Vec.begin(), tzUtf16Vec.length()));
|
||||
}
|
||||
|
||||
auto result = DateTimeFormat::TryCreateFromSkeleton(
|
||||
aLocale, skeletonUtf16Buffer, aDateTimePatternGenerator, timeZone);
|
||||
if (result.isErr()) {
|
||||
return result;
|
||||
}
|
||||
auto dateTimeFormat = result.unwrap();
|
||||
MOZ_TRY(dateTimeFormat->CacheSkeleton(skeletonUtf16Buffer));
|
||||
return dateTimeFormat;
|
||||
}
|
||||
|
||||
ICUResult DateTimeFormat::CacheSkeleton(Span<const char16_t> aSkeleton) {
|
||||
if (mOriginalSkeleton.append(aSkeleton.Elements(), aSkeleton.Length())) {
|
||||
return Ok();
|
||||
|
@ -272,16 +272,6 @@ class DateTimeFormat final {
|
||||
Nothing{}, aTimeZoneOverride);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a DateTimeFormat from a UTF-8 skeleton.
|
||||
*
|
||||
* See the TryCreateFromSkeleton for const char16_t for documentation.
|
||||
*/
|
||||
static Result<UniquePtr<DateTimeFormat>, ICUError> TryCreateFromSkeleton(
|
||||
Span<const char> aLocale, Span<const char> aSkeleton,
|
||||
DateTimePatternGenerator* aDateTimePatternGenerator,
|
||||
Maybe<Span<const char>> aTimeZoneOverride = Nothing{});
|
||||
|
||||
private:
|
||||
static Result<UniquePtr<DateTimeFormat>, ICUError> TryCreateFromSkeleton(
|
||||
Span<const char> aLocale, Span<const char16_t> aSkeleton,
|
||||
|
Loading…
Reference in New Issue
Block a user