| 1 |
/* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 |
|
| 5 |
#include "mozilla/intl/calendar/ICU4XChineseCalendar.h" |
| 6 |
|
| 7 |
namespace mozilla::intl::calendar { |
| 8 |
|
| 9 |
ICU4XChineseCalendar::ICU4XChineseCalendar(const icu::Locale& locale, |
| 10 |
UErrorCode& success) |
| 11 |
: ICU4XChineseBasedCalendar(capi::ICU4XAnyCalendarKind_Chinese, locale, |
| 12 |
success) {} |
| 13 |
|
| 14 |
ICU4XChineseCalendar::ICU4XChineseCalendar(const icu::TimeZone& timeZone, |
| 15 |
const icu::Locale& locale, |
| 16 |
UErrorCode& success) |
| 17 |
: ICU4XChineseBasedCalendar(capi::ICU4XAnyCalendarKind_Chinese, timeZone, |
| 18 |
locale, success) {} |
| 19 |
|
| 20 |
ICU4XChineseCalendar::ICU4XChineseCalendar(const ICU4XChineseCalendar& other) |
| 21 |
: ICU4XChineseBasedCalendar(other) {} |
| 22 |
|
| 23 |
ICU4XChineseCalendar::~ICU4XChineseCalendar() = default; |
| 24 |
|
| 25 |
ICU4XChineseCalendar* ICU4XChineseCalendar::clone() const { |
| 26 |
return new ICU4XChineseCalendar(*this); |
| 27 |
} |
| 28 |
|
| 29 |
const char* ICU4XChineseCalendar::getType() const { return "chinese"; } |
| 30 |
|
| 31 |
//////////////////////////////////////////// |
| 32 |
// ICU4XCalendar implementation overrides // |
| 33 |
//////////////////////////////////////////// |
| 34 |
|
| 35 |
std::string_view ICU4XChineseCalendar::eraName(int32_t extendedYear) const { |
| 36 |
return "chinese"; |
| 37 |
} |
| 38 |
|
| 39 |
//////////////////////////////////////////// |
| 40 |
// icu::Calendar implementation overrides // |
| 41 |
//////////////////////////////////////////// |
| 42 |
|
| 43 |
UDate ICU4XChineseCalendar::defaultCenturyStart() const { |
| 44 |
return defaultCentury_.start(); |
| 45 |
} |
| 46 |
|
| 47 |
int32_t ICU4XChineseCalendar::defaultCenturyStartYear() const { |
| 48 |
return defaultCentury_.startYear(); |
| 49 |
} |
| 50 |
|
| 51 |
UBool ICU4XChineseCalendar::haveDefaultCentury() const { return true; } |
| 52 |
|
| 53 |
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICU4XChineseCalendar) |
| 54 |
|
| 55 |
} // namespace mozilla::intl::calendar |