WordBreak.d.hpp (3824B)
1 #ifndef icu4x_WordBreak_D_HPP 2 #define icu4x_WordBreak_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 WordBreak; 16 } 17 18 19 namespace icu4x { 20 namespace capi { 21 enum WordBreak { 22 WordBreak_Other = 0, 23 WordBreak_ALetter = 1, 24 WordBreak_Format = 2, 25 WordBreak_Katakana = 3, 26 WordBreak_MidLetter = 4, 27 WordBreak_MidNum = 5, 28 WordBreak_Numeric = 6, 29 WordBreak_ExtendNumLet = 7, 30 WordBreak_CR = 8, 31 WordBreak_Extend = 9, 32 WordBreak_LF = 10, 33 WordBreak_MidNumLet = 11, 34 WordBreak_Newline = 12, 35 WordBreak_RegionalIndicator = 13, 36 WordBreak_HebrewLetter = 14, 37 WordBreak_SingleQuote = 15, 38 WordBreak_DoubleQuote = 16, 39 WordBreak_EBase = 17, 40 WordBreak_EBaseGAZ = 18, 41 WordBreak_EModifier = 19, 42 WordBreak_GlueAfterZwj = 20, 43 WordBreak_ZWJ = 21, 44 WordBreak_WSegSpace = 22, 45 }; 46 47 typedef struct WordBreak_option {union { WordBreak ok; }; bool is_ok; } WordBreak_option; 48 } // namespace capi 49 } // namespace 50 51 namespace icu4x { 52 /** 53 * See the [Rust documentation for `WordBreak`](https://docs.rs/icu/latest/icu/properties/props/struct.WordBreak.html) for more information. 54 */ 55 class WordBreak { 56 public: 57 enum Value { 58 Other = 0, 59 ALetter = 1, 60 Format = 2, 61 Katakana = 3, 62 MidLetter = 4, 63 MidNum = 5, 64 Numeric = 6, 65 ExtendNumLet = 7, 66 CR = 8, 67 Extend = 9, 68 LF = 10, 69 MidNumLet = 11, 70 Newline = 12, 71 RegionalIndicator = 13, 72 HebrewLetter = 14, 73 SingleQuote = 15, 74 DoubleQuote = 16, 75 EBase = 17, 76 EBaseGAZ = 18, 77 EModifier = 19, 78 GlueAfterZwj = 20, 79 ZWJ = 21, 80 WSegSpace = 22, 81 }; 82 83 WordBreak() = default; 84 // Implicit conversions between enum and ::Value 85 constexpr WordBreak(Value v) : value(v) {} 86 constexpr operator Value() const { return value; } 87 // Prevent usage as boolean value 88 explicit operator bool() const = delete; 89 90 /** 91 * See the [Rust documentation for `for_char`](https://docs.rs/icu/latest/icu/properties/props/trait.EnumeratedProperty.html#tymethod.for_char) for more information. 92 */ 93 inline static icu4x::WordBreak for_char(char32_t ch); 94 95 /** 96 * Get the "long" name of this property value (returns empty if property value is unknown) 97 * 98 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesLongBorrowed.html#method.get) for more information. 99 */ 100 inline std::optional<std::string_view> long_name() const; 101 102 /** 103 * Get the "short" name of this property value (returns empty if property value is unknown) 104 * 105 * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/properties/struct.PropertyNamesShortBorrowed.html#method.get) for more information. 106 */ 107 inline std::optional<std::string_view> short_name() const; 108 109 /** 110 * Convert to an integer value usable with ICU4C and CodePointMapData 111 * 112 * See the [Rust documentation for `to_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.WordBreak.html#method.to_icu4c_value) for more information. 113 */ 114 inline uint8_t to_integer_value() const; 115 116 /** 117 * Convert from an integer value from ICU4C or CodePointMapData 118 * 119 * See the [Rust documentation for `from_icu4c_value`](https://docs.rs/icu/latest/icu/properties/props/struct.WordBreak.html#method.from_icu4c_value) for more information. 120 */ 121 inline static std::optional<icu4x::WordBreak> from_integer_value(uint8_t other); 122 123 inline icu4x::capi::WordBreak AsFFI() const; 124 inline static icu4x::WordBreak FromFFI(icu4x::capi::WordBreak c_enum); 125 private: 126 Value value; 127 }; 128 129 } // namespace 130 #endif // icu4x_WordBreak_D_HPP