1 #ifndef icu4x_TrailingCase_D_HPP 2 #define icu4x_TrailingCase_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 TrailingCase { 17 TrailingCase_Lower = 0, 18 TrailingCase_Unchanged = 1, 19 }; 20 21 typedef struct TrailingCase_option {union { TrailingCase ok; }; bool is_ok; } TrailingCase_option; 22 } // namespace capi 23 } // namespace 24 25 namespace icu4x { 26 class TrailingCase { 27 public: 28 enum Value { 29 Lower = 0, 30 Unchanged = 1, 31 }; 32 33 TrailingCase() = default; 34 // Implicit conversions between enum and ::Value TrailingCase(Value v)35 constexpr TrailingCase(Value v) : value(v) {} operator Value() const36 constexpr operator Value() const { return value; } 37 // Prevent usage as boolean value 38 explicit operator bool() const = delete; 39 40 inline icu4x::capi::TrailingCase AsFFI() const; 41 inline static icu4x::TrailingCase FromFFI(icu4x::capi::TrailingCase c_enum); 42 private: 43 Value value; 44 }; 45 46 } // namespace 47 #endif // icu4x_TrailingCase_D_HPP 48