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