CalendarKind.d.hpp (2667B)
1 #ifndef icu4x_CalendarKind_D_HPP 2 #define icu4x_CalendarKind_D_HPP 3 4 #include <stdio.h> 5 #include <stdint.h> 6 #include <stddef.h> 7 #include <stdbool.h> 8 #include <memory> 9 #include <functional> 10 #include <optional> 11 #include <cstdlib> 12 #include "../diplomat_runtime.hpp" 13 14 namespace icu4x { 15 namespace capi { struct Locale; } 16 class Locale; 17 class CalendarKind; 18 } 19 20 21 namespace icu4x { 22 namespace capi { 23 enum CalendarKind { 24 CalendarKind_Iso = 0, 25 CalendarKind_Gregorian = 1, 26 CalendarKind_Buddhist = 2, 27 CalendarKind_Japanese = 3, 28 CalendarKind_JapaneseExtended = 4, 29 CalendarKind_Ethiopian = 5, 30 CalendarKind_EthiopianAmeteAlem = 6, 31 CalendarKind_Indian = 7, 32 CalendarKind_Coptic = 8, 33 CalendarKind_Dangi = 9, 34 CalendarKind_Chinese = 10, 35 CalendarKind_Hebrew = 11, 36 CalendarKind_HijriTabularTypeIIFriday = 12, 37 CalendarKind_HijriSimulatedMecca = 18, 38 CalendarKind_HijriTabularTypeIIThursday = 14, 39 CalendarKind_HijriUmmAlQura = 15, 40 CalendarKind_Persian = 16, 41 CalendarKind_Roc = 17, 42 }; 43 44 typedef struct CalendarKind_option {union { CalendarKind ok; }; bool is_ok; } CalendarKind_option; 45 } // namespace capi 46 } // namespace 47 48 namespace icu4x { 49 /** 50 * The various calendar types currently supported by [`Calendar`] 51 * 52 * See the [Rust documentation for `AnyCalendarKind`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html) for more information. 53 */ 54 class CalendarKind { 55 public: 56 enum Value { 57 Iso = 0, 58 Gregorian = 1, 59 Buddhist = 2, 60 Japanese = 3, 61 JapaneseExtended = 4, 62 Ethiopian = 5, 63 EthiopianAmeteAlem = 6, 64 Indian = 7, 65 Coptic = 8, 66 Dangi = 9, 67 Chinese = 10, 68 Hebrew = 11, 69 HijriTabularTypeIIFriday = 12, 70 HijriSimulatedMecca = 18, 71 HijriTabularTypeIIThursday = 14, 72 HijriUmmAlQura = 15, 73 Persian = 16, 74 Roc = 17, 75 }; 76 77 CalendarKind() = default; 78 // Implicit conversions between enum and ::Value 79 constexpr CalendarKind(Value v) : value(v) {} 80 constexpr operator Value() const { return value; } 81 // Prevent usage as boolean value 82 explicit operator bool() const = delete; 83 84 /** 85 * Creates a new [`CalendarKind`] for the specified locale, using compiled data. 86 * 87 * See the [Rust documentation for `new`](https://docs.rs/icu/latest/icu/calendar/enum.AnyCalendarKind.html#method.new) for more information. 88 */ 89 inline static icu4x::CalendarKind create(const icu4x::Locale& locale); 90 91 inline icu4x::capi::CalendarKind AsFFI() const; 92 inline static icu4x::CalendarKind FromFFI(icu4x::capi::CalendarKind c_enum); 93 private: 94 Value value; 95 }; 96 97 } // namespace 98 #endif // icu4x_CalendarKind_D_HPP