1 #ifndef icu4x_IndicSyllabicCategory_D_HPP 2 #define icu4x_IndicSyllabicCategory_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 namespace icu4x { 14 class IndicSyllabicCategory; 15 } 16 17 18 namespace icu4x { 19 namespace capi { 20 enum IndicSyllabicCategory { 21 IndicSyllabicCategory_Other = 0, 22 IndicSyllabicCategory_Avagraha = 1, 23 IndicSyllabicCategory_Bindu = 2, 24 IndicSyllabicCategory_BrahmiJoiningNumber = 3, 25 IndicSyllabicCategory_CantillationMark = 4, 26 IndicSyllabicCategory_Consonant = 5, 27 IndicSyllabicCategory_ConsonantDead = 6, 28 IndicSyllabicCategory_ConsonantFinal = 7, 29 IndicSyllabicCategory_ConsonantHeadLetter = 8, 30 IndicSyllabicCategory_ConsonantInitialPostfixed = 9, 31 IndicSyllabicCategory_ConsonantKiller = 10, 32 IndicSyllabicCategory_ConsonantMedial = 11, 33 IndicSyllabicCategory_ConsonantPlaceholder = 12, 34 IndicSyllabicCategory_ConsonantPrecedingRepha = 13, 35 IndicSyllabicCategory_ConsonantPrefixed = 14, 36 IndicSyllabicCategory_ConsonantSucceedingRepha = 15, 37 IndicSyllabicCategory_ConsonantSubjoined = 16, 38 IndicSyllabicCategory_ConsonantWithStacker = 17, 39 IndicSyllabicCategory_GeminationMark = 18, 40 IndicSyllabicCategory_InvisibleStacker = 19, 41 IndicSyllabicCategory_Joiner = 20, 42 IndicSyllabicCategory_ModifyingLetter = 21, 43 IndicSyllabicCategory_NonJoiner = 22, 44 IndicSyllabicCategory_Nukta = 23, 45 IndicSyllabicCategory_Number = 24, 46 IndicSyllabicCategory_NumberJoiner = 25, 47 IndicSyllabicCategory_PureKiller = 26, 48 IndicSyllabicCategory_RegisterShifter = 27, 49 IndicSyllabicCategory_SyllableModifier = 28, 50 IndicSyllabicCategory_ToneLetter = 29, 51 IndicSyllabicCategory_ToneMark = 30, 52 IndicSyllabicCategory_Virama = 31, 53 IndicSyllabicCategory_Visarga = 32, 54 IndicSyllabicCategory_Vowel = 33, 55 IndicSyllabicCategory_VowelDependent = 34, 56 IndicSyllabicCategory_VowelIndependent = 35, 57 IndicSyllabicCategory_ReorderingKiller = 36, 58 }; 59 60 typedef struct IndicSyllabicCategory_option {union { IndicSyllabicCategory ok; }; bool is_ok; } IndicSyllabicCategory_option; 61 } // namespace capi 62 } // namespace 63 64 namespace icu4x { 65 class IndicSyllabicCategory { 66 public: 67 enum Value { 68 Other = 0, 69 Avagraha = 1, 70 Bindu = 2, 71 BrahmiJoiningNumber = 3, 72 CantillationMark = 4, 73 Consonant = 5, 74 ConsonantDead = 6, 75 ConsonantFinal = 7, 76 ConsonantHeadLetter = 8, 77 ConsonantInitialPostfixed = 9, 78 ConsonantKiller = 10, 79 ConsonantMedial = 11, 80 ConsonantPlaceholder = 12, 81 ConsonantPrecedingRepha = 13, 82 ConsonantPrefixed = 14, 83 ConsonantSucceedingRepha = 15, 84 ConsonantSubjoined = 16, 85 ConsonantWithStacker = 17, 86 GeminationMark = 18, 87 InvisibleStacker = 19, 88 Joiner = 20, 89 ModifyingLetter = 21, 90 NonJoiner = 22, 91 Nukta = 23, 92 Number = 24, 93 NumberJoiner = 25, 94 PureKiller = 26, 95 RegisterShifter = 27, 96 SyllableModifier = 28, 97 ToneLetter = 29, 98 ToneMark = 30, 99 Virama = 31, 100 Visarga = 32, 101 Vowel = 33, 102 VowelDependent = 34, 103 VowelIndependent = 35, 104 ReorderingKiller = 36, 105 }; 106 107 IndicSyllabicCategory() = default; 108 // Implicit conversions between enum and ::Value IndicSyllabicCategory(Value v)109 constexpr IndicSyllabicCategory(Value v) : value(v) {} operator Value() const110 constexpr operator Value() const { return value; } 111 // Prevent usage as boolean value 112 explicit operator bool() const = delete; 113 114 inline static icu4x::IndicSyllabicCategory for_char(char32_t ch); 115 116 inline uint8_t to_integer_value(); 117 118 inline static std::optional<icu4x::IndicSyllabicCategory> from_integer_value(uint8_t other); 119 120 inline icu4x::capi::IndicSyllabicCategory AsFFI() const; 121 inline static icu4x::IndicSyllabicCategory FromFFI(icu4x::capi::IndicSyllabicCategory c_enum); 122 private: 123 Value value; 124 }; 125 126 } // namespace 127 #endif // icu4x_IndicSyllabicCategory_D_HPP 128