DecimalSign.d.hpp (1328B)
1 #ifndef icu4x_DecimalSign_D_HPP 2 #define icu4x_DecimalSign_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 DecimalSign { 18 DecimalSign_None = 0, 19 DecimalSign_Negative = 1, 20 DecimalSign_Positive = 2, 21 }; 22 23 typedef struct DecimalSign_option {union { DecimalSign ok; }; bool is_ok; } DecimalSign_option; 24 } // namespace capi 25 } // namespace 26 27 namespace icu4x { 28 /** 29 * The sign of a Decimal, as shown in formatting. 30 * 31 * See the [Rust documentation for `Sign`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.Sign.html) for more information. 32 */ 33 class DecimalSign { 34 public: 35 enum Value { 36 None = 0, 37 Negative = 1, 38 Positive = 2, 39 }; 40 41 DecimalSign() = default; 42 // Implicit conversions between enum and ::Value 43 constexpr DecimalSign(Value v) : value(v) {} 44 constexpr operator Value() const { return value; } 45 // Prevent usage as boolean value 46 explicit operator bool() const = delete; 47 48 inline icu4x::capi::DecimalSign AsFFI() const; 49 inline static icu4x::DecimalSign FromFFI(icu4x::capi::DecimalSign c_enum); 50 private: 51 Value value; 52 }; 53 54 } // namespace 55 #endif // icu4x_DecimalSign_D_HPP