DecimalSignDisplay.d.hpp (1560B)
1 #ifndef icu4x_DecimalSignDisplay_D_HPP 2 #define icu4x_DecimalSignDisplay_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 DecimalSignDisplay { 18 DecimalSignDisplay_Auto = 0, 19 DecimalSignDisplay_Never = 1, 20 DecimalSignDisplay_Always = 2, 21 DecimalSignDisplay_ExceptZero = 3, 22 DecimalSignDisplay_Negative = 4, 23 }; 24 25 typedef struct DecimalSignDisplay_option {union { DecimalSignDisplay ok; }; bool is_ok; } DecimalSignDisplay_option; 26 } // namespace capi 27 } // namespace 28 29 namespace icu4x { 30 /** 31 * ECMA-402 compatible sign display preference. 32 * 33 * See the [Rust documentation for `SignDisplay`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.SignDisplay.html) for more information. 34 */ 35 class DecimalSignDisplay { 36 public: 37 enum Value { 38 Auto = 0, 39 Never = 1, 40 Always = 2, 41 ExceptZero = 3, 42 Negative = 4, 43 }; 44 45 DecimalSignDisplay() = default; 46 // Implicit conversions between enum and ::Value 47 constexpr DecimalSignDisplay(Value v) : value(v) {} 48 constexpr operator Value() const { return value; } 49 // Prevent usage as boolean value 50 explicit operator bool() const = delete; 51 52 inline icu4x::capi::DecimalSignDisplay AsFFI() const; 53 inline static icu4x::DecimalSignDisplay FromFFI(icu4x::capi::DecimalSignDisplay c_enum); 54 private: 55 Value value; 56 }; 57 58 } // namespace 59 #endif // icu4x_DecimalSignDisplay_D_HPP