Debian Codegraph @

intl/components/src/calendar/ICU4XDangiCalendar.h

raw
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 #ifndef intl_components_calendar_ICU4XDangiCalendar_h_
5 #define intl_components_calendar_ICU4XDangiCalendar_h_
6
7 #include "mozilla/intl/calendar/ICU4XChineseBasedCalendar.h"
8
9 #include <stdint.h>
10 #include <string_view>
11
12 #include "unicode/uobject.h"
13
14 namespace mozilla::intl::calendar {
15
16 /**
17 * Dangi (traditional Korean) calendar implementation.
18 *
19 * Overrides the same methods as icu::DangiCalendar to ensure compatible
20 * behavior even when using ICU4X as the underlying calendar implementation.
21 */
22 class ICU4XDangiCalendar : public ICU4XChineseBasedCalendar {
23 public:
24 ICU4XDangiCalendar() = delete;
25 ICU4XDangiCalendar(const icu::Locale& locale, UErrorCode& success);
26 ICU4XDangiCalendar(const icu::TimeZone& timeZone, const icu::Locale& locale,
27 UErrorCode& success);
28 ICU4XDangiCalendar(const ICU4XDangiCalendar& other);
29
30 virtual ~ICU4XDangiCalendar();
31
32 ICU4XDangiCalendar* clone() const override;
33
34 const char* getType() const override;
35
36 protected:
37 std::string_view eraName(int32_t extendedYear) const override;
38
39 static constexpr int32_t dangiRelatedYearDiff = -2333;
40
41 int32_t relatedYearDifference() const override {
42 return dangiRelatedYearDiff;
43 }
44
45 public:
46 UClassID getDynamicClassID() const override;
47 static UClassID U_EXPORT2 getStaticClassID();
48
49 protected:
50 DECLARE_OVERRIDE_SYSTEM_DEFAULT_CENTURY
51
52 struct SystemDefaultCenturyLocale {
53 static inline const char* identifier = "@calendar=dangi";
54 };
55 static inline SystemDefaultCentury<ICU4XDangiCalendar,
56 SystemDefaultCenturyLocale>
57 defaultCentury_{};
58 };
59
60 } // namespace mozilla::intl::calendar
61
62 #endif