Weekday.d.hpp (1251B)
1 #ifndef icu4x_Weekday_D_HPP 2 #define icu4x_Weekday_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 15 namespace icu4x { 16 namespace capi { 17 enum Weekday { 18 Weekday_Monday = 1, 19 Weekday_Tuesday = 2, 20 Weekday_Wednesday = 3, 21 Weekday_Thursday = 4, 22 Weekday_Friday = 5, 23 Weekday_Saturday = 6, 24 Weekday_Sunday = 7, 25 }; 26 27 typedef struct Weekday_option {union { Weekday ok; }; bool is_ok; } Weekday_option; 28 } // namespace capi 29 } // namespace 30 31 namespace icu4x { 32 class Weekday { 33 public: 34 enum Value { 35 Monday = 1, 36 Tuesday = 2, 37 Wednesday = 3, 38 Thursday = 4, 39 Friday = 5, 40 Saturday = 6, 41 Sunday = 7, 42 }; 43 44 Weekday() = default; 45 // Implicit conversions between enum and ::Value 46 constexpr Weekday(Value v) : value(v) {} 47 constexpr operator Value() const { return value; } 48 // Prevent usage as boolean value 49 explicit operator bool() const = delete; 50 51 inline icu4x::capi::Weekday AsFFI() const; 52 inline static icu4x::Weekday FromFFI(icu4x::capi::Weekday c_enum); 53 private: 54 Value value; 55 }; 56 57 } // namespace 58 #endif // icu4x_Weekday_D_HPP