SentenceBreak.d.hpp (3474B)
1 #ifndef icu4x_SentenceBreak_D_HPP 2 #define icu4x_SentenceBreak_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 namespace icu4x { 15 class SentenceBreak; 16 } 17 18 19 namespace icu4x { 20 namespace capi { 21 enum SentenceBreak { 22 SentenceBreak_Other = 0, 23 SentenceBreak_ATerm = 1, 24 SentenceBreak_Close = 2, 25 SentenceBreak_Format = 3, 26 SentenceBreak_Lower = 4, 27 SentenceBreak_Numeric = 5, 28 SentenceBreak_OLetter = 6, 29 SentenceBreak_Sep = 7, 30 SentenceBreak_Sp = 8, 31 SentenceBreak_STerm = 9, 32 SentenceBreak_Upper = 10, 33 SentenceBreak_CR = 11, 34 SentenceBreak_Extend = 12, 35 SentenceBreak_LF = 13, 36 SentenceBreak_SContinue = 14, 37 }; 38 39 typedef struct SentenceBreak_option {union { SentenceBreak ok; }; bool is_ok; } SentenceBreak_option; 40 } // namespace capi 41 } // namespace 42 43 namespace icu4x { 44 /** 45 * See the [Rust documentation for `SentenceBreak`](https://docs.rs/icu/latest/icu/properties/props/struct.SentenceBreak.html) for more information. 46 */ 47 class SentenceBreak { 48 public: 49 enum Value { 50 Other = 0, 51 ATerm = 1, 52 Close = 2, 53 Format = 3, 54 Lower = 4, 55 Numeric = 5, 56 OLetter = 6, 57 Sep = 7, 58 Sp = 8, 59 STerm = 9, 60 Upper = 10, 61 CR = 11, 62 Extend = 12, 63 LF = 13, 64 SContinue = 14, 65 }; 66 67 SentenceBreak() = default; 68 // Implicit conversions between enum and ::Value 69 constexpr SentenceBreak(Value v) : value(v) {} 70 constexpr operator Value() const { return value; } 71 // Prevent usage as boolean value 72 explicit operator bool() const = delete; 73 74 /** 75 * See the [Rust documentation for `for_char`](https://docs.rs/icu/latest/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information. 76 */ 77 inline static icu4x::SentenceBreak for_char(char32_t ch); 78 79 /** 80 * Get the "long" name of this property value (returns empty if property value is unknown) 81 * 82 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesLongBorrowed.html#method.get) for more information. 83 */ 84 inline std::optional<std::string_view> long_name() const; 85 86 /** 87 * Get the "short" name of this property value (returns empty if property value is unknown) 88 * 89 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesShortBorrowed.html#method.get) for more information. 90 */ 91 inline std::optional<std::string_view> short_name() const; 92 93 /** 94 * Convert to an integer value usable with ICU4C and CodePointMapData 95 * 96 * See the [Rust documentation for `to_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.SentenceBreak.html#method.to_icu4c_value) for more information. 97 */ 98 inline uint8_t to_integer_value() const; 99 100 /** 101 * Convert from an integer value from ICU4C or CodePointMapData 102 * 103 * See the [Rust documentation for `from_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.SentenceBreak.html#method.from_icu4c_value) for more information. 104 */ 105 inline static std::optional<icu4x::SentenceBreak> from_integer_value(uint8_t other); 106 107 inline icu4x::capi::SentenceBreak AsFFI() const; 108 inline static icu4x::SentenceBreak FromFFI(icu4x::capi::SentenceBreak c_enum); 109 private: 110 Value value; 111 }; 112 113 } // namespace 114 #endif // icu4x_SentenceBreak_D_HPP